[GRASS-SVN] r40217 - in grass/trunk: display/d.rast.arrow display/d.rast.num display/d.title display/d.zoom doc/raster/r.example general/g.region imagery/i.albedo imagery/i.class imagery/i.eb.h_SEBAL01 imagery/i.evapo.time_integration imagery/i.latlong imagery/i.modis.qc imagery/i.points imagery/i.rectify imagery/i.vpoints include lib/gpde lib/raster raster/r.bitpattern raster/r.category raster/r.compress raster/r.describe raster/r.flow raster/r.info raster/r.li/r.li.cwed raster/r.li/r.li.daemon raster/r.li/r.li.dominance raster/r.li/r.li.edgedensity raster/r.li/r.li.mpa raster/r.li/r.li.mps raster/r.li/r.li.padcv raster/r.li/r.li.padrange raster/r.li/r.li.padsd raster/r.li/r.li.patchdensity raster/r.li/r.li.patchnum raster/r.li/r.li.richness raster/r.li/r.li.shannon raster/r.li/r.li.shape raster/r.li/r.li.simpson raster/r.los raster/r.mapcalc raster/r.neighbors raster/r.null raster/r.out.tiff raster/r.recode raster/r.region raster/r.resamp.rst raster/r.resample raster/r.slope.aspect raster/r.support raster/r.support.stats raster/r.texture raster/r.to.rast3 raster/r.to.rast3elev raster/r.topidx raster/r.water.outlet raster/r.watershed/ram raster/r.watershed/seg raster3d/r3.cross.rast raster3d/r3.out.vtk raster3d/r3.to.rast

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 4 10:51:47 EST 2010


Author: glynn
Date: 2010-01-04 10:51:45 -0500 (Mon, 04 Jan 2010)
New Revision: 40217

Modified:
   grass/trunk/display/d.rast.arrow/main.c
   grass/trunk/display/d.rast.num/main.c
   grass/trunk/display/d.title/main.c
   grass/trunk/display/d.zoom/main.c
   grass/trunk/doc/raster/r.example/main.c
   grass/trunk/general/g.region/main.c
   grass/trunk/imagery/i.albedo/main.c
   grass/trunk/imagery/i.class/main.c
   grass/trunk/imagery/i.class/signature.c
   grass/trunk/imagery/i.eb.h_SEBAL01/main.c
   grass/trunk/imagery/i.evapo.time_integration/main.c
   grass/trunk/imagery/i.latlong/main.c
   grass/trunk/imagery/i.modis.qc/main.c
   grass/trunk/imagery/i.points/cell.c
   grass/trunk/imagery/i.points/main.c
   grass/trunk/imagery/i.rectify/main.c
   grass/trunk/imagery/i.rectify/rectify.c
   grass/trunk/imagery/i.vpoints/cell.c
   grass/trunk/imagery/i.vpoints/main.c
   grass/trunk/include/rasterdefs.h
   grass/trunk/lib/gpde/N_arrays_io.c
   grass/trunk/lib/raster/auto_mask.c
   grass/trunk/lib/raster/closecell.c
   grass/trunk/lib/raster/get_cellhd.c
   grass/trunk/lib/raster/opencell.c
   grass/trunk/raster/r.bitpattern/main.c
   grass/trunk/raster/r.category/cats.c
   grass/trunk/raster/r.compress/main.c
   grass/trunk/raster/r.describe/describe.c
   grass/trunk/raster/r.flow/io.c
   grass/trunk/raster/r.info/main.c
   grass/trunk/raster/r.li/r.li.cwed/cwed.c
   grass/trunk/raster/r.li/r.li.daemon/daemon.c
   grass/trunk/raster/r.li/r.li.daemon/worker.c
   grass/trunk/raster/r.li/r.li.dominance/dominance.c
   grass/trunk/raster/r.li/r.li.edgedensity/edgedensity.c
   grass/trunk/raster/r.li/r.li.mpa/mpa.c
   grass/trunk/raster/r.li/r.li.mps/mps.c
   grass/trunk/raster/r.li/r.li.padcv/padcv.c
   grass/trunk/raster/r.li/r.li.padrange/padrange.c
   grass/trunk/raster/r.li/r.li.padsd/padsd.c
   grass/trunk/raster/r.li/r.li.patchdensity/main.c
   grass/trunk/raster/r.li/r.li.patchnum/main.c
   grass/trunk/raster/r.li/r.li.richness/richness.c
   grass/trunk/raster/r.li/r.li.shannon/shannon.c
   grass/trunk/raster/r.li/r.li.shape/main.c
   grass/trunk/raster/r.li/r.li.simpson/simpson.c
   grass/trunk/raster/r.los/main.c
   grass/trunk/raster/r.mapcalc/map.c
   grass/trunk/raster/r.neighbors/main.c
   grass/trunk/raster/r.null/main.c
   grass/trunk/raster/r.out.tiff/main.c
   grass/trunk/raster/r.recode/recode.c
   grass/trunk/raster/r.region/main.c
   grass/trunk/raster/r.resamp.rst/main.c
   grass/trunk/raster/r.resample/main.c
   grass/trunk/raster/r.slope.aspect/main.c
   grass/trunk/raster/r.support.stats/histo.c
   grass/trunk/raster/r.support/histo.c
   grass/trunk/raster/r.support/main.c
   grass/trunk/raster/r.texture/main.c
   grass/trunk/raster/r.to.rast3/main.c
   grass/trunk/raster/r.to.rast3elev/main.c
   grass/trunk/raster/r.topidx/file_io.c
   grass/trunk/raster/r.water.outlet/main.c
   grass/trunk/raster/r.watershed/ram/close_maps.c
   grass/trunk/raster/r.watershed/seg/close_maps.c
   grass/trunk/raster3d/r3.cross.rast/main.c
   grass/trunk/raster3d/r3.out.vtk/errorHandling.c
   grass/trunk/raster3d/r3.out.vtk/main.c
   grass/trunk/raster3d/r3.to.rast/main.c
Log:
Rast_close, Rast_unopen, Rast_get_cellhd now generate errors rather than returning a status



