diff options
author | Paolo Carlini <pcarlini@unitus.it> | 2001-11-29 01:27:54 +0100 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2001-11-29 00:27:54 +0000 |
commit | 5a4c85886a6276deccc67f588e524e08ca76eee5 (patch) | |
tree | 5d331fd54056aaa17e1174bf83421a7cc253d7e5 | |
parent | 35a53991ae5b9c730b6cd31a725c2a3d26ae11a7 (diff) | |
download | gcc-5a4c85886a6276deccc67f588e524e08ca76eee5.zip gcc-5a4c85886a6276deccc67f588e524e08ca76eee5.tar.gz gcc-5a4c85886a6276deccc67f588e524e08ca76eee5.tar.bz2 |
locale_facets.tcc (__pad): correctly output hex numbers internally aligned.
2001-11-28 Paolo Carlini <pcarlini@unitus.it>
libstdc++/3655
* include/bits/locale_facets.tcc (__pad): correctly output hex
numbers internally aligned.
* testsuite/27_io/ostream_inserter_arith.cc: Add testcase.
From-SVN: r47433
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/locale_facets.tcc | 6 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc | 14 |
3 files changed, 24 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c381c9e..b0b7819 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2001-11-28 Paolo Carlini <pcarlini@unitus.it> + + libstdc++/3655 + * include/bits/locale_facets.tcc (__pad): correctly output hex + numbers internally aligned. + * testsuite/27_io/ostream_inserter_arith.cc: Add testcase. + 2001-11-28 Paolo Carlini <pcarlini@unitus.it> Loren J. Rittle <ljrittle@acm.org> diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index e602e58..c3f1b03 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -1959,9 +1959,9 @@ namespace std __news[1] = __olds[1]; __mod += 2; __news += 2; - __beg = const_cast<char_type*>(__olds + __mod); - __beglen = __oldlen - __mod; - __end = __pads; + __beg = __pads; + __beglen = __plen; + __end = const_cast<char_type*>(__olds + __mod); } else if (__testsign) { diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc index bd49ebf..25a0c12 100644 --- a/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc +++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_arith.cc @@ -308,11 +308,25 @@ test03() return 0; } +// libstdc++/3655 +int +test04() +{ + stringbuf strbuf; + ostream o(&strbuf); + + o << hex << showbase << setw(6) << internal << 255; + VERIFY( strbuf.str() == "0x ff" ); + + return 0; +} + int main() { test01(); test02(); + test04(); #ifdef TEST_NUMPUT_VERBOSE cout << "Test passed!" << endl; #endif |