From 81223d017f09f34680f80df398d19165ab372525 Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Wed, 30 Jun 2004 04:51:18 +0000 Subject: 2004-06-30 Kees Zeelenberg Danny Smith * include/stdio.h (fopen64): Add inline function. (fseeko64): Add prototype. (ftello64): Add inline function. * include/io.h (lseek64): Add inline function. * include/sys/types (off64_t): Add typedef. (fpos64_t): Add typedef. * mingwex/fopen64.c: New file. * mingwex/fseeko64.c: New file. * mingwex/ftello64.c: New file. * mingwex/lseek64.c: New file. * mingwex/Makefile.in (STDIO_DISTFILES): Add fopen64.c, fseeko.64.c, ftello64.c, lseek64.c. (STDIO_OBJS): Add fopen64.o, fseeko.64.o, ftello64.o, lseek64.o. 2004-06-30 Danny Smith * include/stdio.h (__mingw_fseeko64): Add prototype. * mingwex/mingw-fseek.c (__mingw_fseeko64): Add definition. (__mingw_fwrite): Handle huge files. --- winsup/mingw/include/io.h | 8 ++++++++ winsup/mingw/include/stdio.h | 24 ++++++++++++++++++++++++ winsup/mingw/include/sys/types.h | 9 +++++++++ 3 files changed, 41 insertions(+) (limited to 'winsup/mingw/include') diff --git a/winsup/mingw/include/io.h b/winsup/mingw/include/io.h index 265f42bc5..66d59b5a8 100644 --- a/winsup/mingw/include/io.h +++ b/winsup/mingw/include/io.h @@ -144,6 +144,14 @@ _CRTIMP __int64 __cdecl _telli64(int); _CRTIMP intptr_t __cdecl _findfirst64(const char*, struct __finddata64_t*); _CRTIMP intptr_t __cdecl _findnext64(intptr_t, struct __finddata64_t*); #endif /* __MSVCRT_VERSION__ >= 0x0601 */ + +#ifndef __NO_MINGW_LFS +__CRT_INLINE off64_t lseek64 (int fd, off64_t offset, int whence) +{ + return _lseeki64(fd, (__int64) offset, whence); +} +#endif + #endif /* __MSVCRT__ */ #ifndef _NO_OLDNAMES diff --git a/winsup/mingw/include/stdio.h b/winsup/mingw/include/stdio.h index 63ff1d6ca..9b53fbfb1 100644 --- a/winsup/mingw/include/stdio.h +++ b/winsup/mingw/include/stdio.h @@ -392,6 +392,30 @@ _CRTIMP int __cdecl fileno (FILE*); #define fileno(__F) ((__F)->_file) #endif +#if defined (__MSVCRT__) && !defined (__NO_MINGW_LFS) +#include +__CRT_INLINE FILE* __cdecl fopen64 (const char* filename, const char* mode) +{ + return fopen (filename, mode); +} + +int __cdecl fseeko64 (FILE*, off64_t, int); + +#ifdef __USE_MINGW_FSEEK +int __cdecl __mingw_fseeko64 (FILE *, off64_t, int); +#define fseeko64(fp, offset, whence) __mingw_fseeko64(fp, offset, whence) +#endif + +__CRT_INLINE off64_t __cdecl ftello64 (FILE * stream) +{ + fpos_t pos; + if (fgetpos(stream, &pos)) + return -1LL; + else + return ((off64_t) pos); +} +#endif /* __NO_MINGW_LFS */ + #endif /* Not __STRICT_ANSI__ */ /* Wide versions */ diff --git a/winsup/mingw/include/sys/types.h b/winsup/mingw/include/sys/types.h index 333013399..2bc04e755 100644 --- a/winsup/mingw/include/sys/types.h +++ b/winsup/mingw/include/sys/types.h @@ -105,6 +105,15 @@ typedef _ssize_t ssize_t; #endif #endif /* Not _SSIZE_T_ */ +#ifndef _FPOS64_T_ +#define _FPOS64_T_ +typedef long long fpos64_t; +#endif + +#ifndef _OFF64_T_ +#define _OFF64_T_ +typedef long long off64_t; +#endif #endif /* Not RC_INVOKED */ -- cgit v1.2.3