[PATCH] fdo#62096: Replaced some compareTo with ==

Sameer Deshmukh (via Code Review) gerrit at gerrit.libreoffice.org
Sat Apr 20 11:06:59 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3509

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/09/3509/1

fdo#62096: Replaced some compareTo with ==

Change-Id: I1151dafcef91abdb2ce08abe3547a49fe3f4a67c
---
M sal/inc/rtl/string.hxx
M sal/qa/rtl_strings/rtl_OString.cxx
A wizards/com/sun/star/wizards/table/.#CallTableWizard.java
M writerfilter/source/ooxml/OOXMLStreamImpl.cxx
M xmlhelp/source/cxxhelp/provider/databases.hxx
M xmlhelp/source/cxxhelp/provider/db.hxx
6 files changed, 18 insertions(+), 17 deletions(-)



diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
index e3d5afb..8151262 100644
--- a/sal/inc/rtl/string.hxx
+++ b/sal/inc/rtl/string.hxx
@@ -782,25 +782,25 @@
     template< typename T >
     friend typename internal::CharPtrDetector< T, bool >::Type operator==( const OString& rStr1, const T& value ) SAL_THROW(())
     {
-        return rStr1.compareTo( value ) == 0;
+        return (rStr1 == value);
     }
 
     template< typename T >
     friend typename internal::NonConstCharArrayDetector< T, bool >::Type operator==( const OString& rStr1, T& value ) SAL_THROW(())
     {
-        return rStr1.compareTo( value ) == 0;
+        return (rStr1 == value);
     }
 
     template< typename T >
     friend typename internal::CharPtrDetector< T, bool >::Type operator==( const T& value, const OString& rStr2 ) SAL_THROW(())
     {
-        return rStr2.compareTo( value ) == 0;
+        return (rStr2 == value);
     }
 
     template< typename T >
     friend typename internal::NonConstCharArrayDetector< T, bool >::Type operator==( T& value, const OString& rStr2 ) SAL_THROW(())
     {
-        return rStr2.compareTo( value ) == 0;
+        return (rStr2 == value);
     }
 
     /**
diff --git a/sal/qa/rtl_strings/rtl_OString.cxx b/sal/qa/rtl_strings/rtl_OString.cxx
index 1934f06..293381c 100644
--- a/sal/qa/rtl_strings/rtl_OString.cxx
+++ b/sal/qa/rtl_strings/rtl_OString.cxx
@@ -1929,7 +1929,7 @@
         bRes &= c_rtl_tres_state
                 (
                     hRtlTestResult,
-                    aStr2.compareTo(aStr1) == 0,
+                    aStr2 == aStr1,
                     (sal_Char*)resArray[i],
                     createName( pMeth, "valueOf", i )
                 );
@@ -2163,7 +2163,7 @@
     bRes = c_rtl_tres_state
             (
                 hRtlTestResult,
-                aStr2.compareTo( aStr1 ) == 0,
+                aStr2 ==  aStr1,
                 "if radix not valid then radix must be 10",
                 "valueOf(sal_Int32, sal_Int32 radix): radix = -5"
             );
@@ -2411,7 +2411,7 @@
     bRes = c_rtl_tres_state
             (
                 hRtlTestResult,
-                aStr2.compareTo(aStr1) == 0,
+                aStr2 == aStr1,
                 "if radix not valid then radix must be 10",
                 "valueOf(sal_Int64, sal_Int32 radix): radix = -5"
             );
diff --git "a/wizards/com/sun/star/wizards/table/.\043CallTableWizard.java" "b/wizards/com/sun/star/wizards/table/.\043CallTableWizard.java"
new file mode 120000
index 0000000..d41e7eb07
--- /dev/null
+++ "b/wizards/com/sun/star/wizards/table/.\043CallTableWizard.java"
@@ -0,0 +1 @@
+sameer at sameer-HP-630-NoteBook-PC.23744:1366461591
\ No newline at end of file
diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
index 96f37bd..3305e7c 100644
--- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx
@@ -169,16 +169,16 @@
             {
                 beans::StringPair aPair = aSeq[i];
 
-                if (aPair.First.compareTo(sType) == 0 &&
-                    aPair.Second.compareTo(sStreamType) == 0)
+                if (aPair.First == sType &&
+                    aPair.Second == sStreamType)
                     bFound = true;
-                else if (aPair.First.compareTo(sId) == 0 &&
-                         aPair.Second.compareTo(rId) == 0)
+                else if (aPair.First == sId &&
+                         aPair.Second == rId)
                     bFound = true;
-                else if (aPair.First.compareTo(sTarget) == 0)
+                else if (aPair.First == sTarget)
                     sMyTarget = aPair.Second;
-                else if (aPair.First.compareTo(sTargetMode) == 0 &&
-                         aPair.Second.compareTo(sExternal) == 0)
+                else if (aPair.First == sTargetMode &&
+                         aPair.Second == sExternal)
                     bExternalTarget = true;
 
             }
diff --git a/xmlhelp/source/cxxhelp/provider/databases.hxx b/xmlhelp/source/cxxhelp/provider/databases.hxx
index 905c86c..8585700 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.hxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.hxx
@@ -156,7 +156,7 @@
         {
             bool operator()( const OUString& rKey1, const OUString& rKey2 ) const
             {
-                return rKey1.compareTo( rKey2 ) == 0;
+                return (rKey1 == rKey2);
             }
         };
 
@@ -351,7 +351,7 @@
         {
             bool operator()( const OString& rKey1, const OString& rKey2 ) const
             {
-                return rKey1.compareTo( rKey2 ) == 0;
+                return (rKey1 == rKey2);
             }
         };
 
diff --git a/xmlhelp/source/cxxhelp/provider/db.hxx b/xmlhelp/source/cxxhelp/provider/db.hxx
index d00fbab..5174536 100644
--- a/xmlhelp/source/cxxhelp/provider/db.hxx
+++ b/xmlhelp/source/cxxhelp/provider/db.hxx
@@ -68,7 +68,7 @@
     struct eq
     {
         bool operator()( const OString& rKey1, const OString& rKey2 ) const
-            { return rKey1.compareTo( rKey2 ) == 0; }
+        { return (rKey1 == rKey2);}
     };
 
     struct ha

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1151dafcef91abdb2ce08abe3547a49fe3f4a67c
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Sameer Deshmukh <sameer.deshmukh93 at gmail.com>



More information about the LibreOffice mailing list