From e1f6dac6893e0ad9e1b1f03a3b882cf1e9a08d32 Mon Sep 17 00:00:00 2001 From: Ashish Banerjee Date: Wed, 3 Apr 2013 20:11:54 -0600 Subject: Replace `compareTo(...) == 0` with == MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Proposed patch for the following issue: https://bugs.freedesktop.org/show_bug.cgi?id=62096 Change-Id: Ib83a9051ea12c53642f781e5427a6ca728049a7f Reviewed-on: https://gerrit.libreoffice.org/3198 Reviewed-by: Thomas Arnhold Reviewed-by: Luboš Luňák Tested-by: Miklos Vajna --- comphelper/inc/comphelper/property.hxx | 6 +++--- comphelper/source/misc/ihwrapnofilter.cxx | 2 +- comphelper/source/misc/instancelocker.cxx | 2 +- dbaccess/source/ui/dlg/CollectionView.cxx | 2 +- desktop/source/deployment/manager/dp_informationprovider.cxx | 2 +- dtrans/source/cnttype/mcnttfactory.cxx | 2 +- dtrans/source/generic/clipboardmanager.cxx | 4 ++-- dtrans/source/generic/generic_clipboard.cxx | 2 +- dtrans/source/win32/clipb/WinClipboard.cxx | 2 +- dtrans/source/win32/ftransl/ftransl.cxx | 2 +- embeddedobj/source/commonembedding/xfactory.cxx | 4 ++-- embeddedobj/source/general/xcreator.cxx | 2 +- embeddedobj/source/msole/xdialogcreator.cxx | 2 +- embeddedobj/source/msole/xolefactory.cxx | 2 +- embeddedobj/test/MainThreadExecutor/xexecutor.cxx | 2 +- embeddedobj/test/mtexecutor/bitmapcreator.cxx | 2 +- embeddedobj/test/mtexecutor/mainthreadexecutor.cxx | 2 +- forms/source/component/Edit.cxx | 2 +- fpicker/source/aqua/SalAquaFilePicker.mm | 2 +- fpicker/source/aqua/SalAquaFolderPicker.mm | 2 +- fpicker/source/win32/filepicker/FilePicker.cxx | 2 +- fpicker/source/win32/filepicker/VistaFilePicker.cxx | 2 +- fpicker/source/win32/folderpicker/FolderPicker.cxx | 2 +- 23 files changed, 27 insertions(+), 27 deletions(-) diff --git a/comphelper/inc/comphelper/property.hxx b/comphelper/inc/comphelper/property.hxx index d8e0d3b802f2..29ff7b2b9eca 100644 --- a/comphelper/inc/comphelper/property.hxx +++ b/comphelper/inc/comphelper/property.hxx @@ -60,12 +60,12 @@ namespace comphelper // ................................................................ 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 @@ namespace comphelper { 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 150da2b19329..c6b6697eeb47 100644 --- a/comphelper/source/misc/ihwrapnofilter.cxx +++ b/comphelper/source/misc/ihwrapnofilter.cxx @@ -114,7 +114,7 @@ namespace comphelper 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 50ca694de727..a42852fa2b0c 100644 --- a/comphelper/source/misc/instancelocker.cxx +++ b/comphelper/source/misc/instancelocker.cxx @@ -203,7 +203,7 @@ void SAL_CALL OInstanceLocker::initialize( const uno::Sequence< uno::Any >& aArg 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 40516da304c1..202c54f9c991 100644 --- a/dbaccess/source/ui/dlg/CollectionView.cxx +++ b/dbaccess/source/ui/dlg/CollectionView.cxx @@ -287,7 +287,7 @@ void OCollectionView::initCurrentPath() 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 90c75ee092b0..33fa0748f37c 100644 --- a/desktop/source/deployment/manager/dp_informationprovider.cxx +++ b/desktop/source/deployment/manager/dp_informationprovider.cxx @@ -121,7 +121,7 @@ rtl::OUString PackageInformationProvider::getPackageLocation( 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 86eb6179a3dd..ec43fcdbc5d6 100644 --- a/dtrans/source/cnttype/mcnttfactory.cxx +++ b/dtrans/source/cnttype/mcnttfactory.cxx @@ -87,7 +87,7 @@ sal_Bool SAL_CALL CMimeContentTypeFactory::supportsService( const OUString& Serv 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 be78cdf03b9b..7793826bb0bc 100644 --- a/dtrans/source/generic/clipboardmanager.cxx +++ b/dtrans/source/generic/clipboardmanager.cxx @@ -62,7 +62,7 @@ sal_Bool SAL_CALL ClipboardManager::supportsService( const OUString& ServiceName 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 @@ void SAL_CALL ClipboardManager::addClipboard( const Reference< XClipboard >& xCl // 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 4da2b1bfa07e..88621630ccc2 100644 --- a/dtrans/source/generic/generic_clipboard.cxx +++ b/dtrans/source/generic/generic_clipboard.cxx @@ -75,7 +75,7 @@ sal_Bool SAL_CALL GenericClipboard::supportsService( const OUString& ServiceName 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 7bf96872e34e..80ef257f489c 100644 --- a/dtrans/source/win32/clipb/WinClipboard.cxx +++ b/dtrans/source/win32/clipb/WinClipboard.cxx @@ -288,7 +288,7 @@ sal_Bool SAL_CALL CWinClipboard::supportsService( const OUString& ServiceName ) 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 53611cba47d4..1f141f2faf56 100644 --- a/dtrans/source/win32/ftransl/ftransl.cxx +++ b/dtrans/source/win32/ftransl/ftransl.cxx @@ -225,7 +225,7 @@ sal_Bool SAL_CALL CDataFormatTranslator::supportsService( const OUString& Servic 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 ba5af4a6ab69..404635e73a79 100644 --- a/embeddedobj/source/commonembedding/xfactory.cxx +++ b/embeddedobj/source/commonembedding/xfactory.cxx @@ -462,7 +462,7 @@ sal_Bool SAL_CALL OOoEmbeddedObjectFactory::supportsService( const ::rtl::OUStri 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 @@ sal_Bool SAL_CALL OOoSpecialEmbeddedObjectFactory::supportsService( const ::rtl: 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 24f5bbd4c983..c3ac0250c74c 100644 --- a/embeddedobj/source/general/xcreator.cxx +++ b/embeddedobj/source/general/xcreator.cxx @@ -453,7 +453,7 @@ sal_Bool SAL_CALL UNOEmbeddedObjectCreator::supportsService( const ::rtl::OUStri 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 ea7947a58a49..b4e5d509afb6 100644 --- a/embeddedobj/source/msole/xdialogcreator.cxx +++ b/embeddedobj/source/msole/xdialogcreator.cxx @@ -346,7 +346,7 @@ sal_Bool SAL_CALL MSOLEDialogObjectCreator::supportsService( const ::rtl::OUStri 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 558092573d71..f5fdff4eedd1 100644 --- a/embeddedobj/source/msole/xolefactory.cxx +++ b/embeddedobj/source/msole/xolefactory.cxx @@ -317,7 +317,7 @@ sal_Bool SAL_CALL OleEmbeddedObjectFactory::supportsService( const ::rtl::OUStri 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 f5cb25e20146..e35feb8cd3ac 100644 --- a/embeddedobj/test/MainThreadExecutor/xexecutor.cxx +++ b/embeddedobj/test/MainThreadExecutor/xexecutor.cxx @@ -116,7 +116,7 @@ sal_Bool SAL_CALL UNOMainThreadExecutor::supportsService( const ::rtl::OUString& 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 fdc86df45e9e..593741078374 100644 --- a/embeddedobj/test/mtexecutor/bitmapcreator.cxx +++ b/embeddedobj/test/mtexecutor/bitmapcreator.cxx @@ -97,7 +97,7 @@ sal_Bool SAL_CALL VCLBitmapCreator::supportsService( const ::rtl::OUString& Serv 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 828abef803be..084efe6c5f21 100644 --- a/embeddedobj/test/mtexecutor/mainthreadexecutor.cxx +++ b/embeddedobj/test/mtexecutor/mainthreadexecutor.cxx @@ -98,7 +98,7 @@ sal_Bool SAL_CALL MainThreadExecutor::supportsService( const ::rtl::OUString& Se 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 b6e43b54b4c0..81b816c55427 100644 --- a/forms/source/component/Edit.cxx +++ b/forms/source/component/Edit.cxx @@ -584,7 +584,7 @@ void OEditModel::read(const Reference& _rxInStream) throw ( { 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 d1a399f84415..e64c4225c5ba 100644 --- a/fpicker/source/aqua/SalAquaFilePicker.mm +++ b/fpicker/source/aqua/SalAquaFilePicker.mm @@ -629,7 +629,7 @@ throw( uno::RuntimeException ) uno::Sequence 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 8d06b7fb2e80..766f46026ba7 100644 --- a/fpicker/source/aqua/SalAquaFolderPicker.mm +++ b/fpicker/source/aqua/SalAquaFolderPicker.mm @@ -226,7 +226,7 @@ sal_Bool SAL_CALL SalAquaFolderPicker::supportsService( const rtl::OUString& sSe uno::Sequence 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 de1f84a156ed..e8514093cb1f 100644 --- a/fpicker/source/win32/filepicker/FilePicker.cxx +++ b/fpicker/source/win32/filepicker/FilePicker.cxx @@ -723,7 +723,7 @@ sal_Bool SAL_CALL CFilePicker::supportsService(const rtl::OUString& ServiceName) uno::Sequence 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 3cb4e3a585e5..ce5165594641 100644 --- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx +++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx @@ -619,7 +619,7 @@ sal_Bool SAL_CALL VistaFilePicker::supportsService(const ::rtl::OUString& sServi 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 de5f714a0fc3..2b889e39a552 100644 --- a/fpicker/source/win32/folderpicker/FolderPicker.cxx +++ b/fpicker/source/win32/folderpicker/FolderPicker.cxx @@ -160,7 +160,7 @@ sal_Bool SAL_CALL CFolderPicker::supportsService( const OUString& ServiceName ) 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; -- cgit v1.2.3