[Libreoffice-commits] core.git: dbaccess/source editeng/source extensions/source forms/source framework/source linguistic/source rsc/source svx/source sw/source unotools/source xmloff/source

Thomas Arnhold thomas at arnhold.org
Fri Mar 8 04:04:40 PST 2013


 dbaccess/source/filter/xml/dbloader2.cxx        |    2 +-
 editeng/source/uno/unofield.cxx                 |    4 ++--
 extensions/source/bibliography/bibload.cxx      |    2 +-
 forms/source/richtext/richtextcontrol.cxx       |    2 +-
 framework/source/fwe/xml/saxnamespacefilter.cxx |    2 +-
 linguistic/source/lngsvcmgr.cxx                 |    8 ++++----
 rsc/source/rsc/rsc.cxx                          |    2 +-
 svx/source/unodraw/unomod.cxx                   |    2 +-
 sw/source/core/unocore/unoframe.cxx             |    2 +-
 unotools/source/ucbhelper/ucblockbytes.cxx      |    2 +-
 xmloff/source/core/nmspmap.cxx                  |    6 +++---
 xmloff/source/draw/ximpshap.cxx                 |    2 +-
 12 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 6583305dd70e31ae745d709b8cda8c7b68219735
Author: Thomas Arnhold <thomas at arnhold.org>
Date:   Fri Mar 8 12:37:15 2013 +0100

    simplify compareTo (now correct)
    
    Change-Id: Ia4fd2f54d0bda71d472f46949500c0b23ff8e1b7
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx
index 12df6d7..bca2b1a 100644
--- a/dbaccess/source/filter/xml/dbloader2.cxx
+++ b/dbaccess/source/filter/xml/dbloader2.cxx
@@ -157,7 +157,7 @@ OUString SAL_CALL DBTypeDetection::detect( ::com::sun::star::uno::Sequence< ::co
             xStorageProperties->getPropertyValue( INFO_MEDIATYPE ) >>= sMediaType;
             if ( sMediaType == MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII || sMediaType == MIMETYPE_VND_SUN_XML_BASE_ASCII )
             {
-                if ( bStreamFromDescr && sURL.compareTo( OUString( "private:stream" ), 14 ) != COMPARE_EQUAL )
+                if ( bStreamFromDescr && !sURL.startsWith( "private:stream" ) )
                 {
                     // After fixing of the i88522 issue ( use the new file locking for database files ) the stream from the type detection can be used further
                     // for now the file should be reopened to have read/write access
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index b33da6b..b7b0a00 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -886,8 +886,8 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const ::rt
     // fixed since OOo 3.2 but for compatibility we will still provide support for the wrong notation.
     const OUString aTextFieldPrexit2( "com.sun.star.text.TextField." );
 
-    if( (ServiceSpecifier.compareTo( aTextFieldPrexit, aTextFieldPrexit.getLength() ) == 0) ||
-        (ServiceSpecifier.compareTo( aTextFieldPrexit2, aTextFieldPrexit2.getLength() ) == 0) )
+    if( (ServiceSpecifier.startsWith( aTextFieldPrexit )) ||
+        (ServiceSpecifier.startsWith( aTextFieldPrexit2 )) )
     {
         OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) );
 
diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx
index 52c84c6..5527403 100644
--- a/extensions/source/bibliography/bibload.cxx
+++ b/extensions/source/bibliography/bibload.cxx
@@ -550,7 +550,7 @@ sal_Bool BibliographyLoader::hasByName(const rtl::OUString& rName) throw ( Runti
             do
             {
                 rtl::OUString sCurrentId = xIdColumn->getString();
-                if (!xIdColumn->wasNull() && (rName.compareTo(sCurrentId) == COMPARE_EQUAL))
+                if (!xIdColumn->wasNull() && rName.startsWith(sCurrentId))
                 {
                     bRet = sal_True;
                     break;
diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx
index 730d793..053abd1 100644
--- a/forms/source/richtext/richtextcontrol.cxx
+++ b/forms/source/richtext/richtextcontrol.cxx
@@ -694,7 +694,7 @@ namespace frm
 
         // is it an UNO slot?
         ::rtl::OUString sUnoProtocolPrefix( RTL_CONSTASCII_USTRINGPARAM( ".uno:" ) );
-        if ( 0 == _rURL.Complete.compareTo( sUnoProtocolPrefix, sUnoProtocolPrefix.getLength() ) )
+        if ( _rURL.Complete.startsWith( sUnoProtocolPrefix ) )
         {
             ::rtl::OUString sUnoSlotName = _rURL.Complete.copy( sUnoProtocolPrefix.getLength() );
             SfxSlotId nSlotId = lcl_getSlotFromUnoName( SfxSlotPool::GetSlotPool( NULL ), sUnoSlotName );
diff --git a/framework/source/fwe/xml/saxnamespacefilter.cxx b/framework/source/fwe/xml/saxnamespacefilter.cxx
index 3a9e256..165e537 100644
--- a/framework/source/fwe/xml/saxnamespacefilter.cxx
+++ b/framework/source/fwe/xml/saxnamespacefilter.cxx
@@ -79,7 +79,7 @@ void SAL_CALL SaxNamespaceFilter::startElement(
         for ( sal_Int16 i=0; i< xAttribs->getLength(); i++ )
         {
             OUString aName = xAttribs->getNameByIndex( i );
-            if ( aName.compareTo( m_aXMLAttributeNamespace, m_aXMLAttributeNamespace.getLength() ) == 0 )
+            if ( aName.startsWith( m_aXMLAttributeNamespace ) )
                 aXMLNamespaces.addNamespace( aName, xAttribs->getValueByIndex( i ));
             else
                 aAttributeIndexes.push_back( i );
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index abce091..a41fe51 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -860,7 +860,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
         if (nKeyStart != -1)
             aKeyText = rName.copy( nKeyStart + 1 );
         DBG_ASSERT( !aKeyText.isEmpty(), "unexpected key (lang::Locale) string" );
-        if (0 == rName.compareTo( aSpellCheckerList, aSpellCheckerList.getLength() ))
+        if (rName.startsWith( aSpellCheckerList ))
         {
             // delete old cached data, needs to be acquired new on demand
             clearSvcInfoArray(pAvailSpellSvcs);
@@ -885,7 +885,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
                 pSpellDsp->SetServiceList( LanguageTag(nLang).getLocale(), aSvcImplNames );
             }
         }
-        else if (0 == rName.compareTo( aGrammarCheckerList, aGrammarCheckerList.getLength() ))
+        else if (rName.startsWith( aGrammarCheckerList ))
         {
             // delete old cached data, needs to be acquired new on demand
             clearSvcInfoArray(pAvailGrammarSvcs);
@@ -913,7 +913,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
                 }
             }
         }
-        else if (0 == rName.compareTo( aHyphenatorList, aHyphenatorList.getLength() ))
+        else if (rName.startsWith( aHyphenatorList ))
         {
             // delete old cached data, needs to be acquired new on demand
             clearSvcInfoArray(pAvailHyphSvcs);
@@ -938,7 +938,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
                 pHyphDsp->SetServiceList( LanguageTag(nLang).getLocale(), aSvcImplNames );
             }
         }
-        else if (0 == rName.compareTo( aThesaurusList, aThesaurusList.getLength() ))
+        else if (rName.startsWith( aThesaurusList ))
         {
             // delete old cached data, needs to be acquired new on demand
             clearSvcInfoArray(pAvailThesSvcs);
diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx
index 92da200..007f426 100644
--- a/rsc/source/rsc/rsc.cxx
+++ b/rsc/source/rsc/rsc.cxx
@@ -345,7 +345,7 @@ OString RscCmdLine::substitutePaths( const OString& rIn )
     // search for longest replacement match
     for( std::list< std::pair< OString, OString > >::const_iterator repl = m_aReplacements.begin(); repl != m_aReplacements.end(); ++repl )
     {
-        if( rIn.compareTo( repl->second, repl->second.getLength() ) == 0 ) // path matches
+        if( rIn.startsWith( repl->second ) ) // path matches
         {
             if( last_match == m_aReplacements.end() || last_match->second.getLength() < repl->second.getLength() )
                 last_match = repl;
diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx
index 76e70e9..d3b1268 100644
--- a/svx/source/unodraw/unomod.cxx
+++ b/svx/source/unodraw/unomod.cxx
@@ -172,7 +172,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createInstance(
 {
     const OUString aDrawingPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.") );
 
-    if( rServiceSpecifier.compareTo( aDrawingPrefix, aDrawingPrefix.getLength() ) == 0 )
+    if( rServiceSpecifier.startsWith( aDrawingPrefix ) )
     {
         sal_uInt32 nType = UHashMap::getId( rServiceSpecifier );
         if( nType != UHASHMAP_NOTFOUND )
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index dddeee6..443f376 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1257,7 +1257,7 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
                 // the package URL based graphics are handled in different way currently
                 // TODO/LATER: actually this is the correct place to handle them
                 ::rtl::OUString aGraphicProtocol( RTL_CONSTASCII_USTRINGPARAM( sGraphicObjectProtocol ) );
-                if( aGrfUrl.compareTo( aGraphicProtocol, aGraphicProtocol.getLength() ) == 0 )
+                if( aGrfUrl.startsWith( aGraphicProtocol ) )
                 {
                     rtl::OString sId(rtl::OUStringToOString(
                         aGrfUrl.copy(sizeof(sGraphicObjectProtocol)-1),
diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx
index 8082f5b..dc4a4a4 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -217,7 +217,7 @@ void SAL_CALL UcbPropertiesChangeListener_Impl::propertiesChange ( const Sequenc
             if (evt.NewValue >>= aUrl)
             {
                 ::rtl::OUString aBad (RTL_CONSTASCII_USTRINGPARAM ("private:"));
-                if (!(aUrl.compareTo (aBad, aBad.getLength()) == 0))
+                if (!aUrl.startsWith(aBad))
                 {
                     // URL changed (Redirection).
                     m_xLockBytes->SetRealURL_Impl( aUrl );
diff --git a/xmloff/source/core/nmspmap.cxx b/xmloff/source/core/nmspmap.cxx
index c867818..ebf268c 100644
--- a/xmloff/source/core/nmspmap.cxx
+++ b/xmloff/source/core/nmspmap.cxx
@@ -463,7 +463,7 @@ sal_Bool SvXMLNamespaceMap::NormalizeW3URI( ::rtl::OUString& rName )
 
     sal_Bool bSuccess = sal_False;
     const OUString sURIPrefix = GetXMLToken( XML_URI_W3_PREFIX );
-    if( rName.compareTo( sURIPrefix, sURIPrefix.getLength() ) == 0 )
+    if( rName.startsWith( sURIPrefix ) )
     {
         const OUString sURISuffix = GetXMLToken( XML_URI_XFORMS_SUFFIX );
         sal_Int32 nCompareFrom = rName.getLength() - sURISuffix.getLength();
@@ -508,7 +508,7 @@ sal_Bool SvXMLNamespaceMap::NormalizeOasisURN( ::rtl::OUString& rName )
     sal_Int32 nNameLen = rName.getLength();
     // :urn:oasis:names:tc.*
     const OUString& rOasisURN = GetXMLToken( XML_URN_OASIS_NAMES_TC );
-    if( 0 != rName.compareTo( rOasisURN, rOasisURN.getLength() ) )
+    if( !rName.startsWith( rOasisURN ) )
         return sal_False;
 
     // :urn:oasis:names:tc:.*
@@ -526,7 +526,7 @@ sal_Bool SvXMLNamespaceMap::NormalizeOasisURN( ::rtl::OUString& rName )
     nPos = nTCIdEnd + 1;
     OUString sTmp( rName.copy( nPos ) );
     const OUString& rXMLNS = GetXMLToken( XML_XMLNS );
-    if( 0!= sTmp.compareTo( rXMLNS, rXMLNS.getLength() ) )
+    if( !sTmp.startsWith( rXMLNS ) )
         return sal_False;
 
     // :urn:oasis:names:tc:[^:]:xmlns:.*
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 4ad63cb..c38f45f 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -2670,7 +2670,7 @@ void SdXMLObjectShapeContext::StartElement( const ::com::sun::star::uno::Referen
                 {
                     const OUString  sURL( "vnd.sun.star.EmbeddedObject:" );
 
-                    if ( aPersistName.compareTo( sURL, sURL.getLength() ) == 0 )
+                    if ( aPersistName.startsWith( sURL ) )
                         aPersistName = aPersistName.copy( sURL.getLength() );
 
                     xProps->setPropertyValue( OUString(  "PersistName"  ),


More information about the Libreoffice-commits mailing list