PVS-StudioWarnings

PVS-Studio warning V519 for QT

Nov 19th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. void HtmlGenerator::generateHeader(....)
  2. {
  3.   ...
  4.   QString shortVersion;
  5.   shortVersion = project + " " + shortVersion + ": ";
  6.   if (node && !node->doc().location().isEmpty())
  7.       out() << "<!-- " << node->doc().location().fileName() <<
  8.       " -->\n";
  9.  
  10.   shortVersion = myTree->version();
  11.   ...
  12. }
  13.  
  14. Most likely this is what should be written here: shortVersion += myTree->version();
  15.  
  16. This suspicious code was found in QT project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V519 The 'shortVersion' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 1791, 1795. qdoc3 htmlgenerator.cpp 1795
  19.  
  20. 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