mirror of
https://github.com/Icinga/icinga2.git
synced 2025-10-28 01:33:50 +01:00
Merge pull request #9411 from Icinga/compiler-warnings
Fix compiler warnings
This commit is contained in:
commit
f42510f981
@ -242,5 +242,5 @@ String icinga::PackObject(const Value& value)
|
|||||||
std::string builder;
|
std::string builder;
|
||||||
PackAny(value, builder);
|
PackAny(value, builder);
|
||||||
|
|
||||||
return std::move(builder);
|
return builder;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,8 +32,8 @@ void TcpSocket::Bind(const String& node, const String& service, int family)
|
|||||||
{
|
{
|
||||||
addrinfo hints;
|
addrinfo hints;
|
||||||
addrinfo *result;
|
addrinfo *result;
|
||||||
int error;
|
int error = 0;
|
||||||
const char *func;
|
const char *func = nullptr;
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
hints.ai_family = family;
|
hints.ai_family = family;
|
||||||
@ -126,8 +126,8 @@ void TcpSocket::Connect(const String& node, const String& service)
|
|||||||
{
|
{
|
||||||
addrinfo hints;
|
addrinfo hints;
|
||||||
addrinfo *result;
|
addrinfo *result;
|
||||||
int error;
|
int error = 0;
|
||||||
const char *func;
|
const char *func = nullptr;
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
hints.ai_family = AF_UNSPEC;
|
hints.ai_family = AF_UNSPEC;
|
||||||
|
|||||||
@ -54,7 +54,7 @@ void Connect(Socket& socket, const String& node, const String& service)
|
|||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
auto se (dynamic_cast<const boost::system::system_error*>(&ex));
|
auto se (dynamic_cast<const boost::system::system_error*>(&ex));
|
||||||
|
|
||||||
if (se && se->code() == boost::asio::error::operation_aborted || ++current == result.end()) {
|
if ((se && se->code() == boost::asio::error::operation_aborted) || ++current == result.end()) {
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ void Connect(Socket& socket, const String& node, const String& service, boost::a
|
|||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
auto se (dynamic_cast<const boost::system::system_error*>(&ex));
|
auto se (dynamic_cast<const boost::system::system_error*>(&ex));
|
||||||
|
|
||||||
if (se && se->code() == boost::asio::error::operation_aborted || ++current == result.end()) {
|
if ((se && se->code() == boost::asio::error::operation_aborted) || ++current == result.end()) {
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ boost::thread_specific_ptr<WorkQueue *> l_ThreadWorkQueue;
|
|||||||
|
|
||||||
WorkQueue::WorkQueue(size_t maxItems, int threadCount, LogSeverity statsLogLevel)
|
WorkQueue::WorkQueue(size_t maxItems, int threadCount, LogSeverity statsLogLevel)
|
||||||
: m_ID(m_NextID++), m_ThreadCount(threadCount), m_MaxItems(maxItems),
|
: m_ID(m_NextID++), m_ThreadCount(threadCount), m_MaxItems(maxItems),
|
||||||
m_TaskStats(15 * 60), m_StatsLogLevel(statsLogLevel)
|
m_StatsLogLevel(statsLogLevel), m_TaskStats(15 * 60)
|
||||||
{
|
{
|
||||||
/* Initialize logger. */
|
/* Initialize logger. */
|
||||||
m_StatusTimerTimeout = Utility::GetTime();
|
m_StatusTimerTimeout = Utility::GetTime();
|
||||||
|
|||||||
@ -280,7 +280,7 @@ std::unique_ptr<Expression> ConfigCompiler::Compile()
|
|||||||
|
|
||||||
std::unique_ptr<DictExpression> expr{new DictExpression(std::move(dlist))};
|
std::unique_ptr<DictExpression> expr{new DictExpression(std::move(dlist))};
|
||||||
expr->MakeInline();
|
expr->MakeInline();
|
||||||
return std::move(expr);
|
return expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define scanner (context->GetScanner())
|
#define scanner (context->GetScanner())
|
||||||
|
|||||||
@ -146,7 +146,7 @@ std::unique_ptr<Expression> ConfigCompiler::HandleInclude(const String& relative
|
|||||||
|
|
||||||
std::unique_ptr<DictExpression> expr{new DictExpression(std::move(expressions))};
|
std::unique_ptr<DictExpression> expr{new DictExpression(std::move(expressions))};
|
||||||
expr->MakeInline();
|
expr->MakeInline();
|
||||||
return std::move(expr);
|
return expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -174,7 +174,7 @@ std::unique_ptr<Expression> ConfigCompiler::HandleIncludeRecursive(const String&
|
|||||||
|
|
||||||
std::unique_ptr<DictExpression> dict{new DictExpression(std::move(expressions))};
|
std::unique_ptr<DictExpression> dict{new DictExpression(std::move(expressions))};
|
||||||
dict->MakeInline();
|
dict->MakeInline();
|
||||||
return std::move(dict);
|
return dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigCompiler::HandleIncludeZone(const String& relativeBase, const String& tag, const String& path, const String& pattern, const String& package, std::vector<std::unique_ptr<Expression> >& expressions)
|
void ConfigCompiler::HandleIncludeZone(const String& relativeBase, const String& tag, const String& path, const String& pattern, const String& package, std::vector<std::unique_ptr<Expression> >& expressions)
|
||||||
|
|||||||
@ -541,7 +541,7 @@ Dictionary::Ptr LegacyTimePeriod::FindNextSegment(const String& daydef, const St
|
|||||||
ProcessTimeRanges(timeranges, &iter, segments);
|
ProcessTimeRanges(timeranges, &iter, segments);
|
||||||
|
|
||||||
Dictionary::Ptr bestSegment;
|
Dictionary::Ptr bestSegment;
|
||||||
double bestBegin;
|
double bestBegin = 0;
|
||||||
|
|
||||||
ObjectLock olock(segments);
|
ObjectLock olock(segments);
|
||||||
for (Dictionary::Ptr segment : segments) {
|
for (Dictionary::Ptr segment : segments) {
|
||||||
|
|||||||
@ -1928,10 +1928,10 @@ unsigned short GetPreviousState(const Checkable::Ptr& checkable, const Service::
|
|||||||
{
|
{
|
||||||
auto phs ((type == StateTypeHard ? checkable->GetLastHardStatesRaw() : checkable->GetLastSoftStatesRaw()) % 100u);
|
auto phs ((type == StateTypeHard ? checkable->GetLastHardStatesRaw() : checkable->GetLastSoftStatesRaw()) % 100u);
|
||||||
|
|
||||||
if (service) {
|
if (service || phs == 99) {
|
||||||
return phs;
|
return phs;
|
||||||
} else {
|
} else {
|
||||||
return phs == 99 ? phs : Host::CalculateState(ServiceState(phs));
|
return Host::CalculateState(ServiceState(phs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -41,11 +41,11 @@ RedisConnection::RedisConnection(const String& host, int port, const String& pat
|
|||||||
RedisConnection::RedisConnection(boost::asio::io_context& io, String host, int port, String path, String username, String password,
|
RedisConnection::RedisConnection(boost::asio::io_context& io, String host, int port, String path, String username, String password,
|
||||||
int db, bool useTls, bool insecure, String certPath, String keyPath, String caPath, String crlPath,
|
int db, bool useTls, bool insecure, String certPath, String keyPath, String caPath, String crlPath,
|
||||||
String tlsProtocolmin, String cipherList, double connectTimeout, DebugInfo di, const RedisConnection::Ptr& parent)
|
String tlsProtocolmin, String cipherList, double connectTimeout, DebugInfo di, const RedisConnection::Ptr& parent)
|
||||||
: m_Host(std::move(host)), m_Port(port), m_Path(std::move(path)), m_Username(std::move(username)), m_Password(std::move(password)),
|
: m_Path(std::move(path)), m_Host(std::move(host)), m_Port(port), m_Username(std::move(username)), m_Password(std::move(password)),
|
||||||
m_DbIndex(db), m_CertPath(std::move(certPath)), m_KeyPath(std::move(keyPath)), m_Insecure(insecure),
|
m_DbIndex(db), m_CertPath(std::move(certPath)), m_KeyPath(std::move(keyPath)), m_Insecure(insecure),
|
||||||
m_CaPath(std::move(caPath)), m_CrlPath(std::move(crlPath)), m_TlsProtocolmin(std::move(tlsProtocolmin)),
|
m_CaPath(std::move(caPath)), m_CrlPath(std::move(crlPath)), m_TlsProtocolmin(std::move(tlsProtocolmin)),
|
||||||
m_CipherList(std::move(cipherList)), m_ConnectTimeout(connectTimeout), m_DebugInfo(std::move(di)), m_Connecting(false), m_Connected(false),
|
m_CipherList(std::move(cipherList)), m_ConnectTimeout(connectTimeout), m_DebugInfo(std::move(di)), m_Strand(io),
|
||||||
m_Started(false), m_Strand(io), m_QueuedWrites(io), m_QueuedReads(io), m_LogStatsTimer(io), m_Parent(parent)
|
m_Connecting(false), m_Connected(false), m_Started(false), m_QueuedWrites(io), m_QueuedReads(io), m_LogStatsTimer(io), m_Parent(parent)
|
||||||
{
|
{
|
||||||
if (useTls && m_Path.IsEmpty()) {
|
if (useTls && m_Path.IsEmpty()) {
|
||||||
UpdateTLSContext();
|
UpdateTLSContext();
|
||||||
@ -224,7 +224,7 @@ void RedisConnection::EnqueueCallback(const std::function<void(boost::asio::yiel
|
|||||||
auto ctime (Utility::GetTime());
|
auto ctime (Utility::GetTime());
|
||||||
|
|
||||||
asio::post(m_Strand, [this, callback, priority, ctime]() {
|
asio::post(m_Strand, [this, callback, priority, ctime]() {
|
||||||
m_Queues.Writes[priority].emplace(WriteQueueItem{nullptr, nullptr, nullptr, nullptr, callback, ctime});
|
m_Queues.Writes[priority].emplace(WriteQueueItem{nullptr, nullptr, nullptr, nullptr, callback, ctime, QueryAffects{}});
|
||||||
m_QueuedWrites.Set();
|
m_QueuedWrites.Set();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,8 +26,8 @@ do { \
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
struct lex_buf {
|
struct lex_buf {
|
||||||
char *buf;
|
char *buf = NULL;
|
||||||
size_t size;
|
size_t size = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void lb_init(lex_buf *lb)
|
static void lb_init(lex_buf *lb)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user