PVS-StudioWarnings

PVS-Studio warning V545 for Virtualdub

Nov 27th, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
  2.  
  3. STDAPI AVIStreamInfoA (PAVISTREAM pavi, LPAVISTREAMINFOA psi,
  4.                        LONG lSize);
  5.  
  6. #define AVIStreamInfo AVIStreamInfoA
  7.  
  8. VDPosition AVIReadTunnelStream::TimeToPosition(VDTime timeInUs) {
  9.   AVISTREAMINFO asi;
  10.   if (AVIStreamInfo(pas, &asi, sizeof asi))
  11.     return 0;
  12.  
  13.   return VDRoundToInt64(timeInUs * (double)asi.dwRate /
  14.            (double)asi.dwScale * (1.0 / 1000000.0));
  15. }
  16.  
  17. This suspicious code was found in Virtualdub project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V545 Such conditional expression of 'if' operator is incorrect for the HRESULT type value 'AVIStreamInfoA(pas, & asi, sizeof asi)'. The SUCCEEDED or FAILED macro should be used instead. VirtualDub avireadhandlertunnelw32.cpp 230
  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