[GRASS-dev] Re: [GRASS GIS] #1131: Global LFS for wingrass

GRASS GIS trac at osgeo.org
Tue Aug 17 04:04:27 EDT 2010


#1131: Global LFS for wingrass
--------------------------+-------------------------------------------------
 Reporter:  mmetz         |       Owner:  grass-dev@…              
     Type:  defect        |      Status:  new                      
 Priority:  critical      |   Milestone:  7.0.0                    
Component:  libgis        |     Version:  svn-trunk                
 Keywords:  LFS,wingrass  |    Platform:  MSWindows 7              
      Cpu:  All           |  
--------------------------+-------------------------------------------------

Comment(by mmetz):

 Replying to [comment:14 glynn]:
 > > Alternatively, we could not redefine existing functions/types, but
 define functions/types for grass, e.g.
 > >
 > {{{
 > #define g_off_t off64_t
 > #define g_fseeko fseeko64
 > #define g_ftello ftello64
 > #define g_lseek lseek64
 > /* use _stati64 compatible with MSVCRT < 6.1 */
 > #define g_stat _stati64
 > #define g_fstat _fstati64
 > }}}
 >
 > If you take this route, these should be functions rather than macros
 (IMHO, g_off_t is a non-starter).

 I think I understand. How about in config.h.in

 {{{
 /* use own off_t definition */
 #define _OFF_T_
 #define _off_t off64_t
 #define off_t off64_t
 /* fseeko and ftello are safe because not defined by MINGW */
 #define HAVE_FSEEKO
 #define fseeko fseeko64
 #define ftello ftello64
 /* lseek is not safe, defined in io.h */
 #define HAVE_LSEEK64
 /* use _stati64 compatible with MSVCRT < 6.1 */
 /* stat and fstat are not safe, defined in stat.h */
 #define HAVE__STATI64
 #define HAVE__FSTATI64
 #define _STRUCT_STAT_
 typedef struct _stati64 STRUCT_STAT;
 }}}

 in lib/gis/seek.c new function G_lseek()

 {{{
 off_t G_lseek(int fd, off_t offset, int whence)
 {
 #ifdef HAVE_LSEEK64
     return lseek64(fd, offset, whence);
 #else
     return lseek(fd, offset, whence);
 #endif
 }
 }}}

 in lib/gis/paths.c

 {{{
 int G_stat(const char *file_name, STRUCT_STAT *buf)
 {
 #ifdef HAVE__STATI64
     return _stati64(file_name, buf);
 #else
     return stat(file_name, buf);
 #endif
 }

 int G_lstat(const char *file_name, STRUCT_STAT *buf)
 {
 #ifdef __MINGW32__
     return G_stat(file_name, buf);
 #else
     return lstat(file_name, buf);
 #endif
 }
 }}}

 ?

 Then update other libs and modules accordingly...

 Markus M

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/1131#comment:16>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list