summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-12-28 17:56:40 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-12-29 16:42:33 +0100
commit042033f1e6da22616cb76c8d950c20c9efecbad5 (patch)
tree26b3f1f42d067506f44550b410f3fb9640616a5b /xmlsecurity
parentccfd8e9d09f9ac0a0ea92d0f378391006faaf934 (diff)
loplugin:stringviewparam: operator +
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx12
-rw-r--r--xmlsecurity/qa/unit/xmlsecurity-dialogs-test.cxx2
-rw-r--r--xmlsecurity/source/helper/documentsignaturehelper.cxx27
-rw-r--r--xmlsecurity/source/helper/xmlsignaturehelper.cxx4
4 files changed, 26 insertions, 19 deletions
diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
index a73a392c609b..0c0ce1107a3d 100644
--- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
+++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
@@ -174,7 +174,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFAdd)
OUString aSourceDir = m_directories.getURLFromSrc(DATA_DIRECTORY);
OUString aInURL = aSourceDir + "no.pdf";
OUString aTargetDir
- = m_directories.getURLFromWorkdir("/CppunitTest/xmlsecurity_pdfsigning.test.user/");
+ = m_directories.getURLFromWorkdir(u"/CppunitTest/xmlsecurity_pdfsigning.test.user/");
OUString aOutURL = aTargetDir + "add.pdf";
bool bHadCertificates = sign(aInURL, aOutURL, 0);
@@ -200,7 +200,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFAdd2)
OUString aSourceDir = m_directories.getURLFromSrc(DATA_DIRECTORY);
OUString aInURL = aSourceDir + "no.pdf";
OUString aTargetDir
- = m_directories.getURLFromWorkdir("/CppunitTest/xmlsecurity_pdfsigning.test.user/");
+ = m_directories.getURLFromWorkdir(u"/CppunitTest/xmlsecurity_pdfsigning.test.user/");
OUString aOutURL = aTargetDir + "add.pdf";
bool bHadCertificates = sign(aInURL, aOutURL, 0);
@@ -234,7 +234,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFRemove)
// Remove the signature and write out the result as remove.pdf.
OUString aTargetDir
- = m_directories.getURLFromWorkdir("/CppunitTest/xmlsecurity_pdfsigning.test.user/");
+ = m_directories.getURLFromWorkdir(u"/CppunitTest/xmlsecurity_pdfsigning.test.user/");
OUString aOutURL = aTargetDir + "remove.pdf";
osl::File::copy(aInURL, aOutURL);
{
@@ -265,7 +265,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDFRemoveAll)
// Copy the test document to a temporary file, as it'll be modified.
OUString aTargetDir
- = m_directories.getURLFromWorkdir("/CppunitTest/xmlsecurity_pdfsigning.test.user/");
+ = m_directories.getURLFromWorkdir(u"/CppunitTest/xmlsecurity_pdfsigning.test.user/");
OUString aOutURL = aTargetDir + "remove-all.pdf";
CPPUNIT_ASSERT_EQUAL(
osl::File::RC::E_None,
@@ -348,7 +348,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testPDF16Add)
OUString aSourceDir = m_directories.getURLFromSrc(DATA_DIRECTORY);
OUString aInURL = aSourceDir + "pdf16adobe.pdf";
OUString aTargetDir
- = m_directories.getURLFromWorkdir("/CppunitTest/xmlsecurity_pdfsigning.test.user/");
+ = m_directories.getURLFromWorkdir(u"/CppunitTest/xmlsecurity_pdfsigning.test.user/");
OUString aOutURL = aTargetDir + "add.pdf";
// This failed: verification broke as incorrect xref stream was written as
// part of the new signature.
@@ -438,7 +438,7 @@ CPPUNIT_TEST_FIXTURE(PDFSigningTest, testSigningCertificateAttribute)
OUString aSourceDir = m_directories.getURLFromSrc(DATA_DIRECTORY);
OUString aInURL = aSourceDir + "no.pdf";
OUString aTargetDir
- = m_directories.getURLFromWorkdir("/CppunitTest/xmlsecurity_pdfsigning.test.user/");
+ = m_directories.getURLFromWorkdir(u"/CppunitTest/xmlsecurity_pdfsigning.test.user/");
OUString aOutURL = aTargetDir + "signing-certificate-attribute.pdf";
bool bHadCertificates = sign(aInURL, aOutURL, 0);
if (!bHadCertificates)
diff --git a/xmlsecurity/qa/unit/xmlsecurity-dialogs-test.cxx b/xmlsecurity/qa/unit/xmlsecurity-dialogs-test.cxx
index 41d77079a76b..b5b16c3a72e4 100644
--- a/xmlsecurity/qa/unit/xmlsecurity-dialogs-test.cxx
+++ b/xmlsecurity/qa/unit/xmlsecurity-dialogs-test.cxx
@@ -51,7 +51,7 @@ VclPtr<VclAbstractDialog> XmlsecurityDialogsTest::createDialogByID(sal_uInt32 /*
void XmlsecurityDialogsTest::openAnyDialog()
{
/// process input file containing the UXMLDescriptions of the dialogs to dump
- processDialogBatchFile("xmlsecurity/qa/unit/data/xmlsecurity-dialogs-test.txt");
+ processDialogBatchFile(u"xmlsecurity/qa/unit/data/xmlsecurity-dialogs-test.txt");
}
CPPUNIT_TEST_SUITE_REGISTRATION(XmlsecurityDialogsTest);
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index f1c48daa3a0c..5ff74dcd325c 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -22,6 +22,7 @@
#include <algorithm>
#include <functional>
+#include <string_view>
#include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/embed/XStorage.hpp>
@@ -82,7 +83,7 @@ int compareVersions(
static void ImplFillElementList(
std::vector< OUString >& rList, const Reference < css::embed::XStorage >& rxStore,
- const OUString& rRootStorageName, const bool bRecursive,
+ std::u16string_view rRootStorageName, const bool bRecursive,
const DocumentSignatureAlgorithm mode)
{
const Sequence< OUString > aElements = rxStore->getElementNames();
@@ -190,14 +191,15 @@ DocumentSignatureHelper::CreateElementList(
if (mode == DocumentSignatureAlgorithm::OOo2) //that is, ODF 1.0, 1.1
{
// 1) Main content
- ImplFillElementList(aElements, rxStore, OUString(), false, mode);
+ ImplFillElementList(aElements, rxStore, std::u16string_view(), false, mode);
// 2) Pictures...
OUString aSubStorageName( "Pictures" );
try
{
Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, css::embed::ElementModes::READ );
- ImplFillElementList(aElements, xSubStore, aSubStorageName+aSep, true, mode);
+ ImplFillElementList(
+ aElements, xSubStore, OUString(aSubStorageName+aSep), true, mode);
}
catch(css::io::IOException& )
{
@@ -208,7 +210,8 @@ DocumentSignatureHelper::CreateElementList(
try
{
Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, css::embed::ElementModes::READ );
- ImplFillElementList(aElements, xSubStore, aSubStorageName+aSep, true, mode);
+ ImplFillElementList(
+ aElements, xSubStore, OUString(aSubStorageName+aSep), true, mode);
xSubStore.clear();
// Object folders...
@@ -218,7 +221,8 @@ DocumentSignatureHelper::CreateElementList(
if ( ( rName.match( "Object " ) ) && rxStore->isStorageElement( rName ) )
{
Reference < css::embed::XStorage > xTmpSubStore = rxStore->openStorageElement( rName, css::embed::ElementModes::READ );
- ImplFillElementList(aElements, xTmpSubStore, rName+aSep, true, mode);
+ ImplFillElementList(
+ aElements, xTmpSubStore, OUString(rName+aSep), true, mode);
}
}
}
@@ -230,7 +234,7 @@ DocumentSignatureHelper::CreateElementList(
else
{
// Everything except META-INF
- ImplFillElementList(aElements, rxStore, OUString(), true, mode);
+ ImplFillElementList(aElements, rxStore, std::u16string_view(), true, mode);
}
}
break;
@@ -241,7 +245,8 @@ DocumentSignatureHelper::CreateElementList(
try
{
Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, css::embed::ElementModes::READ );
- ImplFillElementList(aElements, xSubStore, aSubStorageName+aSep, true, mode);
+ ImplFillElementList(
+ aElements, xSubStore, OUString(aSubStorageName+aSep), true, mode);
}
catch( css::io::IOException& )
{
@@ -253,7 +258,8 @@ DocumentSignatureHelper::CreateElementList(
try
{
Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, css::embed::ElementModes::READ );
- ImplFillElementList(aElements, xSubStore, aSubStorageName+aSep, true, mode);
+ ImplFillElementList(
+ aElements, xSubStore, OUString(aSubStorageName+aSep), true, mode);
}
catch( css::io::IOException& )
{
@@ -264,7 +270,8 @@ DocumentSignatureHelper::CreateElementList(
try
{
Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, css::embed::ElementModes::READ );
- ImplFillElementList(aElements, xSubStore, aSubStorageName+aSep, true, mode);
+ ImplFillElementList(
+ aElements, xSubStore, OUString(aSubStorageName+aSep), true, mode);
}
catch( css::io::IOException& )
{
@@ -275,7 +282,7 @@ DocumentSignatureHelper::CreateElementList(
case DocumentSignatureMode::Package:
{
// Everything except META-INF
- ImplFillElementList(aElements, rxStore, OUString(), true, mode);
+ ImplFillElementList(aElements, rxStore, std::u16string_view(), true, mode);
}
break;
}
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index 1857e58f94ad..9977da48f72c 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -325,7 +325,7 @@ bool XMLSignatureHelper::ReadAndVerifySignatureStorage(const uno::Reference<embe
uno::Reference<embed::XStorage> xSubStorage = xStorage->openStorageElement("_rels", nOpenMode);
uno::Reference<io::XInputStream> xRelStream(xSubStorage->openStreamElement("origin.sigs.rels", nOpenMode), uno::UNO_QUERY);
- uno::Sequence< uno::Sequence<beans::StringPair> > aRelationsInfo = comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(xRelStream, "origin.sigs.rels", mxCtx);
+ uno::Sequence< uno::Sequence<beans::StringPair> > aRelationsInfo = comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(xRelStream, u"origin.sigs.rels", mxCtx);
for (sal_Int32 i = 0; i < aRelationsInfo.getLength(); ++i)
{
@@ -414,7 +414,7 @@ void XMLSignatureHelper::EnsureSignaturesRelation(const css::uno::Reference<css:
sal_Int32 nOpenMode = embed::ElementModes::READWRITE;
uno::Reference<embed::XStorage> xSubStorage = xStorage->openStorageElement("_rels", nOpenMode);
uno::Reference<io::XInputStream> xRelStream(xSubStorage->openStreamElement(".rels", nOpenMode), uno::UNO_QUERY);
- std::vector< uno::Sequence<beans::StringPair> > aRelationsInfo = comphelper::sequenceToContainer< std::vector< uno::Sequence<beans::StringPair> > >(comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(xRelStream, ".rels", mxCtx));
+ std::vector< uno::Sequence<beans::StringPair> > aRelationsInfo = comphelper::sequenceToContainer< std::vector< uno::Sequence<beans::StringPair> > >(comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(xRelStream, u".rels", mxCtx));
// Do we have a relation already?
bool bHaveRelation = false;