PVS-StudioWarnings

PVS-Studio warning V555 for OpenJPEG

Nov 26th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. typedef struct opj_stepsize
  2. {
  3.   OPJ_UINT32 expn;
  4.   OPJ_UINT32 mant;
  5. };
  6.  
  7. bool j2k_read_SQcd_SQcc(
  8.   opj_j2k_t *p_j2k,
  9.   OPJ_UINT32 p_comp_no,
  10.   OPJ_BYTE* p_header_data,
  11.   OPJ_UINT32 * p_header_size,
  12.   struct opj_event_mgr * p_manager
  13.   )
  14. {
  15.   ....
  16.   OPJ_UINT32 l_band_no;
  17.   ....
  18.   l_tccp->stepsizes[l_band_no].expn =
  19.     ((l_tccp->stepsizes[0].expn) - ((l_band_no - 1) / 3) > 0) ?
  20.       (l_tccp->stepsizes[0].expn) - ((l_band_no - 1) / 3) : 0;
  21.   ....
  22. }
  23.  
  24. This suspicious code was found in OpenJPEG project by PVS-Studio static code analyzer.
  25. Warning message is:
  26. V555 The expression of the 'A - B > 0' kind will work as 'A != B'. itkopenjpeg j2k.c 3421
  27.  
  28. 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