[GRASS-SVN] r61535 - in grass/branches/releasebranch_7_0: . lib/raster

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 5 13:29:14 PDT 2014


Author: neteler
Date: 2014-08-05 13:29:14 -0700 (Tue, 05 Aug 2014)
New Revision: 61535

Modified:
   grass/branches/releasebranch_7_0/
   grass/branches/releasebranch_7_0/lib/raster/get_row.c
   grass/branches/releasebranch_7_0/lib/raster/put_row.c
Log:
libraster: Added raster name and row info to get/put_row error messages (trunk, r60908)


Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
   - /grass/trunk:60986
   + /grass/trunk:60908,60986

Modified: grass/branches/releasebranch_7_0/lib/raster/get_row.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/raster/get_row.c	2014-08-05 19:45:28 UTC (rev 61534)
+++ grass/branches/releasebranch_7_0/lib/raster/get_row.c	2014-08-05 20:29:14 UTC (rev 61535)
@@ -92,12 +92,14 @@
     size_t bufsize = fcb->cellhd.cols * fcb->nbytes;
 
     if (lseek(fcb->data_fd, t1, SEEK_SET) < 0)
-	G_fatal_error(_("Error reading raster data"));
+	G_fatal_error(_("Error reading raster data for row %d of <%s>"),
+		      row, fcb->name);
 
     *nbytes = fcb->nbytes;
 
     if ((size_t) G_zlib_read(fcb->data_fd, readamount, data_buf, bufsize) != bufsize)
-	G_fatal_error(_("Error reading raster data"));
+	G_fatal_error(_("Error reading raster data for row %d of <%s>"),
+		      row, fcb->name);
 }
 
 static void rle_decompress(unsigned char *dst, const unsigned char *src,
@@ -130,13 +132,15 @@
     int n;
 
     if (lseek(fcb->data_fd, t1, SEEK_SET) < 0)
-	G_fatal_error(_("Error reading raster data"));
+	G_fatal_error(_("Error reading raster data for row %d of <%s>"),
+		      row, fcb->name);
 
     cmp = G__alloca(readamount);
 
     if (read(fcb->data_fd, cmp, readamount) != readamount) {
 	G__freea(cmp);
-	G_fatal_error(_("Error reading raster data"));
+	G_fatal_error(_("Error reading raster data for row %d of <%s>"),
+		      row, fcb->name);
     }
 
     /* Now decompress the row */
@@ -170,10 +174,12 @@
     *nbytes = fcb->nbytes;
 
     if (lseek(fcb->data_fd, (off_t) row * bufsize, SEEK_SET) == -1)
-	G_fatal_error(_("Error reading raster data"));
+	G_fatal_error(_("Error reading raster data for row %d of <%s>"),
+		      row, fcb->name);
 
     if (read(fcb->data_fd, data_buf, bufsize) != bufsize)
-	G_fatal_error(_("Error reading raster data"));
+	G_fatal_error(_("Error reading raster data for row %d of <%s>"),
+		      row, fcb->name);
 }
 
 #ifdef HAVE_GDAL
@@ -208,7 +214,8 @@
     }
 
     if (err != CE_None)
-	G_fatal_error(_("Error reading raster data via GDAL"));
+	G_fatal_error(_("Error reading raster data via GDAL for row %d of <%s>"),
+		      row, fcb->name);
 }
 #endif
 
@@ -819,10 +826,10 @@
     offset = (off_t) size * R;
 
     if (lseek(null_fd, offset, SEEK_SET) < 0)
-	G_fatal_error(_("Error reading null row %d"), R);
+	G_fatal_error(_("Error reading null row %d for <%s>"), R, fcb->name);
 
     if (read(null_fd, flags, size) != size)
-	G_fatal_error(_("Error reading null row %d"), R);
+	G_fatal_error(_("Error reading null row %d for <%s>"), R, fcb->name);
 
     return 1;
 }

Modified: grass/branches/releasebranch_7_0/lib/raster/put_row.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/raster/put_row.c	2014-08-05 19:45:28 UTC (rev 61534)
+++ grass/branches/releasebranch_7_0/lib/raster/put_row.c	2014-08-05 20:29:14 UTC (rev 61535)
@@ -544,6 +544,7 @@
 void Rast__write_null_bits(int null_fd, const unsigned char *flags, int row,
 			   int cols, int fd)
 {
+    struct fileinfo *fcb = &R__.fileinfo[fd];
     off_t offset;
     size_t size;
 
@@ -551,10 +552,10 @@
     offset = (off_t) size *row;
 
     if (lseek(null_fd, offset, SEEK_SET) < 0)
-	G_fatal_error(_("Error writing null row %d"), row);
+	G_fatal_error(_("Error writing null row %d of <%s>"), row, fcb->name);
 
     if (write(null_fd, flags, size) != size)
-	G_fatal_error(_("Error writing null row %d"), row);
+	G_fatal_error(_("Error writing null row %d of <%s>"), row, fcb->name);
 }
 
 static void convert_and_write_if(int fd, const void *vbuf)



More information about the grass-commit mailing list