diff options
45 files changed, 82 insertions, 82 deletions
diff --git a/connectivity/source/commontools/AutoRetrievingBase.cxx b/connectivity/source/commontools/AutoRetrievingBase.cxx index e88fe4160214..6e39c85cc8b4 100644 --- a/connectivity/source/commontools/AutoRetrievingBase.cxx +++ b/connectivity/source/commontools/AutoRetrievingBase.cxx @@ -27,7 +27,7 @@ namespace connectivity OSL_ENSURE( m_bAutoRetrievingEnabled,"Illegal call here. isAutoRetrievingEnabled is false!"); sStmt = sStmt.toAsciiUpperCase(); ::rtl::OUString sStatement; - if ( sStmt.compareToAscii("INSERT",6) == 0 ) + if ( sStmt.startsWith("INSERT") ) { sStatement = m_sGeneratedValueStatement; static const ::rtl::OUString sColumn(RTL_CONSTASCII_USTRINGPARAM("$column")); diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx index 2b24b24d67ed..9ffc553f3182 100644 --- a/connectivity/source/drivers/ado/AConnection.cxx +++ b/connectivity/source/drivers/ado/AConnection.cxx @@ -106,7 +106,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV sal_Int32 nLen = url.indexOf(':'); nLen = url.indexOf(':',nLen+1); ::rtl::OUString aDSN(url.copy(nLen+1)),aUID,aPWD; - if ( aDSN.compareToAscii("access:",7) == 0 ) + if ( aDSN.startsWith("access:") ) aDSN = aDSN.copy(7); sal_Int32 nTimeout = 20; diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index 3f2a96bfbd68..d58c8f56d941 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -399,7 +399,7 @@ namespace connectivity { sal_Bool bEnabled = sal_False; OSL_VERIFY_EQUALS( jfw_getEnabled( &bEnabled ), JFW_E_NONE, "error in jfw_getEnabled" ); - return bEnabled && url.compareToAscii("sdbc:embedded:hsqldb",sizeof("sdbc:embedded:hsqldb")) == 0; + return bEnabled && url.startsWith("sdbc:embedded:hsqldb"); } //-------------------------------------------------------------------- diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx index 2bff3c2b9a8b..ab56f7427a98 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.hxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx @@ -259,7 +259,7 @@ public: /** determines whether the database document has an embedded data storage */ - inline bool isEmbeddedDatabase() const { return ( m_sConnectURL.compareToAscii( "sdbc:embedded:", 14 ) == 0 ); } + inline bool isEmbeddedDatabase() const { return ( m_sConnectURL.startsWith("sdbc:embedded:") ); } /** stores the embedded storage ("database") diff --git a/extensions/source/plugin/base/context.cxx b/extensions/source/plugin/base/context.cxx index 4e153ca5d36d..a4992014317f 100644 --- a/extensions/source/plugin/base/context.cxx +++ b/extensions/source/plugin/base/context.cxx @@ -142,7 +142,7 @@ void XPluginContext_Impl::getURL(const Reference< ::com::sun::star::plugin::XPlu plugin->provideNewStream( ::rtl::OUString(), Reference< XActiveDataSource >(), aUrl, - 0, 0, (sal_Bool)(aUrl.compareToAscii( "file:", 5 ) == 0) ); + 0, 0, aUrl.startsWith("file:") ); return; } diff --git a/extensions/source/plugin/base/manager.cxx b/extensions/source/plugin/base/manager.cxx index 80c6939a3e65..d3f87150104f 100644 --- a/extensions/source/plugin/base/manager.cxx +++ b/extensions/source/plugin/base/manager.cxx @@ -223,7 +223,7 @@ Reference< ::com::sun::star::plugin::XPlugin > XPluginManager_Impl::createPlugi pImpl->provideNewStream( pImpl->getDescription().Mimetype, Reference< com::sun::star::io::XActiveDataSource >(), url, - 0, 0, (sal_Bool)(url.compareToAscii( "file:", 5 ) == 0) ); + 0, 0, url.startsWith("file:") ); if( ! pImpl->getPluginComm() ) { diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx index a456c63e9b96..24fa2c75a871 100644 --- a/extensions/source/plugin/base/xplugin.cxx +++ b/extensions/source/plugin/base/xplugin.cxx @@ -456,7 +456,7 @@ void XPlugin_Impl::modelChanged() provideNewStream( m_aDescription.Mimetype, uno::Reference< XActiveDataSource >(), aURL, - 0, 0, (sal_Bool)(aURL.compareToAscii( "file:", 5 ) == 0) ); + 0, 0, aURL.startsWith("file:") ); m_nProvidingState = PROVIDING_NONE; } @@ -786,7 +786,7 @@ sal_Bool XPlugin_Impl::provideNewStream(const OUString& mimetype, if( isfile && stype == NP_ASFILEONLY ) { rtl::OString aFileName; - if( url.compareToAscii( "file:", 5 ) == 0 ) + if( url.startsWith("file:") ) { OUString aSysName; osl_getSystemPathFromFileURL( url.pData, &aSysName.pData ); diff --git a/forms/source/xforms/model_ui.cxx b/forms/source/xforms/model_ui.cxx index 7032b8fa4653..6b912ce917da 100644 --- a/forms/source/xforms/model_ui.cxx +++ b/forms/source/xforms/model_ui.cxx @@ -858,7 +858,7 @@ static OUString lcl_serializeForDisplay( const Reference<XNodeList>& xNodes ) { OUString sLine = xTextInputStream->readLine(); if( !sLine.isEmpty() - && sLine.compareToAscii( "<?xml", 5 ) != 0 ) + && !sLine.startsWith( "<?xml" ) ) { aBuffer.append( sLine ); aBuffer.append( sal_Unicode('\n') ); diff --git a/framework/inc/queries.h b/framework/inc/queries.h index b839910ded48..94f6c32cda6e 100644 --- a/framework/inc/queries.h +++ b/framework/inc/queries.h @@ -345,8 +345,8 @@ class QueryAnalyzer static sal_Bool isQuery( const OUString& sQuery ) { return( - ( sQuery.compareToAscii( "_query_" , 7 ) == 0 ) || // new style - ( sQuery.compareToAscii( "_filterquery_", 13 ) == 0 ) // old style! + sQuery.startsWith("_query_") || // new style + sQuery.startsWith("_filterquery_") // old style! ); } diff --git a/oox/source/drawingml/textfield.cxx b/oox/source/drawingml/textfield.cxx index d18859337bf2..95f5e24f7fb6 100644 --- a/oox/source/drawingml/textfield.cxx +++ b/oox/source/drawingml/textfield.cxx @@ -60,7 +60,7 @@ void lclCreateTextFields( std::list< Reference< XTextField > > & aFields, Reference< XInterface > xIface; Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW ); - if( sType.compareToAscii( "datetime", 8 ) == 0) + if( sType.startsWith("datetime")) { OString s = OUStringToOString( sType, RTL_TEXTENCODING_UTF8); OString p( s.pData->buffer + 8 ); diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx index de8c90c44990..0fe547569eed 100644 --- a/package/source/manifest/ManifestImport.cxx +++ b/package/source/manifest/ManifestImport.cxx @@ -408,7 +408,7 @@ void SAL_CALL ManifestImport::setDocumentLocator( const uno::Reference< xml::sax ::rtl::OUString aAttrName = xAttribs->getNameByIndex( nInd ); ::rtl::OUString aAttrValue = xAttribs->getValueByIndex( nInd ); if ( aAttrName.getLength() >= 5 - && aAttrName.compareToAscii( "xmlns", 5 ) == 0 + && aAttrName.startsWith("xmlns") && ( aAttrName.getLength() == 5 || aAttrName.getStr()[5] == ( sal_Unicode )':' ) ) { // this is a namespace declaration diff --git a/padmin/source/cmddlg.cxx b/padmin/source/cmddlg.cxx index 17e386332ab7..5cad04d253fd 100644 --- a/padmin/source/cmddlg.cxx +++ b/padmin/source/cmddlg.cxx @@ -276,15 +276,15 @@ RTSCommandPage::RTSCommandPage( RTSDialog* pParent ) : while( nIndex != -1 ) { OUString aToken( m_pParent->m_aJobData.m_aFeatures.getToken( 0, ',', nIndex ) ); - if( ! aToken.compareToAscii( "fax", 3 ) ) + if( aToken.startsWith( "fax" ) ) { m_bWasFax = true; m_aFaxSwallowBox.Show( sal_True ); sal_Int32 nPos = 0; - m_aFaxSwallowBox.Check( ! aToken.getToken( 1, '=', nPos ).compareToAscii( "swallow", 7 ) ? sal_True : sal_False ); + m_aFaxSwallowBox.Check( aToken.getToken( 1, '=', nPos ).startsWith( "swallow" ) ? sal_True : sal_False ); m_aConfigureBox.SelectEntryPos( m_nFaxEntry ); } - else if( ! aToken.compareToAscii( "pdf=", 4 ) ) + else if( aToken.startsWith( "pdf=" ) ) { m_bWasPdf = true; sal_Int32 nPos = 0; @@ -331,8 +331,8 @@ void RTSCommandPage::save() while( nIndex != -1 ) { OUString aToken( m_pParent->m_aJobData.m_aFeatures.getToken( 0, ',', nIndex ) ); - if( aToken.compareToAscii( "fax", 3 ) && - aToken.compareToAscii( "pdf", 3 ) && + if( !aToken.startsWith( "fax" ) && + !aToken.startsWith( "pdf" ) && aToken.compareToAscii( "external_dialog" ) ) { @@ -343,15 +343,15 @@ void RTSCommandPage::save() aFeatures += String( aToken ); } } - else if( ! aToken.compareToAscii( "pdf=", 4 ) ) + else if( aToken.startsWith( "pdf=" ) ) { sal_Int32 nPos = 0; aOldPdfPath = aToken.getToken( 1, '=', nPos ); } - else if( ! aToken.compareToAscii( "fax=", 4 ) ) + else if( aToken.startsWith( "fax=" ) ) { sal_Int32 nPos = 0; - bOldFaxSwallow = aToken.getToken( 1, '=', nPos ).compareToAscii( "swallow", 7 ) ? false : true; + bOldFaxSwallow = aToken.getToken( 1, '=', nPos ).startsWith( "swallow" ); } } ::std::list< String >* pList = &m_aPrinterCommands; diff --git a/padmin/source/padialog.cxx b/padmin/source/padialog.cxx index 760b78730e08..bf89597b9b08 100644 --- a/padmin/source/padialog.cxx +++ b/padmin/source/padialog.cxx @@ -701,9 +701,9 @@ void PADialog::UpdateDevice() { if( aToken.compareToAscii( "autoqueue" ) == 0 ) bAutoQueue = true; - else if( aToken.compareToAscii( "pdf=", 4 ) == 0 ) + else if( aToken.startsWith("pdf=") ) bPdf = true; - else if( aToken.compareToAscii( "fax", 3 ) == 0 ) + else if( aToken.startsWith("fax") ) bFax = true; } } diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx index 3df1a5ea6fc3..2f136c9ab314 100644 --- a/padmin/source/prtsetup.cxx +++ b/padmin/source/prtsetup.cxx @@ -104,7 +104,7 @@ RTSDialog::RTSDialog( const PrinterInfo& rJobData, const String& rPrinter, bool m_pTabControl->RemovePage(m_pTabControl->GetPageId("font")); m_pTabControl->RemovePage(m_pTabControl->GetPageId("command")); } - else if( m_aJobData.m_aDriverName.compareToAscii( "CUPS:", 5 ) == 0 && ! PrinterInfoManager::get().isCUPSDisabled() ) + else if( m_aJobData.m_aDriverName.startsWith("CUPS:") && ! PrinterInfoManager::get().isCUPSDisabled() ) { // command page makes no sense for CUPS printers m_pTabControl->RemovePage(m_pTabControl->GetPageId("command")); diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx index 525d9d94b569..8d6bf00e81f0 100644 --- a/scaddins/source/pricing/pricing.cxx +++ b/scaddins/source/pricing/pricing.cxx @@ -538,9 +538,9 @@ uno::Sequence< sheet::LocalizedName > SAL_CALL ScaPricingAddIn::getCompatibility namespace { bool getinput_putcall(bs::types::PutCall& pc, const OUString& str) { - if(str.compareToAscii("c",1)==0) { + if(str.startsWith("c")) { pc=bs::types::Call; - } else if(str.compareToAscii("p",1)==0) { + } else if(str.startsWith("p")) { pc=bs::types::Put; } else { return false; @@ -572,9 +572,9 @@ bool getinput_strike(double& strike, const ANY& anyval) { } bool getinput_inout(bs::types::BarrierKIO& kio, const OUString& str) { - if(str.compareToAscii("i",1)==0) { + if(str.startsWith("i")) { kio=bs::types::KnockIn; - } else if(str.compareToAscii("o",1)==0) { + } else if(str.startsWith("o")) { kio=bs::types::KnockOut; } else { return false; @@ -583,9 +583,9 @@ bool getinput_inout(bs::types::BarrierKIO& kio, const OUString& str) { } bool getinput_barrier(bs::types::BarrierActive& cont, const OUString& str) { - if(str.compareToAscii("c",1)==0) { + if(str.startsWith("c")) { cont=bs::types::Continuous; - } else if(str.compareToAscii("e",1)==0) { + } else if(str.startsWith("e")) { cont=bs::types::Maturity; } else { return false; @@ -594,9 +594,9 @@ bool getinput_barrier(bs::types::BarrierActive& cont, const OUString& str) { } bool getinput_fordom(bs::types::ForDom& fd, const OUString& str) { - if(str.compareToAscii("f",1)==0) { + if(str.startsWith("f")) { fd=bs::types::Foreign; - } else if(str.compareToAscii("d",1)==0) { + } else if(str.startsWith("d")) { fd=bs::types::Domestic; } else { return false; diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx index f4349bda5797..235a9d38ff75 100644 --- a/sdext/source/pdfimport/filterdet.cxx +++ b/sdext/source/pdfimport/filterdet.cxx @@ -386,7 +386,7 @@ rtl::OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue // check for hybrid PDF oslFileHandle aFile = NULL; if( bSuccess && - ( aURL.isEmpty() || aURL.compareToAscii( "file:", 5 ) != 0 ) + ( aURL.isEmpty() || !aURL.startsWith( "file:" ) ) ) { sal_uInt64 nWritten = 0; 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 diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx index 42c50ed65c2c..9a05e94c57ef 100644 --- a/store/source/lockbyte.cxx +++ b/store/source/lockbyte.cxx @@ -227,7 +227,7 @@ struct FileHandle // Not system path. Assume file url. rtl_uString_assign (&(aFileUrl.pData), pFilename); } - if (aFileUrl.compareToAscii("file://", 7) != 0) + if (!aFileUrl.startsWith("file://")) { // Not file url. Assume relative path. rtl::OUString aCwdUrl; diff --git a/svgio/source/svgreader/svgtoken.cxx b/svgio/source/svgreader/svgtoken.cxx index 0eef4fec84f9..05e6441de202 100644 --- a/svgio/source/svgreader/svgtoken.cxx +++ b/svgio/source/svgreader/svgtoken.cxx @@ -298,7 +298,7 @@ namespace svgio aSVGTokenMapperList.insert(SVGTokenValueType(aSVGStrText, SVGTokenText)); } - const SVGTokenMapper::const_iterator aResult(aSVGTokenMapperList.find(rStr.compareToAscii("svg:", 4) ? rStr : rStr.copy(4))); + const SVGTokenMapper::const_iterator aResult(aSVGTokenMapperList.find(rStr.startsWith("svg:") ? rStr.copy(4) : rStr)); if(aResult == aSVGTokenMapperList.end()) { diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 7d8920df128a..05abd270c9ca 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -770,7 +770,7 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) : Any* pAny = rGeometryItem.GetPropertyValueByName( sType ); if ( pAny ) { *pAny >>= sShapeType; - bOOXMLShape = ( sShapeType.compareToAscii( "ooxml-", 6 ) == 0 ); + bOOXMLShape = ( sShapeType.startsWith("ooxml-") ); OSL_TRACE("shape type: %s %d", OUStringToOString( sShapeType, RTL_TEXTENCODING_ASCII_US ).getStr(), bOOXMLShape); } eSpType = EnhancedCustomShapeTypeNames::Get( sShapeType ); diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx index 87a1e6564d59..c144ec118c88 100644 --- a/svx/source/xml/xmleohlp.cxx +++ b/svx/source/xml/xmleohlp.cxx @@ -219,7 +219,7 @@ void SvXMLEmbeddedObjectHelper::splitObjectURL(::rtl::OUString aURLNoPar, //eliminate './' at start sal_Int32 nStart = 0; sal_Int32 nCount = aURLNoPar.getLength(); - if( 0 == aURLNoPar.compareToAscii( "./", 2 ) ) + if( aURLNoPar.startsWith( "./" ) ) { nStart = 2; nCount -= 2; diff --git a/svx/workben/msview/xmlconfig.cxx b/svx/workben/msview/xmlconfig.cxx index 96203dd47874..7f46b7325786 100644 --- a/svx/workben/msview/xmlconfig.cxx +++ b/svx/workben/msview/xmlconfig.cxx @@ -202,7 +202,7 @@ void SAL_CALL ConfigHandler::startElement(const OUString& aName, const Reference sal_Int32 toInt( const OUString& rText ) { - if( rText.compareToAscii("0x",2) == 0) + if( rText.startsWith("0x")) { sal_Int32 nValue = 0; const sal_Unicode *p = rText; diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx index 11343bbda37a..22878e325e37 100644 --- a/sw/source/filter/xml/xmlimpit.cxx +++ b/sw/source/filter/xml/xmlimpit.cxx @@ -345,7 +345,7 @@ bool SvXMLImportItemMapper::PutXMLValue( pShadow->SetLocation( SVX_SHADOW_NONE ); bOk = true; } - else if( !bColorFound && aToken.compareToAscii( "#", 1 ) == 0 ) + else if( !bColorFound && aToken.startsWith("#") ) { sal_Int32 nColor(0); bOk = ::sax::Converter::convertColor( nColor, aToken ); diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index dc6d71cd95c0..a26ab161b5b2 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -1646,7 +1646,7 @@ Reference< XInterface > SwXTextDocument::createInstance(const OUString& rServic } else { - if( rServiceName.compareToAscii( "com.sun.star.", 13 ) == 0 ) + if( rServiceName.startsWith("com.sun.star.") ) { sal_Int32 nIndex = COM_SUN_STAR__DRAWING_LENGTH; OUString sCategory = rServiceName.getToken( 0, '.', nIndex ); diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx index a08e033e0314..2c551af31595 100644 --- a/ucb/source/ucp/file/bc.cxx +++ b/ucb/source/ucp/file/bc.cxx @@ -1085,7 +1085,7 @@ BaseContent::transfer( sal_Int32 nMyCommandIdentifier, if( m_nState & Deleted ) return; - if( aTransferInfo.SourceURL.compareToAscii( "file:",5 ) != 0 ) + if( !aTransferInfo.SourceURL.startsWith( "file:" ) ) { m_pMyShell->installError( nMyCommandIdentifier, TASKHANDLING_TRANSFER_INVALIDSCHEME ); diff --git a/ucb/source/ucp/webdav/SerfSession.cxx b/ucb/source/ucp/webdav/SerfSession.cxx index 57696dad839c..0a98c4edf2c1 100644 --- a/ucb/source/ucp/webdav/SerfSession.cxx +++ b/ucb/source/ucp/webdav/SerfSession.cxx @@ -418,12 +418,12 @@ apr_status_t SerfSession::verifySerfCertificateChain ( while (nIndex >= 0) { const ::rtl::OUString sToken (sServerCertificateSubject.getToken(0, ',', nIndex)); - if (sToken.compareToAscii("CN=", 3) == 0) + if (sToken.startsWith("CN=")) { sServerCertificateSubject = sToken.copy(3); break; } - else if (sToken.compareToAscii(" CN=", 4) == 0) + else if (sToken.startsWith(" CN=")) { sServerCertificateSubject = sToken.copy(4); break; diff --git a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx index a338bd2dfee9..a1a69ffe15f6 100644 --- a/vcl/aqua/source/dtrans/DataFlavorMapping.cxx +++ b/vcl/aqua/source/dtrans/DataFlavorMapping.cxx @@ -660,7 +660,7 @@ NSArray* DataFlavorMapper::flavorSequenceToTypesArray(const com::sun::star::uno: for (sal_uInt32 i = 0; i < nFlavors; i++) { - if( flavors[i].MimeType.compareToAscii( "image/bmp", 9 ) == 0 ) + if( flavors[i].MimeType.startsWith("image/bmp") ) { [array addObject: NSTIFFPboardType]; [array addObject: NSPICTPboardType]; diff --git a/vcl/aqua/source/dtrans/OSXTransferable.cxx b/vcl/aqua/source/dtrans/OSXTransferable.cxx index 0f6c57d06ef7..6d7ef1b8ed15 100644 --- a/vcl/aqua/source/dtrans/OSXTransferable.cxx +++ b/vcl/aqua/source/dtrans/OSXTransferable.cxx @@ -75,7 +75,7 @@ Any SAL_CALL OSXTransferable::getTransferData( const DataFlavor& aFlavor ) } NSString* sysFormat = - (aFlavor.MimeType.compareToAscii( "image/bmp", 9 ) == 0) + (aFlavor.MimeType.startsWith("image/bmp")) ? mDataFlavorMapper->openOfficeImageToSystemFlavor( mPasteboard ) : mDataFlavorMapper->openOfficeToSystemFlavor(aFlavor); DataProviderPtr_t dp; diff --git a/vcl/generic/fontmanager/helper.cxx b/vcl/generic/fontmanager/helper.cxx index 25c1c4f52c6a..7b1a5713da12 100644 --- a/vcl/generic/fontmanager/helper.cxx +++ b/vcl/generic/fontmanager/helper.cxx @@ -59,19 +59,19 @@ OUString getOfficePath( enum whichOfficePath ePath ) aBootstrap.getFrom( "UserInstallation", aUserPath ); OUString aUPath = aUserPath; - if( ! aConfigPath.compareToAscii( "file://", 7 ) ) + if( aConfigPath.startsWith( "file://" ) ) { OUString aSysPath; if( osl_getSystemPathFromFileURL( aConfigPath.pData, &aSysPath.pData ) == osl_File_E_None ) aConfigPath = aSysPath; } - if( ! aInstallationRootPath.compareToAscii( "file://", 7 ) ) + if( aInstallationRootPath.startsWith( "file://" ) ) { OUString aSysPath; if( osl_getSystemPathFromFileURL( aInstallationRootPath.pData, &aSysPath.pData ) == osl_File_E_None ) aInstallationRootPath = aSysPath; } - if( ! aUserPath.compareToAscii( "file://", 7 ) ) + if( aUserPath.startsWith( "file://" ) ) { OUString aSysPath; if( osl_getSystemPathFromFileURL( aUserPath.pData, &aSysPath.pData ) == osl_File_E_None ) diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx index f01a7cfeb3b7..583587002361 100644 --- a/vcl/generic/print/genprnpsp.cxx +++ b/vcl/generic/print/genprnpsp.cxx @@ -86,7 +86,7 @@ static rtl::OUString getPdfDir( const PrinterInfo& rInfo ) while( nIndex != -1 ) { rtl::OUString aToken( rInfo.m_aFeatures.getToken( 0, ',', nIndex ) ); - if( ! aToken.compareToAscii( "pdf=", 4 ) ) + if( aToken.startsWith( "pdf=" ) ) { sal_Int32 nPos = 0; aDir = aToken.getToken( 1, '=', nPos ); @@ -924,7 +924,7 @@ sal_Bool PspSalPrinter::StartJob( while( nIndex != -1 ) { OUString aToken( rInfo.m_aFeatures.getToken( 0, ',', nIndex ) ); - if( ! aToken.compareToAscii( "fax", 3 ) ) + if( aToken.startsWith( "fax" ) ) { m_bFax = true; m_aTmpFile = getTmpName(); @@ -936,11 +936,11 @@ sal_Bool PspSalPrinter::StartJob( m_aFaxNr = it->second; sal_Int32 nPos = 0; - m_bSwallowFaxNo = ! aToken.getToken( 1, '=', nPos ).compareToAscii( "swallow", 7 ) ? true : false; + m_bSwallowFaxNo = aToken.getToken( 1, '=', nPos ).startsWith( "swallow" ) ? true : false; break; } - if( ! aToken.compareToAscii( "pdf=", 4 ) ) + if( aToken.startsWith( "pdf=" ) ) { m_bPdf = true; m_aTmpFile = getTmpName(); @@ -1170,7 +1170,7 @@ sal_Bool PspSalPrinter::StartJob( const rtl::OUString* i_pFileName, const rtl::O else osl_createTempFile( NULL, NULL, &aPDFUrl.pData ); // normalize to file URL - if( aPDFUrl.compareToAscii( "file:", 5 ) != 0 ) + if( !aPDFUrl.startsWith( "file:" ) ) { // this is not a file URL, but it should // form it into a osl friendly file URL diff --git a/vcl/headless/svpprn.cxx b/vcl/headless/svpprn.cxx index d769847512b3..b6a664839259 100644 --- a/vcl/headless/svpprn.cxx +++ b/vcl/headless/svpprn.cxx @@ -45,7 +45,7 @@ static OUString getPdfDir( const PrinterInfo& rInfo ) while( nIndex != -1 ) { OUString aToken( rInfo.m_aFeatures.getToken( 0, ',', nIndex ) ); - if( ! aToken.compareToAscii( "pdf=", 4 ) ) + if( aToken.startsWith( "pdf=" ) ) { sal_Int32 nPos = 0; aDir = aToken.getToken( 1, '=', nPos ); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 59dcfb722fed..636cd94cdf07 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -4646,7 +4646,7 @@ we check in the following sequence: // getting the needed URL information from the current document path if( eTargetProtocol == INET_PROT_NOT_VALID ) { - if( rLink.m_aURL.getLength() > 4 && rLink.m_aURL.compareToAscii( "\\\\\\\\", 4 ) == 0) + if( rLink.m_aURL.getLength() > 4 && rLink.m_aURL.startsWith("\\\\\\\\")) { bIsUNCPath = sal_True; } diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index 77f0cc09ecd1..46c2910ed8fb 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -653,7 +653,7 @@ bool SelectionManager::convertData( bSuccess = true; } } - else if( aFlavor.MimeType.compareToAscii( "text/plain", 10 ) == 0 ) + else if( aFlavor.MimeType.startsWith("text/plain") ) { rtl_TextEncoding aEncoding = RTL_TEXTENCODING_DONTKNOW; bool bCompoundText = false; @@ -842,7 +842,7 @@ void SelectionManager::getNativeTypeList( const Sequence< DataFlavor >& rTypes, bool bHaveText = false; for( int i = 0; i < nFlavors; i++ ) { - if( pFlavors[i].MimeType.compareToAscii( "text/plain", 10 ) == 0) + if( pFlavors[i].MimeType.startsWith("text/plain")) bHaveText = true; else convertTypeToNative( pFlavors[i].MimeType, targetselection, nFormat, rOutTypeList ); diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index 1c58bfb63d14..102d19c7e5b8 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -438,7 +438,7 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter ) const PPDParser* pNewParser = NULL; OUString aPrinter; - if( rPrinter.compareToAscii( "CUPS:", 5 ) == 0 ) + if( rPrinter.startsWith("CUPS:") ) aPrinter = rPrinter.copy( 5 ); else aPrinter = rPrinter; @@ -561,7 +561,7 @@ void CUPSManager::setupJobContextData( JobData& rData ) if( p_it->second.m_aInfo.m_aContext.getParser() == NULL ) { OUString aPrinter; - if( p_it->second.m_aInfo.m_aDriverName.compareToAscii( "CUPS:", 5 ) == 0 ) + if( p_it->second.m_aInfo.m_aDriverName.startsWith("CUPS:") ) aPrinter = p_it->second.m_aInfo.m_aDriverName.copy( 5 ); else aPrinter = p_it->second.m_aInfo.m_aDriverName; @@ -772,7 +772,7 @@ bool CUPSManager::addPrinter( const OUString& rName, const OUString& rDriver ) { // don't touch the CUPS printers if( m_aCUPSDestMap.find( rName ) != m_aCUPSDestMap.end() || - rDriver.compareToAscii( "CUPS:", 5 ) == 0 + rDriver.startsWith("CUPS:") ) return false; return PrinterInfoManager::addPrinter( rName, rDriver ); diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index b5a0569b272d..133a342ce282 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -411,7 +411,7 @@ void PrinterInfoManager::initialize() // set parser, merge settings // don't do this for CUPS printers as this is done // by the CUPS system itself - if( aPrinter.m_aInfo.m_aDriverName.compareToAscii( "CUPS:", 5 ) != 0 ) + if( !aPrinter.m_aInfo.m_aDriverName.startsWith( "CUPS:" ) ) { aPrinter.m_aInfo.m_pParser = PPDParser::getParser( aPrinter.m_aInfo.m_aDriverName ); aPrinter.m_aInfo.m_aContext.setParser( aPrinter.m_aInfo.m_pParser ); @@ -791,7 +791,7 @@ bool PrinterInfoManager::writePrinterConfig() aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nBottomMarginAdjust)); pConfig->WriteKey("MarginAdjust", aValue.makeStringAndClear()); - if( it->second.m_aInfo.m_aDriverName.compareToAscii( "CUPS:", 5 ) != 0 ) + if( ! it->second.m_aInfo.m_aDriverName.startsWith( "CUPS:" ) ) { // write PPDContext (not for CUPS) for( int i = 0; i < it->second.m_aInfo.m_aContext.countValuesModified(); i++ ) diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx index cc69ccb6edbb..07172468846d 100644 --- a/vcl/unx/gtk/app/gtkinst.cxx +++ b/vcl/unx/gtk/app/gtkinst.cxx @@ -283,7 +283,7 @@ void GtkInstance::AddToRecentDocumentList(const rtl::OUString& rFileUrl, const r { rtl::OString sGtkURL; rtl_TextEncoding aSystemEnc = osl_getThreadTextEncoding(); - if ((aSystemEnc == RTL_TEXTENCODING_UTF8) || (rFileUrl.compareToAscii( "file://", 7 ) != 0)) + if ((aSystemEnc == RTL_TEXTENCODING_UTF8) || !rFileUrl.startsWith( "file://" )) sGtkURL = rtl::OUStringToOString(rFileUrl, RTL_TEXTENCODING_UTF8); else { diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 33f1c1c724de..8660b53464cd 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -466,31 +466,31 @@ StaticModuleInformation* Databases::getStaticInformationForModule( const rtl::OU { current = rtl::OUString( lineBuffer,pos ); - if( current.compareToAscii( "Title",5 ) == 0 ) + if( current.startsWith("Title") ) { title = current.copy( current.indexOf(sal_Unicode( '=' ) ) + 1 ); } - else if( current.compareToAscii( "Start",5 ) == 0 ) + else if( current.startsWith("Start") ) { startid = current.copy( current.indexOf('=') + 1 ); } - else if( current.compareToAscii( "Language",8 ) == 0 ) + else if( current.startsWith("Language") ) { lang_ = current.copy( current.indexOf('=') + 1 ); } - else if( current.compareToAscii( "Program",7 ) == 0 ) + else if( current.startsWith("Program") ) { program = current.copy( current.indexOf('=') + 1 ); } - else if( current.compareToAscii( "Heading",7 ) == 0 ) + else if( current.startsWith("Heading") ) { heading = current.copy( current.indexOf('=') + 1 ); } - else if( current.compareToAscii( "FullText",8 ) == 0 ) + else if( current.startsWith("FullText") ) { fulltext = current.copy( current.indexOf('=') + 1 ); } - else if( current.compareToAscii( "Order",5 ) == 0 ) + else if( current.startsWith("Order") ) { order = current.copy( current.indexOf('=') + 1 ); } diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 386f4662f8f8..f82117de342a 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -519,7 +519,7 @@ bool URLParameter::scheme() { // Correct extension help links as sometimes the // module is missing resulting in a misformed URL - if( m_aExpr.compareToAscii( "vnd.sun.star.help:///", 21 ) == 0 ) + if( m_aExpr.startsWith("vnd.sun.star.help:///") ) { sal_Int32 nLen = m_aExpr.getLength(); rtl::OUString aLastStr = diff --git a/xmloff/source/draw/eventimp.cxx b/xmloff/source/draw/eventimp.cxx index 3cdd5797909a..fb711d8a1fef 100644 --- a/xmloff/source/draw/eventimp.cxx +++ b/xmloff/source/draw/eventimp.cxx @@ -415,7 +415,7 @@ void SdXMLEventContext::EndElement() // so check here if its realy a bookmark or maybe a document if( meClickAction == ClickAction_BOOKMARK ) { - if( msBookmark.compareToAscii( "#", 1 ) != 0 ) + if( !msBookmark.startsWith( "#" ) ) meClickAction = ClickAction_DOCUMENT; } diff --git a/xmloff/source/style/shadwhdl.cxx b/xmloff/source/style/shadwhdl.cxx index 13c1d9a1932c..8df434f91be0 100644 --- a/xmloff/source/style/shadwhdl.cxx +++ b/xmloff/source/style/shadwhdl.cxx @@ -64,7 +64,7 @@ sal_Bool XMLShadowPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rV bRet = sal_True; break; } - else if( !bColorFound && aToken.compareToAscii( "#", 1 ) == 0 ) + else if( !bColorFound && aToken.startsWith("#") ) { sal_Int32 nColor(0); bRet = ::sax::Converter::convertColor( nColor, aToken ); diff --git a/xmloff/source/transform/StyleOASISTContext.cxx b/xmloff/source/transform/StyleOASISTContext.cxx index 6f7caf7daf66..cd76458ad584 100644 --- a/xmloff/source/transform/StyleOASISTContext.cxx +++ b/xmloff/source/transform/StyleOASISTContext.cxx @@ -871,7 +871,7 @@ void XMLStyleOASISTContext::StartElement( --nAttrCount; break; case XML_ATACTION_DECODE_STYLE_NAME: - m_bControlStyle = 0 == rAttrValue.compareToAscii( "ctrl", 4 ); + m_bControlStyle = rAttrValue.startsWith( "ctrl" ); case XML_ATACTION_DECODE_STYLE_NAME_REF: { OUString aAttrValue( rAttrValue ); diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx index 4adfc9727bd0..00665efdeda2 100644 --- a/xmloff/source/transform/TransformerBase.cxx +++ b/xmloff/source/transform/TransformerBase.cxx @@ -1382,7 +1382,7 @@ sal_Bool XMLTransformerBase::ConvertURIToOOo( ::rtl::OUString& rURI, if( bPackage && bSupportPackage ) { OUString sTmp( OUString::valueOf( sal_Unicode( '#' ) ) ); - if( 0 == rURI.compareToAscii( "./", 2 ) ) + if( rURI.startsWith( "./" ) ) rURI = rURI.copy( 2 ); sTmp += rURI; rURI = sTmp; |