PVS-StudioWarnings

PVS-Studio warning V547 for BCMenu

Nov 20th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. BCMenu *BCMenu::FindMenuOption(int nId,UINT& nLoc)
  2. {
  3.   ...
  4.   nLoc = -1;
  5.   ...
  6. }
  7.  
  8. BOOL BCMenu::ModifyODMenuW(wchar_t *lpstrText,
  9.                            UINT nID, int nIconNormal)
  10. {
  11.   UINT nLoc;
  12.   ...
  13.   BCMenu *psubmenu = FindMenuOption(nID,nLoc);
  14.   ...
  15.   if(psubmenu && nLoc>=0) mdata = psubmenu->m_MenuList[nLoc];
  16.   ...
  17. }
  18.  
  19. This suspicious code was found in BCMenu project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V547 Expression 'nLoc >= 0' is always true. Unsigned type value is always >= 0. Merge bcmenu.cpp 1232
  22.  
  23. 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