Cppcheck reports 'else if' condition matches previous condition (vcl)

Caolán McNamara caolanm at redhat.com
Fri Apr 11 07:13:12 PDT 2014


On Sat, 2014-04-05 at 16:06 -0700, julien2412 wrote:
> Indeed we have:
>     296                 else
>     297                 {
>     298                     if( aTmpBmpEx.IsAlpha() )
>     299                         aTmpBmpEx = BitmapEx( aTmpBmp,
> aTmpBmpEx.GetAlpha() );
>     300                     else if( aTmpBmpEx.IsAlpha() )
>     301                         aTmpBmpEx = BitmapEx( aTmpBmp,
> aTmpBmpEx.GetMask() );
>     302                 }
> see
> http://opengrok.libreoffice.org/xref/core/vcl/source/gdi/impimage.cxx#298
> 
> Should the else if be:
> else if( aTmpBmpEx.IsTransparent())

"grep -r IsAlpha -C 5 vcl|grep else" definitely strongly suggests that
was the intent. I reckon its worth making that change and see if
anything falls over. Not the kind of thing I'd backport to 4-2 unless we
get compelling evidence to do that.

C.



More information about the LibreOffice mailing list