Przeglądaj źródła

Rast_put_*_row* now generate errors rather than returning a status

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@40223 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 15 lat temu
rodzic
commit
e1b2b37f30
52 zmienionych plików z 225 dodań i 482 usunięć
  1. 1 2
      doc/raster/r.example/main.c
  2. 1 3
      imagery/i.albedo/main.c
  3. 1 2
      imagery/i.biomass/main.c
  4. 1 2
      imagery/i.cca/transform.c
  5. 1 2
      imagery/i.eb.eta/main.c
  6. 2 6
      imagery/i.eb.evapfr/main.c
  7. 1 2
      imagery/i.eb.h_SEBAL01/main.c
  8. 1 2
      imagery/i.eb.soilheatflux/main.c
  9. 1 2
      imagery/i.emissivity/main.c
  10. 1 2
      imagery/i.evapo.time_integration/main.c
  11. 1 3
      imagery/i.his.rgb/main.c
  12. 1 2
      imagery/i.latlong/main.c
  13. 1 3
      imagery/i.modis.qc/main.c
  14. 1 5
      imagery/i.rectify/write.c
  15. 1 3
      imagery/i.rgb.his/main.c
  16. 1 2
      imagery/i.sunhours/main.c
  17. 1 3
      imagery/i.vi/main.c
  18. 5 5
      include/rasterdefs.h
  19. 3 12
      lib/gpde/N_arrays_io.c
  20. 144 249
      lib/raster/put_row.c
  21. 6 24
      lib/rst/interp_float/resout2d.c
  22. 0 1
      lib/rst/interp_float/ressegm2d.c
  23. 1 2
      raster/r.bitpattern/main.c
  24. 1 3
      raster/r.buffer/write_map.c
  25. 2 5
      raster/r.clump/clump.c
  26. 1 2
      raster/r.composite/main.c
  27. 1 2
      raster/r.compress/main.c
  28. 1 2
      raster/r.cross/renumber.c
  29. 3 6
      raster/r.his/main.c
  30. 1 4
      raster/r.in.mat/main.c
  31. 1 2
      raster/r.in.poly/raster.c
  32. 1 5
      raster/r.in.xyz/main.c
  33. 1 2
      raster/r.lake/main.c
  34. 1 3
      raster/r.los/main.c
  35. 1 2
      raster/r.mapcalc/map.c
  36. 2 8
      raster/r.null/main.c
  37. 1 3
      raster/r.proj/main.c
  38. 1 1
      raster/r.resamp.rst/main.c
  39. 1 2
      raster/r.resample/main.c
  40. 1 2
      raster/r.spreadpath/main.c
  41. 1 3
      raster/r.support/main.c
  42. 5 10
      raster/r.terraflow/grass2str.h
  43. 4 11
      raster/r.texture/main.c
  44. 1 3
      raster/r.uslek/main.c
  45. 1 3
      raster/r.usler/main.c
  46. 0 2
      raster/r.watershed/seg/bseg_read.c
  47. 1 9
      raster/r.watershed/seg/bseg_write.c
  48. 1 9
      raster/r.watershed/seg/cseg_write.c
  49. 1 9
      raster/r.watershed/seg/dseg_write.c
  50. 5 13
      raster3d/r3.cross.rast/main.c
  51. 5 13
      raster3d/r3.to.rast/main.c
  52. 2 4
      vector/v.to.rast/raster.c

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

@@ -160,8 +160,7 @@ int main(int argc, char *argv[])
 	}
 	}
 
 
 	/* write raster row to output raster map */
 	/* write raster row to output raster map */
-	if (Rast_put_row(outfd, outrast, data_type) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s>"), result);
+	Rast_put_row(outfd, outrast, data_type);
     }
     }
 
 
     /* memory cleanup */
     /* memory cleanup */

+ 1 - 3
imagery/i.albedo/main.c

@@ -376,9 +376,7 @@ int main(int argc, char *argv[])
 	    }
 	    }
 	    ((DCELL *) outrast)[col] = de;
 	    ((DCELL *) outrast)[col] = de;
 	}
 	}
-	if (Rast_put_row(outfd, outrast, out_data_type) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s> row %d"),
-			  result, row);
+	Rast_put_row(outfd, outrast, out_data_type);
     }
     }
     for (i = 1; i <= nfiles; i++) {
     for (i = 1; i <= nfiles; i++) {
 	G_free(inrast[i]);
 	G_free(inrast[i]);

+ 1 - 2
imagery/i.biomass/main.c

@@ -166,8 +166,7 @@ int main(int argc, char *argv[])
 		outrast1[col] = d;
 		outrast1[col] = d;
 	    }
 	    }
         }
         }
-	if (Rast_put_d_row(outfd1, outrast1) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s>"), result1);
+	Rast_put_d_row(outfd1, outrast1);
     }
     }
     
     
     /* Color table for biomass */ 
     /* Color table for biomass */ 

+ 1 - 2
imagery/i.cca/transform.c

@@ -47,8 +47,7 @@ transform(int *datafds, int *outfds, int rows, int cols,
 
 
 	/* output the row of data */
 	/* output the row of data */
 	for (j = 0; j < bands; j++)
 	for (j = 0; j < bands; j++)
-	    if (Rast_put_row(outfds[j], rowbufs[j], CELL_TYPE) < 0)
-		G_fatal_error(_("Error writing cell map during transform."));
+	    Rast_put_row(outfds[j], rowbufs[j], CELL_TYPE);
     }
     }
     for (i = 0; i < bands; i++)
     for (i = 0; i < bands; i++)
 	G_free(rowbufs[i]);
 	G_free(rowbufs[i]);

+ 1 - 2
imagery/i.eb.eta/main.c

@@ -120,8 +120,7 @@ int main(int argc, char *argv[])
 		outrast1[col] = d;
 		outrast1[col] = d;
 	    }
 	    }
 	}
 	}
-	if (Rast_put_d_row(outfd1,outrast1) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s>"), result1);
+	Rast_put_d_row(outfd1,outrast1);
     }
     }
     G_free(inrast_rnetday);
     G_free(inrast_rnetday);
     G_free(inrast_evapfr);
     G_free(inrast_evapfr);

+ 2 - 6
imagery/i.eb.evapfr/main.c

@@ -158,13 +158,9 @@ int main(int argc, char *argv[])
 		}
 		}
 	    }
 	    }
         }
         }
-	if (Rast_put_d_row(outfd1, outrast1) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s>"), result1);
+	Rast_put_d_row(outfd1, outrast1);
 	if (makin) 
 	if (makin) 
-        {
-            if (Rast_put_d_row(outfd2, outrast2) < 0)
-		G_fatal_error(_("Failed writing raster map <%s>"), result2);
-        }
+            Rast_put_d_row(outfd2, outrast2);
     }
     }
     G_free(inrast_rnet);
     G_free(inrast_rnet);
     G_free(inrast_g0);
     G_free(inrast_g0);

+ 1 - 2
imagery/i.eb.h_SEBAL01/main.c

@@ -605,8 +605,7 @@ int main(int argc, char *argv[])
 		outrast[col] = d_h3;
 		outrast[col] = d_h3;
 	    }
 	    }
 	}
 	}
-	if (Rast_put_d_row(outfd, outrast) < 0)
-	    G_fatal_error("Failed writing raster map <%s>", h0);
+	Rast_put_d_row(outfd, outrast);
     }
     }
 
 
 
 

+ 1 - 2
imagery/i.eb.soilheatflux/main.c

@@ -153,8 +153,7 @@ int main(int argc, char *argv[])
 		outrast[col] = d;
 		outrast[col] = d;
 	    }
 	    }
 	}
 	}
-	if (Rast_put_d_row(outfd, outrast) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s>"), result);
+	Rast_put_d_row(outfd, outrast);
     }
     }
     G_free(inrast_albedo);
     G_free(inrast_albedo);
     G_free(inrast_ndvi);
     G_free(inrast_ndvi);

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

@@ -96,8 +96,7 @@ int main(int argc, char *argv[])
 		outr[col] = d;
 		outr[col] = d;
 	    }
 	    }
         }
         }
-	if (Rast_put_row(outfd, outr, DCELL_TYPE) < 0)
-	    G_fatal_error(_("Cannot write to output raster file"));
+	Rast_put_row(outfd, outr, DCELL_TYPE);
     }
     }
     G_free(inr);
     G_free(inr);
     Rast_close(infd);
     Rast_close(infd);

+ 1 - 2
imagery/i.evapo.time_integration/main.c

@@ -386,8 +386,7 @@ int main(int argc, char *argv[])
 		}	
 		}	
 	    }
 	    }
 	}
 	}
-	if (Rast_put_row(outfd, outrast, out_data_type) < 0)
-	    G_fatal_error(_("Unable to write to raster map<%s>"), result);
+	Rast_put_row(outfd, outrast, out_data_type);
     }
     }
 
 
     for (i = 1; i <= nfiles; i++) {
     for (i = 1; i <= nfiles; i++) {

+ 1 - 3
imagery/i.his.rgb/main.c

@@ -101,9 +101,7 @@ int main(int argc, char **argv)
 
 
 	/* write out the new row for each cell map */
 	/* write out the new row for each cell map */
 	for (band = 0; band < 3; band++)
 	for (band = 0; band < 3; band++)
-	    if (Rast_put_row(fd_output[band], rowbuffer[band], CELL_TYPE)
-		< 0)
-		G_fatal_error(_("Failed writing raster map row %d"), i);
+	    Rast_put_row(fd_output[band], rowbuffer[band], CELL_TYPE);
     }
     }
 
 
     closefiles(opt_red->answer, opt_green->answer, opt_blue->answer,
     closefiles(opt_red->answer, opt_green->answer, opt_blue->answer,

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

@@ -138,8 +138,7 @@ int main(int argc, char *argv[])
 	        d = latitude;
 	        d = latitude;
 	    outrast1[col] = d;
 	    outrast1[col] = d;
 	}
 	}
