framework/source/fwe/xml/xmlnamespaces.cxx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
New commits: commit 7a7b1f9cbda97e06c71471adb3c0d00b3210a95c Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Oct 21 21:30:22 2024 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Tue Oct 22 06:43:53 2024 +0200 Simplify a bit Change-Id: I224602738ce41529cc5eca681f09db31241a5cac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175385 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/framework/source/fwe/xml/xmlnamespaces.cxx b/framework/source/fwe/xml/xmlnamespaces.cxx index c4fffaf89fe8..d8afe175a159 100644 --- a/framework/source/fwe/xml/xmlnamespaces.cxx +++ b/framework/source/fwe/xml/xmlnamespaces.cxx @@ -33,17 +33,15 @@ void XMLNamespaces::addNamespace( const OUString& aName, const OUString& aValue OUString aNamespaceName( aName ); // delete preceding "xmlns" - constexpr char aXMLAttributeNamespace[] = "xmlns"; - if ( aNamespaceName.startsWith( aXMLAttributeNamespace ) ) + if (std::u16string_view rest; aNamespaceName.startsWith("xmlns", &rest)) { - constexpr sal_Int32 nXMLNamespaceLength = RTL_CONSTASCII_LENGTH(aXMLAttributeNamespace); - if ( aNamespaceName.getLength() == nXMLNamespaceLength ) + if (rest.empty()) { aNamespaceName.clear(); } - else if ( aNamespaceName.getLength() >= nXMLNamespaceLength+2 ) + else if (rest.size() > 1) { - aNamespaceName = aNamespaceName.copy( nXMLNamespaceLength+1 ); + aNamespaceName = rest.substr(1); } else {