PVS-StudioWarnings

PVS-Studio warning V519 for QT

Nov 13th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. QV4::ReturnedValue
  2. QQuickJSContext2DPrototype::method_createPattern(....)
  3. {
  4.   ....
  5.   if (repetition == QStringLiteral("repeat") ||
  6.       repetition.isEmpty()) {
  7.     pattern->patternRepeatX = true;
  8.     pattern->patternRepeatY = true;
  9.   } else if (repetition == QStringLiteral("repeat-x")) {
  10.     pattern->patternRepeatX = true;
  11.   } else if (repetition == QStringLiteral("repeat-y")) {
  12.     pattern->patternRepeatY = true;
  13.   } else if (repetition == QStringLiteral("no-repeat")) {
  14.     pattern->patternRepeatY = false;
  15.     pattern->patternRepeatY = false;
  16.   } else {
  17.     //TODO: exception: SYNTAX_ERR
  18.   }
  19.   ....
  20. }
  21.  
  22. This suspicious code was found in QT project by PVS-Studio static code analyzer.
  23. Warning message is:
  24. V519 The 'pattern->patternRepeatY' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 1775, 1776. qquickcontext2d.cpp 1776
  25.  
  26. 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