[postgis-devel] use of strnicmp

Greg Troxel gdt at lexort.com
Fri Sep 22 12:23:09 PDT 2017


Thanks Paul and Sandro for the hints.

The same problem exists in 2.4.0beta1.    I took the suggestion about
windows and then it built ok.

While I don't like tweaking immediately before a release that much, this
seems like a vast simplification and any issues from it are almost
certain to be really obvious and easy to fix.

--- raster/rt_core/librtcore.h.orig	2016-07-04 15:45:56.000000000 +0000
+++ raster/rt_core/librtcore.h
@@ -58,74 +58,6 @@
 #ifndef LIBRTCORE_H_INCLUDED
 #define LIBRTCORE_H_INCLUDED
 
-/* define the systems */
-#if defined(__linux__)  /* (predefined) */
-#if !defined(LINUX)
-#define LINUX
-#endif
-#if !defined(UNIX)
-#define UNIX        /* make sure this is defined */
-#endif
-#endif
-
-
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__)    /* seems to work like Linux... */
-#if !defined(LINUX)
-#define LINUX
-#endif
-#if !defined(UNIX)
-#define UNIX        /* make sure this is defined */
-#endif
-#endif
-
-#if defined(__GNU__)    /* GNU/Hurd is also like Linux */
-#if !defined(LINUX)
-#define LINUX
-#endif
-#if !defined(UNIX)
-#define UNIX        /* make sure this is defined */
-#endif
-#endif
-
-#if defined(__MSDOS__)
-#if !defined(MSDOS)
-#define MSDOS       /* make sure this is defined */
-#endif
-#endif
-
-#if defined(__WIN32__) || defined(__NT__) || defined(_WIN32)
-#if !defined(WIN32)
-#define WIN32
-#endif
-#if defined(__BORLANDC__) && defined(MSDOS) /* Borland always defines MSDOS */
-#undef  MSDOS
-#endif
-#endif
-
-#if defined(__APPLE__)
-#if !defined(UNIX)
-#define UNIX
-#endif
-#endif
-
-#if defined(sun) || defined(__sun)
-#if !defined(UNIX)
-#define UNIX
-#endif
-#endif
-
-/* if we are in Unix define stricmp to be strcasecmp and strnicmp to */
-/* be strncasecmp. I'm not sure if all Unices have these, but Linux */
-/* does. */
-#if defined(UNIX)
-#if !defined(HAVE_STRICMP)
-#define stricmp     strcasecmp
-#endif
-#if !defined(HAVE_STRNICMP)
-#define strnicmp    strncasecmp
-#endif
-#endif
-
 #include <stdio.h> /* for printf, sprintf */
 #include <stdlib.h> /* For size_t, srand and rand */
 #include <stdint.h> /* For C99 int types */
@@ -151,6 +83,11 @@
 # define __attribute__ (x)
 #endif
 
+/* From postgis-devel 20170922 */
+#if defined(_WIN32) && !defined(_MINGW32_)
+#define strncasecmp	_strnicmp
+#endif
+
 /**
  * Types definitions
  */


--- raster/rt_core/rt_raster.c.orig	2016-07-04 15:45:56.000000000 +0000
+++ raster/rt_core/rt_raster.c
@@ -1963,7 +1963,7 @@ rt_raster_to_gdal_mem(
 			RASTER_DEBUGF(4, "rt_raster_to_gdal_mem: szDatapointer is %p",
 				pszDataPointer);
 
-			if (strnicmp(pszDataPointer, "0x", 2) == 0)
+			if (strncasecmp(pszDataPointer, "0x", 2) == 0)
 				sprintf(szGDALOption, "DATAPOINTER=%s", pszDataPointer);
 			else
 				sprintf(szGDALOption, "DATAPOINTER=0x%s", pszDataPointer);
-------------- 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/793e26ad/attachment.sig>


More information about the postgis-devel mailing list