-	if (Rast_put_d_row(outfd1, outrast1) < 0)
-	    G_fatal_error(_("Cannot write to output raster file"));
+	Rast_put_d_row(outfd1, outrast1);
     }
     }
     G_free(inrast);
     G_free(inrast);
     Rast_close(infd);
     Rast_close(infd);

+ 1 - 3
imagery/i.modis.qc/main.c

@@ -318,9 +318,7 @@ int main(int argc, char *argv[])
 	    outrast[col] = c;
 	    outrast[col] = c;
 	}
 	}
 
 
-	if (Rast_put_c_row(outfd, outrast) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s> row %d"),
-			  output->answer, row);
+	Rast_put_c_row(outfd, outrast);
     }
     }
 
 
     G_free(inrast);
     G_free(inrast);

+ 1 - 5
imagery/i.rectify/write.c

@@ -52,11 +52,7 @@ int write_map(char *name)
 	if (read(temp_fd, rast, target_window.cols * Rast_cell_size(map_type))
 	if (read(temp_fd, rast, target_window.cols * Rast_cell_size(map_type))
 	    != target_window.cols * Rast_cell_size(map_type))
 	    != target_window.cols * Rast_cell_size(map_type))
 	    G_fatal_error(_("Error writing row %d"), row);
 	    G_fatal_error(_("Error writing row %d"), row);
-	if (Rast_put_row(fd, rast, map_type) < 0) {
-	    G_fatal_error(_("Failed writing raster map <%s> row %d"),
-			  name, row);
-	    unlink(temp_name);
-	}
+	Rast_put_row(fd, rast, map_type);
     }
     }
     close(temp_fd);
     close(temp_fd);
     unlink(temp_name);
     unlink(temp_name);

+ 1 - 3
imagery/i.rgb.his/main.c

@@ -100,9 +100,7 @@ int main(int argc, char **argv)
 
 
 	/* write out the new row for each cell map */
 	/* write out the new row for each cell map */
 	for (band = 0; band < 3; band++)
 	for (band = 0; band < 3; band++)
-	    if (Rast_put_row(fd_output[band], rowbuffer[band], CELL_TYPE)
-		< 0)
-		G_fatal_error(_("Failed writing raster map row %ld"), i);
+	    Rast_put_row(fd_output[band], rowbuffer[band], CELL_TYPE);
     }
     }
     G_percent(i, rows, 2);
     G_percent(i, rows, 2);
 
 

+ 1 - 2
imagery/i.sunhours/main.c

@@ -112,8 +112,7 @@ int main(int argc, char *argv[])
 	    d_N = (360.0 / (15.0 * PI)) * d_Ws;
 	    d_N = (360.0 / (15.0 * PI)) * d_Ws;
 	    ((DCELL *) outrast1)[col] = d_N;
 	    ((DCELL *) outrast1)[col] = d_N;
         }
         }
-	if (Rast_put_row(outfd1, outrast1, DCELL_TYPE) < 0)
-	    G_fatal_error(_("Cannot write to output raster file"));
+	Rast_put_row(outfd1, outrast1, DCELL_TYPE);
     }
     }
     G_free(inrast_lat);
     G_free(inrast_lat);
     G_free(inrast_doy);
     G_free(inrast_doy);

+ 1 - 3
imagery/i.vi/main.c

@@ -346,9 +346,7 @@ int main(int argc, char *argv[])
 		    outrast[col] = va_ri(d_redchan, d_greenchan, d_bluechan);
 		    outrast[col] = va_ri(d_redchan, d_greenchan, d_bluechan);
 	    }
 	    }
 	}
 	}
-	if (Rast_put_d_row(outfd, outrast) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s> row %d"),
-			  result, row);
+	Rast_put_d_row(outfd, outrast);
     }
     }
 
 
     G_free(inrast_redchan);
     G_free(inrast_redchan);

+ 5 - 5
include/rasterdefs.h

@@ -403,12 +403,12 @@ void Rast_set_quant_rules(int, struct Quant *);
 int Rast_put_cellhd(const char *, struct Cell_head *);
 int Rast_put_cellhd(const char *, struct Cell_head *);
 
 
 /* put_row.c */
 /* put_row.c */
-int Rast_put_row(int, const void *, RASTER_MAP_TYPE);
-int Rast_put_c_row(int, const CELL *);
-int Rast_put_f_row(int, const FCELL *);
-int Rast_put_d_row(int, const DCELL *);
+void Rast_put_row(int, const void *, RASTER_MAP_TYPE);
+void Rast_put_c_row(int, const CELL *);
+void Rast_put_f_row(int, const FCELL *);
+void Rast_put_d_row(int, const DCELL *);
 int Rast__open_null_write(int);
 int Rast__open_null_write(int);
-int Rast__write_null_bits(int, const unsigned char *, int, int, int);
+void Rast__write_null_bits(int, const unsigned char *, int, int, int);
 
 
 /* put_title.c */
 /* put_title.c */
 int Rast_put_cell_title(const char *, const char *);
 int Rast_put_cell_title(const char *, const char *);

+ 3 - 12
lib/gpde/N_arrays_io.c

@@ -213,20 +213,11 @@ void N_write_array_2d_to_rast(N_array_2d * array, char *name)
 		drast[x] = N_get_array_2d_d_value(array, x, y);
 		drast[x] = N_get_array_2d_d_value(array, x, y);
 	}
 	}
 	if (type == CELL_TYPE)
 	if (type == CELL_TYPE)
-	    if (!Rast_put_c_row(map, rast)) {
-		Rast_unopen(map);	/*unopen the new raster map */
-		G_fatal_error(_("Unable to write raster row %i"), y);
-	    }
+	    Rast_put_c_row(map, rast);
 	if (type == FCELL_TYPE)
 	if (type == FCELL_TYPE)
-	    if (!Rast_put_f_row(map, frast)) {
-		Rast_unopen(map);	/*unopen the new raster map */
-		G_fatal_error(_("Unable to write raster row %i"), y);
-	    }
+	    Rast_put_f_row(map, frast);
 	if (type == DCELL_TYPE)
 	if (type == DCELL_TYPE)
-	    if (!Rast_put_d_row(map, drast)) {
-		Rast_unopen(map);	/*unopen the new raster map */
-		G_fatal_error(_("Unable to write raster row %i"), y);
-	    }
+	    Rast_put_d_row(map, drast);
     }
     }
 
 
     /* Close file */
     /* Close file */

+ 144 - 249
lib/raster/put_row.c

@@ -29,39 +29,7 @@
 #include "../gis/G.h"
 #include "../gis/G.h"
 #include "R.h"
 #include "R.h"
 
 
-static int put_raster_data(int, char *, const void *, int, int, int,
-			   RASTER_MAP_TYPE);
-static int put_data(int, char *, const CELL *, int, int, int);
-static int check_open(const char *, int);
-static void write_error(int, int);
-static int same(const unsigned char *, const unsigned char *, int);
-static void set_file_pointer(int, int);
-static int put_fp_data(int, char *, const void *, int, int, RASTER_MAP_TYPE);
-static int put_null_data(int, const char *, int);
-static int convert_and_write_if(int, const CELL *);
-static int convert_and_write_id(int, const CELL *);
-static int convert_and_write_df(int, const DCELL *);
-static int convert_and_write_fd(int, const FCELL *);
-static int put_raster_row(int, const void *, RASTER_MAP_TYPE, int);
-
-static int put_null_value_row(int fd, const char *buf)
-{
-    struct fileinfo *fcb = &R__.fileinfo[fd];
-
-    if (fcb->gdal)
-	G_fatal_error(_("GDAL output doesn't support writing null rows separately"));
-
-    switch (put_null_data(fd, buf, fcb->null_cur_row)) {
-    case -1:
-	return -1;
-    case 0:
-	return 1;
-    }
-
-    fcb->null_cur_row++;
-
-    return 1;
-}
+static void put_raster_row(int, const void *, RASTER_MAP_TYPE, int);
 
 
 /*!
 /*!
    \brief Writes the next row for cell/fcell/dcell file
    \brief Writes the next row for cell/fcell/dcell file
@@ -92,12 +60,11 @@ static int put_null_value_row(int fd, const char *buf)
    \param buf     buffer holding data
    \param buf     buffer holding data
    \param data_type raster map type (CELL_TYPE, FCELL_TYPE, DCELL_TYPE)
    \param data_type raster map type (CELL_TYPE, FCELL_TYPE, DCELL_TYPE)
 
 
-   \return 1 on success
-   \return -1 on failure
+   \return void
  */
  */
-int Rast_put_row(int fd, const void *buf, RASTER_MAP_TYPE data_type)
+void Rast_put_row(int fd, const void *buf, RASTER_MAP_TYPE data_type)
 {
 {
-    return put_raster_row(fd, buf, data_type, data_type);
+    put_raster_row(fd, buf, data_type, data_type);
 }
 }
 
 
 /*!
 /*!
@@ -108,12 +75,11 @@ int Rast_put_row(int fd, const void *buf, RASTER_MAP_TYPE data_type)
    \param fd file descriptor where data is to be written
    \param fd file descriptor where data is to be written
    \param buf     buffer holding data
    \param buf     buffer holding data
 
 
-   \return 1 on success
-   \return -1 on failure
+   \return void
  */
  */
-int Rast_put_c_row(int fd, const CELL * buf)
+void Rast_put_c_row(int fd, const CELL * buf)
 {
 {
-    return Rast_put_row(fd, buf, CELL_TYPE);
+    Rast_put_row(fd, buf, CELL_TYPE);
 }
 }
 
 
 /*!
 /*!
@@ -124,12 +90,11 @@ int Rast_put_c_row(int fd, const CELL * buf)
    \param fd file descriptor where data is to be written
    \param fd file descriptor where data is to be written
    \param buf     buffer holding data
    \param buf     buffer holding data
 
 
-   \return 1 on success
-   \return -1 on failure
+   \return void
  */
  */
