PVS-StudioWarnings

PVS-Studio warning V519 for QT

Nov 27th, 2014
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. static String variantToSetting(const QVariant& qvariant)
  2. {
  3.     String retVal;
  4.  
  5.     switch (qvariant.type()) {
  6.     case QVariant::Bool:
  7.         retVal = qvariant.toBool() ? "true" : "false";
  8.     case QVariant::String:
  9.         retVal = qvariant.toString();
  10.     default:
  11.         break;
  12.     }
  13.  
  14.     return retVal;
  15. }
  16.  
  17. The break operator is missing.
  18.  
  19. This suspicious code was found in QT project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V519 The 'retVal' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 169, 171. QtWebKit inspectorclientqt.cpp 171
  22.  
  23. 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