[GRASS-SVN] r40216 - in grass/trunk/lib: gpde ogsf rst/interp_float

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 4 09:47:50 EST 2010


Author: glynn
Date: 2010-01-04 09:47:50 -0500 (Mon, 04 Jan 2010)
New Revision: 40216

Modified:
   grass/trunk/lib/gpde/N_arrays_io.c
   grass/trunk/lib/ogsf/Gs3.c
   grass/trunk/lib/rst/interp_float/output2d.c
   grass/trunk/lib/rst/interp_float/resout2d.c
Log:
No need to check return value from Rast_open_* - part 2 - libraries


Modified: grass/trunk/lib/gpde/N_arrays_io.c
===================================================================
--- grass/trunk/lib/gpde/N_arrays_io.c	2010-01-04 14:39:31 UTC (rev 40215)
+++ grass/trunk/lib/gpde/N_arrays_io.c	2010-01-04 14:47:50 UTC (rev 40216)
@@ -53,9 +53,6 @@
     struct Cell_head region;
     N_array_2d *data = array;
 
-    if (NULL == G_find_raster2(name, ""))
-	G_fatal_error(_("Raster map <%s> not found"), name);
-
     /* Get the active region */
     G_get_set_window(&region);
 
@@ -64,9 +61,7 @@
     cols = region.cols;
 
     /*open the raster map */
-    map = Rast_open_old(name, G_find_raster2(name, ""));
-    if (map < 0)
-	G_fatal_error(_("Unable to open raster map <%s>"), name);
+    map = Rast_open_old(name, "");
 
     type = Rast_get_map_type(map);
 
@@ -200,8 +195,6 @@
 
     /*Open the new map */
     map = Rast_open_new(name, type);
-    if (map < 0)
-	G_fatal_error(_("Unable to create raster map <%s>"), name);
 
     if (type == CELL_TYPE)
 	rast = Rast_allocate_buf(type);

Modified: grass/trunk/lib/ogsf/Gs3.c
===================================================================
--- grass/trunk/lib/ogsf/Gs3.c	2010-01-04 14:39:31 UTC (rev 40215)
+++ grass/trunk/lib/ogsf/Gs3.c	2010-01-04 14:47:50 UTC (rev 40216)
@@ -134,9 +134,7 @@
 	G_fatal_error(_("Unable to allocate memory for a null buffer"));
     }
 
-    if ((cellfile = Rast_open_old(map_name, map_set)) == -1) {
-	G_fatal_error(_("Unable to open raster map <%s>"), map_name);
-    }
+    cellfile = Rast_open_old(map_name, map_set);
 
     G_message(_("Loading raster map <%s>..."),
 	      G_fully_qualified_name(map_name, map_set));
@@ -209,9 +207,7 @@
 	G_fatal_error(_("Unable to allocate memory for a null buffer"));
     }
 
-    if ((cellfile = Rast_open_old(map_name, map_set)) == -1) {
-	G_fatal_error(_("Unable to open raster map <%s>"), map_name);
-    }
+    cellfile = Rast_open_old(map_name, map_set);
 
     G_message(_("Loading raster map <%s>..."),
 	      G_fully_qualified_name(map_name, map_set));
@@ -367,9 +363,7 @@
 	G_fatal_error(_("Unable to allocate memory for a null buffer"));
     }
 
-    if ((cellfile = Rast_open_old(map_name, map_set)) == -1) {
-	G_fatal_error(_("Unable to open raster map <%s>"), map_name);
-    }
+    cellfile = Rast_open_old(map_name, map_set);
 
     tmp_buf = (int *)G_malloc(wind->cols * sizeof(int));	/* G_fatal_error */
     if (!tmp_buf) {
@@ -483,9 +477,7 @@
 	G_fatal_error(_("Unable to allocate memory for a null buffer"));
     }
 
-    if ((cellfile = Rast_open_old(map_name, map_set)) == -1) {
-	G_fatal_error(_("Unable to open raster map <%s>"), map_name);
-    }
+    cellfile = Rast_open_old(map_name, map_set);
 
     tmp_buf = (int *)G_malloc(wind->cols * sizeof(int));	/* G_fatal_error */
     if (!tmp_buf) {
@@ -574,9 +566,7 @@
 	return -1;
     }
 
