Advertisement
PVS-StudioWarnings

PVS-Studio warning V501 for IPP Samples

Nov 27th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. IPLFUN(void, iplMpyRCPack2D,
  2.        (IplImage* srcA, IplImage* srcB, IplImage* dst))
  3. {
  4.   ...
  5.   if( (srcA->depth == IPL_DEPTH_8U ) ||
  6.       (srcB->depth == IPL_DEPTH_8U ) ||
  7.       (srcB->depth == IPL_DEPTH_16U) ||
  8.       (srcB->depth == IPL_DEPTH_16U) ||
  9.       (srcA->depth == IPL_DEPTH_1U ) ||
  10.       (srcB->depth == IPL_DEPTH_1U ) )
  11.   ...
  12. }
  13.  
  14. This is what should have been written here: (srcA->depth == IPL_DEPTH_16U) || (srcB->depth == IPL_DEPTH_16U) ||
  15.  
  16. This suspicious code was found in IPP Samples project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V501 There are identical sub-expressions '(srcB->depth == 16)' to the left and to the right of the '||' operator. ipl iplmpy2d.c 457
  19.  
  20. 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