From 9baaa645fb848b2b0bc5a01f4db3c8ac37b2dd46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Mon, 12 Jun 2023 20:56:35 -0400 Subject: [PATCH] Actually, don't bother returning a value that's never used. Still be sure to check the return value of write() though. --- src/conio/x_events.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/conio/x_events.c b/src/conio/x_events.c index 2917161a5a..6c209ae076 100644 --- a/src/conio/x_events.c +++ b/src/conio/x_events.c @@ -1590,14 +1590,14 @@ handle_configuration(int w, int h, bool map) handle_resize_event(w, h, map); } -static bool +static void x11_event(XEvent *ev) { bool resize; int x, y, w, h; if (x11.XFilterEvent(ev, win)) - return false; + return; switch (ev->type) { case ReparentNotify: parent = ev->xreparent.parent; @@ -1605,8 +1605,11 @@ x11_event(XEvent *ev) case ClientMessage: if (ev->xclient.format == 32 && ev->xclient.data.l[0] == A(WM_DELETE_WINDOW) && A(WM_DELETE_WINDOW) != None) { uint16_t key=CIO_KEY_QUIT; - if (write(key_pipe[1], &key, 2) == -1) - return false; + // Bow to GCC + if (write(key_pipe[1], &key, 2) == EXIT_FAILURE) + return; + else + return; } else if(ev->xclient.format == 32 && ev->xclient.data.l[0] == A(_NET_WM_PING) && A(_NET_WM_PING) != None) { ev->xclient.window = root; @@ -1898,8 +1901,11 @@ x11_event(XEvent *ev) else ch = cpchar_from_unicode_cpoint(getcodepage(), wbuf[i], 0); if (ch) { - if (write(key_pipe[1], &ch, 1) == -1) - return false; + // Bow to GCC + if (write(key_pipe[1], &ch, 1) == EXIT_SUCCESS) + return; + else + return; } } break; @@ -2109,17 +2115,20 @@ x11_event(XEvent *ev) uint16_t key=scan; if (key < 128) key = cpchar_from_unicode_cpoint(getcodepage(), key, key); - if(write(key_pipe[1], &key, (scan&0xff)?1:2) == -1) - return false; + // Bow to GCC + if (write(key_pipe[1], &key, (scan & 0xff) ? 1 : 2) != EXIT_SUCCESS) + return; + else + return; } break; } - return true; + return; } default: break; } - return false; + return; } static void x11_terminate_event_thread(void) -- GitLab