Advertisement
PVS-StudioWarnings

PVS-Studio warning V501 for VTK

Nov 27th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. void vtkPiecewiseControlPointsItem::SetControlPoint(
  2.   vtkIdType index, double* newPos)
  3. {
  4.   double oldPos[4];
  5.   this->PiecewiseFunction->GetNodeValue(index, oldPos);
  6.   if (newPos[0] != oldPos[0] || newPos[1] != oldPos[1] ||
  7.       newPos[2] != oldPos[2] || newPos[2] != oldPos[2])
  8.     {
  9.       this->PiecewiseFunction->SetNodeValue(index, newPos);
  10.     }
  11. }
  12.  
  13. A misprint. The last array items are not compared.
  14.  
  15. This suspicious code was found in VTK project by PVS-Studio static code analyzer.
  16. Warning message is:
  17. V501 There are identical sub-expressions 'newPos[2] != oldPos[2]' to the left and to the right of the '||' operator. vtkCharts vtkpiecewisecontrolpointsitem.cxx 129
  18.  
  19. 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
Advertisement