Modified: grass/trunk/display/d.rast.arrow/main.c
===================================================================
--- grass/trunk/display/d.rast.arrow/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/display/d.rast.arrow/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -231,8 +231,7 @@
     if (align->answer) {
 	struct Cell_head wind;
 
-	if (Rast_get_cellhd(layer_name, "", &wind) < 0)
-	    G_fatal_error(_("Unable to read header of raster map <%s>"), layer_name);
+	Rast_get_cellhd(layer_name, "", &wind);
 
 	/* expand window extent by one wind resolution */
 	wind.west += wind.ew_res * ((int)((window.west - wind.west) / wind.ew_res) - (window.west < wind.west));

Modified: grass/trunk/display/d.rast.num/main.c
===================================================================
--- grass/trunk/display/d.rast.num/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/display/d.rast.num/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -139,8 +139,7 @@
     if (align->answer) {
 	struct Cell_head wind;
 
-	if (Rast_get_cellhd(map_name, "", &wind) < 0)
-	    G_fatal_error(_("Unable to read header of raster map <%s>"), map_name);
+	Rast_get_cellhd(map_name, "", &wind);
 
 	/* expand window extent by one wind resolution */
 	wind.west += wind.ew_res * ((int)((window.west - wind.west) / wind.ew_res) - (window.west < wind.west));

Modified: grass/trunk/display/d.title/main.c
===================================================================
--- grass/trunk/display/d.title/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/display/d.title/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -103,9 +103,7 @@
     if (!strlen(map_name))
 	G_fatal_error(_("No map name given"));
 
-    if (Rast_get_cellhd(map_name, "", &window) == -1)
-	G_fatal_error(_("Unable to read header of raster map <%s>"),
-		      map_name);
+    Rast_get_cellhd(map_name, "", &window);
 
     if (Rast_read_cats(map_name, "", &cats) == -1)
 	G_fatal_error(_("Unable to read category file of raster map <%s>"),

Modified: grass/trunk/display/d.zoom/main.c
===================================================================
--- grass/trunk/display/d.zoom/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/display/d.zoom/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -137,7 +137,8 @@
 	nrasts = i;
 
 	for (i = 0; i < nrasts; i++) {
-	    if (Rast_get_cellhd(rast[i], "", &window) >= 0) {
+	    Rast_get_cellhd(rast[i], "", &window);
+	    {
 		if (first) {
 		    first = 0;
 		    U_east = window.east;

Modified: grass/trunk/doc/raster/r.example/main.c
===================================================================
--- grass/trunk/doc/raster/r.example/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/doc/raster/r.example/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -111,8 +111,7 @@
     infd = Rast_open_old(name, mapset);
 
     /* controlling, if we can open input raster */
-    if (Rast_get_cellhd(name, mapset, &cellhd) < 0)
-	G_fatal_error(_("Unable to read file header of <%s>"), name);
+    Rast_get_cellhd(name, mapset, &cellhd);
 
     G_debug(3, "number of rows %d", cellhd.rows);
 

Modified: grass/trunk/general/g.region/main.c
===================================================================
--- grass/trunk/general/g.region/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/general/g.region/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -453,9 +453,7 @@
 	    mapset = G_find_raster2(rast_name, "");
 	    if (!mapset)
 		G_fatal_error(_("Raster map <%s> not found"), rast_name);
-	    if (Rast_get_cellhd(rast_name, mapset, &temp_window) < 0)
-		G_fatal_error(_("Unable to read header of raster map <%s@%s>"),
-			      rast_name, mapset);
+	    Rast_get_cellhd(rast_name, mapset, &temp_window);
 	    if (!first) {
 		G_copy(&window, &temp_window, sizeof(window));
 		first = 1;
@@ -787,9 +785,7 @@
 	mapset = G_find_raster2(name, "");
 	if (!mapset)
 	    G_fatal_error(_("Raster map <%s> not found"), name);
-	if (Rast_get_cellhd(name, mapset, &temp_window) < 0)
-	    G_fatal_error(_("Unable to read header of raster map <%s@%s>"),
-			  name, mapset);
+	Rast_get_cellhd(name, mapset, &temp_window);
 	if ((err = G_align_window(&window, &temp_window)))
 	    G_fatal_error(_("Raster map <%s@%s>: %s"), name, mapset, err);
     }

Modified: grass/trunk/imagery/i.albedo/main.c
===================================================================
--- grass/trunk/imagery/i.albedo/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/imagery/i.albedo/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -154,8 +154,7 @@
 	in_data_type[nfiles] = Rast_map_type(name, "");
 	infd[nfiles] = Rast_open_old(name, "");
 
-	if ((Rast_get_cellhd(name, "", &cellhd)) < 0)
-	    G_fatal_error(_("Unable to read header of raster map <%s>"), name);
+	Rast_get_cellhd(name, "", &cellhd);
 
 	inrast[nfiles] = Rast_allocate_buf(in_data_type[nfiles]);
 	nfiles++;

Modified: grass/trunk/imagery/i.class/main.c
===================================================================
--- grass/trunk/imagery/i.class/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/imagery/i.class/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -161,8 +161,7 @@
     display_title(VIEW_MAP1);
 
     mapset = G_find_raster(bg_map->answer, "");
-    if (Rast_get_cellhd(bg_map->answer, mapset, &cellhd) != 0)
-	G_fatal_error(_("Raster map <%s> not found"), bg_map->answer);
+    Rast_get_cellhd(bg_map->answer, mapset, &cellhd);
 
     G_adjust_window_to_box(&cellhd, &VIEW_MAP1->cell.head, VIEW_MAP1->nrows,
 			   VIEW_MAP1->ncols);
@@ -265,9 +264,7 @@
 	G_fatal_error(_("The subgroup must have at least 2 files to run"));
     }
 
-    if (Rast_get_cellhd(Refer.file[0].name, Refer.file[0].mapset, &Band_cellhd)
-	!= 0)
-	G_fatal_error(_("Unable to read cell header for first band file"));
+    Rast_get_cellhd(Refer.file[0].name, Refer.file[0].mapset, &Band_cellhd);
 
     /* allocate space for signature routines */
     init_sig_routines((size_t) Refer.nfiles);

Modified: grass/trunk/imagery/i.class/signature.c
===================================================================
--- grass/trunk/imagery/i.class/signature.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/imagery/i.class/signature.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -304,8 +304,8 @@
     Rast_write_colors(MASK, G_mapset(), &mask_colors);
 
     /* display new mask */
-    if (Rast_get_cellhd(MASK, G_mapset(), &cellhd) != 0)
-	G_fatal_error(_("Did not find input cell map MASK."));
+    Rast_get_cellhd(MASK, G_mapset(), &cellhd);
+
     G_adjust_window_to_box(&cellhd, &VIEW_MASK1->cell.head, VIEW_MASK1->nrows,
 			   VIEW_MASK1->ncols);
     draw_cell(VIEW_MASK1, OVER_LAY);

Modified: grass/trunk/imagery/i.eb.h_SEBAL01/main.c
===================================================================
--- grass/trunk/imagery/i.eb.h_SEBAL01/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/imagery/i.eb.h_SEBAL01/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -209,14 +209,10 @@
     infd_z0m = Rast_open_old(z0m, "");
     infd_t0dem = Rast_open_old(t0dem, "");
 
-    if (Rast_get_cellhd(Rn, "", &cellhd) < 0)
-	G_fatal_error(_("Unable to read header of raster map <%s>"), Rn);
-    if (Rast_get_cellhd(g0, "", &cellhd) < 0)
-	G_fatal_error(_("Unable to read header of raster map <%s>"), g0);
-    if (Rast_get_cellhd(z0m, "", &cellhd) < 0)
-	G_fatal_error(_("Unable to read header of raster map <%s>"), z0m);
-    if (Rast_get_cellhd(t0dem, "", &cellhd) < 0)
-	G_fatal_error(_("Unable to read header of raster map <%s>"), t0dem);
+    Rast_get_cellhd(Rn, "", &cellhd);
+    Rast_get_cellhd(g0, "", &cellhd);
+    Rast_get_cellhd(z0m, "", &cellhd);
+    Rast_get_cellhd(t0dem, "", &cellhd);
 
     /* Allocate input buffer */
     inrast_Rn = Rast_allocate_d_buf();
@@ -243,8 +239,7 @@
     /***************************************************/
     outrast = Rast_allocate_d_buf();
 
-    if ((outfd = Rast_open_new(h0, DCELL_TYPE)) < 0)
-	G_fatal_error(_("Unable to create raster map <%s>"), h0);
+    outfd = Rast_open_new(h0, DCELL_TYPE);
 
     /***************************************************/
     /* Allocate memory for temporary images            */

Modified: grass/trunk/imagery/i.evapo.time_integration/main.c
===================================================================
--- grass/trunk/imagery/i.evapo.time_integration/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/imagery/i.evapo.time_integration/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -168,8 +168,7 @@
 	/* Allocate input buffer */
 	in_data_type[nfiles] = Rast_map_type(name, mapset);
 	infd[nfiles] = Rast_open_old(name, mapset);
-	if ((Rast_get_cellhd(name, mapset, &cellhd)) < 0)
-	    G_fatal_error(_("Unable to read file header of raster map <%s>"), name);
+	Rast_get_cellhd(name, mapset, &cellhd);
 	inrast[nfiles] = Rast_allocate_buf(in_data_type[nfiles]);
 	nfiles++;
     }
@@ -195,8 +194,7 @@
 	/* Allocate input buffer */
 	in_data_type1[nfiles1] = Rast_map_type(name1, mapset);
 	infd1[nfiles1] = Rast_open_old(name1, mapset);
-	if ((Rast_get_cellhd(name1, mapset, &cellhd)) < 0)
-	    G_fatal_error(_("Unable to read file header of raster map <%s>"), name1);
+	Rast_get_cellhd(name1, mapset, &cellhd);
 	inrast1[nfiles1] = Rast_allocate_buf(in_data_type1[nfiles1]);
 	nfiles1++;
     }
@@ -228,8 +226,7 @@
 	/* Allocate input buffer */
 	in_data_type2[nfiles2] = Rast_map_type(name2, mapset);
 	infd2[nfiles2] = Rast_open_old(name2, mapset);
-	if ((Rast_get_cellhd(name2, mapset, &cellhd)) < 0)
-	    G_fatal_error(_("Unable to read file header of raster map <%s>"), name2);
+	Rast_get_cellhd(name2, mapset, &cellhd);
 	inrast2[nfiles2] = Rast_allocate_d_buf();
 	nfiles2++;
     }

Modified: grass/trunk/imagery/i.latlong/main.c
===================================================================
--- grass/trunk/imagery/i.latlong/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/imagery/i.latlong/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -79,8 +79,7 @@
 
     /***************************************************/ 
     infd = Rast_open_old(in, "");
-    if (Rast_get_cellhd(in, "", &cellhd) < 0)
-	G_fatal_error(_("Cannot read file header of [%s])"), in);
+    Rast_get_cellhd(in, "", &cellhd);
     inrast = Rast_allocate_d_buf();
     
     /***************************************************/ 

Modified: grass/trunk/imagery/i.modis.qc/main.c
===================================================================
--- grass/trunk/imagery/i.modis.qc/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/imagery/i.modis.qc/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -199,8 +199,7 @@
 
     infd = Rast_open_old(qcchan, "");
 
-    if (Rast_get_cellhd(qcchan, "", &cellhd) < 0)
-	G_fatal_error(_("Unable to read header of raster map <%s> "), qcchan);
+    Rast_get_cellhd(qcchan, "", &cellhd);
 
     inrast = Rast_allocate_c_buf();
 

Modified: grass/trunk/imagery/i.points/cell.c
===================================================================
--- grass/trunk/imagery/i.points/cell.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/imagery/i.points/cell.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -41,8 +41,7 @@
     if (x > VIEW_MAP1->left && x < VIEW_MAP1->right) {
 	if (!choose_groupfile(name, mapset))
 	    return 1;
-	if (Rast_get_cellhd(name, mapset, &cellhd) < 0)
-	    return 1;
+	Rast_get_cellhd(name, mapset, &cellhd);
 
 	Erase_view(VIEW_MAP1_ZOOM);
 	VIEW_MAP1_ZOOM->cell.configured = 0;
@@ -57,10 +56,7 @@
 	    return 1;
 	select_target_env();
 
-	if (Rast_get_cellhd(name, mapset, &cellhd) < 0) {
-	    select_current_env();
-	    return 1;
-	}
+	Rast_get_cellhd(name, mapset, &cellhd);
 
 	Erase_view(VIEW_MAP2_ZOOM);
 	VIEW_MAP2_ZOOM->cell.configured = 0;

Modified: grass/trunk/imagery/i.points/main.c
===================================================================
--- grass/trunk/imagery/i.points/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/imagery/i.points/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -185,7 +185,8 @@
 	    quit(0);
 	/* display this file in "map1" */
     }
-    while (Rast_get_cellhd(name, mapset, &cellhd) < 0);
+    while (!G_find_raster2(name, mapset));
+    Rast_get_cellhd(name, mapset, &cellhd);
     G_adjust_window_to_box(&cellhd, &VIEW_MAP1->cell.head, VIEW_MAP1->nrows,
 			   VIEW_MAP1->ncols);
     Configure_view(VIEW_MAP1, name, mapset, cellhd.ns_res, cellhd.ew_res);

Modified: grass/trunk/imagery/i.rectify/main.c
===================================================================
--- grass/trunk/imagery/i.rectify/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/imagery/i.rectify/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -191,18 +191,11 @@
     }
     else {
 	/* Calculate smallest region */
-	if (a->answer) {
-	    if (Rast_get_cellhd(ref.file[0].name, ref.file[0].mapset, &cellhd) <
-		0)
-		G_fatal_error(_("Unable to read header of raster map <%s>"),
-			      ref.file[0].name);
-	}
-	else {
-	    if (Rast_get_cellhd(ifile->answers[0], ref.file[0].mapset, &cellhd) <
-		0)
-		G_fatal_error(_("Unable to read header of raster map <%s>"),
-			      ifile->answers[0]);
-	}
+	if (a->answer)
+	    Rast_get_cellhd(ref.file[0].name, ref.file[0].mapset, &cellhd);
+	else
+	    Rast_get_cellhd(ifile->answers[0], ref.file[0].mapset, &cellhd);
+
 	georef_window(&cellhd, &target_window, order);
     }
 

Modified: grass/trunk/imagery/i.rectify/rectify.c
===================================================================
--- grass/trunk/imagery/i.rectify/rectify.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/imagery/i.rectify/rectify.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -20,8 +20,7 @@
     void *rast;
 
     select_current_env();
-    if (Rast_get_cellhd(name, mapset, &cellhd) < 0)
-	return 0;
+    Rast_get_cellhd(name, mapset, &cellhd);
 
     /* open the result file into target window
      * this open must be first since we change the window later

Modified: grass/trunk/imagery/i.vpoints/cell.c
===================================================================
--- grass/trunk/imagery/i.vpoints/cell.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/imagery/i.vpoints/cell.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -41,8 +41,7 @@
     if (x > VIEW_MAP1->left && x < VIEW_MAP1->right) {
 	if (!choose_groupfile(name, mapset))
 	    return 1;
-	if (Rast_get_cellhd(name, mapset, &cellhd) < 0)
-	    return 1;
+	Rast_get_cellhd(name, mapset, &cellhd);
 
 	Erase_view(VIEW_MAP1_ZOOM);
 	VIEW_MAP1_ZOOM->cell.configured = 0;
@@ -57,10 +56,7 @@
 	    return 1;
 	select_target_env();
 
-	if (Rast_get_cellhd(name, mapset, &cellhd) < 0) {
-	    select_current_env();
-	    return 1;
-	}
+	Rast_get_cellhd(name, mapset, &cellhd);
 
 	Erase_view(VIEW_MAP2_ZOOM);
 	VIEW_MAP2_ZOOM->cell.configured = 0;

Modified: grass/trunk/imagery/i.vpoints/main.c
===================================================================
--- grass/trunk/imagery/i.vpoints/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/imagery/i.vpoints/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -181,7 +181,8 @@
 	    quit(0);
 	/* display this file in "map1" */
     }
-    while (Rast_get_cellhd(name, mapset, &cellhd) < 0);
+    while (!G_find_raster2(name, mapset));
+    Rast_get_cellhd(name, mapset, &cellhd);
 
     G_adjust_window_to_box(&cellhd, &VIEW_MAP1->cell.head, VIEW_MAP1->nrows,
 			   VIEW_MAP1->ncols);

Modified: grass/trunk/include/rasterdefs.h
===================================================================
--- grass/trunk/include/rasterdefs.h	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/include/rasterdefs.h	2010-01-04 15:51:45 UTC (rev 40217)
@@ -82,8 +82,8 @@
 			  void (*)(CELL, CELL, CELL));
 
 /* closecell.c */
