From 67b62c7294984eaa3b199765dd76b258dc979473 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 31 May 2021 13:25:11 -0700 Subject: Added lots of extra compiler checks and fixed a few minor issues. --- terminal.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index 09debb6..ae9fe66 100644 --- a/terminal.c +++ b/terminal.c @@ -58,13 +58,13 @@ static keyname_t key_names[] = { {':', "Colon"}, {',', "Comma"}, }; -static inline int nextchar(int fd) +static int nextchar(int fd) { char c; return read(fd, &c, 1) == 1 ? c : -1; } -static inline int nextnum(int fd, int c, int *n) +static int nextnum(int fd, int c, int *n) { for (*n = 0; '0' <= c && c <= '9'; c = nextchar(fd)) *n = 10*(*n) + (c - '0'); @@ -143,6 +143,7 @@ int bgetkey(FILE *in, int *mouse_x, int *mouse_y) case 21: return modifiers | KEY_F10; case 23: return modifiers | KEY_F11; case 24: return modifiers | KEY_F12; + default: break; } return -1; case '<': { // Mouse clicks @@ -185,6 +186,7 @@ int bgetkey(FILE *in, int *mouse_x, int *mouse_y) case MOUSE_LEFT_RELEASE: key = MOUSE_LEFT_DOUBLE; break; case MOUSE_RIGHT_RELEASE: key = MOUSE_RIGHT_DOUBLE; break; case MOUSE_MIDDLE_RELEASE: key = MOUSE_MIDDLE_DOUBLE; break; + default: break; } } } @@ -238,7 +240,7 @@ char *bkeyname(int key, char *buf) if (' ' < key && key <= '~') return buf + sprintf(buf, "%c", key); else - return buf + sprintf(buf, "\\x%02X", key); + return buf + sprintf(buf, "\\x%02X", (unsigned int)key); } // -- cgit v1.2.3