diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2021-10-17 11:59:18 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2021-10-17 17:21:34 +0200 |
commit | 1d1d0bd4d941c58306f3086cf3103b40ad0978ba (patch) | |
tree | 14acd1580a1677e4056bba3623f9f03bf63e77bb /xmlsecurity | |
parent | fb1469ea68b8f87f17e1729e7c5d4cc8ebbb45bd (diff) |
Simplify Sequences in xmlsecurity
Change-Id: I749e19f786ad006dffcd65dd1ee60e57c428f57b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123717
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/qa/unit/signing/signing.cxx | 9 | ||||
-rw-r--r-- | xmlsecurity/source/component/documentdigitalsignatures.cxx | 7 | ||||
-rw-r--r-- | xmlsecurity/source/helper/xsecsign.cxx | 19 | ||||
-rw-r--r-- | xmlsecurity/source/helper/xsecverify.cxx | 14 |
4 files changed, 23 insertions, 26 deletions
diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index aeb401328429..298ee6d38f38 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -1218,8 +1218,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature12_ODF) // create new document from template mxComponent->dispose(); - mxComponent = mxDesktop->loadComponentFromURL(aURL, "_default", 0, - uno::Sequence<beans::PropertyValue>(0)); + mxComponent = mxDesktop->loadComponentFromURL(aURL, "_default", 0, {}); CPPUNIT_ASSERT_MESSAGE(OUStringToOString(sLoadMessage, RTL_TEXTENCODING_UTF8).getStr(), mxComponent.is()); @@ -1316,8 +1315,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDropMacroTemplateSignature) // create new document from template mxComponent->dispose(); - mxComponent = mxDesktop->loadComponentFromURL(aURL, "_default", 0, - uno::Sequence<beans::PropertyValue>(0)); + mxComponent = mxDesktop->loadComponentFromURL(aURL, "_default", 0, {}); CPPUNIT_ASSERT_MESSAGE(OUStringToOString(sLoadMessage, RTL_TEXTENCODING_UTF8).getStr(), mxComponent.is()); @@ -1410,8 +1408,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature10) // create new document from template mxComponent->dispose(); - mxComponent = mxDesktop->loadComponentFromURL(aURL, "_default", 0, - uno::Sequence<beans::PropertyValue>(0)); + mxComponent = mxDesktop->loadComponentFromURL(aURL, "_default", 0, {}); CPPUNIT_ASSERT_MESSAGE(OUStringToOString(sLoadMessage, RTL_TEXTENCODING_UTF8).getStr(), mxComponent.is()); diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx index 686c49d91b63..50cbdf7184a0 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.cxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx @@ -689,13 +689,10 @@ DocumentDigitalSignatures::chooseCertificatesImpl(std::map<OUString, OUString>& CertificateChooser aChooser(Application::GetFrameWeld(mxParentWindow), std::move(xSecContexts), eAction); - uno::Sequence< Reference< css::security::XCertificate > > xCerts(1); - xCerts[0] = Reference< css::security::XCertificate >(nullptr); - if (aChooser.run() != RET_OK) - return xCerts; + return { Reference< css::security::XCertificate >(nullptr) }; - xCerts = aChooser.GetSelectedCertificates(); + uno::Sequence< Reference< css::security::XCertificate > > xCerts = aChooser.GetSelectedCertificates(); rProperties["Description"] = aChooser.GetDescription(); rProperties["Usage"] = aChooser.GetUsageText(); diff --git a/xmlsecurity/source/helper/xsecsign.cxx b/xmlsecurity/source/helper/xsecsign.cxx index 862375febc90..5b3eb6fa266b 100644 --- a/xmlsecurity/source/helper/xsecsign.cxx +++ b/xmlsecurity/source/helper/xsecsign.cxx @@ -67,15 +67,16 @@ css::uno::Reference< css::xml::crypto::sax::XReferenceResolvedListener > XSecCon rtl::Reference<SignatureCreatorImpl> xSignatureCreator(new SignatureCreatorImpl); - css::uno::Sequence<css::uno::Any> args(5); - args[0] <<= OUString::number(nSecurityId); - args[1] <<= uno::Reference<xml::crypto::sax::XSecuritySAXEventKeeper>(m_xSAXEventKeeper); - args[2] <<= OUString::number(nIdOfSignatureElementCollector); - - //for nss, the internal module is used for signing, which needs to be improved later - args[3] <<= m_xSecurityContext->getSecurityEnvironment(); - - args[4] <<= m_xXMLSignature; + css::uno::Sequence<css::uno::Any> args + { + makeAny(OUString::number(nSecurityId)), + makeAny(uno::Reference<xml::crypto::sax::XSecuritySAXEventKeeper>(m_xSAXEventKeeper)), + makeAny(OUString::number(nIdOfSignatureElementCollector)), + + //for nss, the internal module is used for signing, which needs to be improved later + makeAny(m_xSecurityContext->getSecurityEnvironment()), + makeAny(m_xXMLSignature) + }; xSignatureCreator->initialize(args); sal_Int32 nBlockerId = m_xSAXEventKeeper->addBlocker(); diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx index 82efa17eb807..cd0b11c626ab 100644 --- a/xmlsecurity/source/helper/xsecverify.cxx +++ b/xmlsecurity/source/helper/xsecverify.cxx @@ -72,12 +72,14 @@ css::uno::Reference< css::xml::crypto::sax::XReferenceResolvedListener > XSecCon css::uno::Reference<css::lang::XInitialization> xInitialization(xReferenceResolvedListener, css::uno::UNO_QUERY); - css::uno::Sequence<css::uno::Any> args(5); - args[0] <<= OUString::number(nSecurityId); - args[1] <<= uno::Reference<xml::crypto::sax::XSecuritySAXEventKeeper>(m_xSAXEventKeeper); - args[2] <<= OUString::number(nIdOfSignatureElementCollector); - args[3] <<= m_xSecurityContext; - args[4] <<= m_xXMLSignature; + css::uno::Sequence<css::uno::Any> args + { + makeAny(OUString::number(nSecurityId)), + makeAny(uno::Reference<xml::crypto::sax::XSecuritySAXEventKeeper>(m_xSAXEventKeeper)), + makeAny(OUString::number(nIdOfSignatureElementCollector)), + makeAny(m_xSecurityContext), + makeAny(m_xXMLSignature) + }; xInitialization->initialize(args); css::uno::Reference< css::xml::crypto::sax::XSignatureVerifyResultBroadcaster > |