Commit cd390083ad1fea1ddb93df9c5560eba0a9f26a0d
1 parent
77b9435f
Attached patch fixes a series of this warning
when compiling on NetBSD: warning: array subscript has type 'char' Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5727 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
8 changed files
with
43 additions
and
27 deletions
audio/audio.c
| ... | ... | @@ -215,7 +215,7 @@ static char *audio_alloc_prefix (const char *s) |
| 215 | 215 | pstrcat (r, len + sizeof (qemu_prefix), s); |
| 216 | 216 | |
| 217 | 217 | for (i = 0; i < len; ++i) { |
| 218 | - u[i] = toupper (u[i]); | |
| 218 | + u[i] = qemu_toupper(u[i]); | |
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | return r; |
| ... | ... | @@ -470,7 +470,7 @@ static void audio_process_options (const char *prefix, |
| 470 | 470 | |
| 471 | 471 | /* copy while upper-casing, including trailing zero */ |
| 472 | 472 | for (i = 0; i <= preflen; ++i) { |
| 473 | - optname[i + sizeof (qemu_prefix) - 1] = toupper (prefix[i]); | |
| 473 | + optname[i + sizeof (qemu_prefix) - 1] = qemu_toupper(prefix[i]); | |
| 474 | 474 | } |
| 475 | 475 | pstrcat (optname, optlen, "_"); |
| 476 | 476 | pstrcat (optname, optlen, opt->name); | ... | ... |
block-vvfat.c
| ... | ... | @@ -1056,7 +1056,7 @@ DLOG(if (stderr == NULL) { |
| 1056 | 1056 | |
| 1057 | 1057 | i = strrchr(dirname, ':') - dirname; |
| 1058 | 1058 | assert(i >= 3); |
| 1059 | - if (dirname[i-2] == ':' && isalpha(dirname[i-1])) | |
| 1059 | + if (dirname[i-2] == ':' && qemu_isalpha(dirname[i-1])) | |
| 1060 | 1060 | /* workaround for DOS drive names */ |
| 1061 | 1061 | dirname += i-1; |
| 1062 | 1062 | else | ... | ... |
cutils.c
monitor.c
| ... | ... | @@ -1933,7 +1933,7 @@ static void next(void) |
| 1933 | 1933 | { |
| 1934 | 1934 | if (pch != '\0') { |
| 1935 | 1935 | pch++; |
| 1936 | - while (isspace(*pch)) | |
| 1936 | + while (qemu_isspace(*pch)) | |
| 1937 | 1937 | pch++; |
| 1938 | 1938 | } |
| 1939 | 1939 | } |
| ... | ... | @@ -1992,7 +1992,7 @@ static int64_t expr_unary(void) |
| 1992 | 1992 | *q++ = *pch; |
| 1993 | 1993 | pch++; |
| 1994 | 1994 | } |
| 1995 | - while (isspace(*pch)) | |
| 1995 | + while (qemu_isspace(*pch)) | |
| 1996 | 1996 | pch++; |
| 1997 | 1997 | *q = 0; |
| 1998 | 1998 | ret = get_monitor_def(®, buf); |
| ... | ... | @@ -2017,7 +2017,7 @@ static int64_t expr_unary(void) |
| 2017 | 2017 | expr_error("invalid char in expression"); |
| 2018 | 2018 | } |
| 2019 | 2019 | pch = p; |
| 2020 | - while (isspace(*pch)) | |
| 2020 | + while (qemu_isspace(*pch)) | |
| 2021 | 2021 | pch++; |
| 2022 | 2022 | break; |
| 2023 | 2023 | } |
| ... | ... | @@ -2111,7 +2111,7 @@ static int get_expr(int64_t *pval, const char **pp) |
| 2111 | 2111 | *pp = pch; |
| 2112 | 2112 | return -1; |
| 2113 | 2113 | } |
| 2114 | - while (isspace(*pch)) | |
| 2114 | + while (qemu_isspace(*pch)) | |
| 2115 | 2115 | pch++; |
| 2116 | 2116 | *pval = expr_sum(); |
| 2117 | 2117 | *pp = pch; |
| ... | ... | @@ -2126,7 +2126,7 @@ static int get_str(char *buf, int buf_size, const char **pp) |
| 2126 | 2126 | |
| 2127 | 2127 | q = buf; |
| 2128 | 2128 | p = *pp; |
| 2129 | - while (isspace(*p)) | |
| 2129 | + while (qemu_isspace(*p)) | |
| 2130 | 2130 | p++; |
| 2131 | 2131 | if (*p == '\0') { |
| 2132 | 2132 | fail: |
| ... | ... | @@ -2171,7 +2171,7 @@ static int get_str(char *buf, int buf_size, const char **pp) |
| 2171 | 2171 | } |
| 2172 | 2172 | p++; |
| 2173 | 2173 | } else { |
| 2174 | - while (*p != '\0' && !isspace(*p)) { | |
| 2174 | + while (*p != '\0' && !qemu_isspace(*p)) { | |
| 2175 | 2175 | if ((q - buf) < buf_size - 1) { |
| 2176 | 2176 | *q++ = *p; |
| 2177 | 2177 | } |
| ... | ... | @@ -2217,12 +2217,12 @@ static void monitor_handle_command(const char *cmdline) |
| 2217 | 2217 | /* extract the command name */ |
| 2218 | 2218 | p = cmdline; |
| 2219 | 2219 | q = cmdname; |
| 2220 | - while (isspace(*p)) | |
| 2220 | + while (qemu_isspace(*p)) | |
| 2221 | 2221 | p++; |
| 2222 | 2222 | if (*p == '\0') |
| 2223 | 2223 | return; |
| 2224 | 2224 | pstart = p; |
| 2225 | - while (*p != '\0' && *p != '/' && !isspace(*p)) | |
| 2225 | + while (*p != '\0' && *p != '/' && !qemu_isspace(*p)) | |
| 2226 | 2226 | p++; |
| 2227 | 2227 | len = p - pstart; |
| 2228 | 2228 | if (len > sizeof(cmdname) - 1) |
| ... | ... | @@ -2258,7 +2258,7 @@ static void monitor_handle_command(const char *cmdline) |
| 2258 | 2258 | int ret; |
| 2259 | 2259 | char *str; |
| 2260 | 2260 | |
| 2261 | - while (isspace(*p)) | |
| 2261 | + while (qemu_isspace(*p)) | |
| 2262 | 2262 | p++; |
| 2263 | 2263 | if (*typestr == '?') { |
| 2264 | 2264 | typestr++; |
| ... | ... | @@ -2299,15 +2299,15 @@ static void monitor_handle_command(const char *cmdline) |
| 2299 | 2299 | { |
| 2300 | 2300 | int count, format, size; |
| 2301 | 2301 | |
| 2302 | - while (isspace(*p)) | |
| 2302 | + while (qemu_isspace(*p)) | |
| 2303 | 2303 | p++; |
| 2304 | 2304 | if (*p == '/') { |
| 2305 | 2305 | /* format found */ |
| 2306 | 2306 | p++; |
| 2307 | 2307 | count = 1; |
| 2308 | - if (isdigit(*p)) { | |
| 2308 | + if (qemu_isdigit(*p)) { | |
| 2309 | 2309 | count = 0; |
| 2310 | - while (isdigit(*p)) { | |
| 2310 | + while (qemu_isdigit(*p)) { | |
| 2311 | 2311 | count = count * 10 + (*p - '0'); |
| 2312 | 2312 | p++; |
| 2313 | 2313 | } |
| ... | ... | @@ -2346,7 +2346,7 @@ static void monitor_handle_command(const char *cmdline) |
| 2346 | 2346 | } |
| 2347 | 2347 | } |
| 2348 | 2348 | next: |
| 2349 | - if (*p != '\0' && !isspace(*p)) { | |
| 2349 | + if (*p != '\0' && !qemu_isspace(*p)) { | |
| 2350 | 2350 | term_printf("invalid char in format: '%c'\n", *p); |
| 2351 | 2351 | goto fail; |
| 2352 | 2352 | } |
| ... | ... | @@ -2380,7 +2380,7 @@ static void monitor_handle_command(const char *cmdline) |
| 2380 | 2380 | { |
| 2381 | 2381 | int64_t val; |
| 2382 | 2382 | |
| 2383 | - while (isspace(*p)) | |
| 2383 | + while (qemu_isspace(*p)) | |
| 2384 | 2384 | p++; |
| 2385 | 2385 | if (*typestr == '?' || *typestr == '.') { |
| 2386 | 2386 | if (*typestr == '?') { |
| ... | ... | @@ -2391,7 +2391,7 @@ static void monitor_handle_command(const char *cmdline) |
| 2391 | 2391 | } else { |
| 2392 | 2392 | if (*p == '.') { |
| 2393 | 2393 | p++; |
| 2394 | - while (isspace(*p)) | |
| 2394 | + while (qemu_isspace(*p)) | |
| 2395 | 2395 | p++; |
| 2396 | 2396 | has_arg = 1; |
| 2397 | 2397 | } else { |
| ... | ... | @@ -2436,7 +2436,7 @@ static void monitor_handle_command(const char *cmdline) |
| 2436 | 2436 | c = *typestr++; |
| 2437 | 2437 | if (c == '\0') |
| 2438 | 2438 | goto bad_type; |
| 2439 | - while (isspace(*p)) | |
| 2439 | + while (qemu_isspace(*p)) | |
| 2440 | 2440 | p++; |
| 2441 | 2441 | has_option = 0; |
| 2442 | 2442 | if (*p == '-') { |
| ... | ... | @@ -2461,7 +2461,7 @@ static void monitor_handle_command(const char *cmdline) |
| 2461 | 2461 | } |
| 2462 | 2462 | } |
| 2463 | 2463 | /* check that all arguments were parsed */ |
| 2464 | - while (isspace(*p)) | |
| 2464 | + while (qemu_isspace(*p)) | |
| 2465 | 2465 | p++; |
| 2466 | 2466 | if (*p != '\0') { |
| 2467 | 2467 | term_printf("%s: extraneous characters at the end of line\n", |
| ... | ... | @@ -2609,7 +2609,7 @@ static void parse_cmdline(const char *cmdline, |
| 2609 | 2609 | p = cmdline; |
| 2610 | 2610 | nb_args = 0; |
| 2611 | 2611 | for(;;) { |
| 2612 | - while (isspace(*p)) | |
| 2612 | + while (qemu_isspace(*p)) | |
| 2613 | 2613 | p++; |
| 2614 | 2614 | if (*p == '\0') |
| 2615 | 2615 | break; |
| ... | ... | @@ -2643,7 +2643,7 @@ void readline_find_completion(const char *cmdline) |
| 2643 | 2643 | /* if the line ends with a space, it means we want to complete the |
| 2644 | 2644 | next arg */ |
| 2645 | 2645 | len = strlen(cmdline); |
| 2646 | - if (len > 0 && isspace(cmdline[len - 1])) { | |
| 2646 | + if (len > 0 && qemu_isspace(cmdline[len - 1])) { | |
| 2647 | 2647 | if (nb_args >= MAX_ARGS) |
| 2648 | 2648 | return; |
| 2649 | 2649 | args[nb_args++] = qemu_strdup(""); | ... | ... |
net.c
| ... | ... | @@ -268,7 +268,7 @@ int parse_host_port(struct sockaddr_in *saddr, const char *str) |
| 268 | 268 | if (buf[0] == '\0') { |
| 269 | 269 | saddr->sin_addr.s_addr = 0; |
| 270 | 270 | } else { |
| 271 | - if (isdigit(buf[0])) { | |
| 271 | + if (qemu_isdigit(buf[0])) { | |
| 272 | 272 | if (!inet_aton(buf, &saddr->sin_addr)) |
| 273 | 273 | return -1; |
| 274 | 274 | } else { | ... | ... |
qemu-common.h
| ... | ... | @@ -95,6 +95,22 @@ int strstart(const char *str, const char *val, const char **ptr); |
| 95 | 95 | int stristart(const char *str, const char *val, const char **ptr); |
| 96 | 96 | time_t mktimegm(struct tm *tm); |
| 97 | 97 | |
| 98 | +#define qemu_isalnum(c) isalnum((unsigned char)(c)) | |
| 99 | +#define qemu_isalpha(c) isalpha((unsigned char)(c)) | |
| 100 | +#define qemu_iscntrl(c) iscntrl((unsigned char)(c)) | |
| 101 | +#define qemu_isdigit(c) isdigit((unsigned char)(c)) | |
| 102 | +#define qemu_isgraph(c) isgraph((unsigned char)(c)) | |
| 103 | +#define qemu_islower(c) islower((unsigned char)(c)) | |
| 104 | +#define qemu_isprint(c) isprint((unsigned char)(c)) | |
| 105 | +#define qemu_ispunct(c) ispunct((unsigned char)(c)) | |
| 106 | +#define qemu_isspace(c) isspace((unsigned char)(c)) | |
| 107 | +#define qemu_isupper(c) isupper((unsigned char)(c)) | |
| 108 | +#define qemu_isxdigit(c) isxdigit((unsigned char)(c)) | |
| 109 | +#define qemu_tolower(c) tolower((unsigned char)(c)) | |
| 110 | +#define qemu_toupper(c) toupper((unsigned char)(c)) | |
| 111 | +#define qemu_isascii(c) isascii((unsigned char)(c)) | |
| 112 | +#define qemu_toascii(c) toascii((unsigned char)(c)) | |
| 113 | + | |
| 98 | 114 | void *qemu_malloc(size_t size); |
| 99 | 115 | void *qemu_realloc(void *ptr, size_t size); |
| 100 | 116 | void *qemu_mallocz(size_t size); | ... | ... |
readline.c
| ... | ... | @@ -169,7 +169,7 @@ static void term_backword(void) |
| 169 | 169 | |
| 170 | 170 | /* find first word (backwards) */ |
| 171 | 171 | while (start > 0) { |
| 172 | - if (!isspace(term_cmd_buf[start])) { | |
| 172 | + if (!qemu_isspace(term_cmd_buf[start])) { | |
| 173 | 173 | break; |
| 174 | 174 | } |
| 175 | 175 | |
| ... | ... | @@ -178,7 +178,7 @@ static void term_backword(void) |
| 178 | 178 | |
| 179 | 179 | /* find first space (backwards) */ |
| 180 | 180 | while (start > 0) { |
| 181 | - if (isspace(term_cmd_buf[start])) { | |
| 181 | + if (qemu_isspace(term_cmd_buf[start])) { | |
| 182 | 182 | ++start; |
| 183 | 183 | break; |
| 184 | 184 | } | ... | ... |
target-ppc/translate_init.c