mingw-w64 implementation of ftello64() and _ftelli64() functions are same.

So remove the ftello64 implementation and define ftello64 symbol as an
alias to the _ftelli64 symbol.

This change allows to use native msvcr80+ / UCRT implementation of
_ftelli64() function for the POSIX ftello64() instead of statically linking
the mingw-w64 implementation.
---
 mingw-w64-crt/Makefile.am                        |  2 +-
 mingw-w64-crt/def-include/crt-aliases.def.in     |  1 +
 .../lib-common/api-ms-win-crt-stdio-l1-1-0.def   |  1 +
 mingw-w64-crt/stdio/_ftelli64.c                  |  3 +++
 mingw-w64-crt/stdio/ftello64.c                   | 16 ----------------
 5 files changed, 6 insertions(+), 17 deletions(-)
 delete mode 100644 mingw-w64-crt/stdio/ftello64.c

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index d6576bb7320a..00d03690c443 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -1114,7 +1114,7 @@ src_libmingwex=\
   stdio/_Exit.c            stdio/_findfirst64i32.c   stdio/_findnext64i32.c   
stdio/_wfindfirst64i32.c  stdio/_wfindnext64i32.c \
   stdio/asprintf.c \
   stdio/fopen64.c                                                              
                                                 \
-  stdio/ftello64.c         stdio/ftruncate64.c       stdio/lltoa.c            
stdio/lltow.c             stdio/lseek64.c         \
+  stdio/ftruncate64.c      stdio/lltoa.c             stdio/lltow.c            
stdio/lseek64.c \
   stdio/__mingw_fix_stat_path.c stdio/__mingw_fix_wstat_path.c \
   \
   stdio/mingw_pformat.h    mingw_sformat.h           mingw_swformat.h \
diff --git a/mingw-w64-crt/def-include/crt-aliases.def.in 
b/mingw-w64-crt/def-include/crt-aliases.def.in
index b30e8ea64911..eb80f4511ec6 100644
--- a/mingw-w64-crt/def-include/crt-aliases.def.in
+++ b/mingw-w64-crt/def-include/crt-aliases.def.in
@@ -321,6 +321,7 @@ fstat64 == _fstat64
 #endif
 #ifndef FIXED_SIZE_SYMBOLS
 fseeko64 == _fseeki64
+ftello64 == _ftelli64
 #endif
 
 ; This is list of symbol aliases for GNU functions which are not part of POSIX 
or ISO C
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def 
b/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def
index 38bd1aa819f4..f22ad052eb39 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def
@@ -68,6 +68,7 @@ _fseeki64_nolock
 _fsopen
 _ftell_nolock
 _ftelli64
+ftello64 == _ftelli64
 _ftelli64_nolock
 _fwrite_nolock
 _get_fmode
diff --git a/mingw-w64-crt/stdio/_ftelli64.c b/mingw-w64-crt/stdio/_ftelli64.c
index c1390994166c..b2589c5b252f 100644
--- a/mingw-w64-crt/stdio/_ftelli64.c
+++ b/mingw-w64-crt/stdio/_ftelli64.c
@@ -17,3 +17,6 @@ __int64 __cdecl _ftelli64(FILE* stream)
 }
 
 __int64 __cdecl (*__MINGW_IMP_SYMBOL(_ftelli64))(FILE*) = _ftelli64;
+
+_off64_t __attribute__ ((alias ("_ftelli64"))) __cdecl ftello64(FILE*);
+extern _off64_t __attribute__ ((alias 
(__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(_ftelli64))))) (__cdecl 
*__MINGW_IMP_SYMBOL(ftello64))(FILE*);
diff --git a/mingw-w64-crt/stdio/ftello64.c b/mingw-w64-crt/stdio/ftello64.c
deleted file mode 100644
index a0192fbe6d4c..000000000000
--- a/mingw-w64-crt/stdio/ftello64.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is part of the mingw-w64 runtime package.
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
- */
-#include <stdio.h>
-
-_off64_t
-ftello64 (FILE * stream)
-{
-  fpos_t pos;
-  if (fgetpos(stream, &pos))
-    return  -1LL;
-  else
-   return ((off64_t) pos);
-}
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to