PVS-StudioWarnings

PVS-Studio warning V501 for Skia

Nov 19th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. void SkCanvasStack::pushCanvas(....) {
  2.   ....
  3.   for (int i = fList.count() - 1; i > 0; --i) {
  4.     SkIRect localBounds = canvasBounds;
  5.     localBounds.offset(origin - fCanvasData[i-1].origin);
  6.  
  7.     fCanvasData[i-1].requiredClip.op(localBounds,
  8.                                      SkRegion::kDifference_Op);
  9.     fList[i-i]->clipRegion(fCanvasData[i-1].requiredClip);
  10.   }
  11.   ....
  12. }
  13.  
  14. Most likely this is what should be written here: fList[i-1]->
  15.  
  16. This suspicious code was found in Skia project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V501 There are identical sub-expressions to the left and to the right of the '-' operator: i - i SkCanvasStack.cpp 38
  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