PVS-StudioWarnings

PVS-Studio warning V501 for eLynxSDK

Nov 10th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. void uteTestRunner::StressBayer(uint32 iFlags)
  2. {
  3.   ...
  4.   static EPixelFormat ms_pfList[] =
  5.     { PF_Lub, PF_Lus, PF_Li, PF_Lf, PF_Ld };
  6.   const int fsize = sizeof(ms_pfList) / sizeof(ms_pfList);
  7.  
  8.   static EBayerMatrix ms_bmList[] =
  9.     { BM_GRBG, BM_GBRG, BM_RGGB, BM_BGGR, BM_None };
  10.   const int bsize = sizeof(ms_bmList) / sizeof(ms_bmList);
  11.   ...
  12. }
  13.  
  14. This is what should have been written here: sizeof(ms_pfList) / sizeof(ms_pfList[0]) and sizeof(ms_bmList) / sizeof(ms_bmList[0]).
  15.  
  16. This suspicious code was found in eLynxSDK project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V501 There are identical sub-expressions to the left and to the right of the '/' operator: sizeof (ms_pfList) / sizeof (ms_pfList) IFF plugins engine.cpp 955
  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