Skip to content

Commit

Permalink
tools: fix a bunch of format conversion complaints
Browse files Browse the repository at this point in the history
Fixes #137

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
  • Loading branch information
whot committed Sep 12, 2018
1 parent 14e47ed commit d616218
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
64 changes: 32 additions & 32 deletions tools/libinput-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand All @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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",
Expand Down Expand 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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion tools/shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d616218

Please sign in to comment.