summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2021-01-18 11:14:23 +0000
committernicm <nicm@openbsd.org>2021-01-18 11:14:23 +0000
commit8f1cd816be736c854135264b593aea6d686bc62e (patch)
tree3a07eb9ef24fba9422a33acbd445e55a13f5b52b
parentThere is no need to clear every line entirely before drawing to it, this (diff)
downloadwireguard-openbsd-8f1cd816be736c854135264b593aea6d686bc62e.tar.xz
wireguard-openbsd-8f1cd816be736c854135264b593aea6d686bc62e.zip
Hide some warnings on newer GCC versions, GitHUb issue 2525.
-rw-r--r--usr.bin/tmux/options.c9
-rw-r--r--usr.bin/tmux/server-client.c10
-rw-r--r--usr.bin/tmux/window-copy.c39
-rw-r--r--usr.bin/tmux/window-customize.c12
4 files changed, 32 insertions, 38 deletions
diff --git a/usr.bin/tmux/options.c b/usr.bin/tmux/options.c
index 4967915767f..7773ad55edf 100644
--- a/usr.bin/tmux/options.c
+++ b/usr.bin/tmux/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.60 2020/08/25 11:35:32 nicm Exp $ */
+/* $OpenBSD: options.c,v 1.61 2021/01/18 11:14:23 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -157,8 +157,7 @@ options_value_to_string(struct options_entry *o, union options_value *ov,
case OPTIONS_TABLE_CHOICE:
s = xstrdup(o->tableentry->choices[ov->number]);
break;
- case OPTIONS_TABLE_STRING:
- case OPTIONS_TABLE_COMMAND:
+ default:
fatalx("not a number option type");
}
return (s);
@@ -311,6 +310,8 @@ options_default_to_string(const struct options_table_entry *oe)
case OPTIONS_TABLE_CHOICE:
s = xstrdup(oe->choices[oe->default_num]);
break;
+ default:
+ fatalx("unknown option type");
}
return (s);
}
@@ -703,7 +704,7 @@ options_get_number(struct options *oo, const char *name)
if (o == NULL)
fatalx("missing option %s", name);
if (!OPTIONS_IS_NUMBER(o))
- fatalx("option %s is not a number", name);
+ fatalx("option %s is not a number", name);
return (o->value.number);
}
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index f31efe89ff8..7241f9d1a84 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.366 2020/12/03 07:12:11 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.367 2021/01/18 11:14:23 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1781,11 +1781,11 @@ server_client_check_exit(struct client *c)
switch (c->exit_type) {
case CLIENT_EXIT_RETURN:
- if (c->exit_message != NULL) {
+ if (c->exit_message != NULL)
msize = strlen(c->exit_message) + 1;
- size = (sizeof c->retval) + msize;
- } else
- size = (sizeof c->retval);
+ else
+ msize = 0;
+ size = (sizeof c->retval) + msize;
data = xmalloc(size);
memcpy(data, &c->retval, sizeof c->retval);
if (c->exit_message != NULL)
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index 3b10768f3f0..54cd1b0f377 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.310 2021/01/08 08:22:10 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.311 2021/01/18 11:14:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -3453,10 +3453,10 @@ window_copy_synchronize_cursor_end(struct window_mode_entry *wme, int begin,
struct window_copy_mode_data *data = wme->data;
u_int xx, yy;
+ xx = data->cx;
yy = screen_hsize(data->backing) + data->cy - data->oy;
switch (data->selflag) {
case SEL_WORD:
- xx = data->cx;
if (no_reset)
break;
begin = 0;
@@ -3482,10 +3482,8 @@ window_copy_synchronize_cursor_end(struct window_mode_entry *wme, int begin,
}
break;
case SEL_LINE:
- if (no_reset) {
- xx = data->cx;
+ if (no_reset)
break;
- }
begin = 0;
if (data->dy > yy) {
/* Right to left selection. */
@@ -3505,7 +3503,6 @@ window_copy_synchronize_cursor_end(struct window_mode_entry *wme, int begin,
}
break;
case SEL_CHAR:
- xx = data->cx;
break;
}
if (begin) {
@@ -4784,22 +4781,22 @@ window_copy_start_drag(struct client *c, struct mouse_event *m)
if (x < data->selrx || x > data->endselrx || yg != data->selry)
data->selflag = SEL_CHAR;
switch (data->selflag) {
- case SEL_WORD:
- if (data->ws != NULL) {
- window_copy_update_cursor(wme, x, y);
- window_copy_cursor_previous_word_pos(wme,
- data->ws, 0, &x, &y);
- y -= screen_hsize(data->backing) - data->oy;
- }
- window_copy_update_cursor(wme, x, y);
- break;
- case SEL_LINE:
- window_copy_update_cursor(wme, 0, y);
- break;
- case SEL_CHAR:
+ case SEL_WORD:
+ if (data->ws != NULL) {
window_copy_update_cursor(wme, x, y);
- window_copy_start_selection(wme);
- break;
+ window_copy_cursor_previous_word_pos(wme, data->ws, 0,
+ &x, &y);
+ y -= screen_hsize(data->backing) - data->oy;
+ }
+ window_copy_update_cursor(wme, x, y);
+ break;
+ case SEL_LINE:
+ window_copy_update_cursor(wme, 0, y);
+ break;
+ case SEL_CHAR:
+ window_copy_update_cursor(wme, x, y);
+ window_copy_start_selection(wme);
+ break;
}
window_copy_redraw_screen(wme);
diff --git a/usr.bin/tmux/window-customize.c b/usr.bin/tmux/window-customize.c
index b6d81cccd6d..f354013b3ed 100644
--- a/usr.bin/tmux/window-customize.c
+++ b/usr.bin/tmux/window-customize.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-customize.c,v 1.7 2020/09/18 11:20:59 nicm Exp $ */
+/* $OpenBSD: window-customize.c,v 1.8 2021/01/18 11:14:24 nicm Exp $ */
/*
* Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -190,13 +190,6 @@ window_customize_scope_text(enum window_customize_scope scope,
u_int idx;
switch (scope) {
- case WINDOW_CUSTOMIZE_NONE:
- case WINDOW_CUSTOMIZE_KEY:
- case WINDOW_CUSTOMIZE_SERVER:
- case WINDOW_CUSTOMIZE_GLOBAL_SESSION:
- case WINDOW_CUSTOMIZE_GLOBAL_WINDOW:
- s = xstrdup("");
- break;
case WINDOW_CUSTOMIZE_PANE:
window_pane_index(fs->wp, &idx);
xasprintf(&s, "pane %u", idx);
@@ -207,6 +200,9 @@ window_customize_scope_text(enum window_customize_scope scope,
case WINDOW_CUSTOMIZE_WINDOW:
xasprintf(&s, "window %u", fs->wl->idx);
break;
+ default:
+ s = xstrdup("");
+ break;
}
return (s);
}