From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L1i4F-0001mj-2n for qemu-devel@nongnu.org; Sun, 16 Nov 2008 08:53:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L1i4E-0001mX-Fo for qemu-devel@nongnu.org; Sun, 16 Nov 2008 08:53:34 -0500 Received: from [199.232.76.173] (port=43682 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L1i4E-0001mU-CS for qemu-devel@nongnu.org; Sun, 16 Nov 2008 08:53:34 -0500 Received: from savannah.gnu.org ([199.232.41.3]:54873 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L1i4D-0004ea-S3 for qemu-devel@nongnu.org; Sun, 16 Nov 2008 08:53:34 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1L1i4D-0002rN-7a for qemu-devel@nongnu.org; Sun, 16 Nov 2008 13:53:33 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1L1i4C-0002rJ-Nf for qemu-devel@nongnu.org; Sun, 16 Nov 2008 13:53:33 +0000 MIME-Version: 1.0 Errors-To: blueswir1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Blue Swirl Message-Id: Date: Sun, 16 Nov 2008 13:53:32 +0000 Subject: [Qemu-devel] [5727] Attached patch fixes a series of this warning Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5727 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5727 Author: blueswir1 Date: 2008-11-16 13:53:32 +0000 (Sun, 16 Nov 2008) Log Message: ----------- Attached patch fixes a series of this warning when compiling on NetBSD: warning: array subscript has type 'char' Signed-off-by: Christoph Egger Modified Paths: -------------- trunk/audio/audio.c trunk/block-vvfat.c trunk/cutils.c trunk/monitor.c trunk/net.c trunk/qemu-common.h trunk/readline.c trunk/target-ppc/translate_init.c Modified: trunk/audio/audio.c =================================================================== --- trunk/audio/audio.c 2008-11-16 11:38:43 UTC (rev 5726) +++ trunk/audio/audio.c 2008-11-16 13:53:32 UTC (rev 5727) @@ -215,7 +215,7 @@ pstrcat (r, len + sizeof (qemu_prefix), s); for (i = 0; i < len; ++i) { - u[i] = toupper (u[i]); + u[i] = qemu_toupper(u[i]); } } return r; @@ -470,7 +470,7 @@ /* copy while upper-casing, including trailing zero */ for (i = 0; i <= preflen; ++i) { - optname[i + sizeof (qemu_prefix) - 1] = toupper (prefix[i]); + optname[i + sizeof (qemu_prefix) - 1] = qemu_toupper(prefix[i]); } pstrcat (optname, optlen, "_"); pstrcat (optname, optlen, opt->name); Modified: trunk/block-vvfat.c =================================================================== --- trunk/block-vvfat.c 2008-11-16 11:38:43 UTC (rev 5726) +++ trunk/block-vvfat.c 2008-11-16 13:53:32 UTC (rev 5727) @@ -1056,7 +1056,7 @@ i = strrchr(dirname, ':') - dirname; assert(i >= 3); - if (dirname[i-2] == ':' && isalpha(dirname[i-1])) + if (dirname[i-2] == ':' && qemu_isalpha(dirname[i-1])) /* workaround for DOS drive names */ dirname += i-1; else Modified: trunk/cutils.c =================================================================== --- trunk/cutils.c 2008-11-16 11:38:43 UTC (rev 5726) +++ trunk/cutils.c 2008-11-16 13:53:32 UTC (rev 5727) @@ -72,7 +72,7 @@ p = str; q = val; while (*q != '\0') { - if (toupper(*p) != toupper(*q)) + if (qemu_toupper(*p) != qemu_toupper(*q)) return 0; p++; q++; Modified: trunk/monitor.c =================================================================== --- trunk/monitor.c 2008-11-16 11:38:43 UTC (rev 5726) +++ trunk/monitor.c 2008-11-16 13:53:32 UTC (rev 5727) @@ -1933,7 +1933,7 @@ { if (pch != '\0') { pch++; - while (isspace(*pch)) + while (qemu_isspace(*pch)) pch++; } } @@ -1992,7 +1992,7 @@ *q++ = *pch; pch++; } - while (isspace(*pch)) + while (qemu_isspace(*pch)) pch++; *q = 0; ret = get_monitor_def(®, buf); @@ -2017,7 +2017,7 @@ expr_error("invalid char in expression"); } pch = p; - while (isspace(*pch)) + while (qemu_isspace(*pch)) pch++; break; } @@ -2111,7 +2111,7 @@ *pp = pch; return -1; } - while (isspace(*pch)) + while (qemu_isspace(*pch)) pch++; *pval = expr_sum(); *pp = pch; @@ -2126,7 +2126,7 @@ q = buf; p = *pp; - while (isspace(*p)) + while (qemu_isspace(*p)) p++; if (*p == '\0') { fail: @@ -2171,7 +2171,7 @@ } p++; } else { - while (*p != '\0' && !isspace(*p)) { + while (*p != '\0' && !qemu_isspace(*p)) { if ((q - buf) < buf_size - 1) { *q++ = *p; } @@ -2217,12 +2217,12 @@ /* extract the command name */ p = cmdline; q = cmdname; - while (isspace(*p)) + while (qemu_isspace(*p)) p++; if (*p == '\0') return; pstart = p; - while (*p != '\0' && *p != '/' && !isspace(*p)) + while (*p != '\0' && *p != '/' && !qemu_isspace(*p)) p++; len = p - pstart; if (len > sizeof(cmdname) - 1) @@ -2258,7 +2258,7 @@ int ret; char *str; - while (isspace(*p)) + while (qemu_isspace(*p)) p++; if (*typestr == '?') { typestr++; @@ -2299,15 +2299,15 @@ { int count, format, size; - while (isspace(*p)) + while (qemu_isspace(*p)) p++; if (*p == '/') { /* format found */ p++; count = 1; - if (isdigit(*p)) { + if (qemu_isdigit(*p)) { count = 0; - while (isdigit(*p)) { + while (qemu_isdigit(*p)) { count = count * 10 + (*p - '0'); p++; } @@ -2346,7 +2346,7 @@ } } next: - if (*p != '\0' && !isspace(*p)) { + if (*p != '\0' && !qemu_isspace(*p)) { term_printf("invalid char in format: '%c'\n", *p); goto fail; } @@ -2380,7 +2380,7 @@ { int64_t val; - while (isspace(*p)) + while (qemu_isspace(*p)) p++; if (*typestr == '?' || *typestr == '.') { if (*typestr == '?') { @@ -2391,7 +2391,7 @@ } else { if (*p == '.') { p++; - while (isspace(*p)) + while (qemu_isspace(*p)) p++; has_arg = 1; } else { @@ -2436,7 +2436,7 @@ c = *typestr++; if (c == '\0') goto bad_type; - while (isspace(*p)) + while (qemu_isspace(*p)) p++; has_option = 0; if (*p == '-') { @@ -2461,7 +2461,7 @@ } } /* check that all arguments were parsed */ - while (isspace(*p)) + while (qemu_isspace(*p)) p++; if (*p != '\0') { term_printf("%s: extraneous characters at the end of line\n", @@ -2609,7 +2609,7 @@ p = cmdline; nb_args = 0; for(;;) { - while (isspace(*p)) + while (qemu_isspace(*p)) p++; if (*p == '\0') break; @@ -2643,7 +2643,7 @@ /* if the line ends with a space, it means we want to complete the next arg */ len = strlen(cmdline); - if (len > 0 && isspace(cmdline[len - 1])) { + if (len > 0 && qemu_isspace(cmdline[len - 1])) { if (nb_args >= MAX_ARGS) return; args[nb_args++] = qemu_strdup(""); Modified: trunk/net.c =================================================================== --- trunk/net.c 2008-11-16 11:38:43 UTC (rev 5726) +++ trunk/net.c 2008-11-16 13:53:32 UTC (rev 5727) @@ -268,7 +268,7 @@ if (buf[0] == '\0') { saddr->sin_addr.s_addr = 0; } else { - if (isdigit(buf[0])) { + if (qemu_isdigit(buf[0])) { if (!inet_aton(buf, &saddr->sin_addr)) return -1; } else { Modified: trunk/qemu-common.h =================================================================== --- trunk/qemu-common.h 2008-11-16 11:38:43 UTC (rev 5726) +++ trunk/qemu-common.h 2008-11-16 13:53:32 UTC (rev 5727) @@ -95,6 +95,22 @@ int stristart(const char *str, const char *val, const char **ptr); time_t mktimegm(struct tm *tm); +#define qemu_isalnum(c) isalnum((unsigned char)(c)) +#define qemu_isalpha(c) isalpha((unsigned char)(c)) +#define qemu_iscntrl(c) iscntrl((unsigned char)(c)) +#define qemu_isdigit(c) isdigit((unsigned char)(c)) +#define qemu_isgraph(c) isgraph((unsigned char)(c)) +#define qemu_islower(c) islower((unsigned char)(c)) +#define qemu_isprint(c) isprint((unsigned char)(c)) +#define qemu_ispunct(c) ispunct((unsigned char)(c)) +#define qemu_isspace(c) isspace((unsigned char)(c)) +#define qemu_isupper(c) isupper((unsigned char)(c)) +#define qemu_isxdigit(c) isxdigit((unsigned char)(c)) +#define qemu_tolower(c) tolower((unsigned char)(c)) +#define qemu_toupper(c) toupper((unsigned char)(c)) +#define qemu_isascii(c) isascii((unsigned char)(c)) +#define qemu_toascii(c) toascii((unsigned char)(c)) + void *qemu_malloc(size_t size); void *qemu_realloc(void *ptr, size_t size); void *qemu_mallocz(size_t size); Modified: trunk/readline.c =================================================================== --- trunk/readline.c 2008-11-16 11:38:43 UTC (rev 5726) +++ trunk/readline.c 2008-11-16 13:53:32 UTC (rev 5727) @@ -169,7 +169,7 @@ /* find first word (backwards) */ while (start > 0) { - if (!isspace(term_cmd_buf[start])) { + if (!qemu_isspace(term_cmd_buf[start])) { break; } @@ -178,7 +178,7 @@ /* find first space (backwards) */ while (start > 0) { - if (isspace(term_cmd_buf[start])) { + if (qemu_isspace(term_cmd_buf[start])) { ++start; break; } Modified: trunk/target-ppc/translate_init.c =================================================================== --- trunk/target-ppc/translate_init.c 2008-11-16 11:38:43 UTC (rev 5726) +++ trunk/target-ppc/translate_init.c 2008-11-16 13:53:32 UTC (rev 5727) @@ -9458,7 +9458,7 @@ p = name; check_pvr: for (i = 0; i < 8; i++) { - if (!isxdigit(*p++)) + if (!qemu_isxdigit(*p++)) break; } if (i == 8)