-int Rast_put_f_row(int fd, const FCELL * buf)
+void Rast_put_f_row(int fd, const FCELL * buf)
 {
 {
-    return Rast_put_row(fd, buf, FCELL_TYPE);
+    Rast_put_row(fd, buf, FCELL_TYPE);
 }
 }
 
 
 /*!
 /*!
@@ -140,71 +105,31 @@ int Rast_put_f_row(int fd, const FCELL * buf)
    \param fd file descriptor where data is to be written
    \param fd file descriptor where data is to be written
    \param buf     buffer holding data
    \param buf     buffer holding data
 
 
-   \return 1 on success
-   \return -1 on failure
+   \return void
  */
  */
-int Rast_put_d_row(int fd, const DCELL * buf)
-{
-    return Rast_put_row(fd, buf, DCELL_TYPE);
-}
-
-static int check_open(const char *me, int fd)
-{
-    struct fileinfo *fcb = &R__.fileinfo[fd];
-
-    switch (fcb->open_mode) {
-    case OPEN_OLD:
-	G_warning(_("%s: raster map <%s> not open for write - request ignored"),
-		  me, fcb->name);
-	break;
-    case OPEN_NEW_COMPRESSED:
-    case OPEN_NEW_UNCOMPRESSED:
-	return 1;
-	break;
-    default:
-	G_warning(_("%s: unopened file descriptor - request ignored"), me);
-	break;
-    }
-
-    return 0;
-}
-
-static void write_error(int fd, int row)
+void Rast_put_d_row(int fd, const DCELL * buf)
 {
 {
-    struct fileinfo *fcb = &R__.fileinfo[fd];
-
-    if (fcb->io_error)
-	return;
-
-    G_warning(_("Raster map <%s> - unable to write row %d"), fcb->name, row);
-
-    fcb->io_error = 1;
+    Rast_put_row(fd, buf, DCELL_TYPE);
 }
 }
 
 
-static int write_data(int fd, int row, unsigned char *buf, int n)
+static void write_data(int fd, int row, unsigned char *buf, int n)
 {
 {
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
     ssize_t nwrite = fcb->nbytes * n;
     ssize_t nwrite = fcb->nbytes * n;
 
 
-    if (write(fd, buf, nwrite) != nwrite) {
-	write_error(fd, row);
-	return -1;
-    }
-
-    return 0;
+    if (write(fd, buf, nwrite) != nwrite)
+	G_fatal_error(_("Error writing uncompressed FP data for row %d of <%s>"),
+		      fcb->name, row);
 }
 }
 
 
-static int write_data_compressed(int fd, int row, unsigned char *buf, int n)
+static void write_data_compressed(int fd, int row, unsigned char *buf, int n)
 {
 {
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
     int nwrite = fcb->nbytes * n;
     int nwrite = fcb->nbytes * n;
 
 
-    if (G_zlib_write(fd, buf, nwrite) < 0) {
-	write_error(fd, row);
-	return -1;
-    }
-
-    return 0;
+    if (G_zlib_write(fd, buf, nwrite) < 0)
+	G_fatal_error(_("Error writing compressed FP data for row %d of <%s>"),
+		      fcb->name, row);
 }
 }
 
 
 static void set_file_pointer(int fd, int row)
 static void set_file_pointer(int fd, int row)
@@ -214,8 +139,8 @@ static void set_file_pointer(int fd, int row)
     fcb->row_ptr[row] = lseek(fd, 0L, SEEK_CUR);
     fcb->row_ptr[row] = lseek(fd, 0L, SEEK_CUR);
 }
 }
 
 
-static int convert_float(XDR * xdrs, char *null_buf, const FCELL * rast,
-			 int row, int n)
+static void convert_float(XDR * xdrs, char *null_buf, const FCELL * rast,
+			  int row, int n)
 {
 {
     int i;
     int i;
 
 
@@ -230,17 +155,13 @@ static int convert_float(XDR * xdrs, char *null_buf, const FCELL * rast,
 	else
 	else
 	    f = rast[i];
 	    f = rast[i];
 
 
-	if (!xdr_float(xdrs, &f)) {
-	    G_warning(_("xdr_float failed for index %d of row %d"), i, row);
-	    return -1;
-	}
+	if (!xdr_float(xdrs, &f))
+	    G_fatal_error(_("xdr_float failed for index %d of row %d"), i, row);
     }
     }
-
-    return 0;
 }
 }
 
 
-static int convert_double(XDR * xdrs, char *null_buf, const DCELL * rast,
-			  int row, int n)
+static void convert_double(XDR * xdrs, char *null_buf, const DCELL * rast,
+			   int row, int n)
 {
 {
     int i;
     int i;
 
 
@@ -255,18 +176,14 @@ static int convert_double(XDR * xdrs, char *null_buf, const DCELL * rast,
 	else
 	else
 	    d = rast[i];
 	    d = rast[i];
 
 
-	if (!xdr_double(xdrs, &d)) {
-	    G_warning(_("xdr_double failed for index %d of row %d"), i, row);
-	    return -1;
-	}
+	if (!xdr_double(xdrs, &d))
+	    G_fatal_error(_("xdr_double failed for index %d of row %d"), i, row);
     }
     }
-
-    return 0;
 }
 }
 
 
 /* writes data to fcell file for either full or partial rows */
 /* writes data to fcell file for either full or partial rows */
