[GRASS-dev] [GRASS GIS] #1784: wingrass6.4.3svn: raster3d problems

Glynn Clements glynn at gclements.plus.com
Mon Feb 18 17:03:22 PST 2013


Markus Neteler wrote:

> On Thu, Feb 14, 2013 at 2:55 PM, Helmut Kudrnovsky <hellik at web.de> wrote:
> >>Does this command work in G7 on the same data?
> >
> >
> > g.region -p rast3d=JR_7408MR_2m_t70 at testvolume
> > WARNING: Rast3d_read_window: unable to find
> > [C:\grassdata/nc_spm_08/testvolume/windows3d/C:\grassdata/nc_spm_08/testvolume/grid3/JR_7408MR_2m_t70/cellhd].
> > ERROR: Nordwert muss größer als der Südwert sein
> >
> > not really...
> 
> I tried to debug this on Linux but I have no idea what to look for.
> The problem might be in
> 
> lib/raster3d/windowio.c
> Rast3d_getFullWindowPath()
> 
> Maybe this line causing troubles (guessing around)?
>     if ((*windowName == '/') || (*windowName == '.')) {

I think so.

> Glynn (sorry to ask you directly), any pointers for me?

The minimal portability fix for the above is:

	if (G_is_absolute_path(windowName) || (*windowName == '.'))

But I suggest either:

	if (strpbrk(windowName, "/\\")) {
or:
	if (strchr(windowName, GRASS_DIRSEP) || strchr(windowName, HOST_DIRSEP)) {

which will check whether the window "name" contains any slash or
backslash characters (in which case, it's almost certainly meant to be
a path rather than a name). Unlike the existing code, this will allow
relative paths which don't start with "./" (which should be
redundant). The second alternative avoids matching a backslash on Unix
(which probably doesn't matter; backslashes in filenames are legal but
rare).

Alternatively, assuming that window names are bound by the same rules
as raster map names:

	if (!G_legal_filename(windowName)) {

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list