From 817fe804cf6c8c2c6e87058096c12e565ad5cf36 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 3 Dec 2003 09:26:03 +0000 Subject: [PATCH] re PR libstdc++/12791 (_M_extract_num returns a wrong __beg in case of error) 2003-12-03 Paolo Carlini PR libstdc++/12791 * include/bits/locale_facets.tcc (time_get::_M_extract_num): Rewrite, stop the parsing as soon as a digit cannot possibly lead to a final number within the bounds; otherwise, simplify, avoiding __ctype.is() and atoi(). * testsuite/22_locale/time_get/get_date/char/12791.cc: New. * testsuite/22_locale/time_get/get_date/wchar_t/12791.cc: New. * include/bits/locale_facets.tcc (time_get::_M_extract_via_format): Minor tweak: a 4-digit integer cannot be bigger than 9999. * testsuite/22_locale/time_get/get_date/wchar_t/1.cc: Use type-correct wchar_t string literals. * testsuite/22_locale/time_get/get_monthname/wchar_t/1.cc: Ditto. * testsuite/22_locale/time_get/get_time/wchar_t/1.cc: Ditto. * testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc: Ditto. * testsuite/22_locale/time_get/get_year/wchar_t/1.cc: Ditto. From-SVN: r74222 --- .../testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc index 065b13cf788..782b4e70d34 100644 --- a/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc +++ b/libstdc++-v3/testsuite/22_locale/time_get/get_weekday/wchar_t/1.cc @@ -85,7 +85,7 @@ void test01() tim_get.get_weekday(is_it03, end, iss, errorstate, &time03); VERIFY( time03.tm_wday == time_bday.tm_wday ); VERIFY( errorstate == good ); - VERIFY( *is_it03 == ' '); + VERIFY( *is_it03 == L' ' ); iss.str(L"San"); iterator_type is_it04(iss); @@ -94,7 +94,7 @@ void test01() errorstate = good; tim_get.get_weekday(is_it04, end, iss, errorstate, &time04); VERIFY( time04.tm_wday == 4 ); - VERIFY( *is_it04 == 'n'); + VERIFY( *is_it04 == L'n' ); VERIFY( errorstate == ios_base::failbit ); iss.str(L"Tuesday "); @@ -104,7 +104,7 @@ void test01() tim_get.get_weekday(is_it05, end, iss, errorstate, &time05); VERIFY( time05.tm_wday == 2 ); VERIFY( errorstate == good ); - VERIFY( *is_it05 == ' '); + VERIFY( *is_it05 == L' ' ); iss.str(L"Tuesducky "); // Kind of like Fryday, without the swirls. iterator_type is_it06(iss); @@ -114,7 +114,7 @@ void test01() tim_get.get_weekday(is_it06, end, iss, errorstate, &time06); VERIFY( time06.tm_wday == 4 ); VERIFY( errorstate == ios_base::failbit ); - VERIFY( *is_it05 == 'u'); + VERIFY( *is_it05 == L'u' ); } int main() -- 2.30.2