diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 10:10:33 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-31 11:49:22 +0100 |
commit | 2d43223403aca309a051275159fdde2a084a8e51 (patch) | |
tree | 93fd4d4c3150d044434ba87ebefb12059751bdf7 /svl/source/crypto | |
parent | c981ac598ab46eb3ab7d244bf07fdcbb691438b2 (diff) |
Prepare for removal of non-const operator[] from Sequence in svl
Change-Id: I6b71a075de5d5ac002dc48cd2bb21ff5bf5dd072
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124395
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svl/source/crypto')
-rw-r--r-- | svl/source/crypto/cryptosign.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx index 25ac21b695c4..06080d221364 100644 --- a/svl/source/crypto/cryptosign.cxx +++ b/svl/source/crypto/cryptosign.cxx @@ -9,6 +9,7 @@ #include <sal/config.h> +#include <algorithm> #include <string_view> #include <svl/cryptosign.hxx> @@ -1998,8 +1999,9 @@ bool Signing::Verify(const std::vector<unsigned char>& aData, else { uno::Sequence<sal_Int8> aDerCert(pCertificate->derCert.len); + auto aDerCertRange = asNonConstRange(aDerCert); for (size_t i = 0; i < pCertificate->derCert.len; ++i) - aDerCert[i] = pCertificate->derCert.data[i]; + aDerCertRange[i] = pCertificate->derCert.data[i]; OUStringBuffer aBuffer; comphelper::Base64::encode(aBuffer, aDerCert); SignatureInformation::X509Data temp; @@ -2184,8 +2186,8 @@ bool Signing::Verify(const std::vector<unsigned char>& aData, { // Write rInformation.ouX509Certificate. uno::Sequence<sal_Int8> aDerCert(pSignerCertContext->cbCertEncoded); - for (size_t i = 0; i < pSignerCertContext->cbCertEncoded; ++i) - aDerCert[i] = pSignerCertContext->pbCertEncoded[i]; + std::copy_n(pSignerCertContext->pbCertEncoded, pSignerCertContext->cbCertEncoded, + aDerCert.getArray()); OUStringBuffer aBuffer; comphelper::Base64::encode(aBuffer, aDerCert); SignatureInformation::X509Data temp; |