diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-06-01 20:50:37 +0300 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-06-03 09:32:50 +0200 |
commit | 09c657ebe69fe1c2516a10a4452996870f4237d2 (patch) | |
tree | 1e0d6154aa3674599994bd8a4a90e1e4a83af813 /xmlsecurity | |
parent | 675a3928e1cab27cf310c316be65acdbb764ed65 (diff) |
tdf#39593 use UNO3_GETIMPLEMENTATION* macros
Change-Id: I4e9af3b43a5baf19e100f42b3f37a2ade89ada5d
Reviewed-on: https://gerrit.libreoffice.org/73320
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'xmlsecurity')
4 files changed, 6 insertions, 62 deletions
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx index 96ad4ac3c8fe..20b7ba4dac9f 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx @@ -176,34 +176,7 @@ uno::Sequence< OUString > SAL_CALL SecurityEnvironment_MSCryptImpl::getSupported } /* XUnoTunnel */ -sal_Int64 SAL_CALL SecurityEnvironment_MSCryptImpl::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) -{ - if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) { - return reinterpret_cast<sal_Int64>(this); - } - return 0 ; -} - -/* XUnoTunnel extension */ - - -namespace -{ - class theSecurityEnvironment_MSCryptImplUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSecurityEnvironment_MSCryptImplUnoTunnelId > {}; -} - -const uno::Sequence< sal_Int8>& SecurityEnvironment_MSCryptImpl::getUnoTunnelId() { - return theSecurityEnvironment_MSCryptImplUnoTunnelId::get().getSeq(); -} - -/* XUnoTunnel extension */ -SecurityEnvironment_MSCryptImpl* SecurityEnvironment_MSCryptImpl::getImplementation( const uno::Reference< XInterface >& rObj ) { - uno::Reference< XUnoTunnel > xUT( rObj , uno::UNO_QUERY ) ; - if( xUT.is() ) { - return reinterpret_cast<SecurityEnvironment_MSCryptImpl*>(xUT->getSomething( getUnoTunnelId() )); - } else - return nullptr ; -} +UNO3_GETIMPLEMENTATION_IMPL(SecurityEnvironment_MSCryptImpl); HCRYPTPROV SecurityEnvironment_MSCryptImpl::getCryptoProvider() { return m_hProv ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx index 2d7c1e49bc8e..7064cda138e5 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx @@ -27,6 +27,7 @@ #include <wincrypt.h> #include <sal/config.h> #include <rtl/ustring.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/factory.hxx> #include <cppuhelper/implbase.hxx> #include <com/sun/star/uno/Exception.hpp> @@ -124,10 +125,7 @@ class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper< virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; //Methods from XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - - static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() ; - static SecurityEnvironment_MSCryptImpl* getImplementation( const css::uno::Reference< css::uno::XInterface >& rObj ) ; + UNO3_GETIMPLEMENTATION_DECL(SecurityEnvironment_MSCryptImpl) /// @throws css::uno::Exception /// @throws css::uno::RuntimeException diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx index 17c8eea1b71b..8f161d3df2c0 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx @@ -448,32 +448,7 @@ void X509Certificate_MSCryptImpl::setRawCert( Sequence< sal_Int8 > const & rawCe } /* XUnoTunnel */ -sal_Int64 SAL_CALL X509Certificate_MSCryptImpl::getSomething( const Sequence< sal_Int8 >& aIdentifier ) { - if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) { - return reinterpret_cast<sal_Int64>(this); - } - return 0 ; -} - -/* XUnoTunnel extension */ - -namespace -{ - class theX509Certificate_MSCryptImplUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theX509Certificate_MSCryptImplUnoTunnelId > {}; -} - -const Sequence< sal_Int8>& X509Certificate_MSCryptImpl::getUnoTunnelId() { - return theX509Certificate_MSCryptImplUnoTunnelId::get().getSeq(); -} - -/* XUnoTunnel extension */ -X509Certificate_MSCryptImpl* X509Certificate_MSCryptImpl::getImplementation( const Reference< XInterface >& rObj ) { - Reference< XUnoTunnel > xUT( rObj , UNO_QUERY ) ; - if( xUT.is() ) { - return reinterpret_cast<X509Certificate_MSCryptImpl*>(xUT->getSomething( getUnoTunnelId() )); - } else - return nullptr ; -} +UNO3_GETIMPLEMENTATION_IMPL(X509Certificate_MSCryptImpl); static OUString findOIDDescription(char const *oid) { diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx index d19cd4611934..225d5f6bd5a8 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx @@ -29,6 +29,7 @@ #include <rtl/ustring.hxx> #include <cppuhelper/factory.hxx> #include <cppuhelper/implbase.hxx> +#include <comphelper/servicehelper.hxx> #include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -73,7 +74,7 @@ class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper< virtual sal_Int32 SAL_CALL getCertificateUsage( ) override; //Methods from XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + UNO3_GETIMPLEMENTATION_DECL(X509Certificate_MSCryptImpl) /// @see xmlsecurity::Certificate::getSHA256Thumbprint(). virtual css::uno::Sequence<sal_Int8> getSHA256Thumbprint() override; @@ -81,9 +82,6 @@ class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper< /// @see xmlsecurity::Certificate::getSignatureMethodAlgorithm(). virtual svl::crypto::SignatureMethodAlgorithm getSignatureMethodAlgorithm() override; - static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() ; - static X509Certificate_MSCryptImpl* getImplementation( const css::uno::Reference< css::uno::XInterface >& rObj ) ; - //Helper methods void setMswcryCert( const CERT_CONTEXT* cert ) ; const CERT_CONTEXT* getMswcryCert() const ; |