From 52a2c19fc403affea4e609add8fd3aebe1bbb220 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 15 Jun 2024 23:35:45 +0500 Subject: [PATCH] Remove some unneeded casts This also changes the API used in WriteLibraryToRegistry. Change-Id: Iba4c20567275a64684be8695c771e4c5535956ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168912 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- embedserv/source/inprocserv/dllentry.cxx | 2 +- shell/source/win32/shlxthandler/util/registry.cxx | 4 ++-- vcl/win/window/salframe.cxx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/embedserv/source/inprocserv/dllentry.cxx b/embedserv/source/inprocserv/dllentry.cxx index 4cc8ebdc6024..4b430336d7e5 100644 --- a/embedserv/source/inprocserv/dllentry.cxx +++ b/embedserv/source/inprocserv/dllentry.cxx @@ -71,7 +71,7 @@ namespace { pos += suffix.copy(pos, suffix.size()); assert(pos == end - 1); *pos = 0; - if (ERROR_SUCCESS == RegSetValueExW(HKEY_LOCAL_MACHINE, pSubKey, 0, REG_SZ, reinterpret_cast(pLibrary), nLen*sizeof(wchar_t))) + if (ERROR_SUCCESS == RegSetKeyValueW(HKEY_LOCAL_MACHINE, pSubKey, nullptr, REG_SZ, pLibrary, nLen*sizeof(wchar_t))) bLocalSuccess = true; } diff --git a/shell/source/win32/shlxthandler/util/registry.cxx b/shell/source/win32/shlxthandler/util/registry.cxx index 5e4f73797606..209eb399c923 100644 --- a/shell/source/win32/shlxthandler/util/registry.cxx +++ b/shell/source/win32/shlxthandler/util/registry.cxx @@ -30,7 +30,7 @@ bool SetRegistryKey(HKEY RootKey, const Filepath_char_t* KeyName, const Filepath_char_t* ValueName, const Filepath_char_t* Value) { - int rc = RegSetKeyValueW(RootKey, KeyName, ValueName, REG_SZ, reinterpret_cast(Value), + int rc = RegSetKeyValueW(RootKey, KeyName, ValueName, REG_SZ, Value, (wcslen(Value) + 1) * sizeof(*Value)); return (ERROR_SUCCESS == rc); } @@ -59,7 +59,7 @@ bool QueryRegistryKey(HKEY RootKey, const Filepath_char_t* KeyName, const Filepa { DWORD dwBytes = dwBufLen * sizeof(*pszData); LSTATUS rc = RegGetValueW(RootKey, KeyName, ValueName, RRF_RT_REG_SZ, nullptr, - reinterpret_cast(pszData), &dwBytes); + pszData, &dwBytes); return (ERROR_SUCCESS == rc); } diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index ebcb85f55cff..1661d3408fa8 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -2656,7 +2656,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) wchar_t aValueBuf[10]; DWORD nValueSize = sizeof( aValueBuf ); if (RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\Desktop", L"MenuShowDelay", - RRF_RT_REG_SZ, nullptr, reinterpret_cast(aValueBuf), &nValueSize) + RRF_RT_REG_SZ, nullptr, aValueBuf, &nValueSize) == ERROR_SUCCESS) { aMouseSettings.SetMenuDelay( static_cast(ImplW2I( aValueBuf )) ); @@ -2947,7 +2947,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) DWORD nValueSize = sizeof( aValueBuf ); if (RegGetValueW(HKEY_CURRENT_USER, L"Control Panel\\International\\Calendars\\TwoDigitYearMax", L"1", - RRF_RT_REG_SZ, nullptr, reinterpret_cast(aValueBuf), &nValueSize) + RRF_RT_REG_SZ, nullptr, aValueBuf, &nValueSize) == ERROR_SUCCESS) { DWORD nValue = static_cast(ImplW2I(aValueBuf));