File fseeki64.c provides two functions _fseeki64() and _ftelli64(). Function _fseeki64() is available in all CRT ARM versions, including system msvcrt.dll. For x86 versions, it is available since msvcr80.dll, for system msvcrt.dll it is disabled for backward compatibility. Function _ftelli64() is available since msvcr80.dll, and is not part of system msvcrt.dll.
Split this file fseeki64.c into two files _fseeki64.c and _ftelli64.c. And compile each just for import CRT libraries which do not have required function. ARM ifdef for _fseeki64 was replaced by not including it into ARM version of msvcrt.dll. --- mingw-w64-crt/Makefile.am | 7 +++-- .../stdio/{fseeki64.c => _fseeki64.c} | 14 --------- .../stdio/{fseeki64.c => _ftelli64.c} | 31 ------------------- 3 files changed, 5 insertions(+), 47 deletions(-) copy mingw-w64-crt/stdio/{fseeki64.c => _fseeki64.c} (72%) rename mingw-w64-crt/stdio/{fseeki64.c => _ftelli64.c} (36%) diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 6c1919eb9199..97ab3b4742cc 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -332,7 +332,7 @@ src_msvcrt=\ secapi/_vswprintf_p.c \ secapi/wmemcpy_s.c \ secapi/wmemmove_s.c \ - stdio/fseeki64.c \ + stdio/_ftelli64.c \ stdio/mingw_lock.c src_msvcrt_add_x86=\ @@ -509,6 +509,7 @@ src_msvcrt32=\ misc/wcstoimax.c \ misc/wcstoumax.c \ misc/wctob.c \ + stdio/_fseeki64.c \ stdio/_fstat64i32.c \ stdio/_scprintf.c \ stdio/_scwprintf.c \ @@ -561,6 +562,7 @@ src_msvcrt64=\ misc/wcrtomb.c \ misc/wcsnlen.c \ misc/wctob.c \ + stdio/_fseeki64.c \ string/wcstok.c # Files included in libmsvcrt-os.a (for msvcrt.dll) on arm32 @@ -783,8 +785,9 @@ src_pre_msvcr80=\ misc/wcrtomb.c \ misc/wcsnlen.c \ misc/wctob.c \ + stdio/_fseeki64.c \ stdio/_fstat64i32.c \ - stdio/fseeki64.c \ + stdio/_ftelli64.c \ stdio/mingw_lock.c \ string/wcstok.c diff --git a/mingw-w64-crt/stdio/fseeki64.c b/mingw-w64-crt/stdio/_fseeki64.c similarity index 72% copy from mingw-w64-crt/stdio/fseeki64.c copy to mingw-w64-crt/stdio/_fseeki64.c index f70062e39118..7b6ad552fba8 100644 --- a/mingw-w64-crt/stdio/fseeki64.c +++ b/mingw-w64-crt/stdio/_fseeki64.c @@ -7,7 +7,6 @@ #include <io.h> #include <errno.h> -#if !defined(__arm__) && !defined(__aarch64__) /* we have F_ARM_ANY(_fseeki64) in msvcrt.def.in */ int __cdecl _fseeki64(FILE* stream, __int64 offset, int whence) { fpos_t pos; @@ -35,16 +34,3 @@ int __cdecl _fseeki64(FILE* stream, __int64 offset, int whence) } int __cdecl (*__MINGW_IMP_SYMBOL(_fseeki64))(FILE*, __int64, int) = _fseeki64; -#endif /* !defined(__arm__) && !defined(__aarch64__) */ - -__int64 __cdecl _ftelli64(FILE* stream) -{ - fpos_t pos; - if (fgetpos (stream, &pos)) - return -1LL; - else - return (__int64) pos; -} - -__int64 __cdecl (*__MINGW_IMP_SYMBOL(_ftelli64))(FILE*) = _ftelli64; - diff --git a/mingw-w64-crt/stdio/fseeki64.c b/mingw-w64-crt/stdio/_ftelli64.c similarity index 36% rename from mingw-w64-crt/stdio/fseeki64.c rename to mingw-w64-crt/stdio/_ftelli64.c index f70062e39118..c1390994166c 100644 --- a/mingw-w64-crt/stdio/fseeki64.c +++ b/mingw-w64-crt/stdio/_ftelli64.c @@ -7,36 +7,6 @@ #include <io.h> #include <errno.h> -#if !defined(__arm__) && !defined(__aarch64__) /* we have F_ARM_ANY(_fseeki64) in msvcrt.def.in */ -int __cdecl _fseeki64(FILE* stream, __int64 offset, int whence) -{ - fpos_t pos; - if (whence == SEEK_CUR) - { - /* If stream is invalid, fgetpos sets errno. */ - if (fgetpos (stream, &pos)) - return (-1); - pos += (fpos_t) offset; - } - else if (whence == SEEK_END) - { - /* If writing, we need to flush before getting file length. */ - fflush (stream); - pos = (fpos_t) (_filelengthi64 (_fileno (stream)) + offset); - } - else if (whence == SEEK_SET) - pos = (fpos_t) offset; - else - { - errno = EINVAL; - return (-1); - } - return fsetpos (stream, &pos); -} - -int __cdecl (*__MINGW_IMP_SYMBOL(_fseeki64))(FILE*, __int64, int) = _fseeki64; -#endif /* !defined(__arm__) && !defined(__aarch64__) */ - __int64 __cdecl _ftelli64(FILE* stream) { fpos_t pos; @@ -47,4 +17,3 @@ __int64 __cdecl _ftelli64(FILE* stream) } __int64 __cdecl (*__MINGW_IMP_SYMBOL(_ftelli64))(FILE*) = _ftelli64; - -- 2.20.1 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public