Просмотр исходного кода

No need to check return value from Rast_open_*

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@40215 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 15 лет назад
Родитель
Сommit
d2b26275a0
100 измененных файлов с 146 добавлено и 591 удалено
  1. 3 6
      display/d.his/main.c
  2. 2 5
      display/d.nviz/main.c
  3. 0 2
      display/d.profile/main.c
  4. 0 4
      display/d.rast.arrow/main.c
  5. 0 2
      display/d.rast.num/main.c
  6. 1 2
      display/d.rast/display.c
  7. 1 2
      display/d.rgb/main.c
  8. 0 2
      display/d.what.rast/opencell.c
  9. 2 5
      doc/raster/r.example/main.c
  10. 0 3
      general/g.region/zoom.c
  11. 2 8
      imagery/i.albedo/main.c
  12. 7 14
      imagery/i.biomass/main.c
  13. 3 7
      imagery/i.cca/main.c
  14. 1 2
      imagery/i.class/band_files.c
  15. 0 4
      imagery/i.class/draw_cell.c
  16. 2 4
      imagery/i.class/signature.c
  17. 1 3
      imagery/i.cluster/open_files.c
  18. 4 8
      imagery/i.eb.eta/main.c
  19. 5 10
      imagery/i.eb.evapfr/main.c
  20. 4 8
      imagery/i.eb.h_SEBAL01/main.c
  21. 6 12
      imagery/i.eb.soilheatflux/main.c
  22. 2 4
      imagery/i.emissivity/main.c
  23. 5 26
      imagery/i.evapo.time_integration/main.c
  24. 2 6
      imagery/i.fft/main.c
  25. 0 6
      imagery/i.gensig/openfiles.c
  26. 0 6
      imagery/i.gensigset/openfiles.c
  27. 9 20
      imagery/i.his.rgb/openfiles.c
  28. 1 11
      imagery/i.ifft/main.c
  29. 2 4
      imagery/i.latlong/main.c
  30. 2 11
      imagery/i.maxlik/open.c
  31. 2 4
      imagery/i.modis.qc/main.c
  32. 1 7
      imagery/i.pca/main.c
  33. 0 2
      imagery/i.points/drawcell.c
  34. 0 5
      imagery/i.rectify/rectify.c
  35. 0 3
      imagery/i.rectify/write.c
  36. 9 18
      imagery/i.rgb.his/openfiles.c
  37. 2 22
      imagery/i.smap/opencell.c
  38. 3 7
      imagery/i.sunhours/main.c
  39. 6 13
      imagery/i.vi/main.c
  40. 0 2
      imagery/i.vpoints/drawcell.c
  41. 1 4
      imagery/i.zc/main.c
  42. 1 2
      ps/ps.map/outl_io.c
  43. 1 5
      ps/ps.map/r_cell.c
  44. 2 8
      ps/ps.map/r_group.c
  45. 1 6
      ps/ps.map/r_rgb.c
  46. 0 2
      raster/r.basins.fill/main.c
  47. 1 2
      raster/r.basins.fill/read_map.c
  48. 2 5
      raster/r.bitpattern/main.c
  49. 0 2
      raster/r.buffer/read_map.c
  50. 2 6
      raster/r.buffer/write_map.c
  51. 2 7
      raster/r.carve/main.c
  52. 0 3
      raster/r.category/cats.c
  53. 1 2
      raster/r.category/main.c
  54. 1 3
      raster/r.circle/main.c
  55. 0 4
      raster/r.clump/main.c
  56. 2 6
      raster/r.colors/stats.c
  57. 2 4
      raster/r.composite/main.c
  58. 0 4
      raster/r.compress/main.c
  59. 0 2
      raster/r.contour/main.c
  60. 0 6
      raster/r.cost/main.c
  61. 0 2
      raster/r.covar/main.c
  62. 0 6
      raster/r.cross/main.c
  63. 0 2
      raster/r.describe/describe.c
  64. 0 2
      raster/r.distance/edges.c
  65. 2 5
      raster/r.flow/io.c
  66. 2 10
      raster/r.grow.distance/main.c
  67. 0 4
      raster/r.grow/main.c
  68. 9 21
      raster/r.his/main.c
  69. 1 6
      raster/r.horizon/main.c
  70. 0 2
      raster/r.in.arc/main.c
  71. 0 2
      raster/r.in.ascii/main.c
  72. 0 4
      raster/r.in.bin/main.c
  73. 3 13
      raster/r.in.gdal/main.c
  74. 0 2
      raster/r.in.mat/main.c
  75. 0 2
      raster/r.in.poly/poly2rast.c
  76. 0 2
      raster/r.in.xyz/main.c
  77. 4 16
      raster/r.lake/main.c
  78. 0 2
      raster/r.li/r.li.daemon/daemon.c
  79. 0 6
      raster/r.los/main.c
  80. 1 12
      raster/r.mapcalc/map.c
  81. 0 6
      raster/r.mfilter/perform.c
  82. 1 7
      raster/r.neighbors/main.c
  83. 0 5
      raster/r.null/main.c
  84. 0 2
      raster/r.out.arc/main.c
  85. 0 2
      raster/r.out.ascii/main.c
  86. 0 2
      raster/r.out.bin/main.c
  87. 0 8
      raster/r.out.gdal/export_band.c
  88. 0 2
      raster/r.out.gridatb/file_io.c
  89. 0 2
      raster/r.out.mat/main.c
  90. 0 2
      raster/r.out.mpeg/main.c
  91. 1 2
      raster/r.out.png/main.c
  92. 0 3
      raster/r.out.pov/main.c
  93. 1 2
      raster/r.out.ppm/main.c
  94. 1 2
      raster/r.out.ppm3/main.c
  95. 1 2
      raster/r.out.tiff/main.c
  96. 4 8
      raster/r.out.vrml/main.c
  97. 1 14
      raster/r.out.vtk/main.c
  98. 5 12
      raster/r.param.scale/open_files.c
  99. 0 14
      raster/r.patch/main.c
  100. 0 0
      raster/r.profile/main.c

+ 3 - 6
display/d.his/main.c

@@ -121,8 +121,7 @@ int main(int argc, char **argv)
     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 main(int argc, char **argv)
 	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 @@ int main(int argc, char **argv)
 	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);

+ 2 - 5
display/d.nviz/main.c

@@ -42,7 +42,7 @@ FILE *fp, *fp2;
 
 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 @@ int main(int argc, char *argv[])
     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)

+ 0 - 2
display/d.profile/main.c

@@ -213,8 +213,6 @@ int main(int argc, char **argv)
     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();

+ 0 - 4
display/d.rast.arrow/main.c

@@ -291,8 +291,6 @@ int main(int argc, char **argv)
 
     /* 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 @@ int main(int argc, char **argv)
     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);
 

+ 0 - 2
display/d.rast.num/main.c

@@ -127,8 +127,6 @@ int main(int argc, char **argv)
 	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);

+ 1 - 2
display/d.rast/display.c

@@ -58,8 +58,7 @@ static int cell_draw(const char *name,
     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);

+ 1 - 2
display/d.rgb/main.c

@@ -89,8 +89,7 @@ int main(int argc, char **argv)
 	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);
 

+ 0 - 2
display/d.what.rast/opencell.c

@@ -20,8 +20,6 @@ int opencell(char *fullname, char *name, char *mapset)
 	strcpy(mapset, m);
 
     fd = Rast_open_old(name, mapset);
-    if (fd < 0)
-	G_warning(_("Unable to open raster map <%s>"), name);
 
     return fd;
 }

+ 2 - 5
doc/raster/r.example/main.c

@@ -108,9 +108,7 @@ int main(int argc, char *argv[])
     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)
@@ -127,8 +125,7 @@ int main(int argc, char *argv[])
     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++) {

+ 0 - 3
general/g.region/zoom.c

@@ -20,9 +20,6 @@ int zoom(struct Cell_head *window, const char *name, const char *mapset)
     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);
 

+ 2 - 8
imagery/i.albedo/main.c

@@ -150,14 +150,9 @@ int main(int argc, char *argv[])
 	    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 @@ int main(int argc, char *argv[])
     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 */

+ 7 - 14
imagery/i.biomass/main.c

@@ -99,28 +99,22 @@ int main(int argc, char *argv[])
     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 @@ int main(int argc, char *argv[])
     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++)

+ 3 - 7
imagery/i.cca/main.c

@@ -199,15 +199,11 @@ int main(int argc, char *argv[])
 	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 */

+ 1 - 2
imagery/i.class/band_files.c

@@ -18,8 +18,7 @@ int open_band_files(void)
 	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;

+ 0 - 4
imagery/i.class/draw_cell.c

