[GRASS-SVN] r62170 - grass/trunk/raster/r.clump
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Oct 3 11:35:07 PDT 2014
Author: annakrat
Date: 2014-10-03 11:35:07 -0700 (Fri, 03 Oct 2014)
New Revision: 62170
Modified:
grass/trunk/raster/r.clump/main.c
Log:
r.clump: fix reporting number of clumps when map is empty
Modified: grass/trunk/raster/r.clump/main.c
===================================================================
--- grass/trunk/raster/r.clump/main.c 2014-10-03 17:49:38 UTC (rev 62169)
+++ grass/trunk/raster/r.clump/main.c 2014-10-03 18:35:07 UTC (rev 62170)
@@ -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];
@@ -108,7 +109,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);
@@ -119,7 +120,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