wlr_keyboard: use correct printf format string for keymap_size

keymap_size is a size_t. Otherwise the build fails on arm like

../types/wlr_keyboard.c: In function 'wlr_keyboard_set_keymap':
../include/wlr/util/log.h:34:17: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}' [-Werror=format=]
  _wlr_log(verb, "[%s:%d] " fmt, _strip_path(__FILE__), __LINE__, ##__VA_ARGS__)
                 ^
../types/wlr_keyboard.c:218:3: note: in expansion of macro 'wlr_log'
   wlr_log(L_ERROR, "creating a keymap file for %lu bytes failed", kb->keymap_size);
   ^~~~~~~
../types/wlr_keyboard.c:218:50: note: format string is defined here
   wlr_log(L_ERROR, "creating a keymap file for %lu bytes failed", kb->keymap_size);
                                                ~~^
                                                %u
master
Guido Günther 7 years ago
parent 174d1aa81b
commit 1633b8d793

@ -215,13 +215,13 @@ void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
} }
kb->keymap_fd = os_create_anonymous_file(kb->keymap_size); kb->keymap_fd = os_create_anonymous_file(kb->keymap_size);
if (kb->keymap_fd < 0) { if (kb->keymap_fd < 0) {
wlr_log(L_ERROR, "creating a keymap file for %lu bytes failed", kb->keymap_size); wlr_log(L_ERROR, "creating a keymap file for %zu bytes failed", kb->keymap_size);
goto err; goto err;
} }
void *ptr = mmap(NULL, kb->keymap_size, void *ptr = mmap(NULL, kb->keymap_size,
PROT_READ | PROT_WRITE, MAP_SHARED, kb->keymap_fd, 0); PROT_READ | PROT_WRITE, MAP_SHARED, kb->keymap_fd, 0);
if (ptr == (void*)-1) { if (ptr == (void*)-1) {
wlr_log(L_ERROR, "failed to mmap() %lu bytes", kb->keymap_size); wlr_log(L_ERROR, "failed to mmap() %zu bytes", kb->keymap_size);
goto err; goto err;
} }
strcpy(ptr, keymap_str); strcpy(ptr, keymap_str);

Loading…
Cancel
Save