@@ -39,10 +39,6 @@ int draw_cell(View * view, int overlay)
     }
 
     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);

+ 2 - 4
imagery/i.class/signature.c

@@ -272,10 +272,8 @@ int display_signature(void)
 	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();
 

+ 1 - 3
imagery/i.cluster/open_files.c

@@ -54,9 +54,7 @@ int open_files(void)
 	
 	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);

+ 4 - 8
imagery/i.eb.eta/main.c

@@ -76,24 +76,20 @@ int main(int argc, char *argv[])
     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++)

+ 5 - 10
imagery/i.eb.evapfr/main.c

@@ -95,18 +95,15 @@ int main(int argc, char *argv[])
     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 @@ int main(int argc, char *argv[])
 	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++)

+ 4 - 8
imagery/i.eb.h_SEBAL01/main.c

@@ -204,14 +204,10 @@ int main(int argc, char *argv[])
     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);

+ 6 - 12
imagery/i.eb.soilheatflux/main.c

@@ -94,24 +94,19 @@ int main(int argc, char *argv[])
     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 @@ int main(int argc, char *argv[])
     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++)

+ 2 - 4
imagery/i.emissivity/main.c

@@ -62,8 +62,7 @@ int main(int argc, char *argv[])
     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 @@ int main(int argc, char *argv[])
     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++)

+ 5 - 26
imagery/i.evapo.time_integration/main.c

@@ -165,15 +165,9 @@ int main(int argc, char *argv[])
 	}
 	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 @@ int main(int argc, char *argv[])
 	}
 	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 @@ int main(int argc, char *argv[])
 	}
 	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 @@ int main(int argc, char *argv[])
 
    
     /* 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 */

+ 2 - 6
imagery/i.fft/main.c

@@ -101,8 +101,6 @@ int main(int argc, char *argv[])
     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 @@ int main(int argc, char *argv[])
     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 {					\

+ 0 - 6
imagery/i.gensig/openfiles.c

@@ -31,18 +31,12 @@ int openfiles(struct parms *parms, struct files *files)
     /* 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();
     }
 

+ 0 - 6
imagery/i.gensigset/openfiles.c

@@ -31,18 +31,12 @@ int openfiles(struct parms *parms, struct files *files)
     /* 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();
     }
 

+ 9 - 20
imagery/i.his.rgb/openfiles.c

@@ -10,28 +10,17 @@ void openfiles(char *h_name, char *i_name, char *s_name,
 	       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, "");
 }

+ 1 - 11
imagery/i.ifft/main.c

@@ -102,14 +102,7 @@ int main(int argc, char *argv[])
 
     /* 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,10 +205,7 @@ int main(int argc, char *argv[])
     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>..."),

+ 2 - 4
imagery/i.latlong/main.c

@@ -78,8 +78,7 @@ int main(int argc, char *argv[])
     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 @@ int main(int argc, char *argv[])
 
     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++)
     {

+ 2 - 11
imagery/i.maxlik/open.c

@@ -38,9 +38,7 @@ int open_files(void)
 	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 @@ int open_files(void)
     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;

+ 2 - 4
imagery/i.modis.qc/main.c

@@ -197,8 +197,7 @@ int main(int argc, char *argv[])
 	(!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 @@ int main(int argc, char *argv[])
     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++)

+ 1 - 7
imagery/i.pca/main.c

@@ -117,9 +117,7 @@ int main(int argc, char *argv[])
 	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 @@ write_pca(double **eigmat, int *inp_fd, char *out_basename,
 	    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;

+ 0 - 2
imagery/i.points/drawcell.c

@@ -50,8 +50,6 @@ int drawcell(View * view)
 	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);

+ 0 - 5
imagery/i.rectify/rectify.c

@@ -18,7 +18,6 @@ int rectify(char *name, char *mapset, char *result, int order)
     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 @@ int rectify(char *name, char *mapset, char *result, int order)
      */
     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);

+ 0 - 3
imagery/i.rectify/write.c

@@ -48,9 +48,6 @@ int write_map(char *name)
     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))

+ 9 - 18
imagery/i.rgb.his/openfiles.c

@@ -9,26 +9,17 @@ void openfiles(char *r_name, char *g_name, char *b_name,
 	       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();
 }

+ 2 - 22
imagery/i.smap/opencell.c

@@ -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);
 }

+ 3 - 7
imagery/i.sunhours/main.c

@@ -70,13 +70,11 @@ int main(int argc, char *argv[])
     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,9 +82,7 @@ int main(int argc, char *argv[])
     ncols = G_window_cols();
 
     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++)
     {

+ 6 - 13
imagery/i.vi/main.c

@@ -211,36 +211,30 @@ int main(int argc, char *argv[])
 	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 @@ int main(int argc, char *argv[])
     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++)

+ 0 - 2
imagery/i.vpoints/drawcell.c

@@ -60,8 +60,6 @@ int drawcell(View * view, int initflag)
 	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);

+ 1 - 4
imagery/i.zc/main.c

@@ -101,8 +101,6 @@ int main(int argc, char *argv[])
 
     /* 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 @@ int main(int argc, char *argv[])
 
     /* 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();
 

+ 1 - 2
ps/ps.map/outl_io.c

@@ -64,8 +64,7 @@ RASTER_MAP_TYPE o_open_file(char *cell)
 {
     /* 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);

+ 1 - 5
ps/ps.map/r_cell.c

@@ -30,11 +30,7 @@ int read_cell(char *name, char *mapset)
     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);

+ 2 - 8
ps/ps.map/r_group.c

@@ -50,14 +50,8 @@ int read_group(void)
     }
 
     /* 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);

+ 1 - 6
ps/ps.map/r_rgb.c

@@ -74,12 +74,7 @@ int read_rgb(char *key, char *data)
 	}
 
 	/* 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);

+ 0 - 2
raster/r.basins.fill/main.c

@@ -105,8 +105,6 @@ int main(int argc, char *argv[])
     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++) {

+ 1 - 2
raster/r.basins.fill/read_map.c

@@ -33,8 +33,7 @@ CELL *read_map(const char *name, int nomask, int nrows, int ncols)
     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);

+ 2 - 5
raster/r.bitpattern/main.c

@@ -96,9 +96,7 @@ int main(int argc, char *argv[])
     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 @@ int main(int argc, char *argv[])
     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;

+ 0 - 2
raster/r.buffer/read_map.c

@@ -39,8 +39,6 @@ int read_input_map(char *input, char *mapset, int ZEROFLAG)
     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();
 

+ 2 - 6
raster/r.buffer/write_map.c

@@ -37,14 +37,10 @@ int write_output_map(char *output, int offset)
     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);
 

+ 2 - 7
raster/r.carve/main.c

@@ -161,17 +161,12 @@ int main(int argc, char **argv)
     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)

+ 0 - 3
raster/r.category/cats.c

@@ -40,9 +40,6 @@ int get_cats(const char *name, const char *mapset)
 
     /* 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();

+ 1 - 2
raster/r.category/main.c

@@ -147,8 +147,7 @@ int main(int argc, char *argv[])
 		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);
 

+ 1 - 3
raster/r.circle/main.c

@@ -123,9 +123,7 @@ int main(int argc, char *argv[])
 
     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));
     {

+ 0 - 4
raster/r.clump/main.c

@@ -70,12 +70,8 @@ int main(int argc, char *argv[])
     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);
 

+ 2 - 6
raster/r.colors/stats.c

@@ -30,9 +30,7 @@ int get_stats(const char *name, const char *mapset, struct Cell_stats *statf)
     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 @@ void get_fp_stats(const char *name, const char *mapset,
     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();

+ 2 - 4
raster/r.composite/main.c

@@ -152,8 +152,7 @@ int main(int argc, char **argv)
 	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 @@ int main(int argc, char **argv)
     /* 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();
 

+ 0 - 4
raster/r.compress/main.c

@@ -192,8 +192,6 @@ static int doit(char *name, int uncompress, RASTER_MAP_TYPE map_type)
     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 @@ static int doit(char *name, int uncompress, RASTER_MAP_TYPE map_type)
     else
 	new = Rast_open_new(name, map_type);
 
-    if (new < 0)
-	return 1;
     nrows = G_window_rows();
     rast = Rast_allocate_buf(map_type);
 

+ 0 - 2
raster/r.contour/main.c

@@ -136,8 +136,6 @@ int main(int argc, char *argv[])
     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>"),

+ 0 - 6
raster/r.cost/main.c

@@ -373,9 +373,6 @@ int main(int argc, char *argv[])
 
     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 @@ int main(int argc, char *argv[])
 	    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);
 

+ 0 - 2
raster/r.covar/main.c

@@ -77,8 +77,6 @@ int main(int argc, char *argv[])
 	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();

+ 0 - 6
raster/r.cross/main.c

@@ -109,8 +109,6 @@ int main(int argc, char *argv[])
 	    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 @@ int main(int argc, char *argv[])
     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, ", ");

+ 0 - 2
raster/r.describe/describe.c

@@ -50,8 +50,6 @@ int describe(const char *name, int compact, char *no_data_str,
 	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)

+ 0 - 2
raster/r.distance/edges.c

@@ -59,8 +59,6 @@ void find_edge_cells(struct Map *map)
     }
 
     fd = Rast_open_old(map->name, map->mapset);
-    if (fd < 0)
-	exit(1);
 
     init_edge_list(map);
 

+ 2 - 5
raster/r.flow/io.c

@@ -163,9 +163,8 @@ void open_output_files(void)
 	    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 @@ void write_density_file(void)
 
     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);

+ 2 - 10
raster/r.grow.distance/main.c

@@ -209,20 +209,12 @@ int main(int argc, char **argv)
 	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);

+ 0 - 4
raster/r.grow/main.c

@@ -183,14 +183,10 @@ int main(int argc, char **argv)
 	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);

+ 9 - 21
raster/r.his/main.c

@@ -122,8 +122,7 @@ int main(int argc, char **argv)
     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 main(int argc, char **argv)
 	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 @@ int main(int argc, char **argv)
 	    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 @@ int main(int argc, char **argv)
 
     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();

+ 1 - 6
raster/r.horizon/main.c

@@ -542,10 +542,7 @@ int INPUT(void)
     }
     /*read Z raster */
 
