From c15892e05ec3cd0c2d1fe985db27c02107bed438 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Sun, 10 Mar 2002 23:51:31 +0000 Subject: [PATCH] locale_facets.tcc (time_put::do_put): Consider sizeof(char_type) in allocating the buffer. 2002-03-10 Paolo Carlini * include/bits/locale_facets.tcc (time_put::do_put): Consider sizeof(char_type) in allocating the buffer. * include/bits/locale_facets.tcc (collate::do_tranform): Remove redundant variable. From-SVN: r50553 --- libstdc++-v3/ChangeLog | 20 ++++++++++++++------ libstdc++-v3/include/bits/locale_facets.tcc | 8 +++++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 0ed3aa3116e..7cdebce569f 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,12 +1,20 @@ +2002-03-10 Paolo Carlini + + * include/bits/locale_facets.tcc (time_put::do_put): + Consider sizeof(char_type) in allocating the buffer. + + * include/bits/locale_facets.tcc (collate::do_tranform): + Remove redundant variable. + 2002-03-10 Ulrich Drepper Paolo Carlini - * config/locale/generic/collate_members.cc - (collate::_M_compare_helper): normalize - values returned by strcoll and wcscoll. - * config/locale/gnu/collate_members.cc - (collate::_M_compare_helper): ditto - for __strcoll_l and __wcscoll_l. + * config/locale/generic/collate_members.cc + (collate::_M_compare_helper): normalize + values returned by strcoll and wcscoll. + * config/locale/gnu/collate_members.cc + (collate::_M_compare_helper): ditto + for __strcoll_l and __wcscoll_l. 2002-03-10 Anthony Green diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index 90bb221c56c..37ad6b348cb 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -1795,7 +1795,8 @@ namespace std // NB: This size is arbitrary. Should this be a data member, // initialized at construction? const size_t __maxlen = 64; - char_type* __res = static_cast(__builtin_alloca(__maxlen)); + char_type* __res = + static_cast(__builtin_alloca(sizeof(char_type) * __maxlen)); // NB: In IEE 1003.1-200x, and perhaps other locale models, it // is possible that the format character will be longer than one @@ -1856,14 +1857,15 @@ namespace std { size_t __len = (__hi - __lo) * 2; // First try a buffer perhaps big enough. - _CharT* __c = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __len)); + _CharT* __c = + static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * __len)); size_t __res = _M_transform_helper(__c, __lo, __len); // If the buffer was not large enough, try again with the correct size. if (__res >= __len) { _CharT* __c2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) * (__res + 1))); - size_t __res2 = _M_transform_helper(__c2, __lo, __res + 1); + _M_transform_helper(__c2, __lo, __res + 1); return string_type(__c2); } return string_type(__c); -- 2.30.2