Assuming 'char' is an signed value...

Julien Demaria dem at ACRI-ST.FR
Thu Jan 27 03:56:18 EST 2005


Petter,

maybe this option of gcc can help you ?

"-fsigned-char
Let the type char be signed, like signed char. "

(We use this option to port a project to IRIX...)

Regards,

Julien

At 18:14 26/01/2005, Petter Reinholdtsen wrote:
>This is another interesting warning on Irix:
>
>cc-1183 cc: WARNING File = maptemplate.c, Line = 2789
>   An unsigned integer is being compared to zero.
>
>         if(lp->resultcache->results[0].classindex >= 0 &&
> lp->class[(int)(lp->resultcache->results[0].classindex)].template)
>                                                   ^
>
>cc-1183 cc: WARNING File = maptemplate.c, Line = 2912
>   An unsigned integer is being compared to zero.
>
>         if(lp->resultcache->results[j].classindex >= 0 &&
> lp->class[(int)(lp->resultcache->results[j].classindex)].template)
>                                                   ^
>
>The 'classindex' struct member is a char (in resultCacheMemberObj),
>and the code in question will not work as expected when char is an
>unsigned type (which is the case on some archs).
>
>What is the correct fix?  Changing the use of 'char classindex' to
>'unsigned char classindex' or 'uint8_t' (from <stdint.h>), or perhaps
>stop comparing the value with 0?  I recommend using uint8_t if the
>intention of the code is to use an unsigned 8 bit value.



More information about the mapserver-dev mailing list