Fix ctype invocations with wrong domain.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-08-11 15:37:31 +02:00
parent ec38222f9b
commit 158716f96a
5 changed files with 20 additions and 18 deletions

View File

@ -111,9 +111,9 @@ void editor_modal_save(struct editor* editor, const char* path)
void editor_modal_ask_quit(struct editor* editor, const char* answer)
{
if ( tolower(answer[0]) == 'y' )
if ( tolower((unsigned char) answer[0]) == 'y' )
editor->mode = MODE_QUIT;
else if ( tolower(answer[0]) == 'n' || !answer[0] )
else if ( tolower((unsigned char) answer[0]) == 'n' || !answer[0] )
editor_type_edit(editor);
else
editor->modal_error = true;
@ -235,10 +235,10 @@ bool is_modal_command(const char* cmd, const char* candidate, const char** rest)
{
size_t candidate_len = strlen(candidate);
if ( strncmp(cmd, candidate, candidate_len) == 0 &&
(!cmd[candidate_len] || isspace(cmd[candidate_len])) )
(!cmd[candidate_len] || isspace((unsigned char) cmd[candidate_len])) )
{
*rest = cmd + candidate_len;
while ( **rest && isspace(**rest) )
while ( **rest && isspace((unsigned char) **rest) )
(*rest)++;
return true;
}
@ -247,7 +247,7 @@ bool is_modal_command(const char* cmd, const char* candidate, const char** rest)
void editor_modal_command(struct editor* editor, const char* cmd)
{
while ( *cmd && isspace(*cmd) )
while ( *cmd && isspace((unsigned char) *cmd) )
cmd++;
if ( cmd[0] == ':' )
cmd++;

View File

@ -1065,7 +1065,7 @@ static char* shebang_tokenize(char** saved)
char* data = *saved;
if ( !data )
return *saved = NULL;
while ( data[0] && isspace(data[0]) )
while ( data[0] && isspace((unsigned char) data[0]) )
data++;
if ( !data[0] )
return *saved = NULL;
@ -1077,7 +1077,7 @@ static char* shebang_tokenize(char** saved)
for ( ; data[input]; input++ )
{
char c = data[input];
if ( !escaped && !singly && !doubly && isspace(c) )
if ( !escaped && !singly && !doubly && isspace((unsigned char) c) )
break;
if ( !escaped && !doubly && c == '\'' )
{

View File

@ -167,7 +167,8 @@ bool InclusionRules::AddRule(InclusionRule* rule)
static const char* SkipWhitespace(const char* line)
{
while ( *line && isspace(*line) ) line++;
while ( *line && isspace((unsigned char) *line) )
line++;
return line;
}
@ -183,13 +184,14 @@ static bool IsLineComment(const char* line)
static const char* IsLineCommand(const char* line, const char* command)
{
while ( *line && isspace(*line) ) line++;
while ( *line && isspace((unsigned char) *line) )
line++;
size_t cmdlen = strlen(command);
if ( strncmp(line, command, cmdlen) != 0 )
return NULL;
if ( line[cmdlen] && !isspace(line[cmdlen]) )
if ( line[cmdlen] && !isspace((unsigned char) line[cmdlen]) )
return NULL;
while ( line[cmdlen] && isspace(line[cmdlen]) )
while ( line[cmdlen] && isspace((unsigned char) line[cmdlen]) )
cmdlen++;
return line + cmdlen;
}

View File

@ -1718,7 +1718,7 @@ void on_trap_eof(void* edit_state_ptr)
bool is_usual_char_for_completion(char c)
{
return !isspace(c) &&
return !isspace((unsigned char) c) &&
c != ';' && c != '&' && c != '|' &&
c != '<' && c != '>' && c != '#' && c != '$';
}
@ -1762,7 +1762,7 @@ size_t do_complete(char*** completions_ptr,
else
{
size_t type_offset = complete_at - used_before;
while ( type_offset && isspace(partial[type_offset-1]) )
while ( type_offset && isspace((unsigned char) partial[type_offset-1]) )
type_offset--;
if ( 2 <= type_offset &&

View File

@ -136,7 +136,7 @@ bool string_array_append_token_string(string_array_t* sa, const char* str)
{
while ( *str )
{
if ( isspace(*str) )
if ( isspace((unsigned char) *str) )
{
str++;
continue;
@ -147,7 +147,7 @@ bool string_array_append_token_string(string_array_t* sa, const char* str)
bool quoted = false;
bool escaped = false;
while ( str[input_length] &&
(escaped || quoted || !isspace(str[input_length])) )
(escaped || quoted || !isspace((unsigned char) str[input_length])) )
{
if ( !escaped && str[input_length] == '\\' )
escaped = true;
@ -170,7 +170,7 @@ bool string_array_append_token_string(string_array_t* sa, const char* str)
quoted = false;
escaped = false;
while ( str[input_length] &&
(escaped || quoted || !isspace(str[input_length])) )
(escaped || quoted || !isspace((unsigned char) str[input_length])) )
{
if ( !escaped && str[input_length] == '\\' )
escaped = true;
@ -215,7 +215,7 @@ bool string_array_append_token_string(string_array_t* sa, const char* str)
bool is_token_string_special_character(char c)
{
return isspace(c) || c == '"' || c == '\\';
return isspace((unsigned char) c) || c == '"' || c == '\\';
}
char* token_string_of_string_array(const string_array_t* sa)
@ -333,7 +333,7 @@ void dictionary_normalize_entry(char* entry)
size_t input_off, output_off;
for ( input_off = output_off = 0; entry[input_off]; input_off++ )
{
if ( key && isspace(entry[input_off]) )
if ( key && isspace((unsigned char) entry[input_off]) )
continue;
if ( key && (entry[input_off] == '=' || entry[input_off] == '#') )
key = false;