[GRASS-SVN] r59082 - grass/trunk/raster/r.clump

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Feb 18 06:00:58 PST 2014


Author: mmetz
Date: 2014-02-18 06:00:57 -0800 (Tue, 18 Feb 2014)
New Revision: 59082

Modified:
   grass/trunk/raster/r.clump/clump.c
Log:
r.clump: fix r59076

Modified: grass/trunk/raster/r.clump/clump.c
===================================================================
--- grass/trunk/raster/r.clump/clump.c	2014-02-18 12:59:49 UTC (rev 59081)
+++ grass/trunk/raster/r.clump/clump.c	2014-02-18 14:00:57 UTC (rev 59082)
@@ -91,7 +91,7 @@
 	}
 
 	/* fake a previous row which is all zero */
-	G_zero(prev_in, len);
+	Rast_set_c_null_value(prev_in, ncols + 1);
 	G_zero(prev_clump, len);
 
 	/* create a left edge of zero */
@@ -104,8 +104,8 @@
 	G_message(_("Pass %d..."), pass);
 	for (row = 0; row < nrows; row++) {
 	    Rast_get_c_row(in_fd, cur_in + 1, row);
-	    
-	    G_percent(row+1, nrows, 2);
+
+	    G_percent(row, nrows, 4);
 	    X = 0;
 	    Rast_set_c_null_value(&X, 1);
 	    for (col = 1; col <= ncols; col++) {
@@ -221,10 +221,11 @@
 		temp_cell = out_cell;
 
 		for (column = 0; column < ncols; column++) {
-		    temp_cell++;	/* skip left edge */
-		    *temp_cell = index2[index[*temp_clump++]];
+		    temp_clump++;	/* skip left edge */
+		    *temp_cell = index2[index[*temp_clump]];
 		    if (*temp_cell == 0)
 			Rast_set_null_value(temp_cell, 1, CELL_TYPE);
+		    temp_cell++;
 		}
 		Rast_put_row(out_fd, out_cell, CELL_TYPE);
 	    }
@@ -238,6 +239,7 @@
 	    cur_clump = prev_clump;
 	    prev_clump = temp_clump;
 	}
+	G_percent(1, 1, 1);
 
 	print_time(&cur_time);
     }



More information about the grass-commit mailing list