[PATCH] [core/vcl/source/window/splitwin.cxx:2047] -> [core/vcl/source/window/splitwin.cxx:2045]: (style) Found duplicate branches for if and else.

Riccardo Magliocchetti riccardo.magliocchetti at gmail.com
Thu Feb 16 00:35:03 PST 2012


Il 16/02/2012 00:02, Mariusz Dykierek ha scritto:
> + some simplification
 > +        sal_Bool bLeft = sal_True;
 > +        if ( ( meAlign == WINDOWALIGN_TOP ) || ( meAlign ==
 > WINDOWALIGN_LEFT ) )
 > +            bLeft = sal_False;

I think that keeping possible values explicit could be a good thing so 
what about a switch?

sal_Bool bLeft;

switch (meAlign) {
case WINDOWALIGN_TOP:
case WINDOWALIGN_LEFT:
     bLeft = sal_False;
case WINDOWALIGN_BOTTOM:
case WINDOWALIGN_RIGHT:
default:
     bLeft = sal_True;
}

Otherwise you can simplify it even more:

sal_Bool bLeft = (meAlign == WINDOWALIGN_TOP || meAlign == 
WINDOWALIGN_LEFT) ? sal_False : sal_True;

cheers

-- 
Riccardo Magliocchetti


More information about the LibreOffice mailing list