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