Commit b273c67e authored by Pavel Vainerman's avatar Pavel Vainerman

make style

parent a5721d59
...@@ -43,8 +43,9 @@ LogDB::LogDB( const string& name, int argc, const char* const* argv, const strin ...@@ -43,8 +43,9 @@ LogDB::LogDB( const string& name, int argc, const char* const* argv, const strin
std::string specconfig; std::string specconfig;
int i = uniset::findArgParam("--" + prefix + "single-confile", argc, argv); int i = uniset::findArgParam("--" + prefix + "single-confile", argc, argv);
if( i != -1 ) if( i != -1 )
specconfig = uniset::getArgParam("--" + prefix + "single-confile", argc, argv,""); specconfig = uniset::getArgParam("--" + prefix + "single-confile", argc, argv, "");
std::shared_ptr<UniXML> xml; std::shared_ptr<UniXML> xml;
...@@ -61,6 +62,7 @@ LogDB::LogDB( const string& name, int argc, const char* const* argv, const strin ...@@ -61,6 +62,7 @@ LogDB::LogDB( const string& name, int argc, const char* const* argv, const strin
{ {
cout << myname << "(init): init from single-confile " << specconfig << endl; cout << myname << "(init): init from single-confile " << specconfig << endl;
xml = make_shared<UniXML>(); xml = make_shared<UniXML>();
try try
{ {
xml->open(specconfig); xml->open(specconfig);
...@@ -159,8 +161,10 @@ LogDB::LogDB( const string& name, int argc, const char* const* argv, const strin ...@@ -159,8 +161,10 @@ LogDB::LogDB( const string& name, int argc, const char* const* argv, const strin
// l->tcp = make_shared<UTCPStream>(); // l->tcp = make_shared<UTCPStream>();
l->dblog = dblog; l->dblog = dblog;
if( !dbDisabled ) if( !dbDisabled )
l->signal_on_read().connect(sigc::mem_fun(this, &LogDB::addLog)); l->signal_on_read().connect(sigc::mem_fun(this, &LogDB::addLog));
// l->set(loop); // l->set(loop);
logservers.push_back(l); logservers.push_back(l);
...@@ -1097,6 +1101,7 @@ void LogDB::onWebSocketSession(Poco::Net::HTTPServerRequest& req, Poco::Net::HTT ...@@ -1097,6 +1101,7 @@ void LogDB::onWebSocketSession(Poco::Net::HTTPServerRequest& req, Poco::Net::HTT
{ {
uniset_rwmutex_rlock lk(wsocksMutex); uniset_rwmutex_rlock lk(wsocksMutex);
if( wsocks.size() >= maxwsocks ) if( wsocks.size() >= maxwsocks )
{ {
resp.setStatus(HTTPResponse::HTTP_SERVICE_UNAVAILABLE); resp.setStatus(HTTPResponse::HTTP_SERVICE_UNAVAILABLE);
......
...@@ -58,7 +58,7 @@ namespace uniset ...@@ -58,7 +58,7 @@ namespace uniset
} }
explicit lsMessage( Command c, uint d, const std::string& logname ): explicit lsMessage( Command c, uint d, const std::string& logname ):
magic(MAGICNUM),cmd(c),data(d) magic(MAGICNUM), cmd(c), data(d)
{ {
setLogName(logname); setLogName(logname);
} }
......
...@@ -515,7 +515,7 @@ namespace uniset ...@@ -515,7 +515,7 @@ namespace uniset
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
std::string Configuration::getArg2Param( const std::string& name, const std::string& defval, const std::string& defval2 ) const noexcept std::string Configuration::getArg2Param( const std::string& name, const std::string& defval, const std::string& defval2 ) const noexcept
{ {
return uniset::getArg2Param(name,_argc,_argv,defval,defval2); return uniset::getArg2Param(name, _argc, _argv, defval, defval2);
} }
string Configuration::getArgParam( const string& name, const string& defval ) const noexcept string Configuration::getArgParam( const string& name, const string& defval ) const noexcept
...@@ -530,12 +530,12 @@ namespace uniset ...@@ -530,12 +530,12 @@ namespace uniset
int Configuration::getArgPInt( const string& name, int defval ) const noexcept int Configuration::getArgPInt( const string& name, int defval ) const noexcept
{ {
return uniset::getArgPInt(name,_argc,_argv,"",defval); return uniset::getArgPInt(name, _argc, _argv, "", defval);
} }
int Configuration::getArgPInt( const string& name, const string& strdefval, int defval ) const noexcept int Configuration::getArgPInt( const string& name, const string& strdefval, int defval ) const noexcept
{ {
return uniset::getArgPInt(name,_argc,_argv,strdefval,defval); return uniset::getArgPInt(name, _argc, _argv, strdefval, defval);
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
......
...@@ -628,7 +628,7 @@ timespec uniset::now_to_timespec() ...@@ -628,7 +628,7 @@ timespec uniset::now_to_timespec()
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
char uniset::checkBadSymbols( const string& str ) char uniset::checkBadSymbols( const string& str )
{ {
for ( const auto& c: str ) for ( const auto& c : str )
{ {
for( size_t k = 0; k < sizeof(BadSymbols); k++ ) for( size_t k = 0; k < sizeof(BadSymbols); k++ )
{ {
......
...@@ -96,22 +96,24 @@ namespace uniset ...@@ -96,22 +96,24 @@ namespace uniset
{ {
vector<lsMessage> vcmd; vector<lsMessage> vcmd;
auto v = uniset::explode_str(cmd,' '); auto v = uniset::explode_str(cmd, ' ');
if( v.empty() ) if( v.empty() )
return vcmd; return vcmd;
for( size_t i=0; i < v.size(); i++ ) for( size_t i = 0; i < v.size(); i++ )
{ {
auto c = v[i]; auto c = v[i];
string arg1 = checkArg(i+1, v); string arg1 = checkArg(i + 1, v);
if( arg1.empty() ) if( arg1.empty() )
continue; continue;
i++; i++;
std::string filter = checkArg(i+2,v); std::string filter = checkArg(i + 2, v);
if( !filter.empty() ) if( !filter.empty() )
i++; i++;
......
...@@ -293,16 +293,16 @@ TEST_CASE("UniSetTypes: getArgParam", "[utypes][getArgParam]" ) ...@@ -293,16 +293,16 @@ TEST_CASE("UniSetTypes: getArgParam", "[utypes][getArgParam]" )
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
TEST_CASE("UniSetTypes: getArg2Param", "[utypes][getArg2Param]" ) TEST_CASE("UniSetTypes: getArg2Param", "[utypes][getArg2Param]" )
{ {
// inline std::string getArg2Param(const std::string& name, // inline std::string getArg2Param(const std::string& name,
// int _argc, const char* const* _argv, // int _argc, const char* const* _argv,
// const std::string& defval, const std::string& defval2 = "") noexcept // const std::string& defval, const std::string& defval2 = "") noexcept
int argc = 5; int argc = 5;
char* argv[] = {"progname", "--param1", "val", "--param2", "val2"}; char* argv[] = {"progname", "--param1", "val", "--param2", "val2"};
REQUIRE( getArg2Param("--param1", argc, argv, "") == "val" ); REQUIRE( getArg2Param("--param1", argc, argv, "") == "val" );
REQUIRE( getArg2Param("--param2", argc, argv, "") == "val2" ); REQUIRE( getArg2Param("--param2", argc, argv, "") == "val2" );
REQUIRE( getArg2Param("--unknownparam", argc, argv, "val3") == "val3" ); REQUIRE( getArg2Param("--unknownparam", argc, argv, "val3") == "val3" );
REQUIRE( getArg2Param("--unknownparam2", argc, argv,"","val4") == "val4" ); REQUIRE( getArg2Param("--unknownparam2", argc, argv, "", "val4") == "val4" );
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
TEST_CASE("UniSetTypes: getArgInt", "[utypes][getArgInt]" ) TEST_CASE("UniSetTypes: getArgInt", "[utypes][getArgInt]" )
...@@ -320,9 +320,9 @@ TEST_CASE("UniSetTypes: getArgInt", "[utypes][getArgInt]" ) ...@@ -320,9 +320,9 @@ TEST_CASE("UniSetTypes: getArgInt", "[utypes][getArgInt]" )
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
TEST_CASE("UniSetTypes: getArgPInt", "[utypes][getArgPInt]" ) TEST_CASE("UniSetTypes: getArgPInt", "[utypes][getArgPInt]" )
{ {
// inline int getArgPInt( const std::string& name, // inline int getArgPInt( const std::string& name,
// int _argc, const char* const* _argv, // int _argc, const char* const* _argv,
// const std::string& strdefval, int defval ) noexcept // const std::string& strdefval, int defval ) noexcept
int argc = 5; int argc = 5;
char* argv[] = {"progname", "--param1", "1", "--param2", "text"}; char* argv[] = {"progname", "--param1", "1", "--param2", "text"};
......
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