[GRASS-dev] G_find_key_value() case sensitive
glynn at gclements.plus.com
Thu Mar 22 15:13:21 EDT 2012
Martin Landa wrote:
> > Why does this matter?
> some files use upper-case for keys
> cat ~/grassdata/nc_spm_08/pg/VAR
> DB_DRIVER: sqlite
> DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite.db
> some lower-case
> cat ~/grassdata/nc_spm_08/pg/GDAL
> directory: /home/martin/smetiste/
> format: GTiff
This isn't necessarily a problem.
> it would be probably better to consolidate naming convention to
I would have said the opposite. Lower-case is more common, and easier
to read. $GISRC and VAR use upper-case; almost everything else uses
> Then e.g. `r.external.out` would write GDAL file with
> upper-case keys, in this case
> DIRECTORY: /home/martin/smetiste/
> FORMAT: GTiff
> Case insensitive G_find_key_value() would enable eg. to read GDAL
> files created before this change (lower -> upper).
However, existing versions won't be able to read new files.
Also: are there any cases where the case actually matters? E.g. the
PROJ_INFO file use PROJ parameter names as its keys. Is that going to
cause problems if we change the case?
Any code which enumerates keys (e.g. pj_get_kv() in
lib/proj/get_proj.c) will need to be re-written to use
case-insensitive checks. And if there's any third-party code (e.g.
users' scripts) which parses key-value files directly (or uses the
output from programs which copy keys verbatim), it's going to be
broken by such a change.
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev