Use __MINGW_ASM_CALL for function symbol redirect and use off_t type
(instead of _off_t) for offset parameter. off_t type follows the
_FILE_OFFSET_BITS setting. _off_t type is always 32-bit.
---
 mingw-w64-headers/crt/unistd.h | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/mingw-w64-headers/crt/unistd.h b/mingw-w64-headers/crt/unistd.h
index 363fbceafa4b..c408e8fa9caf 100644
--- a/mingw-w64-headers/crt/unistd.h
+++ b/mingw-w64-headers/crt/unistd.h
@@ -56,19 +56,16 @@ int __cdecl __MINGW_NOTHROW usleep(useconds_t);
 #define FTRUNCATE_DEFINED
 /* This is defined as a real library function to allow autoconf
    to verify its existence. */
-int ftruncate(int, _off_t);
+int ftruncate(int, off_t)
+#if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64))
+__MINGW_ASM_CALL(ftruncate64)
+#endif
+;
 int ftruncate64(int, _off64_t);
 int truncate(const char *, _off_t);
 int truncate64(const char *, _off64_t);
 #endif /* FTRUNCATE_DEFINED */
 
-#ifndef _FILE_OFFSET_BITS_SET_FTRUNCATE
-#define _FILE_OFFSET_BITS_SET_FTRUNCATE
-#if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64))
-#define ftruncate ftruncate64
-#endif /* _FILE_OFFSET_BITS_SET_FTRUNCATE */
-#endif /* _FILE_OFFSET_BITS_SET_FTRUNCATE */
-
 #ifndef _CRT_SWAB_DEFINED
 #define _CRT_SWAB_DEFINED /* Also in stdlib.h */
   void __cdecl swab(char *_Buf1,char *_Buf2,int _SizeInBytes) 
__MINGW_ATTRIB_DEPRECATED_MSVC2005;
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to