summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2023-04-07 09:48:41 +0200
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-06-14 13:27:04 +0200
commit71075740aee2e15f574d19d452f0a586e25a6bd0 (patch)
treeb93c1fcfc73ef99400818a20e4b045069c50ebea /desktop
parent427769a751d3f45e41e5a0f4aed385bb2727998c (diff)
Make encodeForXml accessible for other modules
and share similar code Change-Id: I7729a46d40845893f577c273c1ab340f69ebb51b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151230 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151754 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configuration.cxx36
1 files changed, 2 insertions, 34 deletions
diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index 1f4ba053ec55..622814248670 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -37,6 +37,7 @@
#include <unotools/ucbhelper.hxx>
#include <xmlscript/xml_helper.hxx>
#include <comphelper/lok.hxx>
+#include <comphelper/xmlencode.hxx>
#include <svl/inettype.hxx>
#include <o3tl/string_view.hxx>
#include <com/sun/star/configuration/Update.hpp>
@@ -566,39 +567,6 @@ BackendImpl::PackageImpl::isRegistered_(
}
-OUString encodeForXml( std::u16string_view text )
-{
- // encode conforming xml:
- size_t len = text.size();
- OUStringBuffer buf;
- for ( size_t pos = 0; pos < len; ++pos )
- {
- sal_Unicode c = text[ pos ];
- switch (c) {
- case '<':
- buf.append( "&lt;" );
- break;
- case '>':
- buf.append( "&gt;" );
- break;
- case '&':
- buf.append( "&amp;" );
- break;
- case '\'':
- buf.append( "&apos;" );
- break;
- case '\"':
- buf.append( "&quot;" );
- break;
- default:
- buf.append( c );
- break;
- }
- }
- return buf.makeStringAndClear();
-}
-
-
OUString replaceOrigin(
OUString const & url, std::u16string_view destFolder, Reference< XCommandEnvironment > const & xCmdEnv, Reference< XComponentContext > const & xContext, bool & out_replaced)
{
@@ -651,7 +619,7 @@ OUString replaceOrigin(
if (origin.isEmpty()) {
// encode only once
origin = OUStringToOString(
- encodeForXml( url.subView( 0, url.lastIndexOf( '/' ) ) ),
+ comphelper::string::encodeForXml( url.subView( 0, url.lastIndexOf( '/' ) ) ),
// xxx todo: encode always for UTF-8? => lookup doc-header?
RTL_TEXTENCODING_UTF8 );
}