I remember we replaced the fseek() with an fseeko() because we ran into a bug where we were trying to seek to a large offset (in r.terracost).

No objection to removing the 2 includes, given that it still compiles w/o them on other platforms.

-Laura


On Oct 6, 2008, at 9:18 PM, [EMAIL PROTECTED] wrote:

Message: 4
Date: Tue, 7 Oct 2008 00:12:10 +0100 (BST)
From: Paul Kelly <[EMAIL PROTECTED]>
Subject: Re: [GRASS-dev] fseeko() in libiostream
To: Andrew Danner <[EMAIL PROTECTED]>
Cc: grass-dev@lists.osgeo.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Mon, 6 Oct 2008, Andrew Danner wrote:

fseek is not the same as fseeko.

int fseek(FILE *stream, long offset, int whence);

int fseeko(FILE *stream, off_t offset, int whence);

If large file support is enabled, fseeko will convert off_t to a 64 bit type even on a 32-bit OS. I'm not sure if long will be 64 bit on a 64- bit OS for
fseek.

r.in.xyz may work with large files using plain old fseek as long as r.in.xyz doesn't make long seeks. ami_stream.h could potentially make long seeks (e.g., skip the first 8GB of a 30GB file), though in practice, I'm not sure that code that uses ami_stream (r.terraflow) actually uses this kind of fseek. Still the interface is designed to potentially use long seeks and I would be reluctant to simply replace fseeko with fseek in ami_stream.h.

you may to add a #define to check the compiler type and use fseek only if
fseeko does not exist.

Right - I was vaguely aware of some configure checks for fseeko() but as ami_stream.h was the only file in GRASS using fseeko() I wasn't sure if it
had been made redundant by something else. But looking closely at
include/config.h, I see that we can conditionalise fseeko() on
#ifdef HAVE_LARGEFILES. After doing that, on Windows fseeko() is redefined
to fseeko64() and all then works well.

A couple of further Windows compile errors in lib/iostream though:

sh-2.04$ make
c++ -I/c/grass/grass7/dist.i686-pc-mingw32/include -I/c/grass/extra/ include -O2 -s -I/c/grass/extra/include -D_FILE_OFFSET_BITS=64 - DPACKAGE=\""grasslibs"\" -I/c/grass/grass7/dist.i686-pc-mingw32/ include -o OBJ.i686-pc-mingw32/mm_utils.o -c mm_utils.cc
mm_utils.cc:38:22: sys/mman.h: No such file or directory
make: *** [OBJ.i686-pc-mingw32/mm_utils.o] Error 1

sh-2.04$ make
c++ -I/c/grass/grass7/dist.i686-pc-mingw32/include -I/c/grass/extra/ include -O2 -s -I/c/grass/extra/include -D_FILE_OFFSET_BITS=64 - DPACKAGE=\""grasslibs"\" -I/c/grass/grass7/dist.i686-pc-mingw32/ include -o OBJ.i686-pc-mingw32/mm_utils.o -c mm_utils.cc c++ -I/c/grass/grass7/dist.i686-pc-mingw32/include -I/c/grass/extra/ include -O2 -s -I/c/grass/extra/include -D_FILE_OFFSET_BITS=64 - DPACKAGE=\""grasslibs"\" -I/c/grass/grass7/dist.i686-pc-mingw32/ include -o OBJ.i686-pc-mingw32/rtimer.o -c rtimer.cc
rtimer.cc:38:26: sys/resource.h: No such file or directory
make: *** [OBJ.i686-pc-mingw32/rtimer.o] Error 1

In the two respective cases I commented out the #includes for sys/ mman.h and sys/resource.h and everything compiled fine. r.terraflow compiles fine
too. So I'll simply remove those two #includes unless there's any
objection?

Thanks for the feedback,

Paul



_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to