Skip to content
Snippets Groups Projects
Commit 654d0a66 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix GCC v10.2 warnings about ignored return values of 'write'

The return value of x11_event() isn't actually checked anywhere currently, but
still Deuce might want to adjust the new return value here (__LINE__ or -1?).

Some indicental trailing whitespace was auto-cleaned up part of this commit.
Unexpected as I thought this code had been uncrustified already.
parent 2f21b92c
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* This file contains ONLY the functions that are called from the * This file contains ONLY the functions that are called from the
* event thread. * event thread.
*/ */
#include <math.h> #include <math.h>
#include <unistd.h> #include <unistd.h>
#include <stdbool.h> #include <stdbool.h>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
static void resize_window(); static void resize_window();
/* /*
* Exported variables * Exported variables
*/ */
int local_pipe[2]; /* Used for passing local events */ int local_pipe[2]; /* Used for passing local events */
...@@ -1425,7 +1425,7 @@ local_draw_rect(struct rectlist *rect) ...@@ -1425,7 +1425,7 @@ local_draw_rect(struct rectlist *rect)
} }
#ifdef WITH_XRENDER #ifdef WITH_XRENDER
x11.XPutImage(dpy, xrender_pm, gc, xim, 0, 0, 0, 0, dw, dh); x11.XPutImage(dpy, xrender_pm, gc, xim, 0, 0, 0, 0, dw, dh);
x11.XRenderComposite(dpy, PictOpSrc, xrender_src_pict, 0, xrender_dst_pict, x11.XRenderComposite(dpy, PictOpSrc, xrender_src_pict, 0, xrender_dst_pict,
0, 0, 0, 0, xoff, yoff, 0, 0, 0, 0, xoff, yoff,
cleft, ctop); cleft, ctop);
#else #else
...@@ -1604,7 +1604,8 @@ static int x11_event(XEvent *ev) ...@@ -1604,7 +1604,8 @@ static int x11_event(XEvent *ev)
case ClientMessage: case ClientMessage:
if (ev->xclient.format == 32 && ev->xclient.data.l[0] == A(WM_DELETE_WINDOW) && A(WM_DELETE_WINDOW) != None) { 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; uint16_t key=CIO_KEY_QUIT;
write(key_pipe[1], &key, 2); if(write(key_pipe[1], &key, 2) != 2)
return errno;
} }
else if(ev->xclient.format == 32 && ev->xclient.data.l[0] == A(_NET_WM_PING) && A(_NET_WM_PING) != None) { else if(ev->xclient.format == 32 && ev->xclient.data.l[0] == A(_NET_WM_PING) && A(_NET_WM_PING) != None) {
ev->xclient.window = root; ev->xclient.window = root;
...@@ -1896,7 +1897,8 @@ static int x11_event(XEvent *ev) ...@@ -1896,7 +1897,8 @@ static int x11_event(XEvent *ev)
else else
ch = cpchar_from_unicode_cpoint(getcodepage(), wbuf[i], 0); ch = cpchar_from_unicode_cpoint(getcodepage(), wbuf[i], 0);
if (ch) { if (ch) {
write(key_pipe[1], &ch, 1); if(write(key_pipe[1], &ch, 1) != 1)
return errno;
} }
} }
break; break;
...@@ -1912,7 +1914,7 @@ static int x11_event(XEvent *ev) ...@@ -1912,7 +1914,7 @@ static int x11_event(XEvent *ev)
case XK_ISO_Left_Tab: case XK_ISO_Left_Tab:
scan = 15; scan = 15;
goto docode; goto docode;
case XK_Return: case XK_Return:
case XK_KP_Enter: case XK_KP_Enter:
if (ev->xkey.state & Mod1Mask) { if (ev->xkey.state & Mod1Mask) {
...@@ -2081,7 +2083,7 @@ static int x11_event(XEvent *ev) ...@@ -2081,7 +2083,7 @@ static int x11_event(XEvent *ev)
default: default:
if (ks < ' ' || ks > '~') if (ks < ' ' || ks > '~')
break; break;
scan = Ascii2Scan[ks]; scan = Ascii2Scan[ks];
docode: docode:
if (nlock) if (nlock)
scan |= 0x100; scan |= 0x100;
...@@ -2106,7 +2108,8 @@ static int x11_event(XEvent *ev) ...@@ -2106,7 +2108,8 @@ static int x11_event(XEvent *ev)
uint16_t key=scan; uint16_t key=scan;
if (key < 128) if (key < 128)
key = cpchar_from_unicode_cpoint(getcodepage(), key, key); key = cpchar_from_unicode_cpoint(getcodepage(), key, key);
write(key_pipe[1], &key, (scan&0xff)?1:2); if(write(key_pipe[1], &key, (scan&0xff)?1:2) < 1)
return errno;
} }
break; break;
} }
...@@ -2173,7 +2176,7 @@ void x11_event_thread(void *args) ...@@ -2173,7 +2176,7 @@ void x11_event_thread(void *args)
check_scaling(); check_scaling();
tv.tv_sec=0; tv.tv_sec=0;
tv.tv_usec=54925; /* was 54925 (was also 10) */ tv.tv_usec=54925; /* was 54925 (was also 10) */
/* /*
* Handle any events just sitting around... * Handle any events just sitting around...
...@@ -2234,7 +2237,7 @@ void x11_event_thread(void *args) ...@@ -2234,7 +2237,7 @@ void x11_event_thread(void *args)
case X11_LOCAL_COPY: case X11_LOCAL_COPY:
x11.XSetSelectionOwner(dpy, copy_paste_selection, win, CurrentTime); x11.XSetSelectionOwner(dpy, copy_paste_selection, win, CurrentTime);
break; break;
case X11_LOCAL_PASTE: case X11_LOCAL_PASTE:
{ {
Window sowner=None; Window sowner=None;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment