mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 23:24:09 +02:00
Merge pull request #9731 from Icinga/fix-compiler-warnings-by-copy-constructing-loop-variables-explicitly
Fix compiler warnings by (copy-)constructing loop variables explicitly or not at all
This commit is contained in:
commit
ec2080dcc1
@ -237,7 +237,7 @@ endif()
|
|||||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_FULL_LIBDIR}/icinga2")
|
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_FULL_LIBDIR}/icinga2")
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Winconsistent-missing-override")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Winconsistent-missing-override -Wrange-loop-construct")
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -fcolor-diagnostics -fno-limit-debug-info")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -fcolor-diagnostics -fno-limit-debug-info")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics -fno-limit-debug-info")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics -fno-limit-debug-info")
|
||||||
@ -258,6 +258,10 @@ endif()
|
|||||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override")
|
||||||
|
|
||||||
|
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER_EQUAL "11.0.0")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wrange-loop-construct")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES AIX)
|
if(CMAKE_SYSTEM_NAME MATCHES AIX)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -lpthread")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -lpthread")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -lpthread")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -lpthread")
|
||||||
|
@ -401,7 +401,7 @@ static int Main()
|
|||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
if (vm.count("define")) {
|
if (vm.count("define")) {
|
||||||
for (const String& define : vm["define"].as<std::vector<std::string> >()) {
|
for (String define : vm["define"].as<std::vector<std::string>>()) {
|
||||||
String key, value;
|
String key, value;
|
||||||
size_t pos = define.FindFirstOf('=');
|
size_t pos = define.FindFirstOf('=');
|
||||||
if (pos != String::NPos) {
|
if (pos != String::NPos) {
|
||||||
@ -460,7 +460,7 @@ static int Main()
|
|||||||
ConfigCompiler::AddIncludeSearchDir(Configuration::IncludeConfDir);
|
ConfigCompiler::AddIncludeSearchDir(Configuration::IncludeConfDir);
|
||||||
|
|
||||||
if (!autocomplete && vm.count("include")) {
|
if (!autocomplete && vm.count("include")) {
|
||||||
for (const String& includePath : vm["include"].as<std::vector<std::string> >()) {
|
for (String includePath : vm["include"].as<std::vector<std::string>>()) {
|
||||||
ConfigCompiler::AddIncludeSearchDir(includePath);
|
ConfigCompiler::AddIncludeSearchDir(includePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -643,8 +643,7 @@ void Process::IOThreadProc(int tid)
|
|||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
typedef std::pair<ProcessHandle, Process::Ptr> kv_pair;
|
for (auto& kv : l_Processes[tid]) {
|
||||||
for (const kv_pair& kv : l_Processes[tid]) {
|
|
||||||
const Process::Ptr& process = kv.second;
|
const Process::Ptr& process = kv.second;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
handles[i] = kv.first;
|
handles[i] = kv.first;
|
||||||
|
@ -124,7 +124,7 @@ bool ScriptUtils::Regex(const std::vector<Value>& args)
|
|||||||
if (texts->GetLength() == 0)
|
if (texts->GetLength() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (const String& text : texts) {
|
for (String text : texts) {
|
||||||
bool res = false;
|
bool res = false;
|
||||||
try {
|
try {
|
||||||
boost::smatch what;
|
boost::smatch what;
|
||||||
@ -177,7 +177,7 @@ bool ScriptUtils::Match(const std::vector<Value>& args)
|
|||||||
if (texts->GetLength() == 0)
|
if (texts->GetLength() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (const String& text : texts) {
|
for (String text : texts) {
|
||||||
bool res = Utility::Match(pattern, text);
|
bool res = Utility::Match(pattern, text);
|
||||||
|
|
||||||
if (mode == MatchAny && res)
|
if (mode == MatchAny && res)
|
||||||
@ -223,7 +223,7 @@ bool ScriptUtils::CidrMatch(const std::vector<Value>& args)
|
|||||||
if (ips->GetLength() == 0)
|
if (ips->GetLength() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (const String& ip : ips) {
|
for (String ip : ips) {
|
||||||
bool res = Utility::CidrMatch(pattern, ip);
|
bool res = Utility::CidrMatch(pattern, ip);
|
||||||
|
|
||||||
if (mode == MatchAny && res)
|
if (mode == MatchAny && res)
|
||||||
|
@ -121,7 +121,7 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs,
|
|||||||
ConfigCompilerContext::GetInstance()->OpenObjectsFile(objectsFile);
|
ConfigCompilerContext::GetInstance()->OpenObjectsFile(objectsFile);
|
||||||
|
|
||||||
if (!configs.empty()) {
|
if (!configs.empty()) {
|
||||||
for (const String& configPath : configs) {
|
for (String configPath : configs) {
|
||||||
try {
|
try {
|
||||||
std::unique_ptr<Expression> expression = ConfigCompiler::CompileFile(configPath, String(), "_etc");
|
std::unique_ptr<Expression> expression = ConfigCompiler::CompileFile(configPath, String(), "_etc");
|
||||||
success = ExecuteExpression(&*expression);
|
success = ExecuteExpression(&*expression);
|
||||||
|
@ -58,7 +58,7 @@ int FeatureUtility::EnableFeatures(const std::vector<std::string>& features)
|
|||||||
|
|
||||||
std::vector<std::string> errors;
|
std::vector<std::string> errors;
|
||||||
|
|
||||||
for (const String& feature : features) {
|
for (auto& feature : features) {
|
||||||
String source = features_available_dir + "/" + feature + ".conf";
|
String source = features_available_dir + "/" + feature + ".conf";
|
||||||
|
|
||||||
if (!Utility::PathExists(source) ) {
|
if (!Utility::PathExists(source) ) {
|
||||||
@ -126,7 +126,7 @@ int FeatureUtility::DisableFeatures(const std::vector<std::string>& features)
|
|||||||
|
|
||||||
std::vector<std::string> errors;
|
std::vector<std::string> errors;
|
||||||
|
|
||||||
for (const String& feature : features) {
|
for (auto& feature : features) {
|
||||||
String target = features_enabled_dir + "/" + feature + ".conf";
|
String target = features_enabled_dir + "/" + feature + ".conf";
|
||||||
|
|
||||||
if (!Utility::PathExists(target) ) {
|
if (!Utility::PathExists(target) ) {
|
||||||
|
@ -47,7 +47,7 @@ int NodeUtility::GenerateNodeIcingaConfig(const String& endpointName, const Stri
|
|||||||
|
|
||||||
Array::Ptr myParentZoneMembers = new Array();
|
Array::Ptr myParentZoneMembers = new Array();
|
||||||
|
|
||||||
for (const String& endpoint : endpoints) {
|
for (String endpoint : endpoints) {
|
||||||
/* extract all --endpoint arguments and store host,port info */
|
/* extract all --endpoint arguments and store host,port info */
|
||||||
std::vector<String> tokens = endpoint.Split(",");
|
std::vector<String> tokens = endpoint.Split(",");
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ bool NodeUtility::WriteNodeConfigObjects(const String& filename, const Array::Pt
|
|||||||
fp << " */\n\n";
|
fp << " */\n\n";
|
||||||
|
|
||||||
ObjectLock olock(objects);
|
ObjectLock olock(objects);
|
||||||
for (const Dictionary::Ptr& object : objects) {
|
for (Dictionary::Ptr object : objects) {
|
||||||
SerializeObject(fp, object);
|
SerializeObject(fp, object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ wizard_endpoint_loop_start:
|
|||||||
/* Extract parent node information. */
|
/* Extract parent node information. */
|
||||||
String parentHost, parentPort;
|
String parentHost, parentPort;
|
||||||
|
|
||||||
for (const String& endpoint : endpoints) {
|
for (String endpoint : endpoints) {
|
||||||
std::vector<String> tokens = endpoint.Split(",");
|
std::vector<String> tokens = endpoint.Split(",");
|
||||||
|
|
||||||
if (tokens.size() > 1)
|
if (tokens.size() > 1)
|
||||||
|
@ -161,7 +161,7 @@ void HostDbObject::OnConfigUpdateHeavy()
|
|||||||
|
|
||||||
if (groups) {
|
if (groups) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
for (const String& groupName : groups) {
|
for (String groupName : groups) {
|
||||||
HostGroup::Ptr group = HostGroup::GetByName(groupName);
|
HostGroup::Ptr group = HostGroup::GetByName(groupName);
|
||||||
|
|
||||||
DbQuery query2;
|
DbQuery query2;
|
||||||
|
@ -159,7 +159,7 @@ void ServiceDbObject::OnConfigUpdateHeavy()
|
|||||||
|
|
||||||
if (groups) {
|
if (groups) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
for (const String& groupName : groups) {
|
for (String groupName : groups) {
|
||||||
ServiceGroup::Ptr group = ServiceGroup::GetByName(groupName);
|
ServiceGroup::Ptr group = ServiceGroup::GetByName(groupName);
|
||||||
|
|
||||||
DbQuery query2;
|
DbQuery query2;
|
||||||
|
@ -79,7 +79,7 @@ void UserDbObject::OnConfigUpdateHeavy()
|
|||||||
|
|
||||||
if (groups) {
|
if (groups) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
for (const String& groupName : groups) {
|
for (String groupName : groups) {
|
||||||
UserGroup::Ptr group = UserGroup::GetByName(groupName);
|
UserGroup::Ptr group = UserGroup::GetByName(groupName);
|
||||||
|
|
||||||
DbQuery query2;
|
DbQuery query2;
|
||||||
|
@ -1358,7 +1358,7 @@ Value ClusterEvents::NotificationSentToAllUsersAPIHandler(const MessageOrigin::P
|
|||||||
|
|
||||||
{
|
{
|
||||||
ObjectLock olock(ausers);
|
ObjectLock olock(ausers);
|
||||||
for (const String& auser : ausers) {
|
for (String auser : ausers) {
|
||||||
User::Ptr user = User::GetByName(auser);
|
User::Ptr user = User::GetByName(auser);
|
||||||
|
|
||||||
if (!user)
|
if (!user)
|
||||||
|
@ -169,7 +169,7 @@ String Comment::AddComment(const Checkable::Ptr& checkable, CommentType entryTyp
|
|||||||
|
|
||||||
if (!ConfigObjectUtility::CreateObject(Comment::TypeInstance, fullName, config, errors, nullptr)) {
|
if (!ConfigObjectUtility::CreateObject(Comment::TypeInstance, fullName, config, errors, nullptr)) {
|
||||||
ObjectLock olock(errors);
|
ObjectLock olock(errors);
|
||||||
for (const String& error : errors) {
|
for (String error : errors) {
|
||||||
Log(LogCritical, "Comment", error);
|
Log(LogCritical, "Comment", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ void Comment::RemoveComment(const String& id, bool removedManually, const String
|
|||||||
|
|
||||||
if (!ConfigObjectUtility::DeleteObject(comment, false, errors, nullptr)) {
|
if (!ConfigObjectUtility::DeleteObject(comment, false, errors, nullptr)) {
|
||||||
ObjectLock olock(errors);
|
ObjectLock olock(errors);
|
||||||
for (const String& error : errors) {
|
for (String error : errors) {
|
||||||
Log(LogCritical, "Comment", error);
|
Log(LogCritical, "Comment", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ String CompatUtility::GetCommandLine(const Command::Ptr& command)
|
|||||||
Array::Ptr args = commandLine;
|
Array::Ptr args = commandLine;
|
||||||
|
|
||||||
ObjectLock olock(args);
|
ObjectLock olock(args);
|
||||||
for (const String& arg : args) {
|
for (String arg : args) {
|
||||||
// This is obviously incorrect for non-trivial cases.
|
// This is obviously incorrect for non-trivial cases.
|
||||||
result += " \"" + EscapeString(arg) + "\"";
|
result += " \"" + EscapeString(arg) + "\"";
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ Downtime::Ptr Downtime::AddDowntime(const Checkable::Ptr& checkable, const Strin
|
|||||||
|
|
||||||
if (!ConfigObjectUtility::CreateObject(Downtime::TypeInstance, fullName, config, errors, nullptr)) {
|
if (!ConfigObjectUtility::CreateObject(Downtime::TypeInstance, fullName, config, errors, nullptr)) {
|
||||||
ObjectLock olock(errors);
|
ObjectLock olock(errors);
|
||||||
for (const String& error : errors) {
|
for (String error : errors) {
|
||||||
Log(LogCritical, "Downtime", error);
|
Log(LogCritical, "Downtime", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,7 +388,7 @@ void Downtime::RemoveDowntime(const String& id, bool includeChildren, DowntimeRe
|
|||||||
|
|
||||||
if (!ConfigObjectUtility::DeleteObject(downtime, false, errors, nullptr)) {
|
if (!ConfigObjectUtility::DeleteObject(downtime, false, errors, nullptr)) {
|
||||||
ObjectLock olock(errors);
|
ObjectLock olock(errors);
|
||||||
for (const String& error : errors) {
|
for (String error : errors) {
|
||||||
Log(LogCritical, "Downtime", error);
|
Log(LogCritical, "Downtime", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ void Downtime::TriggerDowntime(double triggerTime)
|
|||||||
|
|
||||||
{
|
{
|
||||||
ObjectLock olock(triggers);
|
ObjectLock olock(triggers);
|
||||||
for (const String& triggerName : triggers) {
|
for (String triggerName : triggers) {
|
||||||
Downtime::Ptr downtime = Downtime::GetByName(triggerName);
|
Downtime::Ptr downtime = Downtime::GetByName(triggerName);
|
||||||
|
|
||||||
if (!downtime)
|
if (!downtime)
|
||||||
|
@ -38,7 +38,7 @@ void Host::OnAllConfigLoaded()
|
|||||||
|
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
for (const String& name : groups) {
|
for (String name : groups) {
|
||||||
HostGroup::Ptr hg = HostGroup::GetByName(name);
|
HostGroup::Ptr hg = HostGroup::GetByName(name);
|
||||||
|
|
||||||
if (hg)
|
if (hg)
|
||||||
@ -71,7 +71,7 @@ void Host::Stop(bool runtimeRemoved)
|
|||||||
if (groups) {
|
if (groups) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
for (const String& name : groups) {
|
for (String name : groups) {
|
||||||
HostGroup::Ptr hg = HostGroup::GetByName(name);
|
HostGroup::Ptr hg = HostGroup::GetByName(name);
|
||||||
|
|
||||||
if (hg)
|
if (hg)
|
||||||
@ -88,8 +88,7 @@ std::vector<Service::Ptr> Host::GetServices() const
|
|||||||
|
|
||||||
std::vector<Service::Ptr> services;
|
std::vector<Service::Ptr> services;
|
||||||
services.reserve(m_Services.size());
|
services.reserve(m_Services.size());
|
||||||
typedef std::pair<String, Service::Ptr> ServicePair;
|
for (auto& kv : m_Services) {
|
||||||
for (const ServicePair& kv : m_Services) {
|
|
||||||
services.push_back(kv.second);
|
services.push_back(kv.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ bool HostGroup::ResolveGroupMembership(const Host::Ptr& host, bool add, int rsta
|
|||||||
if (groups && groups->GetLength() > 0) {
|
if (groups && groups->GetLength() > 0) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
for (const String& name : groups) {
|
for (String name : groups) {
|
||||||
HostGroup::Ptr group = HostGroup::GetByName(name);
|
HostGroup::Ptr group = HostGroup::GetByName(name);
|
||||||
|
|
||||||
if (group && !group->ResolveGroupMembership(host, add, rstack + 1))
|
if (group && !group->ResolveGroupMembership(host, add, rstack + 1))
|
||||||
|
@ -486,7 +486,7 @@ Dictionary::Ptr LegacyTimePeriod::FindRunningSegment(const String& daydef, const
|
|||||||
double bestEnd = 0.0;
|
double bestEnd = 0.0;
|
||||||
|
|
||||||
ObjectLock olock(segments);
|
ObjectLock olock(segments);
|
||||||
for (const Dictionary::Ptr& segment : segments) {
|
for (Dictionary::Ptr segment : segments) {
|
||||||
double begin = segment->Get("begin");
|
double begin = segment->Get("begin");
|
||||||
double end = segment->Get("end");
|
double end = segment->Get("end");
|
||||||
|
|
||||||
@ -544,7 +544,7 @@ Dictionary::Ptr LegacyTimePeriod::FindNextSegment(const String& daydef, const St
|
|||||||
double bestBegin;
|
double bestBegin;
|
||||||
|
|
||||||
ObjectLock olock(segments);
|
ObjectLock olock(segments);
|
||||||
for (const Dictionary::Ptr& segment : segments) {
|
for (Dictionary::Ptr segment : segments) {
|
||||||
double begin = segment->Get("begin");
|
double begin = segment->Get("begin");
|
||||||
|
|
||||||
if (begin < tsref)
|
if (begin < tsref)
|
||||||
|
@ -173,7 +173,7 @@ std::set<User::Ptr> Notification::GetUsers() const
|
|||||||
if (users) {
|
if (users) {
|
||||||
ObjectLock olock(users);
|
ObjectLock olock(users);
|
||||||
|
|
||||||
for (const String& name : users) {
|
for (String name : users) {
|
||||||
User::Ptr user = User::GetByName(name);
|
User::Ptr user = User::GetByName(name);
|
||||||
|
|
||||||
if (!user)
|
if (!user)
|
||||||
@ -195,7 +195,7 @@ std::set<UserGroup::Ptr> Notification::GetUserGroups() const
|
|||||||
if (groups) {
|
if (groups) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
for (const String& name : groups) {
|
for (String name : groups) {
|
||||||
UserGroup::Ptr ug = UserGroup::GetByName(name);
|
UserGroup::Ptr ug = UserGroup::GetByName(name);
|
||||||
|
|
||||||
if (!ug)
|
if (!ug)
|
||||||
@ -667,8 +667,7 @@ String Notification::NotificationFilterToString(int filter, const std::map<Strin
|
|||||||
{
|
{
|
||||||
std::vector<String> sFilters;
|
std::vector<String> sFilters;
|
||||||
|
|
||||||
typedef std::pair<String, int> kv_pair;
|
for (auto& kv : filterMap) {
|
||||||
for (const kv_pair& kv : filterMap) {
|
|
||||||
if (filter & kv.second)
|
if (filter & kv.second)
|
||||||
sFilters.push_back(kv.first);
|
sFilters.push_back(kv.first);
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ void Service::OnAllConfigLoaded()
|
|||||||
|
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
for (const String& name : groups) {
|
for (String name : groups) {
|
||||||
ServiceGroup::Ptr sg = ServiceGroup::GetByName(name);
|
ServiceGroup::Ptr sg = ServiceGroup::GetByName(name);
|
||||||
|
|
||||||
if (sg)
|
if (sg)
|
||||||
|
@ -94,7 +94,7 @@ bool ServiceGroup::ResolveGroupMembership(const Service::Ptr& service, bool add,
|
|||||||
if (groups && groups->GetLength() > 0) {
|
if (groups && groups->GetLength() > 0) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
for (const String& name : groups) {
|
for (String name : groups) {
|
||||||
ServiceGroup::Ptr group = ServiceGroup::GetByName(name);
|
ServiceGroup::Ptr group = ServiceGroup::GetByName(name);
|
||||||
|
|
||||||
if (group && !group->ResolveGroupMembership(service, add, rstack + 1))
|
if (group && !group->ResolveGroupMembership(service, add, rstack + 1))
|
||||||
|
@ -57,7 +57,7 @@ void TimePeriod::AddSegment(double begin, double end)
|
|||||||
if (segments) {
|
if (segments) {
|
||||||
/* Try to merge the new segment into an existing segment. */
|
/* Try to merge the new segment into an existing segment. */
|
||||||
ObjectLock dlock(segments);
|
ObjectLock dlock(segments);
|
||||||
for (const Dictionary::Ptr& segment : segments) {
|
for (Dictionary::Ptr segment : segments) {
|
||||||
if (segment->Get("begin") <= begin && segment->Get("end") >= end)
|
if (segment->Get("begin") <= begin && segment->Get("end") >= end)
|
||||||
return; /* New segment is fully contained in this segment. */
|
return; /* New segment is fully contained in this segment. */
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ void TimePeriod::RemoveSegment(double begin, double end)
|
|||||||
|
|
||||||
/* Try to split or adjust an existing segment. */
|
/* Try to split or adjust an existing segment. */
|
||||||
ObjectLock dlock(segments);
|
ObjectLock dlock(segments);
|
||||||
for (const Dictionary::Ptr& segment : segments) {
|
for (Dictionary::Ptr segment : segments) {
|
||||||
/* Fully contained in the specified range? */
|
/* Fully contained in the specified range? */
|
||||||
if (segment->Get("begin") >= begin && segment->Get("end") <= end)
|
if (segment->Get("begin") >= begin && segment->Get("end") <= end)
|
||||||
// Don't add the old segment, because the segment is fully contained into our range
|
// Don't add the old segment, because the segment is fully contained into our range
|
||||||
@ -193,7 +193,7 @@ void TimePeriod::PurgeSegments(double end)
|
|||||||
|
|
||||||
/* Remove old segments. */
|
/* Remove old segments. */
|
||||||
ObjectLock dlock(segments);
|
ObjectLock dlock(segments);
|
||||||
for (const Dictionary::Ptr& segment : segments) {
|
for (Dictionary::Ptr segment : segments) {
|
||||||
if (segment->Get("end") >= end)
|
if (segment->Get("end") >= end)
|
||||||
newSegments->Add(segment);
|
newSegments->Add(segment);
|
||||||
}
|
}
|
||||||
@ -212,7 +212,7 @@ void TimePeriod::Merge(const TimePeriod::Ptr& timeperiod, bool include)
|
|||||||
if (segments) {
|
if (segments) {
|
||||||
ObjectLock dlock(segments);
|
ObjectLock dlock(segments);
|
||||||
ObjectLock ilock(this);
|
ObjectLock ilock(this);
|
||||||
for (const Dictionary::Ptr& segment : segments) {
|
for (Dictionary::Ptr segment : segments) {
|
||||||
include ? AddSegment(segment) : RemoveSegment(segment);
|
include ? AddSegment(segment) : RemoveSegment(segment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ void TimePeriod::UpdateRegion(double begin, double end, bool clearExisting)
|
|||||||
|
|
||||||
if (segments) {
|
if (segments) {
|
||||||
ObjectLock dlock(segments);
|
ObjectLock dlock(segments);
|
||||||
for (const Dictionary::Ptr& segment : segments) {
|
for (Dictionary::Ptr segment : segments) {
|
||||||
AddSegment(segment);
|
AddSegment(segment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ void TimePeriod::UpdateRegion(double begin, double end, bool clearExisting)
|
|||||||
|
|
||||||
if (timeranges) {
|
if (timeranges) {
|
||||||
ObjectLock olock(timeranges);
|
ObjectLock olock(timeranges);
|
||||||
for (const String& name : timeranges) {
|
for (String name : timeranges) {
|
||||||
const TimePeriod::Ptr timeperiod = TimePeriod::GetByName(name);
|
const TimePeriod::Ptr timeperiod = TimePeriod::GetByName(name);
|
||||||
|
|
||||||
if (timeperiod)
|
if (timeperiod)
|
||||||
@ -265,7 +265,7 @@ void TimePeriod::UpdateRegion(double begin, double end, bool clearExisting)
|
|||||||
|
|
||||||
if (timeranges) {
|
if (timeranges) {
|
||||||
ObjectLock olock(timeranges);
|
ObjectLock olock(timeranges);
|
||||||
for (const String& name : timeranges) {
|
for (String name : timeranges) {
|
||||||
const TimePeriod::Ptr timeperiod = TimePeriod::GetByName(name);
|
const TimePeriod::Ptr timeperiod = TimePeriod::GetByName(name);
|
||||||
|
|
||||||
if (timeperiod)
|
if (timeperiod)
|
||||||
@ -290,7 +290,7 @@ bool TimePeriod::IsInside(double ts) const
|
|||||||
|
|
||||||
if (segments) {
|
if (segments) {
|
||||||
ObjectLock dlock(segments);
|
ObjectLock dlock(segments);
|
||||||
for (const Dictionary::Ptr& segment : segments) {
|
for (Dictionary::Ptr segment : segments) {
|
||||||
if (ts >= segment->Get("begin") && ts < segment->Get("end"))
|
if (ts >= segment->Get("begin") && ts < segment->Get("end"))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -309,7 +309,7 @@ double TimePeriod::FindNextTransition(double begin)
|
|||||||
|
|
||||||
if (segments) {
|
if (segments) {
|
||||||
ObjectLock dlock(segments);
|
ObjectLock dlock(segments);
|
||||||
for (const Dictionary::Ptr& segment : segments) {
|
for (Dictionary::Ptr segment : segments) {
|
||||||
if (segment->Get("begin") > begin && (segment->Get("begin") < closestTransition || closestTransition == -1))
|
if (segment->Get("begin") > begin && (segment->Get("begin") < closestTransition || closestTransition == -1))
|
||||||
closestTransition = segment->Get("begin");
|
closestTransition = segment->Get("begin");
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ void TimePeriod::Dump()
|
|||||||
|
|
||||||
if (segments) {
|
if (segments) {
|
||||||
ObjectLock dlock(segments);
|
ObjectLock dlock(segments);
|
||||||
for (const Dictionary::Ptr& segment : segments) {
|
for (Dictionary::Ptr segment : segments) {
|
||||||
Log(LogDebug, "TimePeriod")
|
Log(LogDebug, "TimePeriod")
|
||||||
<< "Segment: " << Utility::FormatDateTime("%c", segment->Get("begin")) << " <-> "
|
<< "Segment: " << Utility::FormatDateTime("%c", segment->Get("begin")) << " <-> "
|
||||||
<< Utility::FormatDateTime("%c", segment->Get("end"));
|
<< Utility::FormatDateTime("%c", segment->Get("end"));
|
||||||
|
@ -33,7 +33,7 @@ void User::OnAllConfigLoaded()
|
|||||||
|
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
for (const String& name : groups) {
|
for (String name : groups) {
|
||||||
UserGroup::Ptr ug = UserGroup::GetByName(name);
|
UserGroup::Ptr ug = UserGroup::GetByName(name);
|
||||||
|
|
||||||
if (ug)
|
if (ug)
|
||||||
@ -51,7 +51,7 @@ void User::Stop(bool runtimeRemoved)
|
|||||||
if (groups) {
|
if (groups) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
for (const String& name : groups) {
|
for (String name : groups) {
|
||||||
UserGroup::Ptr ug = UserGroup::GetByName(name);
|
UserGroup::Ptr ug = UserGroup::GetByName(name);
|
||||||
|
|
||||||
if (ug)
|
if (ug)
|
||||||
|
@ -110,7 +110,7 @@ bool UserGroup::ResolveGroupMembership(const User::Ptr& user, bool add, int rsta
|
|||||||
if (groups && groups->GetLength() > 0) {
|
if (groups && groups->GetLength() > 0) {
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
for (const String& name : groups) {
|
for (String name : groups) {
|
||||||
UserGroup::Ptr group = UserGroup::GetByName(name);
|
UserGroup::Ptr group = UserGroup::GetByName(name);
|
||||||
|
|
||||||
if (group && !group->ResolveGroupMembership(user, add, rstack + 1))
|
if (group && !group->ResolveGroupMembership(user, add, rstack + 1))
|
||||||
|
@ -27,7 +27,7 @@ bool AttributeFilter::Apply(const Table::Ptr& table, const Value& row)
|
|||||||
bool negate = (m_Operator == "<");
|
bool negate = (m_Operator == "<");
|
||||||
|
|
||||||
ObjectLock olock(array);
|
ObjectLock olock(array);
|
||||||
for (const String& item : array) {
|
for (String item : array) {
|
||||||
if (item == m_Operand)
|
if (item == m_Operand)
|
||||||
return !negate; /* Item found in list. */
|
return !negate; /* Item found in list. */
|
||||||
}
|
}
|
||||||
|
@ -42,17 +42,17 @@ String CommandsTable::GetPrefix() const
|
|||||||
|
|
||||||
void CommandsTable::FetchRows(const AddRowFunction& addRowFn)
|
void CommandsTable::FetchRows(const AddRowFunction& addRowFn)
|
||||||
{
|
{
|
||||||
for (const ConfigObject::Ptr& object : ConfigType::GetObjectsByType<CheckCommand>()) {
|
for (auto& object : ConfigType::GetObjectsByType<CheckCommand>()) {
|
||||||
if (!addRowFn(object, LivestatusGroupByNone, Empty))
|
if (!addRowFn(object, LivestatusGroupByNone, Empty))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const ConfigObject::Ptr& object : ConfigType::GetObjectsByType<EventCommand>()) {
|
for (auto& object : ConfigType::GetObjectsByType<EventCommand>()) {
|
||||||
if (!addRowFn(object, LivestatusGroupByNone, Empty))
|
if (!addRowFn(object, LivestatusGroupByNone, Empty))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const ConfigObject::Ptr& object : ConfigType::GetObjectsByType<NotificationCommand>()) {
|
for (auto& object : ConfigType::GetObjectsByType<NotificationCommand>()) {
|
||||||
if (!addRowFn(object, LivestatusGroupByNone, Empty))
|
if (!addRowFn(object, LivestatusGroupByNone, Empty))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ void StateHistTable::FetchRows(const AddRowFunction& addRowFn)
|
|||||||
Checkable::Ptr checkable;
|
Checkable::Ptr checkable;
|
||||||
|
|
||||||
for (const auto& kv : m_CheckablesCache) {
|
for (const auto& kv : m_CheckablesCache) {
|
||||||
for (const Dictionary::Ptr& state_hist_bag : kv.second) {
|
for (Dictionary::Ptr state_hist_bag : kv.second) {
|
||||||
/* pass a dictionary from state history array */
|
/* pass a dictionary from state history array */
|
||||||
if (!addRowFn(state_hist_bag, LivestatusGroupByNone, Empty))
|
if (!addRowFn(state_hist_bag, LivestatusGroupByNone, Empty))
|
||||||
return;
|
return;
|
||||||
|
@ -376,8 +376,8 @@ void OpenTsdbWriter::SendMetric(const Checkable::Ptr& checkable, const String& m
|
|||||||
{
|
{
|
||||||
String tags_string = "";
|
String tags_string = "";
|
||||||
|
|
||||||
for (const Dictionary::Pair& tag : tags) {
|
for (auto& tag : tags) {
|
||||||
tags_string += " " + tag.first + "=" + Convert::ToString(tag.second);
|
tags_string += " " + tag.first + "=" + tag.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostringstream msgbuf;
|
std::ostringstream msgbuf;
|
||||||
|
@ -88,7 +88,7 @@ bool ActionsHandler::HandleRequest(
|
|||||||
if (params)
|
if (params)
|
||||||
verbose = HttpUtility::GetLastParameter(params, "verbose");
|
verbose = HttpUtility::GetLastParameter(params, "verbose");
|
||||||
|
|
||||||
for (const ConfigObject::Ptr& obj : objs) {
|
for (ConfigObject::Ptr obj : objs) {
|
||||||
try {
|
try {
|
||||||
results.emplace_back(action->Invoke(obj, params));
|
results.emplace_back(action->Invoke(obj, params));
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
@ -108,7 +108,7 @@ bool ActionsHandler::HandleRequest(
|
|||||||
int statusCode = 500;
|
int statusCode = 500;
|
||||||
std::set<int> okStatusCodes, nonOkStatusCodes;
|
std::set<int> okStatusCodes, nonOkStatusCodes;
|
||||||
|
|
||||||
for (const Dictionary::Ptr& res : results) {
|
for (Dictionary::Ptr res : results) {
|
||||||
if (!res->Contains("code")) {
|
if (!res->Contains("code")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ Value ApiListener::ConfigUpdateObjectAPIHandler(const MessageOrigin::Ptr& origin
|
|||||||
<< "Could not create object '" << objName << "':";
|
<< "Could not create object '" << objName << "':";
|
||||||
|
|
||||||
ObjectLock olock(errors);
|
ObjectLock olock(errors);
|
||||||
for (const String& error : errors) {
|
for (auto& error : errors) {
|
||||||
Log(LogCritical, "ApiListener", error);
|
Log(LogCritical, "ApiListener", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ Value ApiListener::ConfigDeleteObjectAPIHandler(const MessageOrigin::Ptr& origin
|
|||||||
Log(LogCritical, "ApiListener", "Could not delete object:");
|
Log(LogCritical, "ApiListener", "Could not delete object:");
|
||||||
|
|
||||||
ObjectLock olock(errors);
|
ObjectLock olock(errors);
|
||||||
for (const String& error : errors) {
|
for (auto& error : errors) {
|
||||||
Log(LogCritical, "ApiListener", error);
|
Log(LogCritical, "ApiListener", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,7 @@ static void ScriptFrameCleanupHandler()
|
|||||||
|
|
||||||
std::vector<String> cleanup_keys;
|
std::vector<String> cleanup_keys;
|
||||||
|
|
||||||
typedef std::pair<String, ApiScriptFrame> KVPair;
|
for (auto& kv : l_ApiScriptFrames) {
|
||||||
|
|
||||||
for (const KVPair& kv : l_ApiScriptFrames) {
|
|
||||||
if (kv.second.Seen < Utility::GetTime() - 1800)
|
if (kv.second.Seen < Utility::GetTime() - 1800)
|
||||||
cleanup_keys.push_back(kv.first);
|
cleanup_keys.push_back(kv.first);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ bool DeleteObjectHandler::HandleRequest(
|
|||||||
|
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
for (const ConfigObject::Ptr& obj : objs) {
|
for (ConfigObject::Ptr obj : objs) {
|
||||||
int code;
|
int code;
|
||||||
String status;
|
String status;
|
||||||
Array::Ptr errors = new Array();
|
Array::Ptr errors = new Array();
|
||||||
|
@ -44,8 +44,7 @@ void EventQueue::ProcessEvent(const Dictionary::Ptr& event)
|
|||||||
|
|
||||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||||
|
|
||||||
typedef std::pair<void *const, std::deque<Dictionary::Ptr> > kv_pair;
|
for (auto& kv : m_Events) {
|
||||||
for (kv_pair& kv : m_Events) {
|
|
||||||
kv.second.push_back(event);
|
kv.second.push_back(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,8 +107,7 @@ std::vector<EventQueue::Ptr> EventQueue::GetQueuesForType(const String& type)
|
|||||||
|
|
||||||
std::vector<EventQueue::Ptr> availQueues;
|
std::vector<EventQueue::Ptr> availQueues;
|
||||||
|
|
||||||
typedef std::pair<String, EventQueue::Ptr> kv_pair;
|
for (auto& kv : queues) {
|
||||||
for (const kv_pair& kv : queues) {
|
|
||||||
if (kv.second->CanProcessEvent(type))
|
if (kv.second->CanProcessEvent(type))
|
||||||
availQueues.push_back(kv.second);
|
availQueues.push_back(kv.second);
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ bool EventsHandler::HandleRequest(
|
|||||||
|
|
||||||
{
|
{
|
||||||
ObjectLock olock(types);
|
ObjectLock olock(types);
|
||||||
for (const String& type : types) {
|
for (String type : types) {
|
||||||
FilterUtility::CheckPermission(user, "events/" + type);
|
FilterUtility::CheckPermission(user, "events/" + type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ bool EventsHandler::HandleRequest(
|
|||||||
|
|
||||||
{
|
{
|
||||||
ObjectLock olock(types);
|
ObjectLock olock(types);
|
||||||
for (const String& type : types) {
|
for (String type : types) {
|
||||||
auto typeId (l_EventTypes.find(type));
|
auto typeId (l_EventTypes.find(type));
|
||||||
|
|
||||||
if (typeId != l_EventTypes.end()) {
|
if (typeId != l_EventTypes.end()) {
|
||||||
|
@ -241,7 +241,7 @@ std::vector<Value> FilterUtility::GetFilterTargets(const QueryDescription& qd, c
|
|||||||
Array::Ptr names = query->Get(attr);
|
Array::Ptr names = query->Get(attr);
|
||||||
if (names) {
|
if (names) {
|
||||||
ObjectLock olock(names);
|
ObjectLock olock(names);
|
||||||
for (const String& name : names) {
|
for (String name : names) {
|
||||||
Object::Ptr target = provider->GetTargetByName(type, name);
|
Object::Ptr target = provider->GetTargetByName(type, name);
|
||||||
|
|
||||||
if (!FilterUtility::EvaluateFilter(permissionFrame, permissionFilter.get(), target, variableName))
|
if (!FilterUtility::EvaluateFilter(permissionFrame, permissionFilter.get(), target, variableName))
|
||||||
|
@ -66,7 +66,7 @@ void HttpHandler::ProcessRequest(
|
|||||||
|
|
||||||
if (current_handlers) {
|
if (current_handlers) {
|
||||||
ObjectLock olock(current_handlers);
|
ObjectLock olock(current_handlers);
|
||||||
for (const HttpHandler::Ptr& current_handler : current_handlers) {
|
for (HttpHandler::Ptr current_handler : current_handlers) {
|
||||||
handlers.push_back(current_handler);
|
handlers.push_back(current_handler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ bool ModifyObjectHandler::HandleRequest(
|
|||||||
|
|
||||||
ArrayData results;
|
ArrayData results;
|
||||||
|
|
||||||
for (const ConfigObject::Ptr& obj : objs) {
|
for (ConfigObject::Ptr obj : objs) {
|
||||||
Dictionary::Ptr result1 = new Dictionary();
|
Dictionary::Ptr result1 = new Dictionary();
|
||||||
|
|
||||||
result1->Set("type", type->GetName());
|
result1->Set("type", type->GetName());
|
||||||
|
@ -23,7 +23,7 @@ Dictionary::Ptr ObjectQueryHandler::SerializeObjectAttrs(const Object::Ptr& obje
|
|||||||
|
|
||||||
if (isJoin && attrs) {
|
if (isJoin && attrs) {
|
||||||
ObjectLock olock(attrs);
|
ObjectLock olock(attrs);
|
||||||
for (const String& attr : attrs) {
|
for (String attr : attrs) {
|
||||||
if (attr == attrPrefix) {
|
if (attr == attrPrefix) {
|
||||||
allAttrs = true;
|
allAttrs = true;
|
||||||
break;
|
break;
|
||||||
@ -40,7 +40,7 @@ Dictionary::Ptr ObjectQueryHandler::SerializeObjectAttrs(const Object::Ptr& obje
|
|||||||
}
|
}
|
||||||
} else if (attrs) {
|
} else if (attrs) {
|
||||||
ObjectLock olock(attrs);
|
ObjectLock olock(attrs);
|
||||||
for (const String& attr : attrs) {
|
for (String attr : attrs) {
|
||||||
String userAttr;
|
String userAttr;
|
||||||
|
|
||||||
if (isJoin) {
|
if (isJoin) {
|
||||||
@ -173,7 +173,7 @@ bool ObjectQueryHandler::HandleRequest(
|
|||||||
|
|
||||||
if (ujoins) {
|
if (ujoins) {
|
||||||
ObjectLock olock(ujoins);
|
ObjectLock olock(ujoins);
|
||||||
for (const String& ujoin : ujoins) {
|
for (String ujoin : ujoins) {
|
||||||
userJoinAttrs.insert(ujoin.SubStr(0, ujoin.FindFirstOf(".")));
|
userJoinAttrs.insert(ujoin.SubStr(0, ujoin.FindFirstOf(".")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ bool ObjectQueryHandler::HandleRequest(
|
|||||||
std::unordered_map<Type*, std::pair<bool, std::unique_ptr<Expression>>> typePermissions;
|
std::unordered_map<Type*, std::pair<bool, std::unique_ptr<Expression>>> typePermissions;
|
||||||
std::unordered_map<Object*, bool> objectAccessAllowed;
|
std::unordered_map<Object*, bool> objectAccessAllowed;
|
||||||
|
|
||||||
for (const ConfigObject::Ptr& obj : objs) {
|
for (ConfigObject::Ptr obj : objs) {
|
||||||
DictionaryData result1{
|
DictionaryData result1{
|
||||||
{ "name", obj->GetName() },
|
{ "name", obj->GetName() },
|
||||||
{ "type", obj->GetReflectionType()->GetName() }
|
{ "type", obj->GetReflectionType()->GetName() }
|
||||||
@ -203,7 +203,7 @@ bool ObjectQueryHandler::HandleRequest(
|
|||||||
|
|
||||||
if (umetas) {
|
if (umetas) {
|
||||||
ObjectLock olock(umetas);
|
ObjectLock olock(umetas);
|
||||||
for (const String& meta : umetas) {
|
for (String meta : umetas) {
|
||||||
if (meta == "used_by") {
|
if (meta == "used_by") {
|
||||||
Array::Ptr used_by = new Array();
|
Array::Ptr used_by = new Array();
|
||||||
metaAttrs.emplace_back("used_by", used_by);
|
metaAttrs.emplace_back("used_by", used_by);
|
||||||
|
@ -91,7 +91,7 @@ bool TypeQueryHandler::HandleRequest(
|
|||||||
|
|
||||||
ArrayData results;
|
ArrayData results;
|
||||||
|
|
||||||
for (const Type::Ptr& obj : objs) {
|
for (Type::Ptr obj : objs) {
|
||||||
Dictionary::Ptr result1 = new Dictionary();
|
Dictionary::Ptr result1 = new Dictionary();
|
||||||
results.push_back(result1);
|
results.push_back(result1);
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ bool Url::ParsePath(const String& path)
|
|||||||
boost::char_separator<char> sep("/");
|
boost::char_separator<char> sep("/");
|
||||||
boost::tokenizer<boost::char_separator<char> > tokens(pathStr, sep);
|
boost::tokenizer<boost::char_separator<char> > tokens(pathStr, sep);
|
||||||
|
|
||||||
for (const String& token : tokens) {
|
for (String token : tokens) {
|
||||||
if (token.IsEmpty())
|
if (token.IsEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ bool Url::ParseQuery(const String& query)
|
|||||||
boost::char_separator<char> sep("&");
|
boost::char_separator<char> sep("&");
|
||||||
boost::tokenizer<boost::char_separator<char> > tokens(queryStr, sep);
|
boost::tokenizer<boost::char_separator<char> > tokens(queryStr, sep);
|
||||||
|
|
||||||
for (const String& token : tokens) {
|
for (String token : tokens) {
|
||||||
size_t pHelper = token.Find("=");
|
size_t pHelper = token.Find("=");
|
||||||
|
|
||||||
if (pHelper == 0)
|
if (pHelper == 0)
|
||||||
|
@ -98,7 +98,7 @@ bool VariableQueryHandler::HandleRequest(
|
|||||||
|
|
||||||
ArrayData results;
|
ArrayData results;
|
||||||
|
|
||||||
for (const Dictionary::Ptr& var : objs) {
|
for (Dictionary::Ptr var : objs) {
|
||||||
if (var->Get("name") == "TicketSalt")
|
if (var->Get("name") == "TicketSalt")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ void Zone::OnAllConfigLoaded()
|
|||||||
|
|
||||||
if (endpoints) {
|
if (endpoints) {
|
||||||
ObjectLock olock(endpoints);
|
ObjectLock olock(endpoints);
|
||||||
for (const String& endpoint : endpoints) {
|
for (String endpoint : endpoints) {
|
||||||
Endpoint::Ptr ep = Endpoint::GetByName(endpoint);
|
Endpoint::Ptr ep = Endpoint::GetByName(endpoint);
|
||||||
|
|
||||||
if (ep)
|
if (ep)
|
||||||
@ -60,7 +60,7 @@ std::set<Endpoint::Ptr> Zone::GetEndpoints() const
|
|||||||
if (endpoints) {
|
if (endpoints) {
|
||||||
ObjectLock olock(endpoints);
|
ObjectLock olock(endpoints);
|
||||||
|
|
||||||
for (const String& name : endpoints) {
|
for (String name : endpoints) {
|
||||||
Endpoint::Ptr endpoint = Endpoint::GetByName(name);
|
Endpoint::Ptr endpoint = Endpoint::GetByName(name);
|
||||||
|
|
||||||
if (!endpoint)
|
if (!endpoint)
|
||||||
|
@ -119,7 +119,7 @@ static int FormatOutput(const Dictionary::Ptr& result)
|
|||||||
|
|
||||||
ObjectLock olock(perfs);
|
ObjectLock olock(perfs);
|
||||||
|
|
||||||
for (const Dictionary::Ptr& perf : perfs) {
|
for (Dictionary::Ptr perf : perfs) {
|
||||||
ssout << "'" << perf->Get("alias") << "'=";
|
ssout << "'" << perf->Get("alias") << "'=";
|
||||||
|
|
||||||
Dictionary::Ptr values = perf->Get("float_value");
|
Dictionary::Ptr values = perf->Get("float_value");
|
||||||
@ -483,7 +483,7 @@ int main(int argc, char **argv)
|
|||||||
endpoint += '/';
|
endpoint += '/';
|
||||||
else {
|
else {
|
||||||
endpoint += '?';
|
endpoint += '?';
|
||||||
for (const String& argument : vm["arguments"].as<std::vector<std::string>>()) {
|
for (String argument : vm["arguments"].as<std::vector<std::string>>()) {
|
||||||
String::SizeType pos = argument.FindFirstOf("=");
|
String::SizeType pos = argument.FindFirstOf("=");
|
||||||
if (pos == String::NPos)
|
if (pos == String::NPos)
|
||||||
endpoint += Utility::EscapeString(argument, ACQUERY_ENCODE, false);
|
endpoint += Utility::EscapeString(argument, ACQUERY_ENCODE, false);
|
||||||
|
@ -502,7 +502,7 @@ BOOST_AUTO_TEST_CASE(dst)
|
|||||||
std::vector<TestData> tests;
|
std::vector<TestData> tests;
|
||||||
|
|
||||||
// 2021-03-14: 01:59:59 PST (UTC-8) -> 03:00:00 PDT (UTC-7)
|
// 2021-03-14: 01:59:59 PST (UTC-8) -> 03:00:00 PDT (UTC-7)
|
||||||
for (const std::string& day : {"2021-03-14", "sunday", "sunday 2", "sunday -3"}) {
|
for (std::string day : {"2021-03-14", "sunday", "sunday 2", "sunday -3"}) {
|
||||||
// range before DST change
|
// range before DST change
|
||||||
tests.push_back(TestData{
|
tests.push_back(TestData{
|
||||||
day, "00:30-01:30",
|
day, "00:30-01:30",
|
||||||
@ -561,7 +561,7 @@ BOOST_AUTO_TEST_CASE(dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2021-11-07: 01:59:59 PDT (UTC-7) -> 01:00:00 PST (UTC-8)
|
// 2021-11-07: 01:59:59 PDT (UTC-7) -> 01:00:00 PST (UTC-8)
|
||||||
for (const std::string& day : {"2021-11-07", "sunday", "sunday 1", "sunday -4"}) {
|
for (std::string day : {"2021-11-07", "sunday", "sunday 1", "sunday -4"}) {
|
||||||
// range before DST change
|
// range before DST change
|
||||||
tests.push_back(TestData{
|
tests.push_back(TestData{
|
||||||
day, "00:15-00:45",
|
day, "00:15-00:45",
|
||||||
|
@ -902,7 +902,7 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
|
|||||||
if (field.Type.ArrayRank > 0) {
|
if (field.Type.ArrayRank > 0) {
|
||||||
m_Impl << "\t" << "if (oldValue) {" << std::endl
|
m_Impl << "\t" << "if (oldValue) {" << std::endl
|
||||||
<< "\t\t" << "ObjectLock olock(oldValue);" << std::endl
|
<< "\t\t" << "ObjectLock olock(oldValue);" << std::endl
|
||||||
<< "\t\t" << "for (const String& ref : oldValue) {" << std::endl
|
<< "\t\t" << "for (auto& ref : oldValue) {" << std::endl
|
||||||
<< "\t\t\tDependencyGraph::RemoveDependency(";
|
<< "\t\t\tDependencyGraph::RemoveDependency(";
|
||||||
|
|
||||||
/* Ew */
|
/* Ew */
|
||||||
@ -916,7 +916,7 @@ void ClassCompiler::HandleClass(const Klass& klass, const ClassDebugInfo&)
|
|||||||
<< "\t" << "}" << std::endl
|
<< "\t" << "}" << std::endl
|
||||||
<< "\t" << "if (newValue) {" << std::endl
|
<< "\t" << "if (newValue) {" << std::endl
|
||||||
<< "\t\t" << "ObjectLock olock(newValue);" << std::endl
|
<< "\t\t" << "ObjectLock olock(newValue);" << std::endl
|
||||||
<< "\t\t" << "for (const String& ref : newValue) {" << std::endl
|
<< "\t\t" << "for (auto& ref : newValue) {" << std::endl
|
||||||
<< "\t\t\tDependencyGraph::AddDependency(";
|
<< "\t\t\tDependencyGraph::AddDependency(";
|
||||||
|
|
||||||
/* Ew */
|
/* Ew */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user