PVS-StudioWarnings

PVS-Studio warning V501 for QT

Nov 17th, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. Q3TextCustomItem* Q3TextDocument::parseTable(....)
  2. {
  3.   ...
  4.   while (end < length
  5.     && !hasPrefix(doc, length, end, QLatin1String("</td"))
  6.     && !hasPrefix(doc, length, end, QLatin1String("<td"))
  7.     && !hasPrefix(doc, length, end, QLatin1String("</th"))
  8.     && !hasPrefix(doc, length, end, QLatin1String("<th"))
  9.     && !hasPrefix(doc, length, end, QLatin1String("<td"))
  10.     && !hasPrefix(doc, length, end, QLatin1String("</tr"))
  11.     && !hasPrefix(doc, length, end, QLatin1String("<tr"))
  12.     && !hasPrefix(doc, length, end, QLatin1String("</table"))
  13.   ) {
  14.   ....
  15. }
  16.  
  17. The "td" prefix is being searched for twice.
  18.  
  19. This suspicious code was found in QT project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V501 There are identical sub-expressions to the left and to the right of the '&&' operator. Qt3Support q3richtext.cpp 6978
  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