Commit 3e7399b5 authored by Pavel Vainerman's avatar Pavel Vainerman

(step 3): fixes after coverity scan

parent 3f7e7fad
...@@ -422,12 +422,6 @@ void MBTCPMultiMaster::MBSlaveInfo::setUse( bool st ) ...@@ -422,12 +422,6 @@ void MBTCPMultiMaster::MBSlaveInfo::setUse( bool st )
use = st; use = st;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool MBTCPMultiMaster::MBSlaveInfo::isUse()
{
std::lock_guard<std::mutex> l(mutInit);
return use;
}
// -----------------------------------------------------------------------------
bool MBTCPMultiMaster::MBSlaveInfo::init( std::shared_ptr<DebugStream>& mblog ) bool MBTCPMultiMaster::MBSlaveInfo::init( std::shared_ptr<DebugStream>& mblog )
{ {
std::lock_guard<std::mutex> l(mutInit); std::lock_guard<std::mutex> l(mutInit);
...@@ -543,7 +537,11 @@ void MBTCPMultiMaster::check_thread() ...@@ -543,7 +537,11 @@ void MBTCPMultiMaster::check_thread()
{ {
bool set = it->respond_invert ? !r : r; bool set = it->respond_invert ? !r : r;
shm->localSetValue(it->respond_it, it->respond_id, (set ? 1 : 0), getId()); shm->localSetValue(it->respond_it, it->respond_id, (set ? 1 : 0), getId());
it->respond_init = true;
{
std::lock_guard<std::mutex> l(it->mutInit);
it->respond_init = true;
}
} }
} }
catch( const uniset::Exception& ex ) catch( const uniset::Exception& ex )
......
...@@ -354,7 +354,6 @@ namespace uniset ...@@ -354,7 +354,6 @@ namespace uniset
bool init( std::shared_ptr<DebugStream>& mblog ); bool init( std::shared_ptr<DebugStream>& mblog );
bool check(); bool check();
void setUse( bool st ); void setUse( bool st );
bool isUse();
timeout_t recv_timeout; timeout_t recv_timeout;
timeout_t aftersend_pause; timeout_t aftersend_pause;
......
...@@ -63,7 +63,7 @@ namespace uniset ...@@ -63,7 +63,7 @@ namespace uniset
std::mutex looprunOK_mutex; std::mutex looprunOK_mutex;
std::condition_variable looprunOK_event; std::condition_variable looprunOK_event;
std::atomic_bool isrunning; std::atomic_bool isrunning = { false };
ev::timer evruntimer; ev::timer evruntimer;
}; };
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
......
...@@ -757,7 +757,9 @@ namespace uniset ...@@ -757,7 +757,9 @@ namespace uniset
void ReadInputStatusMessage::init( const ModbusMessage& m ) void ReadInputStatusMessage::init( const ModbusMessage& m )
{ {
assert( m.pduhead.func == fnReadInputStatus ); assert( m.pduhead.func == fnReadInputStatus );
memcpy(this, &(m.pduhead), sizeof(m.pduhead) + szData()); func = m.pduhead.func;
addr = m.pduhead.addr;
memcpy(&start, &m.data, szData());
// переворачиваем слова // переворачиваем слова
start = SWAPSHORT(start); start = SWAPSHORT(start);
......
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