From 4f9b21248ffdf55cef9f3f9d1da76778ee000775 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 2 May 2014 15:42:25 +0200 Subject: simplify ternary conditions "xxx ? yyy : false" Look for code like: xxx ? yyy : false; Which can be simplified to: xxx && yyy Change-Id: Ia33c0e452aa28af3f0658a5382895aaad0246b4d --- include/vcl/bmpacc.hxx | 2 +- include/vcl/image.hxx | 2 +- include/vcl/keycod.hxx | 2 +- include/vcl/textdata.hxx | 10 +++++----- include/vcl/timer.hxx | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'include/vcl') diff --git a/include/vcl/bmpacc.hxx b/include/vcl/bmpacc.hxx index e96f49c02d5f..153464faabd9 100644 --- a/include/vcl/bmpacc.hxx +++ b/include/vcl/bmpacc.hxx @@ -254,7 +254,7 @@ inline Point BitmapReadAccess::BottomRight() const inline bool BitmapReadAccess::IsTopDown() const { DBG_ASSERT( mpBuffer, "Access is not valid!" ); - return( mpBuffer ? sal::static_int_cast( BMP_SCANLINE_ADJUSTMENT( mpBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN ) : false ); + return mpBuffer && ( BMP_SCANLINE_ADJUSTMENT( mpBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN ); } diff --git a/include/vcl/image.hxx b/include/vcl/image.hxx index fb618d1a21d7..82f53a2d94c9 100644 --- a/include/vcl/image.hxx +++ b/include/vcl/image.hxx @@ -68,7 +68,7 @@ public: Image GetColorTransformedImage( ImageColorTransform eColorTransform ) const; - bool operator!() const { return( !mpImplData ? true : false ); } + bool operator!() const { return !mpImplData; } Image& operator=( const Image& rImage ); bool operator==( const Image& rImage ) const; bool operator!=( const Image& rImage ) const { return !(Image::operator==( rImage )); } diff --git a/include/vcl/keycod.hxx b/include/vcl/keycod.hxx index 4029c30bc618..20e80cf02eae 100644 --- a/include/vcl/keycod.hxx +++ b/include/vcl/keycod.hxx @@ -67,7 +67,7 @@ public: OUString GetName( Window* pWindow = NULL ) const; bool IsFunction() const - { return ((eFunc != KEYFUNC_DONTKNOW) ? true : false); } + { return (eFunc != KEYFUNC_DONTKNOW); } KeyFuncType GetFunction() const; diff --git a/include/vcl/textdata.hxx b/include/vcl/textdata.hxx index 1f475878a01e..8fbc62fd8146 100644 --- a/include/vcl/textdata.hxx +++ b/include/vcl/textdata.hxx @@ -52,7 +52,7 @@ public: inline bool TextPaM::operator == ( const TextPaM& rPaM ) const { - return ( ( mnPara == rPaM.mnPara ) && ( mnIndex == rPaM.mnIndex ) ) ? true : false; + return ( mnPara == rPaM.mnPara ) && ( mnIndex == rPaM.mnIndex ); } inline bool TextPaM::operator != ( const TextPaM& rPaM ) const @@ -62,14 +62,14 @@ inline bool TextPaM::operator != ( const TextPaM& rPaM ) const inline bool TextPaM::operator < ( const TextPaM& rPaM ) const { - return ( ( mnPara < rPaM.mnPara ) || - ( ( mnPara == rPaM.mnPara ) && mnIndex < rPaM.mnIndex ) ) ? true : false; + return ( mnPara < rPaM.mnPara ) || + ( ( mnPara == rPaM.mnPara ) && mnIndex < rPaM.mnIndex ); } inline bool TextPaM::operator > ( const TextPaM& rPaM ) const { - return ( ( mnPara > rPaM.mnPara ) || - ( ( mnPara == rPaM.mnPara ) && mnIndex > rPaM.mnIndex ) ) ? true : false; + return ( mnPara > rPaM.mnPara ) || + ( ( mnPara == rPaM.mnPara ) && mnIndex > rPaM.mnIndex ); } class VCL_DLLPUBLIC TextSelection diff --git a/include/vcl/timer.hxx b/include/vcl/timer.hxx index 91db8cb0a3b5..665978076727 100644 --- a/include/vcl/timer.hxx +++ b/include/vcl/timer.hxx @@ -49,7 +49,7 @@ public: /// set the timeout in milliseconds void SetTimeout( sal_uLong nTimeoutMs ); sal_uLong GetTimeout() const { return mnTimeout; } - bool IsActive() const { return mbActive ? true : false; } + bool IsActive() const { return mbActive; } void SetTimeoutHdl( const Link& rLink ) { maTimeoutHdl = rLink; } const Link& GetTimeoutHdl() const { return maTimeoutHdl; } -- cgit