Advertisement
PVS-StudioWarnings

PVS-Studio warning V564 for Chromium

Nov 27th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. enum FontStyle {
  2.   NORMAL = 0,
  3.   BOLD = 1,
  4.   ITALIC = 2,
  5.   UNDERLINE = 4,
  6. };
  7.  
  8. void LabelButton::SetIsDefault(bool is_default) {
  9.   ....
  10.   style = is_default ? style | gfx::Font::BOLD :
  11.                        style & !gfx::Font::BOLD;
  12.   ....
  13. }
  14.  
  15. This is what should have been written here: style = is_default ? style | gfx::Font::BOLD : style & ~gfx::Font::BOLD;
  16.  
  17. This suspicious code was found in Chromium project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V564 The '&' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '&&' operator. label_button.cc 131
  20.  
  21. 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