-int Rast_close(int);
-int Rast_unopen(int);
+void Rast_close(int);
+void Rast_unopen(int);
 
 /* color_compat.c */
 void Rast_make_ryg_colors(struct Colors *, CELL, CELL);
@@ -294,7 +294,7 @@
 int Rast_close_gdal_write_link(struct GDAL_link *);
 
 /* get_cellhd.c */
-int Rast_get_cellhd(const char *, const char *, struct Cell_head *);
+void Rast_get_cellhd(const char *, const char *, struct Cell_head *);
 
 /* get_row.c */
 int Rast_get_row_nomask(int, void *, int, RASTER_MAP_TYPE);

Modified: grass/trunk/lib/gpde/N_arrays_io.c
===================================================================
--- grass/trunk/lib/gpde/N_arrays_io.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/lib/gpde/N_arrays_io.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -154,8 +154,7 @@
     }
 
     /* Close file */
-    if (Rast_close(map) < 0)
-	G_fatal_error(_("Unable to close input map"));
+    Rast_close(map);
 
     return data;
 }
@@ -234,11 +233,7 @@
     }
 
     /* Close file */
-    if (Rast_close(map) < 0)
-	G_fatal_error(_("Unable to close input map"));
-
-    return;
-
+    Rast_close(map);
 }
 
 

Modified: grass/trunk/lib/raster/auto_mask.c
===================================================================
--- grass/trunk/lib/raster/auto_mask.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/lib/raster/auto_mask.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -55,11 +55,10 @@
 	return 0;
 
     /* check MASK projection/zone against current region */
-    if (Rast_get_cellhd("MASK", G_mapset(), &cellhd) >= 0) {
-	if (cellhd.zone != G_zone() || cellhd.proj != G_projection()) {
-	    R__.auto_mask = 0;
-	    return 0;
-	}
+    Rast_get_cellhd("MASK", G_mapset(), &cellhd);
+    if (cellhd.zone != G_zone() || cellhd.proj != G_projection()) {
+	R__.auto_mask = 0;
+	return 0;
     }
 
     Rast_unopen(R__.mask_fd);

Modified: grass/trunk/lib/raster/closecell.c
===================================================================
--- grass/trunk/lib/raster/closecell.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/lib/raster/closecell.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -67,16 +67,17 @@
  * \return -1 on error
  * \return 1 on success
  */
-int Rast_close(int fd)
+void Rast_close(int fd)
 {
     struct fileinfo *fcb = &R__.fileinfo[fd];
 
     if (fd < 0 || fd >= R__.fileinfo_count || fcb->open_mode <= 0)
-	return -1;
+	G_fatal_error(_("Invalid descriptor: %d"), fd);
+
     if (fcb->open_mode == OPEN_OLD)
-	return close_old(fd);
-
-    return close_new(fd, 1);
+	close_old(fd);
+    else
+	close_new(fd, 1);
 }
 
 /*!
@@ -100,16 +101,17 @@
  * \return -1 on error
  * \return 1 on success
  */
-int Rast_unopen(int fd)
+void Rast_unopen(int fd)
 {
     struct fileinfo *fcb = &R__.fileinfo[fd];
 
     if (fd < 0 || fd >= R__.fileinfo_count || fcb->open_mode <= 0)
-	return -1;
+	G_fatal_error(_("Invalid descriptor: %d"), fd);
+
     if (fcb->open_mode == OPEN_OLD)
-	return close_old(fd);
+	close_old(fd);
     else
-	return close_new(fd, 0);
+	close_new(fd, 0);
 }
 
 static int close_old(int fd)

Modified: grass/trunk/lib/raster/get_cellhd.c
===================================================================
--- grass/trunk/lib/raster/get_cellhd.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/lib/raster/get_cellhd.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -39,17 +39,14 @@
    \param mapset mapset that map belongs to
    \param[out] cellhd structure to hold cell header info
 
-   \return 0 on success
-   \return -1 on error
+   \return void
  */
-int Rast_get_cellhd(const char *name, const char *mapset,
-		    struct Cell_head *cellhd)
+void Rast_get_cellhd(const char *name, const char *mapset,
+		     struct Cell_head *cellhd)
 {
-    FILE *fd;
+    FILE *fp;
     int is_reclass;
     char real_name[GNAME_MAX], real_mapset[GMAPSET_MAX];
-    char buf[1024];
-    char *tail;
 
     /*
        is_reclass = Rast_is_reclass (name, mapset, real_name, real_mapset);
@@ -64,34 +61,22 @@
      */
     is_reclass = (Rast_is_reclass(name, mapset, real_name, real_mapset) > 0);
     if (is_reclass) {
-	fd = G_fopen_old("cellhd", real_name, real_mapset);
-	if (fd == NULL) {
-	    sprintf(buf,
-		    _("Unable to read header file for raster map <%s@%s>."),
-		    name, mapset);
-	    tail = buf + strlen(buf);
-	    sprintf(tail, _(" It is a reclass of raster map <%s@%s> "),
-		    real_name, real_mapset);
-	    tail = buf + strlen(buf);
-	    if (!G_find_raster(real_name, real_mapset))
-		sprintf(tail, _("which is missing."));
-	    else
-		sprintf(tail, _("whose header file can't be opened."));
-	    G_warning("%s", buf);
-	    return -1;
-	}
+	fp = G_fopen_old("cellhd", real_name, real_mapset);
+	if (!fp)
+	    G_fatal_error(_("Unable to read header file for raster map <%s@%s>."
+			    "It is a reclass of raster map <%s@%s> %s"),
+			  name, mapset, real_name, real_mapset,
+			  !G_find_raster(real_name, real_mapset)
+			  ? _("which is missing.")
+			  : _("whose header file can't be opened."));
     }
     else {
-	fd = G_fopen_old("cellhd", name, mapset);
-	if (fd == NULL) {
-	    G_warning(_("Unable to open header file for raster map <%s@%s>"),
-		      name, mapset);
-	    return -1;
-	}
+	fp = G_fopen_old("cellhd", name, mapset);
+	if (!fp)
+	    G_fatal_error(_("Unable to open header file for raster map <%s@%s>"),
+			  name, mapset);
     }
 
-    G__read_Cell_head(fd, cellhd, 1);
-    fclose(fd);
-
-    return 0;
+    G__read_Cell_head(fp, cellhd, 1);
+    fclose(fp);
 }

Modified: grass/trunk/lib/raster/opencell.c
===================================================================
--- grass/trunk/lib/raster/opencell.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/lib/raster/opencell.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -193,9 +193,7 @@
     }
 
     /* read the cell header */
-    if (Rast_get_cellhd(r_name, r_mapset, &cellhd) < 0)
-	G_fatal_error(_("Error reading cellhd file for <%s>"),
-		      G_fully_qualified_name(name, mapset));
+    Rast_get_cellhd(r_name, r_mapset, &cellhd);
 
     /* now check the type */
     MAP_TYPE = Rast_map_type(r_name, r_mapset);

Modified: grass/trunk/raster/r.bitpattern/main.c
===================================================================
--- grass/trunk/raster/r.bitpattern/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.bitpattern/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -101,8 +101,7 @@
     /* determine the inputmap type (CELL/FCELL/DCELL) */
     data_type = Rast_get_map_type(infd);
 
-    if (Rast_get_cellhd(name, "", &cellhd) < 0)
-	G_fatal_error(_("Unable to read header of raster map <%s>"), name);
+    Rast_get_cellhd(name, "", &cellhd);
 
     /* Allocate input buffer */
     inrast = Rast_allocate_buf(data_type);

Modified: grass/trunk/raster/r.category/cats.c
===================================================================
--- grass/trunk/raster/r.category/cats.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.category/cats.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -32,9 +32,7 @@
     struct Cell_head cellhd;
 
     /* set the window to the cell header */
