summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2023-04-07 09:48:41 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2023-05-02 10:33:38 +0200
commit69e5b9a7d95a481aae23e651729cceb618abd00c (patch)
treec08d42afdc1af8f9ed037b3302cd6618e6877786 /desktop
parentd161c6693039bbddeab447834c4cba271d5426d9 (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>
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..5baa4127ad26 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -31,6 +31,7 @@
#include <rtl/string.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
+#include <rtl/xmlencode.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <ucbhelper/content.hxx>
@@ -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( '/' ) ) ),
+ rtl::encodeForXml( url.subView( 0, url.lastIndexOf( '/' ) ) ),
// xxx todo: encode always for UTF-8? => lookup doc-header?
RTL_TEXTENCODING_UTF8 );
}