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.";
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;
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);
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);
}
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:
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;
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);
}
typedef boost::error_info<StackTrace, StackTrace> StackTraceErrorInfo;
-inline std::string to_string(const StackTraceErrorInfo& e)
+inline std::string to_string(const StackTraceErrorInfo&)
{
return "";
}
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;
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;
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])
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;
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;
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)
}
}
- if (state >= matches.size())
+ if (state >= static_cast<int>(matches.size()))
return NULL;
return strdup(matches[state].CStr());
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,
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.");
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.");
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.");
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)
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)
{ "downtimehistory", "entry_time" },
{ "eventhandlers", "start_time" },
{ "externalcommands", "entry_time" },
- { "flappinghistory" "event_time" },
+ { "flappinghistory", "event_time" },
{ "hostchecks", "start_time" },
{ "logentries", "logentry_time" },
{ "notifications", "start_time" },
if (!parent)
continue;
- int state_filter = dep->GetStateFilter();
-
Array::Ptr depInfo = new Array();
depInfo->Add(parent->GetName());
depInfo->Add(dep->GetStateFilter());
if (!parent)
continue;
- int state_filter = dep->GetStateFilter();
-
Array::Ptr depInfo = new Array();
depInfo->Add(parent->GetName());
depInfo->Add(dep->GetStateFilter());
MYSQL m_Connection;
int m_AffectedRows;
- int m_MaxPacketSize;
+ unsigned int m_MaxPacketSize;
std::vector<IdoAsyncQuery> m_AsyncQueries;
ServiceStatistics CIB::CalculateServiceStats(void)
{
- ServiceStatistics ss = {0};
+ ServiceStatistics ss = {};
BOOST_FOREACH(const Service::Ptr& service, ConfigType::GetObjectsByType<Service>()) {
ObjectLock olock(service);
HostStatistics CIB::CalculateHostStats(void)
{
- HostStatistics hs = {0};
+ HostStatistics hs = {};
BOOST_FOREACH(const Host::Ptr& host, ConfigType::GetObjectsByType<Host>()) {
ObjectLock olock(host);
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)) {
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()
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();
Dictionary::Ptr attrs = params->Get("attrs");
Dictionary::Ptr result1 = new Dictionary();
- int code;
String status;
Array::Ptr errors = new Array();
std::set<String> m_Types;
Expression *m_Filter;
- double m_Ttl;
std::map<void *, std::deque<Dictionary::Ptr> > m_Events;
};
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) {
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);
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));
}
}
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;