PVS-StudioWarnings

PVS-Studio warning V640 for ReactOS

Nov 25th, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1. #define stat64_to_stat(buf64, buf)   \
  2.     buf->st_dev   = (buf64)->st_dev;   \
  3.     buf->st_ino   = (buf64)->st_ino;   \
  4.     buf->st_mode  = (buf64)->st_mode;  \
  5.     buf->st_nlink = (buf64)->st_nlink; \
  6.     buf->st_uid   = (buf64)->st_uid;   \
  7.     buf->st_gid   = (buf64)->st_gid;   \
  8.     buf->st_rdev  = (buf64)->st_rdev;  \
  9.     buf->st_size  = (_off_t)(buf64)->st_size;  \
  10.     buf->st_atime = (time_t)(buf64)->st_atime; \
  11.     buf->st_mtime = (time_t)(buf64)->st_mtime; \
  12.     buf->st_ctime = (time_t)(buf64)->st_ctime; \
  13.  
  14. int CDECL _tstat(const _TCHAR* path, struct _stat * buf)
  15. {
  16.   int ret;
  17.   struct __stat64 buf64;
  18.  
  19.   ret = _tstat64(path, &buf64);
  20.   if (!ret)
  21.     stat64_to_stat(&buf64, buf);
  22.   return ret;
  23. }
  24.  
  25. This suspicious code was found in ReactOS project by PVS-Studio static code analyzer.
  26. Warning message is:
  27. V640 The code's operational logic does not correspond with its formatting. The second statement will always be executed. It is possible that curly brackets are missing. stat.c 24
  28.  
  29. 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