diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-06-10 11:41:08 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-06-10 11:41:08 +0200 |
commit | dd90d9b6d7149c68f931805beaa7dbeee8074d3f (patch) | |
tree | b3d232d286fb77b513422bd78163990d5c133390 /framework | |
parent | ed9d32908dca5740109f0d9f3233721aa3a49775 (diff) |
-Werror,-Wtautological-undefined-compare
Change-Id: Ibd738b91d35a1b82e1e7b078ef73c6f6076dc08a
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/helper/ocomponentenumeration.hxx | 8 | ||||
-rw-r--r-- | framework/source/dispatch/menudispatcher.cxx | 59 | ||||
-rw-r--r-- | framework/source/helper/ocomponentenumeration.cxx | 41 | ||||
-rw-r--r-- | framework/source/services/urltransformer.cxx | 13 |
4 files changed, 8 insertions, 113 deletions
diff --git a/framework/inc/helper/ocomponentenumeration.hxx b/framework/inc/helper/ocomponentenumeration.hxx index 6c4b0a47b1db..8dfff638566e 100644 --- a/framework/inc/helper/ocomponentenumeration.hxx +++ b/framework/inc/helper/ocomponentenumeration.hxx @@ -161,14 +161,6 @@ class OComponentEnumeration : public ::cppu::WeakImplHelper2< ::com::sun::star private: - static bool impldbg_checkParameter_OComponentEnumerationCtor ( const css::uno::Sequence< css::uno::Reference< css::lang::XComponent > >& seqComponents ); - static bool impldbg_checkParameter_disposing ( const css::lang::EventObject& aEvent ); - - // variables - // (should be private everyway!) - - private: - sal_uInt32 m_nPosition; /// current position in enumeration css::uno::Sequence< css::uno::Reference< css::lang::XComponent > > m_seqComponents; /// list of current components diff --git a/framework/source/dispatch/menudispatcher.cxx b/framework/source/dispatch/menudispatcher.cxx index f4206e4ece80..3305dc90f48f 100644 --- a/framework/source/dispatch/menudispatcher.cxx +++ b/framework/source/dispatch/menudispatcher.cxx @@ -58,13 +58,6 @@ using namespace ::cppu; const sal_uInt16 SLOTID_MDIWINDOWLIST = 5610; -static bool impldbg_checkParameter_MenuDispatcher ( const css::uno::Reference< css::uno::XComponentContext >& xContext , - const css::uno::Reference< css::frame::XFrame >& xOwner ); -static bool impldbg_checkParameter_addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xControl , - const css::util::URL& aURL ); -static bool impldbg_checkParameter_removeStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xControl , - const css::util::URL& aURL ); - // constructor MenuDispatcher::MenuDispatcher( const uno::Reference< XComponentContext >& xContext , @@ -78,7 +71,7 @@ MenuDispatcher::MenuDispatcher( const uno::Reference< XComponentContext >& { // Safe impossible cases // We need valid information about our owner for work. - SAL_WARN_IF( !impldbg_checkParameter_MenuDispatcher( xContext, xOwner ), "fwk", "MenuDispatcher::MenuDispatcher()\nInvalid parameter detected!" ); + SAL_WARN_IF( !( xContext.is() && xOwner.is() ), "fwk", "MenuDispatcher::MenuDispatcher()\nInvalid parameter detected!" ); m_bActivateListener = true; xOwner->addFrameActionListener( uno::Reference< XFrameActionListener >( (OWeakObject *)this, UNO_QUERY )); @@ -108,7 +101,7 @@ void SAL_CALL MenuDispatcher::addStatusListener( const uno::Reference< XStat SolarMutexGuard g; // Safe impossible cases // Method not defined for all incoming parameter - SAL_WARN_IF( !impldbg_checkParameter_addStatusListener( xControl, aURL ), "fwk", "MenuDispatcher::addStatusListener(): Invalid parameter detected." ); + SAL_WARN_IF( !xControl.is() || aURL.Complete.isEmpty(), "fwk", "MenuDispatcher::addStatusListener(): Invalid parameter detected." ); // Add listener to container. m_aListenerContainer.addInterface( aURL.Complete, xControl ); } @@ -121,7 +114,7 @@ void SAL_CALL MenuDispatcher::removeStatusListener( const uno::Reference< X SolarMutexGuard g; // Safe impossible cases // Method not defined for all incoming parameter - SAL_WARN_IF( !impldbg_checkParameter_removeStatusListener( xControl, aURL ), "fwk", "MenuDispatcher::removeStatusListener(): Invalid parameter detected." ); + SAL_WARN_IF( !xControl.is() || aURL.Complete.isEmpty(), "fwk", "MenuDispatcher::removeStatusListener(): Invalid parameter detected." ); // Add listener to container. m_aListenerContainer.removeInterface( aURL.Complete, xControl ); } @@ -287,52 +280,6 @@ bool MenuDispatcher::impl_setMenuBar( MenuBar* pMenuBar, bool bMenuFromResource return false; } -static bool impldbg_checkParameter_MenuDispatcher( const uno::Reference< XComponentContext >& xContext , - const uno::Reference< XFrame >& xOwner ) -{ - return xContext.is() && xOwner.is(); -} - -// We need a valid URL. What is meaning with "register for nothing"?! -// xControl must correct to - nobody can advised otherwise! -static bool impldbg_checkParameter_addStatusListener( const uno::Reference< XStatusListener >& xControl, - const URL& aURL ) -{ - // Set default return value. - bool bOK = true; - // Check parameter. - if ( - ( &xControl == NULL ) || - ( &aURL == NULL ) || - ( aURL.Complete.isEmpty() ) - ) - { - bOK = false; - } - // Return result of check. - return bOK; -} - -// The same goes for these case! We have added valid listener for correct URL only. -// We can't remove invalid listener for nothing! -static bool impldbg_checkParameter_removeStatusListener( const uno::Reference< XStatusListener >& xControl, - const URL& aURL ) -{ - // Set default return value. - bool bOK = true; - // Check parameter. - if ( - ( &xControl == NULL ) || - ( &aURL == NULL ) || - ( aURL.Complete.isEmpty() ) - ) - { - bOK = false; - } - // Return result of check. - return bOK; -} - } // namespace framework /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/helper/ocomponentenumeration.cxx b/framework/source/helper/ocomponentenumeration.cxx index 6aa602d219e0..bfcdd43d992f 100644 --- a/framework/source/helper/ocomponentenumeration.cxx +++ b/framework/source/helper/ocomponentenumeration.cxx @@ -35,11 +35,7 @@ using namespace ::rtl; OComponentEnumeration::OComponentEnumeration( const Sequence< css::uno::Reference< XComponent > >& seqComponents ) : m_nPosition ( 0 ) // 0 is the first position for a valid list and the right value for an invalid list to! , m_seqComponents ( seqComponents ) -{ - // Safe impossible states - // "Method" not defined for ALL parameters! - SAL_WARN_IF( !impldbg_checkParameter_OComponentEnumerationCtor( seqComponents ), "fwk", "OComponentEnumeration::OComponentEnumeration(): Invalid parameter detected!" ); -} +{} // destructor @@ -57,7 +53,7 @@ void SAL_CALL OComponentEnumeration::disposing( const EventObject& aEvent ) thro // Safe impossible cases // This method is not specified for all incoming parameters. (void) aEvent; - SAL_WARN_IF( !impldbg_checkParameter_disposing( aEvent ), "fwk", "OComponentEnumeration::disposing(): Invalid parameter detected!" ); + SAL_WARN_IF( !aEvent.Source.is(), "fwk", "OComponentEnumeration::disposing(): Invalid parameter detected!" ); // Reset instance to defaults, release references and free memory. impl_resetObject(); @@ -119,39 +115,6 @@ void OComponentEnumeration::impl_resetObject() m_nPosition = 0; } -// debug methods - -/*----------------------------------------------------------------------------------------------------------------- - The follow methods checks the parameter for other functions. If a parameter or his value is non valid, - we return "sal_False". (else sal_True) This mechanism is used to throw an ASSERT! - - ATTENTION - - If you miss a test for one of this parameters, contact the author or add it himself !(?) - But ... look for right testing! See using of this methods! ------------------------------------------------------------------------------------------------------------------*/ - -// An empty list is allowed ... hasMoreElements() will return false then! -bool OComponentEnumeration::impldbg_checkParameter_OComponentEnumerationCtor( const Sequence< css::uno::Reference< XComponent > >& seqComponents ) -{ - // Set default return value. - bool bOK = true; - // Check parameter. - if ( - ( &seqComponents == NULL ) - ) - { - bOK = false; - } - // Return result of check. - return bOK; -} - -bool OComponentEnumeration::impldbg_checkParameter_disposing( const EventObject& aEvent ) -{ - return aEvent.Source.is(); -} - } // namespace framework /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/urltransformer.cxx b/framework/source/services/urltransformer.cxx index 4e150844decc..77394bbbdb3a 100644 --- a/framework/source/services/urltransformer.cxx +++ b/framework/source/services/urltransformer.cxx @@ -128,8 +128,7 @@ namespace sal_Bool SAL_CALL URLTransformer::parseStrict( css::util::URL& aURL ) throw( css::uno::RuntimeException, std::exception ) { // Safe impossible cases. - if (( &aURL == NULL ) || - ( aURL.Complete.isEmpty() ) ) + if ( aURL.Complete.isEmpty() ) { return sal_False; } @@ -181,8 +180,7 @@ sal_Bool SAL_CALL URLTransformer::parseSmart( css::util::URL& aURL, const OUString& sSmartProtocol ) throw( css::uno::RuntimeException, std::exception ) { // Safe impossible cases. - if (( &aURL == NULL ) || - ( aURL.Complete.isEmpty() ) ) + if ( aURL.Complete.isEmpty() ) { return sal_False; } @@ -233,10 +231,6 @@ sal_Bool SAL_CALL URLTransformer::parseSmart( css::util::URL& aURL, // XURLTransformer sal_Bool SAL_CALL URLTransformer::assemble( css::util::URL& aURL ) throw( css::uno::RuntimeException, std::exception ) { - // Safe impossible cases. - if ( &aURL == NULL ) - return sal_False; - // Initialize parser. INetURLObject aParser; @@ -297,8 +291,7 @@ OUString SAL_CALL URLTransformer::getPresentation( const css::util::URL& aURL, sal_Bool bWithPassword ) throw( css::uno::RuntimeException, std::exception ) { // Safe impossible cases. - if (( &aURL == NULL ) || - ( aURL.Complete.isEmpty() ) || + if (( aURL.Complete.isEmpty() ) || (( bWithPassword != sal_True ) && ( bWithPassword != sal_False ) ) ) { |