ソースを参照

r.clump: fix https://trac.osgeo.org/grass/changeset/59076

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@59082 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 11 年 前
コミット
87ccd1ed19
1 ファイル変更7 行追加5 行削除
  1. 7 5
      raster/r.clump/clump.c

+ 7 - 5
raster/r.clump/clump.c

@@ -91,7 +91,7 @@ CELL clump(int in_fd, int out_fd)
 	}
 
 	/* 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 @@ CELL clump(int in_fd, int out_fd)
 	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 @@ CELL clump(int in_fd, int out_fd)
 		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 @@ CELL clump(int in_fd, int out_fd)
 	    cur_clump = prev_clump;
 	    prev_clump = temp_clump;
 	}
+	G_percent(1, 1, 1);
 
 	print_time(&cur_time);
     }