Dave Korn wrote:
> Fell at the first hurdle for me:
>
> gcc-4 -shared-libgcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -D_FORTIFY_SOURCE=2
> -p
> edantic -Wall -Wextra -Werror -O2 -pipe -MT inp_str.lo -MD -MP -MF
> .deps/inp_str
> .Tpo -c inp_str.c -DDLL_EXPORT -DPIC -o .libs/inp_str.o
> cc1: warnings being treated as errors
> inp_str.c: In function 'extract_string':
> inp_str.c:113:10: error: array subscript has type 'char'
> inp_str.c:114:10: error: array subscript has type 'char'
> inp_str.c:115:10: error: array subscript has type 'char'
> inp_str.c:118:13: error: array subscript has type 'char'
> inp_str.c:119:13: error: array subscript has type 'char'
> inp_str.c:120:13: error: array subscript has type 'char'
> make[2]: *** [inp_str.lo] Error 1
> make[2]: *** Waiting for unfinished jobs....
Attached allowed it to build, and seems to be what the function was already
doing for isspace earlier. Test results will follow.
cheers,
DaveK
--- orig/mpc-0.7-dev/src/inp_str.c 2009-08-26 21:24:41.000000000 +0100
+++ mpc-0.7-dev/src/inp_str.c 2009-09-01 12:17:04.546875000 +0100
@@ -110,14 +110,14 @@ extract_string (FILE *stream)
/* (n-char-sequence) only after a NaN */
if ((nread != 3
- || tolower (str[0]) != 'n'
- || tolower (str[1]) != 'a'
- || tolower (str[2]) != 'n')
+ || tolower ((unsigned char) str[0]) != 'n'
+ || tolower ((unsigned char) str[1]) != 'a'
+ || tolower ((unsigned char) str[2]) != 'n')
&& (nread != 5
|| str[0] != '@'
- || tolower (str[1]) != 'n'
- || tolower (str[2]) != 'a'
- || tolower (str[3]) != 'n'
+ || tolower ((unsigned char) str[1]) != 'n'
+ || tolower ((unsigned char) str[2]) != 'a'
+ || tolower ((unsigned char) str[3]) != 'n'
|| str[4] != '@')) {
ungetc (c, stream);
return str;