From 362a21d3a129b90149f6ef645c127f5e86e0ba61 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 26 Sep 2017 11:28:57 +0300 Subject: Use explicit function names for fooA/fooW WinAPI; prefer fooW We should only use generic foo function name when it takes params that are also dependent on UNICODE define, like LoadCursor( nullptr, IDC_ARROW ) where IDC_ARROW is defined in MSVC headers synchronised with LoadCursor definition. We should always use Unicode API for any file paths operations, because otherwise we will get "?" for any character in path that is not in current non-unicode codepage, which will result in failed file operations. Change-Id: I3a7f453ca0f893002d8a9764318919709fd8b633 Reviewed-on: https://gerrit.libreoffice.org/42935 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- xmlhelp/source/cxxhelp/provider/databases.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'xmlhelp') diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 9b16270d4d1f..8f1694778a25 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -966,20 +966,20 @@ void Databases::cascadingStylesheet( const OUString& Language, aCSS = "highcontrastblack"; #ifdef _WIN32 HKEY hKey = nullptr; - LONG lResult = RegOpenKeyExA( HKEY_CURRENT_USER, "Control Panel\\Accessibility\\HighContrast", 0, KEY_QUERY_VALUE, &hKey ); + LONG lResult = RegOpenKeyExW( HKEY_CURRENT_USER, L"Control Panel\\Accessibility\\HighContrast", 0, KEY_QUERY_VALUE, &hKey ); if ( ERROR_SUCCESS == lResult ) { - CHAR szBuffer[1024]; + WCHAR szBuffer[1024]; DWORD nSize = sizeof( szBuffer ); - lResult = RegQueryValueExA( hKey, "High Contrast Scheme", nullptr, nullptr, reinterpret_cast(szBuffer), &nSize ); + lResult = RegQueryValueExW( hKey, L"High Contrast Scheme", nullptr, nullptr, reinterpret_cast(szBuffer), &nSize ); if ( ERROR_SUCCESS == lResult && nSize > 0 ) { szBuffer[nSize] = '\0'; - if ( strncmp( szBuffer, "High Contrast #1", strlen("High Contrast #1") ) == 0 ) + if ( wcscmp( szBuffer, L"High Contrast #1" ) == 0 ) aCSS = "highcontrast1"; - if ( strncmp( szBuffer, "High Contrast #2", strlen("High Contrast #2") ) == 0 ) + if ( wcscmp( szBuffer, L"High Contrast #2" ) == 0 ) aCSS = "highcontrast2"; - if ( strncmp( szBuffer, "High Contrast White", strlen("High Contrast White") ) == 0 ) + if ( wcscmp( szBuffer, L"High Contrast White" ) == 0 ) aCSS = "highcontrastwhite"; } RegCloseKey( hKey ); -- cgit