Cast printf formatter %p arguments to void*

This commit is contained in:
Daniel Eklöf 2020-08-23 07:50:27 +02:00
parent c779a5ec7d
commit e32c0d9bf6
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 31 additions and 23 deletions

23
fdm.c
View file

@ -2,6 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <inttypes.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <assert.h> #include <assert.h>
@ -263,7 +264,7 @@ fdm_hook_add(struct fdm *fdm, fdm_hook_t hook, void *data,
#if defined(_DEBUG) #if defined(_DEBUG)
tll_foreach(*hooks, it) { tll_foreach(*hooks, it) {
if (it->item.callback == hook) { if (it->item.callback == hook) {
LOG_ERR("hook=%p already registered", hook); LOG_ERR("hook=0x%" PRIxPTR " already registered", (uintptr_t)hook);
return false; return false;
} }
} }
@ -286,7 +287,7 @@ fdm_hook_del(struct fdm *fdm, fdm_hook_t hook, enum fdm_hook_priority priority)
return true; return true;
} }
LOG_WARN("hook=%p not registered", hook); LOG_WARN("hook=0x%" PRIxPTR " not registered", (uintptr_t)hook);
return false; return false;
} }
@ -300,18 +301,24 @@ fdm_poll(struct fdm *fdm)
} }
tll_foreach(fdm->hooks_high, it) { tll_foreach(fdm->hooks_high, it) {
LOG_DBG("executing high priority hook %p(fdm=%p, data=%p)", LOG_DBG(
it->item.callback, fdm, it->item.callback_data); "executing high priority hook 0x%" PRIxPTR" (fdm=%p, data=%p)",
(uintptr_t)it->item.callback, (void *)fdm,
(void *)it->item.callback_data);
it->item.callback(fdm, it->item.callback_data); it->item.callback(fdm, it->item.callback_data);
} }
tll_foreach(fdm->hooks_normal, it) { tll_foreach(fdm->hooks_normal, it) {
LOG_DBG("executing normal priority hook %p(fdm=%p, data=%p)", LOG_DBG(
it->item.callback, fdm, it->item.callback_data); "executing normal priority hook 0x%" PRIxPTR " (fdm=%p, data=%p)",
(uintptr_t)it->item.callback, (void *)fdm,
(void *)it->item.callback_data);
it->item.callback(fdm, it->item.callback_data); it->item.callback(fdm, it->item.callback_data);
} }
tll_foreach(fdm->hooks_low, it) { tll_foreach(fdm->hooks_low, it) {
LOG_DBG("executing low priority hook %p(fdm=%p, data=%p)", LOG_DBG(
it->item.callback, fdm, it->item.callback_data); "executing low priority hook 0x%" PRIxPTR " (fdm=%p, data=%p)",
(uintptr_t)it->item.callback, (void *)fdm,
(void *)it->item.callback_data);
it->item.callback(fdm, it->item.callback_data); it->item.callback(fdm, it->item.callback_data);
} }

21
input.c
View file

@ -422,7 +422,7 @@ keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard,
uint32_t format, int32_t fd, uint32_t size) uint32_t format, int32_t fd, uint32_t size)
{ {
LOG_DBG("keyboard_keymap: keyboard=%p (format=%u, size=%u)", LOG_DBG("keyboard_keymap: keyboard=%p (format=%u, size=%u)",
wl_keyboard, format, size); (void *)wl_keyboard, format, size);
struct seat *seat = data; struct seat *seat = data;
struct wayland *wayl = seat->wayl; struct wayland *wayl = seat->wayl;
@ -505,7 +505,7 @@ keyboard_enter(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
struct terminal *term = win->term; struct terminal *term = win->term;
LOG_DBG("%s: keyboard_enter: keyboard=%p, serial=%u, surface=%p", LOG_DBG("%s: keyboard_enter: keyboard=%p, serial=%u, surface=%p",
seat->name, wl_keyboard, serial, surface); seat->name, (void *)wl_keyboard, serial, (void *)surface);
if (seat->kbd.xkb == NULL) if (seat->kbd.xkb == NULL)
return; return;
@ -564,7 +564,7 @@ keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
struct seat *seat = data; struct seat *seat = data;
LOG_DBG("keyboard_leave: keyboard=%p, serial=%u, surface=%p", LOG_DBG("keyboard_leave: keyboard=%p, serial=%u, surface=%p",
wl_keyboard, serial, surface); (void *)wl_keyboard, serial, (void *)surface);
if (seat->kbd.xkb == NULL) if (seat->kbd.xkb == NULL)
return; return;
@ -597,7 +597,7 @@ keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
*/ */
LOG_WARN( LOG_WARN(
"compositor sent keyboard_leave event without a keyboard_enter " "compositor sent keyboard_leave event without a keyboard_enter "
"event: surface=%p", surface); "event: surface=%p", (void *)surface);
} }
} }
@ -795,7 +795,7 @@ keyboard_key(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
LOG_DBG("keyboard_key: keyboard=%p, serial=%u, " LOG_DBG("keyboard_key: keyboard=%p, serial=%u, "
"sym=%u, mod=0x%08x, consumed=0x%08x, significant=0x%08x, " "sym=%u, mod=0x%08x, consumed=0x%08x, significant=0x%08x, "
"effective=0x%08x, repeats=%d", "effective=0x%08x, repeats=%d",
wl_keyboard, serial, (void *)wl_keyboard, serial,
sym, mods, consumed, significant, effective_mods, should_repeat); sym, mods, consumed, significant, effective_mods, should_repeat);
/* /*
@ -1077,7 +1077,7 @@ wl_pointer_enter(void *data, struct wl_pointer *wl_pointer,
seat->pointer.hidden = false; seat->pointer.hidden = false;
LOG_DBG("pointer-enter: pointer=%p, serial=%u, surface = %p, new-moused = %p", LOG_DBG("pointer-enter: pointer=%p, serial=%u, surface = %p, new-moused = %p",
wl_pointer, serial, surface, term); (void *)wl_pointer, serial, (void *)surface, (void *)term);
/* Scale may have changed */ /* Scale may have changed */
wayl_reload_xcursor_theme(seat, term->scale); wayl_reload_xcursor_theme(seat, term->scale);
@ -1145,7 +1145,8 @@ wl_pointer_leave(void *data, struct wl_pointer *wl_pointer,
LOG_DBG( LOG_DBG(
"%s: pointer-leave: pointer=%p, serial=%u, surface = %p, old-moused = %p", "%s: pointer-leave: pointer=%p, serial=%u, surface = %p, old-moused = %p",
seat->name, wl_pointer, serial, surface, old_moused); seat->name, (void *)wl_pointer, serial, (void *)surface,
(void *)old_moused);
seat->pointer.hidden = false; seat->pointer.hidden = false;
@ -1170,7 +1171,7 @@ wl_pointer_leave(void *data, struct wl_pointer *wl_pointer,
if (old_moused == NULL) { if (old_moused == NULL) {
LOG_WARN( LOG_WARN(
"compositor sent pointer_leave event without a pointer_enter " "compositor sent pointer_leave event without a pointer_enter "
"event: surface=%p", surface); "event: surface=%p", (void *)surface);
} else { } else {
if (surface != NULL) { if (surface != NULL) {
/* Sway 1.4 sends this event with a NULL surface when we destroy the window */ /* Sway 1.4 sends this event with a NULL surface when we destroy the window */
@ -1218,7 +1219,7 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
struct terminal *term = seat->mouse_focus; struct terminal *term = seat->mouse_focus;
struct wl_window *win = term->window; struct wl_window *win = term->window;
LOG_DBG("pointer_motion: pointer=%p, x=%d, y=%d", wl_pointer, LOG_DBG("pointer_motion: pointer=%p, x=%d, y=%d", (void *)wl_pointer,
wl_fixed_to_int(surface_x), wl_fixed_to_int(surface_y)); wl_fixed_to_int(surface_x), wl_fixed_to_int(surface_y));
assert(term != NULL); assert(term != NULL);
@ -1353,7 +1354,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
uint32_t serial, uint32_t time, uint32_t button, uint32_t state) uint32_t serial, uint32_t time, uint32_t button, uint32_t state)
{ {
LOG_DBG("BUTTON: pointer=%p, serial=%u, button=%x, state=%u", LOG_DBG("BUTTON: pointer=%p, serial=%u, button=%x, state=%u",
wl_pointer, serial, button, state); (void *)wl_pointer, serial, button, state);
struct seat *seat = data; struct seat *seat = data;
struct wayland *wayl = seat->wayl; struct wayland *wayl = seat->wayl;

8
shm.c
View file

@ -116,7 +116,7 @@ static void
buffer_release(void *data, struct wl_buffer *wl_buffer) buffer_release(void *data, struct wl_buffer *wl_buffer)
{ {
struct buffer *buffer = data; struct buffer *buffer = data;
LOG_DBG("release: cookie=%lx (buf=%p)", buffer->cookie, buffer); LOG_DBG("release: cookie=%lx (buf=%p)", buffer->cookie, (void *)buffer);
assert(buffer->wl_buf == wl_buffer); assert(buffer->wl_buf == wl_buffer);
assert(buffer->busy); assert(buffer->busy);
buffer->busy = false; buffer->busy = false;
@ -208,7 +208,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie,
assert(!it->item.busy); assert(!it->item.busy);
LOG_DBG("cookie=%lx: purging buffer %p (width=%d, height=%d): %zu KB", LOG_DBG("cookie=%lx: purging buffer %p (width=%d, height=%d): %zu KB",
cookie, &it->item, it->item.width, it->item.height, cookie, (void *)&it->item, it->item.width, it->item.height,
it->item.size / 1024); it->item.size / 1024);
buffer_destroy(&it->item); buffer_destroy(&it->item);
@ -225,7 +225,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie,
if (!it->item.busy) { if (!it->item.busy) {
LOG_DBG("cookie=%lx: re-using buffer from cache (buf=%p)", LOG_DBG("cookie=%lx: re-using buffer from cache (buf=%p)",
cookie, &it->item); cookie, (void *)&it->item);
it->item.busy = true; it->item.busy = true;
it->item.purge = false; it->item.purge = false;
assert(it->item.pix_instances == pix_instances); assert(it->item.pix_instances == pix_instances);
@ -244,7 +244,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie,
if (it->item.width == width && it->item.height == height) if (it->item.width == width && it->item.height == height)
continue; continue;
LOG_DBG("cookie=%lx: marking buffer %p for purging", cookie, &it->item); LOG_DBG("cookie=%lx: marking buffer %p for purging", cookie, (void *)&it->item);
it->item.purge = true; it->item.purge = true;
} }

View file

@ -227,7 +227,7 @@ sixel_overwrite(struct terminal *term, struct sixel *six,
assert(rel_right >= 0); assert(rel_right >= 0);
LOG_DBG("SPLIT: six (%p): %dx%d-%dx%d, %dx%d-%dx%d, rel: above=%d, below=%d, left=%d, right=%d", LOG_DBG("SPLIT: six (%p): %dx%d-%dx%d, %dx%d-%dx%d, rel: above=%d, below=%d, left=%d, right=%d",
six, six->pos.row, six->pos.col, six->rows, six->cols, (void *)six, six->pos.row, six->pos.col, six->rows, six->cols,
row, col, height, width, row, col, height, width,
rel_above, rel_below, rel_left, rel_right); rel_above, rel_below, rel_left, rel_right);