-    if (Rast_get_cellhd(name, mapset, &cellhd) < 0)
-	G_fatal_error(_("Cannot read header of raster map <%s> in <%s>"),
-		      name, mapset);
+    Rast_get_cellhd(name, mapset, &cellhd);
 
     Rast_set_window(&cellhd);
 

Modified: grass/trunk/raster/r.compress/main.c
===================================================================
--- grass/trunk/raster/r.compress/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.compress/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -171,12 +171,8 @@
     int new, old, nrows, row;
     void *rast;
 
-    if (Rast_get_cellhd(name, G_mapset(), &cellhd) < 0) {
-	G_warning("Problem reading cell header for [%s]", name);
-	return 1;
-    }
+    Rast_get_cellhd(name, G_mapset(), &cellhd);
 
-
     /* check if already compressed/decompressed */
     if (uncompress && cellhd.compressed == 0) {
 	G_warning(_("[%s] already uncompressed"), name);

Modified: grass/trunk/raster/r.describe/describe.c
===================================================================
--- grass/trunk/raster/r.describe/describe.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.describe/describe.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -43,8 +43,7 @@
 	get_row = Rast_get_c_row;
     }
     else {
-	if (Rast_get_cellhd(name, "", &window) < 0)
-	    G_fatal_error(_("Unable to get cell header for <%s>"), name);
+	Rast_get_cellhd(name, "", &window);
 
 	Rast_set_window(&window);
 	get_row = Rast_get_c_row_nomask;

Modified: grass/trunk/raster/r.flow/io.c
===================================================================
--- grass/trunk/raster/r.flow/io.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.flow/io.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -63,8 +63,8 @@
     if (mapset == NULL)
 	G_fatal_error(_("Raster map <%s> not found"), fname);
 
-    if (chd && (Rast_get_cellhd(fname, mapset, chd) < 0))
-	G_fatal_error(_("Unable to get header for %s"), fname);
+    if (chd)
+	Rast_get_cellhd(fname, mapset, chd);
 
     return Rast_open_old(fname, mapset);
 }

Modified: grass/trunk/raster/r.info/main.c
===================================================================
--- grass/trunk/raster/r.info/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.info/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -54,7 +54,7 @@
     struct History hist;
     struct TimeStamp ts;
     int time_ok = 0, first_time_ok = 0, second_time_ok = 0;
-    int head_ok, cats_ok, hist_ok;
+    int cats_ok, hist_ok;
     int is_reclass;
     RASTER_MAP_TYPE data_type;
     struct Reclass reclass;
@@ -119,7 +119,7 @@
     if ((mapset = G_find_raster2(name, "")) == NULL)
 	G_fatal_error(_("Raster map <%s> not found"), name);
 
-    head_ok = Rast_get_cellhd(name, "", &cellhd) >= 0;
+    Rast_get_cellhd(name, "", &cellhd);
     cats_ok = Rast_read_cats(name, "", &cats) >= 0;
     hist_ok = Rast_read_history(name, "", &hist) >= 0;
     is_reclass = Rast_get_reclass(name, "", &reclass);
@@ -193,7 +193,7 @@
 			 units, vdatum);
 	}
 