-    if ((cellfile = Rast_open_old(map_name, map_set)) == -1) {
-	G_fatal_error(_("Unable to open raster map <%s>"), map_name);
-    }
+    cellfile = Rast_open_old(map_name, map_set);
 
     tmp_buf = (int *)G_malloc(wind->cols * sizeof(int));	/* G_fatal_error */
     if (!tmp_buf) {

Modified: grass/trunk/lib/rst/interp_float/output2d.c
===================================================================
--- grass/trunk/lib/rst/interp_float/output2d.c	2010-01-04 14:39:31 UTC (rev 40215)
+++ grass/trunk/lib/rst/interp_float/output2d.c	2010-01-04 14:47:50 UTC (rev 40216)
@@ -61,58 +61,23 @@
     /*
      * G_set_embedded_null_value_mode(1);
      */
-    if (params->elev != NULL) {
+    if (params->elev)
 	cf1 = Rast_open_fp_new(params->elev);
-	if (cf1 < 0) {
-	    G_warning(_("Unable to create raster map <%s>"), params->elev);
-	    return -1;
-	}
-    }
 
-    if (params->slope != NULL) {
+    if (params->slope)
 	cf2 = Rast_open_fp_new(params->slope);
-	if (cf2 < 0) {
-	    G_warning(_("Unable to create raster map <%s>"),
-		      params->slope);
-	    return -1;
-	}
-    }
 
-    if (params->aspect != NULL) {
+    if (params->aspect)
 	cf3 = Rast_open_fp_new(params->aspect);
-	if (cf3 < 0) {
-	    G_warning(_("Unable to create raster map <%s>"),
-		    params->aspect);
-	    return -1;
-	}
-    }
 
-    if (params->pcurv != NULL) {
+    if (params->pcurv)
 	cf4 = Rast_open_fp_new(params->pcurv);
-	if (cf4 < 0) {
-	    G_warning(_("Unable to create raster map <%s>"),
-		      params->pcurv);
-	    return -1;
-	}
-    }
 
-    if (params->tcurv != NULL) {
+    if (params->tcurv)
 	cf5 = Rast_open_fp_new(params->tcurv);
-	if (cf5 < 0) {
-	    G_warning(_("Unable to create raster map <%s>"),
-		      params->tcurv);
-	    return -1;
-	}
-    }
 
-    if (params->mcurv != NULL) {
+    if (params->mcurv)
 	cf6 = Rast_open_fp_new(params->mcurv);
-	if (cf6 < 0) {
-	    G_warning(_("Unable to create raster map <%s>"),
-		      params->mcurv);
-	    return -1;
-	}
-    }
 
     nrows = cellhd->rows;
     if (nrows != params->nsizr) {

Modified: grass/trunk/lib/rst/interp_float/resout2d.c
===================================================================
--- grass/trunk/lib/rst/interp_float/resout2d.c	2010-01-04 14:39:31 UTC (rev 40215)
+++ grass/trunk/lib/rst/interp_float/resout2d.c	2010-01-04 14:47:50 UTC (rev 40216)
@@ -66,59 +66,23 @@
 
     cell1 = Rast_allocate_f_buf();
 
-    if (params->elev != NULL) {
+    if (params->elev)
 	cf1 = Rast_open_fp_new(params->elev);
-	if (cf1 < 0) {
-	    G_warning(_("Unable to create raster map <%s>"),
-		      params->elev);
-	    return -1;
-	}
-    }
 
-    if (params->slope != NULL) {
+    if (params->slope)
 	cf2 = Rast_open_fp_new(params->slope);
-	if (cf2 < 0) {
-	    G_warning(_("Unable to create raster map <%s>"),
-		      params->elev);
-	    return -1;
-	}
-    }
 
-    if (params->aspect != NULL) {
+    if (params->aspect)
 	cf3 = Rast_open_fp_new(params->aspect);
-	if (cf3 < 0) {
-	    G_warning(_("Unable to create raster map <%s>"),
-		      params->elev);
-	    return -1;
-	}
-    }
 
-    if (params->pcurv != NULL) {
+    if (params->pcurv)
 	cf4 = Rast_open_fp_new(params->pcurv);
-	if (cf4 < 0) {
-	    G_warning(_("Unable to create raster map <%s>"),
-		      params->elev);
-	    return -1;
-	}
-    }
 
-    if (params->tcurv != NULL) {
+    if (params->tcurv)
 	cf5 = Rast_open_fp_new(params->tcurv);
-	if (cf5 < 0) {
-	    G_warning(_("Unable to create raster map <%s>"),
-		      params->elev);
-	    return -1;
-	}
-    }
 
-    if (params->mcurv != NULL) {
+    if (params->mcurv)
 	cf6 = Rast_open_fp_new(params->mcurv);
-	if (cf6 < 0) {
-	    G_warning(_("Unable to create raster map <%s>"),
-		      params->elev);
-	    return -1;
-	}
-    }
 
     nrows = outhd->rows;
     if (nrows != params->nsizr) {



More information about the grass-commit mailing list