[libcxx-commits] [libcxx] [libcxx] Use _ftelli64/_fseeki64 on Windows (PR #123128)
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Aug 13 22:30:31 PDT 2026
================
@@ -936,31 +933,42 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
default:
return pos_type(off_type(-1));
}
-# if !_LIBCPP_HAS_OFF_T_FUNCTIONS
- if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
+ if (__fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
return pos_type(off_type(-1));
- pos_type __r = ftell(__file_);
-# else
- if (::fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
- return pos_type(off_type(-1));
- pos_type __r = ftello(__file_);
-# endif
+ pos_type __r = __ftell(__file_);
__r.state(__st_);
return __r;
}
+template <class _CharT, class _Traits>
+int basic_filebuf<_CharT, _Traits>::__fseek(FILE* __file, pos_type __offset, int __whence) {
+# if defined(_LIBCPP_MSVCRT_LIKE)
+ return _fseeki64(__file, __offset, __whence);
+# elif defined(_NEWLIB_VERSION)
+ return fseek(__file, __offset, __whence);
+# else
+ return ::fseeko(__file, __offset, __whence);
----------------
mstorsjo wrote:
The assymmetry was there before this change as well, so if you want to dig into that, you'd have to dig further. But I'm not sure if there's any specific reason for not using `::` on the other symbols as well.
https://github.com/llvm/llvm-project/pull/123128
More information about the libcxx-commits
mailing list