Commit a912367c authored by Pavel Vainerman's avatar Pavel Vainerman

Правки по результатам скинирования coverity_scan

parent f6103f6a
......@@ -14,7 +14,7 @@
Name: libuniset2
Version: 2.3
Release: alt4
Release: alt5
Summary: UniSet - library for building distributed industrial control systems
License: LGPL
......@@ -483,6 +483,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# ..
%changelog
* Wed May 11 2016 Pavel Vainerman <pv@altlinux.ru> 2.3-alt5
- fixes after coverity_scan
* Thu Apr 28 2016 Pavel Vainerman <pv@altlinux.ru> 2.3-alt4
- build new version
......
......@@ -211,23 +211,24 @@ MBSlave::MBSlave(UniSetTypes::ObjectId objId, UniSetTypes::ObjectId shmId, const
tcpserver->setLog(l);
conf->initLogStream(l, prefix + "-exchangelog");
updateStatTime = conf->getArgInt("--" + prefix + "-update-stat-time", it.getProp("updateStatTime"));
int tmpval = conf->getArgInt("--" + prefix + "-update-stat-time", it.getProp("updateStatTime"));
if( updateStatTime == 0 )
updateStatTime = 4000;
if( tmpval > 0 )
updateStatTime = tmpval;
vmonit(updateStatTime);
sessTimeout = conf->getArgInt("--" + prefix + "-session-timeout", it.getProp("sessTimeout"));
if( sessTimeout == 0 )
sessTimeout = 2000;
tmpval = conf->getArgInt("--" + prefix + "-session-timeout", it.getProp("sessTimeout"));
if( tmpval > 0 )
sessTimeout = tmpval;
vmonit(sessTimeout);
sessMaxNum = conf->getArgInt("--" + prefix + "-session-maxnum", it.getProp("sessMaxNum"));
tmpval = conf->getArgInt("--" + prefix + "-session-maxnum", it.getProp("sessMaxNum"));
if( sessMaxNum == 0 )
sessMaxNum = 5;
if( tmpval > 0 )
sessMaxNum = tmpval;
vmonit(sessMaxNum);
......
......@@ -578,11 +578,11 @@ class MBSlave:
// TCPServer section..
void initTCPClients( UniXML::iterator confnode );
timeout_t sessTimeout; /*!< таймаут на сессию */
timeout_t updateStatTime;
timeout_t sessTimeout = { 2000 }; /*!< таймаут на сессию */
timeout_t updateStatTime = { 4000 };
ModbusTCPServer::Sessions sess; /*!< список открытых сессий */
UniSetTypes::uniset_mutex sessMutex;
unsigned int sessMaxNum;
unsigned int sessMaxNum = { 5 };
std::shared_ptr<ModbusTCPServerSlot> tcpserver;
struct ClientInfo
......@@ -593,7 +593,7 @@ class MBSlave:
ptTimeout.setTiming(0);
}
std::string iaddr;
std::string iaddr = { "" };
UniSetTypes::ObjectId respond_s = { UniSetTypes::DefaultObjectId };
IOController::IOStateList::iterator respond_it;
......@@ -601,7 +601,7 @@ class MBSlave:
PassiveTimer ptTimeout;
timeout_t tout = { 2000 };
long askCount;
long askCount = { 0 };
UniSetTypes::ObjectId askcount_s = { UniSetTypes::DefaultObjectId };
IOController::IOStateList::iterator askcount_it;
......@@ -617,7 +617,7 @@ class MBSlave:
typedef std::unordered_map<std::string, ClientInfo> ClientsMap;
ClientsMap cmap;
UniSetTypes::ObjectId sesscount_id;
UniSetTypes::ObjectId sesscount_id = { UniSetTypes::DefaultObjectId };
IOController::IOStateList::iterator sesscount_it;
std::atomic_bool tcpCancelled = { true };
......
......@@ -6,8 +6,7 @@ using namespace std;
using namespace UniSetTypes;
// -----------------------------------------------------------------------------
TestProc::TestProc( UniSetTypes::ObjectId id, xmlNode* confnode ):
TestProc_SK( id, confnode ),
state(false)
TestProc_SK( id, confnode )
{
loglevels.push_back(Debug::INFO);
loglevels.push_back(Debug::WARN);
......
......@@ -35,8 +35,8 @@ class TestProc:
void test_loglevel();
private:
bool state;
bool undef;
bool state = { false };
bool undef = { false };
std::vector<Debug::type> loglevels;
std::vector<Debug::type>::iterator lit;
......
......@@ -142,9 +142,9 @@ class LogServer:
size_t scount = { 0 };
UniSetTypes::uniset_rwmutex mutSList;
timeout_t timeout;
timeout_t cmdTimeout;
Debug::type sessLogLevel;
timeout_t timeout = { TIMEOUT_INF };
timeout_t cmdTimeout = { 2000 };
Debug::type sessLogLevel = { Debug::NONE };
size_t sessMaxCount = { 10 };
DebugStream mylog;
......@@ -163,8 +163,8 @@ class LogServer:
std::unordered_map< DebugStream*,Debug::type > defaultLogLevels;
std::string myname = { "LogServer" };
std::string addr;
ost::tpport_t port;
std::string addr = { "" };
ost::tpport_t port = { 0 };
std::atomic_bool isrunning = { false };
};
......
......@@ -315,13 +315,13 @@ class ModbusServer
ModbusRTU::mbErrCode recv_pdu( ModbusRTU::ModbusMessage& rbuf, timeout_t timeout );
UniSetTypes::uniset_mutex recvMutex;
timeout_t recvTimeOut_ms; /*!< таймаут на приём */
timeout_t replyTimeout_ms; /*!< таймаут на формирование ответа */
timeout_t aftersend_msec; /*!< пауза после посылки ответа */
timeout_t sleepPause_msec; /*!< пауза между попытками чтения символа из канала */
bool onBroadcast; /*!< включен режим работы с broadcst-сообщениями */
bool crcNoCheckit;
bool cleanBeforeSend;
timeout_t recvTimeOut_ms = { 50 }; /*!< таймаут на приём */
timeout_t replyTimeout_ms = { 2000 }; /*!< таймаут на формирование ответа */
timeout_t aftersend_msec = { 0 }; /*!< пауза после посылки ответа */
timeout_t sleepPause_msec = { 10 }; /*!< пауза между попытками чтения символа из канала */
bool onBroadcast = { false }; /*!< включен режим работы с broadcst-сообщениями */
bool crcNoCheckit = { false };
bool cleanBeforeSend = { false };
void printProcessingTime();
PassiveTimer tmProcessing;
......@@ -329,7 +329,7 @@ class ModbusServer
std::shared_ptr<DebugStream> dlog;
// статистика сервера
size_t askCount;
size_t askCount = { 0 };
ExchangeErrorMap errmap; /*!< статистика ошибок обмена */
PreReceiveSignal m_pre_signal;
......
......@@ -154,7 +154,7 @@ class ModbusTCPServer:
ev::timer ioTimer;
std::shared_ptr<UTCPSocket> sock;
const std::unordered_set<ModbusRTU::ModbusAddr>* vmbaddr;
const std::unordered_set<ModbusRTU::ModbusAddr>* vmbaddr = { nullptr };
TimerSignal m_timer_signal;
timeout_t tmTime_msec = { TIMEOUT_INF }; // время по умолчанию для таймера (TimerSignal)
......
......@@ -576,7 +576,7 @@ std::string UniSetTypes::replace_all( const std::string& src, const std::string&
if( from.empty() )
return std::move(res);
size_t pos = res.find(from, pos);
size_t pos = res.find(from, 0);
while( pos != std::string::npos )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment