[GRASS-SVN] r69388 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 6 06:20:53 PDT 2016


Author: mmetz
Date: 2016-09-06 06:20:53 -0700 (Tue, 06 Sep 2016)
New Revision: 69388

Modified:
   grass/trunk/lib/gis/gisinit.c
Log:
libgis: set valid ZLIB compression level

Modified: grass/trunk/lib/gis/gisinit.c
===================================================================
--- grass/trunk/lib/gis/gisinit.c	2016-09-06 13:17:04 UTC (rev 69387)
+++ grass/trunk/lib/gis/gisinit.c	2016-09-06 13:20:53 UTC (rev 69388)
@@ -119,7 +119,13 @@
     G__.little_endian = G_is_little_endian();
 
     zlib = getenv("GRASS_ZLIB_LEVEL");
-    G__.compression_level = (zlib && *zlib && isdigit(*zlib)) ? atoi(zlib) : -2;
+    /* Valid zlib compression levels -1 - 9 */
+    /* zlib default: Z_DEFAULT_COMPRESSION = -1, equivalent to 6 
+     * level 0 means no compression
+     * as used here, 1 gives the best compromise between speed and compression */
+    G__.compression_level = (zlib && *zlib && isdigit(*zlib)) ? atoi(zlib) : 1;
+    if (G__.compression_level < -1 || G__.compression_level > 9)
+	G__.compression_level = 1;
 
     initialized = 1;
 



More information about the grass-commit mailing list