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

Hello,

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?

--
Yann Chemin
Senior Spatial Hydrologist
www.csu.edu.au/research/icwater
M +61-4-3740 7019

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@gclements.plus.com>