Commit 17961ed1 authored by Pavel Vainerman's avatar Pavel Vainerman

Очередные исправления по результатам проверки Coverity

parent f7e16de5
...@@ -270,7 +270,7 @@ void MBExchange::waitSMReady() ...@@ -270,7 +270,7 @@ void MBExchange::waitSMReady()
// waiting for SM is ready... // waiting for SM is ready...
int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "15000"); int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "15000");
timeout_t ready_timeout = 15000; timeout_t ready_timeout = 15000;
if( ready_timeout > 0 ) if( tout > 0 )
ready_timeout = tout; ready_timeout = tout;
else if( tout < 0 ) else if( tout < 0 )
ready_timeout = UniSetTimer::WaitUpTime; ready_timeout = UniSetTimer::WaitUpTime;
......
...@@ -463,7 +463,7 @@ void MBSlave::waitSMReady() ...@@ -463,7 +463,7 @@ void MBSlave::waitSMReady()
// waiting for SM is ready... // waiting for SM is ready...
int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "15000"); int tout = uniset_conf()->getArgInt("--" + prefix + "-sm-ready-timeout", "15000");
timeout_t ready_timeout = 15000; timeout_t ready_timeout = 15000;
if( ready_timeout > 0 ) if( tout > 0 )
ready_timeout = tout; ready_timeout = tout;
else if( tout < 0 ) else if( tout < 0 )
ready_timeout = UniSetTimer::WaitUpTime; ready_timeout = UniSetTimer::WaitUpTime;
......
...@@ -165,7 +165,7 @@ TEST_CASE("[UNetUDP]: UDPMessage", "[unetudp][udpmessage]") ...@@ -165,7 +165,7 @@ TEST_CASE("[UNetUDP]: UDPMessage", "[unetudp][udpmessage]")
size_t len = u.transport_msg(p); size_t len = u.transport_msg(p);
CHECK( len != 0 ); CHECK( len != 0 );
REQUIRE( a < UniSetUDP::MaxACount ); REQUIRE( a < UniSetUDP::MaxACount );
REQUIRE( a < UniSetUDP::MaxDCount ); REQUIRE( d < UniSetUDP::MaxDCount );
UniSetUDP::UDPMessage u2(p); UniSetUDP::UDPMessage u2(p);
REQUIRE( u2.a_dat[a].id == 100 ); REQUIRE( u2.a_dat[a].id == 100 );
......
...@@ -56,14 +56,6 @@ static bool split_addr( const string& addr, string& host, ost::tpport_t& port ) ...@@ -56,14 +56,6 @@ static bool split_addr( const string& addr, string& host, ost::tpport_t& port )
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
size_t n = UniSetUDP::MaxPacketNum;
cout << "n=" << n << endl;
n++;
cout << "n++=" << n << endl;
return 0;
int optindex = 0; int optindex = 0;
int opt = 0; int opt = 0;
Command cmd = cmdNOP; Command cmd = cmdNOP;
...@@ -332,7 +324,9 @@ int main(int argc, char* argv[]) ...@@ -332,7 +324,9 @@ int main(int argc, char* argv[])
{ {
mypack.num = packetnum++; mypack.num = packetnum++;
if( packetnum > UniSetUDP::MaxPacketNum ) // при переходе черех максимум (UniSetUDP::MaxPacketNum)
// пакет опять должен иметь номер "1"
if( packetnum == 0 )
packetnum = 1; packetnum = 1;
try try
......
...@@ -19,9 +19,9 @@ int main( int argc, char* argv[] ) ...@@ -19,9 +19,9 @@ int main( int argc, char* argv[] )
return session.run(); return session.run();
} }
catch( UniSetTypes::Exception& ex ) catch( const std::exception& ex )
{ {
std::cerr << ex << std::endl; std::cerr << ex.what() << std::endl;
} }
return 1; return 1;
......
...@@ -113,7 +113,7 @@ TEST_CASE("UniXML::iterator", "[unixml][iterator][basic]" ) ...@@ -113,7 +113,7 @@ TEST_CASE("UniXML::iterator", "[unixml][iterator][basic]" )
REQUIRE( sIt.getProp("name") == "Test5" ); REQUIRE( sIt.getProp("name") == "Test5" );
it = uxml.begin(); it = uxml.begin();
it.goChildren(); REQUIRE( it.goChildren() == true );
CHECK( it.getName() == "UserData" ); CHECK( it.getName() == "UserData" );
it.goParent(); it.goParent();
CHECK( it.getName() == "UNISETPLC" ); CHECK( it.getName() == "UNISETPLC" );
......
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