PVS-StudioWarnings

PVS-Studio warning V503 for IPP Samples

Nov 12th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. void lNormalizeVector_32f_P3IM(Ipp32f *vec[3],
  2.                                Ipp32s* mask, Ipp32s len)
  3. {
  4.   Ipp32s  i;
  5.   Ipp32f  norm;
  6.  
  7.   for(i=0; i<len; i++) {
  8.     if(mask<0) continue;
  9.     norm = 1.0f/sqrt(vec[0][i]*vec[0][i]+
  10.                      vec[1][i]*vec[1][i]+
  11.                      vec[2][i]*vec[2][i]);
  12.     vec[0][i] *= norm; vec[1][i] *= norm; vec[2][i] *= norm;
  13.   }
  14. }
  15.  
  16. This is what should have been written here: if(mask[i]<0) continue;
  17.  
  18. This suspicious code was found in IPP Samples project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V503 This is a nonsensical comparison: pointer < 0. ipprsample ippr_sample.cpp 501
  21.  
  22. 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