git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use C++03 in cppcheck.
[stg.git]
/
projects
/
stargazer
/
plugins
/
other
/
rscript
/
rscript.cpp
diff --git
a/projects/stargazer/plugins/other/rscript/rscript.cpp
b/projects/stargazer/plugins/other/rscript/rscript.cpp
index 00114df4c501fa0cd4aa6e3d7fc2031d8e7dc3ed..1e842d255865925fa642d0cdaeb50502f7da2e25 100644
(file)
--- a/
projects/stargazer/plugins/other/rscript/rscript.cpp
+++ b/
projects/stargazer/plugins/other/rscript/rscript.cpp
@@
-19,14
+19,10
@@
* Author : Maxim Mamontov <faust@stargazer.dp.ua>
*/
* Author : Maxim Mamontov <faust@stargazer.dp.ua>
*/
-#include
<sys/time.h>
+#include
"rscript.h"
-#include <csignal>
-#include <cassert>
-#include <cstdlib>
-#include <cerrno>
-#include <cstring>
-#include <algorithm>
+#include "ur_functor.h"
+#include "send_functor.h"
#include "stg/common.h"
#include "stg/locker.h"
#include "stg/common.h"
#include "stg/locker.h"
@@
-34,9
+30,17
@@
#include "stg/user_property.h"
#include "stg/plugin_creator.h"
#include "stg/logger.h"
#include "stg/user_property.h"
#include "stg/plugin_creator.h"
#include "stg/logger.h"
-#include "rscript.h"
-#include "ur_functor.h"
-#include "send_functor.h"
+
+#include <algorithm>
+
+#include <csignal>
+#include <cassert>
+#include <cstdlib>
+#include <cerrno>
+#include <cstring>
+
+#include <sys/time.h>
+#include <netinet/ip.h>
extern volatile time_t stgTime;
extern volatile time_t stgTime;
@@
-47,7
+51,7
@@
namespace {
template<typename T>
struct USER_IS
{
template<typename T>
struct USER_IS
{
- USER_IS(USER_PTR u) : user(u) {}
+
explicit
USER_IS(USER_PTR u) : user(u) {}
bool operator()(const T & notifier) { return notifier.GetUser() == user; }
USER_PTR user;
bool operator()(const T & notifier) { return notifier.GetUser() == user; }
USER_PTR user;
@@
-73,12
+77,7
@@
return rsc.GetPlugin();
//-----------------------------------------------------------------------------
RS::SETTINGS::SETTINGS()
: sendPeriod(0),
//-----------------------------------------------------------------------------
RS::SETTINGS::SETTINGS()
: sendPeriod(0),
- port(0),
- errorStr(),
- netRouters(),
- userParams(),
- password(),
- subnetFile()
+ port(0)
{
}
//-----------------------------------------------------------------------------
{
}
//-----------------------------------------------------------------------------
@@
-91,7
+90,7
@@
netRouters.clear();
///////////////////////////
pv.param = "Port";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
///////////////////////////
pv.param = "Port";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end()
|| pvi->value.empty()
)
{
errorStr = "Parameter \'Port\' not found.";
printfd(__FILE__, "Parameter 'Port' not found\n");
{
errorStr = "Parameter \'Port\' not found.";
printfd(__FILE__, "Parameter 'Port' not found\n");
@@
-107,7
+106,7
@@
port = static_cast<uint16_t>(p);
///////////////////////////
pv.param = "SendPeriod";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
///////////////////////////
pv.param = "SendPeriod";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end()
|| pvi->value.empty()
)
{
errorStr = "Parameter \'SendPeriod\' not found.";
printfd(__FILE__, "Parameter 'SendPeriod' not found\n");
{
errorStr = "Parameter \'SendPeriod\' not found.";
printfd(__FILE__, "Parameter 'SendPeriod' not found\n");
@@
-123,7
+122,7
@@
if (ParseIntInRange(pvi->value[0], 5, 600, &sendPeriod))
///////////////////////////
pv.param = "UserParams";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
///////////////////////////
pv.param = "UserParams";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end()
|| pvi->value.empty()
)
{
errorStr = "Parameter \'UserParams\' not found.";
printfd(__FILE__, "Parameter 'UserParams' not found\n");
{
errorStr = "Parameter \'UserParams\' not found.";
printfd(__FILE__, "Parameter 'UserParams' not found\n");
@@
-133,7
+132,7
@@
userParams = pvi->value;
///////////////////////////
pv.param = "Password";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
///////////////////////////
pv.param = "Password";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end()
|| pvi->value.empty()
)
{
errorStr = "Parameter \'Password\' not found.";
printfd(__FILE__, "Parameter 'Password' not found\n");
{
errorStr = "Parameter \'Password\' not found.";
printfd(__FILE__, "Parameter 'Password' not found\n");
@@
-143,7
+142,7
@@
password = pvi->value[0];
///////////////////////////
pv.param = "SubnetFile";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
///////////////////////////
pv.param = "SubnetFile";
pvi = find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-if (pvi == s.moduleParams.end())
+if (pvi == s.moduleParams.end()
|| pvi->value.empty()
)
{
errorStr = "Parameter \'SubnetFile\' not found.";
printfd(__FILE__, "Parameter 'SubnetFile' not found\n");
{
errorStr = "Parameter \'SubnetFile\' not found.";
printfd(__FILE__, "Parameter 'SubnetFile' not found\n");
@@
-301,7
+300,7
@@
if (isRunning)
return 0;
}
//-----------------------------------------------------------------------------
return 0;
}
//-----------------------------------------------------------------------------
-int REMOTE_SCRIPT::Reload()
+int REMOTE_SCRIPT::Reload(
const MODULE_SETTINGS & /*ms*/
)
{
NRMapParser nrMapParser;
{
NRMapParser nrMapParser;