aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-04-11 15:34:06 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-04-11 15:34:06 -0300
commit49c1607157560f0775f3c697cca47b06978cc3e5 (patch)
tree0a92be21e44cc5facaa22b2547127f295ff45ca3
parentc8e96d6e91dc2e3d5b175cc4cd811398ab35c82d (diff)
downloadlua-49c1607157560f0775f3c697cca47b06978cc3e5.tar.gz
lua-49c1607157560f0775f3c697cca47b06978cc3e5.tar.bz2
lua-49c1607157560f0775f3c697cca47b06978cc3e5.zip
_FILE_OFFSET_BITS usually also needs _LARGEFILE_SOURCE + easier to
use default definition for 'l_fseek' in ansi systems
-rw-r--r--liolib.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/liolib.c b/liolib.c
index 6f3bdc50..8f206d32 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,17 +1,17 @@
1/* 1/*
2** $Id: liolib.c,v 2.110 2013/03/20 19:40:07 roberto Exp roberto $ 2** $Id: liolib.c,v 2.111 2013/03/21 13:57:27 roberto Exp roberto $
3** Standard I/O (and system) library 3** Standard I/O (and system) library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
6 6
7 7
8/* 8/*
9** POSIX idiosyncrasy!
10** This definition must come before the inclusion of 'stdio.h'; it 9** This definition must come before the inclusion of 'stdio.h'; it
11** should not affect non-POSIX systems 10** should not affect non-POSIX systems
12*/ 11*/
13#if !defined(_FILE_OFFSET_BITS) 12#if !defined(_FILE_OFFSET_BITS)
14#define _FILE_OFFSET_BITS 64 13#define _LARGEFILE_SOURCE 1
14#define _FILE_OFFSET_BITS 64
15#endif 15#endif
16 16
17 17
@@ -80,36 +80,37 @@
80 80
81/* 81/*
82** {====================================================== 82** {======================================================
83** lua_fseek/lua_ftell: configuration for longer offsets 83** lua_fseek: configuration for longer offsets
84** ======================================================= 84** =======================================================
85*/ 85*/
86 86
87#if !defined(lua_fseek) /* { */ 87#if !defined(lua_fseek) && !defined(LUA_ANSI) /* { */
88 88
89#if defined(LUA_USE_POSIX) 89#if defined(LUA_USE_POSIX) /* { */
90 90
91#define l_fseek(f,o,w) fseeko(f,o,w) 91#define l_fseek(f,o,w) fseeko(f,o,w)
92#define l_ftell(f) ftello(f) 92#define l_ftell(f) ftello(f)
93#define l_seeknum off_t 93#define l_seeknum off_t
94 94
95#elif defined(LUA_WIN) && !defined(_CRTIMP_TYPEINFO) \ 95#elif defined(LUA_WIN) && !defined(_CRTIMP_TYPEINFO) \
96 && defined(_MSC_VER) && (_MSC_VER >= 1400) 96 && defined(_MSC_VER) && (_MSC_VER >= 1400) /* }{ */
97/* Windows (but not DDK) and Visual C++ 2005 or higher */ 97/* Windows (but not DDK) and Visual C++ 2005 or higher */
98 98
99#define l_fseek(f,o,w) _fseeki64(f,o,w) 99#define l_fseek(f,o,w) _fseeki64(f,o,w)
100#define l_ftell(f) _ftelli64(f) 100#define l_ftell(f) _ftelli64(f)
101#define l_seeknum __int64 101#define l_seeknum __int64
102 102
103#else 103#endif /* } */
104 104
105#endif /* } */
106
107
108#if !defined(l_fseek) /* default definitions */
105#define l_fseek(f,o,w) fseek(f,o,w) 109#define l_fseek(f,o,w) fseek(f,o,w)
106#define l_ftell(f) ftell(f) 110#define l_ftell(f) ftell(f)
107#define l_seeknum long 111#define l_seeknum long
108
109#endif 112#endif
110 113
111#endif /* } */
112
113/* }====================================================== */ 114/* }====================================================== */
114 115
115 116