[GRASS-dev] Re: [GRASS-user] Large vector files
glynn at gclements.plus.com
Tue Oct 10 08:26:30 EDT 2006
> > > > > r.in.xyz doesn't use LFS, so it will be limited to 2Gb on 32-bit
> > > > > systems (any system where "long" is 32 bits). As it uses ANSI
> > > > > stdio functions (including ftell/fseek), extending it to support
> > > > > large files would be non-trivial.
> > > It's inherent in the purpose of the module that it be LFS compliant.
> > > All the filesize, ftell, fseek calls don't need to be there and can
> > > easily be #ifdef'd out if required. They are just there for the
> > > (somewhat lame & inaccurate; but fast, lightweight, and
> > > non-critical) guess at the total number of lines in the input file
> > > to pass to G_percent().
> > In that case, if you remove the fseek/ftell calls, LFS should be
> > straightforward.
> I would like to leave them in there for the generic case, what's the
> best way to test for "./configure --enable-largefile" ?
> #ifndef USE_LARGEFILES
if (_FILE_OFFSET_BITS > 8 * sizeof(long))
You can't use sizeof in a #if directive, and just using
"#if (_FILE_OFFSET_BITS > 32)" will needlessly disable the code on
systems with a 64-bit long (which don't need explicit large-file
> ? or is there some better HAVE_SUSV2 or HAVE_FSEEKO64 to test for?
> > You just need include <grass/config.h> before including any other header.
> is this needed for MinGW only?
It's needed on any platform to enable LFS, i.e. where you want
open/fopen to work on files whose size exceeds the range of a (signed)
"long". ftell/fseek still won't work on such files, though (ftell will
return -1L and set errno to EOVERFLOW if the offset is too large).
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev