]> git.saurik.com Git - apple/icu.git/commitdiff
ICU-59152.0.1.tar.gz macos-10132 macos-10133 v59152.0.1
authorApple <opensource@apple.com>
Sat, 3 Feb 2018 22:31:41 +0000 (22:31 +0000)
committerApple <opensource@apple.com>
Sat, 3 Feb 2018 22:31:41 +0000 (22:31 +0000)
icuSources/data/coll/root.txt
icuSources/data/locales/en_JP.txt
icuSources/i18n/coll.cpp
icuSources/i18n/gregoimp.cpp
icuSources/i18n/gregoimp.h
icuSources/i18n/persncal.cpp
icuSources/i18n/ucoleitr.cpp
icuSources/test/cintltst/ccaltst.c
icuSources/test/cintltst/udatpg_test.c
icuSources/test/cintltst/usrchtst.c

index 1113191d763674b69717e584172cd695693c0f2e..606a5a53dad5096cfe20128e466474d6b3665db4 100644 (file)
@@ -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"}
index 15c0e8ecd2ca84621820cf73857dd577cd01ab4f..e3a4be5615369d6006f84b7d7b4edd229757984d 100755 (executable)
@@ -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"}
index be4b6b886407ab4a161b486024f89b72a3b2b22d..25c8745cbf203b3c590ffea65a67a65394bd653d 100644 (file)
 
 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;
 
 /**
index e62044b361a5620cdd2db04f6a78676b296b5e98..537aa19d8a40ed44a3eb9b5aaf8075ae0eb11be0 100644 (file)
@@ -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;
index b30741679df2f575d17e01269dab3a40e6b5745e..afaacda0b41a74426ac0acb18ab8a018f54eea9d 100644 (file)
@@ -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., <code>-1/4</code> => 0 but
+     * <code>floorDivide(-1,4)</code> => -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
index f66ac676a4a7e1fc44f71cc35d3f2ea4eb857ff7..f38f779fea9f5d6afeed633d79b29a0348344f5d 100644 (file)
@@ -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
index d5455daa5adf2ad86707b403310bf3496e682a0f..e56ea1efe0d452f95fef60594dfe0c782f76fd70 100644 (file)
@@ -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
index 73457baae363d0b889fc91241f3e9c3d062b1b79..498dc9668824dbd7340bd53d33a9cd230a9a86c6 100644 (file)
@@ -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;
index 8895c508acc18f88e243ea8d0a650223808d249a..2db7382005a593d315a548986e70e62ec0ea000e 100644 (file)
@@ -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);
index a93884fd6f78131e1eb317143fa61a28a1a8029d..a06573223853c5b38c8b6b0de5906e77ce1a7650 100644 (file)
@@ -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                    }
 };