-static int put_fp_data(int fd, char *null_buf, const void *rast,
-		       int row, int n, RASTER_MAP_TYPE data_type)
+static void put_fp_data(int fd, char *null_buf, const void *rast,
+			int row, int n, RASTER_MAP_TYPE data_type)
 {
 {
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
     int compressed = (fcb->open_mode == OPEN_NEW_COMPRESSED);
     int compressed = (fcb->open_mode == OPEN_NEW_COMPRESSED);
@@ -274,10 +191,10 @@ static int put_fp_data(int fd, char *null_buf, const void *rast,
     char *work_buf;
     char *work_buf;
 
 
     if (row < 0 || row >= fcb->cellhd.rows)
     if (row < 0 || row >= fcb->cellhd.rows)
-	return 0;
+	return;
 
 
     if (n <= 0)
     if (n <= 0)
-	return 0;
+	return;
 
 
     work_buf = G__alloca(G__.window.cols * fcb->nbytes + 1);
     work_buf = G__alloca(G__.window.cols * fcb->nbytes + 1);
 
 
@@ -288,35 +205,19 @@ static int put_fp_data(int fd, char *null_buf, const void *rast,
 		  (unsigned int)fcb->nbytes * fcb->cellhd.cols, XDR_ENCODE);
 		  (unsigned int)fcb->nbytes * fcb->cellhd.cols, XDR_ENCODE);
     xdr_setpos(xdrs, 0);
     xdr_setpos(xdrs, 0);
 
 
-    if (data_type == FCELL_TYPE) {
-	if (convert_float(xdrs, null_buf, rast, row, n) < 0) {
-	    G__freea(work_buf);
-	    return -1;
-	}
-    }
-    else {
-	if (convert_double(xdrs, null_buf, rast, row, n) < 0) {
-	    G__freea(work_buf);
-	    return -1;
-	}
-    }
+    if (data_type == FCELL_TYPE)
+	convert_float(xdrs, null_buf, rast, row, n);
+    else
+	convert_double(xdrs, null_buf, rast, row, n);
 
 
     xdr_destroy(&fcb->xdrstream);
     xdr_destroy(&fcb->xdrstream);
 
 
-    if (compressed) {
-	if (write_data_compressed(fd, row, work_buf, n) == -1) {
-	    G__freea(work_buf);
-	    return -1;
-	}
-    }
-    else if (write_data(fd, row, work_buf, n) == -1) {
-	G__freea(work_buf);
-	return -1;
-    }
+    if (compressed)
+	write_data_compressed(fd, row, work_buf, n);
+    else
+	write_data(fd, row, work_buf, n);
 
 
     G__freea(work_buf);
     G__freea(work_buf);
-
-    return 1;
 }
 }
 
 
 static void convert_int(unsigned char *wk, char *null_buf, const CELL * rast,
 static void convert_int(unsigned char *wk, char *null_buf, const CELL * rast,
@@ -441,8 +342,8 @@ static int zlib_compress(unsigned char *dst, unsigned char *src, int n,
     return (nwrite >= total) ? 0 : nwrite;
     return (nwrite >= total) ? 0 : nwrite;
 }
 }
 
 
-static int put_data(int fd, char *null_buf, const CELL * cell,
-		    int row, int n, int zeros_r_nulls)
+static void put_data(int fd, char *null_buf, const CELL * cell,
+		     int row, int n, int zeros_r_nulls)
 {
 {
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
     int compressed = fcb->cellhd.compressed;
     int compressed = fcb->cellhd.compressed;
@@ -451,10 +352,10 @@ static int put_data(int fd, char *null_buf, const CELL * cell,
     ssize_t nwrite;
     ssize_t nwrite;
 
 
     if (row < 0 || row >= fcb->cellhd.rows)
     if (row < 0 || row >= fcb->cellhd.rows)
-	return 0;
+	return;
 
 
     if (n <= 0)
     if (n <= 0)
-	return 0;
+	return;
 
 
     work_buf = G__alloca(G__.window.cols * sizeof(CELL) + 1);
     work_buf = G__alloca(G__.window.cols * sizeof(CELL) + 1);
     wk = work_buf;
     wk = work_buf;
@@ -493,21 +394,15 @@ static int put_data(int fd, char *null_buf, const CELL * cell,
 	if (nwrite > 0) {
 	if (nwrite > 0) {
 	    nwrite++;
 	    nwrite++;
 
 
-	    if (write(fd, compressed_buf, nwrite) != nwrite) {
-		write_error(fd, row);
-		G__freea(compressed_buf);
-		G__freea(work_buf);
-		return -1;
-	    }
+	    if (write(fd, compressed_buf, nwrite) != nwrite)
+		G_fatal_error(_("Error writing compressed data for row %d of <%s>"),
+			      row, fcb->name);
 	}
 	}
 	else {
 	else {
 	    nwrite = nbytes * n + 1;
 	    nwrite = nbytes * n + 1;
-	    if (write(fd, work_buf, nwrite) != nwrite) {
-		write_error(fd, row);
-		G__freea(compressed_buf);
-		G__freea(work_buf);
-		return -1;
-	    }
+	    if (write(fd, work_buf, nwrite) != nwrite)
+		G_fatal_error(_("Error writing compressed data for row %d of <%s>"),
+			      row, fcb->name);
 	}
 	}
 
 
 	G__freea(compressed_buf);
 	G__freea(compressed_buf);
@@ -515,20 +410,16 @@ static int put_data(int fd, char *null_buf, const CELL * cell,
     else {
     else {
 	nwrite = fcb->nbytes * n;
 	nwrite = fcb->nbytes * n;
 
 
-	if (write(fd, work_buf, nwrite) != nwrite) {
-	    write_error(fd, row);
-	    G__freea(work_buf);
-	    return -1;
-	}
+	if (write(fd, work_buf, nwrite) != nwrite)
+	    G_fatal_error(_("Error writing uncompressed data for row %d of <%s>"),
+			  row, fcb->name);
     }
     }
 
 
     G__freea(work_buf);
     G__freea(work_buf);
-
-    return 1;
 }
 }
 
 
-static int put_data_gdal(int fd, const void *rast, int row, int n,
-			 int zeros_r_nulls, RASTER_MAP_TYPE map_type)
+static void put_data_gdal(int fd, const void *rast, int row, int n,
+			  int zeros_r_nulls, RASTER_MAP_TYPE map_type)
 {
 {
 #ifdef HAVE_GDAL
 #ifdef HAVE_GDAL
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
@@ -541,10 +432,10 @@ static int put_data_gdal(int fd, const void *rast, int row, int n,
     int i;
     int i;
 
 
     if (row < 0 || row >= fcb->cellhd.rows)
     if (row < 0 || row >= fcb->cellhd.rows)
-	return 0;
+	return;
 
 
     if (n <= 0)
     if (n <= 0)
-	return 0;
+	return;
 
 
     work_buf = G__alloca(n * size);
     work_buf = G__alloca(n * size);
 
 
@@ -573,47 +464,55 @@ static int put_data_gdal(int fd, const void *rast, int row, int n,
 	dst = G_incr_void_ptr(dst, size);
 	dst = G_incr_void_ptr(dst, size);
     }
     }
 
 
-    err =
-	Rast_gdal_raster_IO(fcb->gdal->band, GF_Write, 0, row, n, 1, work_buf,
-			    n, 1, datatype, 0, 0);
+    err = Rast_gdal_raster_IO(fcb->gdal->band, GF_Write, 0, row, n, 1,
+			      work_buf, n, 1, datatype, 0, 0);
 
 
     G__freea(work_buf);
     G__freea(work_buf);
 
 
-    return err == CE_None ? 1 : -1;
-#else
-    return -1;
+    if (err != CE_None)
+	G_fatal_error(_("Error writing data via GDAL for row %d of <%s>"),
+		      row, fcb->name);
 #endif
 #endif
 }
 }
 
 
-static int put_raster_data(int fd, char *null_buf, const void *rast,
-			   int row, int n,
-			   int zeros_r_nulls, RASTER_MAP_TYPE map_type)
+static void put_raster_data(int fd, char *null_buf, const void *rast,
+			    int row, int n,
+			    int zeros_r_nulls, RASTER_MAP_TYPE map_type)
 {
 {
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
 
 
     if (fcb->gdal)
     if (fcb->gdal)
-	return put_data_gdal(fd, rast, row, n, zeros_r_nulls, map_type);
-
-    return (map_type == CELL_TYPE)
-	? put_data(fd, null_buf, rast, row, n, zeros_r_nulls)
-	: put_fp_data(fd, null_buf, rast, row, n, map_type);
+	put_data_gdal(fd, rast, row, n, zeros_r_nulls, map_type);
+    else if (map_type == CELL_TYPE)
+	put_data(fd, null_buf, rast, row, n, zeros_r_nulls);
+    else
+	put_fp_data(fd, null_buf, rast, row, n, map_type);
 }
 }
 
 
-static int put_null_data(int fd, const char *flags, int row)
+static void put_null_data(int fd, const char *flags, int row)
 {
 {
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
 
 
     if (fcb->null_fd < 0)
     if (fcb->null_fd < 0)
-	return -1;
+	G_fatal_error(_("No null file for <%s>"), fcb->name);
 
 
     Rast__convert_01_flags(flags, fcb->null_bits,
     Rast__convert_01_flags(flags, fcb->null_bits,
 			   fcb->cellhd.cols);
 			   fcb->cellhd.cols);
 
 
-    if (Rast__write_null_bits(fcb->null_fd, fcb->null_bits, row,
-			      fcb->cellhd.cols, fd) < 0)
-	return -1;
+    Rast__write_null_bits(fcb->null_fd, fcb->null_bits, row,
+			  fcb->cellhd.cols, fd);
+}
 
 
-    return 1;
+static void put_null_value_row(int fd, const char *buf)
+{
+    struct fileinfo *fcb = &R__.fileinfo[fd];
+
+    if (fcb->gdal)
+	G_fatal_error(_("GDAL output doesn't support writing null rows separately"));
+
+    put_null_data(fd, buf, fcb->null_cur_row);
+
+    fcb->null_cur_row++;
 }
 }
 
 
 /*!
 /*!
@@ -622,22 +521,20 @@ static int put_null_data(int fd, const char *flags, int row)
    \param fd file descriptor of raster cell data file
    \param fd file descriptor of raster cell data file
 
 
    \return field descriptor of null data file
    \return field descriptor of null data file
-   \return -1 on failure
  */
  */
 int Rast__open_null_write(int fd)
 int Rast__open_null_write(int fd)
 {
 {
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
     int null_fd;
     int null_fd;
 
 
-    if (access(fcb->null_temp_name, 0) != 0) {
-	G_warning(_("Unable to find a temporary null file <%s>"),
-		  fcb->null_temp_name);
-	return -1;
-    }
+    if (access(fcb->null_temp_name, 0) != 0)
+	G_fatal_error(_("Unable to find a temporary null file <%s>"),
+		      fcb->null_temp_name);
 
 
     null_fd = open(fcb->null_temp_name, O_WRONLY);
     null_fd = open(fcb->null_temp_name, O_WRONLY);
     if (null_fd < 0)
     if (null_fd < 0)
-	return -1;
+	G_fatal_error(_("Unable to open null file <%s>"),
+		      fcb->null_temp_name);
 
 
     return null_fd;
     return null_fd;
 }
 }
@@ -651,11 +548,10 @@ int Rast__open_null_write(int fd)
    \param col col number
    \param col col number
    \param fd file descriptor of cell data file
    \param fd file descriptor of cell data file
 
 
-   \return 1 on success
-   \return -1 on failure
+   \return void
  */
  */
-int Rast__write_null_bits(int null_fd, const unsigned char *flags, int row,
-			  int cols, int fd)
+void Rast__write_null_bits(int null_fd, const unsigned char *flags, int row,
+			   int cols, int fd)
 {
 {
     off_t offset;
     off_t offset;
     size_t size;
     size_t size;
@@ -663,21 +559,16 @@ int Rast__write_null_bits(int null_fd, const unsigned char *flags, int row,
     size = Rast__null_bitstream_size(cols);
     size = Rast__null_bitstream_size(cols);
     offset = (off_t) size *row;
     offset = (off_t) size *row;
 
 
-    if (lseek(null_fd, offset, SEEK_SET) < 0) {
-	G_warning(_("Error writing null row %d"), row);
-	return -1;
-    }
+    if (lseek(null_fd, offset, SEEK_SET) < 0)
+	G_fatal_error(_("Error writing null row %d"), row);
 
 
-    if (write(null_fd, flags, size) != size) {
-	G_warning(_("Error writing null row %d"), row);
-	return -1;
-    }
-
-    return 1;
+    if (write(null_fd, flags, size) != size)
+	G_fatal_error(_("Error writing null row %d"), row);
 }
 }
 
 
-static int convert_and_write_if(int fd, const CELL * buf)
+static void convert_and_write_if(int fd, const void *vbuf)
 {
 {
+    const CELL *buf = vbuf;
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
     FCELL *p = (FCELL *) fcb->data;
     FCELL *p = (FCELL *) fcb->data;
     int i;
     int i;
@@ -688,11 +579,12 @@ static int convert_and_write_if(int fd, const CELL * buf)
 	else
 	else
 	    p[i] = (FCELL) buf[i];
 	    p[i] = (FCELL) buf[i];
 
 
-    return Rast_put_f_row(fd, p);
+    Rast_put_f_row(fd, p);
 }
 }
 
 
-static int convert_and_write_df(int fd, const DCELL * buf)
+static void convert_and_write_df(int fd, const void *vbuf)
 {
 {
+    const DCELL *buf = vbuf;
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
     FCELL *p = (FCELL *) fcb->data;
     FCELL *p = (FCELL *) fcb->data;
     int i;
     int i;
@@ -703,11 +595,12 @@ static int convert_and_write_df(int fd, const DCELL * buf)
 	else
 	else
 	    p[i] = (FCELL) buf[i];
 	    p[i] = (FCELL) buf[i];
 
 
-    return Rast_put_f_row(fd, p);
+    Rast_put_f_row(fd, p);
 }
 }
 
 
-static int convert_and_write_id(int fd, const CELL * buf)
+static void convert_and_write_id(int fd, const void *vbuf)
 {
 {
+    const CELL *buf = vbuf;
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
     DCELL *p = (DCELL *) fcb->data;
     DCELL *p = (DCELL *) fcb->data;
     int i;
     int i;
@@ -718,11 +611,12 @@ static int convert_and_write_id(int fd, const CELL * buf)
 	else
 	else
 	    p[i] = (DCELL) buf[i];
 	    p[i] = (DCELL) buf[i];
 
 
-    return Rast_put_d_row(fd, p);
+    Rast_put_d_row(fd, p);
 }
 }
 
 
-static int convert_and_write_fd(int fd, const FCELL * buf)
+static void convert_and_write_fd(int fd, const void *vbuf)
 {
 {
+    const FCELL *buf = vbuf;
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
     DCELL *p = (DCELL *) fcb->data;
     DCELL *p = (DCELL *) fcb->data;
     int i;
     int i;
@@ -733,11 +627,12 @@ static int convert_and_write_fd(int fd, const FCELL * buf)
 	else
 	else
 	    p[i] = (DCELL) buf[i];
 	    p[i] = (DCELL) buf[i];
 
 
-    return Rast_put_d_row(fd, p);
+    Rast_put_d_row(fd, p);
 }
 }
 
 
-static int convert_and_write_fi(int fd, const FCELL * buf)
+static void convert_and_write_fi(int fd, const void *vbuf)
 {
 {
+    const FCELL *buf = vbuf;
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
     CELL *p = (CELL *) fcb->data;
     CELL *p = (CELL *) fcb->data;
     int i;
     int i;
@@ -748,11 +643,12 @@ static int convert_and_write_fi(int fd, const FCELL * buf)
 	else
 	else
 	    p[i] = (CELL) buf[i];
 	    p[i] = (CELL) buf[i];
 
 
-    return Rast_put_c_row(fd, p);
+    Rast_put_c_row(fd, p);
 }
 }
 
 
-static int convert_and_write_di(int fd, const DCELL * buf)
+static void convert_and_write_di(int fd, const void *vbuf)
 {
 {
+    const DCELL *buf = vbuf;
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
     CELL *p = (CELL *) fcb->data;
     CELL *p = (CELL *) fcb->data;
     int i;
     int i;
@@ -763,7 +659,7 @@ static int convert_and_write_di(int fd, const DCELL * buf)
 	else
 	else
 	    p[i] = (CELL) buf[i];
 	    p[i] = (CELL) buf[i];
 
 
-    return Rast_put_c_row(fd, p);
+    Rast_put_c_row(fd, p);
 }
 }
 
 
 /*!
 /*!
@@ -777,41 +673,42 @@ static int convert_and_write_di(int fd, const DCELL * buf)
    \param fd file descriptor where data is to be written
    \param fd file descriptor where data is to be written
    \param buf buffer holding null data
    \param buf buffer holding null data
 
 
-   \return 0  if successful
-   \return -1  on fail
+   \return void
  */
  */
-static int put_raster_row(int fd, const void *buf, RASTER_MAP_TYPE data_type,
-			  int zeros_r_nulls)
+static void put_raster_row(int fd, const void *buf, RASTER_MAP_TYPE data_type,
+			   int zeros_r_nulls)
 {
 {
-    static int (*convert_and_write_FtypeOtype[3][3]) () = {
-	{
-	NULL, convert_and_write_if, convert_and_write_id}, {
-	convert_and_write_fi, NULL, convert_and_write_fd}, {
-	convert_and_write_di, convert_and_write_df, NULL}
+    static void (*convert_and_write_FtypeOtype[3][3])(int, const void *) = {
+	{NULL, convert_and_write_if, convert_and_write_id},
+	{convert_and_write_fi, NULL, convert_and_write_fd},
+	{convert_and_write_di, convert_and_write_df, NULL}
     };
     };
     struct fileinfo *fcb = &R__.fileinfo[fd];
     struct fileinfo *fcb = &R__.fileinfo[fd];
     char *null_buf;
     char *null_buf;
-    int stat;
 
 
-    if (!check_open("put_raster_row", fd))
-	return -1;
+    switch (fcb->open_mode) {
+    case OPEN_OLD:
+	G_fatal_error(_("put_raster_row: raster map <%s> not open for write - request ignored"),
+		      fcb->name);
+	break;
+    case OPEN_NEW_COMPRESSED:
+    case OPEN_NEW_UNCOMPRESSED:
+	break;
+    default:
+	G_fatal_error(_("put_raster_row: unopened file descriptor - request ignored"));
+	break;
+    }
 
 
-    if (fcb->map_type != data_type)
-	return convert_and_write_FtypeOtype[data_type][fcb->map_type] (fd,
-								       buf);
+    if (fcb->map_type != data_type) {
+	convert_and_write_FtypeOtype[data_type][fcb->map_type](fd, buf);
+	return;
+    }
 
 
     null_buf = G__alloca(fcb->cellhd.cols);
     null_buf = G__alloca(fcb->cellhd.cols);
     G_zero(null_buf, fcb->cellhd.cols);
     G_zero(null_buf, fcb->cellhd.cols);
 
 
-    switch (put_raster_data(fd, null_buf, buf, fcb->cur_row, fcb->cellhd.cols,
-			    zeros_r_nulls, data_type)) {
-    case -1:
-	G__freea(null_buf);
-	return -1;
-    case 0:
-	G__freea(null_buf);
-	return 1;
-    }
+    put_raster_data(fd, null_buf, buf, fcb->cur_row, fcb->cellhd.cols,
+		    zeros_r_nulls, data_type);
 
 
     /* only for integer maps */
     /* only for integer maps */
     if (data_type == CELL_TYPE) {
     if (data_type == CELL_TYPE) {
@@ -827,10 +724,8 @@ static int put_raster_row(int fd, const void *buf, RASTER_MAP_TYPE data_type,
     fcb->cur_row++;
     fcb->cur_row++;
 
 
     /* write the null row for the data row */
     /* write the null row for the data row */
-    if (fcb->gdal)
-	stat = 0;
-    else
-	stat = put_null_value_row(fd, null_buf);
+    if (!fcb->gdal)
+	put_null_value_row(fd, null_buf);
+
     G__freea(null_buf);
     G__freea(null_buf);
-    return stat;
 }
 }

+ 6 - 24
lib/rst/interp_float/resout2d.c

@@ -105,10 +105,7 @@ int IL_resample_output_2d(struct interp_params *params, double zmin, double zmax
 	    G_fseek(params->Tmp_fd_z, (off_t) (params->nsizr - 1 - i) *
 	    G_fseek(params->Tmp_fd_z, (off_t) (params->nsizr - 1 - i) *
 		    params->nsizc * sizeof(FCELL), 0);
 		    params->nsizc * sizeof(FCELL), 0);
 	    fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_z);
 	    fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_z);
-	    if (Rast_put_f_row(cf1, cell1) < 0) {
-		G_warning(_("Failed writing raster map"));
-		return -1;
-	    }
+	    Rast_put_f_row(cf1, cell1);
 	}
 	}
     }
     }
 
 
@@ -124,10 +121,7 @@ int IL_resample_output_2d(struct interp_params *params, double zmin, double zmax
 	     * fprintf(stderr,"%f ",cell1[ii]); }
 	     * fprintf(stderr,"%f ",cell1[ii]); }
 	     * fprintf(stderr,"params->nsizc=%d \n",params->nsizc);
 	     * fprintf(stderr,"params->nsizc=%d \n",params->nsizc);
 	     */
 	     */
-	    if (Rast_put_f_row(cf2, cell1) < 0) {
-		G_warning(_("Failed writing raster map"));
-		return -1;
-	    }
+	    Rast_put_f_row(cf2, cell1);
 	}
 	}
     }
     }
 
 
@@ -138,10 +132,7 @@ int IL_resample_output_2d(struct interp_params *params, double zmin, double zmax
 	    G_fseek(params->Tmp_fd_dy, (off_t) (params->nsizr - 1 - i) *
 	    G_fseek(params->Tmp_fd_dy, (off_t) (params->nsizr - 1 - i) *
 		    params->nsizc * sizeof(FCELL), 0);
 		    params->nsizc * sizeof(FCELL), 0);
 	    fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_dy);
 	    fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_dy);
-	    if (Rast_put_f_row(cf3, cell1) < 0) {
-		G_warning(_("Failed writing raster map"));
-		return -1;
-	    }
+	    Rast_put_f_row(cf3, cell1);
 	}
 	}
     }
     }
 
 
@@ -152,10 +143,7 @@ int IL_resample_output_2d(struct interp_params *params, double zmin, double zmax
 	    G_fseek(params->Tmp_fd_xx, (off_t) (params->nsizr - 1 - i) *
 	    G_fseek(params->Tmp_fd_xx, (off_t) (params->nsizr - 1 - i) *
 		    params->nsizc * sizeof(FCELL), 0);
 		    params->nsizc * sizeof(FCELL), 0);
 	    fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_xx);
 	    fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_xx);
-	    if (Rast_put_f_row(cf4, cell1) < 0) {
-		G_warning(_("Failed writing raster map"));
-		return -1;
-	    }
+	    Rast_put_f_row(cf4, cell1);
 	}
 	}
     }
     }
 
 
@@ -166,10 +154,7 @@ int IL_resample_output_2d(struct interp_params *params, double zmin, double zmax
 	    G_fseek(params->Tmp_fd_yy, (off_t) (params->nsizr - 1 - i) *
 	    G_fseek(params->Tmp_fd_yy, (off_t) (params->nsizr - 1 - i) *
 		    params->nsizc * sizeof(FCELL), 0);
 		    params->nsizc * sizeof(FCELL), 0);
 	    fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_yy);
 	    fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_yy);
-	    if (Rast_put_f_row(cf5, cell1) < 0) {
-		G_warning(_("Failed writing raster map"));
-		return -1;
-	    }
+	    Rast_put_f_row(cf5, cell1);
 	}
 	}
     }
     }
 
 
