PVS-StudioWarnings

PVS-Studio warning V523 for ReactOS

Nov 19th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.74 KB | None | 0 0
  1. static void TAB_SetupScrolling(
  2.   TAB_INFO*   infoPtr,
  3.   const RECT* clientRect)
  4. {
  5.   ....
  6.   /*
  7.   * Calculate the position of the scroll control.
  8.   */
  9.   if(infoPtr->dwStyle & TCS_VERTICAL)
  10.   {
  11.     controlPos.right = clientRect->right;
  12.     controlPos.left  = controlPos.right -
  13.                        2 * GetSystemMetrics(SM_CXHSCROLL);
  14.  
  15.     if (infoPtr->dwStyle & TCS_BOTTOM)
  16.     {
  17.       controlPos.top    = clientRect->bottom -
  18.                           infoPtr->tabHeight;
  19.       controlPos.bottom = controlPos.top +
  20.                           GetSystemMetrics(SM_CYHSCROLL);
  21.     }
  22.     else
  23.     {
  24.       controlPos.bottom = clientRect->top + infoPtr->tabHeight;
  25.       controlPos.top    = controlPos.bottom -
  26.                           GetSystemMetrics(SM_CYHSCROLL);
  27.     }
  28.   }
  29.   else
  30.   {
  31.     controlPos.right = clientRect->right;
  32.     controlPos.left  = controlPos.right -
  33.                        2 * GetSystemMetrics(SM_CXHSCROLL);
  34.  
  35.     if (infoPtr->dwStyle & TCS_BOTTOM)
  36.     {
  37.       controlPos.top    = clientRect->bottom -
  38.                           infoPtr->tabHeight;
  39.       controlPos.bottom = controlPos.top +
  40.                           GetSystemMetrics(SM_CYHSCROLL);
  41.     }
  42.     else
  43.     {
  44.       controlPos.bottom = clientRect->top + infoPtr->tabHeight;
  45.       controlPos.top    = controlPos.bottom -
  46.                           GetSystemMetrics(SM_CYHSCROLL);
  47.     }
  48.   }
  49.   ....
  50. }
  51.  
  52. This suspicious code was found in ReactOS project by PVS-Studio static code analyzer.
  53. Warning message is:
  54. V523 The 'then' statement is equivalent to the 'else' statement. tab.c 1043
  55.  
  56. 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