Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2591

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/91/2591/1

simplify compareTo (now correct)

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



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 @@
             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 @@
     // 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 @@
             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 @@
 
         // 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 @@
         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 @@
         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 @@
                 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 @@
                 }
             }
         }
-        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 @@
                 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 @@
     // 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 @@
 {
     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 @@
                 // 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 @@
             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 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_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 @@
     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 @@
                 {
                     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"  ),

-- 
To view, visit https://gerrit.libreoffice.org/2591
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia4fd2f54d0bda71d472f46949500c0b23ff8e1b7
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Thomas Arnhold <thomas@arnhold.org>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.