[Gdal-dev] An unsigned integer is being compared to zero.

Mateusz Loskot mateusz at loskot.net
Wed Jan 3 04:28:42 EST 2007

Martin Spott wrote:
> Hi Mateusz,
> Mateusz Loskot wrote:
>> All those errors you're reporting sounds like a lack of C99 support.
>> Missing long long and functions handling this type, errors about C99's
>> "static inline" feature, etc.
> This is MIPSpro 7.41 ....:
>   http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=0650&db=relnotes&fname=/usr/relnotes/c_dev#New%20Features
> I added "-c99" to my CFLAGS for "cc", but actually this didn't change
> anything. "CC" on the other hand does not know about C99 instructions.
> So there appears to be no solution for 'atoll' and 'copysignf' on
> IRIX, I can live with the fallbacks.

OK, so there is C99 mode for MIPSpro.
As I see in the link above, there is long long support,
so there the strtoll() function should be available.
This can safely replace atoll() call.

However, I suppose GDAL is compiled in C++ mode using your compiler,
and AFAIK there is *no* C99 support for C++ mode, so the long long
and *ll() functions won't be available. That's what I suppose.

> Building the included GeoTIFF library was easy once I knew what
> actually happend ....  I simply removed the include path to the
> system-installed TIFF library from the compiler flags and the TIFF
> issue was done.

This library can be compiled in plain ANSI C mode, so here -c99 option
should work well.

> Now I'm running into different trouble - any idea ?
> make[2]: Entering directory `/usr/local/src/gdal-1.4.0/frmts/nitf'
> [...]
>  cc -Xcpluscomm -O2 -use_readonly_const -rdata_shared -woff
>    1001,1012,1014,1110,1116,1155,1172,1174,1234,1401 -woff
>    1460,1551,1552,1681
>    -OPT:roundoff=0:Olimit=0:div_split=ON:alias=typed:fast_io=ON
>    -OPT:got_call_conversion=ON:reorg_common=ON:rsqrt=ON:swp=ON
>    -LANG:exceptions=ON -I/opt/include -I/usr/freeware/include -Wl,-rpath
>    -Wl,/usr/freeware/lib32 -Wl,-rpath -Wl,. -c99
>    -I/usr/local/src/gdal-1.4.0/port -I/usr/local/src/gdal-1.4.0/gcore
>    -I/usr/local/src/gdal-1.4.0/alg -I/usr/local/src/gdal-1.4.0/ogr
>    -I/usr/local/src/gdal-1.4.0/ogr/ogrsf_frmts -DOGR_ENABLED
>    -I/usr/freeware/include -Xcpluscomm -I/usr/local/src/gdal-1.4.0/port
>    -c nitfimage.c -o ../o/nitfimage.o
> cc-1196 cc: WARNING File = nitfimage.c, Line = 1964
>   The indicated function is declared implicitly.
>           pachTRE = NITFFindTREByIndex( psImage->pachTRE, psImage->nTREBytes, 
>                     ^
> cc-1515 cc: ERROR File = nitfimage.c, Line = 1964
>   A value of type "int" cannot be assigned to an entity of type "const char *".
>           pachTRE = NITFFindTREByIndex( psImage->pachTRE, psImage->nTREBytes, 

Here, I suppose, your MIPSpro recognizes that:

1) declaration of the the dNITFFindTREByIndex() is missing
2) then, compiler accepts it as an implicitly declared function
3) by default, the return type of implicitly declared function is int.

So, in following line:

pachTRE = NITFFindTREByIndex(...),

return value from the function which is assumed to be int is assigned to
pachTRE that is declared as char*.

Now, the question is why declaration of the NITFFindTREByIndex() is
missing. Some headers seems to be missing, unable to locate.
That's all about the problem itself, but I have no idea about
dependencies of the NITF driver.

Mateusz Loskot

More information about the Gdal-dev mailing list