gecko-dev/intl/icu-patches/bug-1513934-timezone-detection-win7-part1.diff
André Bargull 7f8b902c81 Bug 1513934 - Import ICU patch to fix possible time zone misdetection on Windows 7. r=Waldo
--HG--
extra : amend_source : 9b0b4e865d1195b7124f74ea096d904a31b0cd71
2018-12-14 05:48:46 -08:00

43 lines
1.7 KiB
Diff

From 9a2c52d1744abaa57defc5f2fb25927ae16a3a0e Mon Sep 17 00:00:00 2001
From: Jeff Genovy <29107334+jefgen@users.noreply.github.com>
Date: Wed, 12 Dec 2018 19:42:48 -0800
Subject: [PATCH] ICU-20302 Timezone detection fails on Windows 7. Also add a
test case for Windows time zone detection failing.
---
icu4c/source/common/wintz.cpp | 6 +++---
icu4c/source/test/cintltst/putiltst.c | 11 +++++++++++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/intl/icu/source/common/wintz.cpp b/intl/icu/source/common/wintz.cpp
index 5e9ac0d2f37..8a143d9e782 100644
--- a/intl/icu/source/common/wintz.cpp
+++ b/intl/icu/source/common/wintz.cpp
@@ -35,7 +35,7 @@
U_NAMESPACE_BEGIN
-// The value of MAX_TIMEZONE_ID_LENGTH is 128, which is defined in DYNAMIC_TIME_ZONE_INFORMATION
+// The max size of TimeZoneKeyName is 128, defined in DYNAMIC_TIME_ZONE_INFORMATION
#define MAX_TIMEZONE_ID_LENGTH 128
/**
@@ -44,7 +44,7 @@ U_NAMESPACE_BEGIN
* Note: We use the Win32 API GetDynamicTimeZoneInformation to get the current time zone info.
* This API returns a non-localized time zone name, which we can then map to an ICU time zone name.
*/
-U_CFUNC const char* U_EXPORT2
+U_INTERNAL const char* U_EXPORT2
uprv_detectWindowsTimeZone()
{
UErrorCode status = U_ZERO_ERROR;
@@ -79,7 +79,7 @@ uprv_detectWindowsTimeZone()
// convert from wchar_t* (UTF-16 on Windows) to char* (UTF-8).
u_strToUTF8(dynamicTZKeyName, UPRV_LENGTHOF(dynamicTZKeyName), nullptr,
- reinterpret_cast<const UChar*>(dynamicTZI.TimeZoneKeyName), UPRV_LENGTHOF(dynamicTZI.TimeZoneKeyName), &status);
+ reinterpret_cast<const UChar*>(dynamicTZI.TimeZoneKeyName), -1, &status);
if (U_FAILURE(status)) {
return nullptr;