[GRASS-SVN] r40215 - in grass/trunk: display/d.his display/d.nviz
display/d.profile display/d.rast display/d.rast.arrow
display/d.rast.num display/d.rgb display/d.what.rast
doc/raster/r.example general/g.region imagery/i.albedo
imagery/i.biomass imagery/i.cca imagery/i.class
imagery/i.cluster imagery/i.eb.eta imagery/i.eb.evapfr
imagery/i.eb.h_SEBAL01 imagery/i.eb.soilheatflux
imagery/i.emissivity imagery/i.evapo.time_integration
imagery/i.fft imagery/i.gensig imagery/i.gensigset
imagery/i.his.rgb imagery/i.ifft imagery/i.latlong
imagery/i.maxlik imagery/i.modis.qc imagery/i.pca
imagery/i.points imagery/i.rectify imagery/i.rgb.his
imagery/i.smap imagery/i.sunhours imagery/i.vi
imagery/i.vpoints imagery/i.zc ps/ps.map raster/r.basins.fill
raster/r.bitpattern raster/r.buffer raster/r.carve
raster/r.category raster/r.circle raster/r.clump
raster/r.colors raster/r.composite raster/r.compress
raster/r.contour raster/r.cost raster/r.covar raster/r.cross
raster/r.describe raster/r.distance raster/r.flow
raster/r.grow raster/r.grow.distance raster/r.his
raster/r.horizon raster/r.in.arc raster/r.in.ascii
raster/r.in.bin raster/r.in.gdal raster/r.in.mat
raster/r.in.poly raster/r.in.xyz raster/r.lake
raster/r.li/r.li.daemon raster/r.los raster/r.mapcalc
raster/r.mfilter raster/r.neighbors raster/r.null
raster/r.out.arc raster/r.out.ascii raster/r.out.bin
raster/r.out.gdal raster/r.out.gridatb raster/r.out.mat
raster/r.out.mpeg raster/r.out.png raster/r.out.pov
raster/r.out.ppm raster/r.out.ppm3 raster/r.out.tiff
raster/r.out.vrml raster/r.out.vtk raster/r.param.scale
raster/r.patch raster/r.profile raster/r.quantile
raster/r.random raster/r.random.cells raster/r.random.surface
raster/r.recode raster/r.resamp.interp raster/r.resamp.rst
raster/r.resamp.stats raster/r.resample raster/r.rescale
raster/r.rescale.eq raster/r.ros raster/r.series
raster/r.slope.aspect raster/r.spread raster/r.spreadpath
raster/r.statistics2 raster/r.statistics3 raster/r.stats
raster/r.sun raster/r.sunmask raster/r.support
raster/r.support.stats raster/r.surf.area
raster/r.surf.contour raster/r.surf.fractal raster/r.surf.idw
raster/r.surf.idw2 raster/r.surf.random raster/r.texture
raster/r.thin raster/r.to.rast3 raster/r.to.rast3elev
raster/r.to.vect raster/r.topidx raster/r.univar
raster/r.uslek raster/r.usler raster/r.volume raster/r.walk
raster/r.water.outlet raster/r.watershed/ram
raster/r.watershed/seg raster/r.watershed/shed raster/r.what
raster/simwe/simlib raster3d/r3.cross.rast
raster3d/r3.out.vtk raster3d/r3.to.rast
vector/lidar/v.surf.bspline vector/v.drape vector/v.extrude
vector/v.kernel vector/v.neighbors vector/v.sample
vector/v.surf.idw vector/v.to.rast vector/v.vol.rst
vector/v.what.rast
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jan 4 09:39:34 EST 2010
Author: glynn
Date: 2010-01-04 09:39:31 -0500 (Mon, 04 Jan 2010)
New Revision: 40215
Modified:
grass/trunk/display/d.his/main.c
grass/trunk/display/d.nviz/main.c
grass/trunk/display/d.profile/main.c
grass/trunk/display/d.rast.arrow/main.c
grass/trunk/display/d.rast.num/main.c
grass/trunk/display/d.rast/display.c
grass/trunk/display/d.rgb/main.c
grass/trunk/display/d.what.rast/opencell.c
grass/trunk/doc/raster/r.example/main.c
grass/trunk/general/g.region/zoom.c
grass/trunk/imagery/i.albedo/main.c
grass/trunk/imagery/i.biomass/main.c
grass/trunk/imagery/i.cca/main.c
grass/trunk/imagery/i.class/band_files.c
grass/trunk/imagery/i.class/draw_cell.c
grass/trunk/imagery/i.class/signature.c
grass/trunk/imagery/i.cluster/open_files.c
grass/trunk/imagery/i.eb.eta/main.c
grass/trunk/imagery/i.eb.evapfr/main.c
grass/trunk/imagery/i.eb.h_SEBAL01/main.c
grass/trunk/imagery/i.eb.soilheatflux/main.c
grass/trunk/imagery/i.emissivity/main.c
grass/trunk/imagery/i.evapo.time_integration/main.c
grass/trunk/imagery/i.fft/main.c
grass/trunk/imagery/i.gensig/openfiles.c
grass/trunk/imagery/i.gensigset/openfiles.c
grass/trunk/imagery/i.his.rgb/openfiles.c
grass/trunk/imagery/i.ifft/main.c
grass/trunk/imagery/i.latlong/main.c
grass/trunk/imagery/i.maxlik/open.c
grass/trunk/imagery/i.modis.qc/main.c
grass/trunk/imagery/i.pca/main.c
grass/trunk/imagery/i.points/drawcell.c
grass/trunk/imagery/i.rectify/rectify.c
grass/trunk/imagery/i.rectify/write.c
grass/trunk/imagery/i.rgb.his/openfiles.c
grass/trunk/imagery/i.smap/opencell.c
grass/trunk/imagery/i.sunhours/main.c
grass/trunk/imagery/i.vi/main.c
grass/trunk/imagery/i.vpoints/drawcell.c
grass/trunk/imagery/i.zc/main.c
grass/trunk/ps/ps.map/outl_io.c
grass/trunk/ps/ps.map/r_cell.c
grass/trunk/ps/ps.map/r_group.c
grass/trunk/ps/ps.map/r_rgb.c
grass/trunk/raster/r.basins.fill/main.c
grass/trunk/raster/r.basins.fill/read_map.c
grass/trunk/raster/r.bitpattern/main.c
grass/trunk/raster/r.buffer/read_map.c
grass/trunk/raster/r.buffer/write_map.c
grass/trunk/raster/r.carve/main.c
grass/trunk/raster/r.category/cats.c
grass/trunk/raster/r.category/main.c
grass/trunk/raster/r.circle/main.c
grass/trunk/raster/r.clump/main.c
grass/trunk/raster/r.colors/stats.c
grass/trunk/raster/r.composite/main.c
grass/trunk/raster/r.compress/main.c
grass/trunk/raster/r.contour/main.c
grass/trunk/raster/r.cost/main.c
grass/trunk/raster/r.covar/main.c
grass/trunk/raster/r.cross/main.c
grass/trunk/raster/r.describe/describe.c
grass/trunk/raster/r.distance/edges.c
grass/trunk/raster/r.flow/io.c
grass/trunk/raster/r.grow.distance/main.c
grass/trunk/raster/r.grow/main.c
grass/trunk/raster/r.his/main.c
grass/trunk/raster/r.horizon/main.c
grass/trunk/raster/r.in.arc/main.c
grass/trunk/raster/r.in.ascii/main.c
grass/trunk/raster/r.in.bin/main.c
grass/trunk/raster/r.in.gdal/main.c
grass/trunk/raster/r.in.mat/main.c
grass/trunk/raster/r.in.poly/poly2rast.c
grass/trunk/raster/r.in.xyz/main.c
grass/trunk/raster/r.lake/main.c
grass/trunk/raster/r.li/r.li.daemon/daemon.c
grass/trunk/raster/r.los/main.c
grass/trunk/raster/r.mapcalc/map.c
grass/trunk/raster/r.mfilter/perform.c
grass/trunk/raster/r.neighbors/main.c
grass/trunk/raster/r.null/main.c
grass/trunk/raster/r.out.arc/main.c
grass/trunk/raster/r.out.ascii/main.c
grass/trunk/raster/r.out.bin/main.c
grass/trunk/raster/r.out.gdal/export_band.c
grass/trunk/raster/r.out.gridatb/file_io.c
grass/trunk/raster/r.out.mat/main.c
grass/trunk/raster/r.out.mpeg/main.c
grass/trunk/raster/r.out.png/main.c
grass/trunk/raster/r.out.pov/main.c
grass/trunk/raster/r.out.ppm/main.c
grass/trunk/raster/r.out.ppm3/main.c
grass/trunk/raster/r.out.tiff/main.c
grass/trunk/raster/r.out.vrml/main.c
grass/trunk/raster/r.out.vtk/main.c
grass/trunk/raster/r.param.scale/open_files.c
grass/trunk/raster/r.patch/main.c
grass/trunk/raster/r.profile/main.c
grass/trunk/raster/r.quantile/main.c
grass/trunk/raster/r.random.cells/indep.c
grass/trunk/raster/r.random.cells/init.c
grass/trunk/raster/r.random.surface/init.c
grass/trunk/raster/r.random.surface/main.c
grass/trunk/raster/r.random.surface/save.c
grass/trunk/raster/r.random/count.c
grass/trunk/raster/r.random/random.c
grass/trunk/raster/r.recode/recode.c
grass/trunk/raster/r.resamp.interp/main.c
grass/trunk/raster/r.resamp.rst/main.c
grass/trunk/raster/r.resamp.stats/main.c
grass/trunk/raster/r.resample/main.c
grass/trunk/raster/r.rescale.eq/get_stats.c
grass/trunk/raster/r.rescale/get_range.c
grass/trunk/raster/r.ros/main.c
grass/trunk/raster/r.series/main.c
grass/trunk/raster/r.slope.aspect/main.c
grass/trunk/raster/r.slope.aspect/opennew.c
grass/trunk/raster/r.spread/main.c
grass/trunk/raster/r.spreadpath/main.c
grass/trunk/raster/r.statistics2/main.c
grass/trunk/raster/r.statistics3/main.c
grass/trunk/raster/r.stats/main.c
grass/trunk/raster/r.sun/main.c
grass/trunk/raster/r.sunmask/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.surf.area/main.c
grass/trunk/raster/r.surf.contour/main.c
grass/trunk/raster/r.surf.contour/read_cell.c
grass/trunk/raster/r.surf.fractal/write_rast.c
grass/trunk/raster/r.surf.idw/main.c
grass/trunk/raster/r.surf.idw2/main.c
grass/trunk/raster/r.surf.idw2/read_cell.c
grass/trunk/raster/r.surf.random/randsurf.c
grass/trunk/raster/r.texture/main.c
grass/trunk/raster/r.thin/io.c
grass/trunk/raster/r.to.rast3/main.c
grass/trunk/raster/r.to.rast3elev/main.c
grass/trunk/raster/r.to.vect/main.c
grass/trunk/raster/r.topidx/file_io.c
grass/trunk/raster/r.univar/r.univar_main.c
grass/trunk/raster/r.uslek/main.c
grass/trunk/raster/r.usler/main.c
grass/trunk/raster/r.volume/main.c
grass/trunk/raster/r.walk/main.c
grass/trunk/raster/r.water.outlet/main.c
grass/trunk/raster/r.watershed/ram/close_maps.c
grass/trunk/raster/r.watershed/ram/init_vars.c
grass/trunk/raster/r.watershed/seg/bseg_read.c
grass/trunk/raster/r.watershed/seg/bseg_write.c
grass/trunk/raster/r.watershed/seg/close_maps.c
grass/trunk/raster/r.watershed/seg/cseg_read.c
grass/trunk/raster/r.watershed/seg/cseg_write.c
grass/trunk/raster/r.watershed/seg/dseg_read.c
grass/trunk/raster/r.watershed/seg/dseg_write.c
grass/trunk/raster/r.watershed/seg/init_vars.c
grass/trunk/raster/r.watershed/shed/read.c
grass/trunk/raster/r.watershed/shed/valid.c
grass/trunk/raster/r.what/main.c
grass/trunk/raster/simwe/simlib/input.c
grass/trunk/raster/simwe/simlib/output.c
grass/trunk/raster3d/r3.cross.rast/main.c
grass/trunk/raster3d/r3.out.vtk/main.c
grass/trunk/raster3d/r3.to.rast/main.c
grass/trunk/vector/lidar/v.surf.bspline/main.c
grass/trunk/vector/v.drape/main.c
grass/trunk/vector/v.extrude/main.c
grass/trunk/vector/v.kernel/main.c
grass/trunk/vector/v.neighbors/main.c
grass/trunk/vector/v.sample/main.c
grass/trunk/vector/v.surf.idw/main.c
grass/trunk/vector/v.to.rast/support.c
grass/trunk/vector/v.to.rast/vect2rast.c
grass/trunk/vector/v.vol.rst/main.c
grass/trunk/vector/v.what.rast/main.c
Log:
No need to check return value from Rast_open_*
Modified: grass/trunk/display/d.his/main.c
===================================================================
--- grass/trunk/display/d.his/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/display/d.his/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -121,8 +121,7 @@
name_h = opt_h->answer;
/* Make sure map is available */
- if ((hue_file = Rast_open_old(name_h, "")) == -1)
- G_fatal_error(_("Unable to open raster map <%s>"), name_h);
+ hue_file = Rast_open_old(name_h, "");
hue_r = G_malloc(window.cols);
hue_g = G_malloc(window.cols);
@@ -143,8 +142,7 @@
int_used = 1;
/* Make sure map is available */
- if ((int_file = Rast_open_old(name_i, "")) == -1)
- G_fatal_error(_("Unable to open raster map <%s>"), name_i);
+ int_file = Rast_open_old(name_i, "");
int_r = G_malloc(window.cols);
int_n = G_malloc(window.cols);
@@ -162,8 +160,7 @@
sat_used = 1;
/* Make sure map is available */
- if ((sat_file = Rast_open_old(name_s, "")) == -1)
- G_fatal_error("Unable to open raster map <%s>", name_s);
+ sat_file = Rast_open_old(name_s, "");
sat_r = G_malloc(window.cols);
sat_n = G_malloc(window.cols);
Modified: grass/trunk/display/d.nviz/main.c
===================================================================
--- grass/trunk/display/d.nviz/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/display/d.nviz/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -42,7 +42,7 @@
int main(int argc, char *argv[])
{
- const char *name, *mapset;
+ const char *name;
char outfile[GNAME_MAX];
int fd, projection;
char buf[512], buf1[1024], buf2[1024];
@@ -176,10 +176,7 @@
name = parm.opt1->answer;
/* Open Raster File */
- if (NULL == (mapset = G_find_raster2(name, "")))
- G_fatal_error(_("Raster map <%s> not found"), name);
- if (0 > (fd = Rast_open_old(name, mapset)))
- G_fatal_error(_("Unable to open raster map <%s>"), name);
+ fd = Rast_open_old(name, "");
/* Set Image name */
if (parm.name->answer)
Modified: grass/trunk/display/d.profile/main.c
===================================================================
--- grass/trunk/display/d.profile/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/display/d.profile/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -213,8 +213,6 @@
mapname = map->answer;
fd = Rast_open_old(mapname, "");
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), mapname);
if (stored->answer)
get_map_range();
Modified: grass/trunk/display/d.rast/display.c
===================================================================
--- grass/trunk/display/d.rast/display.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/display/d.rast/display.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -58,8 +58,7 @@
D_set_overlay_mode(overlay);
/* Make sure map is available */
- if ((cellfile = Rast_open_old(name, "")) == -1)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
+ cellfile = Rast_open_old(name, "");
/* Allocate space for cell buffer */
xarray = Rast_allocate_buf(data_type);
Modified: grass/trunk/display/d.rast.arrow/main.c
===================================================================
--- grass/trunk/display/d.rast.arrow/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/display/d.rast.arrow/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -291,8 +291,6 @@
/* open the raster map */
layer_fd = Rast_open_old(layer_name, "");
- if (layer_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), layer_name);
raster_type = Rast_get_map_type(layer_fd);
@@ -303,8 +301,6 @@
if (opt7->answer) {
/* open the magnitude raster map */
mag_fd = Rast_open_old(mag_map, "");
- if (mag_fd < 0)
- G_fatal_error("Unable to open raster map <%s>", mag_map);
mag_raster_type = Rast_get_map_type(mag_fd);
Modified: grass/trunk/display/d.rast.num/main.c
===================================================================
--- grass/trunk/display/d.rast.num/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/display/d.rast.num/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -127,8 +127,6 @@
fixed_color = 1;
layer_fd = Rast_open_old(map_name, "");
- if (layer_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), map_name);
/* determine the inputmap type (CELL/FCELL/DCELL) */
inmap_type = Rast_get_map_type(layer_fd);
Modified: grass/trunk/display/d.rgb/main.c
===================================================================
--- grass/trunk/display/d.rgb/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/display/d.rgb/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -89,8 +89,7 @@
char *name = B[i].opt->answer;
/* Make sure map is available */
- if ((B[i].file = Rast_open_old(name, "")) == -1)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
+ B[i].file = Rast_open_old(name, "");
B[i].type = Rast_get_map_type(B[i].file);
Modified: grass/trunk/display/d.what.rast/opencell.c
===================================================================
--- grass/trunk/display/d.what.rast/opencell.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/display/d.what.rast/opencell.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -20,8 +20,6 @@
strcpy(mapset, m);
fd = Rast_open_old(name, mapset);
- if (fd < 0)
- G_warning(_("Unable to open raster map <%s>"), name);
return fd;
}
Modified: grass/trunk/doc/raster/r.example/main.c
===================================================================
--- grass/trunk/doc/raster/r.example/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/doc/raster/r.example/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -108,10 +108,8 @@
data_type = Rast_map_type(name, mapset);
/* Rast_open_old - returns file destriptor (>0) */
- if ((infd = Rast_open_old(name, mapset)) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
+ 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);
@@ -127,8 +125,7 @@
outrast = Rast_allocate_buf(data_type);
/* controlling, if we can write the raster */
- if ((outfd = Rast_open_new(result, data_type)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), result);
+ outfd = Rast_open_new(result, data_type);
/* for each row */
for (row = 0; row < nrows; row++) {
Modified: grass/trunk/general/g.region/zoom.c
===================================================================
--- grass/trunk/general/g.region/zoom.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/general/g.region/zoom.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -20,9 +20,6 @@
ncols = window->cols;
fd = Rast_open_old(name, mapset);
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s> in <%s>"),
- name, mapset);
map_type = Rast_get_map_type(fd);
raster = Rast_allocate_buf(map_type);
Modified: grass/trunk/imagery/i.albedo/main.c
===================================================================
--- grass/trunk/imagery/i.albedo/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.albedo/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -150,14 +150,9 @@
G_fatal_error(_("Too many input maps. Only %d allowed."), MAXFILES);
name = *ptr;
- infd[nfiles] = Rast_open_old(name, "");
- if (infd[nfiles] < 0)
- continue;
-
/* Allocate input buffer */
in_data_type[nfiles] = Rast_map_type(name, "");
- if ((infd[nfiles] = Rast_open_old(name, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), 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);
@@ -175,8 +170,7 @@
outrast = Rast_allocate_buf(out_data_type);
/* Create New raster files */
- if ((outfd = Rast_open_new(result, 1)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), result);
+ outfd = Rast_open_new(result, 1);
/*START ALBEDO HISTOGRAM STRETCH */
/*This is correcting contrast for water/sand */
Modified: grass/trunk/imagery/i.biomass/main.c
===================================================================
--- grass/trunk/imagery/i.biomass/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.biomass/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -99,28 +99,22 @@
result1 = output1->answer;
/***************************************************/
- if ((infd_fpar = Rast_open_old(fpar, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), fpar);
+ infd_fpar = Rast_open_old(fpar, "");
inrast_fpar = Rast_allocate_d_buf();
- if ((infd_luf = Rast_open_old(luf, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), luf);
+ infd_luf = Rast_open_old(luf, "");
inrast_luf = Rast_allocate_d_buf();
- if ((infd_lat = Rast_open_old(lat, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), lat);
+ infd_lat = Rast_open_old(lat, "");
inrast_lat = Rast_allocate_d_buf();
- if ((infd_doy = Rast_open_old(doy, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), doy);
+ infd_doy = Rast_open_old(doy, "");
inrast_doy = Rast_allocate_d_buf();
- if ((infd_tsw = Rast_open_old(tsw, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), tsw);
+ infd_tsw = Rast_open_old(tsw, "");
inrast_tsw = Rast_allocate_d_buf();
- if ((infd_wa = Rast_open_old(wa, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), wa);
+ infd_wa = Rast_open_old(wa, "");
inrast_wa = Rast_allocate_d_buf();
nrows = G_window_rows();
@@ -128,8 +122,7 @@
outrast1 = Rast_allocate_d_buf();
/* Create New raster files */
- if ((outfd1 = Rast_open_new(result1, DCELL_TYPE)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), result1);
+ outfd1 = Rast_open_new(result1, DCELL_TYPE);
/* Process pixels */
for (row = 0; row < nrows; row++)
Modified: grass/trunk/imagery/i.cca/main.c
===================================================================
--- grass/trunk/imagery/i.cca/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.cca/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -199,15 +199,11 @@
outbandmax[i] = (CELL) 0;
outbandmin[i] = (CELL) 0;
- if ((datafds[i] = Rast_open_old(refs.file[i - 1].name,
- refs.file[i - 1].mapset)) < 0) {
- G_fatal_error(_("Cannot open raster map <%s>"),
- refs.file[i - 1].name);
- }
+ datafds[i] = Rast_open_old(refs.file[i - 1].name,
+ refs.file[i - 1].mapset);
sprintf(tempname, "%s.%d", out_opt->answer, i);
- if ((outfds[i] = Rast_open_c_new(tempname)) < 0)
- G_fatal_error(_("Cannot create raster map <%s>"), tempname);
+ outfds[i] = Rast_open_c_new(tempname);
}
/* do the transform */
Modified: grass/trunk/imagery/i.class/band_files.c
===================================================================
--- grass/trunk/imagery/i.class/band_files.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.class/band_files.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -18,8 +18,7 @@
Bandbuf[n] = Rast_allocate_c_buf();
name = Refer.file[n].name;
mapset = Refer.file[n].mapset;
- if ((Bandfd[n] = Rast_open_old(name, mapset)) < 0)
- G_fatal_error(_("Unable to open band files."));
+ Bandfd[n] = Rast_open_old(name, mapset);
}
return 0;
Modified: grass/trunk/imagery/i.class/draw_cell.c
===================================================================
--- grass/trunk/imagery/i.class/draw_cell.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.class/draw_cell.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -39,10 +39,6 @@
}
fd = Rast_open_old(view->cell.name, view->cell.mapset);
- if (fd < 0) {
- Rast_free_colors(&colr);
- return 0;
- }
dcell = Rast_allocate_d_buf();
sprintf(msg, "Plotting %s ...", view->cell.name);
Modified: grass/trunk/imagery/i.class/signature.c
===================================================================
--- grass/trunk/imagery/i.class/signature.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.class/signature.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -272,10 +272,8 @@
Rast_set_window(&VIEW_MAP1->cell.head);
open_band_files();
- if ((fd = Rast_open_c_new(MASK)) < 0)
- G_fatal_error(_("Unable to open the cell map MASK."));
- if ((buffer = Rast_allocate_c_buf()) == NULL)
- G_fatal_error(_("Unable to allocate the cell buffer in display_signature()."));
+ fd = Rast_open_c_new(MASK);
+ buffer = Rast_allocate_c_buf();
nrows = G_window_rows();
ncols = G_window_cols();
Modified: grass/trunk/imagery/i.cluster/open_files.c
===================================================================
--- grass/trunk/imagery/i.cluster/open_files.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.cluster/open_files.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -54,9 +54,7 @@
name = ref.file[n].name;
mapset = ref.file[n].mapset;
- if ((cellfd[n] = Rast_open_old(name, mapset)) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- G_fully_qualified_name(name, mapset));
+ cellfd[n] = Rast_open_old(name, mapset);
}
I_init_signatures(&in_sig, ref.nfiles);
Modified: grass/trunk/imagery/i.eb.eta/main.c
===================================================================
--- grass/trunk/imagery/i.eb.eta/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.eb.eta/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -76,24 +76,20 @@
tempk = input3->answer;
result1 = output1->answer;
- if ((infd_rnetday = Rast_open_old(rnetday, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), rnetday);
+ infd_rnetday = Rast_open_old(rnetday, "");
inrast_rnetday = Rast_allocate_d_buf();
- if ((infd_evapfr = Rast_open_old(evapfr, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), evapfr);
+ infd_evapfr = Rast_open_old(evapfr, "");
inrast_evapfr = Rast_allocate_d_buf();
- if ((infd_tempk = Rast_open_old(tempk, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), tempk);
+ infd_tempk = Rast_open_old(tempk, "");
inrast_tempk = Rast_allocate_d_buf();
nrows = G_window_rows();
ncols = G_window_cols();
outrast1 = Rast_allocate_d_buf();
- if ((outfd1 = Rast_open_new(result1, DCELL_TYPE)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), result1);
+ outfd1 = Rast_open_new(result1, DCELL_TYPE);
/* Process pixels */
for (row = 0; row < nrows; row++)
Modified: grass/trunk/imagery/i.eb.evapfr/main.c
===================================================================
--- grass/trunk/imagery/i.eb.evapfr/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.eb.evapfr/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -95,18 +95,15 @@
makin = flag1->answer;
/***************************************************/
- if ((infd_rnet = Rast_open_old(rnet, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), rnet);
+ infd_rnet = Rast_open_old(rnet, "");
inrast_rnet = Rast_allocate_d_buf();
/***************************************************/
- if ((infd_g0 = Rast_open_old(g0, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), g0);
+ infd_g0 = Rast_open_old(g0, "");
inrast_g0 = Rast_allocate_d_buf();
/***************************************************/
- if ((infd_h0 = Rast_open_old(h0, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), h0);
+ infd_h0 = Rast_open_old(h0, "");
inrast_h0 = Rast_allocate_d_buf();
/***************************************************/
@@ -118,11 +115,9 @@
outrast2 = Rast_allocate_d_buf();
/* Create New raster files */
- if ((outfd1 = Rast_open_new(result1, DCELL_TYPE)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), result1);
+ outfd1 = Rast_open_new(result1, DCELL_TYPE);
if (makin)
- if ((outfd2 = Rast_open_new(result2, DCELL_TYPE)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), result2);
+ outfd2 = Rast_open_new(result2, DCELL_TYPE);
/* Process pixels */
for (row = 0; row < nrows; row++)
Modified: grass/trunk/imagery/i.eb.h_SEBAL01/main.c
===================================================================
--- grass/trunk/imagery/i.eb.h_SEBAL01/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.eb.h_SEBAL01/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -204,14 +204,10 @@
if (G_legal_filename(h0) < 0)
G_fatal_error(_("<%s> is an illegal name"), h0);
- if ((infd_Rn = Rast_open_old(Rn, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), Rn);
- if ((infd_g0 = Rast_open_old(g0, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), g0);
- if ((infd_z0m = Rast_open_old(z0m, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), z0m);
- if ((infd_t0dem = Rast_open_old(t0dem, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), t0dem);
+ infd_Rn = Rast_open_old(Rn, "");
+ infd_g0 = Rast_open_old(g0, "");
+ 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);
Modified: grass/trunk/imagery/i.eb.soilheatflux/main.c
===================================================================
--- grass/trunk/imagery/i.eb.soilheatflux/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.eb.soilheatflux/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -94,24 +94,19 @@
result = output1->answer;
roerink = flag1->answer;
- if ((infd_albedo = Rast_open_old(albedo, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), albedo);
+ infd_albedo = Rast_open_old(albedo, "");
inrast_albedo = Rast_allocate_d_buf();
- if ((infd_ndvi = Rast_open_old(ndvi, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), ndvi);
+ infd_ndvi = Rast_open_old(ndvi, "");
inrast_ndvi = Rast_allocate_d_buf();
- if ((infd_tempk = Rast_open_old(tempk, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), tempk);
+ infd_tempk = Rast_open_old(tempk, "");
inrast_tempk = Rast_allocate_d_buf();
- if ((infd_rnet = Rast_open_old(rnet, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), rnet);
+ infd_rnet = Rast_open_old(rnet, "");
inrast_rnet = Rast_allocate_d_buf();
- if ((infd_time = Rast_open_old(time, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), time);
+ infd_time = Rast_open_old(time, "");
inrast_time = Rast_allocate_d_buf();
nrows = G_window_rows();
@@ -119,8 +114,7 @@
outrast = Rast_allocate_d_buf();
/* Create New raster files */
- if ((outfd = Rast_open_new(result,DCELL_TYPE)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), result);
+ outfd = Rast_open_new(result,DCELL_TYPE);
/* Process pixels */
for (row = 0; row < nrows; row++)
Modified: grass/trunk/imagery/i.emissivity/main.c
===================================================================
--- grass/trunk/imagery/i.emissivity/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.emissivity/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -62,8 +62,7 @@
result1 = output->answer;
/***************************************************/
- if ((infd = Rast_open_old(ndvi, "")) < 0)
- G_fatal_error(_("Cannot open cell file [%s]"), ndvi);
+ infd = Rast_open_old(ndvi, "");
inr = Rast_allocate_d_buf();
/***************************************************/
@@ -72,8 +71,7 @@
outr = Rast_allocate_d_buf();
/* Create New raster files */
- if ((outfd = Rast_open_new(result1, DCELL_TYPE)) < 0)
- G_fatal_error(_("Could not open <%s>"), result1);
+ outfd = Rast_open_new(result1, DCELL_TYPE);
/* Process pixels */
for (row = 0; row < nrows; row++)
Modified: grass/trunk/imagery/i.evapo.time_integration/main.c
===================================================================
--- grass/trunk/imagery/i.evapo.time_integration/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.evapo.time_integration/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -165,15 +165,9 @@
}
if (!ok)
continue;
- infd[nfiles] = Rast_open_old(name, mapset);
- if (infd[nfiles] < 0) {
- ok = 0;
- continue;
- }
/* Allocate input buffer */
in_data_type[nfiles] = Rast_map_type(name, mapset);
- if ((infd[nfiles] = Rast_open_old(name, mapset)) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
+ 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);
inrast[nfiles] = Rast_allocate_buf(in_data_type[nfiles]);
@@ -198,15 +192,9 @@
}
if (!ok)
continue;
- infd1[nfiles1] = Rast_open_old(name1, mapset);
- if (infd1[nfiles1] < 0) {
- ok = 0;
- continue;
- }
/* Allocate input buffer */
in_data_type1[nfiles1] = Rast_map_type(name1, mapset);
- if ((infd1[nfiles1] = Rast_open_old(name1, mapset)) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name1);
+ 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);
inrast1[nfiles1] = Rast_allocate_buf(in_data_type1[nfiles1]);
@@ -237,19 +225,11 @@
}
if (!ok)
continue;
- infd2[nfiles2] = Rast_open_old(name2, mapset);
- if (infd2[nfiles2] < 0) {
- ok = 0;
- continue;
- }
/* Allocate input buffer */
in_data_type2[nfiles2] = Rast_map_type(name2, mapset);
- if ((infd2[nfiles2] = Rast_open_old(name2, mapset)) < 0) {
- G_fatal_error(_("Unable to open raster map <%s>"), name2);
- }
- if ((Rast_get_cellhd(name2, mapset, &cellhd)) < 0) {
+ 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);
- }
inrast2[nfiles2] = Rast_allocate_d_buf();
nfiles2++;
}
@@ -264,8 +244,7 @@
/* Create New raster files */
- if ((outfd = Rast_open_new(result, 1)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), result);
+ outfd = Rast_open_new(result, 1);
/*******************/
/* Process pixels */
Modified: grass/trunk/imagery/i.fft/main.c
===================================================================
--- grass/trunk/imagery/i.fft/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.fft/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -101,8 +101,6 @@
Cellmap_imag = opt.imag->answer;
inputfd = Rast_open_old(Cellmap_orig, "");
- if (inputfd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), Cellmap_orig);
if (Rast_maskfd() >= 0)
G_warning(_("Raster MASK found, consider to remove "
@@ -150,10 +148,8 @@
fft2(-1, data, totsize, cols, rows);
/* open the output cell maps */
- if ((realfd = Rast_open_fp_new(Cellmap_real)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), Cellmap_real);
- if ((imagfd = Rast_open_fp_new(Cellmap_imag)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), Cellmap_imag);
+ realfd = Rast_open_fp_new(Cellmap_real);
+ imagfd = Rast_open_fp_new(Cellmap_imag);
#define SWAP1(a, b) \
do { \
Modified: grass/trunk/imagery/i.gensig/openfiles.c
===================================================================
--- grass/trunk/imagery/i.gensig/openfiles.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.gensig/openfiles.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -31,18 +31,12 @@
/* open training map for reading */
mapset = G_find_raster2(parms->training_map, "");
files->train_fd = Rast_open_old(parms->training_map, mapset);
- if (files->train_fd < 0)
- G_fatal_error(_("Unable to open training map <%s>"),
- parms->training_map);
files->train_cell = Rast_allocate_c_buf();
/* open all maps for reading */
for (n = 0; n < Ref.nfiles; n++) {
files->band_fd[n] =
Rast_open_old(Ref.file[n].name, Ref.file[n].mapset);
- if (files->band_fd[n] < 0)
- G_fatal_error(_("Unable to open training map <%s in %s>"),
- Ref.file[n].name, Ref.file[n].mapset);
files->band_cell[n] = Rast_allocate_d_buf();
}
Modified: grass/trunk/imagery/i.gensigset/openfiles.c
===================================================================
--- grass/trunk/imagery/i.gensigset/openfiles.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.gensigset/openfiles.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -31,18 +31,12 @@
/* open training map for reading */
mapset = G_find_raster2(parms->training_map, "");
files->train_fd = Rast_open_old(parms->training_map, mapset);
- if (files->train_fd < 0)
- G_fatal_error(_("Unable to open training map <%s>"),
- parms->training_map);
files->train_cell = Rast_allocate_c_buf();
/* open all maps for reading */
for (n = 0; n < Ref.nfiles; n++) {
files->band_fd[n] =
Rast_open_old(Ref.file[n].name, Ref.file[n].mapset);
- if (files->band_fd[n] < 0)
- G_fatal_error(_("Unable to open training map <%s in %s>"),
- Ref.file[n].name, Ref.file[n].mapset);
files->band_cell[n] = Rast_allocate_d_buf();
}
Modified: grass/trunk/imagery/i.his.rgb/openfiles.c
===================================================================
--- grass/trunk/imagery/i.his.rgb/openfiles.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.his.rgb/openfiles.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -10,28 +10,17 @@
int fd_input[3], int fd_output[3], CELL * rowbuf[3])
{
/* open output files */
- if ((fd_output[0] = Rast_open_c_new(r_name)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), r_name);
- if ((fd_output[1] = Rast_open_c_new(g_name)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), g_name);
- if ((fd_output[2] = Rast_open_c_new(b_name)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), b_name);
+ fd_output[0] = Rast_open_c_new(r_name);
+ fd_output[1] = Rast_open_c_new(g_name);
+ fd_output[2] = Rast_open_c_new(b_name);
/* allocate the cell row buffer */
- if ((rowbuf[0] = Rast_allocate_c_buf()) == NULL)
- G_fatal_error(_("Unable to allocate the input row buffer"));
- if ((rowbuf[1] = Rast_allocate_c_buf()) == NULL)
- G_fatal_error(_("Unable to allocate the input row buffer"));
- if ((rowbuf[2] = Rast_allocate_c_buf()) == NULL)
- G_fatal_error(_("Unable to allocate the input row buffer"));
+ rowbuf[0] = Rast_allocate_c_buf();
+ rowbuf[1] = Rast_allocate_c_buf();
+ rowbuf[2] = Rast_allocate_c_buf();
/* open input files (maps can be in different mapsets) */
- if ((fd_input[0] = Rast_open_old(h_name, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), h_name);
-
- if ((fd_input[1] = Rast_open_old(i_name, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), i_name);
-
- if ((fd_input[2] = Rast_open_old(s_name, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), s_name);
+ fd_input[0] = Rast_open_old(h_name, "");
+ fd_input[1] = Rast_open_old(i_name, "");
+ fd_input[2] = Rast_open_old(s_name, "");
}
Modified: grass/trunk/imagery/i.ifft/main.c
===================================================================
--- grass/trunk/imagery/i.ifft/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.ifft/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -102,14 +102,7 @@
/* open input raster map */
realfd = Rast_open_old(Cellmap_real, "");
- if (realfd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- Cellmap_real);
-
imagfd = Rast_open_old(Cellmap_imag, "");
- if (imagfd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- Cellmap_imag);
/* get and compare the original window data */
Rast_get_cellhd(Cellmap_real, "", &realhead);
@@ -212,11 +205,8 @@
fft2(1, data, totsize, cols, rows);
/* open the output cell map */
- if ((outputfd = Rast_open_fp_new(Cellmap_orig)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"),
- Cellmap_orig);
+ outputfd = Rast_open_fp_new(Cellmap_orig);
-
/* Write out result to a new cell map */
G_message(_("Writing raster map <%s>..."),
Cellmap_orig);
Modified: grass/trunk/imagery/i.latlong/main.c
===================================================================
--- grass/trunk/imagery/i.latlong/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.latlong/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -78,8 +78,7 @@
result1 = output1->answer;
/***************************************************/
- if ((infd = Rast_open_old(in, "")) < 0)
- G_fatal_error(_("Cannot open cell file [%s]"), in);
+ infd = Rast_open_old(in, "");
if (Rast_get_cellhd(in, "", &cellhd) < 0)
G_fatal_error(_("Cannot read file header of [%s])"), in);
inrast = Rast_allocate_d_buf();
@@ -119,8 +118,7 @@
outrast1 = Rast_allocate_d_buf();
- if ((outfd1 = Rast_open_new(result1,DCELL_TYPE)) < 0)
- G_fatal_error(_("Could not open <%s>"), result1);
+ outfd1 = Rast_open_new(result1, DCELL_TYPE);
for (row = 0; row < nrows; row++)
{
Modified: grass/trunk/imagery/i.maxlik/open.c
===================================================================
--- grass/trunk/imagery/i.maxlik/open.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.maxlik/open.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -38,9 +38,7 @@
cell[n] = Rast_allocate_d_buf();
name = Ref.file[n].name;
mapset = Ref.file[n].mapset;
- if ((cellfd[n] = Rast_open_old(name, mapset)) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- G_fully_qualified_name(name, mapset));
+ cellfd[n] = Rast_open_old(name, mapset);
}
I_init_signatures(&S, Ref.nfiles);
@@ -63,19 +61,12 @@
invert_signatures();
class_fd = Rast_open_c_new(class_name);
- if (class_fd < 0)
- exit(EXIT_FAILURE);
-
class_cell = Rast_allocate_c_buf();
reject_cell = NULL;
if (reject_name) {
reject_fd = Rast_open_c_new(reject_name);
- if (reject_fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"),
- reject_name);
- else
- reject_cell = Rast_allocate_c_buf();
+ reject_cell = Rast_allocate_c_buf();
}
return 0;
Modified: grass/trunk/imagery/i.modis.qc/main.c
===================================================================
--- grass/trunk/imagery/i.modis.qc/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.modis.qc/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -197,8 +197,7 @@
(!strcmp(qcflag, "pixel_adjacent_to_cloud") && (strcmp(product, "mod09A1s"))))
G_fatal_error(_("This flag is only available for MOD09A1s @ 500m products"));
- if ((infd = Rast_open_old(qcchan, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), qcchan);
+ infd = Rast_open_old(qcchan, "");
if (Rast_get_cellhd(qcchan, "", &cellhd) < 0)
G_fatal_error(_("Unable to read header of raster map <%s> "), qcchan);
@@ -211,8 +210,7 @@
outrast = Rast_allocate_c_buf();
/* Create New raster files */
- if ((outfd = Rast_open_new(result, data_type_output)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), result);
+ outfd = Rast_open_new(result, data_type_output);
/* Process pixels */
for (row = 0; row < nrows; row++)
Modified: grass/trunk/imagery/i.pca/main.c
===================================================================
--- grass/trunk/imagery/i.pca/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.pca/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -117,9 +117,7 @@
sprintf(tmpbuf, "%s.%d", opt_out->answer, i + 1);
G_check_input_output_name(opt_in->answers[i], tmpbuf, GR_FATAL_EXIT);
- if ((inp_fd[i] = Rast_open_old(opt_in->answers[i], "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- opt_in->answers[i]);
+ inp_fd[i] = Rast_open_old(opt_in->answers[i], "");
}
G_verbose_message(_("Calculating covariance matrix..."));
@@ -392,10 +390,6 @@
Rast_set_fp_type(DCELL_TYPE);
}
- if (out_fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"),
- G_fully_qualified_name(name, G_mapset()));
-
for (pass = 1; pass <= PASSES; pass++) {
void *rowbuf = NULL;
int row, col;
Modified: grass/trunk/imagery/i.points/drawcell.c
===================================================================
--- grass/trunk/imagery/i.points/drawcell.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.points/drawcell.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -50,8 +50,6 @@
return 1;
fd = Rast_open_old(view->cell.name, view->cell.mapset);
- if (fd < 0)
- return 0;
dcell = Rast_allocate_d_buf();
sprintf(msg, "Plotting %s ...", view->cell.name);
Modified: grass/trunk/imagery/i.rectify/rectify.c
===================================================================
--- grass/trunk/imagery/i.rectify/rectify.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.rectify/rectify.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -18,7 +18,6 @@
int row, col;
int infd;
void *rast;
- char buf[2048] = "";
select_current_env();
if (Rast_get_cellhd(name, mapset, &cellhd) < 0)
@@ -43,10 +42,6 @@
*/
Rast_set_window(&cellhd);
infd = Rast_open_old(name, mapset);
- if (infd < 0) {
- close(infd);
- return 0;
- }
map_type = Rast_get_map_type(infd);
rast = (void *)G_calloc(G_window_cols() + 1, Rast_cell_size(map_type));
Rast_set_null_value(rast, G_window_cols() + 1, map_type);
Modified: grass/trunk/imagery/i.rectify/write.c
===================================================================
--- grass/trunk/imagery/i.rectify/write.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.rectify/write.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -48,9 +48,6 @@
temp_fd = open(temp_name, 0);
fd = Rast_open_new(name, map_type);
- if (fd <= 0)
- G_fatal_error(_("Unable to create raster map <%s>"), name);
-
for (row = 0; row < target_window.rows; row++) {
if (read(temp_fd, rast, target_window.cols * Rast_cell_size(map_type))
!= target_window.cols * Rast_cell_size(map_type))
Modified: grass/trunk/imagery/i.rgb.his/openfiles.c
===================================================================
--- grass/trunk/imagery/i.rgb.his/openfiles.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.rgb.his/openfiles.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -9,26 +9,17 @@
char *h_name, char *i_name, char *s_name,
int fd_input[3], int fd_output[3], CELL * rowbuf[3])
{
- if ((fd_input[0] = Rast_open_old(r_name, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), r_name);
- if ((fd_input[1] = Rast_open_old(g_name, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), g_name);
- if ((fd_input[2] = Rast_open_old(b_name, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), b_name);
+ fd_input[0] = Rast_open_old(r_name, "");
+ fd_input[1] = Rast_open_old(g_name, "");
+ fd_input[2] = Rast_open_old(b_name, "");
/* open output files */
- if ((fd_output[0] = Rast_open_c_new(h_name)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), h_name);
- if ((fd_output[1] = Rast_open_c_new(i_name)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), i_name);
- if ((fd_output[2] = Rast_open_c_new(s_name)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), s_name);
+ fd_output[0] = Rast_open_c_new(h_name);
+ fd_output[1] = Rast_open_c_new(i_name);
+ fd_output[2] = Rast_open_c_new(s_name);
/* allocate the cell row buffer */
- if ((rowbuf[0] = Rast_allocate_c_buf()) == NULL)
- G_fatal_error(_("Unable to allocate the input row buffer"));
- if ((rowbuf[1] = Rast_allocate_c_buf()) == NULL)
- G_fatal_error(_("Unable to allocate the input row buffer"));
- if ((rowbuf[2] = Rast_allocate_c_buf()) == NULL)
- G_fatal_error(_("Unable to allocate the input row buffer"));
+ rowbuf[0] = Rast_allocate_c_buf();
+ rowbuf[1] = Rast_allocate_c_buf();
+ rowbuf[2] = Rast_allocate_c_buf();
}
Modified: grass/trunk/imagery/i.smap/opencell.c
===================================================================
--- grass/trunk/imagery/i.smap/opencell.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.smap/opencell.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -6,30 +6,10 @@
int open_cell_old(const char *name, const char *mapset)
{
- int fd;
-
- if (mapset == NULL)
- mapset = G_find_raster2(name, "");
- fd = Rast_open_old(name, mapset);
- if (fd >= 0)
- return fd;
-
- G_fatal_error(_("Unable to open raster map <%s>"), name);
-
- /* should not get here */
- return -1;
+ return Rast_open_old(name, mapset);
}
int open_cell_new(const char *name)
{
- int fd;
-
- fd = Rast_open_c_new(name);
- if (fd >= 0)
- return fd;
-
- G_fatal_error(_("Unable to create raster map <%s>"), name);
-
- /* should not get here */
- return -1;
+ return Rast_open_c_new(name);
}
Modified: grass/trunk/imagery/i.sunhours/main.c
===================================================================
--- grass/trunk/imagery/i.sunhours/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.sunhours/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -70,13 +70,11 @@
result1 = output1->answer;
/***************************************************/
- if ((infd_doy = Rast_open_old(doy, "")) < 0)
- G_fatal_error(_("Cannot open cell file [%s]"), doy);
+ infd_doy = Rast_open_old(doy, "");
inrast_doy = Rast_allocate_d_buf();
/***************************************************/
- if ((infd_lat = Rast_open_old(lat, "")) < 0)
- G_fatal_error(_("Cannot open cell file [%s]"), lat);
+ infd_lat = Rast_open_old(lat, "");
inrast_lat = Rast_allocate_d_buf();
/***************************************************/
@@ -84,10 +82,8 @@
ncols = G_window_cols();
outrast1 = Rast_allocate_d_buf();
+ outfd1 = Rast_open_new(result1, DCELL_TYPE);
- if ((outfd1 = Rast_open_new(result1, DCELL_TYPE)) < 0)
- G_fatal_error(_("Could not open <%s>"), result1);
-
for (row = 0; row < nrows; row++)
{
DCELL d;
Modified: grass/trunk/imagery/i.vi/main.c
===================================================================
--- grass/trunk/imagery/i.vi/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.vi/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -211,36 +211,30 @@
G_fatal_error(_("gvi index requires blue, green, red, nir, chan5 and chan7 maps"));
if ((infd_redchan = Rast_open_old(redchan, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), redchan);
inrast_redchan = Rast_allocate_d_buf();
if (nirchan) {
- if ((infd_nirchan = Rast_open_old(nirchan, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), nirchan);
+ infd_nirchan = Rast_open_old(nirchan, "");
inrast_nirchan = Rast_allocate_d_buf();
}
if (greenchan) {
- if ((infd_greenchan = Rast_open_old(greenchan, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), greenchan);
+ infd_greenchan = Rast_open_old(greenchan, "");
inrast_greenchan = Rast_allocate_d_buf();
}
if (bluechan) {
- if ((infd_bluechan = Rast_open_old(bluechan, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), bluechan);
+ infd_bluechan = Rast_open_old(bluechan, "");
inrast_bluechan = Rast_allocate_d_buf();
}
if (chan5chan) {
- if ((infd_chan5chan = Rast_open_old(chan5chan, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), chan5chan);
+ infd_chan5chan = Rast_open_old(chan5chan, "");
inrast_chan5chan = Rast_allocate_d_buf();
}
if (chan7chan) {
- if ((infd_chan7chan = Rast_open_old(chan7chan, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), chan7chan);
+ infd_chan7chan = Rast_open_old(chan7chan, "");
inrast_chan7chan = Rast_allocate_d_buf();
}
@@ -249,8 +243,7 @@
outrast = Rast_allocate_d_buf();
/* Create New raster files */
- if ((outfd = Rast_open_new(result, DCELL_TYPE)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), result);
+ outfd = Rast_open_new(result, DCELL_TYPE);
/* Process pixels */
for (row = 0; row < nrows; row++)
Modified: grass/trunk/imagery/i.vpoints/drawcell.c
===================================================================
--- grass/trunk/imagery/i.vpoints/drawcell.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.vpoints/drawcell.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -60,8 +60,6 @@
return 1;
fd = Rast_open_old(view->cell.name, view->cell.mapset);
- if (fd < 0)
- return 0;
dcell = Rast_allocate_d_buf();
sprintf(msg, "Displaying %s ...", view->cell.name);
Modified: grass/trunk/imagery/i.zc/main.c
===================================================================
--- grass/trunk/imagery/i.zc/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/imagery/i.zc/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -101,8 +101,6 @@
/* open input cell map */
inputfd = Rast_open_old(input_map->answer, "");
- if (inputfd < 0)
- exit(EXIT_FAILURE);
sscanf(threshold->answer, "%1lf", &Thresh);
if (Thresh <= 0.0)
@@ -172,8 +170,7 @@
/* open the output cell maps and allocate cell row buffers */
G_message(_("Writing transformed data to file..."));
- if ((zcfd = Rast_open_c_new(output_map->answer)) < 0)
- exit(EXIT_FAILURE);
+ zcfd = Rast_open_c_new(output_map->answer);
cell_row = Rast_allocate_c_buf();
Modified: grass/trunk/ps/ps.map/outl_io.c
===================================================================
--- grass/trunk/ps/ps.map/outl_io.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/ps/ps.map/outl_io.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -64,8 +64,7 @@
{
/* open raster map */
sscanf(cell, "%s", cell_name);
- if ((in_file_d = Rast_open_old(cell_name, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), cell_name);
+ in_file_d = Rast_open_old(cell_name, "");
map_type = Rast_get_map_type(in_file_d);
raster_size = Rast_cell_size(map_type);
Modified: grass/trunk/ps/ps.map/r_cell.c
===================================================================
--- grass/trunk/ps/ps.map/r_cell.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/ps/ps.map/r_cell.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -30,11 +30,7 @@
Rast_get_c_color_range(&PS.min_color, &PS.max_color, &PS.colors);
/* open raster map for reading */
- if ((PS.cell_fd = Rast_open_old(name, mapset)) < 0) {
- error(fullname, "", "can't open raster map");
- Rast_free_colors(&PS.colors);
- return 0;
- }
+ PS.cell_fd = Rast_open_old(name, mapset);
strcpy(PS.celltitle, Rast_get_cell_title(name, mapset));
G_strip(PS.celltitle);
Modified: grass/trunk/ps/ps.map/r_group.c
===================================================================
--- grass/trunk/ps/ps.map/r_group.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/ps/ps.map/r_group.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -50,14 +50,8 @@
}
/* open raster maps for reading */
- for (i = 0; i < 3; i++) {
- if ((grp.fd[i] = Rast_open_old(grp.name[i], grp.mapset[i])) < 0) {
- sprintf(fullname, "%s in %s", grp.name[i], grp.mapset[i]);
- error(fullname, "", "can't open raster map");
- Rast_free_colors(&(grp.colors[i]));
- return 0;
- }
- }
+ for (i = 0; i < 3; i++)
+ grp.fd[i] = Rast_open_old(grp.name[i], grp.mapset[i]);
strcpy(PS.celltitle, grp.group_name);
G_strip(PS.celltitle);
Modified: grass/trunk/ps/ps.map/r_rgb.c
===================================================================
--- grass/trunk/ps/ps.map/r_rgb.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/ps/ps.map/r_rgb.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -74,12 +74,7 @@
}
/* open raster maps for reading */
- if ((grp.fd[i] = Rast_open_old(grp.name[i], grp.mapset[i])) < 0) {
- sprintf(fullname, "%s in %s", grp.name[i], grp.mapset[i]);
- error(fullname, "", "can't open raster map");
- Rast_free_colors(&(grp.colors[i]));
- return 0;
- }
+ grp.fd[i] = Rast_open_old(grp.name[i], grp.mapset[i]);
}
strcpy(PS.celltitle, grp.group_name);
Modified: grass/trunk/raster/r.basins.fill/main.c
===================================================================
--- grass/trunk/raster/r.basins.fill/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.basins.fill/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -105,8 +105,6 @@
ridge = read_map(ridge_name, NOMASK, nrows, ncols);
partfd = Rast_open_c_new(part_name);
- if (partfd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), part_name);
/* run through file and set streams to zero at locations where ridges exist */
for (row = 0; row < nrows; row++) {
Modified: grass/trunk/raster/r.basins.fill/read_map.c
===================================================================
--- grass/trunk/raster/r.basins.fill/read_map.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.basins.fill/read_map.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -33,8 +33,7 @@
map = (CELL *) G_malloc(nrows * ncols * sizeof(CELL));
/* open the map */
- if ((fd = Rast_open_old(name, "")) < 0)
- G_fatal_error(_("Unable to open <%s>"), name);
+ fd = Rast_open_old(name, "");
/* read the map */
G_message(_("Reading <%s> ... "), name);
Modified: grass/trunk/raster/r.bitpattern/main.c
===================================================================
--- grass/trunk/raster/r.bitpattern/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.bitpattern/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -96,9 +96,7 @@
pat = atoi(pattern->answer);
patv = atoi(patval->answer);
- /*if Gispf() error */
- if ((infd = Rast_open_old(name, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
+ infd = Rast_open_old(name, "");
/* determine the inputmap type (CELL/FCELL/DCELL) */
data_type = Rast_get_map_type(infd);
@@ -114,8 +112,7 @@
ncols = G_window_cols();
outrast = Rast_allocate_buf(data_type);
- if ((outfd = Rast_open_new(result, data_type)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), result);
+ outfd = Rast_open_new(result, data_type);
for (row = 0; row < nrows; row++) {
CELL c;
Modified: grass/trunk/raster/r.buffer/read_map.c
===================================================================
--- grass/trunk/raster/r.buffer/read_map.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.buffer/read_map.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -39,8 +39,6 @@
map = (MAPTYPE *) G_malloc(window.rows * window.cols * sizeof(MAPTYPE));
fd = Rast_open_old(input, mapset);
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), input);
cell = Rast_allocate_c_buf();
Modified: grass/trunk/raster/r.buffer/write_map.c
===================================================================
--- grass/trunk/raster/r.buffer/write_map.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.buffer/write_map.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -37,14 +37,10 @@
int k;
fd_out = Rast_open_c_new(output);
- if (fd_out < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), output);
- if (offset) {
+ if (offset)
fd_in = Rast_open_old(output, G_mapset());
- if (fd_in < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), output);
- }
+
cell = Rast_allocate_c_buf();
G_message(_("Writing output raster map <%s>..."), output);
Modified: grass/trunk/raster/r.carve/main.c
===================================================================
--- grass/trunk/raster/r.carve/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.carve/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -161,17 +161,12 @@
if ((rmapset = G_find_file2("cell", parm.inrast->answer, "")) == NULL)
G_fatal_error(_("Raster map <%s> not found"), parm.inrast->answer);
- if ((infd = Rast_open_old(parm.inrast->answer, rmapset)) == -1)
- G_fatal_error(_("Unable to open raster map <%s>"),
- parm.inrast->answer);
+ infd = Rast_open_old(parm.inrast->answer, rmapset);
parm.raster_type = Rast_get_map_type(infd);
/* open new map for output */
- if ((outfd =
- Rast_open_new(parm.outrast->answer, parm.raster_type)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"),
- parm.outrast->answer);
+ outfd = Rast_open_new(parm.outrast->answer, parm.raster_type);
/* if specified, open vector for output */
if (parm.outvect->answer)
Modified: grass/trunk/raster/r.category/cats.c
===================================================================
--- grass/trunk/raster/r.category/cats.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.category/cats.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -40,9 +40,6 @@
/* open the raster map */
fd = Rast_open_old(name, mapset);
- if (fd < 0)
- G_fatal_error(_("Cannot open cell file of raster map <%s> in <%s>"),
- name, mapset);
nrows = G_window_rows();
ncols = G_window_cols();
cell = Rast_allocate_c_buf();
Modified: grass/trunk/raster/r.category/main.c
===================================================================
--- grass/trunk/raster/r.category/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.category/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -147,8 +147,7 @@
G_fatal_error(_("Raster map <%s> not found"),
parm.raster->answer);
- if ((fd = Rast_open_old(name, mapset)) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
+ fd = Rast_open_old(name, mapset);
Rast_init_cats("", &cats);
Modified: grass/trunk/raster/r.circle/main.c
===================================================================
--- grass/trunk/raster/r.circle/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.circle/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -123,9 +123,7 @@
G_get_set_window(&w);
- if ((cellfile = Rast_open_c_new(out_file->answer)) == -1)
- G_fatal_error(_("Unable to create raster map <%s>"),
- out_file->answer);
+ cellfile = Rast_open_c_new(out_file->answer);
int_buf = (int *)G_malloc(w.cols * sizeof(int));
{
Modified: grass/trunk/raster/r.clump/main.c
===================================================================
--- grass/trunk/raster/r.clump/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.clump/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -70,12 +70,8 @@
strcpy(name, INPUT);
in_fd = Rast_open_old(name, "");
- if (in_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), INPUT);
out_fd = Rast_open_c_new(OUTPUT);
- if (out_fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), OUTPUT);
clump(in_fd, out_fd);
Modified: grass/trunk/raster/r.colors/stats.c
===================================================================
--- grass/trunk/raster/r.colors/stats.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.colors/stats.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -30,9 +30,7 @@
int row, nrows, ncols;
int fd;
- if ((fd = Rast_open_old(name, mapset)) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- G_fully_qualified_name(name, mapset));
+ fd = Rast_open_old(name, mapset);
cell = Rast_allocate_c_buf();
nrows = G_window_rows();
@@ -63,9 +61,7 @@
int row, col, nrows, ncols;
int fd;
- if ((fd = Rast_open_old(name, mapset)) < 0)
- G_fatal_error("Unable to open raster map <%s>",
- G_fully_qualified_name(name, mapset));
+ fd = Rast_open_old(name, mapset);
dcell = Rast_allocate_d_buf();
nrows = G_window_rows();
Modified: grass/trunk/raster/r.composite/main.c
===================================================================
--- grass/trunk/raster/r.composite/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.composite/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -152,8 +152,7 @@
b->name = b->opt_name->answer;
/* Make sure map is available */
- if ((b->file = Rast_open_old(b->name, "")) == -1)
- G_fatal_error(_("Unable to open raster map <%s>"), b->name);
+ b->file = Rast_open_old(b->name, "");
b->type = Rast_get_map_type(b->file);
@@ -181,8 +180,7 @@
/* open output files */
out_name = opt_out->answer;
- if ((out_file = Rast_open_c_new(out_name)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), out_name);
+ out_file = Rast_open_c_new(out_name);
out_array = Rast_allocate_c_buf();
Modified: grass/trunk/raster/r.compress/main.c
===================================================================
--- grass/trunk/raster/r.compress/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.compress/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -192,8 +192,6 @@
Rast_set_window(&cellhd);
old = Rast_open_old(name, G_mapset());
- if (old < 0)
- return 1;
if (uncompress) {
if (map_type == CELL_TYPE) {
@@ -208,8 +206,6 @@
else
new = Rast_open_new(name, map_type);
- if (new < 0)
- return 1;
nrows = G_window_rows();
rast = Rast_allocate_buf(map_type);
Modified: grass/trunk/raster/r.contour/main.c
===================================================================
--- grass/trunk/raster/r.contour/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.contour/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -136,8 +136,6 @@
name = map->answer;
fd = Rast_open_old(name, "");
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
if (Rast_read_fp_range(name, "", &range) < 0)
G_fatal_error(_("Unable to read fp range of raster map <%s>"),
Modified: grass/trunk/raster/r.cost/main.c
===================================================================
--- grass/trunk/raster/r.cost/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.cost/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -373,9 +373,6 @@
cost_fd = Rast_open_old(cost_layer, cost_mapset);
- if (cost_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), cost_layer);
-
data_type = Rast_get_map_type(cost_fd);
cell = Rast_allocate_buf(data_type);
@@ -645,9 +642,6 @@
G_fatal_error(_("Raster map <%s> not found"), opt9->answer);
fd = Rast_open_old(opt9->answer, search_mapset);
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- opt9->answer);
data_type2 = Rast_get_map_type(fd);
Modified: grass/trunk/raster/r.covar/main.c
===================================================================
--- grass/trunk/raster/r.covar/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.covar/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -77,8 +77,6 @@
dcell[i] = Rast_allocate_d_buf();
name = maps->answers[i];
fd[i] = Rast_open_old(name, "");
- if (fd[i] < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
}
nrows = G_window_rows();
Modified: grass/trunk/raster/r.cross/main.c
===================================================================
--- grass/trunk/raster/r.cross/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.cross/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -109,8 +109,6 @@
G_fatal_error(_("Raster map <%s> not found"), name);
names[nfiles] = name;
fd[nfiles] = Rast_open_old(name, mapset);
- if (fd[nfiles] < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
Rast_read_range(name, mapset, &range);
ncats = range.max - range.min;
@@ -125,10 +123,6 @@
output = parm.output->answer;
outfd = Rast_open_c_new(output);
- if (outfd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"),
- parm.output->answer);
-
sprintf(buf, "Cross of %s", names[0]);
for (i = 1; i < nfiles - 1; i++) {
strcat(buf, ", ");
Modified: grass/trunk/raster/r.describe/describe.c
===================================================================
--- grass/trunk/raster/r.describe/describe.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.describe/describe.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -50,8 +50,6 @@
get_row = Rast_get_c_row_nomask;
}
fd = Rast_open_old(name, "");
- if (fd < 0)
- return 0;
map_type = Rast_get_map_type(fd);
if (as_int)
Modified: grass/trunk/raster/r.distance/edges.c
===================================================================
--- grass/trunk/raster/r.distance/edges.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.distance/edges.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -59,8 +59,6 @@
}
fd = Rast_open_old(map->name, map->mapset);
- if (fd < 0)
- exit(1);
init_edge_list(map);
Modified: grass/trunk/raster/r.flow/io.c
===================================================================
--- grass/trunk/raster/r.flow/io.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.flow/io.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -163,9 +163,8 @@
ds.sfd = open_segment_file(tmp_name(G_tempfile()), ds, TEMP);
}
- if (parm.lgout &&
- ((lgfd = Rast_open_new(parm.lgout, FCELL_TYPE)) < 0))
- G_fatal_error(_("Unable to create raster map <%s>"), parm.lgout);
+ if (parm.lgout)
+ lgfd = Rast_open_new(parm.lgout, FCELL_TYPE);
if (parm.flout && (Vect_open_new(&fl, parm.flout, 0) < 0))
G_fatal_error(_("Unable to create vector map <%s>"), parm.flout);
@@ -200,8 +199,6 @@
G_message(_("Writing density file"));
dsfd = Rast_open_new(parm.dsout, DCELL_TYPE);
- if (dsfd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), parm.dsout);
for (row = 0; row < region.rows; row++) {
Rast_put_row(dsfd, get_row(ds, row), DCELL_TYPE);
Modified: grass/trunk/raster/r.grow/main.c
===================================================================
--- grass/trunk/raster/r.grow/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.grow/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -183,14 +183,10 @@
G_fatal_error(_("Unknown metric: [%s]."), opt.met->answer);
in_fd = Rast_open_old(in_name, "");
- if (in_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), in_name);
type = Rast_get_map_type(in_fd);
out_fd = Rast_open_new(out_name, type);
- if (out_fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), out_name);
if (Rast_read_cats(in_name, "", &cats) == -1) {
G_warning(_("Error reading category file for <%s>"), in_name);
Modified: grass/trunk/raster/r.grow.distance/main.c
===================================================================
--- grass/trunk/raster/r.grow.distance/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.grow.distance/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -209,20 +209,12 @@
scale = G_database_units_to_meters_factor();
in_fd = Rast_open_old(in_name, "");
- if (in_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), in_name);
- if (dist_name) {
+ if (dist_name)
dist_fd = Rast_open_new(dist_name, DCELL_TYPE);
- if (dist_fd < 0)
- G_fatal_error(_("Unable to create distance map <%s>"), dist_name);
- }
- if (val_name) {
+ if (val_name)
val_fd = Rast_open_new(val_name, DCELL_TYPE);
- if (val_fd < 0)
- G_fatal_error(_("Unable to create value map <%s>"), val_name);
- }
temp_name = G_tempfile();
temp_fd = open(temp_name, O_RDWR | O_CREAT | O_EXCL, 0700);
Modified: grass/trunk/raster/r.his/main.c
===================================================================
--- grass/trunk/raster/r.his/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.his/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -122,8 +122,7 @@
name_h = opt_h->answer;
/* Make sure map is available */
- if ((hue_file = Rast_open_old(name_h, "")) == -1)
- G_fatal_error(_("Unable to open raster map <%s>"), name_h);
+ hue_file = Rast_open_old(name_h, "");
hue_r = G_malloc(window.cols);
hue_g = G_malloc(window.cols);
@@ -143,8 +142,7 @@
name_i = opt_i->answer;
int_used = 1;
/* Make sure map is available */
- if ((int_file = Rast_open_old(name_i, "")) == -1)
- G_fatal_error(_("Unable to open raster map <%s>"), name_i);
+ int_file = Rast_open_old(name_i, "");
int_r = G_malloc(window.cols);
int_n = G_malloc(window.cols);
@@ -162,8 +160,7 @@
sat_used = 1;
/* Make sure map is available */
- if ((sat_file = Rast_open_old(name_s, "")) == -1)
- G_fatal_error(_("Unable to open raster map <%s>"), name_s);
+ sat_file = Rast_open_old(name_s, "");
sat_r = G_malloc(window.cols);
sat_n = G_malloc(window.cols);
@@ -177,33 +174,24 @@
if (opt_r->answer != NULL) {
name_r = opt_r->answer;
-
- if ((r_file = Rast_open_c_new(name_r)) < 0)
- r_used = 0;
- else
- r_used = 1;
+ r_file = Rast_open_c_new(name_r);
+ r_used = 1;
}
g_used = 0;
if (opt_g->answer != NULL) {
name_g = opt_g->answer;
-
- if ((g_file = Rast_open_c_new(name_g)) < 0)
- g_used = 0;
- else
- g_used = 1;
+ g_file = Rast_open_c_new(name_g);
+ g_used = 1;
}
b_used = 0;
if (opt_b->answer != NULL) {
name_b = opt_b->answer;
-
- if ((b_file = Rast_open_c_new(name_b)) < 0)
- b_used = 0;
- else
- b_used = 1;
+ b_file = Rast_open_c_new(name_b);
+ b_used = 1;
}
r_array = Rast_allocate_c_buf();
Modified: grass/trunk/raster/r.horizon/main.c
===================================================================
--- grass/trunk/raster/r.horizon/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.horizon/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -542,11 +542,8 @@
}
/*read Z raster */
- if ((mapset = G_find_raster2(elevin, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), elevin);
+ fd1 = Rast_open_old(elevin, "");
- fd1 = Rast_open_old(elevin, mapset);
-
for (row = 0; row < m; row++) {
Rast_get_f_row(fd1, cell1, row);
@@ -610,8 +607,6 @@
if (horizon != NULL) {
cell1 = Rast_allocate_f_buf();
fd1 = Rast_open_fp_new(shad_filename);
- if (fd1 < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), shad_filename);
}
if (numrows != G_window_rows())
Modified: grass/trunk/raster/r.in.arc/main.c
===================================================================
--- grass/trunk/raster/r.in.arc/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.in.arc/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -151,8 +151,6 @@
break;
}
cf = Rast_open_new(output, rtype);
- if (cf < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), output);
for (row = 0; row < nrows; row++) {
G_percent(row, nrows, 5);
Modified: grass/trunk/raster/r.in.ascii/main.c
===================================================================
--- grass/trunk/raster/r.in.ascii/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.in.ascii/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -203,8 +203,6 @@
rast_ptr = Rast_allocate_buf(data_type);
rast = rast_ptr;
cf = Rast_open_new(output, data_type);
- if (cf < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), output);
for (row = 0; row < nrows; row++) {
G_percent(row, nrows, 2);
for (col = 0; col < ncols; col++) {
Modified: grass/trunk/raster/r.in.bin/main.c
===================================================================
--- grass/trunk/raster/r.in.bin/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.in.bin/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -494,10 +494,6 @@
}
cf = Rast_open_new(output, map_type);
- if (cf < 0) {
- G_fatal_error(_("Unable to create raster map <%s>"), output);
- exit(EXIT_FAILURE);
- }
x_v = G_malloc(ncols * bytes);
x_f = (float *)x_v;
Modified: grass/trunk/raster/r.in.gdal/main.c
===================================================================
--- grass/trunk/raster/r.in.gdal/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.in.gdal/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -695,8 +695,6 @@
double dfNoData;
char outputReal[GNAME_MAX], outputImg[GNAME_MAX];
char *nullFlags = NULL;
- int (*raster_open_new_func) (const char *, RASTER_MAP_TYPE) =
- Rast_open_new;
struct History history;
/* -------------------------------------------------------------------- */
@@ -717,7 +715,6 @@
eGDT = GDT_Int32;
complex = FALSE;
Rast_set_cell_format(0);
- /* raster_open_new_func = Rast_open_new_uncompressed; *//* ?? */
break;
case GDT_Int16:
@@ -726,7 +723,6 @@
eGDT = GDT_Int32;
complex = FALSE;
Rast_set_cell_format(1);
- /* raster_open_new_func = Rast_open_new_uncompressed; *//* ?? */
break;
default:
@@ -745,14 +741,10 @@
if (complex) {
sprintf(outputReal, "%s.real", output);
- cfR = (*raster_open_new_func) ((char *)outputReal, data_type);
- if (cfR < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), outputReal);
+ cfR = Rast_open_new(outputReal, data_type);
sprintf(outputImg, "%s.imaginary", output);
- cfI = (*raster_open_new_func) ((char *)outputImg, data_type);
- if (cfI < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), outputImg);
+ cfI = Rast_open_new(outputImg, data_type);
cellReal = Rast_allocate_buf(data_type);
cellImg = Rast_allocate_buf(data_type);
@@ -764,9 +756,7 @@
}
}
else {
- cf = (*raster_open_new_func) ((char *)output, data_type);
- if (cf < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), output);
+ cf = Rast_open_new(output, data_type);
if (group_ref != NULL)
I_add_file_to_group_ref((char *)output, G_mapset(), group_ref);
Modified: grass/trunk/raster/r.in.mat/main.c
===================================================================
--- grass/trunk/raster/r.in.mat/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.in.mat/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -410,8 +410,6 @@
raster = Rast_allocate_buf(map_type);
cf = Rast_open_new(map_name, map_type);
- if (cf < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), outfile);
/* write new raster map */
G_verbose_message(_("Writing new raster map..."));
Modified: grass/trunk/raster/r.in.poly/poly2rast.c
===================================================================
--- grass/trunk/raster/r.in.poly/poly2rast.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.in.poly/poly2rast.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -33,8 +33,6 @@
}
rfd = Rast_open_c_new(raster_map);
- if (rfd < 0)
- G_fatal_error(_("Can't create raster map <%s>"), raster_map);
if (title == NULL)
title = "";
Modified: grass/trunk/raster/r.in.xyz/main.c
===================================================================
--- grass/trunk/raster/r.in.xyz/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.in.xyz/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -499,8 +499,6 @@
/* open output map */
out_fd = Rast_open_new(outmap, rtype);
- if (out_fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), outmap);
if (can_seek) {
/* guess at number of lines in the file without actually reading it all in */
Modified: grass/trunk/raster/r.lake/main.c
===================================================================
--- grass/trunk/raster/r.lake/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.lake/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -212,11 +212,8 @@
lakemap = lake_opt->answer;
/* If lakemap is set, write to it, else is set overwrite flag and we should write to seedmap. */
- if (lakemap) {
+ if (lakemap)
lake_fd = Rast_open_new(lakemap, 1);
- if (lake_fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), lakemap);
- }
rows = G_window_rows();
cols = G_window_cols();
@@ -239,15 +236,10 @@
/* Open terran map */
in_terran_fd = Rast_open_old(terrainmap, "");
- if (in_terran_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), terrainmap);
/* Open seed map */
- if (smap_opt->answer) {
+ if (smap_opt->answer)
out_fd = Rast_open_old(seedmap, "");
- if (out_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), seedmap);
- }
/* Pointers to rows. Row = ptr to 'col' size array. */
in_terran = (FCELL **) G_malloc(rows * sizeof(FCELL *));
@@ -288,14 +280,10 @@
Rast_close(out_fd);
/* Open output map for writing. */
- if (lakemap) {
+ if (lakemap)
out_fd = lake_fd;
- }
- else {
+ else
out_fd = Rast_open_new(seedmap, 1);
- if (out_fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), seedmap);
- }
/* More pases are renudant. Real pases count is controled by altered cell count. */
pases = (int)(rows * cols) / 2;
Modified: grass/trunk/raster/r.li/r.li.daemon/daemon.c
===================================================================
--- grass/trunk/raster/r.li/r.li.daemon/daemon.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.li/r.li.daemon/daemon.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -125,8 +125,6 @@
char *mapset; */
/*creating new raster file */
mv_fd = Rast_open_new(output, DCELL_TYPE);
- if (mv_fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), output);
random_access_name = G_tempfile();
random_access = open(random_access_name, O_RDWR | O_CREAT, 0755);
Modified: grass/trunk/raster/r.los/main.c
===================================================================
--- grass/trunk/raster/r.los/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.los/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -201,19 +201,13 @@
/* open elevation overlay file for reading */
old = Rast_open_old(elev_layer, old_mapset);
- if (old < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), elev_layer);
/* open cell layer for writing output */
new = Rast_open_new(out_layer, FCELL_TYPE);
- if (new < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), out_layer);
/* if pattern layer specified, open it for reading */
if (patt_flag == TRUE) {
patt = Rast_open_old(patt_layer, patt_mapset);
- if (patt < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), patt_layer);
if (Rast_get_map_type(patt) != CELL_TYPE)
G_fatal_error(_("Pattern map should be a binary 0/1 CELL map"));
}
Modified: grass/trunk/raster/r.mapcalc/map.c
===================================================================
--- grass/trunk/raster/r.mapcalc/map.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.mapcalc/map.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -509,8 +509,6 @@
G_fatal_error(_("Raster map <%s> not found"), name);
fd = Rast_open_old(name, mapset);
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s@%s>"), name, mapset);
switch (mod) {
case 'M':
@@ -575,9 +573,6 @@
m->fd = Rast_open_old(name, mapset);
- if (m->fd < 0)
- G_fatal_error(_("Unable to open raster map <%s@%s>"), name, mapset);
-
return num_maps++;
}
@@ -658,13 +653,7 @@
int open_output_map(const char *name, int res_type)
{
- int fd;
-
- fd = Rast_open_new((char *)name, res_type);
- if (fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), name);
-
- return fd;
+ return Rast_open_new((char *)name, res_type);
}
void put_map_row(int fd, void *buf, int res_type)
Modified: grass/trunk/raster/r.mfilter/perform.c
===================================================================
--- grass/trunk/raster/r.mfilter/perform.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.mfilter/perform.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -34,9 +34,6 @@
G_debug(1, "Open raster map %s = %d", in_name, in);
- if (in < 0) {
- G_fatal_error(_("Cannot open raster map <%s>"), in_name);
- }
close(creat(tmp1 = G_tempfile(), 0666));
out = open(tmp1, 2);
if (out < 0)
@@ -80,9 +77,6 @@
/* copy final result to output raster map */
in = out;
out = Rast_open_fp_new(out_name);
- if (out < 0) {
- G_fatal_error(_("Cannot create raster map <%s>"), out_name);
- }
G_message(_("Writing raster map <%s>"), out_name);
for (row = 0; row < nrows; row++) {
Modified: grass/trunk/raster/r.neighbors/main.c
===================================================================
--- grass/trunk/raster/r.neighbors/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.neighbors/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -215,9 +215,7 @@
ncols = G_window_cols();
/* open raster maps */
- if ((in_fd = Rast_open_old(ncb.oldcell, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- ncb.oldcell);
+ in_fd = Rast_open_old(ncb.oldcell, "");
map_type = Rast_get_map_type(in_fd);
@@ -286,13 +284,9 @@
/* open raster map */
in_fd = Rast_open_old(ncb.oldcell, "");
- if (in_fd < 0)
- exit(EXIT_FAILURE);
/*open the new raster map */
out_fd = Rast_open_new(ncb.newcell, map_type);
- if (out_fd < 0)
- exit(EXIT_FAILURE);
if (flag.circle->answer)
circle_mask();
Modified: grass/trunk/raster/r.null/main.c
===================================================================
--- grass/trunk/raster/r.null/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.null/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -315,14 +315,9 @@
Rast_set_window(&cellhd);
old = Rast_open_old(name, mapset);
- if (old < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
new = Rast_open_new(name, map_type);
- if (new < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), name);
-
rast = Rast_allocate_buf(map_type);
G_verbose_message(_("Writing new data for raster map <%s>..."), name);
Modified: grass/trunk/raster/r.out.arc/main.c
===================================================================
--- grass/trunk/raster/r.out.arc/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.out.arc/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -117,8 +117,6 @@
sprintf(null_str, "-9999");
fd = Rast_open_old(parm.map->answer, "");
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), parm.map->answer);
map_type = Rast_get_map_type(fd);
out_type = map_type;
Modified: grass/trunk/raster/r.out.ascii/main.c
===================================================================
--- grass/trunk/raster/r.out.ascii/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.out.ascii/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -144,8 +144,6 @@
/* open raster map */
fd = Rast_open_old(name, "");
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
map_type = Rast_get_map_type(fd);
Modified: grass/trunk/raster/r.out.bin/main.c
===================================================================
--- grass/trunk/raster/r.out.bin/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.out.bin/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -124,8 +124,6 @@
G_get_window(®ion);
fd = Rast_open_old(name, "");
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
map_type = Rast_get_map_type(fd);
if (!flag.int_out->answer)
Modified: grass/trunk/raster/r.out.gdal/export_band.c
===================================================================
--- grass/trunk/raster/r.out.gdal/export_band.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.out.gdal/export_band.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -46,10 +46,6 @@
/* Open GRASS raster */
fd = Rast_open_old(name, mapset);
- if (fd < 0) {
- G_warning(_("Unable to open raster map <%s>"), name);
- return -1;
- }
/* Get min/max values. */
if (Rast_read_fp_range(name, mapset, &sRange) == -1) {
@@ -248,10 +244,6 @@
/* Open GRASS raster */
fd = Rast_open_old(name, mapset);
- if (fd < 0) {
- G_warning(_("Unable to open raster map <%s>"), name);
- return -1;
- }
/* Get raster band */
GDALRasterBandH hBand = GDALGetRasterBand(hMEMDS, band);
Modified: grass/trunk/raster/r.out.gridatb/file_io.c
===================================================================
--- grass/trunk/raster/r.out.gridatb/file_io.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.out.gridatb/file_io.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -15,8 +15,6 @@
RASTER_MAP_TYPE data_type;
fd = Rast_open_old(iname, "");
- if (fd < 0)
- G_fatal_error("%s - could not read", iname);
data_type = Rast_get_map_type(fd);
switch (data_type) {
Modified: grass/trunk/raster/r.out.mat/main.c
===================================================================
--- grass/trunk/raster/r.out.mat/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.out.mat/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -84,8 +84,6 @@
sprintf(outfile, "%s.mat", basename);
fd = Rast_open_old(infile, "");
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), infile);
map_type = Rast_get_map_type(fd);
Modified: grass/trunk/raster/r.out.mpeg/main.c
===================================================================
--- grass/trunk/raster/r.out.mpeg/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.out.mpeg/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -283,8 +283,6 @@
G_message("\r%s <%s>", _("Reading file"), name);
fd = Rast_open_old(name, "");
- if (fd < 0)
- G_fatal_error(_("Raster map <%s> not found"), name);
if (Rast_read_colors(name, "", &colors) < 0)
G_fatal_error(_("Unable to read color table for <%s>"), name);
Modified: grass/trunk/raster/r.out.png/main.c
===================================================================
--- grass/trunk/raster/r.out.png/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.out.png/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -152,8 +152,7 @@
G_message(_("rows = %d, cols = %d"), w.rows, w.cols);
/* open raster map for reading */
- if ((cellfile = Rast_open_old(rast->answer, "")) == -1)
- G_fatal_error(_("Unable to open cellfile for <%s>"), rastermap);
+ cellfile = Rast_open_old(rast->answer, "");
cell_buf = Rast_allocate_c_buf();
fcell_buf = Rast_allocate_f_buf();
Modified: grass/trunk/raster/r.out.pov/main.c
===================================================================
--- grass/trunk/raster/r.out.pov/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.out.pov/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -163,10 +163,7 @@
name = parm.map->answer;
fd = Rast_open_old(name, "");
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
-
outfilename = parm.tga->answer;
if (outfilename == NULL)
G_fatal_error(_("Invalid output filename <%s>"), outfilename);
Modified: grass/trunk/raster/r.out.ppm/main.c
===================================================================
--- grass/trunk/raster/r.out.ppm/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.out.ppm/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -97,8 +97,7 @@
G_message(_("rows = %d, cols = %d"), w.rows, w.cols);
/* open raster map for reading */
- if ((cellfile = Rast_open_old(rast->answer, "")) == -1)
- G_fatal_error(_("Unable to open raster map <%s>"), rast->answer);
+ cellfile = Rast_open_old(rast->answer, "");
cell_buf = Rast_allocate_c_buf();
fcell_buf = Rast_allocate_f_buf();
Modified: grass/trunk/raster/r.out.ppm3/main.c
===================================================================
--- grass/trunk/raster/r.out.ppm3/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.out.ppm3/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -100,8 +100,7 @@
char *name = B[i].opt->answer;
/* Open raster map */
- if ((B[i].file = Rast_open_old(name, "")) == -1)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
+ B[i].file = Rast_open_old(name, "");
/* Get map type (CELL/FCELL/DCELL) */
B[i].type = Rast_get_map_type(B[i].file);
Modified: grass/trunk/raster/r.out.tiff/main.c
===================================================================
--- grass/trunk/raster/r.out.tiff/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.out.tiff/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -158,8 +158,7 @@
"than 256 colors for the available range of data"));
cell = Rast_allocate_c_buf();
- if ((in = Rast_open_old(inopt->answer, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), inopt->answer);
+ in = Rast_open_old(inopt->answer, "");
basename = G_store(outopt->answer);
G_basename(basename, "tiff");
Modified: grass/trunk/raster/r.out.vrml/main.c
===================================================================
--- grass/trunk/raster/r.out.vrml/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.out.vrml/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -83,8 +83,7 @@
G_get_set_window(&W);
- if ((elevfd = Rast_open_old(rast_el->answer, "")) == -1)
- G_fatal_error("Unable to open cellfile for <%s>", rast_el->answer);
+ elevfd = Rast_open_old(rast_el->answer, "");
{
CELL cmin, cmax;
@@ -115,12 +114,9 @@
}
if (rast_co->answer) {
- if ((colorfd = Rast_open_old(rast_co->answer, "")) == -1)
- G_warning(_("Unable to open cellfile for <%s>"), rast_co->answer);
- else {
- Rast_read_colors(rast_co->answer, "", &colr);
- color_ok = 1;
- }
+ colorfd = Rast_open_old(rast_co->answer, "");
+ Rast_read_colors(rast_co->answer, "", &colr);
+ color_ok = 1;
}
/* TODO: if file exists, just append new objects */
Modified: grass/trunk/raster/r.out.vtk/main.c
===================================================================
--- grass/trunk/raster/r.out.vtk/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.out.vtk/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -124,9 +124,6 @@
/* open raster map */
fd = Rast_open_old(param.elevationmap->answer, "");
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- param.elevationmap->answer);
out_type = Rast_get_map_type(fd);
@@ -187,9 +184,6 @@
/* open raster map */
fd = Rast_open_old(param.input->answers[i], "");
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- param.input->answers[i]);
out_type = Rast_get_map_type(fd);
/*Now write the data */
write_vtk_data(fd, fp, param.input->answers[i], region, out_type,
@@ -212,9 +206,6 @@
/* open raster map */
rgbfd[i] = Rast_open_old(param.rgbmaps->answers[i], "");
- if (rgbfd[i] < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- param.rgbmaps->answers[i]);
celltype[i] = Rast_get_map_type(rgbfd[i]);
}
@@ -253,11 +244,7 @@
param.vectmaps->answers[i]);
/* open raster map */
- vectfd[i] =
- Rast_open_old(param.vectmaps->answers[i], "");
- if (vectfd[i] < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- param.vectmaps->answers[i]);
+ vectfd[i] = Rast_open_old(param.vectmaps->answers[i], "");
celltype[i] = Rast_get_map_type(vectfd[i]);
}
Modified: grass/trunk/raster/r.param.scale/open_files.c
===================================================================
--- grass/trunk/raster/r.param.scale/open_files.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.param.scale/open_files.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -23,19 +23,12 @@
{
/* Open existing file and set the input file descriptor. */
- if ((fd_in = Rast_open_old(rast_in_name, "")) < 0)
- G_fatal_error(_("Cannot open raster map <%s>"), rast_in_name);
+ fd_in = Rast_open_old(rast_in_name, "");
/* Open new file and set the output file descriptor. */
- if (mparam != FEATURE) {
- if ((fd_out = Rast_open_new(rast_out_name, DCELL_TYPE)) < 0)
- G_fatal_error(_("Cannot create raster map <%s>"), rast_out_name);
- }
- else {
- if ((fd_out = Rast_open_new(rast_out_name, CELL_TYPE)) < 0)
- G_fatal_error(_("Cannot create raster map <%s>"), rast_out_name);
- }
-
- return;
+ if (mparam != FEATURE)
+ fd_out = Rast_open_new(rast_out_name, DCELL_TYPE);
+ else
+ fd_out = Rast_open_new(rast_out_name, CELL_TYPE);
}
Modified: grass/trunk/raster/r.patch/main.c
===================================================================
--- grass/trunk/raster/r.patch/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.patch/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -36,7 +36,6 @@
int nfiles;
char *rname;
int i;
- int ok;
int row, nrows, ncols;
int ZEROFLAG;
char *new_name;
@@ -78,7 +77,6 @@
ZEROFLAG = (zeroflag->answer);
- ok = 1;
names = opt1->answers;
out_type = CELL_TYPE;
@@ -95,14 +93,7 @@
const char *name = names[i];
int fd;
- if (!ok)
- continue;
-
fd = Rast_open_old(name, "");
- if (fd < 0) {
- ok = 0;
- continue;
- }
infd[i] = fd;
@@ -115,13 +106,8 @@
Rast_init_cell_stats(&statf[i]);
}
- if (!ok)
- G_fatal_error(_("One or more input raster maps not found"));
-
rname = opt2->answer;
outfd = Rast_open_new(new_name = rname, out_type);
- if (outfd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), new_name);
presult = Rast_allocate_buf(out_type);
patch = Rast_allocate_buf(out_type);
Modified: grass/trunk/raster/r.profile/main.c
===================================================================
--- grass/trunk/raster/r.profile/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.profile/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -129,8 +129,7 @@
coords = 1;
/* Open Raster File */
- if ((fd = Rast_open_old(name, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
+ fd = Rast_open_old(name, "");
/* initialize color structure */
if (clr)
Modified: grass/trunk/raster/r.quantile/main.c
===================================================================
--- grass/trunk/raster/r.quantile/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.quantile/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -309,8 +309,6 @@
}
infile = Rast_open_old(opt.input->answer, "");
- if (infile < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), opt.input->answer);
Rast_read_fp_range(opt.input->answer, "", &range);
Rast_get_fp_range_min_max(&range, &min, &max);
Modified: grass/trunk/raster/r.random/count.c
===================================================================
--- grass/trunk/raster/r.random/count.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.random/count.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -21,15 +21,9 @@
int nrows, ncols, row, col;
theState->fd_old = Rast_open_old(theState->inraster, "");
- if (theState->fd_old < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- theState->inraster);
- if (theState->docover == 1) {
+ if (theState->docover == 1)
theState->fd_cold = Rast_open_old(theState->inrcover, "");
- if (theState->fd_cold < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- theState->inrcover);
- }
+
theState->buf.type = Rast_get_map_type(theState->fd_old);
theState->buf.data.v = Rast_allocate_buf(theState->buf.type);
if (theState->docover == 1) {
Modified: grass/trunk/raster/r.random/random.c
===================================================================
--- grass/trunk/raster/r.random/random.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.random/random.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -52,9 +52,7 @@
type = theState->cover.type;
else
type = theState->buf.type;
- if ((outfd = Rast_open_new(theState->outraster, type)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"),
- theState->outraster);
+ outfd = Rast_open_new(theState->outraster, type);
theState->fd_new = outfd;
}
Modified: grass/trunk/raster/r.random.cells/indep.c
===================================================================
--- grass/trunk/raster/r.random.cells/indep.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.random.cells/indep.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -130,9 +130,6 @@
G_debug(2, "outputting()");
OutFD = Rast_open_c_new(Output->answer);
- if (OutFD < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- Output->answer);
G_message(_("Writing raster map <%s>..."),
Output->answer);
Modified: grass/trunk/raster/r.random.cells/init.c
===================================================================
--- grass/trunk/raster/r.random.cells/init.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.random.cells/init.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -41,11 +41,9 @@
Cells = FlagCreate(Rs, Cs);
CellCount = 0;
- if (NULL != G_find_file("cell", "MASK", G_mapset())) {
- if ((FD = Rast_open_old("MASK", G_mapset())) < 0) {
- G_fatal_error(_("Unable to open raster map <%s>"), "MASK");
- }
- else {
+ if (G_find_raster2("MASK", G_mapset())) {
+ FD = Rast_open_old("MASK", G_mapset());
+ {
for (row = 0; row < Rs; row++) {
Rast_get_c_row_nomask(FD, CellBuffer, row);
for (col = 0; col < Cs; col++) {
Modified: grass/trunk/raster/r.random.surface/init.c
===================================================================
--- grass/trunk/raster/r.random.surface/init.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.random.surface/init.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -42,10 +42,8 @@
FDM = -1;
}
else {
- if ((FDM = Rast_open_old("MASK", G_mapset())) < 0) {
- G_fatal_error(_("Unable to open raster map <%s>"), "MASK");
- }
- else {
+ FDM = Rast_open_old("MASK", G_mapset());
+ {
MapCount = 0;
CellBuffer = Rast_allocate_c_buf();
for (row = 0; row < Rs; row++) {
Modified: grass/trunk/raster/r.random.surface/main.c
===================================================================
--- grass/trunk/raster/r.random.surface/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.random.surface/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -124,9 +124,6 @@
for (DoMap = 0; DoMap < NumMaps; DoMap++) {
OutFD = Rast_open_c_new(OutNames[DoMap]);
- if (OutFD < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- OutNames[DoMap]);
G_message(_("Generating raster map <%s>..."), OutNames[DoMap]);
Modified: grass/trunk/raster/r.random.surface/save.c
===================================================================
--- grass/trunk/raster/r.random.surface/save.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.random.surface/save.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -20,9 +20,6 @@
G_debug(2, "SaveMap()");
OutFD = Rast_open_c_new(OutNames[NumMap]);
- if (OutFD < 0)
- G_fatal_error(_("Unable to create raster map <%s>"),
- OutNames[NumMap]);
MeanMod = 0.0;
G_debug(3, "(FDM):%d", FDM);
Modified: grass/trunk/raster/r.recode/recode.c
===================================================================
--- grass/trunk/raster/r.recode/recode.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.recode/recode.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -42,8 +42,6 @@
/* open the input file for reading */
in_fd = Rast_open_old(name, "");
- if (in_fd < 0)
- G_fatal_error("Can't open input map");
out_fd = Rast_open_new(result, out_type);
Modified: grass/trunk/raster/r.resamp.interp/main.c
===================================================================
--- grass/trunk/raster/r.resamp.interp/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.resamp.interp/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -131,8 +131,6 @@
/* open old map */
infile = Rast_open_old(rastin->answer, "");
- if (infile < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), rastin->answer);
/* reset window to current region */
Rast_set_window(&dst_w);
@@ -141,8 +139,6 @@
/* open new map */
outfile = Rast_open_new(rastout->answer, DCELL_TYPE);
- if (outfile < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), rastout->answer);
G_suppress_warnings(1);
/* otherwise get complaints about window changes */
Modified: grass/trunk/raster/r.resamp.rst/main.c
===================================================================
--- grass/trunk/raster/r.resamp.rst/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.resamp.rst/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -366,8 +366,7 @@
if (smooth != NULL) {
- if ((fdsmooth = Rast_open_old(smooth, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), smooth);
+ fdsmooth = Rast_open_old(smooth, "");
if (Rast_get_cellhd(smooth, "", &smhd) < 0)
G_fatal_error(_("Unable to read header for <%s>"), smooth);
@@ -390,10 +389,8 @@
if ((winhd.ew_res != inphd.ew_res) || (winhd.ns_res != inphd.ns_res))
G_fatal_error(_("Input map resolution differs from current region resolution!"));
- if ((fdinp = Rast_open_old(input, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), input);
+ fdinp = Rast_open_old(input, "");
-
sdisk = 0;
if (elev != NULL)
sdisk += disk;
Modified: grass/trunk/raster/r.resamp.stats/main.c
===================================================================
--- grass/trunk/raster/r.resamp.stats/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.resamp.stats/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -338,9 +338,6 @@
/* open old map */
infile = Rast_open_old(parm.rastin->answer, "");
- if (infile < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- parm.rastin->answer);
/* reset window to current region */
Rast_set_window(&dst_w);
@@ -350,9 +347,6 @@
/* open new map */
outfile = Rast_open_new(parm.rastout->answer, DCELL_TYPE);
- if (outfile < 0)
- G_fatal_error(_("Unable to create raster map <%s>"),
- parm.rastout->answer);
/* prevent complaints about window changes */
G_suppress_warnings(1);
Modified: grass/trunk/raster/r.resample/main.c
===================================================================
--- grass/trunk/raster/r.resample/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.resample/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -88,8 +88,6 @@
}
infd = Rast_open_old(name, "");
- if (infd < 0)
- G_fatal_error(_("Unable to open input map <%s>"), name);
/* determine the map type;
data_type is the type of data being processed,
@@ -111,9 +109,6 @@
outfd = Rast_open_new(result, out_type);
Rast_set_null_value(rast, ncols, out_type);
- if (outfd < 0)
- G_fatal_error(_("Unable to open output map <%s>"), name);
-
G_message(_("Percent complete: "));
for (row = 0; row < nrows; row++) {
Modified: grass/trunk/raster/r.rescale/get_range.c
===================================================================
--- grass/trunk/raster/r.rescale/get_range.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.rescale/get_range.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -19,8 +19,6 @@
Rast_set_window(&cellhd);
cell = Rast_allocate_c_buf();
fd = Rast_open_old(name, "");
- if (fd < 0)
- exit(1);
nrows = G_window_rows();
ncols = G_window_cols();
G_message(_("Reading %s ..."), name);
Modified: grass/trunk/raster/r.rescale.eq/get_stats.c
===================================================================
--- grass/trunk/raster/r.rescale.eq/get_stats.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.rescale.eq/get_stats.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -11,8 +11,6 @@
int row, nrows, ncols;
fd = Rast_open_old(name, "");
- if (fd < 0)
- exit(1);
nrows = G_window_rows();
ncols = G_window_cols();
cell = Rast_allocate_c_buf();
Modified: grass/trunk/raster/r.ros/main.c
===================================================================
--- grass/trunk/raster/r.ros/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.ros/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -422,88 +422,34 @@
/* Open input cell layers for reading */
- fuel_fd =
- Rast_open_old(parm.model->answer,
- G_find_raster2(parm.model->answer, ""));
- if (fuel_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- parm.model->answer);
+ fuel_fd = Rast_open_old(parm.model->answer, "");
- if (parm.mois_1h->answer) {
- mois_1h_fd =
- Rast_open_old(parm.mois_1h->answer,
- G_find_raster2(parm.mois_1h->answer, ""));
- if (mois_1h_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- parm.mois_1h->answer);
- }
- if (parm.mois_10h->answer) {
- mois_10h_fd =
- Rast_open_old(parm.mois_10h->answer,
- G_find_raster2(parm.mois_10h->answer, ""));
- if (mois_10h_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- parm.mois_10h->answer);
- }
- if (parm.mois_100h->answer) {
- mois_100h_fd =
- Rast_open_old(parm.mois_100h->answer,
- G_find_raster2(parm.mois_100h->answer, ""));
- if (mois_100h_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- parm.mois_100h->answer);
- }
+ if (parm.mois_1h->answer)
+ mois_1h_fd = Rast_open_old(parm.mois_1h->answer, "");
- mois_live_fd =
- Rast_open_old(parm.mois_live->answer,
- G_find_raster2(parm.mois_live->answer, ""));
- if (mois_live_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- parm.mois_live->answer);
+ if (parm.mois_10h->answer)
+ mois_10h_fd = Rast_open_old(parm.mois_10h->answer,"");
- if (parm.vel->answer) {
- vel_fd =
- Rast_open_old(parm.vel->answer,
- G_find_raster2(parm.vel->answer, ""));
- if (vel_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- parm.vel->answer);
- }
- if (parm.dir->answer) {
- dir_fd =
- Rast_open_old(parm.dir->answer,
- G_find_raster2(parm.dir->answer, ""));
- if (dir_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- parm.dir->answer);
- }
+ if (parm.mois_100h->answer)
+ mois_100h_fd = Rast_open_old(parm.mois_100h->answer, "");
- if (parm.slope->answer) {
- slope_fd =
- Rast_open_old(parm.slope->answer,
- G_find_raster2(parm.slope->answer, ""));
- if (slope_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- parm.slope->answer);
- }
- if (parm.aspect->answer) {
- aspect_fd =
- Rast_open_old(parm.aspect->answer,
- G_find_raster2(parm.aspect->answer, ""));
- if (aspect_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- parm.aspect->answer);
- }
+ mois_live_fd = Rast_open_old(parm.mois_live->answer, "");
- if (spotting) {
- elev_fd =
- Rast_open_old(parm.elev->answer,
- G_find_raster2(parm.elev->answer, ""));
- if (elev_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- parm.elev->answer);
- }
+ if (parm.vel->answer)
+ vel_fd = Rast_open_old(parm.vel->answer, "");
+ if (parm.dir->answer)
+ dir_fd = Rast_open_old(parm.dir->answer, "");
+
+ if (parm.slope->answer)
+ slope_fd = Rast_open_old(parm.slope->answer, "");
+
+ if (parm.aspect->answer)
+ aspect_fd = Rast_open_old(parm.aspect->answer, "");
+
+ if (spotting)
+ elev_fd = Rast_open_old(parm.elev->answer, "");
+
base_fd = Rast_open_c_new(name_base);
max_fd = Rast_open_c_new(name_max);
maxdir_fd = Rast_open_c_new(name_maxdir);
Modified: grass/trunk/raster/r.series/main.c
===================================================================
--- grass/trunk/raster/r.series/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.series/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -189,9 +189,6 @@
p->name = parm.input->answers[i];
G_message(_("Reading raster map <%s>..."), p->name);
p->fd = Rast_open_old(p->name, "");
- if (p->fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- p->name);
p->buf = Rast_allocate_d_buf();
}
@@ -221,8 +218,6 @@
out->buf = Rast_allocate_d_buf();
out->fd = Rast_open_new(output_name,
menu[method].is_int ? CELL_TYPE : DCELL_TYPE);
- if (out->fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), out->name);
}
/* initialise variables */
Modified: grass/trunk/raster/r.slope.aspect/main.c
===================================================================
--- grass/trunk/raster/r.slope.aspect/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.slope.aspect/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -442,8 +442,6 @@
/* open the elevation file for reading */
elevation_fd = Rast_open_old(elev_name, "");
- if (elevation_fd < 0)
- exit(EXIT_FAILURE);
elev_cell[0] = (DCELL *) G_calloc(ncols + 1, sizeof(DCELL));
Rast_set_d_null_value(elev_cell[0], ncols);
elev_cell[1] = (DCELL *) G_calloc(ncols + 1, sizeof(DCELL));
Modified: grass/trunk/raster/r.slope.aspect/opennew.c
===================================================================
--- grass/trunk/raster/r.slope.aspect/opennew.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.slope.aspect/opennew.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -6,15 +6,8 @@
int opennew(const char *name, RASTER_MAP_TYPE wr_type)
{
- int fd;
-
if (wr_type < 0) /* default fp type */
- fd = Rast_open_fp_new(name);
+ return Rast_open_fp_new(name);
else
- fd = Rast_open_new(name, wr_type);
-
- if (fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), name);
-
- return fd;
+ return Rast_open_new(name, wr_type);
}
Modified: grass/trunk/raster/r.spread/main.c
===================================================================
--- grass/trunk/raster/r.spread/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.spread/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -376,31 +376,19 @@
/* Open input cell layers for reading */
max_fd = Rast_open_old(max_layer, G_find_raster2(max_layer, ""));
- if (max_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), max_layer);
dir_fd = Rast_open_old(dir_layer, G_find_raster2(dir_layer, ""));
- if (dir_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), dir_layer);
base_fd = Rast_open_old(base_layer, G_find_raster2(base_layer, ""));
- if (base_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), base_layer);
if (spotting) {
spotdist_fd =
Rast_open_old(spotdist_layer, G_find_raster2(spotdist_layer, ""));
- if (spotdist_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), spotdist_layer);
velocity_fd =
Rast_open_old(velocity_layer, G_find_raster2(velocity_layer, ""));
- if (velocity_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), velocity_layer);
mois_fd = Rast_open_old(mois_layer, G_find_raster2(mois_layer, ""));
- if (mois_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), mois_layer);
}
/* Allocate memories for a row */
@@ -468,8 +456,6 @@
*/
start_fd = Rast_open_old(start_layer, G_find_raster2(start_layer, ""));
- if (start_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), start_layer);
Rast_read_range(start_layer, G_find_file("cell", start_layer, ""), &range);
Rast_get_range_min_max(&range, &range_min, &range_max);
Modified: grass/trunk/raster/r.spreadpath/main.c
===================================================================
--- grass/trunk/raster/r.spreadpath/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.spreadpath/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -169,12 +169,7 @@
/* Open back cell layers for reading */
backrow_fd = Rast_open_old(backrow_layer, backrow_mapset);
- if (backrow_fd < 0)
- G_fatal_error("%s - can't open raster map", backrow_layer);
-
backcol_fd = Rast_open_old(backcol_layer, backcol_mapset);
- if (backcol_fd < 0)
- G_fatal_error("%s - can't open raster map", backcol_layer);
/* Parameters for map submatrices */
len = sizeof(CELL);
@@ -278,8 +273,6 @@
/* create a linked list of of them */
if (flag == 1) {
path_fd = Rast_open_old(path_layer, path_mapset);
- if (path_fd < 0)
- G_fatal_error("%s -can't open raster map", path_layer);
/* Search for the marked starting pts and make list */
for (row = 0; row < nrows; row++) {
Modified: grass/trunk/raster/r.statistics2/main.c
===================================================================
--- grass/trunk/raster/r.statistics2/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.statistics2/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -170,12 +170,8 @@
method = menu[i].val;
base_fd = Rast_open_old(basemap, "");
- if (base_fd < 0)
- G_fatal_error(_("Unable to open base map <%s>"), basemap);
cover_fd = Rast_open_old(covermap, "");
- if (cover_fd < 0)
- G_fatal_error(_("Unable to open cover map <%s>"), covermap);
if (usecats && Rast_read_cats(covermap, "", &cats) < 0)
G_fatal_error(_("Unable to read category file of cover map <%s>"), covermap);
@@ -498,8 +494,6 @@
G_message(_("Writing output map"));
out_fd = Rast_open_fp_new(output);
- if (out_fd < 0)
- G_fatal_error(_("Unable to open output map <%s>"), output);
out_buf = Rast_allocate_d_buf();
Modified: grass/trunk/raster/r.statistics3/main.c
===================================================================
--- grass/trunk/raster/r.statistics3/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.statistics3/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -336,8 +336,6 @@
const char *output = outputs[quant];
out_fd[quant] = Rast_open_fp_new(output);
- if (out_fd[quant] < 0)
- G_fatal_error(_("Unable to open output map <%s>"), output);
}
have_colors = Rast_read_colors(covermap, "", &colors) > 0;
@@ -473,12 +471,8 @@
}
base_fd = Rast_open_old(basemap, "");
- if (base_fd < 0)
- G_fatal_error(_("Unable to open base map <%s>"), basemap);
cover_fd = Rast_open_old(covermap, "");
- if (cover_fd < 0)
- G_fatal_error(_("Unable to open cover map <%s>"), covermap);
if (Rast_map_is_fp(basemap, "") != 0)
G_fatal_error(_("The base map must be an integer (CELL) map"));
Modified: grass/trunk/raster/r.stats/main.c
===================================================================
--- grass/trunk/raster/r.stats/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.stats/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -271,8 +271,6 @@
DMIN = (DCELL *) G_realloc(DMIN, (nfiles + 1) * sizeof(DCELL));
fd[nfiles] = Rast_open_old(name, "");
- if (fd[nfiles] < 0)
- exit(1);
if (!as_int)
is_fp[nfiles] = Rast_map_is_fp(name, "");
else {
Modified: grass/trunk/raster/r.sun/main.c
===================================================================
--- grass/trunk/raster/r.sun/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.sun/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -801,13 +801,8 @@
}
}
+ fd1 = Rast_open_old(elevin, "");
- if ((mapset = G_find_raster2(elevin, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), elevin);
-
-
- fd1 = Rast_open_old(elevin, mapset);
-
if (slopein != NULL) {
cell3 = Rast_allocate_f_buf();
if (s == NULL) {
@@ -817,9 +812,7 @@
s[l] = (float *)G_malloc(sizeof(float) * (n));
}
}
- if ((mapset = G_find_raster2(slopein, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), slopein);
- fd3 = Rast_open_old(slopein, mapset);
+ fd3 = Rast_open_old(slopein, "");
}
@@ -833,11 +826,8 @@
o[l] = (float *)G_malloc(sizeof(float) * (n));
}
}
+ fd2 = Rast_open_old(aspin, "");
- if ((mapset = G_find_raster2(aspin, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), aspin);
- fd2 = Rast_open_old(aspin, mapset);
-
}
if (linkein != NULL) {
@@ -848,9 +838,7 @@
li[l] = (float *)G_malloc(sizeof(float) * (n));
}
- if ((mapset = G_find_raster2(linkein, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), linkein);
- fd4 = Rast_open_old(linkein, mapset);
+ fd4 = Rast_open_old(linkein, "");
}
if (albedo != NULL) {
@@ -860,9 +848,7 @@
for (l = 0; l < numRows; l++)
a[l] = (float *)G_malloc(sizeof(float) * (n));
}
- if ((mapset = G_find_raster2(albedo, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), albedo);
- fd5 = Rast_open_old(albedo, mapset);
+ fd5 = Rast_open_old(albedo, "");
}
if (latin != NULL) {
@@ -872,9 +858,7 @@
for (l = 0; l < numRows; l++)
latitudeArray[l] = (float *)G_malloc(sizeof(float) * (n));
}
- if ((mapset = G_find_raster2(latin, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), latin);
- fd6 = Rast_open_old(latin, mapset);
+ fd6 = Rast_open_old(latin, "");
}
if (longin != NULL) {
@@ -883,9 +867,7 @@
for (l = 0; l < numRows; l++)
longitudeArray[l] = (float *)G_malloc(sizeof(float) * (n));
- if ((mapset = G_find_raster2(longin, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), longin);
- fd7 = Rast_open_old(longin, mapset);
+ fd7 = Rast_open_old(longin, "");
}
if (coefbh != NULL) {
@@ -895,9 +877,7 @@
for (l = 0; l < numRows; l++)
cbhr[l] = (float *)G_malloc(sizeof(float) * (n));
}
- if ((mapset = G_find_raster2(coefbh, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), coefbh);
- fr1 = Rast_open_old(coefbh, mapset);
+ fr1 = Rast_open_old(coefbh, "");
}
if (coefdh != NULL) {
@@ -907,9 +887,7 @@
for (l = 0; l < numRows; l++)
cdhr[l] = (float *)G_malloc(sizeof(float) * (n));
}
- if ((mapset = G_find_raster2(coefdh, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), coefdh);
- fr2 = Rast_open_old(coefdh, mapset);
+ fr2 = Rast_open_old(coefdh, "");
}
if (useHorizonData()) {
@@ -940,10 +918,7 @@
for (i = 0; i < arrayNumInt; i++) {
horizonbuf[i] = Rast_allocate_f_buf();
sprintf(shad_filename, formatString, horizon, i);
- if ((mapset = G_find_raster2(shad_filename, "")) == NULL)
- G_fatal_error(_("Horizon file no. %d <%s> not found"), i,
- shad_filename);
- fd_shad[i] = Rast_open_old(shad_filename, mapset);
+ fd_shad[i] = Rast_open_old(shad_filename, "");
}
}
/*
@@ -1155,43 +1130,31 @@
if (incidout != NULL) {
cell7 = Rast_allocate_f_buf();
fd7 = Rast_open_fp_new(incidout);
- if (fd7 < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), incidout);
}
if (beam_rad != NULL) {
cell8 = Rast_allocate_f_buf();
fd8 = Rast_open_fp_new(beam_rad);
- if (fd8 < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), beam_rad);
}
if (insol_time != NULL) {
cell11 = Rast_allocate_f_buf();
fd11 = Rast_open_fp_new(insol_time);
- if (fd11 < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), insol_time);
}
if (diff_rad != NULL) {
cell9 = Rast_allocate_f_buf();
fd9 = Rast_open_fp_new(diff_rad);
- if (fd9 < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), diff_rad);
}
if (refl_rad != NULL) {
cell10 = Rast_allocate_f_buf();
fd10 = Rast_open_fp_new(refl_rad);
- if (fd10 < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), refl_rad);
}
if (glob_rad != NULL) {
cell12 = Rast_allocate_f_buf();
fd12 = Rast_open_fp_new(glob_rad);
- if (fd12 < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), glob_rad);
}
Modified: grass/trunk/raster/r.sunmask/main.c
===================================================================
--- grass/trunk/raster/r.sunmask/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.sunmask/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -451,10 +451,8 @@
exit(EXIT_SUCCESS);
}
- if ((elev_fd = Rast_open_old(name, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
- if ((output_fd = Rast_open_c_new(outname)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), outname);
+ elev_fd = Rast_open_old(name, "");
+ output_fd = Rast_open_c_new(outname);
data_type = Rast_get_map_type(elev_fd);
elevbuf.v = Rast_allocate_buf(data_type);
Modified: grass/trunk/raster/r.support/histo.c
===================================================================
--- grass/trunk/raster/r.support/histo.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.support/histo.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -22,8 +22,7 @@
G_fatal_error(_("Unable to read header for <%s>"), name);
Rast_set_window(&cellhd);
- if ((fd = Rast_open_old(name, "")) < 0)
- G_fatal_error(_("Unable to open <%s>"), name);
+ fd = Rast_open_old(name, "");
nrows = G_window_rows();
ncols = G_window_cols();
Modified: grass/trunk/raster/r.support/main.c
===================================================================
--- grass/trunk/raster/r.support/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.support/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -282,8 +282,7 @@
int fd;
struct Categories cats;
- if ((fd = Rast_open_old(infile, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), infile);
+ fd = Rast_open_old(infile, "");
Rast_init_cats("", &cats);
if (Rast_read_cats(map_opt->answer, "", &cats) < 0)
G_fatal_error(_("Unable to read category file of raster map <%s>"),
Modified: grass/trunk/raster/r.support.stats/histo.c
===================================================================
--- grass/trunk/raster/r.support.stats/histo.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.support.stats/histo.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -38,8 +38,7 @@
return 1;
Rast_set_window(&cellhd);
- if ((fd = Rast_open_old(name, "")) < 0)
- return 1;
+ fd = Rast_open_old(name, "");
nrows = G_window_rows();
ncols = G_window_cols();
Modified: grass/trunk/raster/r.surf.area/main.c
===================================================================
--- grass/trunk/raster/r.surf.area/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.surf.area/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -114,10 +114,7 @@
G_get_set_window(&w);
/* open raster map for reading */
- {
- if ((cellfile = Rast_open_old(surf->answer, "")) == -1)
- G_fatal_error(_("Unable to open raster map <%s>"), surf->answer);
- }
+ cellfile = Rast_open_old(surf->answer, "");
cell_buf[0] = (DCELL *) G_malloc(w.cols * Rast_cell_size(DCELL_TYPE));
cell_buf[1] = (DCELL *) G_malloc(w.cols * Rast_cell_size(DCELL_TYPE));
Modified: grass/trunk/raster/r.surf.contour/main.c
===================================================================
--- grass/trunk/raster/r.surf.contour/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.surf.contour/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -95,8 +95,7 @@
seen = flag_create(nrows, ncols);
mask = flag_create(nrows, ncols);
if (NULL != G_find_file("cell", "MASK", G_mapset())) {
- if ((file_fd = Rast_open_old("MASK", G_mapset())) < 0)
- G_fatal_error("Unable to open MASK");
+ file_fd = Rast_open_old("MASK", G_mapset());
for (r = 0; r < nrows; r++) {
Rast_get_c_row_nomask(file_fd, alt_row, r);
for (c = 0; c < ncols; c++)
@@ -111,8 +110,6 @@
maxr = nrows - 1;
array_size = INIT_AR;
file_fd = Rast_open_c_new(alt_name);
- if (!file_fd)
- G_fatal_error("Unable to open output map");
for (r = 0; r < nrows; r++) {
G_percent(r, nrows, 1);
for (c = 0; c < ncols; c++) {
Modified: grass/trunk/raster/r.surf.contour/read_cell.c
===================================================================
--- grass/trunk/raster/r.surf.contour/read_cell.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.surf.contour/read_cell.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -11,9 +11,6 @@
int row;
fd = Rast_open_old(name, mapset);
- if (fd < 0)
- G_fatal_error(_("unable to open map <%s> in <%s>"),
- name, mapset);
buf = G_malloc((size_t) nrows * ncols * sizeof(CELL));
idx = G_malloc(nrows * sizeof(CELL *));
Modified: grass/trunk/raster/r.surf.fractal/write_rast.c
===================================================================
--- grass/trunk/raster/r.surf.fractal/write_rast.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.surf.fractal/write_rast.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -55,10 +55,7 @@
else
strcpy(file_name, rast_out_name);
- if ((fd_out = Rast_open_new(file_name, DCELL_TYPE)) < 0) {
- G_fatal_error(_("Unable to create raster map <%s>"),
- file_name);
- }
+ fd_out = Rast_open_new(file_name, DCELL_TYPE);
/*------------------------------------------------------------------*/
/* Extract real component of transform and save as a GRASS raster. */
Modified: grass/trunk/raster/r.surf.idw/main.c
===================================================================
--- grass/trunk/raster/r.surf.idw/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.surf.idw/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -155,8 +155,6 @@
/* Open input cell layer for reading */
fd = Rast_open_old(input, "");
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), input);
/* Store input data in array-indexed doubly-linked lists and close input file */
rowlist = row_lists(nrows, ncols, &datarows, &n, fd, cell);
@@ -167,8 +165,6 @@
/* open cell layer for writing output */
fd = Rast_open_c_new(output);
- if (fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), output);
/* call the interpolation function */
interpolate(rowlist, nrows, ncols, datarows, npoints, fd, maskfd);
Modified: grass/trunk/raster/r.surf.idw2/main.c
===================================================================
--- grass/trunk/raster/r.surf.idw2/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.surf.idw2/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -105,9 +105,6 @@
mask = NULL;
fd = Rast_open_c_new(parm.output->answer);
- if (fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"),
- parm.output->answer);
G_message(_("Interpolating raster map <%s>... %d rows... "),
parm.output->answer, window.rows);
Modified: grass/trunk/raster/r.surf.idw2/read_cell.c
===================================================================
--- grass/trunk/raster/r.surf.idw2/read_cell.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.surf.idw2/read_cell.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -23,10 +23,6 @@
cell = Rast_allocate_c_buf();
fd = Rast_open_old(name, "");
- if (fd < 0) {
- G_fatal_error(_("Unable to open raster map <%s>"), name);
- exit(EXIT_FAILURE);
- }
G_message(_("Reading raster map <%s>..."), name);
Modified: grass/trunk/raster/r.surf.random/randsurf.c
===================================================================
--- grass/trunk/raster/r.surf.random/randsurf.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.surf.random/randsurf.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -24,14 +24,7 @@
G_math_rand(-1 * getpid());
/****** OPEN CELL FILES AND GET CELL DETAILS ******/
- if (int_map) {
- if ((fd_out = Rast_open_new(out, CELL_TYPE)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), out);
- }
- else {
- if ((fd_out = Rast_open_new(out, DCELL_TYPE)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), out);
- }
+ fd_out = Rast_open_new(out, int_map ? CELL_TYPE : DCELL_TYPE);
nrows = G_window_rows();
ncols = G_window_cols();
Modified: grass/trunk/raster/r.texture/main.c
===================================================================
--- grass/trunk/raster/r.texture/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.texture/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -211,8 +211,7 @@
&& moc2 && mcc)
G_fatal_error(_("Nothing to compute. Use at least one of the flags."));
- if ((infd = Rast_open_old(name, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
+ infd = Rast_open_old(name, "");
/* determine the inputmap type (CELL/FCELL/DCELL) */
data_type = Rast_get_map_type(infd);
@@ -284,10 +283,8 @@
|| (t_measure == 52 && mcc))
t_measure += 3;
else {
- if ((outfd =
- Rast_open_new(strcat(filename, suffixes[t_measure]),
- out_data_type)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), result);
+ outfd = Rast_open_new(strcat(filename, suffixes[t_measure]),
+ out_data_type);
*result = '\0';
for (row = 0; row < nrows - (size - 1); row++) {
Modified: grass/trunk/raster/r.thin/io.c
===================================================================
--- grass/trunk/raster/r.thin/io.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.thin/io.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -91,10 +91,7 @@
/* open raster map */
strcpy(cell, name);
- if ((cell_file = Rast_open_old(cell, "")) < 0) {
- unlink(work_file_name);
- G_fatal_error(_("Unable to open raster map <%s>"), cell);
- }
+ cell_file = Rast_open_old(cell, "");
n_rows = G_window_rows();
n_cols = G_window_cols();
@@ -159,10 +156,7 @@
int row_count, col_count, col;
CELL *buf;
- if ((cell_file = Rast_open_c_new(name)) < 0) {
- unlink(work_file_name);
- G_fatal_error(_("Unable to create raster map <%s>"), name);
- }
+ cell_file = Rast_open_c_new(name);
row_count = n_rows - (PAD << 1);
col_count = n_cols - (PAD << 1);
Modified: grass/trunk/raster/r.to.rast3/main.c
===================================================================
--- grass/trunk/raster/r.to.rast3/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.to.rast3/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -342,19 +342,9 @@
/* ************************************************************************* */
int open_input_raster_map(const char *name)
{
- int fd;
-
G_debug(3, "Open Raster file %s", name);
-
- /* open raster map */
- fd = Rast_open_old(name, "");
-
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
-
-
- return fd;
+ return Rast_open_old(name, "");
}
/* ************************************************************************* */
Modified: grass/trunk/raster/r.to.rast3elev/main.c
===================================================================
--- grass/trunk/raster/r.to.rast3elev/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.to.rast3elev/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -108,17 +108,9 @@
/* ************************************************************************* */
int open_input_raster_map(const char *name)
{
- int fd;
-
G_debug(3, "Open Raster file %s", name);
- /* open raster map */
- fd = Rast_open_old(name, "");
-
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), name);
-
- return fd;
+ return Rast_open_old(name, "");
}
/* ************************************************************************* */
Modified: grass/trunk/raster/r.to.vect/main.c
===================================================================
--- grass/trunk/raster/r.to.vect/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.to.vect/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -114,8 +114,7 @@
G_fatal_error(_("z flag is supported only for points"));
/* Open files */
- if ((input_fd = Rast_open_old(in_opt->answer, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), in_opt->answer);
+ input_fd = Rast_open_old(in_opt->answer, "");
data_type = Rast_get_map_type(input_fd);
data_size = Rast_cell_size(data_type);
Modified: grass/trunk/raster/r.topidx/file_io.c
===================================================================
--- grass/trunk/raster/r.topidx/file_io.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.topidx/file_io.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -12,8 +12,7 @@
FCELL *fcell = NULL;
struct Cell_head inhead;
- if ((fd = Rast_open_old(iname, "")) < 0)
- G_fatal_error(_("Cannot open raster map <%s>"), iname);
+ fd = Rast_open_old(iname, "");
data_type = Rast_get_map_type(fd);
if (Rast_get_cellhd(iname, "", &inhead) < 0 )
@@ -82,8 +81,7 @@
int fd, i;
struct History history;
- if ((fd = Rast_open_new(oname, DCELL_TYPE)) < 0)
- G_fatal_error(_("Cannot create raster map <%s>"), oname);
+ fd = Rast_open_new(oname, DCELL_TYPE);
G_important_message(_("Writing topographic index map..."));
Modified: grass/trunk/raster/r.univar/r.univar_main.c
===================================================================
--- grass/trunk/raster/r.univar/r.univar_main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.univar/r.univar_main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -139,13 +139,7 @@
static int open_raster(const char *infile)
{
- int fd;
-
- fd = Rast_open_old(infile, "");
- if (fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), infile);
-
- return fd;
+ return Rast_open_old(infile, "");
}
static univar_stat *univar_stat_with_percentiles(int map_type, int size)
Modified: grass/trunk/raster/r.uslek/main.c
===================================================================
--- grass/trunk/raster/r.uslek/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.uslek/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -88,20 +88,16 @@
result = output1->answer;
/***************************************************/
- if ((infd_psand = Rast_open_old(psand, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), psand);
+ infd_psand = Rast_open_old(psand, "");
inrast_psand = Rast_allocate_d_buf();
- if ((infd_psilt = Rast_open_old(psilt, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), psilt);
+ infd_psilt = Rast_open_old(psilt, "");
inrast_psilt = Rast_allocate_d_buf();
- if ((infd_pclay = Rast_open_old(pclay, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), pclay);
+ infd_pclay = Rast_open_old(pclay, "");
inrast_pclay = Rast_allocate_d_buf();
- if ((infd_pomat = Rast_open_old(pomat, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), pomat);
+ infd_pomat = Rast_open_old(pomat, "");
inrast_pomat = Rast_allocate_d_buf();
/***************************************************/
nrows = G_window_rows();
@@ -109,8 +105,7 @@
outrast = Rast_allocate_d_buf();
/* Create New raster files */
- if ((outfd = Rast_open_new(result, DCELL_TYPE)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), result);
+ outfd = Rast_open_new(result, DCELL_TYPE);
/* Process pixels */
for (row = 0; row < nrows; row++)
Modified: grass/trunk/raster/r.usler/main.c
===================================================================
--- grass/trunk/raster/r.usler/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.usler/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -82,8 +82,7 @@
result = output->answer;
/***************************************************/
- if ((infd_annual_pmm = Rast_open_old(annual_pmm, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), annual_pmm);
+ infd_annual_pmm = Rast_open_old(annual_pmm, "");
inrast_annual_pmm = Rast_allocate_d_buf();
/***************************************************/
@@ -92,8 +91,7 @@
outrast = Rast_allocate_d_buf();
/* Create New raster files */
- if ((outfd = Rast_open_new(result, DCELL_TYPE)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), result);
+ outfd = Rast_open_new(result, DCELL_TYPE);
/* Process pixels */
for (row = 0; row < nrows; row++)
Modified: grass/trunk/raster/r.volume/main.c
===================================================================
--- grass/trunk/raster/r.volume/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.volume/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -150,9 +150,6 @@
rows = window.rows;
cols = window.cols;
- if (fd_data < 0 || fd_clump < 0)
- G_fatal_error(_("Data or Clump file not open"));
-
/* now get the data -- first pass */
G_message("Complete ...");
for (row = 0; row < rows; row++) {
Modified: grass/trunk/raster/r.walk/main.c
===================================================================
--- grass/trunk/raster/r.walk/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.walk/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -544,12 +544,6 @@
dtm_fd = Rast_open_old(dtm_layer, "");
cost_fd = Rast_open_old(cost_layer, "");
- if (dtm_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), dtm_layer);
-
- if (cost_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), cost_layer);
-
dtm_head_ok = Rast_get_cellhd(dtm_layer, "", &dtm_cellhd) >= 0;
cost_head_ok = Rast_get_cellhd(cost_layer, "", &cost_cellhd) >= 0;
@@ -885,9 +879,6 @@
int dsize2;
cum_fd = Rast_open_old(start_layer, "");
- if (cum_fd < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- start_layer);
data_type2 = Rast_get_map_type(cum_fd);
Modified: grass/trunk/raster/r.water.outlet/main.c
===================================================================
--- grass/trunk/raster/r.water.outlet/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.water.outlet/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -129,9 +129,6 @@
ncols_less_one = ncols - 1;
drain_fd = Rast_open_old(drain_name, "");
- if (drain_fd < 0)
- G_fatal_error(_("Unable to open drainage pointer map"));
-
drain_ptrs =
(char *)G_malloc(sizeof(char) * size_array(&pt_seg, nrows, ncols));
bas = (CELL *) G_calloc(size_array(&ba_seg, nrows, ncols), sizeof(CELL));
@@ -154,9 +151,6 @@
cell_buf = Rast_allocate_c_buf();
basin_fd = Rast_open_c_new(basin_name);
- if (basin_fd < 0)
- G_fatal_error(_("Unable to open new basin map"));
-
for (row = 0; row < nrows; row++) {
for (col = 0; col < ncols; col++) {
cell_buf[col] = bas[SEG_INDEX(ba_seg, row, col)];
Modified: grass/trunk/raster/r.watershed/ram/close_maps.c
===================================================================
--- grass/trunk/raster/r.watershed/ram/close_maps.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.watershed/ram/close_maps.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -27,10 +27,7 @@
sum = sum_sqr = stddev = 0.0;
if (wat_flag) {
fd = Rast_open_new(wat_name, DCELL_TYPE);
- if (fd < 0) {
- G_warning(_("unable to open new accum map layer."));
- }
- else {
+ {
if (abs_acc) {
G_warning("Writing out only positive flow accumulation values.");
G_warning("Cells with a likely underestimate for flow accumulation can no longer be identified.");
@@ -139,10 +136,7 @@
/* keep drainage direction == 0 for real depressions */
if (asp_flag) {
fd = Rast_open_c_new(asp_name);
- if (fd < 0) {
- G_warning(_("unable to open new aspect map layer."));
- }
- else {
+ {
for (r = 0; r < nrows; r++) {
Rast_set_c_null_value(buf, ncols); /* reset row to all NULL */
for (c = 0; c < ncols; c++) {
@@ -162,10 +156,7 @@
/* visual output no longer needed */
if (dis_flag) {
fd = Rast_open_c_new(dis_name);
- if (fd < 0) {
- G_warning(_("unable to open new accum map layer."));
- }
- else {
+ {
if (bas_thres <= 0)
bas_thres = 60;
for (r = 0; r < nrows; r++) {
@@ -198,10 +189,7 @@
if (ls_flag) {
fd = Rast_open_new(ls_name, DCELL_TYPE);
- if (fd < 0) {
- G_warning(_("unable to open new LS factor map layer."));
- }
- else {
+ {
for (r = 0; r < nrows; r++) {
for (c = 0; c < ncols; c++) {
dbuf[c] = l_s[SEG_INDEX(l_s_seg, r, c)];
@@ -216,10 +204,7 @@
if (sl_flag) {
fd = Rast_open_new(sl_name, DCELL_TYPE);
- if (fd < 0) {
- G_warning(_("unable to open new slope length map layer."));
- }
- else {
+ {
for (r = 0; r < nrows; r++) {
for (c = 0; c < ncols; c++) {
dbuf[c] = s_l[SEG_INDEX(s_l_seg, r, c)];
@@ -238,10 +223,7 @@
if (sg_flag) {
fd = Rast_open_new(sg_name, DCELL_TYPE);
- if (fd < 0) {
- G_warning(_("unable to open new S factor map layer."));
- }
- else {
+ {
for (r = 0; r < nrows; r++) {
for (c = 0; c < ncols; c++) {
dbuf[c] = s_g[SEG_INDEX(s_g_seg, r, c)];
Modified: grass/trunk/raster/r.watershed/ram/init_vars.c
===================================================================
--- grass/trunk/raster/r.watershed/ram/init_vars.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.watershed/ram/init_vars.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -145,9 +145,6 @@
/* open elevation input */
fd = Rast_open_old(ele_name, "");
- if (fd < 0) {
- G_fatal_error(_("unable to open elevation map layer"));
- }
ele_map_type = Rast_get_map_type(fd);
ele_size = Rast_cell_size(ele_map_type);
@@ -213,9 +210,6 @@
if (run_flag) {
/* ... with input map flow: amount of overland flow per cell */
fd = Rast_open_old(run_name, "");
- if (fd < 0) {
- G_fatal_error(_("unable to open runoff map layer"));
- }
for (r = 0; r < nrows; r++) {
Rast_get_c_row(fd, buf, r);
for (c = 0; c < ncols; c++) {
@@ -252,9 +246,6 @@
/* depression: drainage direction will be set to zero later */
if (pit_flag) {
fd = Rast_open_old(pit_name, "");
- if (fd < 0) {
- G_fatal_error(_("unable to open depression map layer"));
- }
for (r = 0; r < nrows; r++) {
Rast_get_c_row(fd, buf, r);
for (c = 0; c < ncols; c++) {
@@ -269,9 +260,6 @@
/* this is also creating streams... */
if (ob_flag) {
fd = Rast_open_old(ob_name, "");
- if (fd < 0) {
- G_fatal_error(_("unable to open blocking map layer"));
- }
for (r = 0; r < nrows; r++) {
Rast_get_c_row(fd, buf, r);
for (c = 0; c < ncols; c++) {
@@ -284,12 +272,8 @@
}
G_free(buf);
- if (ril_flag) {
+ if (ril_flag)
ril_fd = Rast_open_old(ril_name, "");
- if (ril_fd < 0) {
- G_fatal_error(_("unable to open rill map layer"));
- }
- }
/* RUSLE: LS and/or S factor */
if (er_flag) {
Modified: grass/trunk/raster/r.watershed/seg/bseg_read.c
===================================================================
--- grass/trunk/raster/r.watershed/seg/bseg_read.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.watershed/seg/bseg_read.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -18,12 +18,6 @@
bseg->mapset = NULL;
map_fd = Rast_open_old(map_name, mapset);
- if (map_fd < 0) {
- sprintf(msg, "%s(): unable to open file [%s] in [%s], %d",
- me, map_name, mapset, map_fd);
- G_warning(msg);
- return -3;
- }
nrows = G_window_rows();
ncols = G_window_cols();
buffer = Rast_allocate_c_buf();
Modified: grass/trunk/raster/r.watershed/seg/bseg_write.c
===================================================================
--- grass/trunk/raster/r.watershed/seg/bseg_write.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.watershed/seg/bseg_write.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -13,10 +13,6 @@
char value;
map_fd = Rast_open_c_new(map_name);
- if (map_fd < 0) {
- G_warning("%s(): unable to open new map layer [%s]", me, map_name);
- return -1;
- }
nrows = G_window_rows();
ncols = G_window_cols();
buffer = Rast_allocate_c_buf();
Modified: grass/trunk/raster/r.watershed/seg/close_maps.c
===================================================================
--- grass/trunk/raster/r.watershed/seg/close_maps.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.watershed/seg/close_maps.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -27,9 +27,7 @@
}
fd = Rast_open_new(wat_name, DCELL_TYPE);
- if (fd < 0) {
- G_warning(_("unable to open new accum map layer."));
- }
+
for (r = 0; r < nrows; r++) {
G_percent(r, nrows, 1);
Rast_set_d_null_value(dbuf, ncols); /* reset row to all NULL */
Modified: grass/trunk/raster/r.watershed/seg/cseg_read.c
===================================================================
--- grass/trunk/raster/r.watershed/seg/cseg_read.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.watershed/seg/cseg_read.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -16,12 +16,6 @@
cseg->mapset = NULL;
map_fd = Rast_open_old(map_name, mapset);
- if (map_fd < 0) {
- sprintf(msg, "%s(): unable to open file [%s] in [%s], %d",
- me, map_name, mapset, map_fd);
- G_warning(msg);
- return -3;
- }
nrows = G_window_rows();
buffer = Rast_allocate_c_buf();
for (row = 0; row < nrows; row++) {
Modified: grass/trunk/raster/r.watershed/seg/cseg_write.c
===================================================================
--- grass/trunk/raster/r.watershed/seg/cseg_write.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.watershed/seg/cseg_write.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -12,10 +12,6 @@
CELL *buffer;
map_fd = Rast_open_c_new(map_name);
- if (map_fd < 0) {
- G_warning("%s(): unable to open new map layer [%s]", me, map_name);
- return -1;
- }
nrows = G_window_rows();
buffer = Rast_allocate_c_buf();
segment_flush(&(cseg->seg));
Modified: grass/trunk/raster/r.watershed/seg/dseg_read.c
===================================================================
--- grass/trunk/raster/r.watershed/seg/dseg_read.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.watershed/seg/dseg_read.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -16,12 +16,6 @@
dseg->mapset = NULL;
map_fd = Rast_open_old(map_name, mapset);
- if (map_fd < 0) {
- sprintf(msg, "%s(): unable to open file [%s] in [%s], %d",
- me, map_name, mapset, map_fd);
- G_warning(msg);
- return -3;
- }
nrows = G_window_rows();
ncols = G_window_cols();
dbuffer = Rast_allocate_d_buf();
Modified: grass/trunk/raster/r.watershed/seg/dseg_write.c
===================================================================
--- grass/trunk/raster/r.watershed/seg/dseg_write.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.watershed/seg/dseg_write.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -12,10 +12,6 @@
double *dbuffer;
map_fd = Rast_open_new(map_name, DCELL_TYPE);
- if (map_fd < 0) {
- G_warning("%s(): unable to open new map layer [%s]", me, map_name);
- return -1;
- }
nrows = G_window_rows();
ncols = G_window_cols();
dbuffer = Rast_allocate_d_buf();
Modified: grass/trunk/raster/r.watershed/seg/init_vars.c
===================================================================
--- grass/trunk/raster/r.watershed/seg/init_vars.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.watershed/seg/init_vars.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -212,9 +212,6 @@
/* open elevation input */
ele_fd = Rast_open_old(ele_name, "");
- if (ele_fd < 0) {
- G_fatal_error(_("unable to open elevation map layer"));
- }
ele_map_type = Rast_get_map_type(ele_fd);
ele_size = Rast_cell_size(ele_map_type);
@@ -226,9 +223,6 @@
/* initial flow accumulation */
if (run_flag) {
wat_fd = Rast_open_old(run_name, "");
- if (wat_fd < 0) {
- G_fatal_error(_("unable to open accumulation map layer"));
- }
wat_map_type = Rast_get_map_type(ele_fd);
wat_size = Rast_cell_size(ele_map_type);
@@ -336,9 +330,6 @@
/* depression: drainage direction will be set to zero later */
if (pit_flag) {
fd = Rast_open_old(pit_name, "");
- if (fd < 0) {
- G_fatal_error(_("unable to open depression map layer"));
- }
buf = Rast_allocate_c_buf();
for (r = 0; r < nrows; r++) {
G_percent(r, nrows, 1);
@@ -362,9 +353,6 @@
if (er_flag) {
if (ob_flag) {
fd = Rast_open_old(ob_name, "");
- if (fd < 0) {
- G_fatal_error(_("unable to open blocking map layer"));
- }
buf = Rast_allocate_c_buf();
for (r = 0; r < nrows; r++) {
G_percent(r, nrows, 1);
Modified: grass/trunk/raster/r.watershed/shed/read.c
===================================================================
--- grass/trunk/raster/r.watershed/shed/read.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.watershed/shed/read.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -46,29 +46,27 @@
map->basins[r].sum_values = 0.0;
}
fd = Rast_open_old(map->name, map->mapset);
- if (fd >= 0) {
- for (r = 0; r < nrows; r++) {
- Rast_get_c_row(fd, buf, r);
- Rast_get_c_row(bas_fd, bas_buf, r);
- for (c = 0; c < ncols; c++) {
- v = buf[c];
- b = bas_buf[c] / 2 - 1;
- if (b >= 0) {
- map->basins[b].sum_values += v;
- if (map->do_cats != 0) {
- cat = &(map->basins[b].first_cat);
- if (cat->num_cat == -1) {
- cat->num_cat = 1;
- cat->cat_val = v;
- }
- else
- insert_cat(cat, v, (int)1);
+ for (r = 0; r < nrows; r++) {
+ Rast_get_c_row(fd, buf, r);
+ Rast_get_c_row(bas_fd, bas_buf, r);
+ for (c = 0; c < ncols; c++) {
+ v = buf[c];
+ b = bas_buf[c] / 2 - 1;
+ if (b >= 0) {
+ map->basins[b].sum_values += v;
+ if (map->do_cats != 0) {
+ cat = &(map->basins[b].first_cat);
+ if (cat->num_cat == -1) {
+ cat->num_cat = 1;
+ cat->cat_val = v;
}
+ else
+ insert_cat(cat, v, (int)1);
}
}
}
- Rast_close(fd);
}
+ Rast_close(fd);
}
return 0;
Modified: grass/trunk/raster/r.watershed/shed/valid.c
===================================================================
--- grass/trunk/raster/r.watershed/shed/valid.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.watershed/shed/valid.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -23,10 +23,7 @@
free_output(output);
G_fatal_error(_("accum file missing in valid_basins()"));
}
- if (-1 == (fd = Rast_open_old(accum_name, mapset))) {
- free_output(output);
- G_fatal_error(_("unable to open accum file in valid_basins()"));
- }
+ fd = Rast_open_old(accum_name, mapset);
buf = Rast_allocate_c_buf();
basin_facts = output->basin_facts;
Modified: grass/trunk/raster/r.what/main.c
===================================================================
--- grass/trunk/raster/r.what/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/r.what/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -195,8 +195,7 @@
NFILES);
strcpy(name, *ptr);
- if ((fd[nfiles] = Rast_open_old(name, "")) < 0)
- G_fatal_error(_("Unable to open <%s>"), name);
+ fd[nfiles] = Rast_open_old(name, "");
out_type[nfiles] = Rast_get_map_type(fd[nfiles]);
if (int_flag->answer)
Modified: grass/trunk/raster/simwe/simlib/input.c
===================================================================
--- grass/trunk/raster/simwe/simlib/input.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/simwe/simlib/input.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -174,107 +174,72 @@
/* Check if data available in mapsets
* if found, then open the files */
- if ((mapset = G_find_raster(elevin, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), elevin);
+ fd1 = Rast_open_old(elevin, "");
- fd1 = Rast_open_old(elevin, mapset);
-
/* TO REPLACE BY INTERNAL PROCESSING of dx, dy from Elevin */
if ((mapset = G_find_raster(dxin, "")) == NULL)
G_fatal_error(_("Raster map <%s> not found"), dxin);
- fd2 = Rast_open_old(dxin, mapset);
+ fd2 = Rast_open_old(dxin, "");
- if ((mapset = G_find_raster(dyin, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), dyin);
-
- fd3 = Rast_open_old(dyin, mapset);
+ fd3 = Rast_open_old(dyin, "");
/* END OF REPLACEMENT */
/* Rendered Mannings n input map optional to run! */
/* Careful! (Yann, 20080212) */
- if (manin != NULL) {
- if ((mapset = G_find_raster(manin, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), manin);
- fd5 = Rast_open_old(manin, mapset);
- }
+ if (manin)
+ fd5 = Rast_open_old(manin, "");
/* Rendered Rainfall input map optional to run! */
/* Careful! (Yann, 20080212) */
- if (rain != NULL) {
- if ((mapset = G_find_raster(rain, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), rain);
- fd4 = Rast_open_old(rain, mapset);
- }
+ if (rain)
+ fd4 = Rast_open_old(rain, "");
- if (infil != NULL) {
- if ((mapset = G_find_raster(infil, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), infil);
- fd4a = Rast_open_old(infil, mapset);
- }
+ if (infil)
+ fd4a = Rast_open_old(infil, "");
- if (traps != NULL) {
- if ((mapset = G_find_raster(traps, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), traps);
+ if (traps)
+ fd4b = Rast_open_old(traps, "");
- fd4b = Rast_open_old(traps, mapset);
- }
+ if (detin)
+ fd9 = Rast_open_old(detin, "");
- if (detin != NULL) {
- if ((mapset = G_find_raster(detin, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), detin);
+ if (tranin)
+ fd10 = Rast_open_old(tranin, "");
- fd9 = Rast_open_old(detin, mapset);
- }
+ if (tauin)
+ fd11 = Rast_open_old(tauin, "");
- if (tranin != NULL) {
- if ((mapset = G_find_raster(tranin, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), tranin);
+ if (wdepth)
+ fd12 = Rast_open_old(wdepth, "");
- fd10 = Rast_open_old(tranin, mapset);
- }
-
- if (tauin != NULL) {
- if ((mapset = G_find_raster(tauin, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), tauin);
-
- fd11 = Rast_open_old(tauin, mapset);
- }
-
- if (wdepth != NULL) {
- if ((mapset = G_find_raster(wdepth, "")) == NULL)
- G_fatal_error(_("Raster map <%s> not found"), wdepth);
-
- fd12 = Rast_open_old(wdepth, mapset);
- }
-
for (row = 0; row < my; row++) {
Rast_get_f_row(fd1, cell1, row);
Rast_get_d_row(fd2, cell2, row);
Rast_get_d_row(fd3, cell3, row);
- if (manin != NULL)
+ if (manin)
Rast_get_f_row(fd5, cell5, row);
- if (rain != NULL)
+ if (rain)
Rast_get_d_row(fd4, cell4, row);
- if (infil != NULL)
+ if (infil)
Rast_get_d_row(fd4a, cell4a, row);
- if (traps != NULL)
+ if (traps)
Rast_get_f_row(fd4b, cell4b, row);
- if (detin != NULL)
+ if (detin)
Rast_get_f_row(fd9, cell9, row);
- if (tranin != NULL)
+ if (tranin)
Rast_get_f_row(fd10, cell10, row);
- if (tauin != NULL)
+ if (tauin)
Rast_get_f_row(fd11, cell11, row);
- if (wdepth != NULL)
+ if (wdepth)
Rast_get_d_row(fd12, cell12, row);
for (j = 0; j < mx; j++) {
@@ -309,7 +274,7 @@
*//*printout warning? */
/* If Rain Exists, then load data */
- if (rain != NULL) {
+ if (rain) {
if (!Rast_is_d_null_value(cell4 + j))
si[row_rev][j] = ((double)cell4[j]) * unitconv;
/*conv mm/hr to m/s */
@@ -321,7 +286,7 @@
}
/* Load infiltration map too if it exists */
- if (infil != NULL) {
+ if (infil) {
if (!Rast_is_d_null_value(cell4a + j))
inf[row_rev][j] = (double)cell4a[j] * unitconv;
/*conv mm/hr to m/s */
@@ -343,7 +308,7 @@
}
}
- if (traps != NULL) {
+ if (traps) {
if (!Rast_is_f_null_value(cell4b + j))
trap[row_rev][j] = (float)cell4b[j]; /* no conv, unitless */
else {
@@ -363,7 +328,7 @@
zz[row_rev][j] = UNDEF;
}
- if (infil != NULL) {
+ if (infil) {
if (!Rast_is_d_null_value(cell4a + j))
inf[row_rev][j] = (double)cell4a[j] * unitconv; /*conv mm/hr to m/s */
/*printf("\nINPUT infilt,convert %f %f",inf[row_rev][j],unitconv); */
@@ -384,7 +349,7 @@
}
}
- if (traps != NULL) {
+ if (traps) {
if (!Rast_is_f_null_value(cell4b + j))
trap[row_rev][j] = (float)cell4b[j]; /* no conv, unitless */
else {
@@ -393,7 +358,7 @@
}
}
} /* End of added by Yann 20080213 */
- if (manin != NULL) {
+ if (manin) {
if (!Rast_is_f_null_value(cell5 + j)) {
cchez[row_rev][j] = (float)cell5[j]; /* units in manual */
}
@@ -409,7 +374,7 @@
G_fatal_error(_("Raster map <%s> not found, and manin_val undefined, choose one to be allowed to process"),
manin);
}
- if (detin != NULL) {
+ if (detin) {
if (!Rast_is_f_null_value(cell9 + j))
dc[row_rev][j] = (float)cell9[j]; /*units in manual */
else {
@@ -418,7 +383,7 @@
}
}
- if (tranin != NULL) {
+ if (tranin) {
if (!Rast_is_f_null_value(cell10 + j))
ct[row_rev][j] = (float)cell10[j]; /*units in manual */
else {
@@ -427,7 +392,7 @@
}
}
- if (tauin != NULL) {
+ if (tauin) {
if (!Rast_is_f_null_value(cell11 + j))
tau[row_rev][j] = (float)cell11[j]; /*units in manual */
else {
@@ -436,7 +401,7 @@
}
}
- if (wdepth != NULL) {
+ if (wdepth) {
if (!Rast_is_d_null_value(cell12 + j))
gama[row_rev][j] = (double)cell12[j]; /*units in manual */
else {
@@ -450,29 +415,29 @@
Rast_close(fd2);
Rast_close(fd3);
- if (rain != NULL)
+ if (rain)
Rast_close(fd4);
- if (infil != NULL)
+ if (infil)
Rast_close(fd4a);
- if (traps != NULL)
+ if (traps)
Rast_close(fd4b);
/* Maybe a conditional to manin!=NULL here ! */
Rast_close(fd5);
/****************/
- if (detin != NULL)
+ if (detin)
Rast_close(fd9);
- if (tranin != NULL)
+ if (tranin)
Rast_close(fd10);
- if (tauin != NULL)
+ if (tauin)
Rast_close(fd11);
- if (wdepth != NULL)
+ if (wdepth)
Rast_close(fd12);
return 1;
@@ -546,7 +511,7 @@
slope[k][l] = 0.;
}
else {
- if (wdepth != NULL)
+ if (wdepth)
hh = pow(gama[k][l], 2. / 3.);
/* hh = 1 if there is no water depth input */
v1[k][l] = (double)hh *cchez[k][l] * zx / zd4;
@@ -555,7 +520,7 @@
slope[k][l] =
sqrt(v1[k][l] * v1[k][l] + v2[k][l] * v2[k][l]);
}
- if (wdepth != NULL) {
+ if (wdepth) {
sheer = (double)(cmul2 * gama[k][l] * sinsl); /* shear stress */
/* if critical shear stress >= shear then all zero */
if ((sheer <= tau[k][l]) || (ct[k][l] == 0.)) {
@@ -570,7 +535,7 @@
sisum += si[k][l];
smin = amin1(smin, si[k][l]);
smax = amax1(smax, si[k][l]);
- if (inf != NULL) {
+ if (inf) {
infsum += inf[k][l];
infmin = amin1(infmin, inf[k][l]);
infmax = amax1(infmax, inf[k][l]);
@@ -580,7 +545,7 @@
chsum += cchez[k][l];
zmin = amin1(zmin, (double)zz[k][l]);
zmax = amax1(zmax, (double)zz[k][l]); /* not clear were needed */
- if (wdepth != NULL)
+ if (wdepth)
sigmax = amax1(sigmax, sigma[k][l]);
cchezmax = amax1(cchezmax, cchez[k][l]);
/* saved sqrt(sinsl)*cchez to cchez array for output */
@@ -597,10 +562,10 @@
vmean = vsum / cc;
chmean = chsum / cc;
- if (inf != NULL)
+ if (inf)
infmean = infsum / cc;
- if (wdepth != NULL)
+ if (wdepth)
deltaw = 0.8 / (sigmax * vmax); /*time step for sediment */
deltap = 0.25 * sqrt(stepx * stepy) / vmean; /*time step for water */
@@ -624,14 +589,14 @@
G_message(_("Number of iterations \t= %d cells\n"), miter);
G_message(_("Time step \t= %.2f s\n"), deltap);
- if (wdepth != NULL) {
+ if (wdepth) {
G_message(_("Sigmax \t= %f\nMax velocity \t= %f m/s\n"), sigmax,
vmax);
G_message(_("Time step used \t= %.2f s\n"), deltaw);
}
- /* if (wdepth != NULL) deltap = 0.1;
+ /* if (wdepth) deltap = 0.1;
* deltap for sediment is ar. average deltap and deltaw */
- /* if (wdepth != NULL) deltap = (deltaw+deltap)/2.;
+ /* if (wdepth) deltap = (deltaw+deltap)/2.;
* deltap for sediment is ar. average deltap and deltaw */
@@ -655,11 +620,11 @@
/*if(v1[k][l]*v1[k][l]+v2[k][l]*v2[k][l] > cellsize, warning, napocitaj
*ak viac ako 10%a*/
/* THIS IS CORRECT SOLUTION currently commented out */
- if (inf != NULL)
+ if (inf)
inf[k][l] *= timesec;
- if (wdepth != NULL)
+ if (wdepth)
gama[k][l] = 0.;
- if (et != NULL) {
+ if (et) {
if (sigma[k][l] == 0. || slope[k][l] == 0.)
si[k][l] = 0.;
else
@@ -676,7 +641,7 @@
D_T({\bf r})= \nabla\cdot {\bf T}({\bf r})
* \f$
*/
- if (et != NULL) {
+ if (et) {
erod(si); /* compute divergence of t.capc */
if (output_et() != 1)
G_fatal_error(_("Unable to write et file"));
@@ -686,12 +651,12 @@
* sigma does not store the first order reaction coefficient but the operator
* WRITE the equation here
*/
- if (wdepth != NULL) {
+ if (wdepth) {
for (k = 0; k < my; k++) {
for (l = 0; l < mx; l++) {
if (zz[k][l] != UNDEF) {
/* get back from temp */
- if (et != NULL)
+ if (et)
si[k][l] = si[k][l] * slope[k][l] * sigma[k][l];
if (sigma[k][l] != 0.)
/* rate of weight loss - w=w*sigma ,
Modified: grass/trunk/raster/simwe/simlib/output.c
===================================================================
--- grass/trunk/raster/simwe/simlib/output.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster/simwe/simlib/output.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -48,7 +48,7 @@
ndigit = 6;
/*
- if (outwalk != NULL) {
+ if (outwalk) {
if (ts == 1) {
sprintf(buf, "%s%.*d", outwalk, ndigit, tt);
outwalk0 = G_store(buf);
@@ -88,7 +88,7 @@
}
}
*/
- if (depth != NULL) {
+ if (depth) {
cell6 = Rast_allocate_f_buf();
if (ts == 1) {
sprintf(buf, "%s.%.*d", depth, ndigit, tt);
@@ -97,11 +97,9 @@
}
else
fd6 = Rast_open_fp_new(depth);
- if (fd6 < 0)
- G_fatal_error("unable to create raster map %s", depth);
}
- if (disch != NULL) {
+ if (disch) {
cell7 = Rast_allocate_f_buf();
if (ts == 1) {
sprintf(buf, "%s.%.*d", disch, ndigit, tt);
@@ -110,11 +108,9 @@
}
else
fd7 = Rast_open_fp_new(disch);
- if (fd7 < 0)
- G_fatal_error("unable to create raster map %s", disch);
}
- if (err != NULL) {
+ if (err) {
cell8 = Rast_allocate_f_buf();
if (ts == 1) {
sprintf(buf, "%s.%.*d", err, ndigit, tt);
@@ -123,13 +119,10 @@
}
else
fd8 = Rast_open_fp_new(err);
-
- if (fd8 < 0)
- G_fatal_error("unable to create raster map %s", err);
}
- if (conc != NULL) {
+ if (conc) {
cell14 = Rast_allocate_f_buf();
if (ts == 1) {
sprintf(buf, "%s.%.*d", conc, ndigit, tt);
@@ -138,12 +131,9 @@
}
else
fd14 = Rast_open_fp_new(conc);
-
- if (fd14 < 0)
- G_fatal_error("unable to create raster map %s", conc);
}
- if (flux != NULL) {
+ if (flux) {
cell15 = Rast_allocate_f_buf();
if (ts == 1) {
sprintf(buf, "%s.%.*d", flux, ndigit, tt);
@@ -152,12 +142,9 @@
}
else
fd15 = Rast_open_fp_new(flux);
-
- if (fd15 < 0)
- G_fatal_error("unable to create raster map %s", flux);
}
- if (erdep != NULL) {
+ if (erdep) {
cell16 = Rast_allocate_f_buf();
if (ts == 1) {
sprintf(buf, "%s.%.*d", erdep, ndigit, tt);
@@ -166,9 +153,6 @@
}
else
fd16 = Rast_open_fp_new(erdep);
-
- if (fd16 < 0)
- G_fatal_error("unable to create raster map %s", erdep);
}
@@ -184,7 +168,7 @@
for (iarc = 0; iarc < my; iarc++) {
i = my - iarc - 1;
- if (depth != NULL) {
+ if (depth) {
for (j = 0; j < mx; j++) {
if (zz[i][j] == UNDEF || gama[i][j] == UNDEF)
Rast_set_f_null_value(cell6 + j, 1);
@@ -197,7 +181,7 @@
Rast_put_f_row(fd6, cell6);
}
- if (disch != NULL) {
+ if (disch) {
for (j = 0; j < mx; j++) {
if (zz[i][j] == UNDEF || gama[i][j] == UNDEF ||
cchez[i][j] == UNDEF)
@@ -211,7 +195,7 @@
Rast_put_f_row(fd7, cell7);
}
- if (err != NULL) {
+ if (err) {
for (j = 0; j < mx; j++) {
if (zz[i][j] == UNDEF || gammas[i][j] == UNDEF)
Rast_set_f_null_value(cell8 + j, 1);
@@ -224,7 +208,7 @@
}
- if (conc != NULL) {
+ if (conc) {
for (j = 0; j < mx; j++) {
if (zz[i][j] == UNDEF || gama[i][j] == UNDEF)
Rast_set_f_null_value(cell14 + j, 1);
@@ -237,7 +221,7 @@
}
- if (flux != NULL) {
+ if (flux) {
for (j = 0; j < mx; j++) {
if (zz[i][j] == UNDEF || gama[i][j] == UNDEF ||
slope[i][j] == UNDEF)
@@ -252,7 +236,7 @@
}
- if (erdep != NULL) {
+ if (erdep) {
for (j = 0; j < mx; j++) {
if (zz[i][j] == UNDEF || er[i][j] == UNDEF)
Rast_set_f_null_value(cell16 + j, 1);
@@ -267,20 +251,20 @@
}
- if (depth != NULL)
+ if (depth)
Rast_close(fd6);
- if (disch != NULL)
+ if (disch)
Rast_close(fd7);
- if (err != NULL)
+ if (err)
Rast_close(fd8);
- if (conc != NULL)
+ if (conc)
Rast_close(fd14);
- if (flux != NULL)
+ if (flux)
Rast_close(fd15);
- if (erdep != NULL)
+ if (erdep)
Rast_close(fd16);
- if (depth != NULL) {
+ if (depth) {
Rast_init_colors(&colors);
@@ -324,7 +308,7 @@
}
- if (disch != NULL) {
+ if (disch) {
Rast_init_colors(&colors);
@@ -367,7 +351,7 @@
}
}
- if (flux != NULL) {
+ if (flux) {
Rast_init_colors(&colors);
@@ -408,7 +392,7 @@
}
- if (erdep != NULL) {
+ if (erdep) {
Rast_init_colors(&colors);
@@ -479,7 +463,7 @@
/* history section */
- if (depth != NULL) {
+ if (depth) {
type = "raster";
if (ts == 0) {
mapst = G_find_file("cell", depth, "");
@@ -519,7 +503,7 @@
Rast_write_history(depth, &hist);
}
- if (disch != NULL) {
+ if (disch) {
type = "raster";
if (ts == 0) {
mapst = G_find_file("cell", disch, "");
@@ -557,7 +541,7 @@
Rast_write_history(disch, &hist);
}
- if (flux != NULL) {
+ if (flux) {
type = "raster";
if (ts == 0) {
mapst = G_find_file("cell", flux, "");
@@ -618,7 +602,7 @@
- if (et != NULL) {
+ if (et) {
cell17 = Rast_allocate_f_buf();
/* if (ts == 1) {
sprintf(buf,"%s.%.*d",et,ndigit,tt);
@@ -627,12 +611,9 @@
}
else */
fd17 = Rast_open_fp_new(et);
-
- if (fd17 < 0)
- G_fatal_error("unable to create raster map %s", et);
}
- if (tc != NULL) {
+ if (tc) {
cell13 = Rast_allocate_f_buf();
/* if (ts == 1) {
sprintf(buf,"%s.%.*d",tc,ndigit,tt);
@@ -641,9 +622,6 @@
}
else */
fd13 = Rast_open_fp_new(tc);
-
- if (fd13 < 0)
- G_fatal_error("unable to create raster map %s", tc);
}
@@ -659,7 +637,7 @@
for (iarc = 0; iarc < my; iarc++) {
i = my - iarc - 1;
- if (et != NULL) {
+ if (et) {
for (j = 0; j < mx; j++) {
if (zz[i][j] == UNDEF || er[i][j] == UNDEF)
Rast_set_f_null_value(cell17 + j, 1);
@@ -672,7 +650,7 @@
Rast_put_f_row(fd17, cell17);
}
- if (tc != NULL) {
+ if (tc) {
for (j = 0; j < mx; j++) {
if (zz[i][j] == UNDEF || sigma[i][j] == UNDEF ||
si[i][j] == UNDEF)
@@ -691,13 +669,13 @@
}
- if (tc != NULL)
+ if (tc)
Rast_close(fd13);
- if (et != NULL)
+ if (et)
Rast_close(fd17);
- if (et != NULL) {
+ if (et) {
Rast_init_colors(&colors);
Modified: grass/trunk/raster3d/r3.cross.rast/main.c
===================================================================
--- grass/trunk/raster3d/r3.cross.rast/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster3d/r3.cross.rast/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -330,8 +330,6 @@
/********************************/
elevfd = Rast_open_old(param.elevation->answer, "");
- if (elevfd <= 0)
- fatal_error(map, -1, -1, _("Unable to open elevation map"));
globalElevMapType = Rast_get_map_type(elevfd);
@@ -343,18 +341,10 @@
if (G_find_raster2(param.output->answer, ""))
G_message(_("Output map already exists. Will be overwritten!"));
- if (output_type == FCELL_TYPE) {
+ if (output_type == FCELL_TYPE)
outfd = Rast_open_new(param.output->answer, FCELL_TYPE);
- if (outfd < 0)
- fatal_error(map, elevfd, -1,
- _("Unable to create raster map"));
- }
- else if (output_type == DCELL_TYPE) {
+ else if (output_type == DCELL_TYPE)
outfd = Rast_open_new(param.output->answer, DCELL_TYPE);
- if (outfd < 0)
- fatal_error(map, elevfd, -1,
- _("Unable to create raster map"));
- }
/*if requested set the Mask on */
if (param.mask->answer) {
Modified: grass/trunk/raster3d/r3.out.vtk/main.c
===================================================================
--- grass/trunk/raster3d/r3.out.vtk/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster3d/r3.out.vtk/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -92,19 +92,10 @@
/* ************************************************************************* */
int open_input_map(const char *name, const char *mapset)
{
- int fd;
-
G_debug(3, "Open Raster file %s in Mapset %s", name, mapset);
-
/* open raster map */
- fd = Rast_open_old(name, mapset);
-
- if (fd < 0)
- G_fatal_error(_("Could not open map %s"), name);
-
-
- return fd;
+ return Rast_open_old(name, mapset);
}
Modified: grass/trunk/raster3d/r3.to.rast/main.c
===================================================================
--- grass/trunk/raster3d/r3.to.rast/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/raster3d/r3.to.rast/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -177,13 +177,7 @@
/* ************************************************************************* */
int open_output_map(const char *name, int res_type)
{
- int fd;
-
- fd = Rast_open_new((char *)name, res_type);
- if (fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), name);
-
- return fd;
+ return Rast_open_new(name, res_type);
}
/* ************************************************************************* */
Modified: grass/trunk/vector/lidar/v.surf.bspline/main.c
===================================================================
--- grass/trunk/vector/lidar/v.surf.bspline/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/vector/lidar/v.surf.bspline/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -292,9 +292,7 @@
G_fatal_error (_("Raster <%s> already exist."), out_map_opt->answer);
*/
- if ((raster = Rast_open_fp_new(out_map_opt->answer)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"),
- out_map_opt->answer);
+ raster = Rast_open_fp_new(out_map_opt->answer);
}
if (bspline_field > 0) {
Modified: grass/trunk/vector/v.drape/main.c
===================================================================
--- grass/trunk/vector/v.drape/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/vector/v.drape/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -210,9 +210,7 @@
otype = Vect_option_to_types(type_opt);
/* open the elev raster, and check for error condition */
- if ((fdrast = Rast_open_old(rast_opt->answer, "")) < 0) {
- G_fatal_error(_("Unable to open raster map <%s>"), rast_opt->answer);
- }
+ fdrast = Rast_open_old(rast_opt->answer, "");
/* check input/output vector maps */
Vect_check_input_output_name(in_opt->answer, out_opt->answer,
Modified: grass/trunk/vector/v.extrude/main.c
===================================================================
--- grass/trunk/vector/v.extrude/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/vector/v.extrude/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -176,9 +176,7 @@
G_get_window(&window);
/* open the elev raster, and check for error condition */
- if ((fdrast = Rast_open_old(elevation->answer, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"),
- elevation->answer);
+ fdrast = Rast_open_old(elevation->answer, "");
}
/* if area */
Modified: grass/trunk/vector/v.kernel/main.c
===================================================================
--- grass/trunk/vector/v.kernel/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/vector/v.kernel/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -240,9 +240,7 @@
/* check and open the name of output map */
if (!flag_q->answer) {
Rast_set_fp_type(DCELL_TYPE);
- if ((fdout = Rast_open_new(out_opt->answer, DCELL_TYPE)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"),
- out_opt->answer);
+ fdout = Rast_open_new(out_opt->answer, DCELL_TYPE);
/* open mask file */
if ((maskfd = Rast_maskfd()) >= 0)
Modified: grass/trunk/vector/v.neighbors/main.c
===================================================================
--- grass/trunk/vector/v.neighbors/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/vector/v.neighbors/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -95,8 +95,6 @@
/*open the new cellfile */
out_fd = Rast_open_new(out_opt->answer, CELL_TYPE);
- if (out_fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), out_opt->answer);
box.T = PORT_DOUBLE_MAX;
box.B = -PORT_DOUBLE_MAX;
Modified: grass/trunk/vector/v.sample/main.c
===================================================================
--- grass/trunk/vector/v.sample/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/vector/v.sample/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -132,8 +132,7 @@
Vect_open_old2(&In, parm.input->answer, "", parm.field->answer);
field = Vect_get_field_number(&In, parm.field->answer);
- if ((fdrast = Rast_open_old(parm.rast->answer, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), parm.rast->answer);
+ fdrast = Rast_open_old(parm.rast->answer, "");
/* Read attributes */
Fi = Vect_get_field(&In, field);
Modified: grass/trunk/vector/v.surf.idw/main.c
===================================================================
--- grass/trunk/vector/v.surf.idw/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/vector/v.surf.idw/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -242,9 +242,6 @@
fd = Rast_open_new(parm.output->answer, DCELL_TYPE);
- if (fd < 0)
- G_fatal_error(_("Unable to create raster map <%s>"),
- parm.output->answer);
G_important_message(_("Interpolating raster map <%s> (%d rows, %d cols)... "),
parm.output->answer, window.rows, window.cols);
Modified: grass/trunk/vector/v.to.rast/support.c
===================================================================
--- grass/trunk/vector/v.to.rast/support.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/vector/v.to.rast/support.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -260,8 +260,7 @@
/* init raster categories */
Rast_init_cats("Categories", &rast_cats);
- if (!(fd = Rast_open_old(rast_name, G_mapset())))
- G_fatal_error(_("Unable to open raster map <%s>"), rast_name);
+ fd = Rast_open_old(rast_name, G_mapset());
switch (use) {
case USE_ATTR:
@@ -417,13 +416,11 @@
RASTER_MAP_TYPE map_type;
long count;
- if (!(fd = Rast_open_old(rast_name, G_mapset())))
- G_fatal_error(_("Unable to open raster map <%s>"), rast_name);
+ fd = Rast_open_old(rast_name, G_mapset());
map_type = Rast_map_type(rast_name, G_mapset());
- if (!(rowbuf = Rast_allocate_buf(map_type)))
- G_fatal_error(_("Cannot allocate memory for row buffer"));
+ rowbuf = Rast_allocate_buf(map_type);
Rast_init_cell_stats(&stats);
Rast_set_cats_title("Categories", &rast_cats);
Modified: grass/trunk/vector/v.to.rast/vect2rast.c
===================================================================
--- grass/trunk/vector/v.to.rast/vect2rast.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/vector/v.to.rast/vect2rast.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -116,12 +116,10 @@
switch (format) {
case USE_CELL:
- if ((fd = Rast_open_c_new(raster_map)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), raster_map);
+ fd = Rast_open_c_new(raster_map);
break;
case USE_DCELL:
- if ((fd = Rast_open_new(raster_map, DCELL_TYPE)) < 0)
- G_fatal_error(_("Unable to create raster map <%s>"), raster_map);
+ fd = Rast_open_new(raster_map, DCELL_TYPE);
break;
default:
G_fatal_error(_("Unknown raster map type"));
Modified: grass/trunk/vector/v.vol.rst/main.c
===================================================================
--- grass/trunk/vector/v.vol.rst/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/vector/v.vol.rst/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -644,11 +644,7 @@
if (mapset == NULL)
G_fatal_error(_("Raster map <%s> not found"), cellinp);
fdcell = Rast_open_old(cellinp, mapset);
- if (fdcell < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), cellinp);
fdcout = Rast_open_fp_new(cellout);
- if (fdcout < 0)
- G_fatal_error(_("Cannot open %s"), cellout);
zero_array_cell = (FCELL *) G_malloc(sizeof(FCELL) * n_cols);
if (!zero_array_cell)
clean_fatal_error("Not enough memory for zero_array_cell\n");
Modified: grass/trunk/vector/v.what.rast/main.c
===================================================================
--- grass/trunk/vector/v.what.rast/main.c 2010-01-04 13:58:39 UTC (rev 40214)
+++ grass/trunk/vector/v.what.rast/main.c 2010-01-04 14:39:31 UTC (rev 40215)
@@ -133,8 +133,7 @@
}
/* Open raster */
- if ((fd = Rast_open_old(rast_opt->answer, "")) < 0)
- G_fatal_error(_("Unable to open raster map <%s>"), rast_opt->answer);
+ fd = Rast_open_old(rast_opt->answer, "");
out_type = Rast_get_map_type(fd);
More information about the grass-commit
mailing list