PVS-StudioWarnings

PVS-Studio warning V555 for Wine

Nov 18th, 2014
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. static HRESULT
  2. AVIFILE_RemoveStream(IAVIEditStreamImpl* const This, DWORD nr)
  3. {
  4.   ....
  5.   This->nStreams--;
  6.   if (This->nStreams - nr > 0) {   //<==
  7.     memmove(This->pStreams + nr, This->pStreams + nr + 1,
  8.             (This->nStreams - nr) * sizeof(EditStreamTable));
  9.   }
  10.   ....
  11. }
  12.  
  13. This suspicious code was found in Wine project by PVS-Studio static code analyzer.
  14. Warning message is:
  15. V555 The expression 'This->nStreams - nr > 0' will work as 'This->nStreams != nr'. editstream.c 172
  16.  
  17. 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