diff options
author | Moritz Duge <moritz.duge@allotropia.de> | 2024-04-26 10:07:53 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2024-04-27 08:26:52 +0200 |
commit | 7c0a776f3a26adc3e83d304990b05133d77d05a8 (patch) | |
tree | c9bddd98ce25a62127b7b926e1fd1f95e1ff718a | |
parent | 60f65e63b4b52891c7725a151f3aeedc3a9de4ac (diff) |
Locally simplify getCertificatesImpl.
Change-Id: I13117b36bb063b0afc498ef237b9255c0a900131
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166638
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Tested-by: Jenkins
-rw-r--r-- | xmlsecurity/source/gpg/SecurityEnvironment.cxx | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx b/xmlsecurity/source/gpg/SecurityEnvironment.cxx index fb105ef5449f..db36415591ff 100644 --- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx +++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx @@ -99,7 +99,6 @@ OUString SecurityEnvironmentGpg::getSecurityEnvironmentInformation() Sequence< Reference < XCertificate > > SecurityEnvironmentGpg::getCertificatesImpl( bool bPrivateOnly ) { std::vector< GpgME::Key > keyList; - std::vector< rtl::Reference<CertificateImpl> > certsList; m_ctx->setKeyListMode(GPGME_KEYLIST_MODE_LOCAL); GpgME::Error err = m_ctx->startKeyListing("", bPrivateOnly ); @@ -115,17 +114,13 @@ Sequence< Reference < XCertificate > > SecurityEnvironmentGpg::getCertificatesIm } m_ctx->endKeyListing(); + Sequence< Reference< XCertificate > > xCertificateSequence(keyList.size()); + auto xCertificateSequenceRange = asNonConstRange(xCertificateSequence); + int i = 0; for (auto const& key : keyList) { rtl::Reference<CertificateImpl> xCert = new CertificateImpl(); xCert->setCertificate(m_ctx.get(),key); - certsList.push_back(xCert); - } - - Sequence< Reference< XCertificate > > xCertificateSequence(certsList.size()); - auto xCertificateSequenceRange = asNonConstRange(xCertificateSequence); - int i = 0; - for (const auto& cert : certsList) { - xCertificateSequenceRange[i++] = cert; + xCertificateSequenceRange[i++] = xCert; // fills xCertificateSequence } return xCertificateSequence; |