-    if ((mapset = G_find_raster2(elevin, "")) == NULL)
-	G_fatal_error(_("Raster map <%s> not found"), elevin);
-
-    fd1 = Rast_open_old(elevin, mapset);
+    fd1 = Rast_open_old(elevin, "");
 
     for (row = 0; row < m; row++) {
 	Rast_get_f_row(fd1, cell1, row);
@@ -610,8 +607,6 @@ int OUTGR(int numrows, int numcols)
     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())

+ 0 - 2
raster/r.in.arc/main.c

@@ -151,8 +151,6 @@ int main(int argc, char *argv[])
 	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);

+ 0 - 2
raster/r.in.ascii/main.c

@@ -203,8 +203,6 @@ int main(int argc, char *argv[])
     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++) {

+ 0 - 4
raster/r.in.bin/main.c

@@ -494,10 +494,6 @@ int main(int argc, char *argv[])
     }
 
     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;

+ 3 - 13
raster/r.in.gdal/main.c

@@ -695,8 +695,6 @@ static void ImportBand(GDALRasterBandH hBand, const char *output,
     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 @@ static void ImportBand(GDALRasterBandH hBand, const char *output,
 	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 @@ static void ImportBand(GDALRasterBandH hBand, const char *output,
 	eGDT = GDT_Int32;
 	complex = FALSE;
 	Rast_set_cell_format(1);
-	/* raster_open_new_func = Rast_open_new_uncompressed; *//* ?? */
 	break;
 
     default:
@@ -745,14 +741,10 @@ static void ImportBand(GDALRasterBandH hBand, const char *output,
 
     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 @@ static void ImportBand(GDALRasterBandH hBand, const char *output,
 	}
     }
     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);

+ 0 - 2
raster/r.in.mat/main.c

@@ -410,8 +410,6 @@ int main(int argc, char *argv[])
     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..."));

+ 0 - 2
raster/r.in.poly/poly2rast.c

@@ -33,8 +33,6 @@ int poly_to_rast(char *input_file, char *raster_map, char *title, int nrows)
     }
 
     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 = "";

+ 0 - 2
raster/r.in.xyz/main.c

@@ -499,8 +499,6 @@ int main(int argc, char *argv[])
 
     /* 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 */

+ 4 - 16
raster/r.lake/main.c

@@ -212,11 +212,8 @@ int main(int argc, char *argv[])
     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 @@ int main(int argc, char *argv[])
 
     /* 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 @@ int main(int argc, char *argv[])
 	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;

+ 0 - 2
raster/r.li/r.li.daemon/daemon.c

@@ -125,8 +125,6 @@ int calculateIndex(char *file, int f(int, char **, area_des, double *),
 	   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);

+ 0 - 6
raster/r.los/main.c

@@ -201,19 +201,13 @@ int main(int argc, char *argv[])
 
     /*      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"));
     }

+ 1 - 12
raster/r.mapcalc/map.c

@@ -509,8 +509,6 @@ int open_map(const char *name, int mod, int row, int col)
 	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 @@ int open_map(const char *name, int mod, int row, int col)
 
     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 check_output_map(const char *name)
 
 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)

+ 0 - 6
raster/r.mfilter/perform.c

@@ -34,9 +34,6 @@ int perform_filter(const char *in_name, const char *out_name,
 
 		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 @@ int perform_filter(const char *in_name, const char *out_name,
     /* 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++) {

+ 1 - 7
raster/r.neighbors/main.c

@@ -215,9 +215,7 @@ int main(int argc, char *argv[])
     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 @@ int main(int argc, char *argv[])
 
     /* 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();

+ 0 - 5
raster/r.null/main.c

@@ -315,14 +315,9 @@ int doit(const char *name, const char *mapset, int change_null, RASTER_MAP_TYPE
     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);

+ 0 - 2
raster/r.out.arc/main.c

@@ -117,8 +117,6 @@ int main(int argc, char *argv[])
     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;

+ 0 - 2
raster/r.out.ascii/main.c

@@ -144,8 +144,6 @@ int main(int argc, char *argv[])
 
     /* 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);
 

+ 0 - 2
raster/r.out.bin/main.c

@@ -124,8 +124,6 @@ int main(int argc, char *argv[])
     G_get_window(&region);
 
     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)

+ 0 - 8
raster/r.out.gdal/export_band.c

@@ -46,10 +46,6 @@ int exact_checks(GDALDataType export_datatype,
 
     /* 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 @@ int export_band(GDALDatasetH hMEMDS, GDALDataType export_datatype, int band,
 
     /* 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);

+ 0 - 2
raster/r.out.gridatb/file_io.c

@@ -15,8 +15,6 @@ void rdwr_gridatb(void)
     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) {

+ 0 - 2
raster/r.out.mat/main.c

@@ -84,8 +84,6 @@ int main(int argc, char *argv[])
     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);
 

+ 0 - 2
raster/r.out.mpeg/main.c

@@ -283,8 +283,6 @@ static int load_files(void)
 		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);

+ 1 - 2
raster/r.out.png/main.c

@@ -152,8 +152,7 @@ int main(int argc, char *argv[])
     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();

+ 0 - 3
raster/r.out.pov/main.c

@@ -163,9 +163,6 @@ int main(int argc, char *argv[])
     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)

+ 1 - 2
raster/r.out.ppm/main.c

@@ -97,8 +97,7 @@ int main(int argc, char *argv[])
     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();

+ 1 - 2
raster/r.out.ppm3/main.c

@@ -100,8 +100,7 @@ int main(int argc, char **argv)
 	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);

+ 1 - 2
raster/r.out.tiff/main.c

@@ -158,8 +158,7 @@ int main(int argc, char *argv[])
 			"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");

+ 4 - 8
raster/r.out.vrml/main.c

@@ -83,8 +83,7 @@ int main(int argc, char *argv[])
 
     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 @@ int main(int argc, char *argv[])
     }
 
     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 */

+ 1 - 14
raster/r.out.vtk/main.c

@@ -124,9 +124,6 @@ int main(int argc, char *argv[])
 
 	/* 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 @@ int main(int argc, char *argv[])
 
 	    /* 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 @@ int main(int argc, char *argv[])
 
 		/* 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 @@ int main(int argc, char *argv[])
 			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]);
 	    }
 

+ 5 - 12
raster/r.param.scale/open_files.c

@@ -23,19 +23,12 @@ void open_files(void)
 {
     /* 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);
 }

+ 0 - 14
raster/r.patch/main.c

@@ -36,7 +36,6 @@ int main(int argc, char *argv[])
     int nfiles;
     char *rname;
     int i;
-    int ok;
     int row, nrows, ncols;
     int ZEROFLAG;
     char *new_name;
@@ -78,7 +77,6 @@ int main(int argc, char *argv[])
 
     ZEROFLAG = (zeroflag->answer);
 
-    ok = 1;
     names = opt1->answers;
 
     out_type = CELL_TYPE;
@@ -95,14 +93,7 @@ int main(int argc, char *argv[])
 	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 @@ int main(int argc, char *argv[])
 	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);

+ 0 - 0
raster/r.profile/main.c


Некоторые файлы не были показаны из-за большого количества измененных файлов