cppcheck: Variables reassigned before the old one has been used (vcl/kde4 part)

Lubos Lunak l.lunak at suse.cz
Mon Mar 18 05:19:55 PDT 2013


On Saturday 16 of March 2013, julien2412 wrote:
> Hello,
>
> Cppcheck reported this:
> [KDESalFrame.cxx:301] -> [KDESalFrame.cxx:304]: (performance) Variable
> 'aMenuFore' is reassigned a value before the old one has been used.
> [KDESalFrame.cxx:302] -> [KDESalFrame.cxx:305]: (performance) Variable
> 'aMenuBack' is reassigned a value before the old one has been used.
>
> Indeed, there are the lines:
>     292     // Menu
>     293     style.SetSkipDisabledInMenus( TRUE );
>     294     KMenuBar* pMenuBar = new KMenuBar();
>     295     if ( pMenuBar )
>     296     {
>     297         // Color
>     298         QPalette qMenuCG = pMenuBar->palette();
>     299
>     300         // Menu text and background color, theme specific
>     301         Color aMenuFore = toColor( qMenuCG.color(
> QPalette::WindowText ) );
>     302         Color aMenuBack = toColor( qMenuCG.color( QPalette::Window
> ) );
>     303
>     304         aMenuFore = toColor( qMenuCG.color( QPalette::ButtonText )
> );
>     305         aMenuBack = toColor( qMenuCG.color( QPalette::Button ) );
> (See
> http://opengrok.libreoffice.org/xref/core/vcl/unx/kde4/KDESalFrame.cxx#292)
>
> Must we keep QPalette::WindowText and QPalette::Window or
> QPalette::ButtonText and QPalette::Button ?

 It looks like a leftover from the KDE3 version and if it's been like this all 
the time and nobody has complained, then the useless ones should be removed.

-- 
 Lubos Lunak
 l.lunak at suse.cz


More information about the LibreOffice mailing list