summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu/icu-src/source/common/putil.cpp
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-03-27 17:16:39 +0000
committerKarl Berry <karl@freefriends.org>2016-03-27 17:16:39 +0000
commit46133be58cca10fe420003f25e1a301d8bda6192 (patch)
tree0b0299934291f13c12eba2c11cd1ac33911b1224 /Build/source/libs/icu/icu-src/source/common/putil.cpp
parentd96bcc9a2e41bd962e65f3026384837a9bd44734 (diff)
import icu-57.1 (unmodified, TL patches coming next)
git-svn-id: svn://tug.org/texlive/trunk@40154 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/icu/icu-src/source/common/putil.cpp')
-rw-r--r--Build/source/libs/icu/icu-src/source/common/putil.cpp52
1 files changed, 36 insertions, 16 deletions
diff --git a/Build/source/libs/icu/icu-src/source/common/putil.cpp b/Build/source/libs/icu/icu-src/source/common/putil.cpp
index d9f4b94500f..58a1bb3ccd2 100644
--- a/Build/source/libs/icu/icu-src/source/common/putil.cpp
+++ b/Build/source/libs/icu/icu-src/source/common/putil.cpp
@@ -1,7 +1,7 @@
/*
******************************************************************************
*
-* Copyright (C) 1997-2014, International Business Machines
+* Copyright (C) 1997-2015, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
@@ -41,20 +41,6 @@
// Must be before any other #includes.
#include "uposixdefs.h"
-#if (U_PF_MINGW <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(__STRICT_ANSI__)
-/* tzset isn't defined in strict ANSI on Cygwin and MinGW. */
-#undef __STRICT_ANSI__
-#endif
-
-/*
- * Cygwin with GCC requires inclusion of time.h after the above disabling strict asci mode statement.
- */
-#include <time.h>
-
-#if !U_PLATFORM_USES_ONLY_WIN32_API
-#include <sys/time.h>
-#endif
-
/* include ICU headers */
#include "unicode/utypes.h"
#include "unicode/putil.h"
@@ -116,6 +102,20 @@
# include <sys/neutrino.h>
#endif
+#if (U_PF_MINGW <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(__STRICT_ANSI__)
+/* tzset isn't defined in strict ANSI on Cygwin and MinGW. */
+#undef __STRICT_ANSI__
+#endif
+
+/*
+ * Cygwin with GCC requires inclusion of time.h after the above disabling strict asci mode statement.
+ */
+#include <time.h>
+
+#if !U_PLATFORM_USES_ONLY_WIN32_API
+#include <sys/time.h>
+#endif
+
/*
* Only include langinfo.h if we have a way to get the codeset. If we later
* depend on more feature, we can test on U_HAVE_NL_LANGINFO.
@@ -1000,6 +1000,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;
@@ -1383,9 +1387,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");
}
}
@@ -1877,7 +1890,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. */
@@ -2188,6 +2204,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;
@@ -2195,6 +2212,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;
@@ -2203,6 +2221,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;
}