diff options
author | Howard Hinnant <hhinnant@apple.com> | 2012-08-24 20:37:00 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2012-08-24 20:37:00 +0000 |
commit | 49a37bbb9ffa1a74db62d222a7d02c64b0d9588d (patch) | |
tree | 9b737c3a7ecbe8951a52dd8b1bf7a3dfb873d0b8 | |
parent | e8e4ef102df2ef3cce07e44e2ca34d80c7287f17 (diff) | |
download | bcm5719-llvm-49a37bbb9ffa1a74db62d222a7d02c64b0d9588d.tar.gz bcm5719-llvm-49a37bbb9ffa1a74db62d222a7d02c64b0d9588d.zip |
Fix basic_filebuf's internal buffer is shrinking when using with some codecvt. http://llvm.org/bugs/show_bug.cgi?id=13602
llvm-svn: 162585
-rw-r--r-- | libcxx/include/fstream | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libcxx/include/fstream b/libcxx/include/fstream index 83731a1a16d..aa78d85f3d6 100644 --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -596,7 +596,7 @@ basic_filebuf<_CharT, _Traits>::underflow() memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); - size_t __nmemb = _VSTD::min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz), + size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz), static_cast<size_t>(__extbufend_ - __extbufnext_)); codecvt_base::result __r; state_type __svs = __st_; @@ -611,7 +611,7 @@ basic_filebuf<_CharT, _Traits>::underflow() char_type* __inext; __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_, this->eback() + __unget_sz, - this->egptr(), __inext); + this->eback() + __ibs_, __inext); if (__r == codecvt_base::noconv) { this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_); @@ -816,6 +816,7 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode) return pos_type(off_type(-1)); if (fseeko(__file_, __sp, SEEK_SET)) return pos_type(off_type(-1)); + __st_ = __sp.state; return __sp; } |