fix "warning array subscript has type 'char'"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2021-04-14 19:12:43 +02:00
parent eb1b2902b8
commit 1a45b2ccea
7 changed files with 22 additions and 22 deletions

View File

@ -56,7 +56,7 @@ static int cmp_name(const void *a, const void *b)
static int str_isalnum_(const char *s) static int str_isalnum_(const char *s)
{ {
while (*s) { while (*s) {
if (!isalnum(*s) && *s != '_') if (!isalnum((unsigned char)*s) && *s != '_')
return 0; return 0;
s++; s++;
} }

View File

@ -182,10 +182,10 @@ void find_export_symbols(char * filename)
perror(real_filename); perror(real_filename);
} }
while (fgets(line, MAXLINESZ, fp)) { while (fgets(line, MAXLINESZ, fp)) {
char *p; unsigned char *p;
char *e; unsigned char *e;
if (((p = strstr(line, "EXPORT_SYMBOL_GPL")) != 0) || if (((p = (unsigned char *)strstr(line, "EXPORT_SYMBOL_GPL")) != 0) ||
((p = strstr(line, "EXPORT_SYMBOL")) != 0)) { ((p = (unsigned char *)strstr(line, "EXPORT_SYMBOL")) != 0)) {
/* Skip EXPORT_SYMBOL{_GPL} */ /* Skip EXPORT_SYMBOL{_GPL} */
while (isalnum(*p) || *p == '_') while (isalnum(*p) || *p == '_')
p++; p++;
@ -202,7 +202,7 @@ void find_export_symbols(char * filename)
while (isalnum(*e) || *e == '_') while (isalnum(*e) || *e == '_')
e++; e++;
*e = '\0'; *e = '\0';
add_new_symbol(sym, p); add_new_symbol(sym, (char*)p);
} }
} }
fclose(fp); fclose(fp);
@ -266,7 +266,7 @@ void singfunc(char * filename, char * line)
/* Split line up in individual parameters preceded by FUNCTION */ /* Split line up in individual parameters preceded by FUNCTION */
for (i=0; line[i]; i++) { for (i=0; line[i]; i++) {
if (isspace(line[i])) { if (isspace((unsigned char) line[i])) {
line[i] = '\0'; line[i] = '\0';
startofsym = 1; startofsym = 1;
continue; continue;
@ -293,10 +293,10 @@ void singfunc(char * filename, char * line)
void parse_file(FILE *infile) void parse_file(FILE *infile)
{ {
char line[MAXLINESZ]; char line[MAXLINESZ];
char * s; unsigned char * s;
while (fgets(line, MAXLINESZ, infile)) { while (fgets(line, MAXLINESZ, infile)) {
if (line[0] == '!') { if (line[0] == '!') {
s = line + 2; s = (unsigned char *)line + 2;
switch (line[1]) { switch (line[1]) {
case 'E': case 'E':
while (*s && !isspace(*s)) s++; while (*s && !isspace(*s)) s++;
@ -320,7 +320,7 @@ void parse_file(FILE *infile)
/* function names */ /* function names */
while (isspace(*s)) while (isspace(*s))
s++; s++;
singlefunctions(line +2, s); singlefunctions(line +2, (char*)s);
break; break;
default: default:
defaultline(line); defaultline(line);

View File

@ -226,10 +226,10 @@ void use_config(char *m, int slen)
void parse_config_file(char *map, size_t len) void parse_config_file(char *map, size_t len)
{ {
/* modified for bbox */ /* modified for bbox */
char *end_3 = map + len - 3; /* 3 == length of "IF_" */ unsigned char *end_3 = (unsigned char *)map + len - 3; /* 3 == length of "IF_" */
char *end_7 = map + len - 7; unsigned char *end_7 = (unsigned char *)map + len - 7;
char *p = map; unsigned char *p = (unsigned char *)map;
char *q; unsigned char *q;
int off; int off;
for (; p <= end_3; p++) { for (; p <= end_3; p++) {
@ -263,7 +263,7 @@ void parse_config_file(char *map, size_t len)
break; break;
} }
if (q != p) { if (q != p) {
use_config(p, q-p); use_config((char*)p, q - p);
} }
} }
} }
@ -335,7 +335,7 @@ void parse_dep_file(void *map, size_t len)
p = m; p = m;
while (p < end && *p != ' ') p++; while (p < end && *p != ' ') p++;
if (p == end) { if (p == end) {
do p--; while (!isalnum(*p)); do p--; while (!isalnum((unsigned char)*p));
p++; p++;
} }
memcpy(s, m, p-m); s[p-m] = 0; memcpy(s, m, p-m); s[p-m] = 0;

View File

@ -116,7 +116,7 @@ int main(int argc, const char * argv [])
/* We found #define CONFIG_foo or #undef CONFIG_foo. /* We found #define CONFIG_foo or #undef CONFIG_foo.
* Make the output file name. */ * Make the output file name. */
str_config += sizeof(" CONFIG_") - 1; str_config += sizeof(" CONFIG_") - 1;
for (itarget = 0; !isspace(str_config[itarget]); itarget++) for (itarget = 0; !isspace((unsigned char)str_config[itarget]); itarget++)
{ {
int c = (unsigned char) str_config[itarget]; int c = (unsigned char) str_config[itarget];
if (isupper(c)) c = tolower(c); if (isupper(c)) c = tolower(c);

View File

@ -44,7 +44,7 @@ static void strip(char *str)
char *p = str; char *p = str;
int l; int l;
while ((isspace(*p))) while ((isspace((unsigned char)*p)))
p++; p++;
l = strlen(p); l = strlen(p);
if (p != str) if (p != str)
@ -52,7 +52,7 @@ static void strip(char *str)
if (!l) if (!l)
return; return;
p = str + l - 1; p = str + l - 1;
while ((isspace(*p))) while ((isspace((unsigned char)*p)))
*p-- = 0; *p-- = 0;
} }
@ -401,7 +401,7 @@ static int conf_choice(struct menu *menu)
} }
if (!line[0]) if (!line[0])
cnt = def; cnt = def;
else if (isdigit(line[0])) else if (isdigit((unsigned char)line[0]))
cnt = atoi(line); cnt = atoi(line);
else else
continue; continue;

View File

@ -54,7 +54,7 @@ static char *conf_expand_value(const char *in)
strncat(res_value, in, src - in); strncat(res_value, in, src - in);
src++; src++;
dst = name; dst = name;
while (isalnum(*src) || *src == '_') while (isalnum((unsigned char)*src) || *src == '_')
*dst++ = *src++; *dst++ = *src++;
*dst = 0; *dst = 0;
sym = sym_lookup(name, 0); sym = sym_lookup(name, 0);

View File

@ -771,7 +771,7 @@ static void conf(struct menu *menu)
if (!type) if (!type)
continue; continue;
for (i = 0; input_buf[i] && !isspace(input_buf[i]); i++) for (i = 0; input_buf[i] && !isspace((unsigned char)input_buf[i]); i++)
; ;
if (i >= sizeof(active_entry)) if (i >= sizeof(active_entry))
i = sizeof(active_entry) - 1; i = sizeof(active_entry) - 1;