Commit 3ecaae52 by Paolo Carlini Committed by Paolo Carlini

PR libstdc++/38365 (cont)

2008-12-02  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/38365 (cont)
	* src/localename.cc (locale::locale(const locale&, const locale&,
	category)): Revert last changes.
	* src/localename.cc (locale::_Impl::_M_replace_categories(const
	_Impl*, category)): Fix here instead; rework.

From-SVN: r142358
parent 84cfdcb3
2008-12-02 Paolo Carlini <paolo.carlini@oracle.com> 2008-12-02 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/38365 (cont)
* src/localename.cc (locale::locale(const locale&, const locale&,
category)): Revert last changes.
* src/localename.cc (locale::_Impl::_M_replace_categories(const
_Impl*, category)): Fix here instead; rework.
2008-12-02 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/38365 PR libstdc++/38365
* src/localename.cc (locale::locale(const locale&, const locale&, * src/localename.cc (locale::locale(const locale&, const locale&,
category)): Fix. category)): Fix.
......
...@@ -157,14 +157,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -157,14 +157,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
locale::locale(const locale& __base, const locale& __add, category __cat) locale::locale(const locale& __base, const locale& __add, category __cat)
: _M_impl(0) : _M_impl(0)
{ { _M_coalesce(__base, __add, __cat); }
_M_coalesce(__base, __add, __cat);
if (!__base._M_impl->_M_names[0] || !__add._M_impl->_M_names[0])
{
delete [] _M_impl->_M_names[0];
_M_impl->_M_names[0] = 0; // Unnamed.
}
}
void void
locale::_M_coalesce(const locale& __base, const locale& __add, locale::_M_coalesce(const locale& __base, const locale& __add,
...@@ -274,15 +267,22 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -274,15 +267,22 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_replace_categories(const _Impl* __imp, category __cat) _M_replace_categories(const _Impl* __imp, category __cat)
{ {
category __mask = 1; category __mask = 1;
const bool __have_names = _M_names[0] && __imp->_M_names[0]; if (!_M_names[0] || !__imp->_M_names[0])
{
if (_M_names[0])
{
delete [] _M_names[0];
_M_names[0] = 0; // Unnamed.
}
for (size_t __ix = 0; __ix < _S_categories_size; ++__ix, __mask <<= 1) for (size_t __ix = 0; __ix < _S_categories_size; ++__ix, __mask <<= 1)
{ {
if (__mask & __cat) if (__mask & __cat)
{
// Need to replace entry in _M_facets with other locale's info. // Need to replace entry in _M_facets with other locale's info.
_M_replace_category(__imp, _S_facet_categories[__ix]); _M_replace_category(__imp, _S_facet_categories[__ix]);
// If both have names, go ahead and mangle. }
if (__have_names) }
else
{ {
if (!_M_names[1]) if (!_M_names[1])
{ {
...@@ -298,6 +298,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -298,6 +298,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
} }
} }
for (size_t __ix = 0; __ix < _S_categories_size; ++__ix, __mask <<= 1)
{
if (__mask & __cat)
{
// Need to replace entry in _M_facets with other locale's info.
_M_replace_category(__imp, _S_facet_categories[__ix]);
// FIXME: Hack for libstdc++/29217: the numerical encodings // FIXME: Hack for libstdc++/29217: the numerical encodings
// of the time and collate categories are swapped vs the // of the time and collate categories are swapped vs the
// order of the names in locale::_S_categories. We'd like to // order of the names in locale::_S_categories. We'd like to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment