Kaydet (Commit) dd90d9b6 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

-Werror,-Wtautological-undefined-compare

Change-Id: Ibd738b91d35a1b82e1e7b078ef73c6f6076dc08a
üst ed9d3290
......@@ -159,14 +159,6 @@ class OComponentEnumeration : public ::cppu::WeakImplHelper2< ::com::sun::star
sal_True otherway
*//*-*****************************************************************************************************/
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
......
......@@ -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: */
......@@ -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: */
......@@ -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 ) ) )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment