Suspicous code in kdelibs-3.5.2
Lubos Lunak
l.lunak at suse.cz
Sun Apr 9 10:15:14 BST 2006
On Wednesday 05 April 2006 16:26, Christoph Bartoschek wrote:
> Hi,
>
> here is a list of suspicous lines of code in kdelibs-3.5.2 without khtml.
> I've checked khtml separately.
>
> ------------------------------------------------------------------
> Misc problems:
> ------------------------------------------------------------------
> - kdecore/kwinmodule.cpp:227
>
> Here I guess some braces are missing, maybe you meant:
> !(possibleStrutWindows.findIndex( ev->xany.window ) != -1)
> The current code cannot be false, because "!possibleStrutWindows.findIndex(
> ev->xany.window )" is either true(1) or false(0) and cannot be -1.
I guess Aaron optimized this file with find&replace :). Fixed.
> -----------------------------------------------------------------
> Lines where the operator preference between & and == leads to an error.
> There are some lines of code that look like this:
> if (variable & 0xF != 0) ...
> The compiler reads:
> if (variable & (0xF != 0)) ...
> and not
> if ((variable & 0xF) != 0) ...
> The result is that the compiler optimizes such code to:
> if (variable & 1) ...
> because (0xF != 0) is true and this is equivalent to 1
Long live backwards compatibility (dating back to the very first versions of
C).
> -----------------------------------------------------------------
>
> - kdecore/kglobalaccel_x11.cpp:215
Fixed.
> -----------------------------------------------------------------
> Cases from switch statements that fall through in some cases but
> do not have a fall through comment as in most such cases.
> ------------------------------------------------------------------
>
> - kdecore/kglobalaccel_x11.cpp:246
Actually intended.
> -----------------------------------------------------------------
> Lines where boolean expressions are used in non-boolean contexts:
> -----------------------------------------------------------------
>
> - kdecore/kxerrorhandler.cpp:108
> - kdecore/kxerrorhandler.cpp:110
Fixed.
--
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o. e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27 tel: +420 2 9654 2373
190 00 Praha 9 fax: +420 2 9654 2374
Czech Republic http://www.suse.cz/
More information about the kde-core-devel
mailing list