ソースを参照

r.compress: fix for https://trac.osgeo.org/grass/changeset/74005 to avoid nul msg when GRASS_COMPRESSOR undefined

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@74007 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 6 年 前
コミット
e8c4c25c95
1 ファイル変更11 行追加2 行削除
  1. 11 2
      raster/r.compress/main.c

+ 11 - 2
raster/r.compress/main.c

@@ -235,8 +235,17 @@ static int doit(char *name, int uncompress, RASTER_MAP_TYPE map_type)
     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 @@ static int doit(char *name, int uncompress, RASTER_MAP_TYPE map_type)
 	    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);