[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - xmlsecurity/inc xmlsecurity/source

Thorsten Behrens Thorsten.Behrens at CIB.de
Thu Jun 22 12:31:44 UTC 2017


 xmlsecurity/inc/digitalsignaturesdialog.hxx                          |    2 
 xmlsecurity/inc/documentsignaturemanager.hxx                         |    2 
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx               |    2 
 xmlsecurity/source/gpg/SecurityEnvironment.cxx                       |    1 
 xmlsecurity/source/helper/documentsignaturemanager.cxx               |    5 --
 xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx |   23 ----------
 6 files changed, 7 insertions(+), 28 deletions(-)

New commits:
commit d86170942e322aabd928bf56854cb7cf08bd13a1
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date:   Thu Jun 22 13:25:20 2017 +0200

    gpg4libre: cleanup some issues
    
    Backport from master, squashed in:
    
    - gpg4libre: Init xmlsec in one place before creating the services
    - xmlsecurity: fix loplugin:unusedvariablecheck warning
    - xmlsecurity: fix loplugin:passstuffbyref warnings
    - xmlsecurity: remove newly introduced redundant namespace alias, used only once
    
    Change-Id: I46a05074706bba77ebc488f0df296e35e2b7d553
    Reviewed-on: https://gerrit.libreoffice.org/39096
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/xmlsecurity/inc/digitalsignaturesdialog.hxx b/xmlsecurity/inc/digitalsignaturesdialog.hxx
index e49419e57a4a..9f488bb91c9f 100644
--- a/xmlsecurity/inc/digitalsignaturesdialog.hxx
+++ b/xmlsecurity/inc/digitalsignaturesdialog.hxx
@@ -103,7 +103,7 @@ private:
 
     css::uno::Reference<css::security::XCertificate> getCertificate(const SignatureInformation& rInfo);
     css::uno::Reference<css::xml::crypto::XSecurityEnvironment> getSecurityEnvironmentForCertificate(
-        css::uno::Reference<css::security::XCertificate> xCert);
+        const css::uno::Reference<css::security::XCertificate>& xCert);
 
     //Checks if adding is allowed.
     //See the spec at specs/www/appwide/security/Electronic_Signatures_and_Security.sxw
diff --git a/xmlsecurity/inc/documentsignaturemanager.hxx b/xmlsecurity/inc/documentsignaturemanager.hxx
index eed54a5a32c7..f354ad8c8cbb 100644
--- a/xmlsecurity/inc/documentsignaturemanager.hxx
+++ b/xmlsecurity/inc/documentsignaturemanager.hxx
@@ -62,7 +62,7 @@ public:
     SignatureStreamHelper ImplOpenSignatureStream(sal_Int32 eStreamMode, bool bTempStream);
     /// Add a new signature, using xCert as a signing certificate, and rDescription as description.
     bool add(const css::uno::Reference<css::security::XCertificate>& xCert,
-             const css::uno::Reference<css::xml::crypto::XXMLSecurityContext> xSecurityContext,
+             const css::uno::Reference<css::xml::crypto::XXMLSecurityContext>& xSecurityContext,
              const OUString& rDescription, sal_Int32& nSecurityId, bool bAdESCompliant);
     /// Remove signature at nPosition.
     void remove(sal_uInt16 nPosition);
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index a9fbe930b30d..f52b65dc9917 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -675,7 +675,7 @@ uno::Reference<security::XCertificate> DigitalSignaturesDialog::getCertificate(c
     return xCert;
 }
 
