Advertisement
PVS-StudioWarnings

PVS-Studio warning V533 for Doom3

Nov 26th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. void idSurface_Polytope::FromPlanes(....)
  2. {
  3.   ...
  4.   for ( j = 0; j < w.GetNumPoints(); j++ ) {
  5.     for ( k = 0; k < verts.Num(); j++ ) {
  6.       if ( verts[k].xyz.Compare(w[j].ToVec3(),
  7.                                 POLYTOPE_VERTEX_EPSILON ) ) {
  8.         break;
  9.       }
  10.     }
  11.     ...
  12.   }
  13.   ...
  14. }
  15.  
  16. This is what should have been written here: for ( k = 0; k < verts.Num(); k++ ).
  17.  
  18. This suspicious code was found in Doom3 project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V533 It is likely that a wrong variable is being incremented inside the 'for' operator. Consider reviewing 'j'. idLib surface_polytope.cpp 65
  21.  
  22. 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