locale_facets.tcc (money_get::do_get(string_type&)): Fix parsing of the remaining sign characters.

2004-02-16  Paolo Carlini  <pcarlini@suse.de>

	* 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
This commit is contained in:
Paolo Carlini 2004-02-16 16:46:26 +00:00 committed by Paolo Carlini
parent 9ac9746067
commit b7e64db2a4
10 changed files with 36 additions and 36 deletions

View File

@ -1,3 +1,20 @@
2004-02-16 Paolo Carlini <pcarlini@suse.de>
* 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 <david.asher@cavium.com>
PR libstdc++/11352

View File

@ -1207,7 +1207,7 @@ namespace std
|| ((static_cast<part>(__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;

View File

@ -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()

View File

@ -28,8 +28,6 @@
void test04()
{
using namespace std;
typedef money_base::part part;
typedef money_base::pattern pattern;
typedef istreambuf_iterator<char> 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()

View File

@ -1,6 +1,6 @@
// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
// 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<char,false>
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 } };

View File

@ -34,7 +34,7 @@ struct My_money_io_a : public std::moneypunct<char,false>
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<char,false>
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;

View File

@ -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()

View File

@ -28,8 +28,6 @@
void test04()
{
using namespace std;
typedef money_base::part part;
typedef money_base::pattern pattern;
typedef istreambuf_iterator<wchar_t> 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()

View File

@ -1,6 +1,6 @@
// 2001-09-12 Benjamin Kosnik <bkoz@redhat.com>
// 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<wchar_t,false>
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 } };

View File

@ -34,7 +34,7 @@ struct My_money_io_a : public std::moneypunct<wchar_t,false>
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<wchar_t,false>
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;