[GRASS-dev] Re: [GRASS GIS] #1006: r.terraflow fails to stat()
stream file on Windows
GRASS GIS
trac at osgeo.org
Thu Apr 29 21:09:51 EDT 2010
#1006: r.terraflow fails to stat() stream file on Windows
------------------------------+---------------------------------------------
Reporter: marisn | Owner: grass-dev at lists.osgeo.org
Type: defect | Status: new
Priority: critical | Milestone: 6.4.0
Component: Raster | Version: svn-releasebranch64
Resolution: | Keywords: wingrass, r.terraflow
Platform: MSWindows Vista | Cpu: x86-32
------------------------------+---------------------------------------------
Comment (by glynn):
Replying to [comment:25 adanner]:
> fseek and ftell only work for 32-bit file offsets on 32-bit system as
the offset for fseek and the return value of ftell is a long type. At
least in linux, the proper return type is an off_t which can be set to 32
or 64 bits at compile time and fseeko and ftello use off_t types. A real
fix should support 64 bit file offsets on 32 bit and 64-bit systems in
Windows and Linux, but this gets a bit complicated. Is there a guaranteed
portable 64-bit type in Grass? A portable 64-bit G_fseek might avoid
future problems of this type.
In 7.0, G_fseek() and G_ftell() use off_t and use fseeko/ftello where
available. But Windows doesn't have an equivalent of _FILE_OFFSET_BITS;
you have to explicitly use off64_t, lseek64(), fseeko64() etc.
Also, "long" is still only 32 bits on Win64.
Finally, C89 doesn't guarantee the existence of a 64-bit type; "long long"
is C99, which isn't widely supported. gcc and MSVC support "most" of C99,
but not all of it. Which means that you can either code for C89, code for
whichever subset of C99 is supported by some specific set of compilers, or
code for C99 and be unable to find a compiler which will accept it.
GRASS aims to compile with any sane C89 compiler (excluding technically
conforming yet obscure cases, e.g. 60-bit "int", ones-complement
representation, etc). Anything which uses extensions should have a fall-
back.
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1006#comment:26>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list