From df645a2bd8a9b5463c74f261268f0d2de7245ccc Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sat, 14 Jul 2012 18:00:06 +0200 Subject: There is not need to allocate memory just for getting the 'indexOf' a literal within a OUString. Change-Id: I01ca30c68228f81b3d313dfca5b975448f3c4fc7 --- framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx | 4 ++-- framework/source/uiconfiguration/uiconfigurationmanager.cxx | 4 ++-- framework/source/uielement/toolbarsmenucontroller.cxx | 8 ++++---- framework/source/uifactory/addonstoolboxfactory.cxx | 2 +- framework/source/uifactory/windowcontentfactorymanager.cxx | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'framework') diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index f6b3eab3f008..ed56814c77a8 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -128,7 +128,7 @@ static const char RESOURCEURL_CUSTOM_ELEMENT[] = "custom_"; static sal_Int16 RetrieveTypeFromResourceURL( const rtl::OUString& aResourceURL ) { - if (( aResourceURL.indexOf( OUString( RESOURCEURL_PREFIX )) == 0 ) && + if (( aResourceURL.indexOf( RESOURCEURL_PREFIX ) == 0 ) && ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE )) { OUString aTmpStr = aResourceURL.copy( RESOURCEURL_PREFIX_SIZE ); @@ -149,7 +149,7 @@ static sal_Int16 RetrieveTypeFromResourceURL( const rtl::OUString& aResourceURL static OUString RetrieveNameFromResourceURL( const rtl::OUString& aResourceURL ) { - if (( aResourceURL.indexOf( OUString( RESOURCEURL_PREFIX )) == 0 ) && + if (( aResourceURL.indexOf( RESOURCEURL_PREFIX ) == 0 ) && ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE )) { sal_Int32 nIndex = aResourceURL.lastIndexOf( '/' ); diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index 34eb8a93311b..9132b2956b9b 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -125,7 +125,7 @@ static const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17; static sal_Int16 RetrieveTypeFromResourceURL( const rtl::OUString& aResourceURL ) { - if (( aResourceURL.indexOf( rtl::OUString( RESOURCEURL_PREFIX )) == 0 ) && + if (( aResourceURL.indexOf( RESOURCEURL_PREFIX ) == 0 ) && ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE )) { rtl::OUString aTmpStr = aResourceURL.copy( RESOURCEURL_PREFIX_SIZE ); @@ -146,7 +146,7 @@ static sal_Int16 RetrieveTypeFromResourceURL( const rtl::OUString& aResourceURL static rtl::OUString RetrieveNameFromResourceURL( const rtl::OUString& aResourceURL ) { - if (( aResourceURL.indexOf( rtl::OUString( RESOURCEURL_PREFIX )) == 0 ) && + if (( aResourceURL.indexOf( RESOURCEURL_PREFIX ) == 0 ) && ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE )) { sal_Int32 nIndex = aResourceURL.lastIndexOf( '/' ); diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 87a80a51a56a..0b728b5a0959 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -182,7 +182,7 @@ void ToolbarsMenuController::addCommand( Reference< awt::XMenuExtended > xMenuExtended( m_xPopupMenu, UNO_QUERY ); xMenuExtended->setCommand( nItemId, rCommandURL ); - bool bInternal = ( rCommandURL.indexOf( rtl::OUString( STATIC_INTERNAL_CMD_PART )) == 0); + bool bInternal = ( rCommandURL.indexOf( STATIC_INTERNAL_CMD_PART ) == 0); if ( !bInternal ) { if ( !getDispatchFromCommandURL( rCommandURL ).is() ) @@ -638,7 +638,7 @@ void SAL_CALL ToolbarsMenuController::select( const css::awt::MenuEvent& rEvent PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu(); rtl::OUString aCmd( pVCLPopupMenu->GetItemCommand( rEvent.MenuId )); - if ( aCmd.indexOf( rtl::OUString( STATIC_INTERNAL_CMD_PART )) == 0 ) + if ( aCmd.indexOf( STATIC_INTERNAL_CMD_PART ) == 0 ) { // Command to restore the visibility of all context sensitive toolbars Reference< XNameReplace > xNameReplace( xPersistentWindowState, UNO_QUERY ); @@ -719,7 +719,7 @@ void SAL_CALL ToolbarsMenuController::select( const css::awt::MenuEvent& rEvent } } } - else if ( aCmd.indexOf( rtl::OUString( STATIC_CMD_PART )) < 0 ) + else if ( aCmd.indexOf( STATIC_CMD_PART ) < 0 ) { URL aTargetURL; Sequence aArgs; @@ -787,7 +787,7 @@ void SAL_CALL ToolbarsMenuController::activate( const css::awt::MenuEvent& ) thr const sal_uInt32 nCount = aCmdVector.size(); for ( sal_uInt32 i = 0; i < nCount; i++ ) { - bool bInternal = ( aCmdVector[i].indexOf( rtl::OUString( STATIC_INTERNAL_CMD_PART )) == 0); + bool bInternal = ( aCmdVector[i].indexOf( STATIC_INTERNAL_CMD_PART ) == 0); if ( !bInternal ) { diff --git a/framework/source/uifactory/addonstoolboxfactory.cxx b/framework/source/uifactory/addonstoolboxfactory.cxx index c8d0d6d13d63..06841b59d4b8 100644 --- a/framework/source/uifactory/addonstoolboxfactory.cxx +++ b/framework/source/uifactory/addonstoolboxfactory.cxx @@ -181,7 +181,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, Args[n].Value >>= aResourceURL; } - if ( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/addon_" ))) != 0 ) + if ( aResourceURL.indexOf( "private:resource/toolbar/addon_" ) != 0 ) throw IllegalArgumentException(); // Identify frame and determine module identifier to look for context based buttons diff --git a/framework/source/uifactory/windowcontentfactorymanager.cxx b/framework/source/uifactory/windowcontentfactorymanager.cxx index 9d9f8fe442b9..320026c517be 100644 --- a/framework/source/uifactory/windowcontentfactorymanager.cxx +++ b/framework/source/uifactory/windowcontentfactorymanager.cxx @@ -104,7 +104,7 @@ void WindowContentFactoryManager::RetrieveTypeNameFromResourceURL( const rtl::OU const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17; const char RESOURCEURL_PREFIX[] = "private:resource/"; - if (( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) && + if (( aResourceURL.indexOf( RESOURCEURL_PREFIX ) == 0 ) && ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE )) { rtl::OUString aTmpStr( aResourceURL.copy( RESOURCEURL_PREFIX_SIZE )); -- cgit v1.2.3