From 23f211ab35321c99900a1169cd5abb25e45f65e6 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 25 Nov 2019 17:27:14 +0000 Subject: [PATCH] Fixed some warnings in the macOS and iOS push notifications code --- .../native/juce_ios_PushNotifications.cpp | 6 ++++-- .../native/juce_mac_PushNotifications.cpp | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp b/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp index efcb6ec319..d15ddd0ce5 100644 --- a/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp +++ b/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp @@ -300,7 +300,9 @@ namespace PushNotificationsDelegateDetails if (n.fireDate != nil) { NSDate* dateNow = [NSDate date]; - notif.triggerIntervalSec = [dateNow timeIntervalSinceDate: n.fireDate]; + NSDate* fireDate = n.fireDate; + + notif.triggerIntervalSec = [dateNow timeIntervalSinceDate: fireDate]; } notif.soundToPlay = URL (nsStringToJuce (n.soundName)); @@ -849,7 +851,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate { NSMutableString* hexString = [NSMutableString stringWithCapacity: (length * 2)]; - for (int i = 0; i < length; ++i) + for (NSUInteger i = 0; i < length; ++i) [hexString appendFormat:@"%02x", buffer[i]]; return nsStringToJuce ([hexString copy]); diff --git a/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp b/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp index 2a803aaeba..3d017be162 100644 --- a/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp +++ b/modules/juce_gui_extra/native/juce_mac_PushNotifications.cpp @@ -151,7 +151,9 @@ namespace PushNotificationsDelegateDetailsOsx else { NSDate* dateNow = [NSDate date]; - notif.triggerIntervalSec = [dateNow timeIntervalSinceDate: n.deliveryDate]; + NSDate* deliveryDate = n.deliveryDate; + + notif.triggerIntervalSec = [dateNow timeIntervalSinceDate: deliveryDate]; } notif.soundToPlay = URL (nsStringToJuce (n.soundName)); @@ -367,7 +369,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate NSRemoteNotificationType types = NSUInteger ((bool) settings.allowBadge); if (isAtLeastMountainLion) - types |= ((bool) settings.allowSound << 1 | (bool) settings.allowAlert << 2); + types |= (NSUInteger) ((bool) settings.allowSound << 1 | (bool) settings.allowAlert << 2); [[NSApplication sharedApplication] registerForRemoteNotificationTypes: types]; } @@ -477,7 +479,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate { NSMutableString* hexString = [NSMutableString stringWithCapacity: (length * 2)]; - for (int i = 0; i < length; ++i) + for (NSUInteger i = 0; i < length; ++i) [hexString appendFormat:@"%02x", buffer[i]]; return nsStringToJuce ([hexString copy]); @@ -530,7 +532,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate } } - bool shouldPresentNotification (NSUserNotification* notification) override { return true; } + bool shouldPresentNotification (NSUserNotification*) override { return true; } void subscribeToTopic (const String& topic) { ignoreUnused (topic); } void unsubscribeFromTopic (const String& topic) { ignoreUnused (topic); }