[GRASS-SVN] r74008 - grass/branches/releasebranch_7_6/raster/r.compress

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 22 14:37:24 PST 2019


Author: neteler
Date: 2019-01-22 14:37:24 -0800 (Tue, 22 Jan 2019)
New Revision: 74008

Modified:
   grass/branches/releasebranch_7_6/raster/r.compress/main.c
Log:
r.compress: fix for r74005 to avoid nul msg when GRASS_COMPRESSOR undefined (trunk, r74007)

Modified: grass/branches/releasebranch_7_6/raster/r.compress/main.c
===================================================================
--- grass/branches/releasebranch_7_6/raster/r.compress/main.c	2019-01-22 22:37:00 UTC (rev 74007)
+++ grass/branches/releasebranch_7_6/raster/r.compress/main.c	2019-01-22 22:37:24 UTC (rev 74008)
@@ -235,8 +235,17 @@
     struct Cell_head cellhd;
     int new, old, nrows, row;
     void *rast;
+    char *cname;
 
     Rast_get_cellhd(name, G_mapset(), &cellhd);
+    cname = getenv("GRASS_COMPRESSOR");
+    if (cname && *cname) {
+       if (G_compressor_number(cname) < 1)
+           cname = G_compressor_name(G_default_compressor());
+       else
+           cname = G_compressor_name(G_compressor_number(cname));
+    } else
+           cname = G_compressor_name(G_default_compressor());
 
     /* check if already compressed/decompressed */
     if (uncompress) {
@@ -252,10 +261,10 @@
 	    G_warning(_("[%s] already compressed"), name);
 	    return 1;
 	    */
-	    G_message(_("Re-compressing <%s> with method %s..."), name, G_compressor_name(cellhd.compressed));
+	    G_message(_("Re-compressing <%s> with method %s..."), name, cname);
 	}
 	else
-	    G_message(_("Compressing <%s> with method %s..."), name, G_compressor_name(cellhd.compressed));
+	    G_message(_("Compressing <%s> with method %s..."), name, cname);
     }
 
     Rast_set_window(&cellhd);



More information about the grass-commit mailing list