GCC Bugzilla – Attachment 5114 Details for
Bug 13007
basic_streambuf::pubimbue, imbue wrong
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Draft patch (without new testsuite entry)
patch_13007_draft (text/plain), 3.43 KB, created by
Paolo Carlini
on 2003-11-11 13:22:04 UTC
(
hide
)
Description:
Draft patch (without new testsuite entry)
Filename:
MIME Type:
Creator:
Paolo Carlini
Created:
2003-11-11 13:22:04 UTC
Size:
3.43 KB
patch
obsolete
>diff -urN libstdc++-v3-orig/include/bits/fstream.tcc libstdc++-v3/include/bits/fstream.tcc >--- libstdc++-v3-orig/include/bits/fstream.tcc 2003-11-04 06:27:37.000000000 +0100 >+++ libstdc++-v3/include/bits/fstream.tcc 2003-11-11 13:13:47.000000000 +0100 >@@ -749,7 +749,7 @@ > basic_filebuf<_CharT, _Traits>:: > imbue(const locale& __loc) > { >- if (this->_M_buf_locale != __loc) >+ if (this->getloc() != __loc) > { > bool __testfail = false; > if (this->is_open()) >@@ -765,7 +765,6 @@ > > if (!__testfail) > { >- this->_M_buf_locale = __loc; > if (__builtin_expect(has_facet<__codecvt_type>(__loc), true)) > _M_codecvt = &use_facet<__codecvt_type>(__loc); > else >diff -urN libstdc++-v3-orig/include/std/std_streambuf.h libstdc++-v3/include/std/std_streambuf.h >--- libstdc++-v3-orig/include/std/std_streambuf.h 2003-10-12 12:12:08.000000000 +0200 >+++ libstdc++-v3/include/std/std_streambuf.h 2003-11-11 13:19:58.000000000 +0100 >@@ -200,6 +200,8 @@ > { > locale __tmp(this->getloc()); > this->imbue(__loc); >+ if (__tmp != __loc) >+ _M_buf_locale = __loc; > return __tmp; > } > >@@ -538,15 +540,13 @@ > * 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 > /** >diff -urN libstdc++-v3-orig/testsuite/27_io/basic_filebuf/imbue/char/2.cc libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/2.cc >--- libstdc++-v3-orig/testsuite/27_io/basic_filebuf/imbue/char/2.cc 2003-09-23 22:02:54.000000000 +0200 >+++ libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/2.cc 2003-11-11 14:10:27.000000000 +0100 >@@ -41,10 +41,12 @@ > pos_type p = ob.pubseekoff(2, ios_base::beg, ios_base::in); > VERIFY( p != bad); > >- // 1 "if file is not positioned at its beginning" fails... >+ // "if file is not positioned at its beginning" imbue fails >+ // but, according to 27.5.2.2.1, p1, still loc == getloc() >+ // after pubimbue(loc). > locale loc_de = __gnu_test::try_named_locale("de_DE"); > locale ret = ob.pubimbue(loc_de); >- VERIFY( ob.getloc() == loc ); >+ VERIFY( ob.getloc() == loc_de ); > } > > int main() >diff -urN libstdc++-v3-orig/testsuite/27_io/basic_filebuf/imbue/wchar_t/2.cc libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/2.cc >--- libstdc++-v3-orig/testsuite/27_io/basic_filebuf/imbue/wchar_t/2.cc 2003-09-23 22:02:54.000000000 +0200 >+++ libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/2.cc 2003-11-11 14:10:50.000000000 +0100 >@@ -41,10 +41,12 @@ > pos_type p = ob.pubseekoff(2, ios_base::beg, ios_base::in); > VERIFY( p != bad); > >- // 1 "if file is not positioned at its beginning" fails... >+ // "if file is not positioned at its beginning" imbue fails >+ // but, according to 27.5.2.2.1, p1, still loc == getloc() >+ // after pubimbue(loc). > locale loc_de = __gnu_test::try_named_locale("de_DE"); > locale ret = ob.pubimbue(loc_de); >- VERIFY( ob.getloc() == loc ); >+ VERIFY( ob.getloc() == loc_de ); > } > > int main()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 13007
:
5113
| 5114