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 /svl | |
parent | 81d404803f477eb71b74eb9c7a67bba6b1af95d1 (diff) |
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 'svl')
-rw-r--r-- | svl/source/crypto/cryptosign.cxx | 5 | ||||
-rw-r--r-- | svl/source/svdde/ddedata.cxx | 5 | ||||
-rw-r--r-- | svl/source/svdde/ddestrg.cxx | 3 | ||||
-rw-r--r-- | svl/source/svdde/ddesvr.cxx | 9 |
4 files changed, 13 insertions, 9 deletions
diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx index 83840fb8de5a..0130e9cc3408 100644 --- a/svl/source/crypto/cryptosign.cxx +++ b/svl/source/crypto/cryptosign.cxx @@ -26,6 +26,7 @@ #include <unotools/datetime.hxx> #include <xmloff/xmluconv.hxx> #include <tools/zcodec.hxx> +#include <o3tl/char16_t2wchar_t.hxx> #if HAVE_FEATURE_NSS && !defined(_WIN32) // NSS headers for PDF signing @@ -1573,7 +1574,7 @@ bool Signing::Sign(OStringBuffer& rCMSHexBuffer) aTsPara.cExtension = 0; aTsPara.rgExtension = nullptr; - if (!CryptRetrieveTimeStamp(SAL_W(m_aSignTSA.getStr()), + if (!CryptRetrieveTimeStamp(o3tl::toW(m_aSignTSA.getStr()), 0, 10000, szOID_NIST_sha256, @@ -1946,7 +1947,7 @@ OUString GetSubjectName(PCCERT_CONTEXT pCertContext) return subjectName; } - subjectName = SAL_U(szName); + subjectName = o3tl::toU(szName); LocalFree(szName); return subjectName; diff --git a/svl/source/svdde/ddedata.cxx b/svl/source/svdde/ddedata.cxx index 5ee335ee67ec..05de89628ffe 100644 --- a/svl/source/svdde/ddedata.cxx +++ b/svl/source/svdde/ddedata.cxx @@ -25,6 +25,7 @@ #include <string.h> #include "ddeimp.hxx" #include <svl/svdde.hxx> +#include <o3tl/char16_t2wchar_t.hxx> #include <osl/thread.h> @@ -134,7 +135,7 @@ sal_uLong DdeData::GetExternalFormat(SotClipboardFormatId nFmt) #if defined(_WIN32) OUString aName( SotExchange::GetFormatName( nFmt ) ); if( !aName.isEmpty() ) - return RegisterClipboardFormatW( SAL_W(aName.getStr()) ); + return RegisterClipboardFormatW( o3tl::toW(aName.getStr()) ); #endif } } @@ -158,7 +159,7 @@ SotClipboardFormatId DdeData::GetInternalFormat(sal_uLong nFmt) WCHAR szName[ 256 ]; if(GetClipboardFormatNameW( nFmt, szName, SAL_N_ELEMENTS(szName) )) - return SotExchange::RegisterFormatName( SAL_U(szName) ); + return SotExchange::RegisterFormatName( o3tl::toU(szName) ); } #endif break; diff --git a/svl/source/svdde/ddestrg.cxx b/svl/source/svdde/ddestrg.cxx index 70cde9aa8594..43fbe5b6d9e4 100644 --- a/svl/source/svdde/ddestrg.cxx +++ b/svl/source/svdde/ddestrg.cxx @@ -20,11 +20,12 @@ #include "ddeimp.hxx" #include <svl/svdde.hxx> +#include <o3tl/char16_t2wchar_t.hxx> DdeString::DdeString( DWORD hDdeInst, const OUString& r) : m_aString(r) { - hString = DdeCreateStringHandleW( hDdeInst, SAL_W(r.getStr()), CP_WINUNICODE ); + hString = DdeCreateStringHandleW( hDdeInst, o3tl::toW(r.getStr()), CP_WINUNICODE ); hInst = hDdeInst; } diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx index 5fa56f50f5ad..ad46b8a85ab5 100644 --- a/svl/source/svdde/ddesvr.cxx +++ b/svl/source/svdde/ddesvr.cxx @@ -25,6 +25,7 @@ #include <svl/svdde.hxx> #include <osl/thread.h> #include <o3tl/sorted_vector.hxx> +#include <o3tl/char16_t2wchar_t.hxx> enum DdeItemType { @@ -97,7 +98,7 @@ HDDEDATA CALLBACK DdeInternal::SvrCallback( while( -1 != n ) { OUString s( sTopics.getToken( 0, '\t', n )); - if( s == SAL_U(chTopicBuf) ) + if( s == o3tl::toU(chTopicBuf) ) ++nTopics; } } @@ -124,7 +125,7 @@ HDDEDATA CALLBACK DdeInternal::SvrCallback( { OUString s( sTopics.getToken( 0, '\t', n )); s = s.replaceAll("\n", "").replaceAll("\r", ""); - if( !hText1 || s == SAL_U(chTopicBuf) ) + if( !hText1 || s == o3tl::toU(chTopicBuf) ) { DdeString aDStr( pInst->hDdeInstSvr, s ); pTopic = FindTopic( *pService, aDStr.getHSZ() ); @@ -423,7 +424,7 @@ DdeItem* DdeInternal::FindItem( DdeTopic& rTopic, HSZ hItem ) // Let's query our subclass WCHAR chBuf[250]; DdeQueryStringW(pInst->hDdeInstSvr,hItem,chBuf,SAL_N_ELEMENTS(chBuf),CP_WINUNICODE ); - bContinue = rTopic.MakeItem( SAL_U(chBuf) ); + bContinue = rTopic.MakeItem( o3tl::toU(chBuf) ); // We need to search again } while( bContinue ); @@ -914,7 +915,7 @@ OUString DdeService::Formats() { WCHAR buf[128]; GetClipboardFormatNameW( (UINT)f, buf, SAL_N_ELEMENTS(buf) ); - s += SAL_U(buf); + s += o3tl::toU(buf); } break; } |