Skip to content

Commit

Permalink
Get rid of some warnings with GCC 10, from Thomas Klausner.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicm committed Jun 30, 2023
1 parent 2546216 commit 4e57894
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
3 changes: 1 addition & 2 deletions cmd-resize-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion format.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion hyperlinks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tty-keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion tty-term.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,14 +709,16 @@ 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)
s = "1";
else
s = "0";
break;
default:
fatalx("unknown capability type");
}
*caps = xreallocarray(*caps, (*ncaps) + 1, sizeof **caps);
xasprintf(&(*caps)[*ncaps], "%s=%s", ent->name, s);
Expand Down

0 comments on commit 4e57894

Please sign in to comment.