[GRASS-dev] History.fields problem in i.landsat.toar

Glynn Clements glynn at gclements.plus.com
Tue Oct 19 05:33:06 EDT 2010


Yann Chemin wrote:

> finishing i.landsat.toar conversion to v7, the History adaptation from
> v6 gives a problem (SegFault)
> 
> It happens here:
> -------------------
>             sprintf(history.fields[8],
>                     " Mean solar irradiance (ESUN) .......... %.3lf",
>                     lsat.band[i].esun);
>             sprintf(history.fields[9],
>                     " Reflectance = Radiance divided by ..... %.5lf",
>                     lsat.band[i].K2);
> 
> There is nothing special to these lines from the previous ones.
> Maybe the History fields have a limited amount of storage available or
> maybe I missed something reading the new types?

In 7.0, the fields of the history structure are dynamically allocated. 
You have to use Rast_set_history() or Rast_format_history() to set
fields.

Also, don't use numeric literals, use the HIST_* constants.

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


More information about the grass-dev mailing list