[GRASS-SVN] r43757 -
grass-addons/grass7/raster/r.stream/r.stream.distance
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Oct 1 07:23:59 EDT 2010
Author: jarekj71
Date: 2010-10-01 11:23:59 +0000 (Fri, 01 Oct 2010)
New Revision: 43757
Modified:
grass-addons/grass7/raster/r.stream/r.stream.distance/distance_init.c
Log:
update
Modified: grass-addons/grass7/raster/r.stream/r.stream.distance/distance_init.c
===================================================================
--- grass-addons/grass7/raster/r.stream/r.stream.distance/distance_init.c 2010-10-01 11:21:56 UTC (rev 43756)
+++ grass-addons/grass7/raster/r.stream/r.stream.distance/distance_init.c 2010-10-01 11:23:59 UTC (rev 43757)
@@ -17,12 +17,13 @@
for (r = 0; r < nrows; ++r)
for (c = 0; c < ncols; ++c)
if (streams[r][c]>0) {
-
- if (outlets_num > 2 * (out_max - 1))
- G_fatal_error(_
- ("Stream and direction maps probably do not match"));
- if (outlets_num > (out_max - 1))
- outlets = (OUTLET *)G_realloc(outlets,out_max*2*sizeof(OUTLET));
+ if (outlets_num > (out_max - 1)) {
+ if (outlets_num > 4 * (out_max - 1))
+ G_fatal_error
+ ("Stream and direction maps probably do not match");
+ out_max *= 4;
+ outlets = (OUTLET *) G_realloc(outlets, (out_max) * sizeof(OUTLET));
+ }
d = abs(dirs[r][c]); /* r.watershed */
@@ -79,12 +80,13 @@
segment_get(streams,&streams_cell,r,c);
if (streams_cell>0) {
-
- if (outlets_num > 2 * (out_max - 1))
- G_fatal_error(_
- ("Stream and direction maps probably do not match"));
- if (outlets_num > (out_max - 1))
- outlets = (OUTLET *)G_realloc(outlets,out_max*2*sizeof(OUTLET));
+ if (outlets_num > (out_max - 1)) {
+ if (outlets_num > 4 * (out_max - 1))
+ G_fatal_error
+ ("Stream and direction maps probably do not match");
+ out_max *= 4;
+ outlets = (OUTLET *) G_realloc(outlets, (out_max) * sizeof(OUTLET));
+ }
segment_get(dirs,&dirs_cell,r,c);
d = abs(dirs_cell); /* r.watershed */
More information about the grass-commit
mailing list