diff options
author | Paolo Carlini <pcarlini@unitus.it> | 2003-02-01 17:37:20 +0100 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2003-02-01 16:37:20 +0000 |
commit | 064994a3f25f1c2ff8462ed81f513b50d7d1a1b0 (patch) | |
tree | acb5e18efe0ce7f8e02ae5ae9c902a43ad4bcf8d /libstdc++-v3/src/localename.cc | |
parent | 434c87d422b306c985a1c4e67ebba27d24bd50b7 (diff) | |
download | gcc-064994a3f25f1c2ff8462ed81f513b50d7d1a1b0.tar.gz |
Const correctness issue: http://gcc.gnu.org/ml/libstdc++/2003-01/msg00370.html
2003-02-01 Paolo Carlini <pcarlini@unitus.it>
Benjamin Kosnik <bkoz@redhat.com>
Const correctness issue:
http://gcc.gnu.org/ml/libstdc++/2003-01/msg00370.html
* include/bits/locale_classes.h
(locale::_Impl::_M_facets): Change type to const facet**.
(locale::_Impl::_M_install_facet): Change declaration to
take const facet*.
(locale::facet::_M_references): Make mutable.
(locale::facet::_M_add_reference): Declare const.
(locale::facet::_M_remove_reference): Likewise.
* include/bits/locale_facets.tcc
(use_facet(const locale&)): Tweak for const facet** _M_facets.
(has_facet(const locale&)): Likewise.
* src/locale.cc
(locale::facet::_M_add_reference): Adjust definition.
(locale::facet::_M_remove_reference): Likewise.
* src/localename.cc
(locale::_Impl::_Impl(const _Impl&, size_t)): Tweak for
const facet** _M_facets.
(locale::_Impl::_Impl(const char*, size_t)): Likewise.
(locale::_Impl::_Impl(facet**, size_t, bool)): Likewise.
(locale::_Impl::_M_install_facet): Adjust definition to take
const facet* and for const facet** _M_facets.
* testsuite/22_locale/locale/cons/8.cc: Add.
Co-Authored-By: Benjamin Kosnik <bkoz@redhat.com>
From-SVN: r62248
Diffstat (limited to 'libstdc++-v3/src/localename.cc')
-rw-r--r-- | libstdc++-v3/src/localename.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libstdc++-v3/src/localename.cc b/libstdc++-v3/src/localename.cc index 8a30b897f07..c9528d00c98 100644 --- a/libstdc++-v3/src/localename.cc +++ b/libstdc++-v3/src/localename.cc @@ -94,7 +94,7 @@ namespace std { try { - _M_facets = new facet*[_M_facets_size]; + _M_facets = new const facet*[_M_facets_size]; for (size_t __i = 0; __i < _M_facets_size; ++__i) _M_facets[__i] = 0; } @@ -130,7 +130,7 @@ namespace std try { - _M_facets = new facet*[_M_facets_size]; + _M_facets = new const facet*[_M_facets_size]; for (size_t __i = 0; __i < _M_facets_size; ++__i) _M_facets[__i] = 0; } @@ -214,7 +214,7 @@ namespace std locale::facet::_S_create_c_locale(locale::facet::_S_c_locale, locale::facet::_S_c_name); - _M_facets = new(&facet_vec) facet*[_M_facets_size]; + _M_facets = new(&facet_vec) const facet*[_M_facets_size]; for (size_t __i = 0; __i < _M_facets_size; ++__i) _M_facets[__i] = 0; @@ -310,7 +310,7 @@ namespace std void locale::_Impl:: - _M_install_facet(const locale::id* __idp, facet* __fp) + _M_install_facet(const locale::id* __idp, const facet* __fp) { if (__fp) { @@ -319,10 +319,10 @@ namespace std // Check size of facet vector to ensure adequate room. if (__index > _M_facets_size - 1) { - facet** __old = _M_facets; - facet** __new; + const facet** __old = _M_facets; + const facet** __new; const size_t __new_size = __index + 4; - __new = new facet*[__new_size]; + __new = new const facet*[__new_size]; for (size_t __i = 0; __i < _M_facets_size; ++__i) __new[__i] = _M_facets[__i]; for (size_t __i2 = _M_facets_size; __i2 < __new_size; ++__i2) @@ -334,7 +334,7 @@ namespace std } __fp->_M_add_reference(); - facet*& __fpr = _M_facets[__index]; + const facet*& __fpr = _M_facets[__index]; if (__fpr) { // Replacing an existing facet. Order matters. |