PVS-StudioWarnings

PVS-Studio warning V517 for QT

Nov 10th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1. void Node::setPageType(const QString& t)
  2. {
  3.   if ((t == "API") || (t == "api"))
  4.     pageType_ = ApiPage;
  5.   else if (t == "howto")             <<<===
  6.     pageType_ = HowToPage;
  7.   else if (t == "overview")
  8.     pageType_ = OverviewPage;
  9.   else if (t == "tutorial")
  10.     pageType_ = TutorialPage;
  11.   else if (t == "howto")             <<<===
  12.     pageType_ = HowToPage;
  13.   else if (t == "article")
  14.     pageType_ = ArticlePage;
  15.   else if (t == "example")
  16.     pageType_ = ExamplePage;
  17.   else if (t == "ditamap")
  18.     pageType_ = DitaMapPage;
  19. }
  20.  
  21. This suspicious code was found in QT project by PVS-Studio static code analyzer.
  22. Warning message is:
  23. V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 386, 392. node.cpp 386
  24.  
  25. 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