summaryrefslogtreecommitdiff
path: root/libstdc++-v3/src
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-27 07:08:13 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-27 07:08:13 +0000
commit01335ba725cb49822f49ae953424823f42c86752 (patch)
tree79679cf8ed123d71683f6ad60841eb52eab0d5cd /libstdc++-v3/src
parent458caa241dc32254a638b0306465d91835864c86 (diff)
downloadgcc-01335ba725cb49822f49ae953424823f42c86752.tar.gz
2006-09-27 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29217 * src/localename.cc (locale::_Impl::_M_replace_categories)): Compensate for the inconsistent numerical encodings of the collate and time categories vs the corresponding names. * testsuite/22_locale/locale/cons/29217.cc: New. * testsuite/22_locale/locale/cons/2.cc: Enable and split out the few ENC_TRAITS bits to... * testsuite/22_locale/locale/cons/unicode/1.cc... here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117247 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r--libstdc++-v3/src/localename.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc
index e1a111465c2..ff8c369ce11 100644
--- a/libstdc++-v3/src/localename.cc
+++ b/libstdc++-v3/src/localename.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -288,13 +288,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
std::memcpy(_M_names[__i], _M_names[0], __len);
}
}
- char* __src = __imp->_M_names[__ix] ? __imp->_M_names[__ix]
- : __imp->_M_names[0];
+
+ // FIXME: Hack for libstdc++/29217: the numerical encodings
+ // of the time and collate categories are swapped vs the
+ // order of the names in locale::_S_categories. We'd like to
+ // adjust the former (the latter is dictated by compatibility
+ // with glibc) but we can't for binary compatibility.
+ size_t __ix_name = __ix;
+ if (__ix == 2 || __ix == 3)
+ __ix_name = 5 - __ix;
+
+ char* __src = __imp->_M_names[__ix_name] ?
+ __imp->_M_names[__ix_name] : __imp->_M_names[0];
const size_t __len = std::strlen(__src) + 1;
char* __new = new char[__len];
std::memcpy(__new, __src, __len);
- delete [] _M_names[__ix];
- _M_names[__ix] = __new;
+ delete [] _M_names[__ix_name];
+ _M_names[__ix_name] = __new;
}
}
}