]> granicus.if.org Git - icu/commitdiff
ICU-13366 part 12, fix C SimpleDateFormat::subParse handling of 2-digit years for...
authorPeter Edberg <pedberg@unicode.org>
Tue, 3 Oct 2017 20:36:42 +0000 (20:36 +0000)
committerPeter Edberg <pedberg@unicode.org>
Tue, 3 Oct 2017 20:36:42 +0000 (20:36 +0000)
X-SVN-Rev: 40536

icu4c/source/i18n/smpdtfmt.cpp
icu4c/source/test/intltest/dtfmtrtts.cpp
icu4c/source/test/intltest/tsdate.cpp

index 402672c0631684ee57b4a0c5f6566f4eec325f4e..cc9e9d3f0e476e63211f7a47a68c5591c04ea47d 100644 (file)
@@ -3056,9 +3056,9 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
         // is treated literally:  "2250", "-1", "1", "002".
         if (fDateOverride.compare(hebr)==0 && value < 1000) {
             value += HEBREW_CAL_CUR_MILLENIUM_START_YEAR;
-        } else if ((pos.getIndex() - start) == 2 && !isChineseCalendar
-            && u_isdigit(text.charAt(start))
-            && u_isdigit(text.charAt(start+1)))
+        } else if (text.moveIndex32(start, 2) == pos.getIndex() && !isChineseCalendar
+            && u_isdigit(text.char32At(start))
+            && u_isdigit(text.char32At(text.moveIndex32(start, 1))))
         {
             // only adjust year for patterns less than 3.
             if(count < 3) {
@@ -3096,9 +3096,9 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
         // Comment is the same as for UDAT_Year_FIELDs - look above
         if (fDateOverride.compare(hebr)==0 && value < 1000) {
             value += HEBREW_CAL_CUR_MILLENIUM_START_YEAR;
-        } else if ((pos.getIndex() - start) == 2
-            && u_isdigit(text.charAt(start))
-            && u_isdigit(text.charAt(start+1))
+        } else if (text.moveIndex32(start, 2) == pos.getIndex()
+            && u_isdigit(text.char32At(start))
+            && u_isdigit(text.char32At(text.moveIndex32(start, 1)))
             && fHaveDefaultCentury )
         {
             int32_t ambiguousTwoDigitYear = fDefaultCenturyStartYear % 100;
index 9d5d10ec60e4fba79f4a4db9d8f93585168aace3..2206d0fe0d9d83e172eb988a4b92f47df24a10ff 100644 (file)
@@ -249,9 +249,6 @@ void DateFormatRoundTripTest::test(const Locale& loc)
     
     for(style = DateFormat::FULL; style <= DateFormat::SHORT; ++style) {
         if (TEST_TABLE[itable++]) {
-            if (uprv_strcmp(loc.getLanguage(),"ccp")==0 && style==DateFormat::LONG && logKnownIssue("13366", "Skip handling ccp until DateFormat parsing is fixed")) {
-                continue;
-            }
             logln("Testing style " + UnicodeString(styleName((DateFormat::EStyle)style)));
             DateFormat *df = DateFormat::createTimeInstance((DateFormat::EStyle)style, loc);
             if(df == NULL) {
@@ -266,9 +263,6 @@ void DateFormatRoundTripTest::test(const Locale& loc)
     for(int32_t dstyle = DateFormat::FULL; dstyle <= DateFormat::SHORT; ++dstyle) {
         for(int32_t tstyle = DateFormat::FULL; tstyle <= DateFormat::SHORT; ++tstyle) {
             if(TEST_TABLE[itable++]) {
-                if (uprv_strcmp(loc.getLanguage(),"ccp")==0 && tstyle==DateFormat::LONG && logKnownIssue("13366", "Skip handling ccp until DateFormat parsing is fixed")) {
-                    continue;
-                }
                 logln("Testing dstyle" + UnicodeString(styleName((DateFormat::EStyle)dstyle)) + ", tstyle" + UnicodeString(styleName((DateFormat::EStyle)tstyle)) );
                 DateFormat *df = DateFormat::createDateTimeInstance((DateFormat::EStyle)dstyle, (DateFormat::EStyle)tstyle, loc);
                 if(df == NULL) {
index df9988fa57e03b3e27750a508cba0fb48588dc77..596ce97024bfbaf533da05d961c1f6e9914d8765 100644 (file)
@@ -104,9 +104,6 @@ IntlTestDateFormat::testLocale(/*char* par, */const Locale& locale, const Unicod
             timeStyle < (DateFormat::EStyle)4; 
             timeStyle = (DateFormat::EStyle) (timeStyle+1))
         {
-            if (uprv_strcmp(locale.getLanguage(),"ccp")==0 && logKnownIssue("13366", "Skip handling ccp until DateFormat parsing is fixed")) {
-                continue;
-            }
             fTestName = (UnicodeString) "DateTime test " + (int32_t) dateStyle + "/" + (int32_t) timeStyle + " (" + localeName + ")";
             fFormat = DateFormat::createDateTimeInstance(dateStyle, timeStyle, locale);
             testFormat(/* par */);