summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-15 16:43:40 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-15 20:11:48 +0200
commit558aaa9ed222e7142fe87c9bab9a8293a5e2a159 (patch)
tree7b9a0361dd07dbc0ca6b67ef130d27368569cf18 /xmlsecurity
parentba74c925a5ef872c291613d4be589e1ab4b4e9e1 (diff)
use more string_view in xml*
Change-Id: Ie219cb3feb98660463858d00f82f882881946ad0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133072 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/inc/documentsignaturemanager.hxx2
-rw-r--r--xmlsecurity/source/helper/documentsignaturemanager.cxx11
2 files changed, 7 insertions, 6 deletions
diff --git a/xmlsecurity/inc/documentsignaturemanager.hxx b/xmlsecurity/inc/documentsignaturemanager.hxx
index 06a1a4194be3..06dd200de365 100644
--- a/xmlsecurity/inc/documentsignaturemanager.hxx
+++ b/xmlsecurity/inc/documentsignaturemanager.hxx
@@ -84,7 +84,7 @@ public:
* Checks if a particular stream is a valid xml stream. Those are treated
* differently when they are signed (c14n transformation)
*/
- bool isXML(const OUString& rURI);
+ bool isXML(std::u16string_view rURI);
bool readManifest();
SignatureStreamHelper ImplOpenSignatureStream(sal_Int32 nStreamOpenMode, bool bTempStream);
diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx
index b48a33fe2e05..83606dc963e6 100644
--- a/xmlsecurity/source/helper/documentsignaturemanager.cxx
+++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx
@@ -41,6 +41,7 @@
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <tools/datetime.hxx>
+#include <o3tl/string_view.hxx>
#include <certificate.hxx>
#include <biginteger.hxx>
@@ -166,7 +167,7 @@ bool DocumentSignatureManager::readManifest()
The parameter is an encoded uri. However, the manifest contains paths. Therefore
the path is encoded as uri, so they can be compared.
*/
-bool DocumentSignatureManager::isXML(const OUString& rURI)
+bool DocumentSignatureManager::isXML(std::u16string_view rURI)
{
SAL_WARN_IF(!mxStore.is(), "xmlsecurity.helper", "empty storage reference");
@@ -207,11 +208,11 @@ bool DocumentSignatureManager::isXML(const OUString& rURI)
//Files can only be encrypted if they are in the manifest.xml.
//That is, the current file cannot be encrypted, otherwise bPropsAvailable
//would be true.
- sal_Int32 nSep = rURI.lastIndexOf('.');
- if (nSep != -1)
+ size_t nSep = rURI.rfind('.');
+ if (nSep != std::u16string_view::npos)
{
- OUString aExt = rURI.copy(nSep + 1);
- if (aExt.equalsIgnoreAsciiCase("XML"))
+ std::u16string_view aExt = rURI.substr(nSep + 1);
+ if (o3tl::equalsIgnoreAsciiCase(aExt, u"XML"))
bIsXML = true;
}
}