[PATCH] Replace `compareTo(...) == 0` with ==
Ashish Banerjee (via Code Review)
gerrit at gerrit.libreoffice.org
Wed Apr 3 19:14:27 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3198
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/98/3198/1
Replace `compareTo(...) == 0` with ==
Change-Id: Ib83a9051ea12c53642f781e5427a6ca728049a7f
---
M comphelper/inc/comphelper/property.hxx
M comphelper/source/misc/ihwrapnofilter.cxx
M comphelper/source/misc/instancelocker.cxx
M dbaccess/source/ui/dlg/CollectionView.cxx
M desktop/source/deployment/manager/dp_informationprovider.cxx
M dtrans/source/cnttype/mcnttfactory.cxx
M dtrans/source/generic/clipboardmanager.cxx
M dtrans/source/generic/generic_clipboard.cxx
M dtrans/source/win32/clipb/WinClipboard.cxx
M dtrans/source/win32/ftransl/ftransl.cxx
M embeddedobj/source/commonembedding/xfactory.cxx
M embeddedobj/source/general/xcreator.cxx
M embeddedobj/source/msole/xdialogcreator.cxx
M embeddedobj/source/msole/xolefactory.cxx
M embeddedobj/test/MainThreadExecutor/xexecutor.cxx
M embeddedobj/test/mtexecutor/bitmapcreator.cxx
M embeddedobj/test/mtexecutor/mainthreadexecutor.cxx
M forms/source/component/Edit.cxx
M fpicker/source/aqua/SalAquaFilePicker.mm
M fpicker/source/aqua/SalAquaFolderPicker.mm
M fpicker/source/win32/filepicker/FilePicker.cxx
M fpicker/source/win32/filepicker/VistaFilePicker.cxx
M fpicker/source/win32/folderpicker/FolderPicker.cxx
23 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/comphelper/inc/comphelper/property.hxx b/comphelper/inc/comphelper/property.hxx
index d8e0d3b..29ff7b2 100644
--- a/comphelper/inc/comphelper/property.hxx
+++ b/comphelper/inc/comphelper/property.hxx
@@ -60,12 +60,12 @@
// ................................................................
inline bool operator()( const ::com::sun::star::beans::Property& lhs, const ::rtl::OUString& rhs ) const
{
- return lhs.Name.compareTo(rhs) == 0;
+ return lhs.Name == rhs ;
}
// ................................................................
inline bool operator()( const ::rtl::OUString& lhs, const ::com::sun::star::beans::Property& rhs ) const
{
- return lhs.compareTo(rhs.Name) == 0;
+ return lhs == rhs.Name ;
}
};
//--------------------------------------------------------------------------
@@ -74,7 +74,7 @@
{
bool operator() (const ::com::sun::star::beans::Property& x, const ::com::sun::star::beans::Property& y) const
{
- return x.Name.compareTo(y.Name) == 0;
+ return x.Name == y.Name ;
}
};
diff --git a/comphelper/source/misc/ihwrapnofilter.cxx b/comphelper/source/misc/ihwrapnofilter.cxx
index 150da2b..c6b6697 100644
--- a/comphelper/source/misc/ihwrapnofilter.cxx
+++ b/comphelper/source/misc/ihwrapnofilter.cxx
@@ -114,7 +114,7 @@
uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
+ if ( ServiceName == aSeq[nInd] )
return sal_True;
return sal_False;
diff --git a/comphelper/source/misc/instancelocker.cxx b/comphelper/source/misc/instancelocker.cxx
index 50ca694..a42852f 100644
--- a/comphelper/source/misc/instancelocker.cxx
+++ b/comphelper/source/misc/instancelocker.cxx
@@ -203,7 +203,7 @@
uno::Sequence< ::rtl::OUString > aSeq = getSupportedServiceNames();
for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
+ if ( ServiceName == aSeq[nInd] )
return sal_True;
return sal_False;
diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx
index 40516da..202c54f 100644
--- a/dbaccess/source/ui/dlg/CollectionView.cxx
+++ b/dbaccess/source/ui/dlg/CollectionView.cxx
@@ -287,7 +287,7 @@
const ::rtl::OUString sCID = m_xContent->getIdentifier()->getContentIdentifier();
const static ::rtl::OUString s_sFormsCID("private:forms");
const static ::rtl::OUString s_sReportsCID("private:reports");
- m_bCreateForm = s_sFormsCID.compareTo(sCID) == 0;
+ m_bCreateForm = s_sFormsCID == sCID ;
::rtl::OUString sPath("/");
if ( m_bCreateForm && sCID.getLength() != s_sFormsCID.getLength())
sPath = sCID.copy(s_sFormsCID.getLength());
diff --git a/desktop/source/deployment/manager/dp_informationprovider.cxx b/desktop/source/deployment/manager/dp_informationprovider.cxx
index 90c75ee..33fa074 100644
--- a/desktop/source/deployment/manager/dp_informationprovider.cxx
+++ b/desktop/source/deployment/manager/dp_informationprovider.cxx
@@ -121,7 +121,7 @@
try
{
const beans::Optional< rtl::OUString > aID = packages[ pos ]->getIdentifier();
- if ( aID.IsPresent && aID.Value.compareTo( _rExtensionId ) == 0 )
+ if ( aID.IsPresent && (aID.Value == _rExtensionId ) )
{
aLocationURL = packages[ pos ]->getURL();
break;
diff --git a/dtrans/source/cnttype/mcnttfactory.cxx b/dtrans/source/cnttype/mcnttfactory.cxx
index 86eb617..ec43fcd 100644
--- a/dtrans/source/cnttype/mcnttfactory.cxx
+++ b/dtrans/source/cnttype/mcnttfactory.cxx
@@ -87,7 +87,7 @@
Sequence < OUString > SupportedServicesNames = MimeContentTypeFactory_getSupportedServiceNames();
for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
- if (SupportedServicesNames[n].compareTo(ServiceName) == 0)
+ if ( SupportedServicesNames[n] == ServiceName )
return sal_True;
return sal_False;
diff --git a/dtrans/source/generic/clipboardmanager.cxx b/dtrans/source/generic/clipboardmanager.cxx
index be78cdf..7793826 100644
--- a/dtrans/source/generic/clipboardmanager.cxx
+++ b/dtrans/source/generic/clipboardmanager.cxx
@@ -62,7 +62,7 @@
Sequence < OUString > SupportedServicesNames = ClipboardManager_getSupportedServiceNames();
for ( sal_Int32 n = 0, nmax = SupportedServicesNames.getLength(); n < nmax; n++ )
- if (SupportedServicesNames[n].compareTo(ServiceName) == 0)
+ if ( SupportedServicesNames[n] == ServiceName )
return sal_True;
return sal_False;
@@ -111,7 +111,7 @@
// the name "default" is reserved for internal use
OUString aName = xClipboard->getName();
- if (m_aDefaultName.compareTo(aName) == 0)
+ if ( m_aDefaultName == aName )
throw IllegalArgumentException(OUString("name reserved"),
static_cast < XClipboardManager * > (this), 1);
diff --git a/dtrans/source/generic/generic_clipboard.cxx b/dtrans/source/generic/generic_clipboard.cxx
index 4da2b1b..8862163 100644
--- a/dtrans/source/generic/generic_clipboard.cxx
+++ b/dtrans/source/generic/generic_clipboard.cxx
@@ -75,7 +75,7 @@
Sequence < OUString > SupportedServicesNames = GenericClipboard_getSupportedServiceNames();
for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
- if (SupportedServicesNames[n].compareTo(ServiceName) == 0)
+ if ( SupportedServicesNames[n] == ServiceName )
return sal_True;
return sal_False;
diff --git a/dtrans/source/win32/clipb/WinClipboard.cxx b/dtrans/source/win32/clipb/WinClipboard.cxx
index 7bf9687..80ef257 100644
--- a/dtrans/source/win32/clipb/WinClipboard.cxx
+++ b/dtrans/source/win32/clipb/WinClipboard.cxx
@@ -288,7 +288,7 @@
Sequence < OUString > SupportedServicesNames = WinClipboard_getSupportedServiceNames();
for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
- if (SupportedServicesNames[n].compareTo(ServiceName) == 0)
+ if ( SupportedServicesNames[n] == ServiceName )
return sal_True;
return sal_False;
diff --git a/dtrans/source/win32/ftransl/ftransl.cxx b/dtrans/source/win32/ftransl/ftransl.cxx
index 53611cb..1f141f2 100644
--- a/dtrans/source/win32/ftransl/ftransl.cxx
+++ b/dtrans/source/win32/ftransl/ftransl.cxx
@@ -225,7 +225,7 @@
Sequence < OUString > SupportedServicesNames = DataFormatTranslator_getSupportedServiceNames();
for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
- if (SupportedServicesNames[n].compareTo(ServiceName) == 0)
+ if ( SupportedServicesNames[n] == ServiceName )
return sal_True;
return sal_False;
diff --git a/embeddedobj/source/commonembedding/xfactory.cxx b/embeddedobj/source/commonembedding/xfactory.cxx
index ba5af4a..404635e 100644
--- a/embeddedobj/source/commonembedding/xfactory.cxx
+++ b/embeddedobj/source/commonembedding/xfactory.cxx
@@ -462,7 +462,7 @@
uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
+ if ( ServiceName == aSeq[nInd] )
return sal_True;
return sal_False;
@@ -537,7 +537,7 @@
uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
+ if ( ServiceName == aSeq[nInd] )
return sal_True;
return sal_False;
diff --git a/embeddedobj/source/general/xcreator.cxx b/embeddedobj/source/general/xcreator.cxx
index 24f5bbd..c3ac025 100644
--- a/embeddedobj/source/general/xcreator.cxx
+++ b/embeddedobj/source/general/xcreator.cxx
@@ -453,7 +453,7 @@
uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
+ if ( ServiceName == aSeq[nInd] )
return sal_True;
return sal_False;
diff --git a/embeddedobj/source/msole/xdialogcreator.cxx b/embeddedobj/source/msole/xdialogcreator.cxx
index ea7947a..b4e5d50 100644
--- a/embeddedobj/source/msole/xdialogcreator.cxx
+++ b/embeddedobj/source/msole/xdialogcreator.cxx
@@ -346,7 +346,7 @@
uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
+ if ( ServiceName == aSeq[nInd] )
return sal_True;
return sal_False;
diff --git a/embeddedobj/source/msole/xolefactory.cxx b/embeddedobj/source/msole/xolefactory.cxx
index 5580925..f5fdff4 100644
--- a/embeddedobj/source/msole/xolefactory.cxx
+++ b/embeddedobj/source/msole/xolefactory.cxx
@@ -317,7 +317,7 @@
uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
+ if ( ServiceName == aSeq[nInd] )
return sal_True;
return sal_False;
diff --git a/embeddedobj/test/MainThreadExecutor/xexecutor.cxx b/embeddedobj/test/MainThreadExecutor/xexecutor.cxx
index f5cb25e..e35feb8 100644
--- a/embeddedobj/test/MainThreadExecutor/xexecutor.cxx
+++ b/embeddedobj/test/MainThreadExecutor/xexecutor.cxx
@@ -116,7 +116,7 @@
uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
+ if ( ServiceName == aSeq[nInd] )
return sal_True;
return sal_False;
diff --git a/embeddedobj/test/mtexecutor/bitmapcreator.cxx b/embeddedobj/test/mtexecutor/bitmapcreator.cxx
index fdc86df..5937410 100644
--- a/embeddedobj/test/mtexecutor/bitmapcreator.cxx
+++ b/embeddedobj/test/mtexecutor/bitmapcreator.cxx
@@ -97,7 +97,7 @@
uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
+ if ( ServiceName == aSeq[nInd] )
return sal_True;
return sal_False;
diff --git a/embeddedobj/test/mtexecutor/mainthreadexecutor.cxx b/embeddedobj/test/mtexecutor/mainthreadexecutor.cxx
index 828abef..084efe6 100644
--- a/embeddedobj/test/mtexecutor/mainthreadexecutor.cxx
+++ b/embeddedobj/test/mtexecutor/mainthreadexecutor.cxx
@@ -98,7 +98,7 @@
uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
+ if ( ServiceName == aSeq[nInd] )
return sal_True;
return sal_False;
diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx
index b6e43b5..81b816c 100644
--- a/forms/source/component/Edit.cxx
+++ b/forms/source/component/Edit.cxx
@@ -584,7 +584,7 @@
{
Any aDefaultControl = m_xAggregateSet->getPropertyValue(PROPERTY_DEFAULTCONTROL);
if ( (aDefaultControl.getValueType().getTypeClass() == TypeClass_STRING)
- && (getString(aDefaultControl).compareTo(STARDIV_ONE_FORM_CONTROL_TEXTFIELD) == COMPARE_EQUAL)
+ && (getString(aDefaultControl) == STARDIV_ONE_FORM_CONTROL_TEXTFIELD )
)
{
m_xAggregateSet->setPropertyValue( PROPERTY_DEFAULTCONTROL, makeAny( (::rtl::OUString)STARDIV_ONE_FORM_CONTROL_EDIT ) );
diff --git a/fpicker/source/aqua/SalAquaFilePicker.mm b/fpicker/source/aqua/SalAquaFilePicker.mm
index d1a399f..e64c422 100644
--- a/fpicker/source/aqua/SalAquaFilePicker.mm
+++ b/fpicker/source/aqua/SalAquaFilePicker.mm
@@ -629,7 +629,7 @@
uno::Sequence <rtl::OUString> supportedServicesNames = FilePicker_getSupportedServiceNames();
for( sal_Int32 n = supportedServicesNames.getLength(); n--; ) {
- if( supportedServicesNames[n].compareTo( sServiceName ) == 0) {
+ if( supportedServicesNames[n] == sServiceName ) {
retVal = sal_True;
break;
}
diff --git a/fpicker/source/aqua/SalAquaFolderPicker.mm b/fpicker/source/aqua/SalAquaFolderPicker.mm
index 8d06b7f..766f460 100644
--- a/fpicker/source/aqua/SalAquaFolderPicker.mm
+++ b/fpicker/source/aqua/SalAquaFolderPicker.mm
@@ -226,7 +226,7 @@
uno::Sequence <rtl::OUString> supportedServicesNames = FolderPicker_getSupportedServiceNames();
for( sal_Int32 n = supportedServicesNames.getLength(); n--; ) {
- if( supportedServicesNames[n].compareTo( sServiceName ) == 0) {
+ if( supportedServicesNames[n] == sServiceName ) {
retVal = sal_True;
break;
}
diff --git a/fpicker/source/win32/filepicker/FilePicker.cxx b/fpicker/source/win32/filepicker/FilePicker.cxx
index de1f84a..e851409 100644
--- a/fpicker/source/win32/filepicker/FilePicker.cxx
+++ b/fpicker/source/win32/filepicker/FilePicker.cxx
@@ -723,7 +723,7 @@
uno::Sequence <rtl::OUString> SupportedServicesNames = FilePicker_getSupportedServiceNames();
for (sal_Int32 n = SupportedServicesNames.getLength(); n--;)
- if (SupportedServicesNames[n].compareTo(ServiceName) == 0)
+ if (SupportedServicesNames[n] == ServiceName)
return sal_True;
return sal_False;
diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
index 3cb4e3a..ce51655 100644
--- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
@@ -619,7 +619,7 @@
css::uno::Sequence< ::rtl::OUString > lSupportedServicesNames = VistaFilePicker_getSupportedServiceNames();
for (sal_Int32 n = lSupportedServicesNames.getLength(); n--;)
- if (lSupportedServicesNames[n].compareTo(sServiceName) == 0)
+ if (lSupportedServicesNames[n] == sServiceName)
return sal_True;
return sal_False;
diff --git a/fpicker/source/win32/folderpicker/FolderPicker.cxx b/fpicker/source/win32/folderpicker/FolderPicker.cxx
index de5f714..2b889e3 100644
--- a/fpicker/source/win32/folderpicker/FolderPicker.cxx
+++ b/fpicker/source/win32/folderpicker/FolderPicker.cxx
@@ -160,7 +160,7 @@
Sequence < OUString > SupportedServicesNames = FolderPicker_getSupportedServiceNames();
for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
- if (SupportedServicesNames[n].compareTo(ServiceName) == 0)
+ if ( SupportedServicesNames[n] == ServiceName )
return sal_True;
return sal_False;
--
To view, visit https://gerrit.libreoffice.org/3198
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib83a9051ea12c53642f781e5427a6ca728049a7f
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Ashish Banerjee <ashish.banerjee10 at gmail.com>
More information about the LibreOffice
mailing list