[packages/libinput] upstream fixes for 32bit archs
atler
atler at pld-linux.org
Fri Sep 14 18:17:35 CEST 2018
commit 3028a89b1b2b02c9dee1c55e4fec6f5eea6b0acc
Author: Jan Palus <atler at pld-linux.org>
Date: Fri Sep 14 18:14:27 2018 +0200
upstream fixes for 32bit archs
see https://gitlab.freedesktop.org/libinput/libinput/issues/137
32bit.patch | 273 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
libinput.spec | 2 +
2 files changed, 275 insertions(+)
---
diff --git a/libinput.spec b/libinput.spec
index e4e1286..43f3805 100644
--- a/libinput.spec
+++ b/libinput.spec
@@ -19,6 +19,7 @@ License: MIT
Group: Libraries
Source0: https://www.freedesktop.org/software/libinput/%{name}-%{version}.tar.xz
# Source0-md5: efbea0deaa7126b6d1f8cbbe16c0470a
+Patch0: 32bit.patch
URL: https://www.freedesktop.org/wiki/Software/libinput/
BuildRequires: check-devel >= 0.9.10
%if %{with gui}
@@ -123,6 +124,7 @@ Dokumentacja API biblioteki libinput.
%prep
%setup -q
+%patch0 -p1
%{__sed} -i -e '1s,/usr/bin/env python3,%{__python3},' tools/libinput-measure-{touchpad-pressure,touch-size,touchpad-tap}.py
diff --git a/32bit.patch b/32bit.patch
new file mode 100644
index 0000000..9923024
--- /dev/null
+++ b/32bit.patch
@@ -0,0 +1,273 @@
+From d616218c9ab60adea3f7a99e2fceaf21cde3b188 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Wed, 12 Sep 2018 13:28:16 +1000
+Subject: [PATCH 1/3] tools: fix a bunch of format conversion complaints
+
+Fixes #137
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+ tools/libinput-record.c | 64 ++++++++++++++++++++---------------------
+ tools/shared.c | 2 +-
+ 2 files changed, 33 insertions(+), 33 deletions(-)
+
+diff --git a/tools/libinput-record.c b/tools/libinput-record.c
+index 0f1cb174..3f4bb7ff 100644
+--- a/tools/libinput-record.c
++++ b/tools/libinput-record.c
+@@ -379,8 +379,8 @@ buffer_key_event(struct record_context *ctx,
+ snprintf(event->u.libinput.msg,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s, key: %d, state: %s}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ key,
+ state == LIBINPUT_KEY_STATE_PRESSED ? "pressed" : "released");
+@@ -414,8 +414,8 @@ buffer_motion_event(struct record_context *ctx,
+ snprintf(event->u.libinput.msg,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s, delta: [%6.2f, %6.2f], unaccel: [%6.2f, %6.2f]}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ x, y,
+ uax, uay);
+@@ -449,8 +449,8 @@ buffer_absmotion_event(struct record_context *ctx,
+ snprintf(event->u.libinput.msg,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s, point: [%6.2f, %6.2f], transformed: [%6.2f, %6.2f]}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ x, y,
+ tx, ty);
+@@ -484,8 +484,8 @@ buffer_pointer_button_event(struct record_context *ctx,
+ snprintf(event->u.libinput.msg,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s, button: %d, state: %s, seat_count: %u}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ button,
+ state == LIBINPUT_BUTTON_STATE_PRESSED ? "pressed" : "released",
+@@ -541,8 +541,8 @@ buffer_pointer_axis_event(struct record_context *ctx,
+ snprintf(event->u.libinput.msg,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s, axes: [%2.2f, %2.2f], discrete: [%d, %d], source: %s}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ h, v,
+ hd, vd,
+@@ -596,8 +596,8 @@ buffer_touch_event(struct record_context *ctx,
+ snprintf(event->u.libinput.msg,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type);
+ break;
+ case LIBINPUT_EVENT_TOUCH_DOWN:
+@@ -609,8 +609,8 @@ buffer_touch_event(struct record_context *ctx,
+ snprintf(event->u.libinput.msg,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s, slot: %d, seat_slot: %d, point: [%6.2f, %6.2f], transformed: [%6.2f, %6.2f]}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ slot,
+ seat_slot,
+@@ -622,8 +622,8 @@ buffer_touch_event(struct record_context *ctx,
+ snprintf(event->u.libinput.msg,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s, slot: %d, seat_slot: %d}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ slot,
+ seat_slot);
+@@ -679,8 +679,8 @@ buffer_gesture_event(struct record_context *ctx,
+ "{time: %ld.%06ld, type: %s, nfingers: %d, "
+ "delta: [%6.2f, %6.2f], unaccel: [%6.2f, %6.2f], "
+ "angle_delta: %6.2f, scale: %6.2f}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ libinput_event_gesture_get_finger_count(g),
+ libinput_event_gesture_get_dx(g),
+@@ -698,8 +698,8 @@ buffer_gesture_event(struct record_context *ctx,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s, nfingers: %d, "
+ "delta: [%6.2f, %6.2f], unaccel: [%6.2f, %6.2f]}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ libinput_event_gesture_get_finger_count(g),
+ libinput_event_gesture_get_dx(g),
+@@ -875,8 +875,8 @@ buffer_tablet_tool_proximity_event(struct record_context *ctx,
+ snprintf(event->u.libinput.msg,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s, proximity: %s, tool-type: %s, serial: %" PRIu64 ", axes: %s, %s}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ prox ? "in" : "out",
+ tool_type,
+@@ -917,8 +917,8 @@ buffer_tablet_tool_button_event(struct record_context *ctx,
+ snprintf(event->u.libinput.msg,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s, button: %d, state: %s}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ button,
+ state ? "pressed" : "released");
+@@ -974,8 +974,8 @@ buffer_tablet_tool_event(struct record_context *ctx,
+ snprintf(event->u.libinput.msg,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s%s, tip: %s, %s}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ btn_buffer, /* may be empty string */
+ tip ? "down" : "up",
+@@ -1016,8 +1016,8 @@ buffer_tablet_pad_button_event(struct record_context *ctx,
+ snprintf(event->u.libinput.msg,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s, button: %d, state: %s, mode: %d, is-toggle: %s}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ button,
+ state == LIBINPUT_BUTTON_STATE_PRESSED ? "pressed" : "released",
+@@ -1083,8 +1083,8 @@ buffer_tablet_pad_ringstrip_event(struct record_context *ctx,
+ snprintf(event->u.libinput.msg,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s, number: %d, position: %.2f, source: %s, mode: %d}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ number,
+ pos,
+@@ -1121,8 +1121,8 @@ buffer_switch_event(struct record_context *ctx,
+ snprintf(event->u.libinput.msg,
+ sizeof(event->u.libinput.msg),
+ "{time: %ld.%06ld, type: %s, switch: %d, state: %s}",
+- time / (int)1e6,
+- time % (int)1e6,
++ (long)(time / (int)1e6),
++ (long)(time % (int)1e6),
+ type,
+ sw,
+ state == LIBINPUT_SWITCH_STATE_ON ? "on" : "off");
+diff --git a/tools/shared.c b/tools/shared.c
+index b103470b..41bed879 100644
+--- a/tools/shared.c
++++ b/tools/shared.c
+@@ -697,7 +697,7 @@ tools_list_device_quirks(struct quirks_context *ctx,
+ case QUIRK_ATTR_SIZE_HINT:
+ case QUIRK_ATTR_RESOLUTION_HINT:
+ quirks_get_dimensions(quirks, *q, &dim);
+- snprintf(buf, sizeof(buf), "%s=%ldx%ld", name, dim.x, dim.y);
++ snprintf(buf, sizeof(buf), "%s=%zdx%zd", name, dim.x, dim.y);
+ callback(userdata, buf);
+ break;
+ case QUIRK_ATTR_TOUCH_SIZE_RANGE:
+--
+2.18.0
+
+
+From c501dabf396e6aeae41869cd2b57809f6d565378 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Thu, 13 Sep 2018 08:18:16 +1000
+Subject: [PATCH 2/3] util: check for < 0 explicitly in safe_atou
+
+The previous check only worked if sizeof(long) > sizeof(int). Rather than be
+fancy about it, just cast to a signed long, check for negativity and continue
+based on that.
+
+Fixes #137
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+ src/libinput-util.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/libinput-util.h b/src/libinput-util.h
+index ff8d56fb..360e3906 100644
+--- a/src/libinput-util.h
++++ b/src/libinput-util.h
+@@ -538,7 +538,7 @@ safe_atou_base(const char *str, unsigned int *val, int base)
+ if (*str != '\0' && *endptr != '\0')
+ return false;
+
+- if (v > UINT_MAX)
++ if ((long)v < 0)
+ return false;
+
+ *val = v;
+--
+2.18.0
+
+
+From 037bd0cc9c2675f789f8fbca1a8572c0a2090e23 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Fri, 14 Sep 2018 10:19:55 +1000
+Subject: [PATCH 3/3] test: drop a condition from the safe_atou test
+
+If sizeof(long) == sizeof(int), this test won't pass so let's drop it
+altogether.
+
+Fixes #137
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+ test/test-misc.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/test/test-misc.c b/test/test-misc.c
+index a7f97acd..9a22add1 100644
+--- a/test/test-misc.c
++++ b/test/test-misc.c
+@@ -1157,7 +1157,6 @@ START_TEST(safe_atou_test)
+ { "-1", false, 0 },
+ { "2147483647", true, 2147483647 },
+ { "-2147483648", false, 0},
+- { "4294967295", true, 4294967295 },
+ { "0x0", false, 0 },
+ { "-10x10", false, 0 },
+ { "1x-99", false, 0 },
+--
+2.18.0
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/libinput.git/commitdiff/3028a89b1b2b02c9dee1c55e4fec6f5eea6b0acc
More information about the pld-cvs-commit
mailing list