Fix some format specifier nits, from Ben Boeckel.

This commit is contained in:
nicm 2015-03-31 17:45:10 +00:00
parent cd9ccbc1e9
commit 02df86079b
12 changed files with 31 additions and 31 deletions

View File

@ -557,7 +557,7 @@ client_dispatch_wait(void *data0)
data = imsg.data;
datalen = imsg.hdr.len - IMSG_HEADER_SIZE;
log_debug("got %d from server", imsg.hdr.type);
log_debug("got %u from server", imsg.hdr.type);
switch (imsg.hdr.type) {
case MSG_EXIT:
case MSG_SHUTDOWN:
@ -604,7 +604,7 @@ client_dispatch_wait(void *data0)
fatalx("bad MSG_VERSION size");
fprintf(stderr, "protocol version mismatch "
"(client %u, server %u)\n", PROTOCOL_VERSION,
"(client %d, server %u)\n", PROTOCOL_VERSION,
imsg.hdr.peerid);
client_exitval = 1;
@ -648,7 +648,7 @@ client_dispatch_attached(void)
data = imsg.data;
datalen = imsg.hdr.len - IMSG_HEADER_SIZE;
log_debug("got %d from server", imsg.hdr.type);
log_debug("got %u from server", imsg.hdr.type);
switch (imsg.hdr.type) {
case MSG_DETACH:
case MSG_DETACHKILL:

View File

@ -74,7 +74,7 @@ cmd_capture_pane_pending(struct args *args, struct window_pane *wp,
tmp[0] = line[i];
tmp[1] = '\0';
} else
xsnprintf(tmp, sizeof tmp, "\\%03o", line[i]);
xsnprintf(tmp, sizeof tmp, "\\%03hho", line[i]);
buf = cmd_capture_pane_append(buf, len, tmp,
strlen(tmp));
}

View File

@ -59,7 +59,7 @@ cmd_respawn_pane_exec(struct cmd *self, struct cmd_q *cmdq)
if (!args_has(self->args, 'k') && wp->fd != -1) {
if (window_pane_index(wp, &idx) != 0)
fatalx("index not found");
cmdq_error(cmdq, "pane still active: %s:%u.%u",
cmdq_error(cmdq, "pane still active: %s:%d.%u",
s->name, wl->idx, idx);
return (CMD_RETURN_ERROR);
}

View File

@ -147,7 +147,7 @@ colour_tostring(int c)
static char s[32];
if (c & 0x100) {
xsnprintf(s, sizeof s, "colour%u", c & ~0x100);
xsnprintf(s, sizeof s, "colour%d", c & ~0x100);
return (s);
}

View File

@ -503,7 +503,7 @@ format_defaults_session(struct format_tree *ft, struct session *s)
format_add(ft, "session_created_string", "%s", tim);
format_add(ft, "session_attached", "%u", s->attached);
format_add(ft, "session_many_attached", "%u", s->attached > 1);
format_add(ft, "session_many_attached", "%d", s->attached > 1);
}
/* Set default format keys for a client. */
@ -572,7 +572,7 @@ format_defaults_window(struct format_tree *ft, struct window *w)
format_add(ft, "window_height", "%u", w->sy);
format_add(ft, "window_layout", "%s", layout);
format_add(ft, "window_panes", "%u", window_count_panes(w));
format_add(ft, "window_zoomed_flag", "%u",
format_add(ft, "window_zoomed_flag", "%d",
!!(w->flags & WINDOW_ZOOMED));
free(layout);
@ -597,13 +597,13 @@ format_defaults_winlink(struct format_tree *ft, struct session *s,
format_add(ft, "window_flags", "%s", flags);
format_add(ft, "window_active", "%d", wl == s->curw);
format_add(ft, "window_bell_flag", "%u",
format_add(ft, "window_bell_flag", "%d",
!!(wl->flags & WINLINK_BELL));
format_add(ft, "window_activity_flag", "%u",
format_add(ft, "window_activity_flag", "%d",
!!(wl->flags & WINLINK_ACTIVITY));
format_add(ft, "window_silence_flag", "%u",
format_add(ft, "window_silence_flag", "%d",
!!(wl->flags & WINLINK_SILENCE));
format_add(ft, "window_last_flag", "%u",
format_add(ft, "window_last_flag", "%d",
!!(wl == TAILQ_FIRST(&s->lastw)));
free(flags);
@ -623,7 +623,7 @@ format_defaults_pane_tabs(struct format_tree *ft, struct window_pane *wp)
if (EVBUFFER_LENGTH(buffer) > 0)
evbuffer_add(buffer, ",", 1);
evbuffer_add_printf(buffer, "%d", i);
evbuffer_add_printf(buffer, "%u", i);
}
format_add(ft, "pane_tabs", "%.*s", (int) EVBUFFER_LENGTH(buffer),
@ -694,16 +694,16 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp)
free(cmd);
}
format_add(ft, "cursor_x", "%d", wp->base.cx);
format_add(ft, "cursor_y", "%d", wp->base.cy);
format_add(ft, "scroll_region_upper", "%d", wp->base.rupper);
format_add(ft, "scroll_region_lower", "%d", wp->base.rlower);
format_add(ft, "saved_cursor_x", "%d", wp->ictx.old_cx);
format_add(ft, "saved_cursor_y", "%d", wp->ictx.old_cy);
format_add(ft, "cursor_x", "%u", wp->base.cx);
format_add(ft, "cursor_y", "%u", wp->base.cy);
format_add(ft, "scroll_region_upper", "%u", wp->base.rupper);
format_add(ft, "scroll_region_lower", "%u", wp->base.rlower);
format_add(ft, "saved_cursor_x", "%u", wp->ictx.old_cx);
format_add(ft, "saved_cursor_y", "%u", wp->ictx.old_cy);
format_add(ft, "alternate_on", "%d", wp->saved_grid ? 1 : 0);
format_add(ft, "alternate_saved_x", "%d", wp->saved_cx);
format_add(ft, "alternate_saved_y", "%d", wp->saved_cy);
format_add(ft, "alternate_saved_x", "%u", wp->saved_cx);
format_add(ft, "alternate_saved_y", "%u", wp->saved_cy);
format_add(ft, "cursor_flag", "%d",
!!(wp->base.mode & MODE_CURSOR));

View File

@ -219,7 +219,7 @@ input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m)
* legacy format.
*/
if (m->sgr && (wp->screen->mode & MODE_MOUSE_SGR)) {
len = xsnprintf(buf, sizeof buf, "\033[<%d;%d;%d%c",
len = xsnprintf(buf, sizeof buf, "\033[<%u;%u;%u%c",
m->sgr_xb, m->x + 1, m->y + 1,
m->sgr_rel ? 'm' : 'M');
} else if (wp->screen->mode & MODE_MOUSE_UTF8) {

View File

@ -1717,7 +1717,7 @@ void
input_exit_osc(struct input_ctx *ictx)
{
u_char *p = ictx->input_buf;
int option;
u_int option;
if (ictx->flags & INPUT_DISCARD)
return;

View File

@ -824,7 +824,7 @@ server_client_msg_dispatch(struct client *c)
continue;
}
log_debug("got %d from client %d", imsg.hdr.type, c->ibuf.fd);
log_debug("got %u from client %d", imsg.hdr.type, c->ibuf.fd);
switch (imsg.hdr.type) {
case MSG_IDENTIFY_FLAGS:
case MSG_IDENTIFY_TERM:

View File

@ -41,9 +41,9 @@ server_fill_environ(struct session *s, struct environ *env)
idx = s->id;
} else
idx = -1;
idx = (u_int)-1;
pid = getpid();
xsnprintf(var, sizeof var, "%s,%ld,%d", socket_path, pid, idx);
xsnprintf(var, sizeof var, "%s,%ld,%u", socket_path, pid, idx);
environ_set(env, "TMUX", var);
}

View File

@ -90,7 +90,7 @@ server_window_check_bell(struct session *s, struct winlink *wl)
if (c->session->curw->window == w)
status_message_set(c, "Bell in current window");
else if (action == BELL_ANY)
status_message_set(c, "Bell in window %u", wl->idx);
status_message_set(c, "Bell in window %d", wl->idx);
}
return (1);
@ -124,7 +124,7 @@ server_window_check_activity(struct session *s, struct winlink *wl)
c = ARRAY_ITEM(&clients, i);
if (c == NULL || c->session != s)
continue;
status_message_set(c, "Activity in window %u", wl->idx);
status_message_set(c, "Activity in window %d", wl->idx);
}
}
@ -175,7 +175,7 @@ server_window_check_silence(struct session *s, struct winlink *wl)
c = ARRAY_ITEM(&clients, i);
if (c == NULL || c->session != s)
continue;
status_message_set(c, "Silence in window %u", wl->idx);
status_message_set(c, "Silence in window %d", wl->idx);
}
}

View File

@ -98,7 +98,7 @@ window_choose_add(struct window_pane *wp, struct window_choose_data *wcd)
item->pos = ARRAY_LENGTH(&data->list) - 1;
item->state = 0;
data->width = xsnprintf(tmp, sizeof tmp , "%u", item->pos);
data->width = xsnprintf(tmp, sizeof tmp , "%d", item->pos);
}
void

View File

@ -1216,7 +1216,7 @@ window_copy_write_line(struct window_pane *wp, struct screen_write_ctx *ctx,
limit = screen_size_x(s) + 1;
if (data->inputtype == WINDOW_COPY_NUMERICPREFIX) {
xoff = size = xsnprintf(hdr, limit,
"Repeat: %u", data->numprefix);
"Repeat: %d", data->numprefix);
} else {
xoff = size = xsnprintf(hdr, limit,
"%s: %s", data->inputprompt, data->inputstr);