Issue #1971 - Part 2: Update ICU source to 63.2.

This commit is contained in:
Job Bautista 2022-07-24 21:03:27 +08:00 committed by roytam1
commit 1e69214382
3160 changed files with 275815 additions and 234203 deletions

View file

@ -1,4 +1,4 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
*******************************************************************************
@ -17,7 +17,7 @@
#include "unicode/ustring.h"
#include "unicode/putil.h"
#include "unicode/simpletz.h"
#include "unicode/strenum.h"
#include "umutex.h"
#include "uvector.h"
#include "cmemory.h"
@ -28,6 +28,7 @@
#include "uresimp.h"
#include "uhash.h"
#include "olsontz.h"
#include "uinvchar.h"
static UMutex gZoneMetaLock = U_MUTEX_INITIALIZER;
@ -255,6 +256,12 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
tzid.extract(utzid, ZID_KEY_MAX + 1, tmpStatus);
U_ASSERT(tmpStatus == U_ZERO_ERROR); // we checked the length of tzid already
if (!uprv_isInvariantUString(utzid, -1)) {
// All of known tz IDs are only containing ASCII invariant characters.
status = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
// Check if it was already cached
umtx_lock(&gZoneMetaLock);
{
@ -312,10 +319,10 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
id[len] = (char) 0; // Make sure it is null terminated.
// replace '/' with ':'
char *p = id;
while (*p++) {
if (*p == '/') {
*p = ':';
char *q = id;
while (*q++) {
if (*q == '/') {
*q = ':';
}
}
@ -683,6 +690,7 @@ ZoneMeta::createMetazoneMappings(const UnicodeString &tzid) {
mzMappings = new UVector(deleteOlsonToMetaMappingEntry, NULL, status);
if (U_FAILURE(status)) {
delete mzMappings;
mzMappings = NULL;
uprv_free(entry);
break;
}
@ -784,7 +792,7 @@ static void U_CALLCONV initAvailableMetaZoneIDs () {
break;
}
const char *mzID = ures_getKey(&res);
int32_t len = uprv_strlen(mzID);
int32_t len = static_cast<int32_t>(uprv_strlen(mzID));
UChar *uMzID = (UChar*)uprv_malloc(sizeof(UChar) * (len + 1));
if (uMzID == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
@ -842,13 +850,13 @@ ZoneMeta::createCustomTimeZone(int32_t offset) {
negative = TRUE;
tmp = -offset;
}
int32_t hour, min, sec;
uint8_t hour, min, sec;
tmp /= 1000;
sec = tmp % 60;
sec = static_cast<uint8_t>(tmp % 60);
tmp /= 60;
min = tmp % 60;
hour = tmp / 60;
min = static_cast<uint8_t>(tmp % 60);
hour = static_cast<uint8_t>(tmp / 60);
UnicodeString zid;
formatCustomID(hour, min, sec, negative, zid);