X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b331163bffd790ced0e88b73f44f86d49ccc48a5..2ca993e82fb37b597a3c73ecd1586a139a6579c5:/icuSources/common/locmap.c?ds=sidebyside diff --git a/icuSources/common/locmap.c b/icuSources/common/locmap.c index c746ce3d..8459dae0 100644 --- a/icuSources/common/locmap.c +++ b/icuSources/common/locmap.c @@ -1,6 +1,6 @@ /* ********************************************************************** - * Copyright (C) 1996-2014, International Business Machines + * Copyright (C) 1996-2016, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * @@ -113,7 +113,7 @@ static const ILcidPosixElement locmap_ ## id [] = * @param _posixID the full POSIX ID for this entry. */ #define ILCID_POSIX_MAP(_posixID) \ - {sizeof(locmap_ ## _posixID)/sizeof(ILcidPosixElement), locmap_ ## _posixID} + {UPRV_LENGTHOF(locmap_ ## _posixID), locmap_ ## _posixID} /* //////////////////////////////////////////// @@ -196,7 +196,8 @@ ILCID_POSIX_SUBTABLE(bn) { ILCID_POSIX_SUBTABLE(bo) { {0x51, "bo"}, {0x0851, "bo_BT"}, - {0x0451, "bo_CN"} + {0x0451, "bo_CN"}, + {0x0c51, "dz_BT"} }; ILCID_POSIX_ELEMENT_ARRAY(0x047e, br, br_FR) @@ -279,6 +280,7 @@ ILCID_POSIX_SUBTABLE(es) { {0x340a, "es_CL"}, {0x240a, "es_CO"}, {0x140a, "es_CR"}, + {0x5c0a, "es_CU"}, {0x1c0a, "es_DO"}, {0x300a, "es_EC"}, {0x0c0a, "es_ES"}, /*Modern sort.*/ @@ -318,7 +320,8 @@ ILCID_POSIX_SUBTABLE(fa_AF) { ILCID_POSIX_SUBTABLE(ff) { {0x67, "ff"}, {0x7c67, "ff_Latn"}, - {0x0867, "ff_Latn_SN"} + {0x0867, "ff_Latn_SN"}, + {0x0467, "ff_NG"} }; ILCID_POSIX_ELEMENT_ARRAY(0x040b, fi, fi_FI) @@ -552,7 +555,35 @@ ILCID_POSIX_SUBTABLE(qu) { {0x0C6b, "quz_PE"} }; -ILCID_POSIX_ELEMENT_ARRAY(0x0486, qut, qut_GT) /* qut is an ISO-639-3 code */ +ILCID_POSIX_SUBTABLE(quc) { + {0x93, "quc"}, + {0x0493, "quc_CO"}, + /* + "quc_Latn_GT" is an exceptional case. Language ID of "quc" + is 0x93, but LCID of "quc_Latn_GT" is 0x486, which should be + under the group of "qut". "qut" is a retired ISO 639-3 language + code for West Central Quiche, and merged to "quc". + It looks Windows previously reserved "qut" for K'iche', but, + decided to use "quc" when adding a locale for K'iche' (Guatemala). + + This data structure used here assumes language ID bits in + LCID is unique for alphabetic language code. But this is not true + for "quc_Latn_GT". If we don't have the data below, LCID look up + by alphabetic locale ID (POSIX) will fail. The same entry is found + under "qut" below, which is required for reverse look up. + */ + {0x0486, "quc_Latn_GT"} +}; + +ILCID_POSIX_SUBTABLE(qut) { + {0x86, "qut"}, + {0x0486, "qut_GT"}, + /* + See the note in "quc" above. + */ + {0x0486, "quc_Latn_GT"} +}; + ILCID_POSIX_ELEMENT_ARRAY(0x0417, rm, rm_CH) ILCID_POSIX_SUBTABLE(ro) { @@ -578,6 +609,7 @@ ILCID_POSIX_ELEMENT_ARRAY(0x0485, sah,sah_RU) ILCID_POSIX_SUBTABLE(sd) { {0x59, "sd"}, {0x0459, "sd_IN"}, + {0x0459, "sd_Deva_IN"}, {0x0859, "sd_PK"} }; @@ -660,6 +692,7 @@ ILCID_POSIX_SUBTABLE(tzm) { {0x7c5f, "tzm_Latn"}, {0x085f, "tzm_Latn_DZ"}, {0x105f, "tzm_Tfng_MA"}, + {0x045f, "tzm_Arab_MA"}, {0x045f, "tmz"} }; @@ -828,6 +861,7 @@ static const ILcidPosixMap gPosixIDmap[] = { ILCID_POSIX_MAP(ps), /* ps Pashto 0x63 */ ILCID_POSIX_MAP(pt), /* pt Portuguese 0x16 */ ILCID_POSIX_MAP(qu), /* qu Quechua 0x6B */ + ILCID_POSIX_MAP(quc), /* quc K'iche 0x93 */ ILCID_POSIX_MAP(qut), /* qut K'iche 0x86 */ ILCID_POSIX_MAP(rm), /* rm Raeto-Romance/Romansh 0x17 */ ILCID_POSIX_MAP(ro), /* ro Romanian 0x18 */ @@ -874,7 +908,7 @@ static const ILcidPosixMap gPosixIDmap[] = { ILCID_POSIX_MAP(zu), /* zu Zulu 0x35 */ }; -static const uint32_t gLocaleCount = sizeof(gPosixIDmap)/sizeof(ILcidPosixMap); +static const uint32_t gLocaleCount = UPRV_LENGTHOF(gPosixIDmap); /** * Do not call this function. It is called by hostID. @@ -988,7 +1022,7 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr int32_t tmpLen = 0; char locName[157]; /* ULOC_FULLNAME_CAPACITY */ - tmpLen = GetLocaleInfoA(hostid, LOCALE_SNAME, (LPSTR)locName, sizeof(locName)/sizeof(locName[0])); + tmpLen = GetLocaleInfoA(hostid, LOCALE_SNAME, (LPSTR)locName, UPRV_LENGTHOF(locName)); if (tmpLen > 1) { /* Windows locale name may contain sorting variant, such as "es-ES_tradnl". In such case, we need special mapping data found in the hardcoded table