Advertisement
PVS-StudioWarnings

PVS-Studio warning V547 for IPP Samples

Nov 26th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1. typedef signed int     Ipp32s;
  2. typedef unsigned int   Ipp32u;
  3.  
  4. Ipp32s StreamParser::GetTrackByPidOrCreateNew(Ipp32s iPid,
  5.                                               bool *pIsNew)
  6. {
  7.   ...
  8.   else if (!pIsNew || m_uiTracks >= MAX_TRACK)
  9.     return -1;
  10.   ...
  11. }
  12.  
  13. Status StreamParser::GetNextData(MediaData *pData,
  14.                                  Ipp32u *pTrack)
  15. {
  16.   ...
  17.   *pTrack = GetTrackByPidOrCreateNew(m_pPacket->iPid, NULL);
  18.  
  19.   if (*pTrack >= 0 && TRACK_LPCM == m_pInfo[*pTrack]->m_Type)
  20.     ippsSwapBytes_16u_I((Ipp16u *)pData->GetDataPointer(),
  21.                         m_pPacket->uiSize / 2);
  22.   ...
  23. }
  24.  
  25. This suspicious code was found in IPP Samples project by PVS-Studio static code analyzer.
  26. Warning message is:
  27. V547 Expression '* pTrack >= 0' is always true. Unsigned type value is always >= 0. demuxer umc_stream_parser.cpp 179
  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
Advertisement