-uno::Reference<xml::crypto::XSecurityEnvironment> DigitalSignaturesDialog::getSecurityEnvironmentForCertificate(uno::Reference<security::XCertificate> xCert)
+uno::Reference<xml::crypto::XSecurityEnvironment> DigitalSignaturesDialog::getSecurityEnvironmentForCertificate(const uno::Reference<security::XCertificate>& xCert)
 {
     if (xCert->getCertificateKind() == CertificateKind_OPENPGP)
         return maSignatureManager.getGpgSecurityEnvironment();
diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx b/xmlsecurity/source/gpg/SecurityEnvironment.cxx
index 2b8a2d567afd..9892ec6ac5c8 100644
--- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx
+++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx
@@ -93,7 +93,6 @@ Sequence< Reference < XCertificate > > SecurityEnvironmentGpg::getPersonalCertif
 Reference< XCertificate > SecurityEnvironmentGpg::getCertificate( const OUString& issuerName, const Sequence< sal_Int8 >& /*serialNumber*/ )
 {
     CertificateImpl* xCert=nullptr;
-    std::list< CertificateImpl* > certsList;
 
     m_ctx->setKeyListMode(GPGME_KEYLIST_MODE_LOCAL);
     OString ostr = OUStringToOString( issuerName , RTL_TEXTENCODING_UTF8 );
diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx
index ded3de8d9960..ee863e4c2530 100644
--- a/xmlsecurity/source/helper/documentsignaturemanager.cxx
+++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx
@@ -41,7 +41,6 @@
 #include <xmlsec/xmlsec_init.hxx>
 
 using namespace css;
-namespace cssu = com::sun::star::uno;
 
 DocumentSignatureManager::DocumentSignatureManager(const uno::Reference<uno::XComponentContext>& xContext, DocumentSignatureMode eMode)
     : mxContext(xContext),
@@ -254,7 +253,7 @@ SignatureStreamHelper DocumentSignatureManager::ImplOpenSignatureStream(sal_Int3
 }
 
 bool DocumentSignatureManager::add(const uno::Reference<security::XCertificate>& xCert,
-                                   const uno::Reference<xml::crypto::XXMLSecurityContext> xSecurityContext,
+                                   const uno::Reference<xml::crypto::XXMLSecurityContext>& xSecurityContext,
                                    const OUString& rDescription,
                                    sal_Int32& nSecurityId,
                                    bool bAdESCompliant)
@@ -266,7 +265,7 @@ bool DocumentSignatureManager::add(const uno::Reference<security::XCertificate>&
     }
 
     // GPG or X509 key?
-    uno::Reference< lang::XServiceInfo > xServiceInfo( xSecurityContext, cssu::UNO_QUERY );
+    uno::Reference< lang::XServiceInfo > xServiceInfo(xSecurityContext, uno::UNO_QUERY);
     if (xServiceInfo->getImplementationName() == "com.sun.star.xml.security.gpg.XMLSecurityContext_GpgImpl")
     {
         // GPG keys only really have PGPKeyId and PGPKeyPacket
diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
index 90dd4e833af4..b0797f092a7c 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
@@ -38,29 +38,10 @@ XMLSecurityContext_MSCryptImpl::XMLSecurityContext_MSCryptImpl()
     ://m_pKeysMngr( NULL ) ,
      m_xSecurityEnvironment( nullptr )
 {
-    //Init xmlsec library
-    if( xmlSecInit() < 0 ) {
-        throw RuntimeException() ;
-    }
-
-    //Init xmlsec crypto engine library
-    if( xmlSecCryptoInit() < 0 ) {
-        xmlSecShutdown() ;
-        throw RuntimeException() ;
-    }
-
-    //Enable external stream handlers
-    if( xmlEnableStreamInputCallbacks() < 0 ) {
-        xmlSecCryptoShutdown() ;
-        xmlSecShutdown() ;
-        throw RuntimeException() ;
-    }
 }
 
-XMLSecurityContext_MSCryptImpl::~XMLSecurityContext_MSCryptImpl() {
-    xmlDisableStreamInputCallbacks() ;
-    xmlSecCryptoShutdown() ;
-    xmlSecShutdown() ;
+XMLSecurityContext_MSCryptImpl::~XMLSecurityContext_MSCryptImpl()
+{
 }
 
 sal_Int32 SAL_CALL XMLSecurityContext_MSCryptImpl::addSecurityEnvironment(


More information about the Libreoffice-commits mailing list