@@ -180,10 +165,7 @@ int IL_resample_output_2d(struct interp_params *params, double zmin, double zmax
 	    G_fseek(params->Tmp_fd_xy, (off_t) (params->nsizr - 1 - i) *
 	    G_fseek(params->Tmp_fd_xy, (off_t) (params->nsizr - 1 - i) *
 		    params->nsizc * sizeof(FCELL), 0);
 		    params->nsizc * sizeof(FCELL), 0);
 	    fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_xy);
 	    fread(cell1, sizeof(FCELL), params->nsizc, params->Tmp_fd_xy);
-	    if (Rast_put_f_row(cf6, cell1) < 0) {
-		G_warning(_("Failed writing raster map"));
-		return -1;
-	    }
+	    Rast_put_f_row(cf6, cell1);
 	}
 	}
     }
     }
 
 

+ 0 - 1
lib/rst/interp_float/ressegm2d.c

@@ -494,7 +494,6 @@ static int input_data(struct interp_params *params,
 {
 {
     double x, y, sm;		/* input data and smoothing */
     double x, y, sm;		/* input data and smoothing */
     int m1, m2;			/* loop counters */
     int m1, m2;			/* loop counters */
-    int ret_val, ret_val1;	/* return values of Rast_get_c_row */
     static FCELL *cellinp = NULL;	/* cell buffer for input data */
     static FCELL *cellinp = NULL;	/* cell buffer for input data */
     static FCELL *cellsmooth = NULL;	/* cell buffer for smoothing */
     static FCELL *cellsmooth = NULL;	/* cell buffer for smoothing */
 
 

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

@@ -134,8 +134,7 @@ int main(int argc, char *argv[])
 
 
 	}
 	}
 
 
-	if (Rast_put_row(outfd, outrast, data_type) < 0)
-	    G_fatal_error(_("Unable to write to <%s>"), result);
+	Rast_put_row(outfd, outrast, data_type);
     }
     }
 
 
     G_free(inrast);
     G_free(inrast);

+ 1 - 3
raster/r.buffer/write_map.c

@@ -69,9 +69,7 @@ int write_output_map(char *output, int offset)
 	    if (cell[k] == 0)
 	    if (cell[k] == 0)
 		Rast_set_null_value(&cell[k], 1, CELL_TYPE);
 		Rast_set_null_value(&cell[k], 1, CELL_TYPE);
 
 
-	if (Rast_put_row(fd_out, cell, CELL_TYPE) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s> row %d"), output,
-			  row);
+	Rast_put_row(fd_out, cell, CELL_TYPE);
     }
     }
 
 
     G_percent(row, window.rows, 2);
     G_percent(row, window.rows, 2);

+ 2 - 5
raster/r.clump/clump.c

@@ -219,8 +219,7 @@ CELL clump(int in_fd, int out_fd)
 		   for (col = 1; col <= ncols; col++)
 		   for (col = 1; col <= ncols; col++)
 		   out_cell[col] = index[cur_clump[col]];
 		   out_cell[col] = index[cur_clump[col]];
 
 
-		   if (Rast_put_row (out_fd, out_cell+1, CELL_TYPE) < 0)
-		   G_fatal_error (_("Unable to properly write output raster map"));
+		   Rast_put_row (out_fd, out_cell+1, CELL_TYPE);
 		 */
 		 */
 		col = ncols;
 		col = ncols;
 		temp_clump = cur_clump + 1;	/* skip left edge */
 		temp_clump = cur_clump + 1;	/* skip left edge */
@@ -233,9 +232,7 @@ CELL clump(int in_fd, int out_fd)
 		    if (out_cell[column] == 0)
 		    if (out_cell[column] == 0)
 			Rast_set_null_value(&out_cell[column], 1, CELL_TYPE);
 			Rast_set_null_value(&out_cell[column], 1, CELL_TYPE);
 		}
 		}
-		if (Rast_put_row(out_fd, out_cell, CELL_TYPE) < 0)
-		    G_fatal_error(_("Failed writing raster map row %d"),
-				  row);
+		Rast_put_row(out_fd, out_cell, CELL_TYPE);
 	    }
 	    }
 
 
 	    /* switch the buffers so that the current buffer becomes the previous */
 	    /* switch the buffers so that the current buffer becomes the previous */

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

@@ -243,8 +243,7 @@ int main(int argc, char **argv)
 		(val[2] * B[1].levels + val[1]) * B[0].levels + val[0];
 		(val[2] * B[1].levels + val[1]) * B[0].levels + val[0];
 	}
 	}
 
 
-	if (Rast_put_row(out_file, out_array, CELL_TYPE) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s>"), out_name);
+	Rast_put_row(out_file, out_array, CELL_TYPE);
     }
     }
     G_percent(window.rows, window.rows, 1);
     G_percent(window.rows, window.rows, 1);
 
 

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

@@ -211,8 +211,7 @@ static int doit(char *name, int uncompress, RASTER_MAP_TYPE map_type)
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 2);
 	G_percent(row, nrows, 2);
 	Rast_get_row_nomask(old, rast, row, map_type);
 	Rast_get_row_nomask(old, rast, row, map_type);
-	if (Rast_put_row(new, rast, map_type) < 0)
-	    break;
+	Rast_put_row(new, rast, map_type);
     }
     }
     G_free(rast);
     G_free(rast);
     Rast_close(old);
     Rast_close(old);

+ 1 - 2
raster/r.cross/renumber.c

@@ -39,8 +39,7 @@ int renumber(int in, int out)
 	    *c = table[*c];
 	    *c = table[*c];
 	    c++;
 	    c++;
 	}
 	}
-	if (Rast_put_row(out, cell, CELL_TYPE) < 0)
-	    exit(1);
+	Rast_put_row(out, cell, CELL_TYPE);
     }
     }
     G_percent(row, nrows, 10);
     G_percent(row, nrows, 10);
     G_free(cell);
     G_free(cell);

+ 3 - 6
raster/r.his/main.c

@@ -239,16 +239,13 @@ int main(int argc, char **argv)
 	}
 	}
 
 
 	if (r_used)
 	if (r_used)
-	    if (Rast_put_row(r_file, r_array, CELL_TYPE) < 0)
-		r_used = 0;
+	    Rast_put_row(r_file, r_array, CELL_TYPE);
 
 
 	if (g_used)
 	if (g_used)
-	    if (Rast_put_row(g_file, g_array, CELL_TYPE) < 0)
-		g_used = 0;
+	    Rast_put_row(g_file, g_array, CELL_TYPE);
 
 
 	if (b_used)
 	if (b_used)
-	    if (Rast_put_row(b_file, b_array, CELL_TYPE) < 0)
-		b_used = 0;
+	    Rast_put_row(b_file, b_array, CELL_TYPE);
     }
     }
     G_percent(window.rows, window.rows, 5);
     G_percent(window.rows, window.rows, 5);
 
 

+ 1 - 4
raster/r.in.mat/main.c

@@ -468,10 +468,7 @@ int main(int argc, char *argv[])
 	fprintf(stderr, "]\n");
 	fprintf(stderr, "]\n");
 #endif
 #endif
 
 
-	if (1 != Rast_put_row(cf, raster, map_type)) {
-	    Rast_close(cf);
-	    G_fatal_error(_("Writing raster map, row %d"), row);
-	}
+	Rast_put_row(cf, raster, map_type);
 
 
 	G_percent(row, mrows, 5);
 	G_percent(row, mrows, 5);
     }
     }

+ 1 - 2
raster/r.in.poly/raster.c

@@ -186,8 +186,7 @@ int output_raster(int fd)
 	}
 	}
 
 
 	G_percent(i, page.rows, 2);
 	G_percent(i, page.rows, 2);
-	if (Rast_put_row(fd, cell, CELL_TYPE) < 0)
-	    return ERROR;
+	Rast_put_row(fd, cell, CELL_TYPE);
     }
     }
     G_percent(i, page.rows, 2);
     G_percent(i, page.rows, 2);
     return configure_plot();
     return configure_plot();

+ 1 - 5
raster/r.in.xyz/main.c

@@ -1012,11 +1012,7 @@ int main(int argc, char *argv[])
 	    }
 	    }
 
 
 	    /* write out line of raster data */
 	    /* write out line of raster data */
-	    if (1 != Rast_put_row(out_fd, raster_row, rtype)) {
-		Rast_close(out_fd);
-		G_fatal_error(_("Writing map, row %d"),
-			      ((pass - 1) * rows) + row);
-	    }
+	    Rast_put_row(out_fd, raster_row, rtype);
 	}
 	}
 
 
 	/* free memory */
 	/* free memory */

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

@@ -76,8 +76,7 @@ void save_map(FCELL ** out, int out_fd, int rows, int cols, int flag,
 	    if (out[row][col] < *min_depth)
 	    if (out[row][col] < *min_depth)
 		*min_depth = out[row][col];
 		*min_depth = out[row][col];
 	}
 	}
-	if (Rast_put_f_row(out_fd, out[row]) == -1)
-	    G_fatal_error(_("Failed writing output raster map row %d"), row);
+	Rast_put_f_row(out_fd, out[row]);
 	G_percent(row + 1, rows, 5);
 	G_percent(row + 1, rows, 5);
     }
     }
 }
 }

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

@@ -371,9 +371,7 @@ int main(int argc, char *argv[])
 	    /* set to NULL if beyond max_dist (0) or blocked view (1) */
 	    /* set to NULL if beyond max_dist (0) or blocked view (1) */
 	    if (fcell[col] == 0 || fcell[col] == 1)
 	    if (fcell[col] == 0 || fcell[col] == 1)
 		Rast_set_null_value(&fcell[col], 1, FCELL_TYPE);
 		Rast_set_null_value(&fcell[col], 1, FCELL_TYPE);
-	if (Rast_put_row(new, fcell, FCELL_TYPE) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s> row %d"),
-			  out_layer, row);
+	Rast_put_row(new, fcell, FCELL_TYPE);
     }
     }
 
 
     segment_release(&seg_in);	/* release memory       */
     segment_release(&seg_in);	/* release memory       */

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

