Fix warnings related to enum integer conversion

This commit is contained in:
Johannes Schmidt 2025-05-06 08:34:32 +02:00
parent 6a6c494279
commit f8d3bacc29
2 changed files with 5 additions and 3 deletions

View File

@ -472,7 +472,8 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
if (type == NotificationProblem && !reminder && !checkable->GetVolatile()) {
auto [host, service] = GetHostService(checkable);
uint_fast8_t state = service ? service->GetState() : host->GetState();
uint_fast8_t state = service ? static_cast<uint_fast8_t>(service->GetState())
: static_cast<uint_fast8_t>(host->GetState());
if (state == (uint_fast8_t)GetLastNotifiedStatePerUser()->Get(userName)) {
auto stateStr (service ? NotificationServiceStateToString(service->GetState()) : NotificationHostStateToString(host->GetState()));
@ -501,7 +502,8 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
if (type == NotificationProblem) {
auto [host, service] = GetHostService(checkable);
uint_fast8_t state = service ? service->GetState() : host->GetState();
uint_fast8_t state = service ? static_cast<uint_fast8_t>(service->GetState())
: static_cast<uint_fast8_t>(host->GetState());
if (state != (uint_fast8_t)GetLastNotifiedStatePerUser()->Get(userName)) {
GetLastNotifiedStatePerUser()->Set(userName, state);

View File

@ -2061,7 +2061,7 @@ void IcingaDB::SendSentNotification(
"host_id", GetObjectIdentifier(host),
"type", Convert::ToString(type),
"state", Convert::ToString(cr ? service ? Convert::ToLong(cr->GetState()) : Convert::ToLong(Host::CalculateState(cr->GetState())) : 99),
"previous_hard_state", Convert::ToString(cr ? Convert::ToLong(service ? cr->GetPreviousHardState() : Host::CalculateState(cr->GetPreviousHardState())) : 99),
"previous_hard_state", Convert::ToString(cr ? service ? Convert::ToLong(cr->GetPreviousHardState()) : Convert::ToLong(Host::CalculateState(cr->GetPreviousHardState())) : 99),
"author", Utility::ValidateUTF8(author),
"text", Utility::ValidateUTF8(finalText),
"users_notified", Convert::ToString(usersAmount),