[GRASS5] 5.3 Cygwin, Tcl/Tk, NVIZ

Glynn Clements glynn.clements at virgin.net
Mon Mar 8 15:37:23 EST 2004


Markus Neteler wrote:

> > > ==== 3/3/2004  NVWISH2.2 error message ====
> > > 
> > > Error in startup script: integer value too large to represent
> > >      while executing
> > > "expr int([lindex $range 0])"
> > >      (procedure "mkcutplanePanel" line 55)
> > >      invoked from within
> > 
> > This suggests that GS_get_zrange_nz() is returning garbage, possibly
> > because it can't find a surface.
> 
> src/libes/ogsf/GS2.c
> 
> void GS_get_zrange_nz(float *min, float *max)
> {
>  [...]
>  return;
> }

The problem is that it isn't guaranteed to write anything to *min and
*max. If they point to uninitialised variables on entry, they may
still be uninitialised upon return.

> Shouldn't it be 
> int  GS_get_zrange_nz(float *min, float *max)
> ?

That would only help if the caller bothers to check the return value.

> On the other hand in NVIZ there are no if statements
> so maybe a test is needed there.
> 
> ?

There seem to be three alternative approaches:

1. Leave GS_get_zrange_nz() alone, and have the caller initialise the
variables to suitable defaults. Either GS_get_zrange_nz() will
overwrite them with other (valid) values, or they will remain
unchanged.

2. Change GS_get_zrange_nz() to write hardcoded defaults in the event
that it doesn't find a surface.

3. Change GS_get_zrange_nz() to return a status code, and change the
callers to handle failure.

Also, 3 could co-exist with either 1 or 2.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list