[GRASS-user] problem with Rast_get_x_value functions

Jarek Jasiewicz jarekj at amu.edu.pl
Fri Jul 16 18:24:53 EDT 2010


Hi
Sorry for GRASS USERS list but I'm totally banned on GRASS-DEV due to my 
proxyserver error, hope I will change it in the next few days, so for 
now I ask here.


I have problem with functions
Rast_get_[c,f,d]_value(void*, RASTER_MAP_TYPE)

according to its description it require void* argument as first so:

suppose in_map_type=CELL_TYPE

Rast_allocate_buf(in_map_type);
Rast_get_row(in_map_fd, in_buf, r, in_map_type); // for now is OK, 
buffer has proper value
But next:
for(c=0;c<ncols;++c)
internal_map_f[r][c] = Rast_get_f_value(&in_buf[c], in_map_type);
// not ok, compiler show warning on dereferencing pointer and program 
returns garbage

internal_map_f[r][c] = Rast_get_f_value(&((CELL*)in_buf)[c], 
in_map_type); // OK  but I must cast it manually

it is illogical for me, if in_buf (void*) is casted internally to 
(CELL*) why I must to do it again in a function calling?
sorry again for NTG.
Jarek



More information about the grass-user mailing list