Commit a912367c authored by Pavel Vainerman's avatar Pavel Vainerman

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

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