From 3bb97ae2c034620e98ae804f2ed484db37b2e461 Mon Sep 17 00:00:00 2001 From: Apple Date: Sat, 3 Feb 2018 22:31:41 +0000 Subject: [PATCH] ICU-59152.0.1.tar.gz --- icuSources/data/coll/root.txt | 21 ++++- icuSources/data/locales/en_JP.txt | 126 +++++++++++++++++++++++++ icuSources/i18n/coll.cpp | 2 + icuSources/i18n/gregoimp.cpp | 5 + icuSources/i18n/gregoimp.h | 11 +++ icuSources/i18n/persncal.cpp | 2 +- icuSources/i18n/ucoleitr.cpp | 4 +- icuSources/test/cintltst/ccaltst.c | 33 +++++++ icuSources/test/cintltst/udatpg_test.c | 6 ++ icuSources/test/cintltst/usrchtst.c | 20 ++++ 10 files changed, 223 insertions(+), 7 deletions(-) diff --git a/icuSources/data/coll/root.txt b/icuSources/data/coll/root.txt index 1113191d..606a5a53 100644 --- a/icuSources/data/coll/root.txt +++ b/icuSources/data/coll/root.txt @@ -851,8 +851,12 @@ root{ "<<<Ќ" "&ք" "<և" + "&🇿" + "< 🏴󠁧󠁢󠁥󠁮󠁧󠁿" + "< 🏴󠁧󠁢󠁳󠁣󠁴󠁿" + "< 🏴󠁧󠁢󠁷󠁬󠁳󠁿" } - Version{"31.0.1"} + Version{"31.0.2"} } private-unihan{ Sequence{ @@ -1238,12 +1242,21 @@ root{ "&を < ヺ" "&ゝ < ゞ" "&ヽ < ヾ" + "&🇿" + "< 🏴󠁧󠁢󠁥󠁮󠁧󠁿" + "< 🏴󠁧󠁢󠁳󠁣󠁴󠁿" + "< 🏴󠁧󠁢󠁷󠁬󠁳󠁿" } - Version{"31.0.1"} + Version{"31.0.2"} } standard{ - Sequence{""} - Version{"31.0.1"} + Sequence{ + "&🇿" + "< 🏴󠁧󠁢󠁥󠁮󠁧󠁿" + "< 🏴󠁧󠁢󠁳󠁣󠁴󠁿" + "< 🏴󠁧󠁢󠁷󠁬󠁳󠁿" + } + Version{"31.0.2"} } } depends:process(dependency){"ucadata.icu"} diff --git a/icuSources/data/locales/en_JP.txt b/icuSources/data/locales/en_JP.txt index 15c0e8ec..e3a4be56 100755 --- a/icuSources/data/locales/en_JP.txt +++ b/icuSources/data/locales/en_JP.txt @@ -67,28 +67,59 @@ en_JP{ "{1} {0}", } availableFormats{ + E{"ccc"} EHm{"E H:mm"} EHms{"E H:mm:ss"} Ed{"d E"} Ehm{"E aK:mm"} Ehms{"E aK:mm:ss"} + Gy{"y G"} + GyMMM{"MMM y G"} GyMMMEd{"E, MMM d, y G"} GyMMMd{"MMM d, y G"} H{"H"} Hm{"H:mm"} Hms{"H:mm:ss"} + M{"L"} MEd{"MM/dd E"} + MMM{"LLL"} MMMEd{"E, MMM d"} MMMMd{"MMMM d"} MMMd{"MMM d"} Md{"MM/dd"} + d{"d"} + h{"h a"} + hm{"h:mm a"} + hms{"h:mm:ss a"} + ms{"mm:ss"} + y{"y G"} + yyyy{"y G"} yyyyM{"GGGGG y/MM"} yyyyMEd{"GGGGG y/MM/dd E"} + yyyyMMM{"MMM y G"} yyyyMMMEd{"E, MMM d, y G"} + yyyyMMMM{"MMMM y G"} yyyyMMMd{"MMM d, y G"} yyyyMd{"GGGGG y/MM/dd"} } intervalFormats{ + H{ + H{"HH – HH"} + } + Hm{ + H{"HH:mm – HH:mm"} + m{"HH:mm – HH:mm"} + } + Hmv{ + H{"HH:mm – HH:mm v"} + m{"HH:mm – HH:mm v"} + } + Hv{ + H{"HH – HH v"} + } + M{ + M{"M – M"} + } MEd{ M{"MM/dd E – MM/dd E"} d{"MM/dd E – MM/dd E"} @@ -105,6 +136,31 @@ en_JP{ M{"MM/dd – MM/dd"} d{"MM/dd – MM/dd"} } + d{ + d{"d – d"} + } + fallback{"{0} – {1}"} + h{ + a{"h a – h a"} + h{"h – h a"} + } + hm{ + a{"h:mm a – h:mm a"} + h{"h:mm – h:mm a"} + m{"h:mm – h:mm a"} + } + hmv{ + a{"h:mm a – h:mm a v"} + h{"h:mm – h:mm a v"} + m{"h:mm – h:mm a v"} + } + hv{ + a{"h a – h a v"} + h{"h – h a v"} + } + y{ + y{"y – y G"} + } yM{ M{"GGGGG y/MM – y/MM"} y{"GGGGG y/MM – y/MM"} @@ -148,33 +204,70 @@ en_JP{ "{1} {0}", } availableFormats{ + E{"ccc"} EHm{"E H:mm"} EHms{"E H:mm:ss"} Ed{"d E"} Ehm{"E aK:mm"} Ehms{"E aK:mm:ss"} + Gy{"y G"} + GyMMM{"MMM y G"} GyMMMEd{"E, MMM d, y G"} GyMMMd{"MMM d, y G"} H{"H"} Hm{"H:mm"} Hms{"H:mm:ss"} + Hmsv{"HH:mm:ss v"} + Hmv{"HH:mm v"} + M{"L"} MEd{"MM/dd E"} + MMM{"LLL"} MMMEd{"E, MMM d"} MMMMd{"MMMM d"} MMMd{"MMM d"} MMdd{"MM/dd"} Md{"MM/dd"} + d{"d"} + h{"h a"} + hm{"h:mm a"} + hms{"h:mm:ss a"} + hmsv{"h:mm:ss a v"} + hmv{"h:mm a v"} + ms{"mm:ss"} + y{"y"} yM{"y/MM"} yMEd{"y/MM/dd E"} + yMMM{"MMM y"} yMMMEd{"E, MMM d, y"} + yMMMM{"MMMM y"} yMMMd{"MMM d, y"} yMd{"y/MM/dd"} } intervalFormats{ + H{ + H{"HH – HH"} + } + Hm{ + H{"HH:mm – HH:mm"} + m{"HH:mm – HH:mm"} + } + Hmv{ + H{"HH:mm – HH:mm v"} + m{"HH:mm – HH:mm v"} + } + Hv{ + H{"HH – HH v"} + } + M{ + M{"M – M"} + } MEd{ M{"MM/dd E – MM/dd E"} d{"MM/dd E – MM/dd E"} } + MMM{ + M{"MMM – MMM"} + } MMMEd{ M{"E, MMM d – E, MMM d"} d{"E, MMM d – E, MMM d"} @@ -187,6 +280,31 @@ en_JP{ M{"MM/dd – MM/dd"} d{"MM/dd – MM/dd"} } + d{ + d{"d – d"} + } + fallback{"{0} – {1}"} + h{ + a{"h a – h a"} + h{"h – h a"} + } + hm{ + a{"h:mm a – h:mm a"} + h{"h:mm – h:mm a"} + m{"h:mm – h:mm a"} + } + hmv{ + a{"h:mm a – h:mm a v"} + h{"h:mm – h:mm a v"} + m{"h:mm – h:mm a v"} + } + hv{ + a{"h a – h a v"} + h{"h – h a v"} + } + y{ + y{"y – y"} + } yM{ M{"y/MM – y/MM"} y{"y/MM – y/MM"} @@ -196,11 +314,19 @@ en_JP{ d{"y/MM/dd E – y/MM/dd E"} y{"y/MM/dd E – y/MM/dd E"} } + yMMM{ + M{"MMM – MMM y"} + y{"MMM y – MMM y"} + } yMMMEd{ M{"E, MMM d – E, MMM d, y"} d{"E, MMM d – E, MMM d, y"} y{"E, MMM d, y – E, MMM d, y"} } + yMMMM{ + M{"MMMM – MMMM y"} + y{"MMMM y – MMMM y"} + } yMMMd{ M{"MMM d – MMM d, y"} d{"MMM d – d, y"} diff --git a/icuSources/i18n/coll.cpp b/icuSources/i18n/coll.cpp index be4b6b88..25c8745c 100644 --- a/icuSources/i18n/coll.cpp +++ b/icuSources/i18n/coll.cpp @@ -63,8 +63,10 @@ static icu::Locale* availableLocaleList = NULL; static int32_t availableLocaleListCount; +#if !UCONFIG_NO_SERVICE static icu::ICULocaleService* gService = NULL; static icu::UInitOnce gServiceInitOnce = U_INITONCE_INITIALIZER; +#endif static icu::UInitOnce gAvailableLocaleListInitOnce; /** diff --git a/icuSources/i18n/gregoimp.cpp b/icuSources/i18n/gregoimp.cpp index e62044b3..537aa19d 100644 --- a/icuSources/i18n/gregoimp.cpp +++ b/icuSources/i18n/gregoimp.cpp @@ -27,6 +27,11 @@ int32_t ClockMath::floorDivide(int32_t numerator, int32_t denominator) { numerator / denominator : ((numerator + 1) / denominator) - 1; } +int64_t ClockMath::floorDivide(int64_t numerator, int64_t denominator) { + return (numerator >= 0) ? + numerator / denominator : ((numerator + 1) / denominator) - 1; +} + int32_t ClockMath::floorDivide(double numerator, int32_t denominator, int32_t& remainder) { double quotient; diff --git a/icuSources/i18n/gregoimp.h b/icuSources/i18n/gregoimp.h index b3074167..afaacda0 100644 --- a/icuSources/i18n/gregoimp.h +++ b/icuSources/i18n/gregoimp.h @@ -40,6 +40,17 @@ class ClockMath { */ static int32_t floorDivide(int32_t numerator, int32_t denominator); + /** + * Divide two integers, returning the floor of the quotient. + * Unlike the built-in division, this is mathematically + * well-behaved. E.g., -1/4 => 0 but + * floorDivide(-1,4) => -1. + * @param numerator the numerator + * @param denominator a divisor which must be != 0 + * @return the floor of the quotient + */ + static int64_t floorDivide(int64_t numerator, int64_t denominator); + /** * Divide two numbers, returning the floor of the quotient. * Unlike the built-in division, this is mathematically diff --git a/icuSources/i18n/persncal.cpp b/icuSources/i18n/persncal.cpp index f66ac676..f38f779f 100644 --- a/icuSources/i18n/persncal.cpp +++ b/icuSources/i18n/persncal.cpp @@ -213,7 +213,7 @@ void PersianCalendar::handleComputeFields(int32_t julianDay, UErrorCode &/*statu int32_t year, month, dayOfMonth, dayOfYear; int32_t daysSinceEpoch = julianDay - PERSIAN_EPOCH; - year = 1 + ClockMath::floorDivide(33 * daysSinceEpoch + 3, 12053); + year = 1 + (int32_t)ClockMath::floorDivide(33 * (int64_t)daysSinceEpoch + 3, (int64_t)12053); int32_t farvardin1 = 365 * (year - 1) + ClockMath::floorDivide(8 * year + 21, 33); dayOfYear = (daysSinceEpoch - farvardin1); // 0-based diff --git a/icuSources/i18n/ucoleitr.cpp b/icuSources/i18n/ucoleitr.cpp index d5455daa..e56ea1ef 100644 --- a/icuSources/i18n/ucoleitr.cpp +++ b/icuSources/i18n/ucoleitr.cpp @@ -330,7 +330,7 @@ ucol_nextProcessed(UCollationElements *elems, int32_t *ixHigh, UErrorCode *status) { - return (UCollationPCE::UCollationPCE(elems)).nextProcessed(ixLow, ixHigh, status); + return (UCollationPCE(elems)).nextProcessed(ixLow, ixHigh, status); } @@ -394,7 +394,7 @@ ucol_previousProcessed(UCollationElements *elems, int32_t *ixHigh, UErrorCode *status) { - return (UCollationPCE::UCollationPCE(elems)).previousProcessed(ixLow, ixHigh, status); + return (UCollationPCE(elems)).previousProcessed(ixLow, ixHigh, status); } U_NAMESPACE_BEGIN diff --git a/icuSources/test/cintltst/ccaltst.c b/icuSources/test/cintltst/ccaltst.c index 73457baa..498dc966 100644 --- a/icuSources/test/cintltst/ccaltst.c +++ b/icuSources/test/cintltst/ccaltst.c @@ -41,6 +41,7 @@ void TestGetTZTransition(void); void TestGetWindowsTimeZoneID(void); void TestGetTimeZoneIDByWindowsID(void); void TestClear(void); +void TestPersianCalOverflow(void); void TestGetDayPeriods(); /* Apple-specific */ void addCalTest(TestNode** root); @@ -65,6 +66,7 @@ void addCalTest(TestNode** root) addTest(root, &TestGetWindowsTimeZoneID, "tsformat/ccaltst/TestGetWindowsTimeZoneID"); addTest(root, &TestGetTimeZoneIDByWindowsID, "tsformat/ccaltst/TestGetTimeZoneIDByWindowsID"); addTest(root, &TestClear, "tsformat/ccaltst/TestClear"); + addTest(root, &TestPersianCalOverflow, "tsformat/ccaltst/TestPersianCalOverflow"); addTest(root, &TestGetDayPeriods, "tsformat/ccaltst/TestGetDayPeriods"); /* Apple-specific */ } @@ -2508,6 +2510,37 @@ void TestClear() { } } +void TestPersianCalOverflow() { + const char * locale = "bs_Cyrl@calendar=persian"; + UErrorCode status = U_ZERO_ERROR; + UCalendar * ucal = ucal_open(NULL, 0, locale, UCAL_DEFAULT, &status); + if ( U_FAILURE(status) ) { + log_data_err("FAIL: ucal_open for locale %s, status %s\n", locale, u_errorName(status)); + } else { + int32_t maxMonth = ucal_getLimit(ucal, UCAL_MONTH, UCAL_MAXIMUM, &status); + int32_t maxDayOfMonth = ucal_getLimit(ucal, UCAL_DATE, UCAL_MAXIMUM, &status); + if ( U_FAILURE(status) ) { + log_err("FAIL: ucal_getLimit MONTH/DATE for locale %s, status %s\n", locale, u_errorName(status)); + } else { + int32_t jd, month, dayOfMonth; + for (jd = 67023580; jd <= 67023584; jd++) { // year 178171, int32_t overflow if jd >= 67023582 + status = U_ZERO_ERROR; + ucal_clear(ucal); + ucal_set(ucal, UCAL_JULIAN_DAY, jd); + month = ucal_get(ucal, UCAL_MONTH, &status); + dayOfMonth = ucal_get(ucal, UCAL_DATE, &status); + if ( U_FAILURE(status) ) { + log_err("FAIL: ucal_get MONTH/DATE for locale %s, julianDay %d, status %s\n", locale, jd, u_errorName(status)); + } else if (month > maxMonth || dayOfMonth > maxDayOfMonth) { + log_err("FAIL: locale %s, julianDay %d; maxMonth %d, got month %d; maxDayOfMonth %d, got dayOfMonth %d\n", + locale, jd, maxMonth, month, maxDayOfMonth, dayOfMonth); + } + } + } + ucal_close(ucal); + } +} + /* Apple-specific */ typedef struct { const char * locale; diff --git a/icuSources/test/cintltst/udatpg_test.c b/icuSources/test/cintltst/udatpg_test.c index 8895c508..2db73820 100644 --- a/icuSources/test/cintltst/udatpg_test.c +++ b/icuSources/test/cintltst/udatpg_test.c @@ -386,6 +386,8 @@ enum { kTestOptionsPatLenMax = 32 }; static const UChar skel_Hmm[] = { 0x0048, 0x006D, 0x006D, 0 }; static const UChar skel_HHmm[] = { 0x0048, 0x0048, 0x006D, 0x006D, 0 }; static const UChar skel_hhmm[] = { 0x0068, 0x0068, 0x006D, 0x006D, 0 }; +static const UChar skel_mmss[] = { 0x006D, 0x006D, 0x0073, 0x0073, 0 }; +static const UChar skel_mmssSS[] = { 0x006D, 0x006D, 0x0073, 0x0073, 0x0053, 0x0053, 0 }; static const UChar patn_hcmm_a[] = { 0x0068, 0x003A, 0x006D, 0x006D, 0x0020, 0x0061, 0 }; /* h:mm a */ static const UChar patn_HHcmm[] = { 0x0048, 0x0048, 0x003A, 0x006D, 0x006D, 0 }; /* HH:mm */ static const UChar patn_hhcmm_a[] = { 0x0068, 0x0068, 0x003A, 0x006D, 0x006D, 0x0020, 0x0061, 0 }; /* hh:mm a */ @@ -393,6 +395,8 @@ static const UChar patn_HHpmm[] = { 0x0048, 0x0048, 0x002E, 0x006D, 0x006D, 0 static const UChar patn_hpmm_a[] = { 0x0068, 0x002E, 0x006D, 0x006D, 0x0020, 0x0061, 0 }; /* h.mm a */ static const UChar patn_Hpmm[] = { 0x0048, 0x002E, 0x006D, 0x006D, 0 }; /* H.mm */ static const UChar patn_hhpmm_a[] = { 0x0068, 0x0068, 0x002E, 0x006D, 0x006D, 0x0020, 0x0061, 0 }; /* hh.mm a */ +static const UChar patn_mmcss[] = { 0x006D, 0x006D, 0x003A, 0x0073, 0x0073, 0 }; /* mm:ss */ +static const UChar patn_mmcsspSS[]= { 0x006D, 0x006D, 0x003A, 0x0073, 0x0073, 0x002E, 0x0053, 0x0053, 0 }; /* mm:ss.SS */ static void TestOptions() { const DTPtnGenOptionsData testData[] = { @@ -409,6 +413,8 @@ static void TestOptions() { { "da", skel_Hmm, UDATPG_MATCH_HOUR_FIELD_LENGTH, patn_Hpmm }, { "da", skel_HHmm, UDATPG_MATCH_HOUR_FIELD_LENGTH, patn_HHpmm }, { "da", skel_hhmm, UDATPG_MATCH_HOUR_FIELD_LENGTH, patn_hhpmm_a }, + { "en_JP@calendar=japanese", skel_mmss, UDATPG_MATCH_NO_OPTIONS, patn_mmcss }, + { "en_JP@calendar=japanese", skel_mmssSS, UDATPG_MATCH_NO_OPTIONS, patn_mmcsspSS }, }; int count = UPRV_LENGTHOF(testData); diff --git a/icuSources/test/cintltst/usrchtst.c b/icuSources/test/cintltst/usrchtst.c index a93884fd..a0657322 100644 --- a/icuSources/test/cintltst/usrchtst.c +++ b/icuSources/test/cintltst/usrchtst.c @@ -2799,6 +2799,25 @@ static const PatternAndOffsets scModsPatternsOffsets[] = { { NULL, NULL, 0, NULL } }; +static const UChar scFlagText[] = { +/*00*/ 0xD83C,0xDDF3,0xD83C,0xDDFF, /*NZ*/ +/*04*/ 0xD83C,0xDFF4,0xDB40,0xDC67,0xDB40,0xDC62,0xDB40,0xDC65,0xDB40,0xDC6E,0xDB40,0xDC67,0xDB40,0xDC7F, /*gbeng*/ +/*18*/ 0x0061,0x0062,0x0063, +/*21*/ 0xD83C,0xDFF4,0xDB40,0xDC67,0xDB40,0xDC62,0xDB40,0xDC73,0xDB40,0xDC63,0xDB40,0xDC74,0xDB40,0xDC7F, /*gbsct*/ +/*35*/ 0xD83C,0xDFF4,0xDB40,0xDC67,0xDB40,0xDC62,0xDB40,0xDC77,0xDB40,0xDC6C,0xDB40,0xDC73,0xDB40,0xDC7F, /*gbwls*/ +/*49*/ 0x0020,0 +}; + +static const UChar scFlag1[] = { 0xD83C,0xDFF4,0xDB40,0xDC67,0xDB40,0xDC62,0xDB40,0xDC73,0xDB40,0xDC63,0xDB40,0xDC74,0xDB40,0xDC7F,0 }; /* gbsct */ +static const int32_t scOffFlag1[] = { 21 }; +static const int32_t scLenFlag1[] = { 14 }; + +static const PatternAndOffsets scFlagPatternsOffsets[] = { + { scFlag1, scOffFlag1, UPRV_LENGTHOF(scOffFlag1), scLenFlag1 }, + { NULL, NULL, 0, NULL } +}; + + typedef struct { const char * locale; const UChar * text; @@ -2814,6 +2833,7 @@ static const TUSCItem tuscItems[] = { { "ja@colStrength=primary", scJaText, scJaStndPatternsOffsets }, { "ja@collation=search;colStrength=primary", scJaText, scJaSrchPatternsOffsets }, { "root@collation=search;colStrength=primary", scModsText, scModsPatternsOffsets }, + { "root@collation=search;colStrength=primary", scFlagText, scFlagPatternsOffsets }, { NULL, NULL, NULL } }; -- 2.45.2