[PATCH] Use fseek/ftell instead of fseeko/ftello when Newlib is the libc
Jonathan Roelofs
jonathan at codesourcery.com
Thu Dec 11 13:36:50 PST 2014
Fix defined(_WIN32)'s, and this time with more context.
http://reviews.llvm.org/D6626
Files:
include/fstream
include/iosfwd
Index: include/fstream
===================================================================
--- include/fstream
+++ include/fstream
@@ -807,7 +807,7 @@
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 @@
{
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 @@
}
}
}
-#if _WIN32
+#if defined(_WIN32) || defined(_NEWLIB_VERSION)
if (fseek(__file_, -__c, SEEK_CUR))
return -1;
#else
Index: include/iosfwd
===================================================================
--- include/iosfwd
+++ include/iosfwd
@@ -180,7 +180,11 @@
typedef fpos<mbstate_t> u32streampos;
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+#if defined(_NEWLIB_VERSION)
+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>,
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6626.17190.patch
Type: text/x-patch
Size: 1386 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141211/0f3ae759/attachment.bin>
More information about the cfe-commits
mailing list