diff options
28 files changed, 46 insertions, 55 deletions
diff --git a/connectivity/source/drivers/ado/ADriver.cxx b/connectivity/source/drivers/ado/ADriver.cxx index fc51c3d2b84a..cbcc5561eb35 100644 --- a/connectivity/source/drivers/ado/ADriver.cxx +++ b/connectivity/source/drivers/ado/ADriver.cxx @@ -141,7 +141,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return (!url.compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdbc:ado:")),9)); + return url.startsWith("sdbc:ado:"); } // ----------------------------------------------------------------------------- void ODriver::impl_checkURL_throw(const ::rtl::OUString& _sUrl) diff --git a/connectivity/source/drivers/calc/CDriver.cxx b/connectivity/source/drivers/calc/CDriver.cxx index d5da23c93797..27ea3e1e5467 100644 --- a/connectivity/source/drivers/calc/CDriver.cxx +++ b/connectivity/source/drivers/calc/CDriver.cxx @@ -78,7 +78,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return url.compareTo(::rtl::OUString("sdbc:calc:"),10) == 0; + return url.startsWith("sdbc:calc:"); } Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/dbase/DDriver.cxx b/connectivity/source/drivers/dbase/DDriver.cxx index 36290b84eed9..6da0aa49118f 100644 --- a/connectivity/source/drivers/dbase/DDriver.cxx +++ b/connectivity/source/drivers/dbase/DDriver.cxx @@ -70,7 +70,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, // -------------------------------------------------------------------------------- sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return !url.compareTo(::rtl::OUString("sdbc:dbase:"),11); + return url.startsWith("sdbc:dbase:"); } // ----------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx index f4e0e6f2d657..21a0d9dda5ec 100644 --- a/connectivity/source/drivers/file/FDriver.cxx +++ b/connectivity/source/drivers/file/FDriver.cxx @@ -118,7 +118,7 @@ sal_Bool SAL_CALL OFileDriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::acceptsURL" ); - return (!url.compareTo(::rtl::OUString("sdbc:file:"),10)); + return url.startsWith("sdbc:file:"); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL OFileDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/flat/EDriver.cxx b/connectivity/source/drivers/flat/EDriver.cxx index 1398fea8bcc2..86bf8fe5ed27 100644 --- a/connectivity/source/drivers/flat/EDriver.cxx +++ b/connectivity/source/drivers/flat/EDriver.cxx @@ -74,7 +74,7 @@ Reference< XConnection > SAL_CALL ODriver::connect( const ::rtl::OUString& url, sal_Bool SAL_CALL ODriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return url.compareTo(::rtl::OUString("sdbc:flat:"),10) == 0; + return url.startsWith("sdbc:flat:"); } // ----------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL ODriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/jdbc/JDriver.cxx b/connectivity/source/drivers/jdbc/JDriver.cxx index 7aa056edbb4a..2e03671dcdf6 100644 --- a/connectivity/source/drivers/jdbc/JDriver.cxx +++ b/connectivity/source/drivers/jdbc/JDriver.cxx @@ -118,8 +118,7 @@ sal_Bool SAL_CALL java_sql_Driver::acceptsURL( const ::rtl::OUString& url ) thro // I feel responsible for all jdbc url's sal_Bool bEnabled = sal_False; OSL_VERIFY_EQUALS( jfw_getEnabled( &bEnabled ), JFW_E_NONE, "error in jfw_getEnabled" ); - static const ::rtl::OUString s_sJdbcPrefix( "jdbc:" ); - return bEnabled && 0 == url.compareTo(s_sJdbcPrefix, 5); + return bEnabled && url.startsWith("jdbc:"); } // ------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL java_sql_Driver::getPropertyInfo( const ::rtl::OUString& url, diff --git a/connectivity/source/drivers/kab/KDriver.cxx b/connectivity/source/drivers/kab/KDriver.cxx index b9765c00b14d..d086838af909 100644 --- a/connectivity/source/drivers/kab/KDriver.cxx +++ b/connectivity/source/drivers/kab/KDriver.cxx @@ -408,7 +408,7 @@ sal_Bool SAL_CALL KabDriver::acceptsURL( const ::rtl::OUString& url ) return sal_False; // here we have to look whether we support this URL format - return (!url.compareTo(::rtl::OUString("sdbc:address:kab:"), 16)); + return url.startsWith("sdbc:address:kab:"); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL KabDriver::getPropertyInfo( const ::rtl::OUString&, const Sequence< PropertyValue >& ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/macab/MacabDriver.cxx b/connectivity/source/drivers/macab/MacabDriver.cxx index 7365e3d4c995..4a547660b540 100644 --- a/connectivity/source/drivers/macab/MacabDriver.cxx +++ b/connectivity/source/drivers/macab/MacabDriver.cxx @@ -276,7 +276,7 @@ sal_Bool SAL_CALL MacabDriver::acceptsURL( const ::rtl::OUString& url ) return sal_False; // here we have to look whether we support this URL format - return (!url.compareTo(::rtl::OUString("sdbc:address:macab:"), 18)); + return url.startsWith("sdbc:address:macab:"); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL MacabDriver::getPropertyInfo( const ::rtl::OUString&, const Sequence< PropertyValue >& ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/drivers/odbcbase/ODriver.cxx b/connectivity/source/drivers/odbcbase/ODriver.cxx index e5c2cf13f590..ba469451fe19 100644 --- a/connectivity/source/drivers/odbcbase/ODriver.cxx +++ b/connectivity/source/drivers/odbcbase/ODriver.cxx @@ -118,7 +118,7 @@ Reference< XConnection > SAL_CALL ODBCDriver::connect( const ::rtl::OUString& ur sal_Bool SAL_CALL ODBCDriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { - return (!url.compareTo(::rtl::OUString("sdbc:odbc:"),10)); + return url.startsWith("sdbc:odbc:"); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL ODBCDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& /*info*/ ) throw(SQLException, RuntimeException) diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index a0f7d43fe9af..338d73853e65 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -4739,7 +4739,7 @@ OSQLParseNode* OSQLParser::parseTree(::rtl::OUString& rErrorMessage, if (!aStr.getLength()) { aStr = yytname[YYTRANSLATE(nTokenID)]; - if(!aStr.compareTo("SQL_TOKEN_",10)) + if(aStr.startsWith("SQL_TOKEN_")) aStr = aStr.copy(10); } return aStr; diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx index e6babf061f85..96bafbcdef93 100644 --- a/dbaccess/source/ui/dlg/directsql.cxx +++ b/dbaccess/source/ui/dlg/directsql.cxx @@ -229,7 +229,7 @@ DBG_NAME(DirectSQLDialog) m_aOutput.SetText(rtl::OUString()); if (xStatement.is()) { - if (::rtl::OUString(_rStatement).toAsciiUpperCase().compareTo(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SELECT")),6)==0 && m_pShowOutput->IsChecked()) + if (OUString(_rStatement).toAsciiUpperCase().startsWith("SELECT") && m_pShowOutput->IsChecked()) { // execute it as a query xResultSet = xStatement->executeQuery(_rStatement); diff --git a/framework/inc/queries.h b/framework/inc/queries.h index 24e0a74cc65c..b839910ded48 100644 --- a/framework/inc/queries.h +++ b/framework/inc/queries.h @@ -264,27 +264,27 @@ class QueryAnalyzer { sParam = sNewQuery.getToken( 0, SEPERATOR_QUERYPARAM, nToken ); // "default_first" - if( sParam.compareTo( QUERYPARAM_DEFAULT_FIRST, QUERYPARAM_DEFAULT_FIRST.getLength() ) == 0 ) + if( sParam.startsWith( QUERYPARAM_DEFAULT_FIRST ) ) { m_bDefaultFirst = sal_True; } // "use_order" - else if( sParam.compareTo( QUERYPARAM_USE_ORDER, QUERYPARAM_USE_ORDER.getLength() ) == 0 ) + else if( sParam.startsWith( QUERYPARAM_USE_ORDER ) ) { m_bUseOrder = sal_True; } // "descending" - else if( sParam.compareTo( QUERYPARAM_DESCENDING, QUERYPARAM_DESCENDING.getLength() ) == 0 ) + else if( sParam.startsWith( QUERYPARAM_DESCENDING ) ) { m_bDescending = sal_True; } // "case_sensitive" - else if( sParam.compareTo( QUERYPARAM_CASE_SENSITIVE, QUERYPARAM_CASE_SENSITIVE.getLength() ) == 0 ) + else if( sParam.startsWith( QUERYPARAM_CASE_SENSITIVE ) ) { m_bCaseSensitive = sal_True; } // "iflags=<mask>" - else if( sParam.compareTo( QUERYPARAM_IFLAGS, QUERYPARAM_IFLAGS.getLength() ) == 0 ) + else if( sParam.startsWith( QUERYPARAM_IFLAGS ) ) { sal_Int32 nSubToken = 0; sParam.getToken( 0, SEPERATOR_QUERYPARAMVALUE, nSubToken ); @@ -294,7 +294,7 @@ class QueryAnalyzer } } // "eflags=<mask>" - else if( sParam.compareTo( QUERYPARAM_EFLAGS, QUERYPARAM_EFLAGS.getLength() ) == 0 ) + else if( sParam.startsWith( QUERYPARAM_EFLAGS ) ) { sal_Int32 nSubToken = 0; sParam.getToken( 0, SEPERATOR_QUERYPARAMVALUE, nSubToken ); @@ -304,17 +304,16 @@ class QueryAnalyzer } } // "sort_prop=<[name,uiname]>" - else if( sParam.compareTo( QUERYPARAM_SORT_PROP, QUERYPARAM_SORT_PROP.getLength() ) == 0 ) + else if( sParam.startsWith( QUERYPARAM_SORT_PROP ) ) { sal_Int32 nSubToken = 0; sParam.getToken( 0, SEPERATOR_QUERYPARAMVALUE, nSubToken ); if( nSubToken > 0 ) { OUString sParamValue = sParam.getToken( 0, SEPERATOR_QUERYPARAMVALUE, nSubToken ); - if( sParamValue.compareTo( QUERYPARAMVALUE_SORT_PROP_NAME, QUERYPARAMVALUE_SORT_PROP_NAME.getLength() ) == 0 ) + if( sParamValue.startsWith( QUERYPARAMVALUE_SORT_PROP_NAME ) ) m_eSortProp = E_NAME; - else - if( sParamValue.compareTo( QUERYPARAMVALUE_SORT_PROP_UINAME, QUERYPARAMVALUE_SORT_PROP_UINAME.getLength() ) == 0 ) + else if( sParamValue.startsWith( QUERYPARAMVALUE_SORT_PROP_UINAME ) ) m_eSortProp = E_UINAME; } } diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx index 4556ac489cd2..762453bbb9eb 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx @@ -134,7 +134,7 @@ sal_Bool SAL_CALL SkeletonDriver::acceptsURL( const ::rtl::OUString& url ) { // here we have to look if we support this url format // change the URL format to your needs, but please aware that the first on who accepts the URl wins. - return (!url.compareTo(::rtl::OUString("sdbc:skeleton:"),14)); + return url.startsWith("sdbc:skeleton:"); } // -------------------------------------------------------------------------------- Sequence< DriverPropertyInfo > SAL_CALL SkeletonDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) diff --git a/svtools/source/dialogs/filedlg2.cxx b/svtools/source/dialogs/filedlg2.cxx index 210dfd48d84d..44e5985944f7 100644 --- a/svtools/source/dialogs/filedlg2.cxx +++ b/svtools/source/dialogs/filedlg2.cxx @@ -71,7 +71,7 @@ KbdListBox::PreNotify( NotifyEvent& rNEvt ) aEntry = comphelper::string::stripStart(aEntry, ' ').toAsciiUpperCase(); OUString aCompare = OUString(cCharCode).toAsciiUpperCase(); - if ( aEntry.compareTo( aCompare, 1 ) == 0 ) + if ( aEntry.startsWith( aCompare ) ) { SelectEntryPos ( (i + nCurrentPos) % nEntries ); break; diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 106e777fe053..3af6dfc5c5e1 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1001,7 +1001,7 @@ OUString SwXFieldMaster::LocalizeFormula( { OUString sSource = bQuery ? sTypeName : sProgName; OUString sDest = bQuery ? sProgName : sTypeName; - if(!rFormula.compareTo(sSource, sSource.getLength())) + if(rFormula.startsWith(sSource)) { OUString sTmpFormula = sDest; sTmpFormula += rFormula.copy(sSource.getLength()); diff --git a/unotools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx index 9696ef8934e1..78042d66bc84 100644 --- a/unotools/source/config/dynamicmenuoptions.cxx +++ b/unotools/source/config/dynamicmenuoptions.cxx @@ -197,7 +197,7 @@ class SvtDynMenu pItem!=lUserEntries.end() ; ++pItem ) { - if( pItem->sName.compareTo( PATHPREFIX_USER, 1 ) == 0 ) + if( pItem->sName.startsWith( PATHPREFIX_USER ) ) { OUString sNr = pItem->sName.copy( 1, pItem->sName.getLength()-1 ); sal_Int32 nCheckNr = sNr.toInt32(); diff --git a/vcl/headless/svpelement.cxx b/vcl/headless/svpelement.cxx index ee5fb00ce126..5458fe8a7539 100644 --- a/vcl/headless/svpelement.cxx +++ b/vcl/headless/svpelement.cxx @@ -163,7 +163,7 @@ IMPL_LINK( SvpElementContainer, processRequest, void*, pSocket ) while( read( nFile, &c, 1 ) && c != '\n' ) aBuf.append( sal_Char(c) ); rtl::OString aCommand( aBuf.makeStringAndClear() ); - if( aCommand.compareTo( "list", 4 ) == 0 ) + if( aCommand.startsWith( "list" ) ) { boost::unordered_map< rtl::OString, std::list<SvpElement*>, rtl::OStringHash > aMap; for( std::list< SvpElement* >::const_iterator it = m_aElements.begin(); @@ -186,7 +186,7 @@ IMPL_LINK( SvpElementContainer, processRequest, void*, pSocket ) } } } - else if( aCommand.compareTo( "get", 3 ) == 0 ) + else if( aCommand.startsWith( "get" ) ) { sal_IntPtr aId = aCommand.copy( 3 ).toInt64( 16 ); SvpElement* pElement = reinterpret_cast<SvpElement*>(aId); @@ -212,7 +212,7 @@ IMPL_LINK( SvpElementContainer, processRequest, void*, pSocket ) } } } - else if( aCommand.compareTo( "quit", 4 ) == 0 ) + else if( aCommand.startsWith( "quit" ) ) { Application::Quit(); close( m_nSocket ); diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 164384a4e1da..8aa8d7043e43 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -455,11 +455,11 @@ bool ImplInitAccessBridge(bool bAllowCancel, bool &rCancelled) rtl::OUString aTitle; rtl::OUStringBuffer aMessage(ResId(SV_ACCESSERROR_BRIDGE_MSG, *pResMgr).toString()); - if( 0 == e.Message.compareTo(::rtl::OUString("ClassNotFound"), 13) ) + if( e.Message.startsWith("ClassNotFound") ) { aTitle = ResId(SV_ACCESSERROR_MISSING_BRIDGE, *pResMgr).toString(); } - else if( 0 == e.Message.compareTo(::rtl::OUString("NoSuchMethod"), 12) ) + else if( e.Message.startsWith("NoSuchMethod") ) { aTitle = ResId(SV_ACCESSERROR_WRONG_VERSION, *pResMgr).toString(); } diff --git a/vcl/test/dndtest.cxx b/vcl/test/dndtest.cxx index c2756dcfbf41..83c98872f0ad 100644 --- a/vcl/test/dndtest.cxx +++ b/vcl/test/dndtest.cxx @@ -152,7 +152,7 @@ void MyApp::Main() osl_getCommandArg( n, &aArg.pData ); - if( aArg.compareTo( OUString("-r"), 2 ) == 0 ) + if( aArg.startsWith( "-r" ) ) { if ( n + 1 < nmax ) osl_getCommandArg( ++n, &aRegistry.pData ); diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx index fa28ecbae8d9..12ce0cc25d46 100644 --- a/vcl/workben/svpclient.cxx +++ b/vcl/workben/svpclient.cxx @@ -185,7 +185,7 @@ void MyWin::parseList( const rtl::OString& rList ) if( ! aLine.getLength() || *aLine.getStr() == '#' ) continue; - if( aLine.compareTo( "ElementType: ", 13 ) == 0 ) + if( aLine.startsWith( "ElementType: " ) ) aElementType = rtl::OStringToOUString( aLine.copy( 13 ), RTL_TEXTENCODING_ASCII_US ); else { diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 92be3877daf2..423019cb6bfe 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2867,10 +2867,10 @@ void DomainMapper_Impl::CloseFieldCommand() nSpaceIndex = aCommand.indexOf(' '); if(nSpaceIndex > 0) aCommand = aCommand.copy(nSpaceIndex).trim(); - if (aCommand.compareTo("\\s", 2) == 0) + if (aCommand.startsWith("\\s")) { aCommand = aCommand.copy(2); - if (aCommand.compareTo("\\do", 3) == 0) + if (aCommand.startsWith("\\do")) { aCommand = aCommand.copy(3); sal_Int32 nStartIndex = aCommand.indexOf('('); diff --git a/xmlhelp/source/cxxhelp/provider/db.hxx b/xmlhelp/source/cxxhelp/provider/db.hxx index 6c42e5fecf7b..429fd24bdbe2 100644 --- a/xmlhelp/source/cxxhelp/provider/db.hxx +++ b/xmlhelp/source/cxxhelp/provider/db.hxx @@ -110,7 +110,7 @@ namespace helpdatafileproxy { , m_nItRead( -1 ) , m_iItPos( -1 ) { - OSL_ASSERT(!rFileURL.compareTo("file:", 5)); + OSL_ASSERT(rFileURL.startsWith("file:")); } ~Hdf() { releaseHashMap(); } diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 81afbf314543..c578286c0b7a 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -1854,8 +1854,7 @@ sal_Int32 SvXMLExport::dataStyleForceSystemLanguage(sal_Int32 nFormat) const OUString SvXMLExport::AddEmbeddedGraphicObject( const OUString& rGraphicObjectURL ) { OUString sRet( rGraphicObjectURL ); - if( 0 == rGraphicObjectURL.compareTo( msGraphicObjectProtocol, - msGraphicObjectProtocol.getLength() ) && + if( rGraphicObjectURL.startsWith( msGraphicObjectProtocol ) && mxGraphicResolver.is() ) { if( (getExportFlags() & EXPORT_EMBEDDED) == 0 ) @@ -1874,8 +1873,7 @@ sal_Bool SvXMLExport::AddEmbeddedGraphicObjectAsBase64( const OUString& rGraphic sal_Bool bRet = sal_False; if( (getExportFlags() & EXPORT_EMBEDDED) != 0 && - 0 == rGraphicObjectURL.compareTo( msGraphicObjectProtocol, - msGraphicObjectProtocol.getLength() ) && + rGraphicObjectURL.startsWith( msGraphicObjectProtocol ) && mxGraphicResolver.is() ) { Reference< XBinaryStreamResolver > xStmResolver( mxGraphicResolver, UNO_QUERY ); @@ -1898,10 +1896,8 @@ sal_Bool SvXMLExport::AddEmbeddedGraphicObjectAsBase64( const OUString& rGraphic OUString SvXMLExport::AddEmbeddedObject( const OUString& rEmbeddedObjectURL ) { OUString sRet; - if( (0 == rEmbeddedObjectURL.compareTo( msEmbeddedObjectProtocol, - msEmbeddedObjectProtocol.getLength() ) || - 0 == rEmbeddedObjectURL.compareTo( msGraphicObjectProtocol, - msGraphicObjectProtocol.getLength() ) ) && + if( (rEmbeddedObjectURL.startsWith( msEmbeddedObjectProtocol ) || + rEmbeddedObjectURL.startsWith( msGraphicObjectProtocol ) ) && mxEmbeddedResolver.is() ) { sRet = @@ -1916,10 +1912,8 @@ OUString SvXMLExport::AddEmbeddedObject( const OUString& rEmbeddedObjectURL ) sal_Bool SvXMLExport::AddEmbeddedObjectAsBase64( const OUString& rEmbeddedObjectURL ) { sal_Bool bRet = sal_False; - if( (0 == rEmbeddedObjectURL.compareTo( msEmbeddedObjectProtocol, - msEmbeddedObjectProtocol.getLength() ) || - 0 == rEmbeddedObjectURL.compareTo( msGraphicObjectProtocol, - msGraphicObjectProtocol.getLength() ) ) && + if( (rEmbeddedObjectURL.startsWith( msEmbeddedObjectProtocol ) || + rEmbeddedObjectURL.startsWith( msGraphicObjectProtocol ) ) && mxEmbeddedResolver.is() ) { Reference < XNameAccess > xNA( mxEmbeddedResolver, UNO_QUERY ); diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 2edbac4ad084..04f7a51081af 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -639,7 +639,7 @@ void SAL_CALL SvXMLImport::startElement( const OUString& rName, } } else if( ( rAttrName.getLength() >= 5 ) && - ( rAttrName.compareTo( GetXMLToken(XML_XMLNS), 5 ) == 0 ) && + ( rAttrName.startsWith( GetXMLToken(XML_XMLNS) ) ) && ( rAttrName.getLength() == 5 || ':' == rAttrName[5] ) ) { if( !pRewindMap ) diff --git a/xmloff/source/style/XMLClipPropertyHandler.cxx b/xmloff/source/style/XMLClipPropertyHandler.cxx index e55e6ee4a87d..ec0e1d59de1a 100644 --- a/xmloff/source/style/XMLClipPropertyHandler.cxx +++ b/xmloff/source/style/XMLClipPropertyHandler.cxx @@ -66,7 +66,7 @@ sal_Bool XMLClipPropertyHandler::importXML( const OUString& rStrImpValue, uno::A sal_Bool bRet = sal_False; sal_Int32 nLen = rStrImpValue.getLength(); if( nLen > 6 && - 0 == rStrImpValue.compareTo( GetXMLToken(XML_RECT), 4 ) && + rStrImpValue.startsWith( GetXMLToken(XML_RECT)) && rStrImpValue[4] == '(' && rStrImpValue[nLen-1] == ')' ) { diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx index 67c8e5bb39a0..4adfc9727bd0 100644 --- a/xmloff/source/transform/TransformerBase.cxx +++ b/xmloff/source/transform/TransformerBase.cxx @@ -242,7 +242,7 @@ void SAL_CALL XMLTransformerBase::startElement( const OUString& rName, { const OUString& rAttrName = xAttrList->getNameByIndex( i ); if( ( rAttrName.getLength() >= 5 ) && - ( rAttrName.compareTo( GetXMLToken(XML_XMLNS), 5 ) == 0 ) && + ( rAttrName.startsWith( GetXMLToken(XML_XMLNS) ) ) && ( rAttrName.getLength() == 5 || ':' == rAttrName[5] ) ) { if( !pRewindMap ) @@ -1340,8 +1340,7 @@ sal_Bool XMLTransformerBase::ConvertURIToOOo( ::rtl::OUString& rURI, break; case '.': // a rel path - if( 0 == rURI.compareTo( m_aExtPathPrefix, - m_aExtPathPrefix.getLength() ) ) + if( rURI.startsWith( m_aExtPathPrefix ) ) { // an external URI; remove '../' rURI = rURI.copy( m_aExtPathPrefix.getLength() ); diff --git a/xmlscript/source/xml_helper/xml_impctx.cxx b/xmlscript/source/xml_helper/xml_impctx.cxx index 5c2dec389677..9189e534d8d7 100644 --- a/xmlscript/source/xml_helper/xml_impctx.cxx +++ b/xmlscript/source/xml_helper/xml_impctx.cxx @@ -563,7 +563,7 @@ void DocumentHandlerImpl::startElement( pQNames[ nPos ] = xAttribs->getNameByIndex( nPos ); OUString const & rQAttributeName = pQNames[ nPos ]; - if (rQAttributeName.compareTo( m_sXMLNS, 5 ) == 0) + if (rQAttributeName.startsWith( m_sXMLNS )) { if (rQAttributeName.getLength() == 5) // set default namespace { diff --git a/xmlsecurity/source/helper/xsecparser.cxx b/xmlsecurity/source/helper/xsecparser.cxx index ce6cedd5d1b7..bb8aec5a31ce 100644 --- a/xmlsecurity/source/helper/xsecparser.cxx +++ b/xmlsecurity/source/helper/xsecparser.cxx @@ -106,7 +106,7 @@ void SAL_CALL XSecParser::startElement( rtl::OUString ouUri = xAttribs->getValueByName(rtl::OUString(RTL_ASCII_USTRINGPARAM(ATTR_URI))); DBG_ASSERT( ouUri != NULL, "URI == NULL" ); - if (0 == ouUri.compareTo(rtl::OUString(RTL_ASCII_USTRINGPARAM(CHAR_FRAGMENT)),1)) + if (ouUri.startsWith(CHAR_FRAGMENT)) { /* * remove the first character '#' from the attribute value |