From 18077724c32912345d1a61528859f91be6341024 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Tue, 12 Feb 2019 09:29:02 +0100 Subject: [PATCH] MacGui: send integerForKey: instead of [objectForKey:] intValue] --- macosx/HBController.m | 6 +++--- macosx/HBCore.h | 6 +++--- macosx/HBCore.m | 4 ++-- macosx/HBFilters.m | 2 +- macosx/HBPreviewGenerator.m | 2 +- macosx/HBQueueController.m | 2 +- macosx/HBUtilities.m | 7 ++++--- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/macosx/HBController.m b/macosx/HBController.m index 15c9a43da..2b64afaaa 100644 --- a/macosx/HBController.m +++ b/macosx/HBController.m @@ -161,7 +161,7 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext; if (self) { // Init libhb - int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue]; + NSInteger loggingLevel = [[NSUserDefaults standardUserDefaults] integerForKey:@"LoggingLevel"]; _core = [[HBCore alloc] initWithLogLevel:loggingLevel name:@"ScanCore"]; // Inits the controllers @@ -626,8 +626,8 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext; if (canScan) { - int hb_num_previews = [[[NSUserDefaults standardUserDefaults] objectForKey:@"PreviewsNumber"] intValue]; - int min_title_duration_seconds = [[[NSUserDefaults standardUserDefaults] objectForKey:@"MinTitleScanSeconds"] intValue]; + NSUInteger hb_num_previews = [[NSUserDefaults standardUserDefaults] integerForKey:@"PreviewsNumber"]; + NSUInteger min_title_duration_seconds = [[NSUserDefaults standardUserDefaults] integerForKey:@"MinTitleScanSeconds"]; [self.core scanURL:mediaURL titleIndex:index diff --git a/macosx/HBCore.h b/macosx/HBCore.h index eb4d3920b..6f8750ab5 100644 --- a/macosx/HBCore.h +++ b/macosx/HBCore.h @@ -91,7 +91,7 @@ typedef void (^HBCoreCompletionHandler)(HBCoreResult result); * @param level the desired libhb logging level. * @param queue the queue on which the callbacks will be called. */ -- (instancetype)initWithLogLevel:(int)level queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithLogLevel:(NSInteger)level queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER; /** * Opens low level HandBrake library. This should be called once before other @@ -100,12 +100,12 @@ typedef void (^HBCoreCompletionHandler)(HBCoreResult result); * @param level the desired libhb logging level * @param name the instance debug name */ -- (instancetype)initWithLogLevel:(int)level name:(NSString *)name; +- (instancetype)initWithLogLevel:(NSInteger)level name:(NSString *)name; /** * Log level. */ -@property (nonatomic, readwrite) int logLevel; +@property (nonatomic, readwrite) NSInteger logLevel; /** * Set whether system sleep will be disable or not during a scan/encode diff --git a/macosx/HBCore.m b/macosx/HBCore.m index 3dfdeb476..391153dbb 100644 --- a/macosx/HBCore.m +++ b/macosx/HBCore.m @@ -96,7 +96,7 @@ typedef void (^HBCoreCleanupHandler)(void); return [self initWithLogLevel:0 queue:dispatch_get_main_queue()]; } -- (instancetype)initWithLogLevel:(int)level queue:(dispatch_queue_t)queue +- (instancetype)initWithLogLevel:(NSInteger)level queue:(dispatch_queue_t)queue { self = [super init]; if (self) @@ -122,7 +122,7 @@ typedef void (^HBCoreCleanupHandler)(void); return self; } -- (instancetype)initWithLogLevel:(int)level name:(NSString *)name +- (instancetype)initWithLogLevel:(NSInteger)level name:(NSString *)name { self = [self initWithLogLevel:level queue:dispatch_get_main_queue()]; if (self) diff --git a/macosx/HBFilters.m b/macosx/HBFilters.m index c6c99d2e5..81cbb0613 100644 --- a/macosx/HBFilters.m +++ b/macosx/HBFilters.m @@ -816,7 +816,7 @@ fail: { self.notificationsEnabled = NO; - // If the preset has an objectForKey:@"UsesPictureFilters", and handle the filters here + // If the preset has "UsesPictureFilters", handle the filters here if ([preset[@"UsesPictureFilters"] boolValue]) { // Deinterlace diff --git a/macosx/HBPreviewGenerator.m b/macosx/HBPreviewGenerator.m index 9f1057b35..efc95e011 100644 --- a/macosx/HBPreviewGenerator.m +++ b/macosx/HBPreviewGenerator.m @@ -280,7 +280,7 @@ job.video.twoPass = NO; // Init the libhb core - int level = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue]; + NSInteger level = [[NSUserDefaults standardUserDefaults] integerForKey:@"LoggingLevel"]; self.core = [[HBCore alloc] initWithLogLevel:level name:@"PreviewCore"]; HBStateFormatter *formatter = [[HBStateFormatter alloc] init]; diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m index fe603d5ea..dfe824409 100644 --- a/macosx/HBQueueController.m +++ b/macosx/HBQueueController.m @@ -86,7 +86,7 @@ static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext; _dockTile = [[HBDockTile alloc] initWithDockTile:[[NSApplication sharedApplication] dockTile] image:[[NSApplication sharedApplication] applicationIconImage]]; - int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue]; + NSInteger loggingLevel = [[NSUserDefaults standardUserDefaults] integerForKey:@"LoggingLevel"]; // Init a separate instance of libhb for the queue _core = [[HBCore alloc] initWithLogLevel:loggingLevel name:@"QueueCore"]; diff --git a/macosx/HBUtilities.m b/macosx/HBUtilities.m index 68eec8dbe..e6f9c67ec 100644 --- a/macosx/HBUtilities.m +++ b/macosx/HBUtilities.m @@ -220,9 +220,10 @@ static NSDateFormatter *_releaseDateFormatter = nil; BOOL chapterMarkers = (job.chaptersEnabled) && (job.range.type != HBRangeTypeChapters || job.range.chapterStart < job.range.chapterStop); - if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString:@".m4v"] || - ((YES == anyCodecAC3 || YES == chapterMarkers) && - [[[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"] isEqualToString:@"Auto"])) + NSString *defaultExtension = [[NSUserDefaults standardUserDefaults] objectForKey:@"DefaultMpegExtension"]; + + if ([defaultExtension isEqualToString:@".m4v"] || + ((YES == anyCodecAC3 || YES == chapterMarkers) && [defaultExtension isEqualToString:@"Auto"])) { extension = @"m4v"; } -- 2.40.0