[openrtm-commit:02432] r2946 - branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 2月 11日 (土) 13:19:31 JST
Author: n-ando
Date: 2017-02-11 13:19:31 +0900 (Sat, 11 Feb 2017)
New Revision: 2946
Modified:
branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.cpp
Log:
[compat,->DEV_IQ_2016] LDRA rule "Devide by zero." has been made a countermeasured. refs #3908
Modified: branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.cpp
===================================================================
--- branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.cpp 2017-02-11 03:19:40 UTC (rev 2945)
+++ branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.cpp 2017-02-11 04:19:31 UTC (rev 2946)
@@ -338,11 +338,13 @@
if (bufferIsEmpty()) { return BUFFER_EMPTY; }
ReturnCode ret(PORT_OK);
- int readable = m_buffer->readable();
- int preskip(readable + m_leftskip);
- int loopcnt(preskip/(m_skipn +1));
- int postskip(m_skipn - m_leftskip);
- for (int i(0); i < loopcnt; ++i)
+ size_t readable = m_buffer->readable();
+ size_t preskip(readable + m_leftskip);
+ assert(m_skipn >= 0);
+ size_t loopcnt(preskip / (m_skipn + 1));
+ assert(m_skipn >= m_leftskip);
+ size_t postskip(m_skipn - m_leftskip);
+ for (size_t i(0); i < loopcnt; ++i)
{
m_buffer->advanceRptr(postskip);
readable -= postskip;
@@ -363,6 +365,7 @@
}
m_buffer->advanceRptr(readable);
+ assert(m_skipn >= 0);
m_leftskip = preskip % (m_skipn +1);
return ret;
More information about the openrtm-commit
mailing list