[GRASS-dev] Re: [GRASS-windows] Problems with Mapcanvas

Glynn Clements glynn at gclements.plus.com
Wed Nov 21 14:05:52 EST 2007


Hamish wrote:

> > > Contents of PERMANENT/PROJ_INFO file:
> > > 
> > > name: Lambert Conformal Conic
> > > proj: lcc
> > > datum: nad83
> > > ellps: grs80
> > > lat_1: 36.16666666666666
> > > lat_2: 34.33333333333334
> > > lat_0: 33.75
> > > lon_0: -79
> > > x_0: 609601.22
> > > y_0: 0
> > > no_defs: defined
> > > towgs84: 0.000,0.000,0.000
> 
> Glynn:
> > That doesn't tell me the one thing I really need to know: whether
> > there are CR characters in the file.
> > 
> > Try "od -t x1z PROJ_INFO"; look for any occurrences of "0d" in the
> > output.
> 
> 
> perhaps this patch helps:
> 
> Index: lib/gis/key_value2.c
> ===================================================================
> RCS file: /home/grass/grassrepository/grass6/lib/gis/key_value2.c,v
> retrieving revision 2.3
> diff -u -r2.3 key_value2.c
> --- lib/gis/key_value2.c        14 Apr 2007 23:01:59 -0000      2.3
> +++ lib/gis/key_value2.c        21 Nov 2007 01:11:54 -0000
> @@ -32,7 +32,7 @@
>      kv = G_create_key_value();
>      if (kv == NULL)
>         return NULL;
> -    while (G_getl(buf, sizeof buf, fd) != 0)
> +    while (G_getl2(buf, sizeof buf, fd) != 0)
>      {
>         key = value = buf;
>         while (*value && *value != ':')

Probably. Although we should also change the code which is putting the
CRs there in the first place (assuming that's what's happening).

For 7.x, we should probably just rename G_getl2 -> G_getl. There can't
be many cases where we actually want to read native line ends.

> also, should that be using "(buf, sizeof(buf)-1, fd" ?

Yes and no. The current behaviour of G_getl2() requires it, but it's
G_getl2() which should be changed to match G_getl(), fgets() etc.

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


More information about the grass-windows mailing list