Advertisement
PVS-StudioWarnings

PVS-Studio warning V547 for Miranda IM

Nov 24th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. typedef UINT_PTR WPARAM;
  2.  
  3. static int id2pos(int id)
  4. {
  5.   int i;
  6.   if (FramesSysNotStarted) return -1;
  7.   for (i=0;i<nFramescount;i++)
  8.   {
  9.     if (Frames[i].id==id) return(i);
  10.   }
  11.   return(-1);
  12. }
  13.  
  14. INT_PTR CLUIFrameSetFloat(WPARAM wParam,LPARAM lParam)
  15. {
  16.   ...
  17.   wParam=id2pos(wParam);
  18.   if(wParam>=0&&(int)wParam<nFramescount)
  19.     if (Frames[wParam].floating)
  20.   ...
  21. }
  22.  
  23. This suspicious code was found in Miranda IM project by PVS-Studio static code analyzer.
  24. Warning message is:
  25. V547 Expression 'wParam >= 0' is always true. Unsigned type value is always >= 0.  clist_mw  cluiframes.c  3140
  26.  
  27. 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