From 8649c1791254050b983e9456239a77c93f713c32 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Sat, 20 Jun 2015 00:03:15 +1000 Subject: [PATCH] Change edit_char() from unsigned char to char This squashes a few more warnings. --- include/commands.h | 1 - include/input.h | 1 + source/input.c | 11 +++++------ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/commands.h b/include/commands.h index abc6372..d656774 100644 --- a/include/commands.h +++ b/include/commands.h @@ -15,7 +15,6 @@ extern char *recv_nick; void eval_inputlist (char *, char *); int BX_parse_command (char *, int, char *); void BX_parse_line (const char *, char *, const char *, int, int, int); - void edit_char (unsigned char); void execute_timer (void); void ison_now (char *, char *); void quote_char (char, char *); diff --git a/include/input.h b/include/input.h index 96f413e..4edd5c8 100644 --- a/include/input.h +++ b/include/input.h @@ -22,6 +22,7 @@ void input_move_cursor (int); void change_input_prompt (int); void BX_cursor_to_input (void); + void edit_char(char); /* keybinding functions */ void backward_character (char, char *); diff --git a/source/input.c b/source/input.c index 69742af..4cff741 100644 --- a/source/input.c +++ b/source/input.c @@ -1332,7 +1332,7 @@ BUILT_IN_KEYBINDING(parse_text) * edit_char: handles each character for an input stream. Not too difficult * to work out. */ -void edit_char (u_char key) +void edit_char(char key) { void (*func) (char, char *) = NULL; char *ptr = NULL; @@ -1353,8 +1353,7 @@ void edit_char (u_char key) /* were we waiting for a keypress? */ if (last_input_screen->promptlist && last_input_screen->promptlist->type == WAIT_PROMPT_KEY) { - unsigned char key_[2] = "\0"; - key_[0] = key; + char key_[2] = { key, 0 }; oldprompt = last_input_screen->promptlist; last_input_screen->promptlist = oldprompt->next; (*oldprompt->func)(oldprompt->data, key_); @@ -1394,7 +1393,7 @@ void edit_char (u_char key) #ifdef TRANSLATE if (translation) - extended_key = transFromClient[key]; + extended_key = transFromClient[(unsigned char)key]; else #endif extended_key = key; @@ -2862,10 +2861,10 @@ BUILT_IN_COMMAND(type) } default: { - c = *(args++); + c = (unsigned char)*(args++); if (islower(c)) c = toupper(c); - if (c < 64) + if (c < 64 || c > 95) { say("Invalid key sequence: ^%c", c); return;