aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits/locale_conv.h
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-22 15:09:22 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-22 15:09:22 +0000
commitce3ddd15d55dd68999fa4055f191712cedc8cfac (patch)
tree4c733b0c0e0eedd1fbcf50e1a05b7775d73f855a /libstdc++-v3/include/bits/locale_conv.h
parent3cc0c1c5322271672ee3c4b7a8176ab9074bb991 (diff)
* include/bits/locale_conv.h (__do_str_codecvt): Handle empty range.
(wstring_convert): Move into __cxx11 namespace. (wbuffer_convert(streambuf*, _Codecvt*, state_type)): Fix exception message. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224737 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/locale_conv.h')
-rw-r--r--libstdc++-v3/include/bits/locale_conv.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/libstdc++-v3/include/bits/locale_conv.h b/libstdc++-v3/include/bits/locale_conv.h
index 61b535c57de..fd99499b8f6 100644
--- a/libstdc++-v3/include/bits/locale_conv.h
+++ b/libstdc++-v3/include/bits/locale_conv.h
@@ -58,6 +58,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_OutStr& __outstr, const _Codecvt& __cvt, _State& __state,
size_t& __count, _Fn __fn)
{
+ if (__first == __last)
+ {
+ __outstr.clear();
+ return true;
+ }
+
size_t __outchars = 0;
auto __next = __first;
const auto __maxlen = __cvt.max_length() + 1;
@@ -150,6 +156,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __str_codecvt_out(__first, __last, __outstr, __cvt, __state, __n);
}
+_GLIBCXX_BEGIN_NAMESPACE_CXX11
+
/// String conversions
template<typename _Codecvt, typename _Elem = wchar_t,
typename _Wide_alloc = allocator<_Elem>,
@@ -301,6 +309,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool _M_with_strings = false;
};
+_GLIBCXX_END_NAMESPACE_CXX11
+
/// Buffer conversions
template<typename _Codecvt, typename _Elem = wchar_t,
typename _Tr = char_traits<_Elem>>
@@ -325,7 +335,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: _M_buf(__bytebuf), _M_cvt(__pcvt), _M_state(__state)
{
if (!_M_cvt)
- __throw_logic_error("wstring_convert");
+ __throw_logic_error("wbuffer_convert");
_M_always_noconv = _M_cvt->always_noconv();