[openrtm-commit:02429] r2945 - in branches/DEV_IQ_2016/OpenRTM-aist/src/lib: coil/common rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 2月 11日 (土) 12:19:41 JST
Author: n-ando
Date: 2017-02-11 12:19:40 +0900 (Sat, 11 Feb 2017)
New Revision: 2945
Modified:
branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/Properties.cpp
branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/Properties.h
branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/ManagerConfig.cpp
branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp
Log:
[compat,->DEV_IQ_2016] LDRA rule "Array passed as actual parameter." 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-11 02:08:18 UTC (rev 2944)
+++ branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/Properties.cpp 2017-02-11 03:19:40 UTC (rev 2945)
@@ -72,7 +72,7 @@
* @brief Constructor(Give the default value with char*[])
* @endif
*/
- Properties::Properties(const char* defaults[], long num)
+ Properties::Properties(const char** defaults, long num)
: name(""), value(""), default_value(""), root(NULL), m_empty("")
{
leaf.clear();
Modified: branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/Properties.h
===================================================================
--- branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/Properties.h 2017-02-11 02:08:18 UTC (rev 2944)
+++ branches/DEV_IQ_2016/OpenRTM-aist/src/lib/coil/common/Properties.h 2017-02-11 03:19:40 UTC (rev 2945)
@@ -207,7 +207,7 @@
*
* @endif
*/
- explicit Properties(const char* defaults[], long num = LONG_MAX);
+ explicit Properties(const char** defaults, long num = LONG_MAX);
/*!
* @if jp
Modified: branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/ManagerConfig.cpp
===================================================================
--- branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/ManagerConfig.cpp 2017-02-11 02:08:18 UTC (rev 2944)
+++ branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/ManagerConfig.cpp 2017-02-11 03:19:40 UTC (rev 2945)
@@ -246,15 +246,14 @@
// Getting current proccess pid by using ACE_OS::getpid() (UNIX/Windows)
//
coil::pid_t pid = coil::getpid();
- char pidc[8];
- sprintf(pidc, "%d", pid);
+ std::string pidc = coil::otos(pid);
prop.setProperty("os.name", sysinfo.sysname);
prop.setProperty("os.release", sysinfo.release);
prop.setProperty("os.version", sysinfo.version);
prop.setProperty("os.arch", sysinfo.machine);
prop.setProperty("os.hostname", sysinfo.nodename);
- prop.setProperty("manager.pid", pidc);
+ prop.setProperty("manager.pid", pidc);
return;
}
Modified: branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp
===================================================================
--- branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp 2017-02-11 02:08:18 UTC (rev 2944)
+++ branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/SystemLogger.cpp 2017-02-11 03:19:40 UTC (rev 2945)
@@ -15,10 +15,12 @@
* $Id: SystemLogger.cpp 845 2008-09-25 11:10:40Z n-ando $
*
*/
-
#include <rtm/SystemLogger.h>
#include <rtm/Manager.h>
+#include <sstream>
+#include <iomanip>
+
#if defined(_MSC_VER)
#define snprintf _snprintf
#endif
@@ -166,27 +168,17 @@
if (m_msEnable > 0)
{
- char msec[4];
-#ifdef WIN32
- _snprintf(msec, sizeof(msec), "%03d",
- static_cast<int>(tm.usec() / 1000));
-#else
- snprintf(msec, sizeof(msec), "%03d",
- static_cast<int>(tm.usec() / 1000));
-#endif
- coil::replaceString(fmt, "#m#", msec);
+ std::stringstream msec("");
+ msec << std::setfill('0') << std::setw(3);
+ msec << static_cast<int>(tm.usec() / 1000);
+ coil::replaceString(fmt, "#m#", msec.str());
}
if (m_usEnable > 0)
{
- char usec[4];
-#ifdef WIN32
- _snprintf(usec, sizeof(usec), "%03d",
- static_cast<int>(tm.usec() - ((tm.usec() / 1000) * 1000)));
-#else
- snprintf(usec, sizeof(usec), "%03d",
- static_cast<int>(tm.usec() - ((tm.usec() / 1000) * 1000)));
-#endif
- coil::replaceString(fmt, "#u#", usec);
+ std::stringstream usec("");
+ usec << std::setfill('0') << std::setw(3);
+ usec << static_cast<int>(tm.usec() - ((tm.usec() / 1000) * 1000));
+ coil::replaceString(fmt, "#u#", usec.str());
}
return fmt;
More information about the openrtm-commit
mailing list