]> granicus.if.org Git - icinga2/commitdiff
Fix compiler warnings and style
authorMichael Friedrich <michael.friedrich@icinga.com>
Wed, 10 Jul 2019 09:51:58 +0000 (11:51 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 10 Jul 2019 09:51:58 +0000 (11:51 +0200)
lib/icinga/checkable-check.cpp
lib/icinga/checkable-notification.cpp

index 90c6395e144de14741c1005303ef2bd1f4bb01a4..7b095353aaebbab380c8aa25d6a4e8037b4afc93 100644 (file)
@@ -461,7 +461,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
                for (int conflict : {NotificationProblem | NotificationRecovery, NotificationFlappingStart | NotificationFlappingEnd}) {
                        /* E.g. problem and recovery notifications neutralize each other. */
 
-                       if (suppressed_types_after & conflict == conflict) {
+                       if ((suppressed_types_after & conflict) == conflict) {
                                suppressed_types_after &= ~conflict;
                        }
                }
index a6475b87f0c7483d31388653a9f4cab004b1c33c..78c488dfe53336fb4ce292f9d91da566c03f2861 100644 (file)
@@ -110,30 +110,38 @@ static void FireSuppressedNotifications(Checkable* checkable)
                        auto cr (checkable->GetLastCheckResult());
 
                        switch (type) {
-                       case NotificationProblem:
-                               still_applies = cr && !checkable->IsStateOK(cr->GetState()) && checkable->GetStateType() == StateTypeHard;
-                               break;
-                       case NotificationRecovery:
-                               still_applies = cr && checkable->IsStateOK(cr->GetState());
-                               break;
-                       case NotificationFlappingStart:
-                               still_applies = checkable->IsFlapping();
-                               break;
-                       case NotificationFlappingEnd:
-                               still_applies = !checkable->IsFlapping();
+                               case NotificationProblem:
+                                       still_applies = cr && !checkable->IsStateOK(cr->GetState()) && checkable->GetStateType() == StateTypeHard;
+                                       break;
+                               case NotificationRecovery:
+                                       still_applies = cr && checkable->IsStateOK(cr->GetState());
+                                       break;
+                               case NotificationFlappingStart:
+                                       still_applies = checkable->IsFlapping();
+                                       break;
+                               case NotificationFlappingEnd:
+                                       still_applies = !checkable->IsFlapping();
+                                       break;
+                               default:
+                                       break;
                        }
 
                        if (still_applies) {
                                bool still_suppressed;
 
                                switch (type) {
-                               case NotificationProblem:
-                               case NotificationRecovery:
-                                       still_suppressed = !checkable->IsReachable(DependencyNotification) || checkable->IsInDowntime() || checkable->IsAcknowledged();
-                                       break;
-                               case NotificationFlappingStart:
-                               case NotificationFlappingEnd:
-                                       still_suppressed = checkable->IsInDowntime();
+                                       case NotificationProblem:
+                                               /* Fall through. */
+                                       case NotificationRecovery:
+                                               still_suppressed = !checkable->IsReachable(DependencyNotification) || checkable->IsInDowntime() || checkable->IsAcknowledged();
+                                               break;
+                                       case NotificationFlappingStart:
+                                               /* Fall through. */
+                                       case NotificationFlappingEnd:
+                                               still_suppressed = checkable->IsInDowntime();
+                                               break;
+                                       default:
+                                               break;
                                }
 
                                if (!still_suppressed && checkable->GetEnableActiveChecks()) {
@@ -169,6 +177,7 @@ static void FireSuppressedNotifications(Checkable* checkable)
 
        if (subtract) {
                ObjectLock olock (checkable);
+
                int suppressed_types_before (checkable->GetSuppressedNotifications());
                int suppressed_types_after (suppressed_types_before & ~subtract);