Revert: Revert r227804: Use fseek/ftell instead of fseeko/ftello when Newlib is the...
authorJonathan Roelofs <jonathan@codesourcery.com>
Tue, 3 Feb 2015 15:34:17 +0000 (15:34 +0000)
committerJonathan Roelofs <jonathan@codesourcery.com>
Tue, 3 Feb 2015 15:34:17 +0000 (15:34 +0000)
EricWF has updated the compilers on his buildbots. Hopefully they won't crash now.

llvm-svn: 227971

libcxx/include/fstream
libcxx/include/iosfwd

index 38778c6..ace5eb9 100644 (file)
@@ -807,7 +807,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
     default:
         return pos_type(off_type(-1));
     }
-#if _WIN32
+#if defined(_WIN32) || defined(_NEWLIB_VERSION)
     if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
         return pos_type(off_type(-1));
     pos_type __r = ftell(__file_);
@@ -826,7 +826,7 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
 {
     if (__file_ == 0 || sync())
         return pos_type(off_type(-1));
-#if _WIN32
+#if defined(_WIN32) || defined(_NEWLIB_VERSION)
     if (fseek(__file_, __sp, SEEK_SET))
         return pos_type(off_type(-1));
 #else
@@ -891,7 +891,7 @@ basic_filebuf<_CharT, _Traits>::sync()
                 }
             }
         }
-#if _WIN32
+#if defined(_WIN32) || defined(_NEWLIB_VERSION)
         if (fseek(__file_, -__c, SEEK_CUR))
             return -1;
 #else
index d24c227..eccfd34 100644 (file)
@@ -180,7 +180,12 @@ typedef fpos<mbstate_t>    u16streampos;
 typedef fpos<mbstate_t>    u32streampos;
 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
 
+#if defined(_NEWLIB_VERSION)
+// On newlib, off_t is 'long int'
+typedef long int streamoff;         // for char_traits in <string>
+#else
 typedef long long streamoff;        // for char_traits in <string>
+#endif
 
 template <class _CharT,             // for <stdexcept>
           class _Traits = char_traits<_CharT>,