[OSRS-PROJ] pj_gridinfo.c file and C++ compilation

Frank Warmerdam warmerdam at pobox.com
Wed Aug 20 09:24:55 EDT 2003


Paul Selormey wrote:
> In the function
> static int pj_gridinfo_init_ntv2( FILE *fid, PJ_GRIDINFO *gilist )
> {
>     unsigned char header[11*16];
> }
> 
> the "header" variable as defined will pass through most C/C++ string
> functions
> like "strncmp".
> 
> VC++ 6.x gives the following error:
> 
> -------------------------------------------------------------------------
> C:\...\pj_gridinfo.cpp(372) : error C2664: 'strncmp' : cannot convert
> parameter 1 from
> 'unsigned char [176]' to 'const char *'
>         Types pointed to are unrelated; conversion requires
> reinterpret_cast,
> C-style cast or function-style cast
> -------------------------------------------------------------------------
> 
> Since I do not know the format of the NTV2 file, I cannot tell if the
> "unsigned char"
> is necessary. Any suggestions for work around? Will the cast to "const
> char*" be safe?

Paul,

Many of the uses of the "header" array do require it to be unsigned char.
However, I have committed changes to pj_gridinfo.c casting it to const
char * in places where it is appropriate (the various string functions).

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent


----------------------------------------
PROJ.4 Discussion List
See http://www.remotesensing.org/proj for subscription, unsubscription
and other information.



More information about the Proj mailing list