Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Unified Diff: source/common/locmap.c

Issue 2440913002: Update ICU to 58.1
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/common/locmap.h ('k') | source/common/locresdata.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/common/locmap.c
diff --git a/source/common/locmap.c b/source/common/locmap.c
index 224a2b179a2498caf0f79b6323f5ee202bb99557..67a5f0d38a14cce2ae52a1862b6cbbe4f1acc43d 100644
--- a/source/common/locmap.c
+++ b/source/common/locmap.c
@@ -1,6 +1,8 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
- * Copyright (C) 1996-2014, International Business Machines
+ * Copyright (C) 1996-2016, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*
@@ -29,7 +31,6 @@
#include "cstring.h"
#include "cmemory.h"
-#if 0
#if U_PLATFORM == U_PF_WINDOWS && defined(_MSC_VER) && (_MSC_VER >= 1500)
/*
* TODO: It seems like we should widen this to
@@ -41,7 +42,6 @@
*/
#define USE_WINDOWS_LOCALE_API
#endif
-#endif
#ifdef USE_WINDOWS_LOCALE_API
#include <windows.h>
@@ -115,7 +115,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}
/*
////////////////////////////////////////////
@@ -198,7 +198,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)
@@ -281,6 +282,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.*/
@@ -320,7 +322,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)
@@ -554,7 +557,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) {
@@ -580,6 +611,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"}
};
@@ -662,6 +694,7 @@ ILCID_POSIX_SUBTABLE(tzm) {
{0x7c5f, "tzm_Latn"},
{0x085f, "tzm_Latn_DZ"},
{0x105f, "tzm_Tfng_MA"},
+ {0x045f, "tzm_Arab_MA"},
{0x045f, "tmz"}
};
@@ -830,6 +863,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 */
@@ -876,7 +910,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.
@@ -990,7 +1024,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
« no previous file with comments | « source/common/locmap.h ('k') | source/common/locresdata.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698