PVS-StudioWarnings

PVS-Studio warning V581 for Chromium

Nov 19th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. static bool PasswordFormComparator(const PasswordForm& pf1,
  2.                                    const PasswordForm& pf2) {
  3.   if (pf1.submit_element < pf2.submit_element)
  4.     return true;
  5.   if (pf1.username_element < pf2.username_element)
  6.     return true;
  7.   if (pf1.username_value < pf2.username_value)
  8.     return true;
  9.   if (pf1.username_value < pf2.username_value)
  10.     return true;
  11.   if (pf1.password_element < pf2.password_element)
  12.     return true;
  13.   if (pf1.password_value < pf2.password_value)
  14.     return true;
  15.  
  16.   return false;
  17. }
  18.  
  19. This suspicious code was found in Chromium project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V581 The conditional expressions of the 'if' operators situated alongside each other are identical. Check lines: 259, 261. profile_sync_service_password_unittest.cc 261
  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