Group :: System/Libraries
RPM: libinput
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: libinput-1.12.0-up-format.patch
Download
Download
diff --git a/src/libinput-util.h b/src/libinput-util.h
index ff8d56fbeabad99e5872e49d1cec201b3985bf36..360e3906801b665728d367f15c6db6783145ce29 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;
diff --git a/test/test-misc.c b/test/test-misc.c
index a7f97acddc2d2298b963f6e10dd10f2cf5ede03f..9a22add130e42a14ab834d4ef74f3b1ace6b5b1d 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 },
diff --git a/tools/libinput-record.c b/tools/libinput-record.c
index 0f1cb174721e9ca91c09d4529227bf6d23e183dd..3f4bb7ffc9a65315a3f6b3b7bfa5ce5e86d340c3 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 b103470b1abe69977e06199875152b0b056e959d..41bed87931af5ab6d0e5300e1bd7d4f863adabe9 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: