diff options
author | dim <dim@FreeBSD.org> | 2012-10-22 18:25:04 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-10-22 18:25:04 +0000 |
commit | 708d8e446e991358da23bb52ec5320440221f12f (patch) | |
tree | 3a061d75674cd5b60d9f6df45d0b8d755da3782f /contrib/libc++/include/locale | |
parent | b8c74d455d2690e710a0802a98a9d310995a52eb (diff) | |
parent | 13334223d751d249ccd6475b8cba36ff71ddc972 (diff) | |
download | FreeBSD-src-708d8e446e991358da23bb52ec5320440221f12f.zip FreeBSD-src-708d8e446e991358da23bb52ec5320440221f12f.tar.gz |
Import libc++ trunk r165949. Among other improvements and bug fixes,
this has many visibility problems fixed, which should help with
compiling certain ports that exercise C++11 mode (i.e. Firefox).
Also, belatedly add the LICENSE.TXT and accompanying CREDITS.TXT files,
which are referred to in all the source files.
MFC after: 1 month
Diffstat (limited to 'contrib/libc++/include/locale')
-rw-r--r-- | contrib/libc++/include/locale | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/contrib/libc++/include/locale b/contrib/libc++/include/locale index bec27f6..0d77a4a 100644 --- a/contrib/libc++/include/locale +++ b/contrib/libc++/include/locale @@ -1587,6 +1587,52 @@ __pad_and_output(_OutputIterator __s, return __s; } +template <class _CharT, class _Traits> +_LIBCPP_HIDDEN +ostreambuf_iterator<_CharT, _Traits> +__pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s, + const _CharT* __ob, const _CharT* __op, const _CharT* __oe, + ios_base& __iob, _CharT __fl) +{ + if (__s.__sbuf_ == nullptr) + return __s; + streamsize __sz = __oe - __ob; + streamsize __ns = __iob.width(); + if (__ns > __sz) + __ns -= __sz; + else + __ns = 0; + streamsize __np = __op - __ob; + if (__np > 0) + { + if (__s.__sbuf_->sputn(__ob, __np) != __np) + { + __s.__sbuf_ = nullptr; + return __s; + } + } + if (__ns > 0) + { + basic_string<_CharT, _Traits> __sp(__ns, __fl); + if (__s.__sbuf_->sputn(__sp.data(), __ns) != __ns) + { + __s.__sbuf_ = nullptr; + return __s; + } + } + __np = __oe - __op; + if (__np > 0) + { + if (__s.__sbuf_->sputn(__op, __np) != __np) + { + __s.__sbuf_ = nullptr; + return __s; + } + } + __iob.width(0); + return __s; +} + template <class _CharT, class _OutputIterator> _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, @@ -3920,7 +3966,8 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: if (__cvtptr_ != nullptr) { wide_string __ws(2*(__frm_end - __frm), _Elem()); - __ws.resize(__ws.capacity()); + if (__frm != __frm_end) + __ws.resize(__ws.capacity()); codecvt_base::result __r = codecvt_base::ok; state_type __st = __cvtstate_; if (__frm != __frm_end) @@ -3980,7 +4027,8 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: if (__cvtptr_ != nullptr) { byte_string __bs(2*(__frm_end - __frm), char()); - __bs.resize(__bs.capacity()); + if (__frm != __frm_end) + __bs.resize(__bs.capacity()); codecvt_base::result __r = codecvt_base::ok; state_type __st = __cvtstate_; if (__frm != __frm_end) |