diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:18:58 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:18:58 +0000 |
commit | 53a420fba21cf1644972b34dcd811a43cdb8368d (patch) | |
tree | 66a19f6f8b65215772549a51d688492ab8addc0d /include/fstream | |
parent | b50f1549701eb950921e5d6f2e55ba1a1dadbb43 (diff) | |
download | src-53a420fba21cf1644972b34dcd811a43cdb8368d.tar.gz src-53a420fba21cf1644972b34dcd811a43cdb8368d.zip |
Vendor import of libc++ trunk r290819:vendor/libc++/libc++-trunk-r290819
Notes
Notes:
svn path=/vendor/libc++/dist/; revision=311123
svn path=/vendor/libc++/libc++-trunk-r290819/; revision=311124; tag=vendor/libc++/libc++-trunk-r290819
Diffstat (limited to 'include/fstream')
-rw-r--r-- | include/fstream | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/include/fstream b/include/fstream index 3cb3b13bd10f..b8d18aadb1c9 100644 --- a/include/fstream +++ b/include/fstream @@ -618,10 +618,9 @@ basic_filebuf<_CharT, _Traits>::underflow() size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_); if (__nr != 0) { -#ifndef _LIBCPP_NO_EXCEPTIONS if (!__cv_) - throw bad_cast(); -#endif + __throw_bad_cast(); + __extbufend_ = __extbufnext_ + __nr; char_type* __inext; __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_, @@ -700,10 +699,9 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c) codecvt_base::result __r; do { -#ifndef _LIBCPP_NO_EXCEPTIONS if (!__cv_) - throw bad_cast(); -#endif + __throw_bad_cast(); + const char_type* __e; __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, __extbuf_, __extbuf_ + __ebs_, __extbe); @@ -793,10 +791,9 @@ typename basic_filebuf<_CharT, _Traits>::pos_type basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode) { -#ifndef _LIBCPP_NO_EXCEPTIONS if (!__cv_) - throw bad_cast(); -#endif + __throw_bad_cast(); + int __width = __cv_->encoding(); if (__file_ == 0 || (__width <= 0 && __off != 0) || sync()) return pos_type(off_type(-1)); @@ -816,7 +813,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, default: return pos_type(off_type(-1)); } -#if defined(_WIN32) || defined(_NEWLIB_VERSION) +#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence)) return pos_type(off_type(-1)); pos_type __r = ftell(__file_); @@ -835,7 +832,7 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode) { if (__file_ == 0 || sync()) return pos_type(off_type(-1)); -#if defined(_WIN32) || defined(_NEWLIB_VERSION) +#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) if (fseek(__file_, __sp, SEEK_SET)) return pos_type(off_type(-1)); #else @@ -852,10 +849,9 @@ basic_filebuf<_CharT, _Traits>::sync() { if (__file_ == 0) return 0; -#ifndef _LIBCPP_NO_EXCEPTIONS if (!__cv_) - throw bad_cast(); -#endif + __throw_bad_cast(); + if (__cm_ & ios_base::out) { if (this->pptr() != this->pbase()) @@ -900,7 +896,7 @@ basic_filebuf<_CharT, _Traits>::sync() } } } -#if defined(_WIN32) || defined(_NEWLIB_VERSION) +#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS) if (fseek(__file_, -__c, SEEK_CUR)) return -1; #else |