#include "unicode/udat.h"
#include "unicode/ustring.h"
#include "unicode/utf16.h"
+#include "bytesinkutil.h"
+#include "charstr.h"
#include "tzgnames.h"
#include "cmemory.h"
#include "cstring.h"
#include "putilimp.h"
#include "uassert.h"
#include "ucln_in.h"
+#include "ulocimp.h"
#include "umutex.h"
#include "uresimp.h"
#include "ureslocs.h"
static TextTrieMap *gShortZoneIdTrie = NULL;
static icu::UInitOnce gShortZoneIdTrieInitOnce = U_INITONCE_INITIALIZER;
-static UMutex *gLock() {
- static UMutex *m = STATIC_NEW(UMutex);
- return m;
-}
+static UMutex gLock;
U_CDECL_BEGIN
/**
const char* region = fLocale.getCountry();
int32_t regionLen = static_cast<int32_t>(uprv_strlen(region));
if (regionLen == 0) {
- char loc[ULOC_FULLNAME_CAPACITY];
- uloc_addLikelySubtags(fLocale.getName(), loc, sizeof(loc), &status);
+ CharString loc;
+ {
+ CharStringByteSink sink(&loc);
+ ulocimp_addLikelySubtags(fLocale.getName(), sink, &status);
+ }
- regionLen = uloc_getCountry(loc, fTargetRegion, sizeof(fTargetRegion), &status);
+ regionLen = uloc_getCountry(loc.data(), fTargetRegion, sizeof(fTargetRegion), &status);
if (U_SUCCESS(status)) {
fTargetRegion[regionLen] = 0;
} else {
return isEqual;
}
-Format*
+TimeZoneFormat*
TimeZoneFormat::clone() const {
return new TimeZoneFormat(*this);
}
return NULL;
}
- umtx_lock(gLock());
+ umtx_lock(&gLock);
if (fTimeZoneGenericNames == NULL) {
TimeZoneFormat *nonConstThis = const_cast<TimeZoneFormat *>(this);
nonConstThis->fTimeZoneGenericNames = TimeZoneGenericNames::createInstance(fLocale, status);
}
- umtx_unlock(gLock());
+ umtx_unlock(&gLock);
return fTimeZoneGenericNames;
}
return NULL;
}
- umtx_lock(gLock());
+ umtx_lock(&gLock);
if (fTZDBTimeZoneNames == NULL) {
TZDBTimeZoneNames *tzdbNames = new TZDBTimeZoneNames(fLocale);
if (tzdbNames == NULL) {
nonConstThis->fTZDBTimeZoneNames = tzdbNames;
}
}
- umtx_unlock(gLock());
+ umtx_unlock(&gLock);
return fTZDBTimeZoneNames;
}
while (len > 0) {
UChar32 ch;
int32_t chLen;
- U16_GET(patStr, 0, 0, len, ch)
+ U16_GET(patStr, 0, 0, len, ch);
if (PatternProps::isWhiteSpace(ch)) {
chLen = U16_LENGTH(ch);
len -= chLen;