Advertisement
PVS-StudioWarnings

PVS-Studio warning V547 for Snes9x

Nov 24th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. bool Set_RS_Val()
  2. {
  3.   ....
  4.   int appliedSize;
  5.   ....
  6.   if((appliedSize == TEXT('b') && appliedSize == TEXT('s') &&
  7.       (rs_param < -128 || rs_param > 127)) ||
  8.      (appliedSize == TEXT('b') && appliedSize != TEXT('s') &&
  9.       (rs_param < 0 || rs_param > 255)) ||
  10.      (appliedSize == TEXT('w') && appliedSize == TEXT('s') &&
  11.       (rs_param < -32768 || rs_param > 32767)) ||
  12.      (appliedSize == TEXT('w') && appliedSize != TEXT('s') &&
  13.       (rs_param < 0 || rs_param > 65535)))
  14.      return false;
  15.   ....
  16. }
  17.  
  18. This suspicious code was found in Snes9x project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V547 Expression is always false. Probably the '||' operator should be used here. ram_search.cpp 921
  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