From 1944e3ddc0b2247de3138d2a441cd6999e21fd9a Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 5 Oct 2017 06:19:56 +0300 Subject: Rename and move SAL_U/W to o3tl::toU/W Previosly (since commit 9ac98e6e3488e434bf4864ecfb13a121784f640b) it was expected to gradually remove SAL_U/W usage in Windows code by replacing with reinterpret_cast or changing to some bettertypes. But as it's useful to make use of fact that LibreOffice and Windows use compatible representation of strings, this commit puts these functions to a better-suited o3tl, and recommends that the functions be consistently used throughout Windows-specific code to reflect the compatibility and keep the casts safe. Change-Id: I2f7c65606d0e2d0c01a00f08812bb4ab7659c5f6 Reviewed-on: https://gerrit.libreoffice.org/43150 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- configmgr/source/winreg.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'configmgr/source') diff --git a/configmgr/source/winreg.cxx b/configmgr/source/winreg.cxx index bf30f8045d8f..995202806931 100644 --- a/configmgr/source/winreg.cxx +++ b/configmgr/source/winreg.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include "winreg.hxx" #include "writemodfile.hxx" @@ -86,7 +87,7 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil HKEY hCurKey; if(RegOpenKeyExW( - hKey, SAL_W(aKeyName.getStr()), 0, + hKey, o3tl::toW(aKeyName.getStr()), 0, KEY_READ, &hCurKey) == ERROR_SUCCESS) { @@ -109,9 +110,9 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil //Make up full key name if(aKeyName.isEmpty()) - aSubkeyName = aKeyName + OUString(SAL_U(buffKeyName)); + aSubkeyName = aKeyName + OUString(o3tl::toU(buffKeyName)); else - aSubkeyName = aKeyName + "\\" + OUString(SAL_U(buffKeyName)); + aSubkeyName = aKeyName + "\\" + OUString(o3tl::toU(buffKeyName)); //Recursion, until no more subkeys are found dumpWindowsRegistryKey(hKey, aSubkeyName, aFileHandle); @@ -140,9 +141,9 @@ void dumpWindowsRegistryKey(HKEY hKey, OUString const & aKeyName, TempFile &aFil const wchar_t wsType[] = L"Type"; if(!wcscmp(pValueName.get(), wsValue)) - aValue = SAL_U(pValue.get()); + aValue = o3tl::toU(pValue.get()); else if (!wcscmp(pValueName.get(), wsType)) - aType = SAL_U(pValue.get()); + aType = o3tl::toU(pValue.get()); else if(!wcscmp(pValueName.get(), wsFinal) && *reinterpret_cast(pValue.get()) == 1) bFinal = true; } -- cgit