PVS-StudioWarnings

PVS-Studio warning V501 for Firefox

Nov 13th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. NS_IMETHODIMP
  2. nsNativeThemeWin::WidgetStateChanged(....)
  3. {
  4.   ....
  5.   if (aWidgetType == NS_THEME_WINDOW_TITLEBAR ||
  6.       aWidgetType == NS_THEME_WINDOW_TITLEBAR_MAXIMIZED ||
  7.       aWidgetType == NS_THEME_WINDOW_FRAME_LEFT ||
  8.       aWidgetType == NS_THEME_WINDOW_FRAME_RIGHT ||
  9.       aWidgetType == NS_THEME_WINDOW_FRAME_BOTTOM ||
  10.       aWidgetType == NS_THEME_WINDOW_BUTTON_CLOSE ||
  11.       aWidgetType == NS_THEME_WINDOW_BUTTON_MINIMIZE ||  <<<<====
  12.       aWidgetType == NS_THEME_WINDOW_BUTTON_MINIMIZE ||  <<<<====
  13.       aWidgetType == NS_THEME_WINDOW_BUTTON_RESTORE) {
  14.     *aShouldRepaint = true;
  15.     return NS_OK;
  16.   ....
  17. }
  18.  
  19. This suspicious code was found in Firefox project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V501 There are identical sub-expressions 'aWidgetType == 237' to the left and to the right of the '||' operator. nsnativethemewin.cpp 2475
  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