[GRASS-SVN] r44645 - grass/trunk/raster/r.thin

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 21 12:32:55 EST 2010


Author: mmetz
Date: 2010-12-21 09:32:55 -0800 (Tue, 21 Dec 2010)
New Revision: 44645

Modified:
   grass/trunk/raster/r.thin/io.c
Log:
fix for Rast_get_c_row() replacing G_get_map_row()

Modified: grass/trunk/raster/r.thin/io.c
===================================================================
--- grass/trunk/raster/r.thin/io.c	2010-12-21 15:33:49 UTC (rev 44644)
+++ grass/trunk/raster/r.thin/io.c	2010-12-21 17:32:55 UTC (rev 44645)
@@ -108,7 +108,8 @@
 	G_fatal_error(_("%s: Unable to create temporary file <%s> -- errno = %d"),
 		      error_prefix, work_file_name, errno);
     }
-    buf = (CELL *) G_malloc(buf_len = n_cols * sizeof(CELL));
+    buf_len = n_cols * sizeof(CELL);
+    buf = (CELL *) G_malloc(buf_len);
     for (col = 0; col < n_cols; col++)
 	buf[col] = 0;
     for (i = 0; i < PAD; i++) {
@@ -120,6 +121,10 @@
     }
     for (row = 0; row < n_rows; row++) {
 	Rast_get_c_row(cell_file, buf + PAD, row);
+	for (col = 0; col < n_cols; col++) {
+	    if (Rast_is_c_null_value(&buf[col]))
+		buf[col] = 0;
+	}
 	if (write(work_file, buf, buf_len) != buf_len) {
 	    unlink(work_file_name);
 	    G_fatal_error(_("%s: Error writing temporary file"),



More information about the grass-commit mailing list