diff options
Diffstat (limited to 'desktop/source/deployment/registry/configuration/dp_configuration.cxx')
-rw-r--r-- | desktop/source/deployment/registry/configuration/dp_configuration.cxx | 51 |
1 files changed, 10 insertions, 41 deletions
diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index e2fb409c2f6a..622814248670 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -37,7 +37,9 @@ #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> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> @@ -380,12 +382,12 @@ void BackendImpl::configmgrini_verify_init( xCmdEnv, false /* no throw */ )) { OUString line; - if (readLine( &line, "SCHEMA=", ucb_content, + if (readLine( &line, u"SCHEMA=", ucb_content, RTL_TEXTENCODING_UTF8 )) { sal_Int32 index = RTL_CONSTASCII_LENGTH("SCHEMA="); do { - OUString token( line.getToken( 0, ' ', index ).trim() ); + OUString token( o3tl::trim(o3tl::getToken(line, 0, ' ', index )) ); if (!token.isEmpty()) { //The file may not exist anymore if a shared or bundled //extension was removed, but it can still be in the configmgrini. @@ -396,20 +398,20 @@ void BackendImpl::configmgrini_verify_init( } while (index >= 0); } - if (readLine( &line, "DATA=", ucb_content, + if (readLine( &line, u"DATA=", ucb_content, RTL_TEXTENCODING_UTF8 )) { sal_Int32 index = RTL_CONSTASCII_LENGTH("DATA="); do { - OUString token( line.getToken( 0, ' ', index ).trim() ); - if (!token.isEmpty()) + std::u16string_view token( o3tl::trim(o3tl::getToken(line, 0, ' ', index )) ); + if (!token.empty()) { if (token[ 0 ] == '?') - token = token.copy( 1 ); + token = token.substr( 1 ); //The file may not exist anymore if a shared or bundled //extension was removed, but it can still be in the configmgrini. //After running XExtensionManager::synchronize, the configmgrini is //cleaned up - m_xcu_files.push_back( token ); + m_xcu_files.push_back( OUString(token) ); } } while (index >= 0); @@ -565,39 +567,6 @@ BackendImpl::PackageImpl::isRegistered_( } -OUString encodeForXml( OUString const & text ) -{ - // encode conforming xml: - sal_Int32 len = text.getLength(); - OUStringBuffer buf; - for ( sal_Int32 pos = 0; pos < len; ++pos ) - { - sal_Unicode c = text[ pos ]; - switch (c) { - case '<': - buf.append( "<" ); - break; - case '>': - buf.append( ">" ); - break; - case '&': - buf.append( "&" ); - break; - case '\'': - buf.append( "'" ); - break; - case '\"': - buf.append( """ ); - 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) { @@ -650,7 +619,7 @@ OUString replaceOrigin( if (origin.isEmpty()) { // encode only once origin = OUStringToOString( - encodeForXml( url.copy( 0, url.lastIndexOf( '/' ) ) ), + comphelper::string::encodeForXml( url.subView( 0, url.lastIndexOf( '/' ) ) ), // xxx todo: encode always for UTF-8? => lookup doc-header? RTL_TEXTENCODING_UTF8 ); } |