mirror of https://github.com/Icinga/icinga2.git
parent
ae1ab5f865
commit
429d11daa8
|
@ -461,14 +461,14 @@ int Main(void)
|
|||
if (vm.count("arg"))
|
||||
args = vm["arg"].as<std::vector<std::string> >();
|
||||
|
||||
if (args.size() < command->GetMinArguments()) {
|
||||
if (static_cast<int>(args.size()) < command->GetMinArguments()) {
|
||||
Log(LogCritical, "cli")
|
||||
<< "Too few arguments. Command needs at least " << command->GetMinArguments()
|
||||
<< " argument" << (command->GetMinArguments() != 1 ? "s" : "") << ".";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (command->GetMaxArguments() >= 0 && args.size() > command->GetMaxArguments()) {
|
||||
if (command->GetMaxArguments() >= 0 && static_cast<int>(args.size()) > command->GetMaxArguments()) {
|
||||
Log(LogCritical, "cli")
|
||||
<< "Too many arguments. At most " << command->GetMaxArguments()
|
||||
<< " argument" << (command->GetMaxArguments() != 1 ? "s" : "") << " may be specified.";
|
||||
|
|
|
@ -182,12 +182,10 @@ wxPGProperty *MainForm::ValueToProperty(const String& name, const Value& value)
|
|||
wxPGProperty *prop;
|
||||
|
||||
if (value.IsNumber()) {
|
||||
double val = value;
|
||||
prop = new wxFloatProperty(name.GetData(), wxPG_LABEL, value);
|
||||
prop->SetAttribute(wxPG_ATTR_UNITS, "Number");
|
||||
return prop;
|
||||
} else if (value.IsBoolean()) {
|
||||
bool val = value;
|
||||
prop = new wxBoolProperty(name.GetData(), wxPG_LABEL, value);
|
||||
prop->SetAttribute(wxPG_ATTR_UNITS, "Boolean");
|
||||
return prop;
|
||||
|
|
|
@ -229,7 +229,7 @@ Value Array::GetFieldByName(const String& field, bool sandboxed, const DebugInfo
|
|||
|
||||
ObjectLock olock(this);
|
||||
|
||||
if (index < 0 || index >= GetLength())
|
||||
if (index < 0 || static_cast<size_t>(index) >= GetLength())
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Array index '" + Convert::ToString(index) + "' is out of bounds.", debugInfo));
|
||||
|
||||
return Get(index);
|
||||
|
@ -240,7 +240,12 @@ void Array::SetFieldByName(const String& field, const Value& value, const DebugI
|
|||
ObjectLock olock(this);
|
||||
|
||||
int index = Convert::ToLong(field);
|
||||
if (index >= GetLength())
|
||||
|
||||
if (index < 0)
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Array index '" + Convert::ToString(index) + "' is out of bounds.", debugInfo));
|
||||
|
||||
if (static_cast<size_t>(index) >= GetLength())
|
||||
Resize(index + 1);
|
||||
|
||||
Set(index, value);
|
||||
}
|
||||
|
|
|
@ -59,10 +59,10 @@ public:
|
|||
m_DebugInfo = di;
|
||||
}
|
||||
|
||||
inline virtual void Start(bool runtimeCreated)
|
||||
inline virtual void Start(bool /* runtimeCreated */)
|
||||
{ }
|
||||
|
||||
inline virtual void Stop(bool runtimeRemoved)
|
||||
inline virtual void Stop(bool /* runtimeRemoved */)
|
||||
{ }
|
||||
|
||||
private:
|
||||
|
|
|
@ -198,7 +198,7 @@ String Dictionary::ToString(void) const
|
|||
return msgbuf.str();
|
||||
}
|
||||
|
||||
Value Dictionary::GetFieldByName(const String& field, bool sandboxed, const DebugInfo& debugInfo) const
|
||||
Value Dictionary::GetFieldByName(const String& field, bool, const DebugInfo& debugInfo) const
|
||||
{
|
||||
Value value;
|
||||
|
||||
|
@ -208,7 +208,7 @@ Value Dictionary::GetFieldByName(const String& field, bool sandboxed, const Debu
|
|||
return GetPrototypeField(const_cast<Dictionary *>(this), field, false, debugInfo);
|
||||
}
|
||||
|
||||
void Dictionary::SetFieldByName(const String& field, const Value& value, const DebugInfo& debugInfo)
|
||||
void Dictionary::SetFieldByName(const String& field, const Value& value, const DebugInfo&)
|
||||
{
|
||||
Set(field, value);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ I2_BASE_API void RethrowUncaughtException(void);
|
|||
|
||||
typedef boost::error_info<StackTrace, StackTrace> StackTraceErrorInfo;
|
||||
|
||||
inline std::string to_string(const StackTraceErrorInfo& e)
|
||||
inline std::string to_string(const StackTraceErrorInfo&)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ void SocketEventEnginePoll::ThreadProc(int tid)
|
|||
if (m_FDChanged[tid])
|
||||
continue;
|
||||
|
||||
for (int i = 0; i < pfds.size(); i++) {
|
||||
for (std::vector<pollfd>::size_type i = 0; i < pfds.size(); i++) {
|
||||
if ((pfds[i].revents & (POLLIN | POLLOUT | POLLHUP | POLLERR)) == 0)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -176,7 +176,9 @@ bool CLICommand::ParseCommand(int argc, char **argv, po::options_description& vi
|
|||
BOOST_FOREACH(const CLIKeyValue& kv, GetRegistry()) {
|
||||
const std::vector<String>& vname = kv.first;
|
||||
|
||||
for (int i = 0, k = 1; i < vname.size() && k < argc; i++, k++) {
|
||||
std::vector<String>::size_type i;
|
||||
int k;
|
||||
for (i = 0, k = 1; i < vname.size() && k < argc; i++, k++) {
|
||||
if (strcmp(argv[k], "--no-stack-rlimit") == 0 || strcmp(argv[k], "--autocomplete") == 0 || strcmp(argv[k], "--scm") == 0) {
|
||||
i--;
|
||||
continue;
|
||||
|
@ -237,14 +239,16 @@ void CLICommand::ShowCommands(int argc, char **argv, po::options_description *vi
|
|||
|
||||
arg_begin = 0;
|
||||
|
||||
for (int i = 0, k = 1; i < vname.size() && k < argc; i++, k++) {
|
||||
std::vector<String>::size_type i;
|
||||
int k;
|
||||
for (i = 0, k = 1; i < vname.size() && k < argc; i++, k++) {
|
||||
if (strcmp(argv[k], "--no-stack-rlimit") == 0 || strcmp(argv[k], "--autocomplete") == 0 || strcmp(argv[k], "--scm") == 0) {
|
||||
i--;
|
||||
arg_begin++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (autocomplete && i >= autoindex - 1)
|
||||
if (autocomplete && static_cast<int>(i) >= autoindex - 1)
|
||||
break;
|
||||
|
||||
if (vname[i] != argv[k])
|
||||
|
@ -267,7 +271,7 @@ void CLICommand::ShowCommands(int argc, char **argv, po::options_description *vi
|
|||
if (autoindex < argc)
|
||||
aword = argv[autoindex];
|
||||
|
||||
if (autoindex - 1 > best_match.size() && !command)
|
||||
if (autoindex - 1 > static_cast<int>(best_match.size()) && !command)
|
||||
return;
|
||||
} else
|
||||
std::cout << "Supported commands: " << std::endl;
|
||||
|
@ -280,7 +284,7 @@ void CLICommand::ShowCommands(int argc, char **argv, po::options_description *vi
|
|||
|
||||
bool match = true;
|
||||
|
||||
for (int i = 0; i < best_match.size(); i++) {
|
||||
for (std::vector<String>::size_type i = 0; i < best_match.size(); i++) {
|
||||
if (vname[i] != best_match[i]) {
|
||||
match = false;
|
||||
break;
|
||||
|
@ -293,7 +297,7 @@ void CLICommand::ShowCommands(int argc, char **argv, po::options_description *vi
|
|||
if (autocomplete) {
|
||||
String cname;
|
||||
|
||||
if (autoindex - 1 < vname.size()) {
|
||||
if (autoindex - 1 < static_cast<int>(vname.size())) {
|
||||
cname = vname[autoindex - 1];
|
||||
|
||||
if (cname.Find(aword) == 0)
|
||||
|
|
|
@ -175,7 +175,7 @@ char *ConsoleCommand::ConsoleCompleteHelper(const char *word, int state)
|
|||
}
|
||||
}
|
||||
|
||||
if (state >= matches.size())
|
||||
if (state >= static_cast<int>(matches.size()))
|
||||
return NULL;
|
||||
|
||||
return strdup(matches[state].CStr());
|
||||
|
|
|
@ -52,7 +52,6 @@ public:
|
|||
private:
|
||||
mutable boost::mutex m_Mutex;
|
||||
mutable boost::condition_variable m_CV;
|
||||
mutable bool m_CommandReady;
|
||||
|
||||
static void ExecuteScriptCompletionHandler(boost::mutex& mutex, boost::condition_variable& cv,
|
||||
bool& ready, boost::exception_ptr eptr, const Value& result, Value& resultOut,
|
||||
|
|
|
@ -281,7 +281,7 @@ Expression *ConfigCompiler::Compile(void)
|
|||
|
||||
std::vector<Expression *> dlist;
|
||||
typedef std::pair<Expression *, EItemInfo> EListItem;
|
||||
int num = 0;
|
||||
std::vector<std::pair<Expression *, EItemInfo> >::size_type num = 0;
|
||||
BOOST_FOREACH(const EListItem& litem, llist) {
|
||||
if (!litem.second.SideEffect && num != llist.size() - 1) {
|
||||
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
|
||||
|
@ -778,7 +778,7 @@ rterm_scope: '{'
|
|||
context->m_IgnoreNewlines.pop();
|
||||
std::vector<Expression *> dlist;
|
||||
typedef std::pair<Expression *, EItemInfo> EListItem;
|
||||
int num = 0;
|
||||
std::vector<std::pair<Expression *, EItemInfo> >::size_type num = 0;
|
||||
BOOST_FOREACH(const EListItem& litem, *$3) {
|
||||
if (!litem.second.SideEffect && num != $3->size() - 1)
|
||||
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
|
||||
|
@ -1006,7 +1006,7 @@ rterm_no_side_effect_no_dict: T_STRING
|
|||
|
||||
std::vector<Expression *> dlist;
|
||||
typedef std::pair<Expression *, EItemInfo> EListItem;
|
||||
int num = 0;
|
||||
std::vector<std::pair<Expression *, EItemInfo> >::size_type num = 0;
|
||||
BOOST_FOREACH(const EListItem& litem, *$3) {
|
||||
if (!litem.second.SideEffect && num != $3->size() - 1)
|
||||
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value computed is not used.");
|
||||
|
|
|
@ -799,7 +799,7 @@ class I2_CONFIG_API FunctionExpression : public DebuggableExpression
|
|||
public:
|
||||
FunctionExpression(const String& name, const std::vector<String>& args,
|
||||
std::map<String, Expression *> *closedVars, Expression *expression, const DebugInfo& debugInfo = DebugInfo())
|
||||
: DebuggableExpression(debugInfo), m_Args(args), m_Name(name), m_ClosedVars(closedVars), m_Expression(expression)
|
||||
: DebuggableExpression(debugInfo), m_Name(name), m_Args(args), m_ClosedVars(closedVars), m_Expression(expression)
|
||||
{ }
|
||||
|
||||
~FunctionExpression(void)
|
||||
|
|
|
@ -39,8 +39,8 @@ Timer::Ptr DbConnection::m_ProgramStatusTimer;
|
|||
boost::once_flag DbConnection::m_OnceFlag = BOOST_ONCE_INIT;
|
||||
|
||||
DbConnection::DbConnection(void)
|
||||
: m_QueryStats(15 * 60), m_PendingQueries(0), m_PendingQueriesTimestamp(0),
|
||||
m_IDCacheValid(false), m_ActiveChangedHandler(false)
|
||||
: m_IDCacheValid(false), m_QueryStats(15 * 60), m_PendingQueries(0),
|
||||
m_PendingQueriesTimestamp(0), m_ActiveChangedHandler(false)
|
||||
{ }
|
||||
|
||||
void DbConnection::OnConfigLoaded(void)
|
||||
|
@ -255,7 +255,7 @@ void DbConnection::CleanUpHandler(void)
|
|||
{ "downtimehistory", "entry_time" },
|
||||
{ "eventhandlers", "start_time" },
|
||||
{ "externalcommands", "entry_time" },
|
||||
{ "flappinghistory" "event_time" },
|
||||
{ "flappinghistory", "event_time" },
|
||||
{ "hostchecks", "start_time" },
|
||||
{ "logentries", "logentry_time" },
|
||||
{ "notifications", "start_time" },
|
||||
|
|
|
@ -427,8 +427,6 @@ String HostDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields) co
|
|||
if (!parent)
|
||||
continue;
|
||||
|
||||
int state_filter = dep->GetStateFilter();
|
||||
|
||||
Array::Ptr depInfo = new Array();
|
||||
depInfo->Add(parent->GetName());
|
||||
depInfo->Add(dep->GetStateFilter());
|
||||
|
|
|
@ -371,8 +371,6 @@ String ServiceDbObject::CalculateConfigHash(const Dictionary::Ptr& configFields)
|
|||
if (!parent)
|
||||
continue;
|
||||
|
||||
int state_filter = dep->GetStateFilter();
|
||||
|
||||
Array::Ptr depInfo = new Array();
|
||||
depInfo->Add(parent->GetName());
|
||||
depInfo->Add(dep->GetStateFilter());
|
||||
|
|
|
@ -76,7 +76,7 @@ private:
|
|||
|
||||
MYSQL m_Connection;
|
||||
int m_AffectedRows;
|
||||
int m_MaxPacketSize;
|
||||
unsigned int m_MaxPacketSize;
|
||||
|
||||
std::vector<IdoAsyncQuery> m_AsyncQueries;
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ CheckableCheckStatistics CIB::CalculateServiceCheckStats(void)
|
|||
|
||||
ServiceStatistics CIB::CalculateServiceStats(void)
|
||||
{
|
||||
ServiceStatistics ss = {0};
|
||||
ServiceStatistics ss = {};
|
||||
|
||||
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
|
||||
ObjectLock olock(service);
|
||||
|
@ -232,7 +232,7 @@ ServiceStatistics CIB::CalculateServiceStats(void)
|
|||
|
||||
HostStatistics CIB::CalculateHostStats(void)
|
||||
{
|
||||
HostStatistics hs = {0};
|
||||
HostStatistics hs = {};
|
||||
|
||||
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
|
||||
ObjectLock olock(host);
|
||||
|
|
|
@ -138,7 +138,7 @@ std::vector<LivestatusRowValue> Table::FilterRows(const Filter::Ptr& filter, int
|
|||
|
||||
bool Table::FilteredAddRow(std::vector<LivestatusRowValue>& rs, const Filter::Ptr& filter, int limit, const Value& row, LivestatusGroupByType groupByType, const Object::Ptr& groupByObject)
|
||||
{
|
||||
if (limit != -1 && rs.size() == limit)
|
||||
if (limit != -1 && static_cast<int>(rs.size()) == limit)
|
||||
return false;
|
||||
|
||||
if (!filter || filter->Apply(this, row)) {
|
||||
|
|
|
@ -148,7 +148,6 @@ void InfluxdbWriter::CheckResultHandler(const Checkable::Ptr& checkable, const C
|
|||
Dictionary::Ptr tags = tmpl->Get("tags");
|
||||
if (tags) {
|
||||
ObjectLock olock(tags);
|
||||
retry:
|
||||
BOOST_FOREACH(const Dictionary::Pair& pair, tags) {
|
||||
// Prevent missing macros from warning; will return an empty value
|
||||
// which will be filtered out in SendMetric()
|
||||
|
@ -318,7 +317,7 @@ void InfluxdbWriter::SendMetric(const Dictionary::Ptr& tmpl, const String& label
|
|||
m_DataBuffer->Add(String(msgbuf.str()));
|
||||
|
||||
// Flush if we've buffered too much to prevent excessive memory use
|
||||
if (m_DataBuffer->GetLength() >= GetFlushThreshold()) {
|
||||
if (static_cast<int>(m_DataBuffer->GetLength()) >= GetFlushThreshold()) {
|
||||
Log(LogDebug, "InfluxdbWriter")
|
||||
<< "Data buffer overflow writing " << m_DataBuffer->GetLength() << " data points";
|
||||
Flush();
|
||||
|
|
|
@ -52,7 +52,6 @@ bool CreateObjectHandler::HandleRequest(const ApiUser::Ptr& user, HttpRequest& r
|
|||
Dictionary::Ptr attrs = params->Get("attrs");
|
||||
|
||||
Dictionary::Ptr result1 = new Dictionary();
|
||||
int code;
|
||||
String status;
|
||||
Array::Ptr errors = new Array();
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ private:
|
|||
|
||||
std::set<String> m_Types;
|
||||
Expression *m_Filter;
|
||||
double m_Ttl;
|
||||
|
||||
std::map<void *, std::deque<Dictionary::Ptr> > m_Events;
|
||||
};
|
||||
|
|
|
@ -67,7 +67,7 @@ void HttpHandler::ProcessRequest(const ApiUser::Ptr& user, HttpRequest& request,
|
|||
std::vector<HttpHandler::Ptr> handlers;
|
||||
const std::vector<String>& path = request.RequestUrl->GetPath();
|
||||
|
||||
for (int i = 0; i <= path.size(); i++) {
|
||||
for (std::vector<String>::size_type i = 0; i <= path.size(); i++) {
|
||||
Array::Ptr current_handlers = node->Get("handlers");
|
||||
|
||||
if (current_handlers) {
|
||||
|
|
|
@ -37,7 +37,7 @@ static boost::once_flag l_HttpServerConnectionOnceFlag = BOOST_ONCE_INIT;
|
|||
static Timer::Ptr l_HttpServerConnectionTimeoutTimer;
|
||||
|
||||
HttpServerConnection::HttpServerConnection(const String& identity, bool authenticated, const TlsStream::Ptr& stream)
|
||||
: m_Stream(stream), m_CurrentRequest(stream), m_Seen(Utility::GetTime()), m_PendingRequests(0)
|
||||
: m_Stream(stream), m_Seen(Utility::GetTime()), m_CurrentRequest(stream), m_PendingRequests(0)
|
||||
{
|
||||
boost::call_once(l_HttpServerConnectionOnceFlag, &HttpServerConnection::StaticInitialize);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ void JsonRpcConnection::StaticInitialize(void)
|
|||
l_JsonRpcConnectionWorkQueueCount = Application::GetConcurrency();
|
||||
l_JsonRpcConnectionWorkQueues = new WorkQueue[l_JsonRpcConnectionWorkQueueCount];
|
||||
|
||||
for (int i = 0; i < l_JsonRpcConnectionWorkQueueCount; i++) {
|
||||
for (size_t i = 0; i < l_JsonRpcConnectionWorkQueueCount; i++) {
|
||||
l_JsonRpcConnectionWorkQueues[i].SetName("JsonRpcConnection, #" + Convert::ToString(i));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ void ClassCompiler::HandleCode(const std::string& code, const ClassDebugInfo&)
|
|||
m_Header << code << std::endl;
|
||||
}
|
||||
|
||||
void ClassCompiler::HandleLibrary(const std::string& library, const ClassDebugInfo& locp)
|
||||
void ClassCompiler::HandleLibrary(const std::string& library, const ClassDebugInfo&)
|
||||
{
|
||||
m_Library = library;
|
||||
|
||||
|
|
Loading…
Reference in New Issue