PVS-StudioWarnings

PVS-Studio warning V547 for Miranda IM

Nov 10th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. WINUSERAPI
  2. UINT
  3. WINAPI
  4. GetDlgItemInt(
  5.     __in HWND hDlg,
  6.     __in int nIDDlgItem,
  7.     __out_opt BOOL *lpTranslated,
  8.     __in BOOL bSigned);
  9.  
  10. #define SRMSGSET_LIMITNAMESLEN_MIN 0
  11.  
  12. static INT_PTR CALLBACK DlgProcTabsOptions(....)
  13. {
  14.   ...
  15.   limitLength =
  16.     GetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, NULL, TRUE) >=
  17.     SRMSGSET_LIMITNAMESLEN_MIN ?
  18.     GetDlgItemInt(hwndDlg, IDC_LIMITNAMESLEN, NULL, TRUE) :
  19.     SRMSGSET_LIMITNAMESLEN_MIN;
  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 is always true. Unsigned type value is always >= 0. scriver msgoptions.c 458
  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