Advertisement
PVS-StudioWarnings

PVS-Studio warning V547 for Miranda IM

Nov 21st, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. typedef struct tagPROTOFILETRANSFERSTATUS
  2. {
  3.   ...
  4.   unsigned __int64 currentFileSize;
  5.   ...
  6. } PROTOFILETRANSFERSTATUS;
  7.  
  8. //There is this place in the program code:
  9. ft->std.currentFileSize = -1;
  10.  
  11. void __cdecl CJabberProto::FileReceiveThread(filetransfer* ft)
  12. {
  13.   ...
  14.   if (ft->state==FT_DONE ||
  15.       ( ft->state==FT_RECEIVING && ft->std.currentFileSize < 0 ))
  16.   ...
  17. }
  18.  
  19. This suspicious code was found in Miranda IM project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V547 Expression 'ft->std.currentFileSize < 0' is always false. Unsigned type value is never < 0. jabber jabber_file.cpp 92
  22.  
  23. 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