-	if (head_ok) {
+	{
 	    compose_line(out, "  Rows:         %d", cellhd.rows);
 	    compose_line(out, "  Columns:      %d", cellhd.cols);
 #ifdef HAVE_LONG_LONG_INT

Modified: grass/trunk/raster/r.li/r.li.cwed/cwed.c
===================================================================
--- grass/trunk/raster/r.li/r.li.cwed/cwed.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.cwed/cwed.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -162,12 +162,8 @@
 	return RLI_ERRORE;
     }
 
-    if (Rast_get_cellhd(ad->raster, "", &hd) == -1) {
-	G_fatal_error("can't read raster header");
-	return RLI_ERRORE;
-    }
+    Rast_get_cellhd(ad->raster, "", &hd);
 
-
     for (i = 0; i < totRow; i++) {
 	long num = 0;
 	char **b;

Modified: grass/trunk/raster/r.li/r.li.daemon/daemon.c
===================================================================
--- grass/trunk/raster/r.li/r.li.daemon/daemon.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.daemon/daemon.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -350,8 +350,7 @@
     rel_cl = atof(strtok(NULL, "\n"));
 
     /* find raster map */
-    if (Rast_get_cellhd(raster, "", &cellhd) == -1)
-	G_fatal_error(_("Cannot read raster header file"));
+    Rast_get_cellhd(raster, "", &cellhd);
 
     /* calculate absolute sampling frame definition */
     sf_x = (int)rint(cellhd.cols * rel_x);

Modified: grass/trunk/raster/r.li/r.li.daemon/worker.c
===================================================================
--- grass/trunk/raster/r.li/r.li.daemon/worker.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.daemon/worker.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -61,10 +61,7 @@
 
     /* open raster map */
     fd = Rast_open_old(raster, "");
-    if (Rast_get_cellhd(raster, "", &hd) == -1) {
-	G_message(_("CHILD[pid = %i] cannot open raster map"), pid);
-	exit(EXIT_FAILURE);
-    }
+    Rast_get_cellhd(raster, "", &hd);
 
     /* read data type to allocate cache */
     data_type = Rast_map_type(raster, "");
@@ -235,12 +232,10 @@
 	    raster, mask, rl, cl);
 
     /* open raster */
-    if (Rast_get_cellhd(raster, "", &cell) == -1)
-	return NULL;
+    Rast_get_cellhd(raster, "", &cell);
 
     /* open raster */
-    if (Rast_get_cellhd(mask, "", &oldcell) == -1)
-	return NULL;
+    Rast_get_cellhd(mask, "", &oldcell);
 
     add_row = 1.0 * oldcell.rows / rl;
     add_col = 1.0 * oldcell.cols / cl;

Modified: grass/trunk/raster/r.li/r.li.dominance/dominance.c
===================================================================
--- grass/trunk/raster/r.li/r.li.dominance/dominance.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.dominance/dominance.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -74,10 +74,8 @@
     struct Cell_head hd;
 
 
-    if (Rast_get_cellhd(ad->raster, "", &hd) == -1)
-	return RLI_ERRORE;
+    Rast_get_cellhd(ad->raster, "", &hd);
 
-
     switch (ad->data_type) {
     case CELL_TYPE:
 	{

Modified: grass/trunk/raster/r.li/r.li.edgedensity/edgedensity.c
===================================================================
--- grass/trunk/raster/r.li/r.li.edgedensity/edgedensity.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.edgedensity/edgedensity.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -84,10 +84,8 @@
     int ris = -1;
     double indice = 0;
 
-    if (Rast_get_cellhd(ad->raster, "", &hd) == -1)
-	return RLI_ERRORE;
+    Rast_get_cellhd(ad->raster, "", &hd);
 
-
     switch (ad->data_type) {
     case CELL_TYPE:
 	{

Modified: grass/trunk/raster/r.li/r.li.mpa/mpa.c
===================================================================
--- grass/trunk/raster/r.li/r.li.mpa/mpa.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.mpa/mpa.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -71,10 +71,8 @@
     double indice = 0;
     struct Cell_head hd;
 
-    if (Rast_get_cellhd(ad->raster, "", &hd) == -1)
-	return RLI_ERRORE;
+    Rast_get_cellhd(ad->raster, "", &hd);
 
-
     switch (ad->data_type) {
     case CELL_TYPE:
 	{

Modified: grass/trunk/raster/r.li/r.li.mps/mps.c
===================================================================
--- grass/trunk/raster/r.li/r.li.mps/mps.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.mps/mps.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -72,8 +72,7 @@
     double indice = 0;
     struct Cell_head hd;
 
-    if (Rast_get_cellhd(ad->raster, "", &hd) == -1)
-	return RLI_ERRORE;
+    Rast_get_cellhd(ad->raster, "", &hd);
 
     switch (ad->data_type) {
     case CELL_TYPE:

Modified: grass/trunk/raster/r.li/r.li.padcv/padcv.c
===================================================================
--- grass/trunk/raster/r.li/r.li.padcv/padcv.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.padcv/padcv.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -60,8 +60,8 @@
     struct Cell_head hd;
     int ris = RLI_OK;
 
-    if (Rast_get_cellhd(ad->raster, "", &hd) == -1)
-	return RLI_ERRORE;
+    Rast_get_cellhd(ad->raster, "", &hd);
+
     switch (ad->data_type)
     {
     case CELL_TYPE:

Modified: grass/trunk/raster/r.li/r.li.padrange/padrange.c
===================================================================
--- grass/trunk/raster/r.li/r.li.padrange/padrange.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.padrange/padrange.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -63,8 +63,8 @@
     struct Cell_head hd;
     int ris = RLI_OK;
 
-    if (Rast_get_cellhd(ad->raster, "", &hd) == -1)
-	return RLI_ERRORE;
+    Rast_get_cellhd(ad->raster, "", &hd);
+
     switch (ad->data_type)
     {
     case CELL_TYPE:

Modified: grass/trunk/raster/r.li/r.li.padsd/padsd.c
===================================================================
--- grass/trunk/raster/r.li/r.li.padsd/padsd.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.padsd/padsd.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -60,8 +60,8 @@
     struct Cell_head hd;
     int ris = RLI_OK;
 
-    if (Rast_get_cellhd(ad->raster, "", &hd) == -1)
-	return RLI_ERRORE;
+    Rast_get_cellhd(ad->raster, "", &hd);
+
     switch (ad->data_type)
     {
     case CELL_TYPE:

Modified: grass/trunk/raster/r.li/r.li.patchdensity/main.c
===================================================================
--- grass/trunk/raster/r.li/r.li.patchdensity/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.patchdensity/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -70,8 +70,8 @@
     int mask_fd = -1, *mask_buf, *mask_sup, null_count = 0;
 
     Rast_set_c_null_value(&complete_value, 1);
-    if (Rast_get_cellhd(ad->raster, "", &hd) == -1)
-	return 0;
+    Rast_get_cellhd(ad->raster, "", &hd);
+
     sup = Rast_allocate_c_buf();
 
     /* open mask if needed */

Modified: grass/trunk/raster/r.li/r.li.patchnum/main.c
===================================================================
--- grass/trunk/raster/r.li/r.li.patchnum/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.patchnum/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -67,8 +67,8 @@
     int mask_fd = -1, *mask_buf, *mask_sup, null_count = 0;
 
     Rast_set_c_null_value(&complete_value, 1);
-    if (Rast_get_cellhd(ad->raster, "", &hd) == -1)
-	return 0;
+    Rast_get_cellhd(ad->raster, "", &hd);
+
     sup = Rast_allocate_c_buf();
 
     /* open mask if needed */

Modified: grass/trunk/raster/r.li/r.li.richness/richness.c
===================================================================
--- grass/trunk/raster/r.li/r.li.richness/richness.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.richness/richness.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -69,8 +69,7 @@
     double indice = 0;
     struct Cell_head hd;
 
-    if (Rast_get_cellhd(ad->raster, "", &hd) == -1)
-	return RLI_ERRORE;
+    Rast_get_cellhd(ad->raster, "", &hd);
 
     switch (ad->data_type) {
     case CELL_TYPE:

Modified: grass/trunk/raster/r.li/r.li.shannon/shannon.c
===================================================================
--- grass/trunk/raster/r.li/r.li.shannon/shannon.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.shannon/shannon.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -70,10 +70,8 @@
     double indice = 0;
     struct Cell_head hd;
 
-    if (Rast_get_cellhd(ad->raster, "", &hd) == -1)
-	return RLI_ERRORE;
+    Rast_get_cellhd(ad->raster, "", &hd);
 
-
     switch (ad->data_type) {
     case CELL_TYPE:
 	{

Modified: grass/trunk/raster/r.li/r.li.shape/main.c
===================================================================
--- grass/trunk/raster/r.li/r.li.shape/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.shape/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -72,10 +72,8 @@
     int *mask_buf;
 
     Rast_set_c_null_value(&complete_value, 1);
-    if (Rast_get_cellhd(ad->raster, "", &hd) == -1)
-	return 0;
+    Rast_get_cellhd(ad->raster, "", &hd);
 
-
     /* open mask if needed */
     if (ad->mask == 1) {
 	if ((mask_fd = open(ad->mask_name, O_RDONLY, 0755)) < 0)

Modified: grass/trunk/raster/r.li/r.li.simpson/simpson.c
===================================================================
--- grass/trunk/raster/r.li/r.li.simpson/simpson.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.li/r.li.simpson/simpson.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -69,8 +69,7 @@
     double indice = 0;
     struct Cell_head hd;
 
-    if (Rast_get_cellhd(ad->raster, "", &hd) == -1)
-	return RLI_ERRORE;
+    Rast_get_cellhd(ad->raster, "", &hd);
 
     switch (ad->data_type) {
     case CELL_TYPE:

Modified: grass/trunk/raster/r.los/main.c
===================================================================
--- grass/trunk/raster/r.los/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.los/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -180,13 +180,11 @@
     }
 
     /*  read header info for elevation layer        */
-    if (Rast_get_cellhd(elev_layer, old_mapset, &cellhd_elev) < 0)
-	G_fatal_error(_("[%s]: Cannot read map header"), elev_layer);
+    Rast_get_cellhd(elev_layer, old_mapset, &cellhd_elev);
 
     /*  if pattern layer present, read in its header info   */
     if (patt_flag == TRUE) {
-	if (Rast_get_cellhd(patt_layer, patt_mapset, &cellhd_patt) < 0)
-	    G_fatal_error(_("[%s]: Cannot read map header"), patt_layer);
+	Rast_get_cellhd(patt_layer, patt_mapset, &cellhd_patt);
 
 	/*  allocate buffer space for row-io to layer           */
 	cell = Rast_allocate_buf(CELL_TYPE);

Modified: grass/trunk/raster/r.mapcalc/map.c
===================================================================
--- grass/trunk/raster/r.mapcalc/map.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.mapcalc/map.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -431,9 +431,7 @@
     if (m->fd < 0)
 	return;
 
-    if (Rast_close(m->fd) < 0)
-	G_fatal_error(_("Unable to close raster map <%s@%s>"),
-		      m->name, m->mapset);
+    Rast_close(m->fd);
 
 #ifdef HAVE_PTHREAD_H
     pthread_mutex_destroy(&m->mutex);
@@ -664,8 +662,7 @@
 
 void close_output_map(int fd)
 {
-    if (Rast_close(fd) < 0)
-	G_fatal_error(_("Unable to close raster map"));
+    Rast_close(fd);
 }
 
 void unopen_output_map(int fd)

Modified: grass/trunk/raster/r.neighbors/main.c
===================================================================
--- grass/trunk/raster/r.neighbors/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.neighbors/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -204,8 +204,7 @@
     ncb.newcell = parm.output->answer;
 
     if (!flag.align->answer) {
-	if (Rast_get_cellhd(ncb.oldcell, "", &cellhd) < 0)
-	    exit(EXIT_FAILURE);
+	Rast_get_cellhd(ncb.oldcell, "", &cellhd);
 	G_get_window(&window);
 	G_align_window(&window, &cellhd);
 	Rast_set_window(&window);

Modified: grass/trunk/raster/r.null/main.c
===================================================================
--- grass/trunk/raster/r.null/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.null/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -155,9 +155,7 @@
 
     parse_vallist(parms.setnull->answers, &d_mask);
 
-    if (Rast_get_cellhd(name, mapset, &cellhd) < 0)
-	G_fatal_error(_("Unable to read header of raster map <%s>"),
-		      G_fully_qualified_name(name, mapset));
+    Rast_get_cellhd(name, mapset, &cellhd);
 
     if (create) {
 	/* write a file of no-nulls */

Modified: grass/trunk/raster/r.out.tiff/main.c
===================================================================
--- grass/trunk/raster/r.out.tiff/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.out.tiff/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -140,9 +140,7 @@
     palette = pflag->answer;
     tfw = tflag->answer;
 
-    if ((Rast_get_cellhd(inopt->answer, "", &cellhd) < 0))
-	G_fatal_error(_("Unable to read header of raster map <%s>"),
-		      inopt->answer);
+    Rast_get_cellhd(inopt->answer, "", &cellhd);
 
     G_get_window(&cellhd);
 

Modified: grass/trunk/raster/r.recode/recode.c
===================================================================
--- grass/trunk/raster/r.recode/recode.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.recode/recode.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -29,10 +29,9 @@
     /* set the window from the header for the input file */
     if (align_wind) {
 	G_get_window(&window);
-	if (Rast_get_cellhd(name, "", &cellhd) >= 0) {
-	    G_align_window(&window, &cellhd);
-	    Rast_set_window(&window);
-	}
+	Rast_get_cellhd(name, "", &cellhd);
+	G_align_window(&window, &cellhd);
+	Rast_set_window(&window);
     }
 
     G_get_set_window(&window);

Modified: grass/trunk/raster/r.region/main.c
===================================================================
--- grass/trunk/raster/r.region/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.region/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -153,8 +153,7 @@
 
     name = parm.map->answer;
 
-    if (Rast_get_cellhd(name, G_mapset(), &cellhd) < 0)
-	G_fatal_error(_("Unable to read header of raster map <%s>"), name);
+    Rast_get_cellhd(name, G_mapset(), &cellhd);
 
     G_copy(&window, &cellhd, sizeof(window));
 
@@ -197,8 +196,7 @@
     }
 
     if ((name = parm.raster->answer)) {	/* raster= */
-	if (Rast_get_cellhd(name, "", &window) < 0)
-	    G_fatal_error(_("Unable to read header of raster map <%s>"), name);
+	Rast_get_cellhd(name, "", &window);
     }
 
     if ((name = parm.vect->answer)) {	/* vect= */
@@ -311,8 +309,8 @@
     if ((name = parm.align->answer)) {	/* align= */
 	struct Cell_head temp_window;
 
-	if (Rast_get_cellhd(name, "", &temp_window) < 0)
-	    G_fatal_error(_("Unable to read header of raster map <%s>"), name);
+	Rast_get_cellhd(name, "", &temp_window);
+
 	if ((err = G_align_window(&window, &temp_window)))
 	    G_fatal_error("%s: %s", name, err);
     }

Modified: grass/trunk/raster/r.resamp.rst/main.c
===================================================================
--- grass/trunk/raster/r.resamp.rst/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.resamp.rst/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -368,8 +368,7 @@
 
 	fdsmooth = Rast_open_old(smooth, "");
 
-	if (Rast_get_cellhd(smooth, "", &smhd) < 0)
-	    G_fatal_error(_("Unable to read header for <%s>"), smooth);
+	Rast_get_cellhd(smooth, "", &smhd);
 
 	if ((winhd.ew_res != smhd.ew_res) || (winhd.ns_res != smhd.ns_res))
 	    G_fatal_error(_("Map <%s> is the wrong resolution"), smooth);
@@ -383,8 +382,7 @@
 	    G_fatal_error(_("Smoothing values can not be negative or NULL"));
     }
 
-    if (Rast_get_cellhd(input, "", &inphd) < 0)
-	G_fatal_error(_("Unable to read header for <%s>"), input);
+    Rast_get_cellhd(input, "", &inphd);
 
     if ((winhd.ew_res != inphd.ew_res) || (winhd.ns_res != inphd.ns_res))
 	G_fatal_error(_("Input map resolution differs from current region resolution!"));

Modified: grass/trunk/raster/r.resample/main.c
===================================================================
--- grass/trunk/raster/r.resample/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.resample/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -95,8 +95,7 @@
     data_type = Rast_get_map_type(infd);
     out_type = data_type;
 
-    if (Rast_get_cellhd(name, "", &cellhd) < 0)
-	G_fatal_error(_("Unable to read header for <%s>"), name);
+    Rast_get_cellhd(name, "", &cellhd);
 
     /* raster buffer is big enough to hold data */
     rast = Rast_allocate_buf(data_type);

Modified: grass/trunk/raster/r.slope.aspect/main.c
===================================================================
--- grass/trunk/raster/r.slope.aspect/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.slope.aspect/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -367,10 +367,9 @@
     /* set the window from the header for the elevation file */
     if (!flag.a->answer) {
 	G_get_window(&window);
-	if (Rast_get_cellhd(elev_name, "", &cellhd) >= 0) {
-	    G_align_window(&window, &cellhd);
-	    Rast_set_window(&window);
-	}
+	Rast_get_cellhd(elev_name, "", &cellhd);
+	G_align_window(&window, &cellhd);
+	Rast_set_window(&window);
     }
 
     if (strcmp(parm.out_precision->answer, "double") == 0)

Modified: grass/trunk/raster/r.support/histo.c
===================================================================
--- grass/trunk/raster/r.support/histo.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.support/histo.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -18,8 +18,7 @@
     int row;
     int fd;
 
-    if (Rast_get_cellhd(name, "", &cellhd) < 0)
-	G_fatal_error(_("Unable to read header for <%s>"), name);
+    Rast_get_cellhd(name, "", &cellhd);
 
     Rast_set_window(&cellhd);
     fd = Rast_open_old(name, "");

Modified: grass/trunk/raster/r.support/main.c
===================================================================
--- grass/trunk/raster/r.support/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.support/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -43,7 +43,6 @@
     struct Option *map_opt, *units_opt, *vdatum_opt;
     struct Option *load_opt, *save_opt;
     struct Flag *stats_flag, *null_flag, *del_flag;
-    int cellhd_ok;		/* Is cell header OK? */
     int is_reclass;		/* Is raster reclass? */
     const char *infile;
     char title[MAX_TITLE_LEN + 1], datasrc[RECORD_LEN + 1];
@@ -148,7 +147,7 @@
     if (!mapset || strcmp(mapset, G_mapset()) != 0)
 	G_fatal_error(_("Raster map <%s> not found in current mapset"), infile);
 
-    cellhd_ok = (Rast_get_cellhd(raster->answer, "", &cellhd) >= 0);
+    Rast_get_cellhd(raster->answer, "", &cellhd);
     is_reclass = (Rast_is_reclass(raster->answer, "", rname, rmapset) > 0);
 
     if (title_opt->answer) {

Modified: grass/trunk/raster/r.support.stats/histo.c
===================================================================
--- grass/trunk/raster/r.support.stats/histo.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.support.stats/histo.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -34,8 +34,7 @@
     int row;
     int fd;
 
-    if (Rast_get_cellhd(name, "", &cellhd) < 0)
-	return 1;
+    Rast_get_cellhd(name, "", &cellhd);
 
     Rast_set_window(&cellhd);
     fd = Rast_open_old(name, "");

Modified: grass/trunk/raster/r.texture/main.c
===================================================================
--- grass/trunk/raster/r.texture/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.texture/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -216,8 +216,7 @@
     /* determine the inputmap type (CELL/FCELL/DCELL) */
     data_type = Rast_get_map_type(infd);
 
-    if (Rast_get_cellhd(name, "", &cellhd) < 0)
-	G_fatal_error(_("Unable to read header of raster map <%s>"), name);
+    Rast_get_cellhd(name, "", &cellhd);
 
     out_data_type = FCELL_TYPE;
     /* Allocate output buffer, use FCELL data_type */

Modified: grass/trunk/raster/r.to.rast3/main.c
===================================================================
--- grass/trunk/raster/r.to.rast3/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.to.rast3/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -352,6 +352,5 @@
 /* ************************************************************************* */
 void close_input_raster_map(int fd)
 {
-    if (Rast_close(fd) < 0)
-	G_fatal_error(_("Unable to close input map"));
+    Rast_close(fd);
 }

Modified: grass/trunk/raster/r.to.rast3elev/main.c
===================================================================
--- grass/trunk/raster/r.to.rast3elev/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.to.rast3elev/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -118,8 +118,7 @@
 /* ************************************************************************* */
 void close_input_raster_map(int fd)
 {
-    if (Rast_close(fd) < 0)
-	G_fatal_error(_("Unable to close input map"));
+    Rast_close(fd);
 }
 
 /* ************************************************************************* */

Modified: grass/trunk/raster/r.topidx/file_io.c
===================================================================
--- grass/trunk/raster/r.topidx/file_io.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.topidx/file_io.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -15,8 +15,7 @@
     fd = Rast_open_old(iname, "");
 
     data_type = Rast_get_map_type(fd);
-    if (Rast_get_cellhd(iname, "", &inhead) < 0 )
-	G_fatal_error(_("Unable to read header of raster map <%s>"), iname);
+    Rast_get_cellhd(iname, "", &inhead);
 
     if (data_type == CELL_TYPE)
 	ccell = (CELL *) G_malloc(sizeof(CELL) * window.cols);

Modified: grass/trunk/raster/r.water.outlet/main.c
===================================================================
--- grass/trunk/raster/r.water.outlet/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.water.outlet/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -159,8 +159,7 @@
     }
     G_free(bas);
     G_free(cell_buf);
-    if (Rast_close(basin_fd) < 0)
-	G_fatal_error(_("Unable to close new basin map layer"));
+    Rast_close(basin_fd);
 
     return 0;
 }

Modified: grass/trunk/raster/r.watershed/ram/close_maps.c
===================================================================
--- grass/trunk/raster/r.watershed/ram/close_maps.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.watershed/ram/close_maps.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -60,8 +60,7 @@
 		    Rast_put_row(fd, dbuf, DCELL_TYPE);
 		}
 	    }
-	    if (Rast_close(fd) < 0)
-		G_warning(_("Close failed."));
+	    Rast_close(fd);
 
 	    stddev =
 		sqrt((sum_sqr - (sum + sum / do_points)) / (do_points - 1));
@@ -144,8 +143,7 @@
 		}
 		Rast_put_row(fd, buf, CELL_TYPE);
 	    }
-	    if (Rast_close(fd) < 0)
-		G_warning(_("Close failed."));
+	    Rast_close(fd);
 	}
 	Rast_init_colors(&colors);
 	Rast_make_aspect_colors(&colors, 0, 8);
@@ -174,8 +172,7 @@
 		}
 		Rast_put_row(fd, buf, CELL_TYPE);
 	    }
-	    if (Rast_close(fd) < 0)
-		G_warning(_("Close failed."));
+	    Rast_close(fd);
 	}
 	Rast_init_colors(&colors);
 	Rast_make_rainbow_colors(&colors, 1, 120);
@@ -196,8 +193,7 @@
 		}
 		Rast_put_row(fd, dbuf, DCELL_TYPE);
 	    }
-	    if (Rast_close(fd) < 0)
-		G_warning(_("Close failed."));
+	    Rast_close(fd);
 	}
 	G_free(l_s);
     }
@@ -213,8 +209,7 @@
 		}
 		Rast_put_row(fd, dbuf, DCELL_TYPE);
 	    }
-	    if (Rast_close(fd) < 0)
-		G_warning(_("Close failed."));
+	    Rast_close(fd);
 	}
     }
 
