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 --- sal/qa/osl/security/osl_Security.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'sal/qa/osl') diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx index 90502118cfed..c6692f3ef0f1 100644 --- a/sal/qa/osl/security/osl_Security.cxx +++ b/sal/qa/osl/security/osl_Security.cxx @@ -29,6 +29,7 @@ #include #include #include +#include using namespace osl; using namespace rtl; @@ -366,11 +367,11 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *, lpszSystemInfo = wchBuffer; if( GetUserNameW(lpszSystemInfo, &cchBuff) ) - strUserName = SAL_U(lpszSystemInfo); + strUserName = o3tl::toU(lpszSystemInfo); cchBuff = BUFSIZE; if( GetComputerNameW(lpszSystemInfo, &cchBuff) ) - strComputerName = SAL_U(lpszSystemInfo); + strComputerName = o3tl::toU(lpszSystemInfo); /// Get user home directory. HKEY hRegKey; @@ -382,7 +383,7 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *, DWORD Type; lRet = RegQueryValueExW(hRegKey, L"AppData", nullptr, &Type, reinterpret_cast(PathW), &lSize); - if ( ( lRet == ERROR_SUCCESS ) && ( Type == REG_SZ ) && ( _waccess( SAL_W(PathW), 0 ) == 0 ) ) + if ( ( lRet == ERROR_SUCCESS ) && ( Type == REG_SZ ) && ( _waccess( o3tl::toW(PathW), 0 ) == 0 ) ) { CPPUNIT_ASSERT_EQUAL_MESSAGE( "#Convert from system path to URL failed.", ::osl::File::E_None, ::osl::File::getFileURLFromSystemPath( PathW, strConfigDirectory ) ); @@ -390,7 +391,7 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *, lSize = sizeof(PathW); lRet = RegQueryValueExW(hRegKey, L"Personal", nullptr, &Type, reinterpret_cast(PathW), &lSize); - if ( ( lRet == ERROR_SUCCESS ) && ( Type == REG_SZ ) && ( _waccess( SAL_W(PathW), 0 ) == 0 ) ) + if ( ( lRet == ERROR_SUCCESS ) && ( Type == REG_SZ ) && ( _waccess( o3tl::toW(PathW), 0 ) == 0 ) ) { CPPUNIT_ASSERT_EQUAL_MESSAGE( "#Convert from system path to URL failed.", ::osl::File::E_None, ::osl::File::getFileURLFromSystemPath( PathW, strHomeDirectory ) ); @@ -411,7 +412,7 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *, SID_NAME_USE eSidType; DWORD dwErrorCode = 0; - LPCWSTR wszAccName = SAL_W(strUserName.getStr( )); + LPCWSTR wszAccName = o3tl::toW(strUserName.getStr( )); // Create buffers for the SID and the domain name. PSID pSid = static_cast(new BYTE[dwSidBufferSize]); @@ -524,7 +525,7 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *, *GetSidSubAuthority(pSid, dwCounter) ); } - strUserID = SAL_U(Ident); + strUserID = o3tl::toU(Ident); free(Ident); delete [] static_cast(pSid); -- cgit