PVS-StudioWarnings

PVS-Studio warning V501 for IPP Samples

Nov 12th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. bool H264_AU_Stream::IsPictureSame(
  2.   H264SliceHeaderParse & p_newHeader)
  3. {
  4.   if ((p_newHeader.frame_num !=
  5.        m_lastSlice.frame_num) ||
  6.       (p_newHeader.pic_parameter_set_id !=
  7.        p_newHeader.pic_parameter_set_id) ||
  8.       (p_newHeader.field_pic_flag !=
  9.        p_newHeader.field_pic_flag) ||
  10.       (p_newHeader.bottom_field_flag !=
  11.        m_lastSlice.bottom_field_flag)
  12.       ){
  13.       return false;
  14.   }
  15.   ...
  16. }
  17.  
  18. The code is formatted. That's why the error is clearly seen. In reality, such errors are difficult to find. 'p_newHeader' is used in two places instead of 'm_lastSlice' here.
  19.  
  20. This suspicious code was found in IPP Samples project by PVS-Studio static code analyzer.
  21. Warning message is:
  22. V501 There are identical sub-expressions 'p_newHeader.pic_parameter_set_id' to the left and to the right of the '!=' operator. h264_spl umc_h264_au_stream.cpp 478
  23.  
  24. 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