Advertisement
PVS-StudioWarnings

PVS-Studio warning V519 for QT

Nov 21st, 2014
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. bool GSuggestCompletion::eventFilter(QObject *obj, QEvent *ev)
  2. {
  3.   ....
  4.   switch (key) {
  5.   case Qt::Key_Enter:
  6.   case Qt::Key_Return:
  7.     doneCompletion();
  8.     consumed = true;
  9.  
  10.   case Qt::Key_Escape:
  11.     editor->setFocus();
  12.     popup->hide();
  13.     consumed = true;
  14.  
  15.   case Qt::Key_Up:
  16.   case Qt::Key_Down:
  17.   case Qt::Key_Home:
  18.   case Qt::Key_End:
  19.   case Qt::Key_PageUp:
  20.   case Qt::Key_PageDown:
  21.     break;
  22.   ....
  23. }
  24.  
  25. This suspicious code was found in QT project by PVS-Studio static code analyzer.
  26. Warning message is:
  27. V519 The 'consumed' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 110, 115. googlesuggest.cpp 115
  28.  
  29. 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
Advertisement