From 68fda0e9b74dfa94914e5bd0cd7dc239dc4b7ad2 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 7 Jan 2004 11:57:35 +0000 Subject: [PATCH] re PR libstdc++/13007 (basic_streambuf::pubimbue, imbue wrong) 2004-01-07 Paolo Carlini Petur Runolfsson PR libstdc++/13007 * include/bits/fstream.tcc (imbue): Don't touch the stored locale. * include/std/std_streambuf.h (imbue): According to the standard, base class version does nothing. (pubimbue): Store the locale. Co-Authored-By: Petur Runolfsson From-SVN: r75502 --- libstdc++-v3/ChangeLog | 10 ++++++++++ libstdc++-v3/include/bits/fstream.tcc | 15 ++------------- libstdc++-v3/include/std/std_streambuf.h | 13 ++++++------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 34270813ca01..cac5d6285a76 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2004-01-07 Paolo Carlini + Petur Runolfsson + + PR libstdc++/13007 + * include/bits/fstream.tcc (imbue): Don't touch the stored + locale. + * include/std/std_streambuf.h (imbue): According to the + standard, base class version does nothing. + (pubimbue): Store the locale. + 2003-12-10 Benjamin Kosnik PR libstdc++/6243 diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc index 1efeaab470e6..8727acbc440c 100644 --- a/libstdc++-v3/include/bits/fstream.tcc +++ b/libstdc++-v3/include/bits/fstream.tcc @@ -506,19 +506,8 @@ namespace std template void basic_filebuf<_CharT, _Traits>:: - imbue(const locale& __loc) - { - bool __testbeg = gptr() == eback() && pptr() == pbase(); - - if (__testbeg && _M_buf_locale != __loc) - _M_buf_locale = __loc; - - // NB this may require the reconversion of previously - // converted chars. This in turn may cause the reconstruction - // of the original file. YIKES!! - // XXX The part in the above comment is not done. - _M_last_overflowed = false; - } + imbue(const locale&) + { _M_last_overflowed = false; } // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. diff --git a/libstdc++-v3/include/std/std_streambuf.h b/libstdc++-v3/include/std/std_streambuf.h index a1958c1a8e7c..d058459a65fe 100644 --- a/libstdc++-v3/include/std/std_streambuf.h +++ b/libstdc++-v3/include/std/std_streambuf.h @@ -379,6 +379,7 @@ namespace std { locale __tmp(this->getloc()); this->imbue(__loc); + _M_buf_locale = __loc; return __tmp; } @@ -688,15 +689,13 @@ namespace std * are changed by this call. The standard adds, "Between invocations * of this function a class derived from streambuf can safely cache * results of calls to locale functions and to members of facets - * so obtained." This function simply stores the new locale for use - * by derived classes. + * so obtained." + * + * @note Base class version does nothing. */ virtual void - imbue(const locale& __loc) - { - if (_M_buf_locale != __loc) - _M_buf_locale = __loc; - } + imbue(const locale&) + { } // [27.5.2.4.2] buffer management and positioning /** -- 2.47.2