summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-03-20 13:02:46 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-03-20 13:05:35 +0100
commit2d9ce9191da681e4fd9f1d08933ca5117c56601b (patch)
treeeecfa2690dcaffca064cc5712d7a5c9662a32b87
parentdc06576d8809760b79f771831bed3122878e0505 (diff)
Remove uses of rtl::OUString::compareToAscii(asciiStr, maxLength)
...which is a confusing overload with unexpectedly different semantics from the one-parameter form. In preparation of marking it as deprecated. Change-Id: I4f176995546ae583fc570d770647ffc315eecc75
-rw-r--r--connectivity/source/commontools/dbmetadata.cxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_databasemetadata.cxx8
-rw-r--r--cppuhelper/source/shlib.cxx2
-rw-r--r--editeng/source/items/frmitems.cxx6
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx2
-rw-r--r--filter/source/xsltdialog/typedetectionexport.cxx8
-rw-r--r--filter/source/xsltdialog/xmlfilterjar.cxx8
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.cxx2
-rw-r--r--forms/source/component/Button.cxx5
-rw-r--r--forms/source/inc/frm_strings.hxx2
-rw-r--r--framework/source/dispatch/mailtodispatcher.cxx5
-rw-r--r--framework/source/dispatch/popupmenudispatcher.cxx5
-rw-r--r--framework/source/dispatch/servicehandler.cxx2
-rw-r--r--framework/source/dispatch/systemexec.cxx2
-rw-r--r--framework/source/fwe/classes/addonsoptions.cxx2
-rw-r--r--framework/source/uielement/imagebuttontoolbarcontroller.cxx2
-rw-r--r--framework/source/uielement/toolbarmanager.cxx2
-rw-r--r--sd/source/core/CustomAnimationPreset.cxx2
-rw-r--r--sd/source/core/TransitionPreset.cxx2
-rw-r--r--sd/source/filter/ppt/pptinanimations.cxx2
-rw-r--r--sd/source/ui/unoidl/unopage.cxx4
-rw-r--r--sfx2/source/dialog/taskpane.cxx4
-rw-r--r--sfx2/source/view/frmload.cxx2
-rw-r--r--stoc/source/security/permissions.cxx2
-rw-r--r--svtools/source/graphic/grfmgr.cxx2
-rw-r--r--svtools/source/graphic/provider.cxx2
-rw-r--r--svx/source/unodraw/unoshap2.cxx6
-rw-r--r--svx/source/xml/xmleohlp.cxx7
-rw-r--r--sw/source/ui/uno/unodispatch.cxx3
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx4
-rw-r--r--toolkit/source/controls/unocontrols.cxx2
-rw-r--r--ucb/source/ucp/expand/ucpexpand.cxx3
-rw-r--r--ucb/source/ucp/hierarchy/hierarchycontent.cxx5
-rw-r--r--ucb/source/ucp/webdav-neon/DAVProperties.cxx20
-rw-r--r--xmlhelp/source/cxxhelp/provider/urlparameter.cxx2
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_export.cxx2
36 files changed, 59 insertions, 84 deletions
diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx
index 70dd05740d8d..6ec14fb57e87 100644
--- a/connectivity/source/commontools/dbmetadata.cxx
+++ b/connectivity/source/commontools/dbmetadata.cxx
@@ -406,7 +406,7 @@ namespace dbtools
{
Reference< XDatabaseMetaData > xMeta( m_pImpl->xConnectionMetaData, UNO_SET_THROW );
::rtl::OUString sConnectionURL( xMeta->getURL() );
- doDisplay = sConnectionURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "sdbc:mysql:mysqlc" ) ) == 0;
+ doDisplay = sConnectionURL.startsWith( "sdbc:mysql:mysqlc" );
}
catch( const Exception& )
{
@@ -423,7 +423,7 @@ namespace dbtools
{
Reference< XDatabaseMetaData > xMeta( m_pImpl->xConnectionMetaData, UNO_SET_THROW );
::rtl::OUString sConnectionURL( xMeta->getURL() );
- bSupported = sConnectionURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "sdbc:mysql:mysqlc" ) ) != 0;
+ bSupported = !sConnectionURL.startsWith( "sdbc:mysql:mysqlc" );
}
catch( const Exception& )
{
diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
index df012107f8f9..a7b63df958a5 100644
--- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
+++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx
@@ -1263,11 +1263,11 @@ struct SortInternalSchemasLastAndPublicFirst
a[0] >>= valueA;
b[0] >>= valueB;
bool ret = false;
- if( valueA.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "public" ) ) == 0 )
+ if( valueA.startsWith( "public" ) )
{
ret = true;
}
- else if( valueB.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "public" ) ) == 0 )
+ else if( valueB.startsWith( "public" ) )
{
ret = false;
}
@@ -2202,9 +2202,9 @@ struct TypeInfoByDataTypeSorter
OUString nameB;
a[0 /*TYPE_NAME*/] >>= nameA;
b[0 /*TYPE_NAME*/] >>= nameB;
- if( nameA.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "int4" ) ) == 0 )
+ if( nameA.startsWith( "int4" ) )
return 1;
- if( nameB.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "int4" ) ) == 0 )
+ if( nameB.startsWith( "int4" ) )
return 0;
return nameA.compareTo( nameB ) < 0;
}
diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx
index 180a05484b66..6678e2590ca3 100644
--- a/cppuhelper/source/shlib.cxx
+++ b/cppuhelper/source/shlib.cxx
@@ -136,7 +136,7 @@ static bool checkAccessPath( OUString * pComp ) throw ()
if (pPath)
{
- sal_Bool bAbsolute = (pComp->compareToAscii( "file://" , 7 ) == 0);
+ sal_Bool bAbsolute = pComp->startsWith( "file://" );
for ( ::std::vector< OUString >::const_iterator iPos( pPath->begin() );
iPos != pPath->end(); ++iPos )
{
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 1a23a68ffdf9..869f3a1d5dee 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -3703,13 +3703,11 @@ bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
{
OUString sLink;
rVal >>= sLink;
- if( 0 == sLink.compareToAscii( UNO_NAME_GRAPHOBJ_URLPKGPREFIX,
- sizeof(UNO_NAME_GRAPHOBJ_URLPKGPREFIX)-1 ) )
+ if( sLink.startsWith( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) )
{
OSL_FAIL( "package urls aren't implemented" );
}
- else if( 0 == sLink.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX,
- sizeof(UNO_NAME_GRAPHOBJ_URLPREFIX)-1 ) )
+ else if( sLink.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
{
DELETEZ( pStrLink );
String sTmp( sLink );
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index eff0c8e8c70b..008b4b5909c6 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -2792,7 +2792,7 @@ namespace pcr
OUString sCurValue;
OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= sCurValue );
- if ( !sCurValue.isEmpty() && sCurValue.compareToAscii(GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH(GRAPHOBJ_URLPREFIX) ) != 0 )
+ if ( !sCurValue.isEmpty() && !sCurValue.startsWith(GRAPHOBJ_URLPREFIX) )
{
aFileDlg.SetDisplayDirectory( sCurValue );
// TODO: need to set the display directory _and_ the default name
diff --git a/filter/source/xsltdialog/typedetectionexport.cxx b/filter/source/xsltdialog/typedetectionexport.cxx
index 9fa3b3dc223e..4a66506c96c6 100644
--- a/filter/source/xsltdialog/typedetectionexport.cxx
+++ b/filter/source/xsltdialog/typedetectionexport.cxx
@@ -45,10 +45,10 @@ TypeDetectionExporter::TypeDetectionExporter( Reference< XComponentContext >& xC
static OUString createRelativeURL( const OUString& rFilterName, const OUString& rURL )
{
if( !rURL.isEmpty() &&
- (rURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM("http:") ) != 0) &&
- (rURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM("https:") ) != 0) &&
- (rURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM("jar:") ) != 0) &&
- (rURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM("ftp:") ) != 0))
+ !rURL.startsWith("http:") &&
+ !rURL.startsWith("https:") &&
+ !rURL.startsWith("jar:") &&
+ !rURL.startsWith("ftp:") )
{
INetURLObject aURL( rURL );
OUString aName( aURL.GetName() );
diff --git a/filter/source/xsltdialog/xmlfilterjar.cxx b/filter/source/xsltdialog/xmlfilterjar.cxx
index f99bd73938b1..66f7198a5fdb 100644
--- a/filter/source/xsltdialog/xmlfilterjar.cxx
+++ b/filter/source/xsltdialog/xmlfilterjar.cxx
@@ -128,10 +128,10 @@ static void _addFile( Reference< XInterface >& xRootFolder, Reference< XSingleSe
void XMLFilterJarHelper::addFile( Reference< XInterface > xRootFolder, Reference< XSingleServiceFactory > xFactory, const OUString& rSourceFile ) throw( Exception )
{
if( !rSourceFile.isEmpty() &&
- (rSourceFile.compareToAscii( RTL_CONSTASCII_STRINGPARAM("http:") ) != 0) &&
- (rSourceFile.compareToAscii( RTL_CONSTASCII_STRINGPARAM("https:") ) != 0) &&
- (rSourceFile.compareToAscii( RTL_CONSTASCII_STRINGPARAM("jar:") ) != 0) &&
- (rSourceFile.compareToAscii( RTL_CONSTASCII_STRINGPARAM("ftp:") ) != 0))
+ !rSourceFile.startsWith("http:") &&
+ !rSourceFile.startsWith("https:") &&
+ !rSourceFile.startsWith("jar:") &&
+ !rSourceFile.startsWith("ftp:") )
{
OUString aFileURL( rSourceFile );
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index 60e5188efcd4..0791c3f9cfd3 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -1661,7 +1661,7 @@ OUString string_decode( const OUString & rText )
bool isFileURL( const ::rtl::OUString & rURL )
{
- return rURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM("file:") ) == 0;
+ return rURL.startsWith("file:");
}
// -----------------------------------------------------------------------
diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx
index df76b7acf39d..8526cc35b5de 100644
--- a/forms/source/component/Button.cxx
+++ b/forms/source/component/Button.cxx
@@ -654,9 +654,8 @@ namespace
{
bool isFormControllerURL( const ::rtl::OUString& _rURL )
{
- const sal_Int32 nPrefixLen = URL_CONTROLLER_PREFIX.length;
- return ( _rURL.getLength() > nPrefixLen )
- && ( _rURL.compareToAscii( URL_CONTROLLER_PREFIX.ascii, nPrefixLen ) == 0 );
+ return ( _rURL.getLength() > RTL_CONSTASCII_LENGTH( ".uno:FormController/" ) )
+ && ( _rURL.startsWith( ".uno:FormController/" ) );
}
}
diff --git a/forms/source/inc/frm_strings.hxx b/forms/source/inc/frm_strings.hxx
index ad01b92b81f9..3e10031b8c74 100644
--- a/forms/source/inc/frm_strings.hxx
+++ b/forms/source/inc/frm_strings.hxx
@@ -286,8 +286,6 @@ namespace frm
//--------------------------------------------------------------------------
//- URLs
//--------------------------------------------------------------------------
- FORMS_CONSTASCII_STRING( URL_CONTROLLER_PREFIX, ".uno:FormController/" );
-
FORMS_CONSTASCII_STRING( URL_FORM_POSITION, ".uno:FormController/positionForm" );
FORMS_CONSTASCII_STRING( URL_FORM_RECORDCOUNT, ".uno:FormController/RecordCount" );
FORMS_CONSTASCII_STRING( URL_RECORD_FIRST, ".uno:FormController/moveToFirst" );
diff --git a/framework/source/dispatch/mailtodispatcher.cxx b/framework/source/dispatch/mailtodispatcher.cxx
index 331243b11f77..40f6a9102360 100644
--- a/framework/source/dispatch/mailtodispatcher.cxx
+++ b/framework/source/dispatch/mailtodispatcher.cxx
@@ -30,9 +30,6 @@
namespace framework{
-#define PROTOCOL_VALUE "mailto:"
-#define PROTOCOL_LENGTH 7
-
//_________________________________________________________________________________________________________________
// XInterface, XTypeProvider, XServiceInfo
@@ -111,7 +108,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL MailToDispatcher::queryDis
sal_Int32 /*nFlags*/ ) throw( css::uno::RuntimeException )
{
css::uno::Reference< css::frame::XDispatch > xDispatcher;
- if (aURL.Complete.compareToAscii(PROTOCOL_VALUE,PROTOCOL_LENGTH)==0)
+ if (aURL.Complete.startsWith("mailto:"))
xDispatcher = this;
return xDispatcher;
}
diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx
index 30b271f30a06..f4d60b334951 100644
--- a/framework/source/dispatch/popupmenudispatcher.cxx
+++ b/framework/source/dispatch/popupmenudispatcher.cxx
@@ -55,9 +55,6 @@ using namespace ::cppu ;
using namespace ::osl ;
using namespace ::rtl ;
-const char* PROTOCOL_VALUE = "vnd.sun.star.popup:";
-const sal_Int32 PROTOCOL_LENGTH = 19;
-
//*****************************************************************************************************************
// constructor
//*****************************************************************************************************************
@@ -216,7 +213,7 @@ throw( css::uno::RuntimeException )
{
css::uno::Reference< css::frame::XDispatch > xDispatch;
- if ( rURL.Complete.compareToAscii( PROTOCOL_VALUE, PROTOCOL_LENGTH ) == 0 )
+ if ( rURL.Complete.startsWith( "vnd.sun.star.popup:" ) )
{
// --- SAFE ---
ResetableGuard aGuard( m_aLock );
diff --git a/framework/source/dispatch/servicehandler.cxx b/framework/source/dispatch/servicehandler.cxx
index ddeac81e3b20..ddd6c681cf39 100644
--- a/framework/source/dispatch/servicehandler.cxx
+++ b/framework/source/dispatch/servicehandler.cxx
@@ -110,7 +110,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL ServiceHandler::queryDispa
sal_Int32 /*nFlags*/ ) throw( css::uno::RuntimeException )
{
css::uno::Reference< css::frame::XDispatch > xDispatcher;
- if (aURL.Complete.compareToAscii(PROTOCOL_VALUE,PROTOCOL_LENGTH)==0)
+ if (aURL.Complete.startsWith(PROTOCOL_VALUE))
xDispatcher = this;
return xDispatcher;
}
diff --git a/framework/source/dispatch/systemexec.cxx b/framework/source/dispatch/systemexec.cxx
index 16d1fa85203a..b06b76498ccf 100644
--- a/framework/source/dispatch/systemexec.cxx
+++ b/framework/source/dispatch/systemexec.cxx
@@ -94,7 +94,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL SystemExec::queryDispatch(
sal_Int32 ) throw( css::uno::RuntimeException )
{
css::uno::Reference< css::frame::XDispatch > xDispatcher;
- if (aURL.Complete.compareToAscii(PROTOCOL_VALUE,PROTOCOL_LENGTH)==0)
+ if (aURL.Complete.startsWith(PROTOCOL_VALUE))
xDispatcher = this;
return xDispatcher;
}
diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx
index 47c4efbc2077..6b9aefa75ef1 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -1277,7 +1277,7 @@ sal_Bool AddonsOptions_Impl::HasAssociatedImages( const OUString& aURL )
//*****************************************************************************************************************
void AddonsOptions_Impl::SubstituteVariables( OUString& aURL )
{
- if (( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 ) )
+ if ( aURL.startsWith( EXPAND_PROTOCOL ) )
{
// cut protocol
OUString macro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) );
diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
index 9390838e1fdf..e790afda932d 100644
--- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx
+++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
@@ -83,7 +83,7 @@ uno::Reference< util::XMacroExpander > GetMacroExpander()
static void SubstituteVariables( OUString& aURL )
{
- if ( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 )
+ if ( aURL.startsWith( EXPAND_PROTOCOL ) )
{
uno::Reference< util::XMacroExpander > xMacroExpander = GetMacroExpander();
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index b47ee8f951bc..661942c9ee5c 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -1256,7 +1256,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL )
{
aProp[i].Value >>= aCommandURL;
- if ( aCommandURL.compareToAscii(MENUPREFIX, RTL_CONSTASCII_LENGTH(MENUPREFIX) ) == 0 )
+ if ( aCommandURL.startsWith(MENUPREFIX) )
{
try
{
diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx
index 3cc45984e16e..9ac81d682214 100644
--- a/sd/source/core/CustomAnimationPreset.cxx
+++ b/sd/source/core/CustomAnimationPreset.cxx
@@ -326,7 +326,7 @@ void CustomAnimationPresets::importEffects()
for( sal_Int32 i=0; i<aFiles.getLength(); ++i )
{
rtl::OUString aURL = aFiles[i];
- if( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 )
+ if( aURL.startsWith( EXPAND_PROTOCOL ) )
{
// cut protocol
rtl::OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) );
diff --git a/sd/source/core/TransitionPreset.cxx b/sd/source/core/TransitionPreset.cxx
index 3c9f408a635d..127b3027bdb4 100644
--- a/sd/source/core/TransitionPreset.cxx
+++ b/sd/source/core/TransitionPreset.cxx
@@ -176,7 +176,7 @@ bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList )
for( sal_Int32 i=0; i<aFiles.getLength(); ++i )
{
rtl::OUString aURL = aFiles[i];
- if( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 )
+ if( aURL.startsWith( EXPAND_PROTOCOL ) )
{
// cut protocol
rtl::OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) );
diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx
index 2ed65bf02be6..192169da1fd5 100644
--- a/sd/source/filter/ppt/pptinanimations.cxx
+++ b/sd/source/filter/ppt/pptinanimations.cxx
@@ -2246,7 +2246,7 @@ void AnimationImporter::importCommandContainer( const Atom* pAtom, const Referen
{
nCommand = EffectCommands::PLAY;
}
- else if( aParam.compareToAscii( RTL_CONSTASCII_STRINGPARAM("playFrom") ) == 0 )
+ else if( aParam.startsWith( "playFrom" ) )
{
const OUString aMediaTime( aParam.copy( 9, aParam.getLength() - 10 ) );
rtl_math_ConversionStatus eStatus;
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 5625097ea2db..03b11bd7c2c0 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -110,7 +110,7 @@ enum WID_PAGE
#endif
#endif
-static sal_Char sEmptyPageName[sizeof("page")] = "page";
+static sal_Char const sEmptyPageName[sizeof("page")] = "page";
/** this function stores the property maps for draw pages in impress and draw */
const SvxItemPropertySet* ImplGetDrawPagePropertySet( sal_Bool bImpress, PageKind ePageKind )
@@ -2256,7 +2256,7 @@ void SAL_CALL SdDrawPage::setName( const OUString& rName )
if(GetPage() && GetPage()->GetPageKind() != PK_NOTES)
{
// check if this is the default 'page1234' name
- if(aName.compareToAscii( sEmptyPageName, sizeof( sEmptyPageName ) - 1 ) == 0)
+ if(aName.startsWith( sEmptyPageName ))
{
// ok, it maybe is, first get the number part after 'page'
OUString aNumber( aName.copy( sizeof( sEmptyPageName ) - 1 ) );
diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx
index 4f44b6910ba3..1ac035d00c77 100644
--- a/sfx2/source/dialog/taskpane.cxx
+++ b/sfx2/source/dialog/taskpane.cxx
@@ -169,9 +169,9 @@ namespace sfx2
aMediaProperties.put( "URL", sImageURL );
// special handling: if the ImageURL denotes a CommandName, then retrieve the image for that command
- const sal_Char* pCommandImagePrefix = "private:commandimage/";
+ static const sal_Char pCommandImagePrefix[] = "private:commandimage/";
const sal_Int32 nCommandImagePrefixLen = strlen( pCommandImagePrefix );
- if ( sImageURL.compareToAscii( pCommandImagePrefix, nCommandImagePrefixLen ) == 0 )
+ if ( sImageURL.startsWith( pCommandImagePrefix ) )
{
::rtl::OUStringBuffer aCommandName;
aCommandName.appendAscii(RTL_CONSTASCII_STRINGPARAM(".uno:"));
diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx
index 7fb15389ef7d..afbc1fddb929 100644
--- a/sfx2/source/view/frmload.cxx
+++ b/sfx2/source/view/frmload.cxx
@@ -531,7 +531,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
// check for factory URLs to create a new doc, instead of loading one
const ::rtl::OUString sURL = aDescriptor.getOrDefault( "URL", ::rtl::OUString() );
- const bool bIsFactoryURL = ( sURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "private:factory/" ) ) == 0 );
+ const bool bIsFactoryURL = sURL.startsWith( "private:factory/" );
bool bInitNewModel = bIsFactoryURL;
if ( bIsFactoryURL && !bExternalModel )
{
diff --git a/stoc/source/security/permissions.cxx b/stoc/source/security/permissions.cxx
index e97e379ef56a..c6edcf2004db 100644
--- a/stoc/source/security/permissions.cxx
+++ b/stoc/source/security/permissions.cxx
@@ -339,7 +339,7 @@ FilePermission::FilePermission(
buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("/-") );
m_url = buf.makeStringAndClear();
}
- else if (0 != m_url.compareToAscii( RTL_CONSTASCII_STRINGPARAM("file:///") ))
+ else if (!m_url.startsWith("file:///"))
{
// relative path
OUString out;
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx
index cba578609be9..3d21da07c949 100644
--- a/svtools/source/graphic/grfmgr.cxx
+++ b/svtools/source/graphic/grfmgr.cxx
@@ -1157,7 +1157,7 @@ GraphicObject::InspectForGraphicObjectImageURL( const Reference< XInterface >& x
{
rtl::OUString sURL;
xProps->getPropertyValue( sImageURL ) >>= sURL;
- if ( !sURL.isEmpty() && sURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 )
+ if ( !sURL.isEmpty() && sURL.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
rvEmbedImgUrls.push_back( sURL );
}
}
diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx
index 07817c818b8d..c8e98e20088d 100644
--- a/svtools/source/graphic/provider.cxx
+++ b/svtools/source/graphic/provider.cxx
@@ -147,7 +147,7 @@ uno::Sequence< sal_Int8 > SAL_CALL GraphicProvider::getImplementationId()
uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadGraphicObject( const ::rtl::OUString& rResourceURL ) const
{
uno::Reference< ::graphic::XGraphic > xRet;
- if( rResourceURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 )
+ if( rResourceURL.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
{
// graphic manager url
String aTmpStr( rResourceURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ) );
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 6a5b80064766..f974e51247a7 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -1505,7 +1505,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const ::rtl::OUString& rName, const
OUString aURL;
if( rValue >>= aURL )
{
- if( aURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 )
+ if( aURL.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
{
// graphic manager url
aURL = aURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
@@ -1522,7 +1522,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const ::rtl::OUString& rName, const
static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicObject( aGrafObj );
}
}
- else if( aURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPKGPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) ) != 0 )
+ else if( !aURL.startsWith( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) )
{
// normal link
String aFilterName;
@@ -1570,7 +1570,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const ::rtl::OUString& rName, const
if( rValue >>= aStreamURL )
{
- if( aStreamURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPKGPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) ) != 0 )
+ if( !aStreamURL.startsWith( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) )
aStreamURL = OUString();
if( mpObj.is() )
diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx
index b351b6595893..64482f87a354 100644
--- a/svx/source/xml/xmleohlp.cxx
+++ b/svx/source/xml/xmleohlp.cxx
@@ -282,12 +282,9 @@ sal_Bool SvXMLEmbeddedObjectHelper::ImplGetStorageNames(
nPos = aURLNoPar.indexOf( ':' );
if( -1 == nPos )
return sal_False;
- sal_Bool bObjUrl =
- 0 == aURLNoPar.compareToAscii( XML_EMBEDDEDOBJECT_URL_BASE,
- sizeof( XML_EMBEDDEDOBJECT_URL_BASE ) -1 );
+ sal_Bool bObjUrl = aURLNoPar.startsWith( XML_EMBEDDEDOBJECT_URL_BASE );
sal_Bool bGrUrl = !bObjUrl &&
- 0 == aURLNoPar.compareToAscii( XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE,
- sizeof( XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE ) -1 );
+ aURLNoPar.startsWith( XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE );
if( !(bObjUrl || bGrUrl) )
return sal_False;
diff --git a/sw/source/ui/uno/unodispatch.cxx b/sw/source/ui/uno/unodispatch.cxx
index dd2089f14103..21fe1165d414 100644
--- a/sw/source/ui/uno/unodispatch.cxx
+++ b/sw/source/ui/uno/unodispatch.cxx
@@ -35,7 +35,6 @@ using namespace ::com::sun::star;
using ::rtl::OUString;
-static const char* cURLStart = ".uno:DataSourceBrowser/";
static const char* cURLFormLetter = ".uno:DataSourceBrowser/FormLetter";
static const char* cURLInsertContent = ".uno:DataSourceBrowser/InsertContent";//data into fields
static const char* cURLInsertColumns = ".uno:DataSourceBrowser/InsertColumns";//data into text
@@ -71,7 +70,7 @@ uno::Reference< frame::XDispatch > SwXDispatchProviderInterceptor::queryDispatch
DispatchMutexLock_Impl aLock(*this);
uno::Reference< frame::XDispatch> xResult;
// create some dispatch ...
- if(m_pView && !aURL.Complete.compareToAscii(cURLStart, 23))
+ if(m_pView && aURL.Complete.startsWith(".uno:DataSourceBrowser/"))
{
if(!aURL.Complete.compareToAscii(cURLFormLetter) ||
!aURL.Complete.compareToAscii(cURLInsertContent) ||
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index 40499e928dab..4dc26286e818 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -379,7 +379,7 @@ void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDes
( !aImageURL.isEmpty() ))
{
::rtl::OUString absoluteUrl = aImageURL;
- if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
+ if ( !aImageURL.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
absoluteUrl = getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
uno::makeAny( aImageURL ) );
@@ -608,7 +608,7 @@ void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChang
( !aImageURL.isEmpty() ))
{
::rtl::OUString absoluteUrl = aImageURL;
- if ( aImageURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) != 0 )
+ if ( !aImageURL.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
absoluteUrl = getPhysicalLocation( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL )),
uno::makeAny(aImageURL));
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index e98c6782e993..92d49df671d8 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -81,7 +81,7 @@ using namespace ::toolkit;
uno::Reference< graphic::XGraphic >
ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( uno::Reference< graphic::XGraphicObject >& xOutGraphicObj, const OUString& _rURL )
{
- if( ( _rURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 ) )
+ if ( _rURL.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
{
// graphic manager uniqueid
rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
diff --git a/ucb/source/ucp/expand/ucpexpand.cxx b/ucb/source/ucp/expand/ucpexpand.cxx
index 9dd95fa5d7fd..b823a2d91470 100644
--- a/ucb/source/ucp/expand/ucpexpand.cxx
+++ b/ucb/source/ucp/expand/ucpexpand.cxx
@@ -177,8 +177,7 @@ OUString ExpandContentProviderImpl::expandUri(
uno::Reference< ucb::XContentIdentifier > const & xIdentifier ) const
{
OUString uri( xIdentifier->getContentIdentifier() );
- if (uri.compareToAscii(
- RTL_CONSTASCII_STRINGPARAM(EXPAND_PROTOCOL ":") ) != 0)
+ if (!uri.startsWith(EXPAND_PROTOCOL ":"))
{
throw ucb::IllegalIdentifierException(
"expected protocol " EXPAND_PROTOCOL "!",
diff --git a/ucb/source/ucp/hierarchy/hierarchycontent.cxx b/ucb/source/ucp/hierarchy/hierarchycontent.cxx
index 3676019219fc..92313ca5c078 100644
--- a/ucb/source/ucp/hierarchy/hierarchycontent.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchycontent.cxx
@@ -1602,10 +1602,7 @@ void HierarchyContent::transfer(
}
// Is source a hierarchy content?
- if ( ( rInfo.SourceURL.getLength() < HIERARCHY_URL_SCHEME_LENGTH + 2 ) ||
- ( rInfo.SourceURL.compareToAscii( HIERARCHY_URL_SCHEME ":/",
- HIERARCHY_URL_SCHEME_LENGTH + 2 )
- != 0 ) )
+ if ( !rInfo.SourceURL.startsWith( HIERARCHY_URL_SCHEME ":/" ) )
{
ucbhelper::cancelCommandExecution(
uno::makeAny( ucb::InteractiveBadTransferURLException(
diff --git a/ucb/source/ucp/webdav-neon/DAVProperties.cxx b/ucb/source/ucp/webdav-neon/DAVProperties.cxx
index 4b89cef5dcdc..576f87b89479 100644
--- a/ucb/source/ucp/webdav-neon/DAVProperties.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVProperties.cxx
@@ -51,7 +51,7 @@ const ::rtl::OUString DAVProperties::EXECUTABLE("http://apache.org/dav/props/exe
void DAVProperties::createNeonPropName( const rtl::OUString & rFullName,
NeonPropName & rName )
{
- if ( rFullName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "DAV:" ) ) == 0 )
+ if ( rFullName.startsWith( "DAV:" ) )
{
rName.nspace = "DAV:";
rName.name
@@ -59,8 +59,7 @@ void DAVProperties::createNeonPropName( const rtl::OUString & rFullName,
rFullName.copy( RTL_CONSTASCII_LENGTH( "DAV:" ) ),
RTL_TEXTENCODING_UTF8 ).getStr() );
}
- else if ( rFullName.compareToAscii( RTL_CONSTASCII_STRINGPARAM(
- "http://apache.org/dav/props/" ) ) == 0 )
+ else if ( rFullName.startsWith( "http://apache.org/dav/props/" ) )
{
rName.nspace = "http://apache.org/dav/props/";
rName.name
@@ -70,8 +69,7 @@ void DAVProperties::createNeonPropName( const rtl::OUString & rFullName,
"http://apache.org/dav/props/" ) ),
RTL_TEXTENCODING_UTF8 ).getStr() );
}
- else if ( rFullName.compareToAscii( RTL_CONSTASCII_STRINGPARAM(
- "http://ucb.openoffice.org/dav/props/" ) ) == 0 )
+ else if ( rFullName.startsWith( "http://ucb.openoffice.org/dav/props/" ) )
{
rName.nspace = "http://ucb.openoffice.org/dav/props/";
rName.name
@@ -81,8 +79,7 @@ void DAVProperties::createNeonPropName( const rtl::OUString & rFullName,
"http://ucb.openoffice.org/dav/props/" ) ),
RTL_TEXTENCODING_UTF8 ).getStr() );
}
- else if ( rFullName.compareToAscii( RTL_CONSTASCII_STRINGPARAM(
- "<prop:" ) ) == 0 )
+ else if ( rFullName.startsWith( "<prop:" ) )
{
// Support for 3rd party namespaces/props
@@ -145,18 +142,15 @@ void DAVProperties::createUCBPropName( const char * nspace,
rFullName = aNameSpace;
rFullName += aName;
- if ( rFullName.compareToAscii( RTL_CONSTASCII_STRINGPARAM(
- "DAV:" ) ) == 0 )
+ if ( rFullName.startsWith( "DAV:" ) )
{
// Okay, Just concat strings.
}
- else if ( rFullName.compareToAscii( RTL_CONSTASCII_STRINGPARAM(
- "http://apache.org/dav/props/" ) ) == 0 )
+ else if ( rFullName.startsWith( "http://apache.org/dav/props/" ) )
{
// Okay, Just concat strings.
}
- else if ( rFullName.compareToAscii( RTL_CONSTASCII_STRINGPARAM(
- "http://ucb.openoffice.org/dav/props/" ) ) == 0 )
+ else if ( rFullName.startsWith( "http://ucb.openoffice.org/dav/props/" ) )
{
// Remove namespace from our own properties.
rFullName = rFullName.copy(
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
index f82117de342a..2f968f64a36f 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
@@ -537,7 +537,7 @@ bool URLParameter::scheme()
for( sal_Int32 nPrefixLen = 20 ; nPrefixLen >= 18 ; --nPrefixLen )
{
- if( m_aExpr.compareToAscii( "vnd.sun.star.help://", nPrefixLen ) == 0 )
+ if( m_aExpr.matchAsciiL( "vnd.sun.star.help://", nPrefixLen ) )
{
m_aExpr = m_aExpr.copy( nPrefixLen );
return true;
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index 3ac5fa163589..7b855d893337 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -695,7 +695,7 @@ void ElementDescriptor::readImageURLAttr( OUString const & rPropName, OUString c
OUString sURL;
_xProps->getPropertyValue( rPropName ) >>= sURL;
- if ( !sURL.isEmpty() && sURL.compareToAscii( XMLSCRIPT_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( XMLSCRIPT_GRAPHOBJ_URLPREFIX ) ) == 0 )
+ if ( sURL.startsWith( XMLSCRIPT_GRAPHOBJ_URLPREFIX ) )
{
Reference< document::XStorageBasedDocument > xDocStorage( _xDocument, UNO_QUERY );
if ( xDocStorage.is() )