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

julien2412 serval2412 at yahoo.fr
Sat Mar 16 13:52:23 PDT 2013


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 ?

Julien



--
View this message in context: http://nabble.documentfoundation.org/cppcheck-Variables-reassigned-before-the-old-one-has-been-used-vcl-kde4-part-tp4044235.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list