@@ -655,8 +655,7 @@ int open_output_map(const char *name, int res_type)
 
 
 void put_map_row(int fd, void *buf, int res_type)
 void put_map_row(int fd, void *buf, int res_type)
 {
 {
-    if (Rast_put_row(fd, buf, res_type) < 0)
-	G_fatal_error(_("Failed writing raster map row"));
+    Rast_put_row(fd, buf, res_type);
 }
 }
 
 
 void close_output_map(int fd)
 void close_output_map(int fd)

+ 2 - 8
raster/r.null/main.c

@@ -171,9 +171,7 @@ int main(int argc, char *argv[])
 
 
 	for (row = 0; row < cellhd.rows; row++) {
 	for (row = 0; row < cellhd.rows; row++) {
 	    G_percent(row, cellhd.rows, 1);
 	    G_percent(row, cellhd.rows, 1);
-	    if (Rast__write_null_bits(null_fd, null_bits, row, cellhd.cols, 0) <
-		0)
-		G_fatal_error(_("Error writing null row %d"), row);
+	    Rast__write_null_bits(null_fd, null_bits, row, cellhd.cols, 0);
 	}
 	}
 	G_percent(row, cellhd.rows, 1);
 	G_percent(row, cellhd.rows, 1);
 	close(null_fd);
 	close(null_fd);
@@ -328,11 +326,7 @@ int doit(const char *name, const char *mapset, int change_null, RASTER_MAP_TYPE
 
 
 	mask_raster_array(rast, cellhd.cols, change_null, map_type);
 	mask_raster_array(rast, cellhd.cols, change_null, map_type);
 
 
-	if (Rast_put_row(new, rast, map_type) < 0) {
-	    G_warning(_("Failed writing raster map <%s> row %d"),
-		      name, row);
-	    break;
-	}
+	Rast_put_row(new, rast, map_type);
     }
     }
     G_percent(row, cellhd.rows, 1);
     G_percent(row, cellhd.rows, 1);
     G_free(rast);
     G_free(rast);

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

@@ -438,9 +438,7 @@ int main(int argc, char **argv)
 	    ycoord1 = ycoord2;
 	    ycoord1 = ycoord2;
 	}
 	}
 
 
-	if (Rast_put_row(fdo, obuffer, cell_type) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s> row %d"), mapname,
-			  row);
+	Rast_put_row(fdo, obuffer, cell_type);
 
 
 	xcoord1 = xcoord2 = outcellhd.west + (outcellhd.ew_res / 2);
 	xcoord1 = xcoord2 = outcellhd.west + (outcellhd.ew_res / 2);
 	ycoord2 -= outcellhd.ns_res;
 	ycoord2 -= outcellhd.ns_res;

+ 1 - 1
raster/r.resamp.rst/main.c

@@ -124,7 +124,7 @@ static void clean(void);
 
 
 int main(int argc, char *argv[])
 int main(int argc, char *argv[])
 {
 {
-    int m1, ret_val;
+    int m1;
     struct FPRange range;
     struct FPRange range;
     DCELL cellmin, cellmax;
     DCELL cellmin, cellmax;
     FCELL *cellrow, fcellmin;
     FCELL *cellrow, fcellmin;

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

@@ -113,8 +113,7 @@ int main(int argc, char *argv[])
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 2);
 	G_percent(row, nrows, 2);
 	Rast_get_row(infd, rast, row, data_type);
 	Rast_get_row(infd, rast, row, data_type);
-	if (Rast_put_row(outfd, rast, out_type) < 0)
-	    G_fatal_error(_("Error writing row %d"), row);
+	Rast_put_row(outfd, rast, out_type);
 	Rast_mark_cats(rast, ncols, &cats, data_type);
 	Rast_mark_cats(rast, ncols, &cats, data_type);
     }
     }
 
 

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

@@ -321,8 +321,7 @@ int main(int argc, char **argv)
     path_fd = Rast_open_c_new(path_layer);
     path_fd = Rast_open_c_new(path_layer);
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
 	segment_get_row(&out_seg, cell, row);
 	segment_get_row(&out_seg, cell, row);
-	if (Rast_put_row(path_fd, cell, CELL_TYPE) < 0)
-	    G_fatal_error("unable to write map row %d", row);
+	Rast_put_row(path_fd, cell, CELL_TYPE);
     }
     }
 
 
     if (verbose)
     if (verbose)

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

@@ -326,9 +326,7 @@ int main(int argc, char *argv[])
 	G_message(_("Writing new null file for [%s]... "), raster->answer);
 	G_message(_("Writing new null file for [%s]... "), raster->answer);
 	for (row = 0; row < cellhd.rows; row++) {
 	for (row = 0; row < cellhd.rows; row++) {
 	    G_percent(row, cellhd.rows, 1);
 	    G_percent(row, cellhd.rows, 1);
-	    if (Rast__write_null_bits(null_fd, null_bits, row, cellhd.cols, 0) <
-		0)
-		G_fatal_error(_("Error writing null row [%d]."), row);
+	    Rast__write_null_bits(null_fd, null_bits, row, cellhd.cols, 0);
 	}
 	}
 	G_percent(row, cellhd.rows, 1);
 	G_percent(row, cellhd.rows, 1);
 
 

+ 5 - 10
raster/r.terraflow/grass2str.h

@@ -210,8 +210,7 @@ stream2_CELL(AMI_STREAM<T>* str, dimension_type nrows, dimension_type ncols,
     }
     }
 
 
   } /* for j*/
   } /* for j*/
-  if (Rast_put_row (outfd, outrast, mtype) < 0)
-    G_fatal_error ("Cannot write to <%s>",cellname);
+  Rast_put_row (outfd, outrast, mtype);
 
 
   G_percent(i, nrows, 2);
   G_percent(i, nrows, 2);
   }/* for i */
   }/* for i */
@@ -289,8 +288,7 @@ stream2_CELL(AMI_STREAM<T> *str, dimension_type nrows, dimension_type ncols,
       }
       }
       
       
     } /* for j*/
     } /* for j*/
-    if (Rast_put_row (outfd, outrast, CELL_TYPE) < 0)
-      G_fatal_error ("Cannot write to <%s>",cellname);
+    Rast_put_row (outfd, outrast, CELL_TYPE);
 
 
     G_percent(i, nrows, 2);
     G_percent(i, nrows, 2);
   }/* for i */
   }/* for i */
@@ -363,8 +361,7 @@ stream2_FCELL(AMI_STREAM<T> *str, dimension_type nrows, dimension_type ncols,
       }
       }
       
       
     } /* for j*/
     } /* for j*/
-    if (Rast_put_row (outfd, outrast, FCELL_TYPE) < 0)
-      G_fatal_error ("Cannot write to <%s>",cellname);
+    Rast_put_row (outfd, outrast, FCELL_TYPE);
 
 
     G_percent(i, nrows, 2);
     G_percent(i, nrows, 2);
   }/* for i */
   }/* for i */
@@ -472,10 +469,8 @@ stream2_FCELL(AMI_STREAM<T>* str,  dimension_type nrows, dimension_type ncols,
 
 
     } /* for j*/
     } /* for j*/
 
 
-    if (Rast_put_row (fd1, rast1, FCELL_TYPE) < 0)
-      G_fatal_error ("Cannot write to <%s>", cellname1);
-    if (Rast_put_row (fd2, rast2, FCELL_TYPE) < 0)
-      G_fatal_error ("Cannot write to <%s>", cellname2);
+    Rast_put_row (fd1, rast1, FCELL_TYPE);
+    Rast_put_row (fd2, rast2, FCELL_TYPE);
     
     
     G_percent(i, nrows, 2);
     G_percent(i, nrows, 2);
 
 

+ 4 - 11
raster/r.texture/main.c

@@ -328,21 +328,14 @@ int main(int argc, char *argv[])
 		/* The early (size/2) samples take value from (size/2+1)'th sample */
 		/* The early (size/2) samples take value from (size/2+1)'th sample */
 		if (row == 0)
 		if (row == 0)
 		    for (j = 0; j < (size / 2); j++)
 		    for (j = 0; j < (size / 2); j++)
-			if (Rast_put_row(outfd, outrast, out_data_type) <
-			    0)
-			    G_fatal_error(_("Failed writing raster map <%s> row %d"),
-					  result, row);
-
-		if (Rast_put_row(outfd, outrast, out_data_type) < 0)
-		    G_fatal_error(_("Failed writing raster map <%s> row %d"),
-				  result, row);
+			Rast_put_row(outfd, outrast, out_data_type);
+
+		Rast_put_row(outfd, outrast, out_data_type);
 	    }
 	    }
 	    /* The last few (size/2) samples take value from nrows-(size/2+1)'th sample */
 	    /* The last few (size/2) samples take value from nrows-(size/2+1)'th sample */
 	    if ((row >= nrows - (size - 1)) && (row < nrows))
 	    if ((row >= nrows - (size - 1)) && (row < nrows))
 		for (j = 0; j < (size / 2); j++)
 		for (j = 0; j < (size / 2); j++)
-		    if (Rast_put_row(outfd, outrast, out_data_type) < 0)
-			G_fatal_error(_("Failed writing raster map <%s> row %d"),
-				      result, row);
+		    Rast_put_row(outfd, outrast, out_data_type);
 
 
 	    Rast_close(outfd);
 	    Rast_close(outfd);
 	    strcpy(mapname, filename);
 	    strcpy(mapname, filename);

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

@@ -151,9 +151,7 @@ int main(int argc, char *argv[])
                 }
                 }
 	    }
 	    }
 	}
 	}
-	if (Rast_put_d_row(outfd, outrast) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s> row %d"),
-			  result, row);
+	Rast_put_d_row(outfd, outrast);
     }
     }
     G_free(inrast_psand);
     G_free(inrast_psand);
     G_free(inrast_psilt);
     G_free(inrast_psilt);

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

