Skip to content

Commit f8d3bac

Browse files
Fix warnings related to enum integer conversion
1 parent 6a6c494 commit f8d3bac

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/icinga/notification.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,8 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
472472

473473
if (type == NotificationProblem && !reminder && !checkable->GetVolatile()) {
474474
auto [host, service] = GetHostService(checkable);
475-
uint_fast8_t state = service ? service->GetState() : host->GetState();
475+
uint_fast8_t state = service ? static_cast<uint_fast8_t>(service->GetState())
476+
: static_cast<uint_fast8_t>(host->GetState());
476477

477478
if (state == (uint_fast8_t)GetLastNotifiedStatePerUser()->Get(userName)) {
478479
auto stateStr (service ? NotificationServiceStateToString(service->GetState()) : NotificationHostStateToString(host->GetState()));
@@ -501,7 +502,8 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
501502

502503
if (type == NotificationProblem) {
503504
auto [host, service] = GetHostService(checkable);
504-
uint_fast8_t state = service ? service->GetState() : host->GetState();
505+
uint_fast8_t state = service ? static_cast<uint_fast8_t>(service->GetState())
506+
: static_cast<uint_fast8_t>(host->GetState());
505507

506508
if (state != (uint_fast8_t)GetLastNotifiedStatePerUser()->Get(userName)) {
507509
GetLastNotifiedStatePerUser()->Set(userName, state);

lib/icingadb/icingadb-objects.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2061,7 +2061,7 @@ void IcingaDB::SendSentNotification(
20612061
"host_id", GetObjectIdentifier(host),
20622062
"type", Convert::ToString(type),
20632063
"state", Convert::ToString(cr ? service ? Convert::ToLong(cr->GetState()) : Convert::ToLong(Host::CalculateState(cr->GetState())) : 99),
2064-
"previous_hard_state", Convert::ToString(cr ? Convert::ToLong(service ? cr->GetPreviousHardState() : Host::CalculateState(cr->GetPreviousHardState())) : 99),
2064+
"previous_hard_state", Convert::ToString(cr ? service ? Convert::ToLong(cr->GetPreviousHardState()) : Convert::ToLong(Host::CalculateState(cr->GetPreviousHardState())) : 99),
20652065
"author", Utility::ValidateUTF8(author),
20662066
"text", Utility::ValidateUTF8(finalText),
20672067
"users_notified", Convert::ToString(usersAmount),

0 commit comments

Comments
 (0)