PVS-StudioWarnings

PVS-Studio warning V501 for Lugaru

Nov 18th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. void  Game::Tick()
  2. {
  3.   ...
  4.   if(Compare(consoletext[0],"belt ",0,4)||
  5.      Compare(consoletext[0],"belt ",0,4))
  6.   {
  7.     player[0].skeleton.clothes = 1-player[0].skeleton.clothes;
  8.     donesomething=1;
  9.   }
  10.   ...
  11. }
  12.  
  13. The word "belt" should start both with the capital and small letters.
  14.  
  15. This suspicious code was found in Lugaru project by PVS-Studio static code analyzer.
  16. Warning message is:
  17. V501 There are identical sub-expressions 'Compare (consoletext [0], "belt ", 0, 4)' to the left and to the right of the '||' operator. Lugaru gametick.cpp 5515
  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