[GRASS-SVN] r62176 - in grass/branches/releasebranch_7_0: . raster/r.clump

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Oct 4 11:48:38 PDT 2014


Author: annakrat
Date: 2014-10-04 11:48:38 -0700 (Sat, 04 Oct 2014)
New Revision: 62176

Modified:
   grass/branches/releasebranch_7_0/
   grass/branches/releasebranch_7_0/raster/r.clump/main.c
Log:
r.clump: fix reporting number of clumps when map is empty (merge from trunk, r62170)


Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
   - /grass/trunk:60289,60696,61269,61380,61420,61422,61480,61500,61764,61793,61808,61829,61831,61840,61851-61854,61858,61888,61891,61905,61907,61913-61914,61916,61918,61920-61921,61938,61967-61968,61975,61980,61986,61993,62005,62095,62099,62114,62122,62128,62131,62148,62174
   + /grass/trunk:60289,60696,61269,61380,61420,61422,61480,61500,61764,61793,61808,61829,61831,61840,61851-61854,61858,61888,61891,61905,61907,61913-61914,61916,61918,61920-61921,61938,61967-61968,61975,61980,61986,61993,62005,62095,62099,62114,62122,62128,62131,62148,62170,62174

Modified: grass/branches/releasebranch_7_0/raster/r.clump/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.clump/main.c	2014-10-04 18:44:21 UTC (rev 62175)
+++ grass/branches/releasebranch_7_0/raster/r.clump/main.c	2014-10-04 18:48:38 UTC (rev 62176)
@@ -30,6 +30,7 @@
     struct Range range;
     struct History hist;
     CELL min, max;
+    int range_return, n_clumps;
     int in_fd, out_fd;
     char title[512];
     char name[GNAME_MAX];
@@ -105,7 +106,7 @@
 	Rast_put_cell_title(OUTPUT, title);
 
 	/* colors */
-	Rast_read_range(OUTPUT, G_mapset(), &range);
+	range_return = Rast_read_range(OUTPUT, G_mapset(), &range);
 	Rast_get_range_min_max(&range, &min, &max);
 	Rast_make_random_colors(&colr, min, max);
 	Rast_write_colors(OUTPUT, G_mapset(), &colr);
@@ -116,7 +117,8 @@
 	Rast_command_history(&hist);
 	Rast_write_history(OUTPUT, &hist);
 
-	G_done_msg(_n("%d clump.", "%d clumps.", range.max), range.max);
+	n_clumps = range_return == 2 ? 0 : range.max;
+	G_done_msg(_n("%d clump.", "%d clumps.", n_clumps), n_clumps);
     }
 
     exit(EXIT_SUCCESS);



More information about the grass-commit mailing list