diff options
author | dim <dim@FreeBSD.org> | 2013-04-27 22:47:52 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-04-27 22:47:52 +0000 |
commit | 815a6cc1e325a4e8596b91756039a7d699471b11 (patch) | |
tree | e5a6a26d0973c6968273f6fabb61cb3d624be555 /contrib/libc++/include/fstream | |
parent | 1497a98f71419ff66d08ad2b8c90530e65521ac2 (diff) | |
download | FreeBSD-src-815a6cc1e325a4e8596b91756039a7d699471b11.zip FreeBSD-src-815a6cc1e325a4e8596b91756039a7d699471b11.tar.gz |
Merge libc++ trunk r180598. Contains several minor cleanups and bug
fixes, no major changes.
MFC after: 2 weeks
Diffstat (limited to 'contrib/libc++/include/fstream')
-rw-r--r-- | contrib/libc++/include/fstream | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/contrib/libc++/include/fstream b/contrib/libc++/include/fstream index 1b8e7a0..e3f8306 100644 --- a/contrib/libc++/include/fstream +++ b/contrib/libc++/include/fstream @@ -180,7 +180,7 @@ typedef basic_fstream<wchar_t> wfstream; _LIBCPP_BEGIN_NAMESPACE_STD template <class _CharT, class _Traits> -class _LIBCPP_VISIBLE basic_filebuf +class _LIBCPP_TYPE_VIS basic_filebuf : public basic_streambuf<_CharT, _Traits> { public: @@ -807,9 +807,15 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, default: return pos_type(off_type(-1)); } +#if _WIN32 + 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 __r.state(__st_); return __r; } @@ -820,8 +826,13 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode) { if (__file_ == 0 || sync()) return pos_type(off_type(-1)); +#if _WIN32 + if (fseek(__file_, __sp, SEEK_SET)) + return pos_type(off_type(-1)); +#else if (fseeko(__file_, __sp, SEEK_SET)) return pos_type(off_type(-1)); +#endif __st_ = __sp.state(); return __sp; } @@ -880,8 +891,13 @@ basic_filebuf<_CharT, _Traits>::sync() } } } +#if _WIN32 + if (fseek(__file_, -__c, SEEK_CUR)) + return -1; +#else if (fseeko(__file_, -__c, SEEK_CUR)) return -1; +#endif if (__update_st) __st_ = __state; __extbufnext_ = __extbufend_ = __extbuf_; @@ -978,7 +994,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode() // basic_ifstream template <class _CharT, class _Traits> -class _LIBCPP_VISIBLE basic_ifstream +class _LIBCPP_TYPE_VIS basic_ifstream : public basic_istream<_CharT, _Traits> { public: @@ -1123,7 +1139,7 @@ basic_ifstream<_CharT, _Traits>::close() // basic_ofstream template <class _CharT, class _Traits> -class _LIBCPP_VISIBLE basic_ofstream +class _LIBCPP_TYPE_VIS basic_ofstream : public basic_ostream<_CharT, _Traits> { public: @@ -1268,7 +1284,7 @@ basic_ofstream<_CharT, _Traits>::close() // basic_fstream template <class _CharT, class _Traits> -class _LIBCPP_VISIBLE basic_fstream +class _LIBCPP_TYPE_VIS basic_fstream : public basic_iostream<_CharT, _Traits> { public: |