[GRASS-SVN] r65261 - grass/branches/releasebranch_7_0/raster/r.surf.idw

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 17 05:42:33 PDT 2015


Author: neteler
Date: 2015-05-17 05:42:33 -0700 (Sun, 17 May 2015)
New Revision: 65261

Modified:
   grass/branches/releasebranch_7_0/raster/r.surf.idw/main.c
Log:
r.surf.idw: exit with fatal error in case of FCELL or DCELL input; backport of r65214 (trac #2671, #2672)

Modified: grass/branches/releasebranch_7_0/raster/r.surf.idw/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.surf.idw/main.c	2015-05-17 12:40:42 UTC (rev 65260)
+++ grass/branches/releasebranch_7_0/raster/r.surf.idw/main.c	2015-05-17 12:42:33 UTC (rev 65261)
@@ -95,6 +95,7 @@
 	struct Flag *e;
     } flag;
     int n, fd, maskfd;
+    int cell_type;
 
     /* Initialize the GIS calls                                     */
     G_gisinit(argv[0]);
@@ -158,6 +159,10 @@
     /*  Open input cell layer for reading                           */
     fd = Rast_open_old(input, "");
 
+    cell_type = Rast_get_map_type(fd);
+    if (cell_type != CELL_TYPE)
+        G_fatal_error(_("This module currently only works for integer (CELL) maps"));
+
     /* Store input data in array-indexed doubly-linked lists and close input file */
     rowlist = row_lists(nrows, ncols, &datarows, &n, fd, cell);
     Rast_close(fd);
@@ -712,7 +717,7 @@
 	Rast_get_c_row_nomask(fd, cell, row);
 
 	for (col = 0; col < cols; col++) {
-	    if (cell[col] != 0) {
+	    if (!Rast_is_c_null_value(&cell[col])) {
 		++(*npts);
 		Mptr = (MELEMENT *) G_malloc(sizeof(MELEMENT));
 		Mptr->x = col;



More information about the grass-commit mailing list