[GRASS5] raster filename length problem
Glynn Clements
glynn at gclements.plus.com
Sun Jul 17 07:28:20 EDT 2005
Markus Neteler wrote:
> > > > More generally, it would help if we had standardised NAME_MAX and
> > > > MAPSET_MAX constants, rather than having arbitrary integer literals
> > > > scattered all over the code.
> > >
> > > I'll try whenever I come across NAME/MAPSET definitions to set them
> > > to NAME_MAX,MAPSET_MAX. Before adding those to gis.h, how long?
> > > Is 100 ok during the migration to NAME_MAX,MAPSET_MAX? I'm not
> > > sure how to capture string overflows.
> >
> > The set_data program limits the location and mapset to 25 characters
> > each (not including the terminating NUL).
>
> In lib/init/set_data.c we have
>
> char gisdbase[70];
> char location_name[41] ;
> char location[1024] ;
> char mapset[41] ;
>
> V_ques (location_name, 's', line++, 12, 25);
> ...
> V_ques (mapset, 's', line++, 12, 25);
> ...
> V_ques (gisdbase, 's', line++, 10, sizeof(gisdbase) - 1);
>
> Which looks a bit messy to me.
> Is there a problem to set things to GNAME_NAME length?
Presumably you mean GMAPSET_MAX? There isn't a map name field there.
The location should probably have a similar constant, although that's
less critical as so few modules explicitly deal with locations.
char mapset[GMAPSET_MAX];
V_ques (mapset, 's', line++, 12, sizeof(mapset) - 1);
I'm not sure what will happen if GMAPSET_MAX is set too high (i.e.
whether the field will go off of the screen; it depends upon whether
the vask library has a check for this).
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list