diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-10-05 06:19:56 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-10-05 16:02:52 +0200 |
commit | 1944e3ddc0b2247de3138d2a441cd6999e21fd9a (patch) | |
tree | b59f213e245e151ee792ca424fd06b5a11c88857 /sal/qa | |
parent | Fix typos (diff) | |
download | core-1944e3ddc0b2247de3138d2a441cd6999e21fd9a.tar.gz core-1944e3ddc0b2247de3138d2a441cd6999e21fd9a.zip |
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 <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sal/qa')
-rw-r--r-- | sal/qa/osl/security/osl_Security.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
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 <osl/thread.h> #include <rtl/process.h> #include <rtl/strbuf.hxx> +#include <o3tl/char16_t2wchar_t.hxx> 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<unsigned char *>(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<unsigned char *>(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<PSID>(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<BYTE*>(pSid); |