[GRASS5] confused by lib fns

Hamish hamish_nospam at yahoo.com
Sun Oct 9 20:58:33 EDT 2005


> > while trying to fix the broken d.rast.num "-f", I am running into
> > two (possible) gis lib bugs in lib/gis/color_get.c.
..
> >    To get `d.rast.num -f` to work currently I need to cast to CELL
> >    then  run G_get_color(). :/
> 
> 	G_get_raster_color(cell[col], &R, &G, &B, &colors, inmap_type);
> should be:
> 	G_get_raster_color(&cell[col], &R, &G, &B, &colors, map_type);
> 
> The first argument needs to be a pointer to the value, and the last
> argument should reflect the actual type of the data (i.e. it should be
> map_type rather than inmap_type).

Thanks. I knew about the pointer; it was the inmap_type vs. map_type
mistake which was causing me grief. Now fixed in CVS.


> > 2) All fn's in color_get.c have R,G,B as int,
> 
> Pointer to int.
> 
> > but lib/raster/RGB_color.c
> >    wants unsigned char. You can't access & set the display color
> >    without the compiler doing a cast.  gis.h likes unsigned char.
> >    Should color_get.c be changed to use unsigned char?
> 
> RGB_color.c isn't the only user of that function; most of the callers
> use ints.

Can we at least standardize the library functions to something we agree
is "correct" (gis.h should be canonical) and worry about what the
rabble of modules call later?



Hamish




More information about the grass-dev mailing list