@@ -230,8 +225,7 @@
 		}
 		Rast_put_row(fd, dbuf, DCELL_TYPE);
 	    }
-	    if (Rast_close(fd) < 0)
-		G_warning(_("Close failed."));
+	    Rast_close(fd);
 	}
 	G_free(s_g);
     }

Modified: grass/trunk/raster/r.watershed/seg/close_maps.c
===================================================================
--- grass/trunk/raster/r.watershed/seg/close_maps.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster/r.watershed/seg/close_maps.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -51,8 +51,7 @@
 	}
 	G_percent(r, nrows, 1);    /* finish it */
 
-	if (Rast_close(fd) < 0)
-	    G_warning(_("Close failed."));
+	Rast_close(fd);
 
 	stddev = sqrt((sum_sqr - (sum + sum / do_points)) / (do_points - 1));
 	G_debug(1, "stddev: %f", stddev);

Modified: grass/trunk/raster3d/r3.cross.rast/main.c
===================================================================
--- grass/trunk/raster3d/r3.cross.rast/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster3d/r3.cross.rast/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -74,8 +74,7 @@
 /* ************************************************************************* */
 void close_output_map(int fd)
 {
-    if (Rast_close(fd) < 0)
-	G_fatal_error(_("Unable to close output map"));
+    Rast_close(fd);
 }
 
 
