[GRASS-SVN] r62901 - grass-addons/grass7/raster/r.hydrodem

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 24 15:34:57 PST 2014


Author: neteler
Date: 2014-11-24 15:34:56 -0800 (Mon, 24 Nov 2014)
New Revision: 62901

Modified:
   grass-addons/grass7/raster/r.hydrodem/bseg.c
   grass-addons/grass7/raster/r.hydrodem/cseg.c
   grass-addons/grass7/raster/r.hydrodem/dseg.c
   grass-addons/grass7/raster/r.hydrodem/seg.c
Log:
r.hydrodem: sync msg to trunk; fix compilation error

Modified: grass-addons/grass7/raster/r.hydrodem/bseg.c
===================================================================
--- grass-addons/grass7/raster/r.hydrodem/bseg.c	2014-11-24 23:34:23 UTC (rev 62900)
+++ grass-addons/grass7/raster/r.hydrodem/bseg.c	2014-11-24 23:34:56 UTC (rev 62901)
@@ -1,5 +1,6 @@
 #include <unistd.h>
 #include <fcntl.h>
+#include <grass/segment.h>
 #include <grass/glocale.h>
 #include "seg.h"
 
@@ -16,7 +17,7 @@
 
     filename = G_tempfile();
     if (-1 == (fd = creat(filename, 0666))) {
-	G_warning(_("bseg_open(): unable to create segment file"));
+	G_warning(_("Unable to create segment file"));
 	return -2;
     }
     if (0 > (errflag = Segment_format(fd, Rast_window_rows(),
@@ -25,29 +26,29 @@
 	close(fd);
 	unlink(filename);
 	if (errflag == -1) {
-	    G_warning(_("bseg_open(): could not write segment file"));
+	    G_warning(_("Unable to write segment file"));
 	    return -1;
 	}
 	else {
-	    G_warning(_("bseg_open(): illegal configuration parameter(s)"));
+	    G_warning(_("Illegal configuration parameter(s)"));
 	    return -3;
 	}
     }
     close(fd);
     if (-1 == (fd = open(filename, 2))) {
 	unlink(filename);
-	G_warning(_("bseg_open(): unable to re-open segment file"));
+	G_warning(_("Unable to re-open segment file"));
 	return -4;
     }
     if (0 > (errflag = Segment_init(&(bseg->seg), fd, nsegs_in_memory))) {
 	close(fd);
 	unlink(filename);
 	if (errflag == -1) {
-	    G_warning(_("bseg_open(): could not read segment file"));
+	    G_warning(_("Unable to read segment file"));
 	    return -5;
 	}
 	else {
-	    G_warning(_("bseg_open(): out of memory"));
+	    G_warning(_("Out of memory"));
 	    return -6;
 	}
     }
@@ -75,7 +76,7 @@
 int bseg_put(BSEG *bseg, char *value, int row, int col)
 {
     if (Segment_put(&(bseg->seg), value, row, col) < 0) {
-	G_warning(_("bseg_put(): could not write segment file"));
+	G_warning(_("Unable to write segment file"));
 	return -1;
     }
     return 0;
@@ -84,7 +85,7 @@
 int bseg_put_row(BSEG *bseg, char *value, int row)
 {
     if (Segment_put_row(&(bseg->seg), value, row) < 0) {
-	G_warning(_("bseg_put_row(): could not write segment file"));
+	G_warning(_("Unable to write segment file"));
 	return -1;
     }
     return 0;
@@ -93,7 +94,7 @@
 int bseg_get(BSEG *bseg, char *value, int row, int col)
 {
     if (Segment_get(&(bseg->seg), value, row, col) < 0) {
-	G_warning(_("bseg_get(): could not read segment file"));
+	G_warning(_("Unable to read segment file"));
 	return -1;
     }
     return 0;

Modified: grass-addons/grass7/raster/r.hydrodem/cseg.c
===================================================================
--- grass-addons/grass7/raster/r.hydrodem/cseg.c	2014-11-24 23:34:23 UTC (rev 62900)
+++ grass-addons/grass7/raster/r.hydrodem/cseg.c	2014-11-24 23:34:56 UTC (rev 62901)
@@ -1,5 +1,6 @@
 #include <unistd.h>
 #include <fcntl.h>
+#include <grass/segment.h>
 #include <grass/glocale.h>
 #include "seg.h"
 
@@ -16,7 +17,7 @@
 
     filename = G_tempfile();
     if (-1 == (fd = creat(filename, 0666))) {
-	G_warning(_("cseg_open(): unable to create segment file"));
+	G_warning(_("Unable to create segment file"));
 	return -2;
     }
     if (0 >
@@ -26,29 +27,29 @@
 	close(fd);
 	unlink(filename);
 	if (errflag == -1) {
-	    G_warning(_("cseg_open(): could not write segment file"));
+	    G_warning(_("Unable to write segment file"));
 	    return -1;
 	}
 	else {
-	    G_warning(_("cseg_open(): illegal configuration parameter(s)"));
+	    G_warning(_("Illegal configuration parameter(s)"));
 	    return -3;
 	}
     }
     close(fd);
     if (-1 == (fd = open(filename, 2))) {
 	unlink(filename);
-	G_warning(_("cseg_open(): unable to re-open segment file"));
+	G_warning(_("Unable to re-open segment file"));
 	return -4;
     }
     if (0 > (errflag = Segment_init(&(cseg->seg), fd, nsegs_in_memory))) {
 	close(fd);
 	unlink(filename);
 	if (errflag == -1) {
-	    G_warning(_("cseg_open(): could not read segment file"));
+	    G_warning(_("Unable to read segment file"));
 	    return -5;
 	}
 	else {
-	    G_warning(_("cseg_open(): out of memory"));
+	    G_warning(_("Out of memory"));
 	    return -6;
 	}
     }
@@ -76,7 +77,7 @@
 int cseg_put(CSEG *cseg, CELL *value, int row, int col)
 {
     if (Segment_put(&(cseg->seg), value, row, col) < 0) {
-	G_warning(_("cseg_put(): could not write segment file"));
+	G_warning(_("Unable to write segment file"));
 	return -1;
     }
     return 0;
@@ -85,7 +86,7 @@
 int cseg_put_row(CSEG *cseg, CELL *value, int row)
 {
     if (Segment_put_row(&(cseg->seg), value, row) < 0) {
-	G_warning(_("cseg_put_row(): could not write segment file"));
+	G_warning(_("Unable to write segment file"));
 	return -1;
     }
     return 0;
@@ -94,7 +95,7 @@
 int cseg_get(CSEG *cseg, CELL *value, int row, int col)
 {
     if (Segment_get(&(cseg->seg), value, row, col) < 0) {
-	G_warning(_("cseg_get(): could not read segment file"));
+	G_warning(_("Unabel to read segment file"));
 	return -1;
     }
     return 0;
@@ -117,9 +118,9 @@
 	if (Segment_put_row(&(cseg->seg), buffer, row) < 0) {
 	    G_free(buffer);
 	    Rast_close(map_fd);
-	    G_warning(_("cseg_read_cell(): unable to segment put row for <%s> in <%s>"),
-		    map_name, mapset);
-	    return (-1);
+	    G_warning(_("Unable to segment put row %d for raster map <%s>"),
+                      row, map_name);
+	    return -1;
 	}
     }
 

Modified: grass-addons/grass7/raster/r.hydrodem/dseg.c
===================================================================
--- grass-addons/grass7/raster/r.hydrodem/dseg.c	2014-11-24 23:34:23 UTC (rev 62900)
+++ grass-addons/grass7/raster/r.hydrodem/dseg.c	2014-11-24 23:34:56 UTC (rev 62901)
@@ -1,5 +1,6 @@
 #include <unistd.h>
 #include <fcntl.h>
+#include <grass/segment.h>
 #include <grass/glocale.h>
 #include "seg.h"
 
@@ -26,29 +27,29 @@
 	close(fd);
 	unlink(filename);
 	if (errflag == -1) {
-	    G_warning(_("dseg_open(): could not write segment file"));
+	    G_warning(_("Unable to write segment file"));
 	    return -1;
 	}
 	else {
-	    G_warning(_("dseg_open(): illegal configuration parameter(s)"));
+	    G_warning(_("Iillegal configuration parameter(s)"));
 	    return -3;
 	}
     }
     close(fd);
     if (-1 == (fd = open(filename, 2))) {
 	unlink(filename);
-	G_warning(_("dseg_open(): unable to re-open segment file"));
+	G_warning(_("Unable to re-open segment file"));
 	return -4;
     }
     if (0 > (errflag = Segment_init(&(dseg->seg), fd, nsegs_in_memory))) {
 	close(fd);
 	unlink(filename);
 	if (errflag == -1) {
-	    G_warning(_("dseg_open(): could not read segment file"));
+	    G_warning(_("Unable to read segment file"));
 	    return -5;
 	}
 	else {
-	    G_warning(_("dseg_open(): out of memory"));
+	    G_warning(_("Out of memory"));
 	    return -6;
 	}
     }
@@ -76,7 +77,7 @@
 int dseg_put(DSEG *dseg, DCELL *value, int row, int col)
 {
     if (Segment_put(&(dseg->seg), (DCELL *) value, row, col) < 0) {
-	G_warning(_("dseg_put(): could not write segment file"));
+	G_warning(_("Unable to write segment file"));
 	return -1;
     }
     return 0;
@@ -85,7 +86,7 @@
 int dseg_put_row(DSEG *dseg, DCELL *value, int row)
 {
     if (Segment_put_row(&(dseg->seg), (DCELL *) value, row) < 0) {
-	G_warning(_("dseg_put(): could not write segment file"));
+	G_warning(_("Unable to write segment file"));
 	return -1;
     }
     return 0;
@@ -94,7 +95,7 @@
 int dseg_get(DSEG *dseg, DCELL *value, int row, int col)
 {
     if (Segment_get(&(dseg->seg), (DCELL *) value, row, col) < 0) {
-	G_warning(_("dseg_get(): could not read segment file"));
+	G_warning(_("Unable to read segment file"));
 	return -1;
     }
     return 0;
@@ -102,7 +103,7 @@
 
 int dseg_read_raster(DSEG *dseg, char *map_name, char *mapset)
 {
-    int row, nrows, ncols;
+    int row, nrows;
     int map_fd;
     DCELL *dbuffer;
 
@@ -111,16 +112,15 @@
 
     map_fd = Rast_open_old(map_name, mapset);
     nrows = Rast_window_rows();
-    ncols = Rast_window_cols();
     dbuffer = Rast_allocate_d_buf();
     for (row = 0; row < nrows; row++) {
 	Rast_get_d_row(map_fd, dbuffer, row);
 	if (Segment_put_row(&(dseg->seg), (DCELL *) dbuffer, row) < 0) {
 	    G_free(dbuffer);
 	    Rast_close(map_fd);
-	    G_warning(_("dseg_read_raster(): unable to segment put row for <%s> in <%s>"),
-		    map_name, mapset);
-	    return (-1);
+	    G_warning(_("Inable to segment put row %d for raster <%s>"),
+                      row, map_name);
+	    return -1;
 	}
     }
 
@@ -136,12 +136,11 @@
 int dseg_write_cellfile(DSEG *dseg, char *map_name)
 {
     int map_fd;
-    int row, nrows, ncols;
+    int row, nrows;
     DCELL *dbuffer;
 
     map_fd = Rast_open_new(map_name, DCELL_TYPE);
     nrows = Rast_window_rows();
-    ncols = Rast_window_cols();
     dbuffer = Rast_allocate_d_buf();
     Segment_flush(&(dseg->seg));
     for (row = 0; row < nrows; row++) {

Modified: grass-addons/grass7/raster/r.hydrodem/seg.c
===================================================================
--- grass-addons/grass7/raster/r.hydrodem/seg.c	2014-11-24 23:34:23 UTC (rev 62900)
+++ grass-addons/grass7/raster/r.hydrodem/seg.c	2014-11-24 23:34:56 UTC (rev 62901)
@@ -16,7 +16,7 @@
 
     filename = G_tempfile();
     if (-1 == (fd = creat(filename, 0666))) {
-	G_warning(_("seg_open(): unable to create segment file"));
+	G_warning(_("Unable to create segment file"));
 	return -2;
     }
     if (fill)
@@ -30,29 +30,29 @@
 	close(fd);
 	unlink(filename);
 	if (errflag == -1) {
-	    G_warning(_("seg_open(): could not write segment file"));
+	    G_warning(_("Unable to write segment file"));
 	    return -1;
 	}
 	else {
-	    G_warning(_("seg_open(): illegal configuration parameter(s)"));
+	    G_warning(_("Illegal configuration parameter(s)"));
 	    return -3;
 	}
     }
     close(fd);
     if (-1 == (fd = open(filename, 2))) {
 	unlink(filename);
-	G_warning(_("seg_open(): unable to re-open segment file"));
+	G_warning(_("Unable to re-open file '%s'"), filename);
 	return -4;
     }
     if (0 > (errflag = Segment_init(&(sseg->seg), fd, nsegs_in_memory))) {
 	close(fd);
 	unlink(filename);
 	if (errflag == -1) {
-	    G_warning(_("seg_open(): could not read segment file"));
+	    G_warning(_("Unable to read segment file"));
 	    return -5;
 	}
 	else {
-	    G_warning(_("seg_open(): out of memory"));
+	    G_warning(_("Out of memory"));
 	    return -6;
 	}
     }
@@ -72,7 +72,7 @@
 int seg_put(SSEG *sseg, char *value, int row, int col)
 {
     if (Segment_put(&(sseg->seg), value, row, col) < 0) {
-	G_warning(_("seg_put(): could not write segment file"));
+	G_warning(_("Unable to write segment file"));
 	return -1;
     }
     return 0;
@@ -90,7 +90,7 @@
 int seg_get(SSEG *sseg, char *value, int row, int col)
 {
     if (Segment_get(&(sseg->seg), value, row, col) < 0) {
-	G_warning(_("seg_get(): could not read segment file"));
+	G_warning(_("Unable to read segment file"));
 	return -1;
     }
     return 0;
@@ -99,7 +99,7 @@
 int seg_get_row(SSEG *sseg, char *value, int row)
 {
     if (Segment_get_row(&(sseg->seg), value, row) < 0) {
-	G_warning(_("seg_get_row(): could not read segment file"));
+	G_warning(_("Unable to read segment file"));
 	return -1;
     }
     return 0;



More information about the grass-commit mailing list