+2003-01-23 Petur Runolfsson <peturr02@ru.is>
+
+ PR libstdc++/9322
+ * include/std/std_streambuf.h
+ (basic_streambuf::basic_streambuf,
+ basic_streambuf::~basic_streambuf,
+ basic_streambuf::getloc, basic_streambuf::imbue):
+ Remove _M_buf_locale_init use.
+ * include/bits/fstream.tcc (basic_filebuf::imbue): Likewise
+ * testsuite/27_io/filebuf_virtuals.cc (test08): Add.
+ * testsuite/27_io/streambuf_members.cc (test08): Add.
+ * testsuite/27_io/stringbuf_virtuals.cc (test08): Add.
+
2003-01-23 Benjamin Kosnik <bkoz@redhat.com>
* config/linker-map.gnu: Synch with 3_3-branch.
// File based streams -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
bool __testbeg = gptr() == eback() && pptr() == pbase();
if (__testbeg && _M_buf_locale != __loc)
- {
- _M_buf_locale = __loc;
- _M_buf_locale_init = true;
- }
+ _M_buf_locale = __loc;
// NB this may require the reconversion of previously
// converted chars. This in turn may cause the reconstruction
// Stream buffer classes -*- C++ -*-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
_M_buf_size = 0;
_M_buf_size_opt = 0;
_M_mode = ios_base::openmode(0);
- _M_buf_locale_init = false;
}
// Locales:
locale
getloc() const
- {
- if (_M_buf_locale_init)
- return _M_buf_locale;
- else
- return locale();
- }
+ { return _M_buf_locale; }
// Buffer and positioning:
__streambuf_type*
_M_buf_unified(false), _M_in_beg(0), _M_in_cur(0), _M_in_end(0),
_M_out_beg(0), _M_out_cur(0), _M_out_end(0),
_M_mode(ios_base::openmode(0)), _M_buf_locale(locale()),
- _M_buf_locale_init(false), _M_pback_cur_save(0), _M_pback_end_save(0),
+ _M_pback_cur_save(0), _M_pback_end_save(0),
_M_pback_init(false)
{ }
virtual void
imbue(const locale& __loc)
{
- _M_buf_locale_init = true;
if (_M_buf_locale != __loc)
_M_buf_locale = __loc;
}
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// 27.8.1.4 Overridden virtual functions
#include <fstream>
+#include <locale>
#include <testsuite_hooks.h>
// @require@ %-*.tst %-*.txt
VERIFY( buffer[0] == 'a' );
}
+// libstdc++/9322
+void test07()
+{
+ using std::locale;
+ bool test = true;
+
+ locale loc;
+ std::filebuf ob;
+ VERIFY( ob.getloc() == loc );
+
+ locale::global(locale("en_US"));
+ VERIFY( ob.getloc() == loc );
+
+ locale loc_de ("de_DE");
+ locale ret = ob.pubimbue(loc_de);
+ VERIFY( ob.getloc() == loc_de );
+ VERIFY( ret == loc );
+
+ locale::global(loc);
+ VERIFY( ob.getloc() == loc_de );
+}
+
main()
{
test01();
test05();
test06();
+ test07();
return 0;
}
// 1999-10-11 bkoz
-// Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
VERIFY(out.good());
}
+// libstdc++/9322
+void test08()
+{
+ using std::locale;
+ bool test = true;
+
+ locale loc;
+ testbuf2 ob;
+ VERIFY( ob.getloc() == loc );
+
+ locale::global(locale("en_US"));
+ VERIFY( ob.getloc() == loc );
+
+ locale loc_de ("de_DE");
+ locale ret = ob.pubimbue(loc_de);
+ VERIFY( ob.getloc() == loc_de );
+ VERIFY( ret == loc );
+
+ locale::global(loc);
+ VERIFY( ob.getloc() == loc_de );
+}
+
int main()
{
test01();
test05();
test07();
+ test08();
return 0;
}
// 2001-05-21 Benjamin Kosnik <bkoz@redhat.com>
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
VERIFY( p == bad );
}
+// libstdc++/9322
+void test08()
+{
+ using std::locale;
+ bool test = true;
+
+ locale loc;
+ std::stringbuf ob;
+ VERIFY( ob.getloc() == loc );
+
+ locale::global(locale("en_US"));
+ VERIFY( ob.getloc() == loc );
+
+ locale loc_de ("de_DE");
+ locale ret = ob.pubimbue(loc_de);
+ VERIFY( ob.getloc() == loc_de );
+ VERIFY( ret == loc );
+
+ locale::global(loc);
+ VERIFY( ob.getloc() == loc_de );
+}
+
int main()
{
using namespace std;
test02(in2, false);
test02(in3, false);
+ test08();
return 0;
}