summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-10-05 06:19:56 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-10-05 16:02:52 +0200
commit1944e3ddc0b2247de3138d2a441cd6999e21fd9a (patch)
treeb59f213e245e151ee792ca424fd06b5a11c88857 /xmlsecurity
parent81d404803f477eb71b74eb9c7a67bba6b1af95d1 (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 'xmlsecurity')
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx7
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx7
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx3
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx5
4 files changed, 13 insertions, 9 deletions
diff --git a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx
index fbff7f04f588..54eaafbfc036 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/security/CertAltNameEntry.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <comphelper/sequence.hxx>
+#include <o3tl/char16_t2wchar_t.hxx>
#include "sanextension_mscryptimpl.hxx"
@@ -93,11 +94,11 @@ css::uno::Sequence< css::security::CertAltNameEntry > SAL_CALL SanExtensionImpl:
}
case CERT_ALT_NAME_RFC822_NAME :
arrCertAltNameEntry[i].Type = ExtAltNameType_RFC822_NAME;
- arrCertAltNameEntry[i].Value <<= OUString(SAL_U(pEntry->pwszRfc822Name));
+ arrCertAltNameEntry[i].Value <<= OUString(o3tl::toU(pEntry->pwszRfc822Name));
break;
case CERT_ALT_NAME_DNS_NAME :
arrCertAltNameEntry[i].Type = ExtAltNameType_DNS_NAME;
- arrCertAltNameEntry[i].Value <<= OUString(SAL_U(pEntry->pwszDNSName));
+ arrCertAltNameEntry[i].Value <<= OUString(o3tl::toU(pEntry->pwszDNSName));
break;
case CERT_ALT_NAME_DIRECTORY_NAME :
{
@@ -106,7 +107,7 @@ css::uno::Sequence< css::security::CertAltNameEntry > SAL_CALL SanExtensionImpl:
}
case CERT_ALT_NAME_URL :
arrCertAltNameEntry[i].Type = ExtAltNameType_URL;
- arrCertAltNameEntry[i].Value <<= OUString(SAL_U(pEntry->pwszURL));
+ arrCertAltNameEntry[i].Value <<= OUString(o3tl::toU(pEntry->pwszURL));
break;
case CERT_ALT_NAME_IP_ADDRESS :
{
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index 32bb0a82f0a8..d7c41b731c11 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -50,6 +50,7 @@
#include <rtl/locale.h>
#include <osl/nlsupport.h>
#include <osl/process.h>
+#include <o3tl/char16_t2wchar_t.hxx>
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::lang ;
@@ -299,7 +300,7 @@ static OUString get_system_name(const void *pvSystemStore,
{
ppwszSystemName = static_cast<LPCWSTR>(pvSystemStore);
}
- return SAL_U(ppwszSystemName);
+ return o3tl::toU(ppwszSystemName);
}
extern "C" BOOL WINAPI cert_enum_physical_store_callback(const void *,
@@ -309,7 +310,7 @@ extern "C" BOOL WINAPI cert_enum_physical_store_callback(const void *,
void *,
void *)
{
- OUString name(SAL_U(pwszStoreName));
+ OUString name(o3tl::toU(pwszStoreName));
if (dwFlags & CERT_PHYSICAL_STORE_PREDEFINED_ENUM_FLAG)
name += " (implicitly created)";
SAL_INFO("xmlsecurity.xmlsec", " Physical store: " << name);
@@ -433,7 +434,7 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl::getCertificate( const
encoding = osl_getTextEncodingFromLocale( pLocale ) ;
//Create cert info from issue and serial
- LPCWSTR pszName = SAL_W( issuerName.getStr() );
+ LPCWSTR pszName = o3tl::toW( issuerName.getStr() );
if( ! ( CertStrToNameW(
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING ,
diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
index 6fd3bdc85c24..2c3357e7fd9e 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/xml/crypto/XMLSecurityContext.hpp>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <o3tl/char16_t2wchar_t.hxx>
namespace cssu = com::sun::star::uno;
namespace cssl = com::sun::star::lang;
@@ -57,7 +58,7 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL
{
sCertDir = OString(sCertDB.getStr(), sCertDB.getLength(), RTL_TEXTENCODING_ASCII_US);
n_pCertStore = sCertDir.getStr();
- n_hStoreHandle = CertOpenSystemStoreW( NULL, SAL_W(sCertDB.getStr())) ;
+ n_hStoreHandle = CertOpenSystemStoreW( NULL, o3tl::toW(sCertDB.getStr())) ;
if( n_hStoreHandle == nullptr )
{
return nullptr;
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index c45b541cf3d7..a4069a91798a 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -31,6 +31,7 @@
#include <rtl/locale.h>
#include <osl/nlsupport.h>
#include <osl/process.h>
+#include <o3tl/char16_t2wchar_t.hxx>
#include <memory>
#include <utility>
@@ -228,7 +229,7 @@ OUString SAL_CALL X509Certificate_MSCryptImpl::getIssuerName() {
}
if(issuer.get()[cchIssuer -1] == 0) cchIssuer--; //delimit the last 0x00;
- OUString xIssuer(SAL_U(issuer.get()), cchIssuer) ;
+ OUString xIssuer(o3tl::toU(issuer.get()), cchIssuer) ;
return replaceTagSWithTagST(xIssuer);
} else {
@@ -265,7 +266,7 @@ OUString SAL_CALL X509Certificate_MSCryptImpl::getSubjectName()
throw RuntimeException() ;
}
- OUString xSubject(SAL_U(subject.get()));
+ OUString xSubject(o3tl::toU(subject.get()));
return replaceTagSWithTagST(xSubject);
} else