Fix printf() specified bugs all over the code

When enabling the printf() logic for the logging subsystem, several
warnings were produced about missing or wrong specifiers. This fixes all
those occurrences.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-09-30 18:01:35 +02:00
parent 17a56a24f2
commit 32faedbfb4
9 changed files with 18 additions and 14 deletions

View File

@ -213,13 +213,13 @@ int conf_parse_argv(struct conf_option *opts, size_t len,
short_options = malloc(sizeof(char) * (len + 1) * 2);
if (!short_options) {
log_error("cannot allocate enough memory to parse command line arguments (%d): %m");
log_error("cannot allocate enough memory to parse command line arguments (%d): %m", errno);
return -ENOMEM;
}
long_options = malloc(sizeof(struct option) * len * 2);
if (!long_options) {
log_error("cannot allocate enough memory to parse command line arguments (%d): %m");
log_error("cannot allocate enough memory to parse command line arguments (%d): %m", errno);
free(short_options);
return -ENOMEM;
}

View File

@ -158,6 +158,7 @@
*/
#include <errno.h>
#include <inttypes.h>
#include <pthread.h>
#include <signal.h>
#include <stdbool.h>
@ -505,14 +506,14 @@ static int write_eventfd(llog_submit_t llog, int fd, uint64_t val)
return llog_dEINVAL(llog);
if (val == 0xffffffffffffffffULL) {
llog_dwarning(llog, "increasing counter with invalid value %llu", val);
llog_dwarning(llog, "increasing counter with invalid value %" PRIu64, val);
return -EINVAL;;
}
ret = write(fd, &val, sizeof(val));
if (ret < 0) {
if (errno == EAGAIN)
llog_dwarning(llog, "eventfd overflow while writing %llu", val);
llog_dwarning(llog, "eventfd overflow while writing %" PRIu64, val);
else
llog_dwarning(llog, "eventfd write error (%d): %m", errno);
return -EFAULT;
@ -846,7 +847,7 @@ int ev_eloop_dispatch(struct ev_eloop *loop, int timeout)
ep = realloc(loop->cur_fds, sizeof(struct epoll_event) *
loop->cur_fds_size * 2);
if (!ep) {
llog_warning(loop, "cannot reallocate dispatch cache to size %u",
llog_warning(loop, "cannot reallocate dispatch cache to size %zu",
loop->cur_fds_size * 2);
} else {
loop->cur_fds = ep;

View File

@ -512,6 +512,6 @@ void log_print_init(const char *appname)
if (!appname)
appname = "<unknown>";
log_format(LOG_DEFAULT_CONF, NULL, LOG_NOTICE,
"%s Build #%u %s %s", appname,
"%s Build #%lu %s %s", appname,
log_build, __DATE__, __TIME__);
}

View File

@ -25,6 +25,7 @@
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <pthread.h>
#include <pty.h>
#include <signal.h>
@ -438,7 +439,7 @@ static void sig_child(struct ev_eloop *eloop, struct signalfd_siginfo *info,
if (info->ssi_pid != pty->child)
return;
log_info("child exited: pid: %u status: %d utime: %llu stime: %llu",
log_info("child exited: pid: %u status: %d utime: %" PRIu64 " stime: %" PRIu64,
info->ssi_pid, info->ssi_status,
info->ssi_utime, info->ssi_stime);

View File

@ -31,6 +31,7 @@
*/
#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include "eloop.h"
@ -65,7 +66,7 @@ struct kmscon_terminal {
unsigned int min_cols;
unsigned int min_rows;
unsigned int fps;
unsigned long fps;
unsigned int redraw;
struct ev_timer *redraw_timer;
struct tsm_screen *console;
@ -119,7 +120,7 @@ static void redraw_timer_event(struct ev_timer *timer, uint64_t num, void *data)
* ev_timer_enable/disable() all the time. */
if (num > 1)
log_debug("CPU is too slow; skipping %llu frames", num - 1);
log_debug("CPU is too slow; skipping %" PRIu64 " frames", num - 1);
if (term->redraw-- != term->fps) {
if (!term->redraw) {
@ -203,7 +204,7 @@ static int add_display(struct kmscon_terminal *term, struct uterm_display *disp)
scr = malloc(sizeof(*scr));
if (!scr) {
log_error("cannot allocate memory for display %p");
log_error("cannot allocate memory for display %p", disp);
return -ENOMEM;
}
memset(scr, 0, sizeof(*scr));

View File

@ -323,7 +323,7 @@ try_next:
goto err_tex;
}
log_debug("new atlas of size %ux%u for %u", width, height, newsize);
log_debug("new atlas of size %ux%u for %zu", width, height, newsize);
nsize = txt->cols * txt->rows;

View File

@ -32,6 +32,7 @@
*/
#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
@ -1405,7 +1406,7 @@ void tsm_screen_draw(struct tsm_screen *con,
if (con->opts & TSM_SCREEN_OPT_RENDER_TIMING)
llog_debug(con,
"timing: sum: %llu prepare: %llu draw: %llu render: %llu",
"timing: sum: %" PRIu64 " prepare: %" PRIu64 " draw: %" PRIu64 " render: %" PRIu64,
time_prep + time_draw + time_rend,
time_prep, time_draw, time_rend);
}

View File

@ -151,7 +151,7 @@ static int input_wake_up_dev(struct uterm_input_dev *dev)
&ledbits);
if (ret == -1)
log_warn("cannot read LED state of %s (%d): %m",
errno, dev->node);
dev->node, errno);
}
/* rediscover the keyboard state if sth changed during sleep */

View File

@ -901,7 +901,7 @@ int wlt_display_new(struct wlt_display **out,
dp_global,
disp);
if (!disp->dp_listener) {
log_error("cannot add wayland global listener (%d)");
log_error("cannot add wayland global listener (%d)", errno);
goto err_timer;
}