[GRASS-SVN] r71738 - grass/trunk/raster/r.in.gdal

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Nov 15 13:05:15 PST 2017


Author: mmetz
Date: 2017-11-15 13:05:15 -0800 (Wed, 15 Nov 2017)
New Revision: 71738

Modified:
   grass/trunk/raster/r.in.gdal/main.c
Log:
r.in.gdal: fix r71735, support for GDAL's GIntBig on Windows

Modified: grass/trunk/raster/r.in.gdal/main.c
===================================================================
--- grass/trunk/raster/r.in.gdal/main.c	2017-11-15 18:40:51 UTC (rev 71737)
+++ grass/trunk/raster/r.in.gdal/main.c	2017-11-15 21:05:15 UTC (rev 71738)
@@ -27,21 +27,30 @@
 #include <grass/raster.h>
 #include <grass/imagery.h>
 
-/* for GDAL's GIntBig on WIN32 */
-/* must be before including gprojects.h
- * this will be solved in GDAl 2.3 */
-#include "cpl_config.h"
-/* HAVE_LONG_LONG_INT comes from GRASS
- * HAVE_LONG_LONG comes from GDAL */
-#if defined HAVE_LONG_LONG_INT && !defined HAVE_LONG_LONG
-#define HAVE_LONG_LONG
+/* GDAL < 2.3 does not define HAVE_LONG_LONG when compiled with 
+ * Visual Studio as for OSGeo4W, even though long long is available,
+ * and GIntBig falls back to long which is on Windows always 4 bytes.
+ * This patch ensures that GIntBig is defined as long long (8 bytes)
+ * if GDAL is compiled with Visual Studio and GRASS is compiled with 
+ * MinGW. This patch must be applied before other GDAL/OGR headers are
+ * included, as done by gprojects.h and vector.h */
+#if defined(__MINGW32__)
+#  include <gdal_version.h>
+#  if GDAL_VERSION_NUM < 2030000
+#    include <cpl_config.h>
+     /* HAVE_LONG_LONG_INT comes from GRASS
+      * HAVE_LONG_LONG comes from GDAL */
+#    if defined HAVE_LONG_LONG_INT && !defined HAVE_LONG_LONG
+#      define HAVE_LONG_LONG 1
+#    endif
+#  endif
 #endif
 
 #include <grass/gprojects.h>
 #include <grass/glocale.h>
 
 #include <gdal.h>
-#include "cpl_conv.h"
+#include <cpl_conv.h>
 
 #undef MIN
 #undef MAX



More information about the grass-commit mailing list