Chromium Code Reviews

Unified Diff: source/common/putil.cpp

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.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « source/common/punycode.cpp ('k') | source/common/putilimp.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/common/putil.cpp
diff --git a/source/common/putil.cpp b/source/common/putil.cpp
index c87b60e3828814edcafe930b82a3d0e735d6c76a..ca1dd445b37019e0c173fde7d893dfa44664f7d9 100644
--- a/source/common/putil.cpp
+++ b/source/common/putil.cpp
@@ -1,7 +1,9 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*
-* Copyright (C) 1997-2014, International Business Machines
+* Copyright (C) 1997-2016, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@@ -1009,6 +1011,10 @@ uprv_tzname(int n)
&& uprv_strcmp(tzid, TZ_ENV_CHECK) != 0
#endif
) {
+ /* The colon forces tzset() to treat the remainder as zoneinfo path */
+ if (tzid[0] == ':') {
+ tzid++;
+ }
/* This might be a good Olson ID. */
skipZoneIDPrefix(&tzid);
return tzid;
@@ -1024,7 +1030,7 @@ uprv_tzname(int n)
because the tzfile contents is underspecified.
This isn't guaranteed to work because it may not be a symlink.
*/
- int32_t ret = (int32_t)readlink(TZDEFAULT, gTimeZoneBuffer, sizeof(gTimeZoneBuffer));
+ int32_t ret = (int32_t)readlink(TZDEFAULT, gTimeZoneBuffer, sizeof(gTimeZoneBuffer)-1);
if (0 < ret) {
int32_t tzZoneInfoLen = uprv_strlen(TZZONEINFO);
gTimeZoneBuffer[ret] = 0;
@@ -1392,9 +1398,18 @@ static const char *uprv_getPOSIXIDForCategory(int category)
{
/* Maybe we got some garbage. Try something more reasonable */
posixID = getenv("LC_ALL");
+ /* Solaris speaks POSIX - See IEEE Std 1003.1-2008
+ * This is needed to properly handle empty env. variables
+ */
+#if U_PLATFORM == U_PF_SOLARIS
+ if ((posixID == 0) || (posixID[0] == '\0')) {
+ posixID = getenv(category == LC_MESSAGES ? "LC_MESSAGES" : "LC_CTYPE");
+ if ((posixID == 0) || (posixID[0] == '\0')) {
+#else
if (posixID == 0) {
posixID = getenv(category == LC_MESSAGES ? "LC_MESSAGES" : "LC_CTYPE");
if (posixID == 0) {
+#endif
posixID = getenv("LANG");
}
}
@@ -1886,7 +1901,10 @@ int_getDefaultCodepage()
localeName = uprv_getPOSIXIDForDefaultCodepage();
uprv_memset(codesetName, 0, sizeof(codesetName));
-#if U_HAVE_NL_LANGINFO_CODESET
+ /* On Solaris nl_langinfo returns C locale values unless setlocale
+ * was called earlier.
+ */
+#if (U_HAVE_NL_LANGINFO_CODESET && U_PLATFORM != U_PF_SOLARIS)
/* When available, check nl_langinfo first because it usually gives more
useful names. It depends on LC_CTYPE.
nl_langinfo may use the same buffer as setlocale. */
@@ -2197,6 +2215,7 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
U_INTERNAL void * U_EXPORT2
uprv_dl_open(const char *libName, UErrorCode *status) {
+ (void)libName;
if(U_FAILURE(*status)) return NULL;
*status = U_UNSUPPORTED_ERROR;
return NULL;
@@ -2204,6 +2223,7 @@ uprv_dl_open(const char *libName, UErrorCode *status) {
U_INTERNAL void U_EXPORT2
uprv_dl_close(void *lib, UErrorCode *status) {
+ (void)lib;
if(U_FAILURE(*status)) return;
*status = U_UNSUPPORTED_ERROR;
return;
@@ -2212,6 +2232,8 @@ uprv_dl_close(void *lib, UErrorCode *status) {
U_INTERNAL UVoidFunction* U_EXPORT2
uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
+ (void)lib;
+ (void)sym;
if(U_SUCCESS(*status)) {
*status = U_UNSUPPORTED_ERROR;
}
« no previous file with comments | « source/common/punycode.cpp ('k') | source/common/putilimp.h » ('j') | no next file with comments »

Powered by Google App Engine