PVS-StudioWarnings

PVS-Studio warning V547 for DeSmuME

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