@@ -26,6 +26,7 @@
// ISO C++ 14882: 27.8 File-based streams
//
+#include <bits/largefile-config.h>
#include <bits/basic_file.h>
#include <fcntl.h>
#include <errno.h>
@@ -251,11 +252,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const char* __c_mode = fopen_mode(__mode);
if (__c_mode && !this->is_open())
{
-#ifdef _GLIBCXX_USE_LFS
- if ((_M_cfile = fopen64(__name, __c_mode)))
-#else
if ((_M_cfile = fopen(__name, __c_mode)))
-#endif
{
_M_cfile_created = true;
__ret = this;
@@ -389,8 +386,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
# else
return ftell(__f->file());
# endif
-#elif defined(_GLIBCXX_USE_LFS)
- return lseek64(__f->fd(), 0, (int)ios_base::cur);
#else
return lseek(__f->fd(), 0, (int)ios_base::cur);
#endif
@@ -417,11 +412,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return -1;
}
return __way == ios_base::beg ? __off : std::get_file_offset(this);
-#elif defined(_GLIBCXX_USE_LFS)
- return lseek64(this->fd(), __off, __way);
#else
- if (__off > numeric_limits<off_t>::max()
- || __off < numeric_limits<off_t>::min())
+ if _GLIBCXX17_CONSTEXPR (sizeof(streamoff) > sizeof(off_t))
+ if (__off > numeric_limits<off_t>::max()
+ || __off < numeric_limits<off_t>::min())
return -1L;
return lseek(this->fd(), __off, __way);
#endif
@@ -455,20 +449,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if defined(_GLIBCXX_HAVE_S_ISREG) || defined(_GLIBCXX_HAVE_S_IFREG)
// Regular files.
-#ifdef _GLIBCXX_USE_LFS
- struct stat64 __buffer;
- const int __err = fstat64(this->fd(), &__buffer);
+ struct stat __buffer;
+ const int __err = fstat(this->fd(), &__buffer);
if (!__err && _GLIBCXX_ISREG(__buffer.st_mode))
{
const streamoff __off = __buffer.st_size - std::get_file_offset(this);
return std::min(__off, streamoff(numeric_limits<streamsize>::max()));
}
-#else
- struct stat __buffer;
- const int __err = fstat(this->fd(), &__buffer);
- if (!__err && _GLIBCXX_ISREG(__buffer.st_mode))
- return __buffer.st_size - std::get_file_offset(this);
-#endif
#endif
return 0;
}