Get rid of some warnings with GCC 10, from Thomas Klausner.

This commit is contained in:
nicm 2023-06-30 13:19:32 +00:00
parent 2546216019
commit 4e57894e85
7 changed files with 12 additions and 9 deletions

View File

@ -53,8 +53,7 @@ cmd_resize_window_exec(struct cmd *self, struct cmdq_item *item)
struct session *s = target->s; struct session *s = target->s;
const char *errstr; const char *errstr;
char *cause; char *cause;
u_int adjust, sx, sy; u_int adjust, sx, sy, xpixel = 0, ypixel = 0;
int xpixel = -1, ypixel = -1;
if (args_count(args) == 0) if (args_count(args) == 0)
adjust = 1; adjust = 1;

View File

@ -3813,7 +3813,7 @@ format_build_modifiers(struct format_expand_state *es, const char **s,
argc = 0; argc = 0;
/* Single argument with no wrapper character. */ /* 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, ":;"); end = format_skip(cp + 1, ":;");
if (end == NULL) if (end == NULL)
break; break;

View File

@ -43,7 +43,7 @@
#define MAX_HYPERLINKS 5000 #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; static u_int global_hyperlinks_count;
struct hyperlinks_uri { struct hyperlinks_uri {

View File

@ -2842,9 +2842,11 @@ input_reply_clipboard(struct bufferevent *bev, const char *buf, size_t len,
const char *end) const char *end)
{ {
char *out = NULL; char *out = NULL;
size_t outlen = 0; int outlen = 0;
if (buf != NULL && len != 0) { if (buf != NULL && len != 0) {
if (len >= ((size_t)INT_MAX * 3 / 4) - 1)
return;
outlen = 4 * ((len + 2) / 3) + 1; outlen = 4 * ((len + 2) / 3) + 1;
out = xmalloc(outlen); out = xmalloc(outlen);
if ((outlen = b64_ntop(buf, len, out, outlen)) == -1) { if ((outlen = b64_ntop(buf, len, out, outlen)) == -1) {

View File

@ -194,7 +194,7 @@ notify_add(const char *name, struct cmd_find_state *fs, struct client *c,
ne->client = c; ne->client = c;
ne->session = s; ne->session = s;
ne->window = w; 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->pbname = (pbname != NULL ? xstrdup(pbname) : NULL);
ne->formats = format_create(NULL, NULL, 0, FORMAT_NOJOBS); 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.client = cmdq_get_client(item);
ne.session = target->s; ne.session = target->s;
ne.window = target->w; 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); ne.formats = format_create(NULL, NULL, 0, FORMAT_NOJOBS);
format_add(ne.formats, "hook", "%s", name); format_add(ne.formats, "hook", "%s", name);

View File

@ -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 client *c = tty->client;
struct window_pane *wp; struct window_pane *wp;
size_t end, terminator, needed; size_t end, terminator = 0, needed;
char *copy, *out; char *copy, *out;
int outlen; int outlen;
u_int i; u_int i;

View File

@ -717,6 +717,8 @@ tty_term_read_list(const char *name, int fd, char ***caps, u_int *ncaps,
else else
s = "0"; s = "0";
break; break;
default:
fatalx("unknown capability type");
} }
*caps = xreallocarray(*caps, (*ncaps) + 1, sizeof **caps); *caps = xreallocarray(*caps, (*ncaps) + 1, sizeof **caps);
xasprintf(&(*caps)[*ncaps], "%s=%s", ent->name, s); xasprintf(&(*caps)[*ncaps], "%s=%s", ent->name, s);