diff options
author | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2013-11-22 00:10:46 +0100 |
---|---|---|
committer | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2013-11-22 00:10:46 +0100 |
commit | 5bc22db14b6ffd4cb39722a415d4cd176bb7fc0d (patch) | |
tree | ffe438dcf5f52c8e1148e1da3ca6b9fa64d9dc32 /src/editor.c | |
parent | 407dc8b5e6a4db430381000256c87ba313bbed5e (diff) | |
download | ratpoison-5bc22db14b6ffd4cb39722a415d4cd176bb7fc0d.zip |
Cast char arguments to to*/is* ctype calls to unsigned char
* those functions expect an int whose value is between -1 and 255.
Cast to unsigned char so that sign extension when promoting to int
doesn't bite us.
Diffstat (limited to 'src/editor.c')
-rw-r--r-- | src/editor.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/editor.c b/src/editor.c index 6c17754..3dabe89 100644 --- a/src/editor.c +++ b/src/editor.c @@ -192,11 +192,11 @@ editor_forward_word (rp_input_line *line) return EDIT_NO_OP; while (line->position < line->length - && !isalnum (line->buffer[line->position])) + && !isalnum ((unsigned char)line->buffer[line->position])) line->position++; while (line->position < line->length - && (isalnum (line->buffer[line->position]) + && (isalnum ((unsigned char)line->buffer[line->position]) || RP_IS_UTF8_CHAR (line->buffer[line->position]))) line->position++; @@ -209,11 +209,11 @@ editor_backward_word (rp_input_line *line) if (line->position == 0) return EDIT_NO_OP; - while (line->position > 0 && !isalnum (line->buffer[line->position])) + while (line->position > 0 && !isalnum ((unsigned char)line->buffer[line->position])) line->position--; while (line->position > 0 - && (isalnum (line->buffer[line->position]) + && (isalnum ((unsigned char)line->buffer[line->position]) || RP_IS_UTF8_CHAR (line->buffer[line->position]))) line->position--; @@ -301,11 +301,11 @@ editor_kill_word (rp_input_line *line) return EDIT_NO_OP; while (line->position + diff < line->length && - !isalnum (line->buffer[line->position + diff])) + !isalnum ((unsigned char)line->buffer[line->position + diff])) diff++; while (line->position + diff < line->length - && (isalnum (line->buffer[line->position + diff]) + && (isalnum ((unsigned char)line->buffer[line->position + diff]) || RP_IS_UTF8_CHAR (line->buffer[line->position + diff]))) diff++; @@ -330,11 +330,11 @@ editor_backward_kill_word (rp_input_line *line) return EDIT_NO_OP; while (line->position - diff > 0 && - !isalnum (line->buffer[line->position - diff])) + !isalnum ((unsigned char)line->buffer[line->position - diff])) diff++; while (line->position - diff > 0 - && (isalnum (line->buffer[line->position - diff]) + && (isalnum ((unsigned char)line->buffer[line->position - diff]) || RP_IS_UTF8_CHAR (line->buffer[line->position - diff]))) diff++; |