PVS-StudioWarnings

PVS-Studio warning V560 for QT

Nov 18th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. QString decodeMSG(const MSG& msg)
  2. {
  3.   ...
  4.   int repCount     = (lKeyData & 0xffff);        // Bit 0-15
  5.   int scanCode     = (lKeyData & 0xf0000) >> 16; // Bit 16-23
  6.   bool contextCode = (lKeyData && 0x20000000);   // Bit 29
  7.   bool prevState   = (lKeyData && 0x40000000);   // Bit 30
  8.   bool transState  = (lKeyData && 0x80000000);   // Bit 31
  9.   ...
  10. }
  11.  
  12. This place is not crucial, but still needs paying attention to.
  13.  
  14. This suspicious code was found in QT project by PVS-Studio static code analyzer.
  15. Warning message is:
  16. V560 A part of conditional expression is always true: 0x20000000. QtCore qcoreapplication_win.cpp 870
  17.  
  18. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment