From 937b63af3322f7f8b5e869b2c7431a2deaec3113 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Sat, 9 Mar 2013 22:47:20 +0100 Subject: use startsWith() instead of compareToAscii() brain damage... Change-Id: I4dc63c7346f724eded9ac7b82cda25c2bb60beff --- sfx2/source/appl/appuno.cxx | 2 +- sfx2/source/doc/docfile.cxx | 6 +++--- sfx2/source/doc/graphhelp.cxx | 2 +- sfx2/source/doc/sfxbasemodel.cxx | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index df9676926de0..62b2dfedc88b 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -1737,7 +1737,7 @@ SfxObjectShell* SfxMacroLoader::GetObjectShell_Impl() sal_Int32 /*nSearchFlags*/ ) throw( ::com::sun::star::uno::RuntimeException ) { ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatcher; - if(aURL.Complete.compareToAscii("macro:",6)==0) + if(aURL.Complete.startsWith("macro:")) xDispatcher = this; return xDispatcher; } diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 9a5967328ca2..7fa12d46d11e 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -1801,7 +1801,7 @@ void SfxMedium::Transfer_Impl() // in case an output stream is provided from outside and the URL is correct // commit to the stream - if (pImp->m_aLogicName.compareToAscii("private:stream", 14) == 0) + if (pImp->m_aLogicName.startsWith("private:stream")) { // TODO/LATER: support storing to SID_STREAM SFX_ITEMSET_ARG( pImp->m_pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, false); @@ -2505,7 +2505,7 @@ void SfxMedium::Init_Impl() SFX_ITEMSET_ARG( pImp->m_pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, false); if( pOutStreamItem && ( !( pOutStreamItem->GetValue() >>= rOutStream ) - || (pImp->m_aLogicName.compareToAscii("private:stream", 14) != 0)) ) + || !pImp->m_aLogicName.startsWith("private:stream")) ) { pImp->m_pSet->ClearItem( SID_OUTPUTSTREAM ); OSL_FAIL( "Unexpected Output stream parameter!\n" ); @@ -2768,7 +2768,7 @@ void SfxMedium::SetIsRemote_Impl() pImp->m_bRemote = true; break; default: - pImp->m_bRemote = GetName().compareToAscii("private:msgid", 13) == 0; + pImp->m_bRemote = GetName().startsWith("private:msgid"); break; } diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx index c4d18c9096b1..392840e5d8d9 100644 --- a/sfx2/source/doc/graphhelp.cxx +++ b/sfx2/source/doc/graphhelp.cxx @@ -500,7 +500,7 @@ sal_uInt16 GraphicHelper::getThumbnailReplacementIDByFactoryName_Impl( const ::r { nResult = BMP_128X128_MATH_DOC; } - else if ( aFactoryShortName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "swriter" ) ) || aFactoryShortName.compareToAscii( "swriter/", 8 ) == 0 ) + else if ( aFactoryShortName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "swriter" ) ) || aFactoryShortName.startsWith("swriter/") ) { nResult = BMP_128X128_WRITER_DOC; } diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index a37e4a7c8c35..608214dfe8fd 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1617,7 +1617,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa // If this is an embedded object that has no URL based location it should be stored to own storage. // An embedded object can have a location based on URL in case it is a link, then it should be // stored in normal way. - if ( !hasLocation() || getLocation().compareToAscii( "private:", 8 ) == 0 ) + if ( !hasLocation() || getLocation().startsWith("private:") ) { // actually in this very rare case only UI parameters have sence // TODO/LATER: should be done later, after integration of sb19 @@ -2926,7 +2926,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL sal_Bool bSaved = sal_False; if ( !bSaveTo && m_pData->m_pObjectShell && !sURL.isEmpty() - && sURL.compareToAscii( "private:stream", 14 ) != COMPARE_EQUAL + && !sURL.startsWith( "private:stream" ) && ::utl::UCBContentHelper::EqualURLs( getLocation(), sURL ) ) { // this is the same file URL as the current document location, try to use storeOwn if possible -- cgit