From 9d94148b0429acf77880742c0569bbebddd794f9 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 12 Dec 2014 17:51:36 +0100 Subject: desktop: Use appropriate OUString functions on string constants Change-Id: I5791c212a103fe9c2a5376545944a70454b28bdd --- desktop/source/app/appinit.cxx | 12 +++++------- desktop/source/app/cmdlinehelp.cxx | 10 +++++----- desktop/source/deployment/inc/dp_ucb.h | 3 +-- desktop/source/deployment/manager/dp_manager.cxx | 9 ++------- desktop/source/offacc/acceptor.cxx | 6 +++--- desktop/source/splash/unxsplash.cxx | 6 ++---- 6 files changed, 18 insertions(+), 28 deletions(-) (limited to 'desktop') diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx index 02478a4b7450..797ea9c84a74 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -234,7 +234,7 @@ void Desktop::destroyAcceptor(const OUString& aAcceptString) { // special case stop all acceptors AcceptorMap &rMap = acceptorMap::get(); - if (aAcceptString.equalsAscii("all")) { + if (aAcceptString == "all") { rMap.clear(); } else { @@ -283,9 +283,8 @@ void Desktop::CreateTemporaryDirectory() } // set temp base directory - sal_Int32 nLength = aTempBaseURL.getLength(); - if ( aTempBaseURL.matchAsciiL( "/", 1, nLength-1 ) ) - aTempBaseURL = aTempBaseURL.copy( 0, nLength - 1 ); + if ( aTempBaseURL.endsWith( "/" ) ) + aTempBaseURL = aTempBaseURL.copy( 0, aTempBaseURL.getLength() - 1 ); OUString aRet; OUString aTempPath( aTempBaseURL ); @@ -298,9 +297,8 @@ void Desktop::CreateTemporaryDirectory() { ::osl::File::getTempDirURL( aTempBaseURL ); - nLength = aTempBaseURL.getLength(); - if ( aTempBaseURL.matchAsciiL( "/", 1, nLength-1 ) ) - aTempBaseURL = aTempBaseURL.copy( 0, nLength - 1 ); + if ( aTempBaseURL.endsWith( "/" ) ) + aTempBaseURL = aTempBaseURL.copy( 0, aTempBaseURL.getLength() - 1 ); aTempPath = aTempBaseURL; ::osl::FileBase::getFileURLFromSystemPath( aRet, aTempPath ); diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx index dbec4e918f42..614fa5a99a89 100644 --- a/desktop/source/app/cmdlinehelp.cxx +++ b/desktop/source/app/cmdlinehelp.cxx @@ -139,11 +139,11 @@ namespace desktop { // if you put variables in other chunks don't forget to call the replace routines // for those chunks... - OUString aHelpMessage_version = OUString::createFromAscii(aCmdLineHelp_version); - OUString aHelpMessage_head = OUString::createFromAscii(aCmdLineHelp_head); - OUString aHelpMessage_left = OUString::createFromAscii(aCmdLineHelp_left); - OUString aHelpMessage_right = OUString::createFromAscii(aCmdLineHelp_right); - OUString aHelpMessage_bottom = OUString::createFromAscii(aCmdLineHelp_bottom); + OUString aHelpMessage_version(aCmdLineHelp_version); + OUString aHelpMessage_head(aCmdLineHelp_head); + OUString aHelpMessage_left(aCmdLineHelp_left); + OUString aHelpMessage_right(aCmdLineHelp_right); + OUString aHelpMessage_bottom(aCmdLineHelp_bottom); aHelpMessage_version = ReplaceStringHookProc(aHelpMessage_version); aHelpMessage_head = aHelpMessage_head.replaceFirst( "%CMDNAME", "soffice" ); if (!unknown.isEmpty()) diff --git a/desktop/source/deployment/inc/dp_ucb.h b/desktop/source/deployment/inc/dp_ucb.h index 2b267056fd31..ee68c63ce935 100644 --- a/desktop/source/deployment/inc/dp_ucb.h +++ b/desktop/source/deployment/inc/dp_ucb.h @@ -45,8 +45,7 @@ struct DESKTOP_DEPLOYMENTMISC_DLLPUBLIC StrTitle } static OUString getTitle( ::ucbhelper::Content &rContent ) { - return OUString( rContent.getPropertyValue( - OUString::createFromAscii( "Title" ) ).get() ); + return rContent.getPropertyValue("Title").get(); } // just return titles - the ucbhelper should have a simpler API for this [!] static css::uno::Reference< css::sdbc::XResultSet > diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index a4eb6c6bde33..8d9050187448 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -192,16 +192,11 @@ void PackageManagerImpl::initActivationLayer( Reference( xResultSet, UNO_QUERY_THROW )->getString( 1 /* Title */ ) ); - - const char extensionRemoved[] = "removed"; - if (title.endsWith( extensionRemoved )) + if (title.endsWith("removed", &title)) { //save the file name withouth the "removed" part - sal_Int32 index = title.lastIndexOfAsciiL( - extensionRemoved, sizeof(extensionRemoved) - 1); - OUString remFile = title.copy(0, index); removedEntries.push_back(::rtl::Uri::encode( - remFile, rtl_UriCharClassPchar, + title, rtl_UriCharClassPchar, rtl_UriEncodeIgnoreEscapes, RTL_TEXTENCODING_UTF8 ) ); } diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx index ef64f9f65116..85b729c862f1 100644 --- a/desktop/source/offacc/acceptor.cxx +++ b/desktop/source/offacc/acceptor.cxx @@ -232,15 +232,15 @@ Reference AccInstanceProvider::getInstance (const OUString& aName ) Reference rInstance; - if ( aName.equalsAscii( "StarOffice.ServiceManager" ) ) + if ( aName == "StarOffice.ServiceManager" ) { rInstance = Reference< XInterface >( m_rContext->getServiceManager() ); } - else if(aName.equalsAscii( "StarOffice.ComponentContext" ) ) + else if ( aName == "StarOffice.ComponentContext" ) { rInstance = m_rContext; } - else if ( aName.equalsAscii("StarOffice.NamingService" ) ) + else if ( aName == "StarOffice.NamingService" ) { Reference< XNamingService > rNamingService( m_rContext->getServiceManager()->createInstanceWithContext("com.sun.star.uno.NamingService", m_rContext), diff --git a/desktop/source/splash/unxsplash.cxx b/desktop/source/splash/unxsplash.cxx index 9f34c4170324..c41f233227cb 100644 --- a/desktop/source/splash/unxsplash.cxx +++ b/desktop/source/splash/unxsplash.cxx @@ -25,8 +25,6 @@ #include #include -#define PIPE_ARG "--splash-pipe=" - namespace desktop { UnxSplashScreen::UnxSplashScreen( const Reference< uno::XComponentContext >& xCtx ) @@ -104,9 +102,9 @@ UnxSplashScreen::initialize( const ::com::sun::star::uno::Sequence< ::com::sun:: { OUString aArg; osl_getCommandArg( i, &aArg.pData ); - if ( aArg.matchIgnoreAsciiCaseAsciiL( PIPE_ARG, sizeof( PIPE_ARG ) - 1, 0 ) ) + OUString aNum; + if ( aArg.startsWithIgnoreAsciiCase("--splash-pipe=", &aNum) ) { - OUString aNum = aArg.copy( sizeof( PIPE_ARG ) - 1 ); int fd = aNum.toInt32(); m_pOutFd = fdopen( fd, "w" ); #if OSL_DEBUG_LEVEL > 1 -- cgit