From df4ee3377ab1188bf8986aab835776f714d9f0cf Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Tue, 24 Mar 2020 09:54:18 -0400 Subject: [PATCH] Warning and analyze fixes --- MVMCore/MVMCore/AlertHandling/MVMCoreAlertOperation.m | 2 +- MVMCore/MVMCore/AlertHandling/MVMCoreTopAlertObject.m | 4 ++-- MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m | 2 +- MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m | 2 +- MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m | 2 +- MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m | 6 +++--- MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.h | 2 +- MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m | 2 +- MVMCore/MVMCore/Utility/Helpers/MVMCoreDispatchUtility.h | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertOperation.m b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertOperation.m index 9e9d35f..5aa9058 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreAlertOperation.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreAlertOperation.m @@ -70,7 +70,7 @@ static void * XXContext = &XXContext; } - (nullable instancetype)initWithAlert:(nonnull UIAlertController *)alert isGreedy:(BOOL)isGreedy alertDelegate:(nullable NSObject *)alertDelegate { - if ([self initWithAlert:alert isGreedy:isGreedy]) { + if (self = [self initWithAlert:alert isGreedy:isGreedy]) { self.alertDelegate = alertDelegate; } return self; diff --git a/MVMCore/MVMCore/AlertHandling/MVMCoreTopAlertObject.m b/MVMCore/MVMCore/AlertHandling/MVMCoreTopAlertObject.m index 6fe372d..45819d4 100644 --- a/MVMCore/MVMCore/AlertHandling/MVMCoreTopAlertObject.m +++ b/MVMCore/MVMCore/AlertHandling/MVMCoreTopAlertObject.m @@ -41,7 +41,7 @@ NSUInteger const TopAlertDismissTime = 5; // The default is yes if not sent by server (for legacy to work as is) NSNumber *closeButton = [responseInfo optionalNumberForKey:KeyCloseButton]; - if (closeButton) { + if (closeButton != nil) { self.useCloseButton = [closeButton boolValue]; } else { self.useCloseButton = YES; @@ -52,7 +52,7 @@ NSUInteger const TopAlertDismissTime = 5; // Server driven dismiss time. if (self.useNewStyle) { NSNumber *topAlertTime = [responseInfo optionalNumberForKey:@"topAlertTime"]; - if (topAlertTime) { + if (topAlertTime != nil) { self.topAlertDismissTime = [topAlertTime integerValue]; } } diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m index 5bf2864..bc1056d 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadHandler.m @@ -152,7 +152,7 @@ } NSTimeInterval timeOutInterval = 60; - if (requestParameters.customTimeoutTime) { + if (requestParameters.customTimeoutTime != nil) { timeOutInterval = requestParameters.customTimeoutTime.floatValue; } else if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(timeOutIntervalForRequest:)]) { timeOutInterval = [[MVMCoreObject sharedInstance].globalLoadDelegate timeOutIntervalForRequest:requestParameters]; diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m index ee459f5..7a52182 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadObject.m @@ -62,7 +62,7 @@ - (BOOL)extendsAppSession { NSNumber *extendSessionFlag = [self.responseInfoMap optionalNumberForKey:@"appSessionExtended"]; - return !extendSessionFlag || [extendSessionFlag boolValue]; // Default to YES if the key does not exist. + return extendSessionFlag == nil || [extendSessionFlag boolValue]; // Default to YES if the key does not exist. } #pragma mark - Deprecated diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index c8cd23b..2f4019b 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -824,7 +824,7 @@ if (postCallsDict) { NSArray *actionList = [postCallsDict array:@"actionList"]; //TODO needs to create operation queue based on concurrent flag - BOOL isConcurrent = [postCallsDict boolForKey:@"concurrent"]; + //BOOL isConcurrent = [postCallsDict boolForKey:@"concurrent"]; //Needs further enhancements based on the flags. BOOL shouldTriggerFromCache = [postCallsDict boolForKey:@"shouldTriggerFromCache"]; //Check if page is not from cache diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m b/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m index 238b9d9..d7b79a8 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m @@ -220,7 +220,7 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt"; // Adds json to cache with page type key. NSNumber *shouldCache = [jsonDictionary optionalNumberForKey:@"cache"]; - if (!shouldCache || shouldCache.boolValue) { + if (shouldCache == nil || shouldCache.boolValue) { [weakSelf.pageTypeCache setObject:jsonDictionary forKey:pageType]; } } @@ -257,7 +257,7 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt"; // Adds json to cache with page type key. NSNumber *shouldCache = [jsonDictionary optionalNumberForKey:@"cache"]; - if (!shouldCache || shouldCache.boolValue) { + if (shouldCache == nil || shouldCache.boolValue) { [weakSelf.moduleCache setObject:obj forKey:key]; } } @@ -567,7 +567,7 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt"; if (isGif) { [self checkImage:nil imageData:data fallbackImage:fallbackImageName completionHandler:completionHandler]; } else { - UIImage *image = [UIImage imageWithData:data scale:[UIScreen mainScreen].scale]; + UIImage *image = data != nil ? [UIImage imageWithData:data scale:[UIScreen mainScreen].scale] : nil; [self checkImage:image imageData:nil fallbackImage:fallbackImageName completionHandler:completionHandler]; } }]; diff --git a/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.h b/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.h index bdb0abd..b3abbd8 100644 --- a/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.h +++ b/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.h @@ -27,6 +27,6 @@ + (BOOL)classIsInstanceTypeOfClass:(nonnull Class)theClass otherClass:(nonnull Class)otherClass throwException:(BOOL)throwException; // Calls the above function with throw exception yes if the object is not nil. Returns the object. Convenience function for one liner in initializer. -+ (nonnull id)initializerClassCheck:(nullable NSObject *)object classToVerify:(nonnull Class)classToVerify; ++ (nullable id)initializerClassCheck:(nullable NSObject *)object classToVerify:(nonnull Class)classToVerify; @end diff --git a/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m b/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m index 2c6c8f1..6702f00 100644 --- a/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m +++ b/MVMCore/MVMCore/Utility/Helpers/MVMCoreActionUtility.m @@ -53,7 +53,7 @@ NSInteger count = [dictionary count]; id __unsafe_unretained objects[count]; id __unsafe_unretained keys[count]; - [dictionary getObjects:objects andKeys:keys]; + [dictionary getObjects:objects andKeys:keys count:count]; for (NSUInteger i = 0; i < count; i++) { id object = objects[i]; NSString *key = keys[i]; diff --git a/MVMCore/MVMCore/Utility/Helpers/MVMCoreDispatchUtility.h b/MVMCore/MVMCore/Utility/Helpers/MVMCoreDispatchUtility.h index 9ee0da1..fd6876a 100644 --- a/MVMCore/MVMCore/Utility/Helpers/MVMCoreDispatchUtility.h +++ b/MVMCore/MVMCore/Utility/Helpers/MVMCoreDispatchUtility.h @@ -19,7 +19,7 @@ + (void)performSyncBlockInBackground:(nonnull void (^)(void))block; /// Ensures the block is peformed on the same *labeled* dispatch queue. The queue *must* be previously initialized with a unique label. -+ (void)performBlock:(nonnull void (^)(void))block onQueue:(dispatch_queue_t)queue; ++ (void)performBlock:(nonnull void (^)(void))block onQueue:(nonnull dispatch_queue_t)queue; + (void)performSyncBlock:(nonnull void (^)(void))block onQueue:(nonnull dispatch_queue_t)queue; @end