[postgis-devel] use of strnicmp
Greg Troxel
gdt at lexort.com
Fri Sep 22 12:12:53 PDT 2017
Paul Ramsey <pramsey at cleverelephant.ca> writes:
> There don't actually appear to be any calls to strnicmp in the .c files, so
> that whole chunk of header seems to be out-of-date. Maybe our windows build
> base moved in posix support to the point where it doesn't matter anymore.
Maybe this is no longer true in 2.4.0. But I was building 2.3.3, and it
seems to be there:
postgis-2.3.3/raster/rt_core/rt_raster.c: if (strnicmp(pszDataPointer, "0x", 2) == 0)
> That still leaves questions of why you'd have any regression issues once
> you got build running though.
True. But I'm going to pass on figuring that out :-)
a.furieri at lqt.it writes:
> the usual workaround adopted by many other FLOSS/GFOSS
> libraries for ensuring transparent cross-compiler
> portability is as follows:
>
> 1. always use stcasecmp and strncasecmp in your code
> 2. define in some appropriate header file this macro:
>
> #if defined(_WIN32) && !defined(__MINGW32__)
> #define strcasecmp _stricmp
> #define strncasecmp _strnicmp
> #endif
>
> note: the "if defined" clauses ensures that name
> replacement will happen only for MSVC but not for
> MinGW, that being a conformant porting of GNU gcc
> for Windows is perfectly aware of strcasecmp and
> strncasecmp
>
> bye Sandro
That sounds like a great solution. It could even be put directly at the
front of rt_raster.c, and all of this removed from the header.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 162 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20170922/80dda8a6/attachment.sig>
More information about the postgis-devel
mailing list