[GRASS-SVN] r49417 - grass/trunk/lib/rst/interp_float

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Nov 29 03:52:29 EST 2011


Author: mmetz
Date: 2011-11-29 00:52:29 -0800 (Tue, 29 Nov 2011)
New Revision: 49417

Modified:
   grass/trunk/lib/rst/interp_float/output2d.c
Log:
rst lib: valid file desriptors are non-negative, zero is fine

Modified: grass/trunk/lib/rst/interp_float/output2d.c
===================================================================
--- grass/trunk/lib/rst/interp_float/output2d.c	2011-11-29 07:42:42 UTC (rev 49416)
+++ grass/trunk/lib/rst/interp_float/output2d.c	2011-11-29 08:52:29 UTC (rev 49417)
@@ -59,7 +59,7 @@
  */
 {
     FCELL *cell1;
-    int cf1 = 0, cf2 = 0, cf3 = 0, cf4 = 0, cf5 = 0, cf6 = 0;
+    int cf1 = -1, cf2 = -1, cf3 = -1, cf4 = -1, cf5 = -1, cf6 = -1;
     int nrows, ncols;
     int i, ii;
     double zstep;
@@ -84,22 +84,22 @@
      * G_set_embedded_null_value_mode(1);
      */
     if (params->elev)
-	cf1 = Rast_open_fp_new(params->elev);
+	cf1 = Rast_open_new(params->elev, FCELL_TYPE);
 
     if (params->slope)
-	cf2 = Rast_open_fp_new(params->slope);
+	cf2 = Rast_open_new(params->slope, FCELL_TYPE);
 
     if (params->aspect)
-	cf3 = Rast_open_fp_new(params->aspect);
+	cf3 = Rast_open_new(params->aspect, FCELL_TYPE);
 
     if (params->pcurv)
-	cf4 = Rast_open_fp_new(params->pcurv);
+	cf4 = Rast_open_new(params->pcurv, FCELL_TYPE);
 
     if (params->tcurv)
-	cf5 = Rast_open_fp_new(params->tcurv);
+	cf5 = Rast_open_new(params->tcurv, FCELL_TYPE);
 
     if (params->mcurv)
-	cf6 = Rast_open_fp_new(params->mcurv);
+	cf6 = Rast_open_new(params->mcurv, FCELL_TYPE);
 
     nrows = cellhd->rows;
     if (nrows != params->nsizr) {
@@ -186,17 +186,17 @@
 	}
     }
 
-    if (cf1)
+    if (cf1 >= 0)
 	Rast_close(cf1);
-    if (cf2)
+    if (cf2 >= 0)
 	Rast_close(cf2);
-    if (cf3)
+    if (cf3 >= 0)
 	Rast_close(cf3);
-    if (cf4)
+    if (cf4 >= 0)
 	Rast_close(cf4);
-    if (cf5)
+    if (cf5 >= 0)
 	Rast_close(cf5);
-    if (cf6)
+    if (cf6 >= 0)
 	Rast_close(cf6);
 
 



More information about the grass-commit mailing list