PVS-StudioWarnings

PVS-Studio warning V547 for CryEngineSDK

Nov 18th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 KB | None | 0 0
  1. const CCircularBufferTimeline *
  2. CCircularBufferStatsContainer::GetTimeline(
  3.   size_t inTimelineId) const
  4. {
  5.   ....
  6.   if (inTimelineId >= 0 && (int)inTimelineId < m_numTimelines)
  7.   {
  8.     tl = &m_timelines[inTimelineId];
  9.   }
  10.   else
  11.   {
  12.     CryWarning(VALIDATOR_MODULE_GAME,VALIDATOR_ERROR,
  13.                "Statistics event %" PRISIZE_T
  14.                " is larger than the max registered of %"
  15.                PRISIZE_T ", event ignored",
  16.                inTimelineId,m_numTimelines);
  17.   }
  18.   ....
  19. }
  20.  
  21. This suspicious code was found in CryEngineSDK project by PVS-Studio static code analyzer.
  22. Warning message is:
  23. V547 Expression 'inTimelineId >= 0' is always true. Unsigned type value is always >= 0. circularstatsstorage.cpp 31
  24.  
  25. 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