summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-09-22 17:13:59 +0200
committerStephan Bergmann <sbergman@redhat.com>2021-09-22 19:58:55 +0200
commit924e0774a8201651a762394d51a964a4f8a0c566 (patch)
tree22b3457bb4d225f6ec42d3656b83580449ae11b7 /xmlsecurity
parentdbc82c02eb24ec1c97c6ee32069771d8deb394f9 (diff)
Extend loplugin:stringviewparam to starts/endsWith: xmlsecurity
Change-Id: I8a08b0382121355c70284c2e85375ba6c3671553 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122468 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/helper/ooxmlsecexporter.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
index 324657a96ee0..a202cda19cef 100644
--- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
@@ -20,6 +20,7 @@
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <comphelper/ofopxmlhelper.hxx>
+#include <o3tl/string_view.hxx>
#include <rtl/ref.hxx>
#include <sal/log.hxx>
#include <svx/xoutbmp.hxx>
@@ -55,7 +56,7 @@ public:
}
/// Should we intentionally not sign this stream?
- static bool isOOXMLDenylist(const OUString& rStreamName);
+ static bool isOOXMLDenylist(std::u16string_view rStreamName);
/// Should we intentionally not sign this relation type?
static bool isOOXMLRelationDenylist(const OUString& rRelationName);
@@ -85,16 +86,17 @@ public:
void writeSignatureLineImages();
};
-bool OOXMLSecExporter::Impl::isOOXMLDenylist(const OUString& rStreamName)
+bool OOXMLSecExporter::Impl::isOOXMLDenylist(std::u16string_view rStreamName)
{
static const std::initializer_list<std::u16string_view> vDenylist
= { u"/%5BContent_Types%5D.xml", u"/docProps/app.xml", u"/docProps/core.xml",
// Don't attempt to sign other signatures for now.
u"/_xmlsignatures" };
// Just check the prefix, as we don't care about the content type part of the stream name.
- return std::any_of(
- vDenylist.begin(), vDenylist.end(),
- [&](const std::u16string_view& rLiteral) { return rStreamName.startsWith(rLiteral); });
+ return std::any_of(vDenylist.begin(), vDenylist.end(),
+ [&](const std::u16string_view& rLiteral) {
+ return o3tl::starts_with(rStreamName, rLiteral);
+ });
}
bool OOXMLSecExporter::Impl::isOOXMLRelationDenylist(const OUString& rRelationName)