On Tue, 2007-02-20 at 08:53 +0100, Jáchym Čepický wrote:
hi glynn,
2007/2/19, Glynn Clements <glynn@gclements.plus.com>:
> >[...]
> Probably this:
>
> --- raster/r.flow/io.c 7 Feb 2007 05:24:40 -0000 1.14
> +++ raster/r.flow/io.c 19 Feb 2007 18:18:41 -0000
> @@ -126,7 +126,7 @@
> for (col = 0; col < region.cols; col++)
> {
> BM_set(bitbar, col, row, (barc[col] != 0));
> - if (barc[col] != 0)
> + if (ds.buf && barc[col] != 0)
> put(ds, row, col, -1);
> }
> }
This makes it not to segfault, but it does not make r.flow work properly
The problem is that it requires that the 'dsout' option be specified in
addition to the options you already provided. The memory buffer is not
allocated without it.
I'm not sure if that's a feature or a bug. If someone can guide me to
proper operation, I'll commit fix for it.
Here's a patch that "corrects" the problem (essentially, what Glynn
already posted), but I'm not sure if this is proper behavior. Ideally,
it should either A) error out or B) allocate the memory if 'barin' is
specified:
RCS file: /grassrepository/grass6/raster/r.flow/io.c,v
retrieving revision 1.14
diff -u -r1.14 io.c
--- io.c 7 Feb 2007 05:24:40 -0000 1.14
+++ io.c 20 Feb 2007 08:30:36 -0000
@@ -114,7 +114,7 @@
G_close_cell(fd);
}
- if (parm.barin)
+ if (parm.barin && parm.dsout)
{
G_message(_("Reading input files: barrier"));
barc = G_allocate_d_raster_buf();
@@ -132,6 +132,8 @@
}
G_close_cell(fd);
}
+
+ if (barc) G_free (barc);
}
--
Brad Douglas <rez touchofmadness com> KB8UYR/6
Address: 37.493,-121.924 / WGS84 National Map Corps #TNMC-3785