PVS-StudioWarnings

PVS-Studio warning V501 for VTK

Nov 13th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. int vtkFixedPointVolumeRayCastMapper::ComputeRowBounds(....)
  2. {
  3.   if ( ( minX < 0 && maxX < 0 ) ||
  4.        ( minY < 0 && maxY < 0 ) ||
  5.        ( minX > imageViewportSize[0]-1 &&
  6.          maxX > imageViewportSize[0]-1 ) ||
  7.        ( minX > imageViewportSize[0]-1 &&
  8.          maxX > imageViewportSize[0]-1 ) )
  9.   ...
  10. }
  11.  
  12. The consequences of the Copy-Paste method. A null index is used everywhere.
  13.  
  14. This suspicious code was found in VTK project by PVS-Studio static code analyzer.
  15. Warning message is:
  16. V501 There are identical sub-expressions '(minX > imageViewportSize[0] - 1 && maxX > imageViewportSize[0] - 1)' to the left and to the right of the '||' operator. vtkVolumeRendering vtkfixedpointvolumeraycastmapper.cxx 2184
  17.  
  18. 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