[GRASS-SVN] r70390 - grass/branches/releasebranch_7_2/raster/r.null

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 17 13:42:38 PST 2017


Author: mmetz
Date: 2017-01-17 13:42:37 -0800 (Tue, 17 Jan 2017)
New Revision: 70390

Modified:
   grass/branches/releasebranch_7_2/raster/r.null/main.c
Log:
r.null: backport trunk r70338

Modified: grass/branches/releasebranch_7_2/raster/r.null/main.c
===================================================================
--- grass/branches/releasebranch_7_2/raster/r.null/main.c	2017-01-17 20:31:26 UTC (rev 70389)
+++ grass/branches/releasebranch_7_2/raster/r.null/main.c	2017-01-17 21:42:37 UTC (rev 70390)
@@ -196,9 +196,26 @@
     }
 
     if (recreate) {
+	/* (un-)compress NULL file */
 	int in_fd;
+	char *nullcompr = getenv("GRASS_COMPRESS_NULLS");
+        int donullcompr = (nullcompr && atoi(nullcompr)) ? 1 : 0;
 
-	/* (un-)compress NULL file */
+	G_debug(1, "NULL compression is currently %s", donullcompr ? "enabled" : "disabled");
+
+	if (donullcompr) {
+	    if (G_find_file2_misc("cell_misc", "nullcmpr", name, mapset)) {
+		G_message(_("The NULL file is already compressed, nothing to do."));
+		exit(EXIT_SUCCESS);
+	    }
+	}
+	else {
+	    if (G_find_file2_misc("cell_misc", "null", name, mapset)) {
+		G_message(_("The NULL file is already uncompressed, nothing to do."));
+		exit(EXIT_SUCCESS);
+	    }
+	}
+
 	null_bits = Rast__allocate_null_bits(cellhd.cols);
 	Rast__init_null_bits(null_bits, cellhd.cols);
 



More information about the grass-commit mailing list