From: Paolo Carlini Date: Mon, 16 Feb 2004 16:46:26 +0000 (+0000) Subject: locale_facets.tcc (money_get::do_get(string_type&)): Fix parsing of the remaining... X-Git-Tag: releases/gcc-4.0.0~10091 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b7e64db2a475a13f90219c36d4c9c3d846f60b1c;p=thirdparty%2Fgcc.git locale_facets.tcc (money_get::do_get(string_type&)): Fix parsing of the remaining sign characters. 2004-02-16 Paolo Carlini * include/bits/locale_facets.tcc (money_get::do_get(string_type&)): Fix parsing of the remaining sign characters. * 22_locale/money_get/get/char/2.cc: Tweak: now, correctly, the input is scanned 'til eof. * 22_locale/money_get/get/char/4.cc: Likewise. * 22_locale/money_get/get/wchar_t/2.cc: Likewise. * 22_locale/money_get/get/wchar_t/4.cc: Likewise. * 22_locale/money_get/get/char/8.cc: Tweak: override do_neg_format, not do_pos_format: the former is the only one that matters during input. * 22_locale/money_get/get/wchar_t/8.cc: Likewise. * 22_locale/money_get/get/char/6.cc: Minor tweak. * 22_locale/money_get/get/wchar_t/6.cc: Likewise. From-SVN: r77896 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 2765ee1c740a..301779611e47 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,20 @@ +2004-02-16 Paolo Carlini + + * include/bits/locale_facets.tcc (money_get::do_get(string_type&)): + Fix parsing of the remaining sign characters. + * 22_locale/money_get/get/char/2.cc: Tweak: now, correctly, + the input is scanned 'til eof. + * 22_locale/money_get/get/char/4.cc: Likewise. + * 22_locale/money_get/get/wchar_t/2.cc: Likewise. + * 22_locale/money_get/get/wchar_t/4.cc: Likewise. + * 22_locale/money_get/get/char/8.cc: Tweak: override do_neg_format, + not do_pos_format: the former is the only one that matters during + input. + * 22_locale/money_get/get/wchar_t/8.cc: Likewise. + + * 22_locale/money_get/get/char/6.cc: Minor tweak. + * 22_locale/money_get/get/wchar_t/6.cc: Likewise. + 2004-02-15 David Asher PR libstdc++/11352 diff --git a/libstdc++-v3/include/bits/locale_facets.tcc b/libstdc++-v3/include/bits/locale_facets.tcc index afbd96c70ae2..5e6128e0934b 100644 --- a/libstdc++-v3/include/bits/locale_facets.tcc +++ b/libstdc++-v3/include/bits/locale_facets.tcc @@ -1207,7 +1207,7 @@ namespace std || ((static_cast(__p.field[3]) != money_base::none) && __i == 2)) { - // According to 22.2.6.1.2.2, symbol is required + // According to 22.2.6.1.2, p2, symbol is required // if (__io.flags() & ios_base::showbase), // otherwise is optional and consumed only if // other characters are needed to complete the @@ -1293,9 +1293,8 @@ namespace std { const size_type __len = __sign.size(); size_type __i = 1; - for (; __beg != __end && __i < __len; ++__i) - for (; __beg != __end - && *__beg != __sign[__i]; ++__beg); + for (; __beg != __end && __i < __len + && *__beg == __sign[__i]; ++__beg, ++__i); if (__i != __len) __testvalid = false; diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/2.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/2.cc index 0d516a28402d..b9bd0052cb63 100644 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/2.cc +++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/2.cc @@ -81,7 +81,7 @@ void test02() ios_base::iostate err10 = ios_base::goodbit; mon_get.get(is_it10, end, true, iss, err10, result10); VERIFY( result10 == digits2 ); - VERIFY( err10 == ios_base::goodbit ); + VERIFY( err10 == ios_base::eofbit ); iss.str("(HKD .01)"); iterator_type is_it11(iss); @@ -89,7 +89,7 @@ void test02() ios_base::iostate err11 = ios_base::goodbit; mon_get.get(is_it11, end, true, iss, err11, result11); VERIFY( result11 == digits4 ); - VERIFY( err11 == ios_base::goodbit ); + VERIFY( err11 == ios_base::eofbit ); // for the "en_HK" locale the parsing of the very same input streams must // be successful without showbase too, since the symbol field appears in @@ -111,7 +111,7 @@ void test02() ios_base::iostate err13 = ios_base::goodbit; mon_get.get(is_it13, end, true, iss, err13, result13); VERIFY( result13 == digits2 ); - VERIFY( err13 == ios_base::goodbit ); + VERIFY( err13 == ios_base::eofbit ); iss.str("(HKD .01)"); iterator_type is_it14(iss); @@ -119,7 +119,7 @@ void test02() ios_base::iostate err14 = ios_base::goodbit; mon_get.get(is_it14, end, true, iss, err14, result14); VERIFY( result14 == digits4 ); - VERIFY( err14 == ios_base::goodbit ); + VERIFY( err14 == ios_base::eofbit ); } int main() diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/4.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/4.cc index 7c009c85d3bc..c5aa7a3a8c49 100644 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/4.cc +++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/4.cc @@ -28,8 +28,6 @@ void test04() { using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; typedef istreambuf_iterator iterator_type; bool test __attribute__((unused)) = true; @@ -64,7 +62,7 @@ void test04() ios_base::iostate err03 = ios_base::goodbit; mon_get.get(is_it03, end, true, iss, err03, result3); VERIFY( result3 == digits4 ); - VERIFY( err03 == ios_base::goodbit ); + VERIFY( err03 == ios_base::eofbit ); } int main() diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/6.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/6.cc index 8c03e8245ffc..434edfe12b7c 100644 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/6.cc +++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/6.cc @@ -1,6 +1,6 @@ // 2001-09-12 Benjamin Kosnik -// Copyright (C) 2001, 2002, 2003 Free Software Foundation +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation // // 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 @@ -35,12 +35,6 @@ struct My_money_io : public std::moneypunct int do_frac_digits() const { return 2; } - pattern do_pos_format() const - { - pattern pat = { { symbol, none, sign, value } }; - return pat; - } - pattern do_neg_format() const { pattern pat = { { symbol, none, sign, value } }; diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/char/8.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/char/8.cc index 01a93381557d..f88b521c0020 100644 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/char/8.cc +++ b/libstdc++-v3/testsuite/22_locale/money_get/get/char/8.cc @@ -34,7 +34,7 @@ struct My_money_io_a : public std::moneypunct int do_frac_digits() const { return 2; } - pattern do_pos_format() const + pattern do_neg_format() const { pattern pat = { { sign, value, space, symbol } }; return pat; @@ -51,7 +51,7 @@ struct My_money_io_b : public std::moneypunct int do_frac_digits() const { return 2; } - pattern do_pos_format() const + pattern do_neg_format() const { pattern pat = { { sign, value, symbol, none } }; return pat; diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/2.cc index efdec283e7a6..95a0c735632b 100644 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/2.cc +++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/2.cc @@ -81,7 +81,7 @@ void test02() ios_base::iostate err10 = ios_base::goodbit; mon_get.get(is_it10, end, true, iss, err10, result10); VERIFY( result10 == digits2 ); - VERIFY( err10 == ios_base::goodbit ); + VERIFY( err10 == ios_base::eofbit ); iss.str(L"(HKD .01)"); iterator_type is_it11(iss); @@ -89,7 +89,7 @@ void test02() ios_base::iostate err11 = ios_base::goodbit; mon_get.get(is_it11, end, true, iss, err11, result11); VERIFY( result11 == digits4 ); - VERIFY( err11 == ios_base::goodbit ); + VERIFY( err11 == ios_base::eofbit ); // for the "en_HK" locale the parsing of the very same input streams must // be successful without showbase too, since the symbol field appears in @@ -111,7 +111,7 @@ void test02() ios_base::iostate err13 = ios_base::goodbit; mon_get.get(is_it13, end, true, iss, err13, result13); VERIFY( result13 == digits2 ); - VERIFY( err13 == ios_base::goodbit ); + VERIFY( err13 == ios_base::eofbit ); iss.str(L"(HKD .01)"); iterator_type is_it14(iss); @@ -119,7 +119,7 @@ void test02() ios_base::iostate err14 = ios_base::goodbit; mon_get.get(is_it14, end, true, iss, err14, result14); VERIFY( result14 == digits4 ); - VERIFY( err14 == ios_base::goodbit ); + VERIFY( err14 == ios_base::eofbit ); } int main() diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/4.cc index cea15f5a85d4..cb1a2abfcbcb 100644 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/4.cc +++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/4.cc @@ -28,8 +28,6 @@ void test04() { using namespace std; - typedef money_base::part part; - typedef money_base::pattern pattern; typedef istreambuf_iterator iterator_type; bool test __attribute__((unused)) = true; @@ -64,7 +62,7 @@ void test04() ios_base::iostate err03 = ios_base::goodbit; mon_get.get(is_it03, end, true, iss, err03, result3); VERIFY( result3 == digits4 ); - VERIFY( err03 == ios_base::goodbit ); + VERIFY( err03 == ios_base::eofbit ); } int main() diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/6.cc index 5d40fab761fe..cebba6e3b80e 100644 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/6.cc +++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/6.cc @@ -1,6 +1,6 @@ // 2001-09-12 Benjamin Kosnik -// Copyright (C) 2001, 2002, 2003 Free Software Foundation +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation // // 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 @@ -35,12 +35,6 @@ struct My_money_io : public std::moneypunct int do_frac_digits() const { return 2; } - pattern do_pos_format() const - { - pattern pat = { { symbol, none, sign, value } }; - return pat; - } - pattern do_neg_format() const { pattern pat = { { symbol, none, sign, value } }; diff --git a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/8.cc b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/8.cc index aeaa25737805..2b86b3675423 100644 --- a/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/8.cc +++ b/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/8.cc @@ -34,7 +34,7 @@ struct My_money_io_a : public std::moneypunct int do_frac_digits() const { return 2; } - pattern do_pos_format() const + pattern do_neg_format() const { pattern pat = { { sign, value, space, symbol } }; return pat; @@ -51,7 +51,7 @@ struct My_money_io_b : public std::moneypunct int do_frac_digits() const { return 2; } - pattern do_pos_format() const + pattern do_neg_format() const { pattern pat = { { sign, value, symbol, none } }; return pat;