diff options
author | Steven R. Loomis <srloomis@us.ibm.com> | 2018-07-09 13:46:16 -0700 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-07-11 00:15:23 +0200 |
commit | 538acead6670d711ddb71c0b852089b792c996e3 (patch) | |
tree | 917c6df14436e66d4883feb7bb9269480fce06ab /deps/icu-small/source/common/wintz.cpp | |
parent | ed715ef8900afa5056ebd5ef995e89eebd4987c2 (diff) | |
download | android-node-v8-538acead6670d711ddb71c0b852089b792c996e3.tar.gz android-node-v8-538acead6670d711ddb71c0b852089b792c996e3.tar.bz2 android-node-v8-538acead6670d711ddb71c0b852089b792c996e3.zip |
deps: icu 62.1 bump (Unicode 11, CLDR 33.1)
- Full release notes: http://site.icu-project.org/download/62
Fixes: https://github.com/nodejs/node/issues/21452
PR-URL: https://github.com/nodejs/node/pull/21728
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Diffstat (limited to 'deps/icu-small/source/common/wintz.cpp')
-rw-r--r-- | deps/icu-small/source/common/wintz.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/deps/icu-small/source/common/wintz.cpp b/deps/icu-small/source/common/wintz.cpp index c30a5dbc60..3708925b38 100644 --- a/deps/icu-small/source/common/wintz.cpp +++ b/deps/icu-small/source/common/wintz.cpp @@ -49,7 +49,7 @@ typedef struct /** * Various registry keys and key fragments. */ -static const char CURRENT_ZONE_REGKEY[] = "SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation\\"; +static const wchar_t CURRENT_ZONE_REGKEY[] = L"SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation\\"; static const char STANDARD_TIME_REGKEY[] = " Standard Time"; static const char TZI_REGKEY[] = "TZI"; static const char STD_REGKEY[] = "Std"; @@ -121,27 +121,39 @@ static LONG getSTDName(const char *winid, char *regStdName, int32_t length) return result; } -static LONG getTZKeyName(char* tzKeyName, int32_t length) +static LONG getTZKeyName(char* tzKeyName, int32_t tzKeyNamelength) { HKEY hkey; LONG result = FALSE; - DWORD cbData = length; + WCHAR timeZoneKeyNameData[128]; + DWORD timeZoneKeyNameLength = static_cast<DWORD>(sizeof(timeZoneKeyNameData)); - if(ERROR_SUCCESS == RegOpenKeyExA( + if(ERROR_SUCCESS == RegOpenKeyExW( HKEY_LOCAL_MACHINE, CURRENT_ZONE_REGKEY, 0, KEY_QUERY_VALUE, &hkey)) { - result = RegQueryValueExA( + if (ERROR_SUCCESS == RegQueryValueExW( hkey, - "TimeZoneKeyName", + L"TimeZoneKeyName", NULL, NULL, - (LPBYTE)tzKeyName, - &cbData); + (LPBYTE)timeZoneKeyNameData, + &timeZoneKeyNameLength)) + { + // Ensure null termination. + timeZoneKeyNameData[UPRV_LENGTHOF(timeZoneKeyNameData) - 1] = L'\0'; + // Convert the UTF-16 string to UTF-8. + UErrorCode status = U_ZERO_ERROR; + u_strToUTF8(tzKeyName, tzKeyNamelength, NULL, reinterpret_cast<const UChar *>(timeZoneKeyNameData), -1, &status); + if (U_ZERO_ERROR == status) + { + result = ERROR_SUCCESS; + } + } RegCloseKey(hkey); } |