@@ -126,9 +126,7 @@ int main(int argc, char *argv[])
 		outrast[col] = d ;
 		outrast[col] = d ;
 	    }
 	    }
 	}
 	}
-	if (Rast_put_d_row(outfd, outrast) < 0)
-	    G_fatal_error(_("Failed writing raster map <%s> row %d"),
-			  result, row);
+	Rast_put_d_row(outfd, outrast);
     }
     }
     G_free(inrast_annual_pmm);
     G_free(inrast_annual_pmm);
     Rast_close(infd_annual_pmm);
     Rast_close(infd_annual_pmm);

+ 0 - 2
raster/r.watershed/seg/bseg_read.c

@@ -3,8 +3,6 @@
 #include <unistd.h>
 #include <unistd.h>
 #include "cseg.h"
 #include "cseg.h"
 
 
-static char *me = "bseg_read_cell";
-
 int bseg_read_cell(BSEG * bseg, char *map_name, char *mapset)
 int bseg_read_cell(BSEG * bseg, char *map_name, char *mapset)
 {
 {
     int row, nrows;
     int row, nrows;

+ 1 - 9
raster/r.watershed/seg/bseg_write.c

@@ -2,8 +2,6 @@
 #include <grass/raster.h>
 #include <grass/raster.h>
 #include "cseg.h"
 #include "cseg.h"
 
 
-static char *me = "bseg_write_cell";
-
 int bseg_write_cellfile(BSEG * bseg, char *map_name)
 int bseg_write_cellfile(BSEG * bseg, char *map_name)
 {
 {
     int map_fd;
     int map_fd;
@@ -22,13 +20,7 @@ int bseg_write_cellfile(BSEG * bseg, char *map_name)
 	    bseg_get(bseg, &value, row, col);
 	    bseg_get(bseg, &value, row, col);
 	    buffer[col] = value;
 	    buffer[col] = value;
 	}
 	}
-	if (Rast_put_row(map_fd, buffer, CELL_TYPE) < 0) {
-	    G_free(buffer);
-	    Rast_unopen(map_fd);
-	    G_warning("%s(): unable to write new map layer [%s], row %d",
-		      me, map_name, row);
-	    return -2;
-	}
+	Rast_put_row(map_fd, buffer, CELL_TYPE);
     }
     }
     G_percent(row, nrows, 1);    /* finish it */
     G_percent(row, nrows, 1);    /* finish it */
     G_free(buffer);
     G_free(buffer);

+ 1 - 9
raster/r.watershed/seg/cseg_write.c

@@ -3,8 +3,6 @@
 #include <grass/segment.h>
 #include <grass/segment.h>
 #include "cseg.h"
 #include "cseg.h"
 
 
-static char *me = "cseg_write_cell";
-
 int cseg_write_cellfile(CSEG * cseg, char *map_name)
 int cseg_write_cellfile(CSEG * cseg, char *map_name)
 {
 {
     int map_fd;
     int map_fd;
@@ -18,13 +16,7 @@ int cseg_write_cellfile(CSEG * cseg, char *map_name)
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 1);
 	G_percent(row, nrows, 1);
 	segment_get_row(&(cseg->seg), buffer, row);
 	segment_get_row(&(cseg->seg), buffer, row);
-	if (Rast_put_row(map_fd, buffer, CELL_TYPE) < 0) {
-	    G_free(buffer);
-	    Rast_unopen(map_fd);
-	    G_warning("%s(): unable to write new map layer [%s], row %d",
-		      me, map_name, row);
-	    return -2;
-	}
+	Rast_put_row(map_fd, buffer, CELL_TYPE);
     }
     }
     G_percent(row, nrows, 1);    /* finish it */
     G_percent(row, nrows, 1);    /* finish it */
     G_free(buffer);
     G_free(buffer);

+ 1 - 9
raster/r.watershed/seg/dseg_write.c

@@ -3,8 +3,6 @@
 #include <grass/segment.h>
 #include <grass/segment.h>
 #include "cseg.h"
 #include "cseg.h"
 
 
-static char *me = "dseg_write_cell";
-
 int dseg_write_cellfile(DSEG * dseg, char *map_name)
 int dseg_write_cellfile(DSEG * dseg, char *map_name)
 {
 {
     int map_fd;
     int map_fd;
@@ -19,13 +17,7 @@ int dseg_write_cellfile(DSEG * dseg, char *map_name)
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 1);
 	G_percent(row, nrows, 1);
 	segment_get_row(&(dseg->seg), (DCELL *) dbuffer, row);
 	segment_get_row(&(dseg->seg), (DCELL *) dbuffer, row);
-	if (Rast_put_row(map_fd, dbuffer, DCELL_TYPE) < 0) {
-	    G_free(dbuffer);
-	    Rast_unopen(map_fd);
-	    G_warning("%s(): unable to write new map layer [%s], row %d",
-		      me, map_name, row);
-	    return -2;
-	}
+	Rast_put_row(map_fd, dbuffer, DCELL_TYPE);
     }
     }
     G_percent(row, nrows, 1);    /* finish it */
     G_percent(row, nrows, 1);    /* finish it */
     G_free(dbuffer);
     G_free(dbuffer);

+ 5 - 13
raster3d/r3.cross.rast/main.c

@@ -118,7 +118,7 @@ void set_params()
 void rast3d_cross_section(void *map, G3D_Region region, int elevfd, int outfd)
 void rast3d_cross_section(void *map, G3D_Region region, int elevfd, int outfd)
 {
 {
     double d1 = 0, f1 = 0;
     double d1 = 0, f1 = 0;
-    int x, y, z, check = 0;
+    int x, y, z;
     int rows, cols, depths, typeIntern;
     int rows, cols, depths, typeIntern;
     FCELL *fcell = NULL;
     FCELL *fcell = NULL;
     DCELL *dcell = NULL;
     DCELL *dcell = NULL;
@@ -221,19 +221,11 @@ void rast3d_cross_section(void *map, G3D_Region region, int elevfd, int outfd)
 	}
 	}
 
 
 	/*Write the data to the output map */
 	/*Write the data to the output map */
-	if (typeIntern == FCELL_TYPE) {
-	    check = Rast_put_f_row(outfd, fcell);
-	    if (check != 1)
-		fatal_error(map, elevfd, outfd,
-			    _("Could not write raster row"));
-	}
+	if (typeIntern == FCELL_TYPE)
+	    Rast_put_f_row(outfd, fcell);
 
 
-	if (typeIntern == DCELL_TYPE) {
-	    check = Rast_put_d_row(outfd, dcell);
-	    if (check != 1)
-		fatal_error(map, elevfd, outfd,
-			    _("Could not write raster row"));
-	}
+	if (typeIntern == DCELL_TYPE)
+	    Rast_put_d_row(outfd, dcell);
     }
     }
     G_debug(3, "\nDone\n");
     G_debug(3, "\nDone\n");
 
 

+ 5 - 13
raster3d/r3.to.rast/main.c

@@ -103,7 +103,7 @@ void set_params()
 void g3d_to_raster(void *map, G3D_Region region, int *fd)
 void g3d_to_raster(void *map, G3D_Region region, int *fd)
 {
 {
     double d1 = 0, f1 = 0;
     double d1 = 0, f1 = 0;
-    int x, y, z, check = 0;
+    int x, y, z;
     int rows, cols, depths, typeIntern, pos = 0;
     int rows, cols, depths, typeIntern, pos = 0;
     FCELL *fcell = NULL;
     FCELL *fcell = NULL;
     DCELL *dcell = NULL;
     DCELL *dcell = NULL;
@@ -146,19 +146,11 @@ void g3d_to_raster(void *map, G3D_Region region, int *fd)
 			dcell[x] = (DCELL) d1;
 			dcell[x] = (DCELL) d1;
 		}
 		}
 	    }
 	    }
-	    if (typeIntern == FCELL_TYPE) {
-		check = Rast_put_f_row(fd[pos], fcell);
-		if (check != 1)
-		    fatal_error(map, fd, depths,
-				_("Unable to write raster row"));
-	    }
+	    if (typeIntern == FCELL_TYPE)
+		Rast_put_f_row(fd[pos], fcell);
 
 
-	    if (typeIntern == DCELL_TYPE) {
-		check = Rast_put_d_row(fd[pos], dcell);
-		if (check != 1)
-		    fatal_error(map, fd, depths,
-				_("Unable to write raster row"));
-	    }
+	    if (typeIntern == DCELL_TYPE)
+		Rast_put_d_row(fd[pos], dcell);
 	}
 	}
 	G_debug(2, "Finished writing map %d.", z + 1);
 	G_debug(2, "Finished writing map %d.", z + 1);
 	pos++;
 	pos++;

+ 2 - 4
vector/v.to.rast/raster.c

@@ -145,16 +145,14 @@ int output_raster(int fd)
 
 
 	    /* insert the NULL values */
 	    /* insert the NULL values */
 	    Rast_insert_c_null_values(cell, null_flags[i], page.cols);
 	    Rast_insert_c_null_values(cell, null_flags[i], page.cols);
-	    if (Rast_put_c_row(fd, cell) < 0)
-		return -1;
+	    Rast_put_c_row(fd, cell);
 	    break;
 	    break;
 	case USE_DCELL:
 	case USE_DCELL:
 	    dcell = raster.dcell[i];
 	    dcell = raster.dcell[i];
 
 
 	    /* insert the NULL values */
 	    /* insert the NULL values */
 	    Rast_insert_d_null_values(dcell, null_flags[i], page.cols);
 	    Rast_insert_d_null_values(dcell, null_flags[i], page.cols);
-	    if (Rast_put_d_row(fd, dcell) < 0)
-		return -1;
+	    Rast_put_d_row(fd, dcell);
 	    break;
 	    break;
 	}
 	}
     }
     }