From f8d3bacc2958dc041cda90629597986b71da8119 Mon Sep 17 00:00:00 2001 From: Johannes Schmidt Date: Tue, 6 May 2025 08:34:32 +0200 Subject: [PATCH] Fix warnings related to enum integer conversion --- lib/icinga/notification.cpp | 6 ++++-- lib/icingadb/icingadb-objects.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/icinga/notification.cpp b/lib/icinga/notification.cpp index d5597065f..63e24b746 100644 --- a/lib/icinga/notification.cpp +++ b/lib/icinga/notification.cpp @@ -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(service->GetState()) + : static_cast(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(service->GetState()) + : static_cast(host->GetState()); if (state != (uint_fast8_t)GetLastNotifiedStatePerUser()->Get(userName)) { GetLastNotifiedStatePerUser()->Set(userName, state); diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index 914d46bc0..56b74a3c1 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -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),