[GRASS-dev] Principle G3D library question
Soeren Gebbert
soerengebbert at googlemail.com
Tue Jun 21 07:29:27 EDT 2011
Hi Maris,
2011/6/21 Maris Nartiss <maris.gis at gmail.com>:
> Hello,
> It's not an backporting of header it's about GRASS6 being able to
> distinguish GRASS7 format g3d files. I have not peaked into code if
> there such feature exists. If not, it should be implemented to prevent
> GRASS6 failures (or worse - data corruption) on GRASS7 files.
I see, good point!
The grass6 implementation checks for valid header:
static void readHeaderString(FILE * fp, char *valueString, double *value)
{
static char format[100];
/* to avoid buffer overflows we use snprintf */
G_snprintf(format, 100, "%s %%lf", valueString);
if (fscanf(fp, format, value) != 1) {
G_debug(0, "bad value for [%s]", valueString);
fatalError("readHeaderString: header value invalid");
}
while (fgetc(fp) != '\n') ;
}
I think this should prevent the import of new grass7 volume ascii
files in grass6. The grass6 import will break in when the new lines of
the grass7 header are parsed.
Best regards
Soeren
More information about the grass-dev
mailing list