PVS-StudioWarnings

PVS-Studio warning V562 for ReactOS

Nov 10th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #define INVALID_SET_FILE_POINTER ((DWORD)-1)
  2.  
  3. BOOL LogfInitializeExisting(PLOGFILE LogFile)
  4. {
  5.   ...
  6.   if (!SetFilePointer(LogFile->hFile, 0, NULL, FILE_BEGIN) ==
  7.       INVALID_SET_FILE_POINTER)
  8.   {
  9.       DPRINT1("SetFilePointer() failed! %d\n", GetLastError());
  10.       return FALSE;
  11.   }
  12.   ...
  13. }
  14.  
  15. This is what should have been written here: if (SetFilePointer(LogFile->hFile, 0, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
  16.  
  17. This suspicious code was found in ReactOS project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V562 It's odd to compare 0 or 1 with a value of 4294967295. eventlog file.c 264
  20.  
  21. 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