PVS-StudioWarnings

PVS-Studio warning V547 for DeSmuME

Nov 19th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. static int _FAT_directory_lfnLength (const char* name) {
  2.   ...
  3.   for (i = 0; i < nameLength; i++) {
  4.     if (name[i] < 0x20 || name[i] >= ABOVE_UCS_RANGE) {
  5.       return -1;
  6.     }
  7.   }
  8.   ...
  9. }
  10.  
  11. This is what should have been written here: (unsigned char)(name[i]) >= ABOVE_UCS_RANGE
  12.  
  13. This suspicious code was found in DeSmuME project by PVS-Studio static code analyzer.
  14. Warning message is:
  15. V547 Expression 'name[i] >= 0xF0' is always false. The value range of signed char type: [-128, 127]. DeSmuME_VS2005 directory.cpp 118
  16.  
  17. 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