@@ -370,10 +369,8 @@
 		    G3d_maskOff(map);
 	}
 
-	if (Rast_close(outfd) < 0)
-	    fatal_error(map, elevfd, -1, _("Unable to close output map"));
-	if (Rast_close(elevfd) < 0)
-	    fatal_error(map, -1, -1, _("Unable to close elevation map"));
+	Rast_close(outfd);
+	Rast_close(elevfd);
 
     }
     else {

Modified: grass/trunk/raster3d/r3.out.vtk/errorHandling.c
===================================================================
--- grass/trunk/raster3d/r3.out.vtk/errorHandling.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster3d/r3.out.vtk/errorHandling.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -49,10 +49,7 @@
 int CloseInputRasterMap(int fd)
 {
     if (fd != -1)
-	if (Rast_close(fd) < 0) {
-	    G_warning(_("unable to close input raster map"));
-	    return 1;
-	}
+	Rast_close(fd);
 
     return 0;
 

Modified: grass/trunk/raster3d/r3.out.vtk/main.c
===================================================================
--- grass/trunk/raster3d/r3.out.vtk/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster3d/r3.out.vtk/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -481,14 +481,12 @@
 	    write_vtk_unstructured_grid_cells(fp, region);
 	}
 
-	if (Rast_close(in->top) < 0) {
-	    G_fatal_error(_("unable to close top raster map"));
-	}
+	Rast_close(in->top);
+
 	in->top = -1;
 
-	if (Rast_close(in->bottom) < 0) {
-	    G_fatal_error(_("unable to close bottom raster map"));
-	}
+	Rast_close(in->bottom);
+
 	in->bottom = -1;
     }
     else {

Modified: grass/trunk/raster3d/r3.to.rast/main.c
===================================================================
--- grass/trunk/raster3d/r3.to.rast/main.c	2010-01-04 14:47:50 UTC (rev 40216)
+++ grass/trunk/raster3d/r3.to.rast/main.c	2010-01-04 15:51:45 UTC (rev 40217)
@@ -185,8 +185,7 @@
 /* ************************************************************************* */
 void close_output_map(int fd)
 {
-    if (Rast_close(fd) < 0)
-	G_fatal_error(_("Unable to close output map"));
+    Rast_close(fd);
 }
 
 /* ************************************************************************* */



More information about the grass-commit mailing list