From e3eeb0f87a2b34bb5841849db5538686897ffca4 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 30 Jun 2023 13:19:32 +0000 Subject: [PATCH] Get rid of some warnings with GCC 10, from Thomas Klausner. --- usr.bin/tmux/cmd-resize-window.c | 5 ++--- usr.bin/tmux/format.c | 4 ++-- usr.bin/tmux/hyperlinks.c | 4 ++-- usr.bin/tmux/input.c | 6 ++++-- usr.bin/tmux/notify.c | 6 +++--- usr.bin/tmux/tty-keys.c | 4 ++-- usr.bin/tmux/tty-term.c | 6 ++++-- 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/usr.bin/tmux/cmd-resize-window.c b/usr.bin/tmux/cmd-resize-window.c index 980bb35436c..a897506073f 100644 --- a/usr.bin/tmux/cmd-resize-window.c +++ b/usr.bin/tmux/cmd-resize-window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-resize-window.c,v 1.9 2021/08/27 17:15:57 nicm Exp $ */ +/* $OpenBSD: cmd-resize-window.c,v 1.10 2023/06/30 13:19:32 nicm Exp $ */ /* * Copyright (c) 2018 Nicholas Marriott @@ -53,8 +53,7 @@ cmd_resize_window_exec(struct cmd *self, struct cmdq_item *item) struct session *s = target->s; const char *errstr; char *cause; - u_int adjust, sx, sy; - int xpixel = -1, ypixel = -1; + u_int adjust, sx, sy, xpixel = 0, ypixel = 0; if (args_count(args) == 0) adjust = 1; diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index 7420ec114cf..404a6080aee 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.313 2023/05/19 07:46:34 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.314 2023/06/30 13:19:32 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -3813,7 +3813,7 @@ format_build_modifiers(struct format_expand_state *es, const char **s, argc = 0; /* Single argument with no wrapper character. */ - if (!ispunct(cp[1]) || cp[1] == '-') { + if (!ispunct((u_char)cp[1]) || cp[1] == '-') { end = format_skip(cp + 1, ":;"); if (end == NULL) break; diff --git a/usr.bin/tmux/hyperlinks.c b/usr.bin/tmux/hyperlinks.c index 4f2585e9ef5..ea0e7db735d 100644 --- a/usr.bin/tmux/hyperlinks.c +++ b/usr.bin/tmux/hyperlinks.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hyperlinks.c,v 1.2 2022/07/06 07:36:36 nicm Exp $ */ +/* $OpenBSD: hyperlinks.c,v 1.3 2023/06/30 13:19:32 nicm Exp $ */ /* * Copyright (c) 2021 Will @@ -43,7 +43,7 @@ #define MAX_HYPERLINKS 5000 -static uint64_t hyperlinks_next_external_id = 1; +static long long hyperlinks_next_external_id = 1; static u_int global_hyperlinks_count; struct hyperlinks_uri { diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c index 422e1ceb5e3..ebb3847dccf 100644 --- a/usr.bin/tmux/input.c +++ b/usr.bin/tmux/input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: input.c,v 1.215 2023/06/25 15:53:07 nicm Exp $ */ +/* $OpenBSD: input.c,v 1.216 2023/06/30 13:19:32 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -2842,9 +2842,11 @@ input_reply_clipboard(struct bufferevent *bev, const char *buf, size_t len, const char *end) { char *out = NULL; - size_t outlen = 0; + int outlen = 0; if (buf != NULL && len != 0) { + if (len >= ((size_t)INT_MAX * 3 / 4) - 1) + return; outlen = 4 * ((len + 2) / 3) + 1; out = xmalloc(outlen); if ((outlen = b64_ntop(buf, len, out, outlen)) == -1) { diff --git a/usr.bin/tmux/notify.c b/usr.bin/tmux/notify.c index 8fc3704428d..c019d7240aa 100644 --- a/usr.bin/tmux/notify.c +++ b/usr.bin/tmux/notify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: notify.c,v 1.43 2022/10/28 13:00:02 nicm Exp $ */ +/* $OpenBSD: notify.c,v 1.44 2023/06/30 13:19:32 nicm Exp $ */ /* * Copyright (c) 2012 George Nachman @@ -194,7 +194,7 @@ notify_add(const char *name, struct cmd_find_state *fs, struct client *c, ne->client = c; ne->session = s; ne->window = w; - ne->pane = (wp != NULL ? wp->id : -1); + ne->pane = (wp != NULL ? (int)wp->id : -1); ne->pbname = (pbname != NULL ? xstrdup(pbname) : NULL); ne->formats = format_create(NULL, NULL, 0, FORMAT_NOJOBS); @@ -241,7 +241,7 @@ notify_hook(struct cmdq_item *item, const char *name) ne.client = cmdq_get_client(item); ne.session = target->s; ne.window = target->w; - ne.pane = (target->wp != NULL ? target->wp->id : -1); + ne.pane = (target->wp != NULL ? (int)target->wp->id : -1); ne.formats = format_create(NULL, NULL, 0, FORMAT_NOJOBS); format_add(ne.formats, "hook", "%s", name); diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c index 6d86f14b8ab..f72c6b36f82 100644 --- a/usr.bin/tmux/tty-keys.c +++ b/usr.bin/tmux/tty-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-keys.c,v 1.166 2023/04/17 17:57:35 nicm Exp $ */ +/* $OpenBSD: tty-keys.c,v 1.167 2023/06/30 13:19:32 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1160,7 +1160,7 @@ tty_keys_clipboard(struct tty *tty, const char *buf, size_t len, size_t *size) { struct client *c = tty->client; struct window_pane *wp; - size_t end, terminator, needed; + size_t end, terminator = 0, needed; char *copy, *out; int outlen; u_int i; diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c index fc0f4762f2c..6ca24f4a286 100644 --- a/usr.bin/tmux/tty-term.c +++ b/usr.bin/tmux/tty-term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-term.c,v 1.98 2023/04/28 05:59:35 nicm Exp $ */ +/* $OpenBSD: tty-term.c,v 1.99 2023/06/30 13:19:32 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -709,7 +709,7 @@ tty_term_read_list(const char *name, int fd, char ***caps, u_int *ncaps, s = tmp; break; case TTYCODE_FLAG: - n = tigetflag((char *) ent->name); + n = tigetflag((char *)ent->name); if (n == -1) continue; if (n) @@ -717,6 +717,8 @@ tty_term_read_list(const char *name, int fd, char ***caps, u_int *ncaps, else s = "0"; break; + default: + fatalx("unknown capability type"); } *caps = xreallocarray(*caps, (*ncaps) + 1, sizeof **caps); xasprintf(&(*caps)[*ncaps], "%s=%s", ent->name, s); -- 2.20.1