[Libreoffice-commits] core.git: xmlsecurity/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 22 17:59:35 UTC 2021


 xmlsecurity/source/helper/ooxmlsecexporter.cxx |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 924e0774a8201651a762394d51a964a4f8a0c566
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Sep 22 17:13:59 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Sep 22 19:58:55 2021 +0200

    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 at redhat.com>

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)


More information about the Libreoffice-commits mailing list