Advertisement
PVS-StudioWarnings

PVS-Studio warning V517 for eibsuite

Nov 25th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. string TimePeriod::toString() const
  2. {
  3.   ...
  4.   if (_relativeTime <= 143)
  5.     os << ((int)_relativeTime + 1) * 5 << _(" minutes");
  6.   else if (_relativeTime <= 167)
  7.     os << 12 * 60 + ((int)_relativeTime - 143) *
  8.                     30 << _(" minutes");
  9.   else if (_relativeTime <= 196)
  10.     os << (int)_relativeTime - 166 << _(" days");
  11.   else if (_relativeTime <= 143)
  12.     os << (int)_relativeTime - 192 << _(" weeks");
  13.   ...
  14. }
  15.  
  16. The (_relativeTime <= 143) check is repeated twice.
  17.  
  18. This suspicious code was found in eibsuite project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. GSM gsm_sms_codec.cc 175
  21.  
  22. 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