[openrtm-commit:02424] r2941 - branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 2月 10日 (金) 20:07:26 JST
Author: n-ando
Date: 2017-02-10 20:07:26 +0900 (Fri, 10 Feb 2017)
New Revision: 2941
Modified:
branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/Properties.cpp
branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/TimeMeasure.cpp
branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/crc.cpp
branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/stringutil.cpp
Log:
[compat,->DEV_IQ_2016] LDRA rule "Signed/unsigned conversion without cast." has been made a countermeasured. refs #3909
Modified: branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/Properties.cpp
===================================================================
--- branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/Properties.cpp 2017-02-10 10:15:30 UTC (rev 2940)
+++ branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/Properties.cpp 2017-02-10 11:07:26 UTC (rev 2941)
@@ -341,11 +341,11 @@
*/
void Properties::load(std::istream& inStream)
{
- std::string pline = std:s:tring();
+ std::string pline = std::string();
while (!inStream.eof())
{
- std::string tmp = std:s:tring();
+ std::string tmp = std::string();
coil::getlinePortable(inStream, tmp);
coil::eraseHeadBlank(tmp);
Modified: branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/TimeMeasure.cpp
===================================================================
--- branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/TimeMeasure.cpp 2017-02-10 10:15:30 UTC (rev 2940)
+++ branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/TimeMeasure.cpp 2017-02-10 11:07:26 UTC (rev 2941)
@@ -44,7 +44,7 @@
m_recurred(false)
{
m_record.reserve(m_countMax);
- for (unsigned long i(0); i < m_countMax; ++i)
+ for (unsigned long int i(0); i < m_countMax; ++i)
{
m_record.push_back(TimeValue(0, 0));
}
@@ -118,7 +118,8 @@
*/
unsigned long int TimeMeasure::count() const
{
- return m_recurred ? m_record.size() : m_count;
+ return m_recurred ?
+ static_cast<unsigned long int>(m_record.size()) : m_count;
}
/*!
@@ -140,7 +141,7 @@
double sq_sum = 0;
unsigned long int len(count());
- if (len == 0) return false;
+ if (len == 0UL) { return false; }
for (unsigned long int i(0); i < len; ++i)
{
Modified: branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/crc.cpp
===================================================================
--- branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/crc.cpp 2017-02-10 10:15:30 UTC (rev 2940)
+++ branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/crc.cpp 2017-02-10 11:07:26 UTC (rev 2941)
@@ -182,7 +182,7 @@
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
};
unsigned long c(0xffffffffL);
- for (int i(0); i < len; ++i)
+ for (size_t i(0); i < len; ++i)
{
c = crc32tab[(c ^ str[i]) & 0xff] ^ (c >> 8);
}
Modified: branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/stringutil.cpp
===================================================================
--- branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/stringutil.cpp 2017-02-10 10:15:30 UTC (rev 2940)
+++ branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/stringutil.cpp 2017-02-10 11:07:26 UTC (rev 2941)
@@ -135,9 +135,14 @@
*/
bool isEscaped(const std::string& str, std::string::size_type pos)
{
+ if (pos == 0) { return false; }
--pos;
- unsigned int i;
- for (i = 0; (pos >= 0) && str[pos] == '\\'; --pos, ++i) ;
+ size_t i = 0;
+ for ( ; (pos >= 0) && str[pos] == '\\'; ++i)
+ {
+ if (pos == 0) { break; }
+ --pos;
+ }
// If the number of \ is odd, delimiter is escaped.
return (i % 2) == 1;
}
More information about the openrtm-commit
mailing list