diff options
Diffstat (limited to 'macosx')
35 files changed, 125 insertions, 48 deletions
diff --git a/macosx/HBAddPresetController.h b/macosx/HBAddPresetController.h index 63be604d5..7162767fd 100644 --- a/macosx/HBAddPresetController.h +++ b/macosx/HBAddPresetController.h @@ -8,6 +8,8 @@ #import <Cocoa/Cocoa.h> +NS_ASSUME_NONNULL_BEGIN + @class HBPreset; @interface HBAddPresetController : NSWindowController @@ -17,3 +19,5 @@ @property (nonatomic, readonly) HBPreset *preset; @end + +NS_ASSUME_NONNULL_END diff --git a/macosx/HBAdvancedController.h b/macosx/HBAdvancedController.h index 8cf5a9ccc..f2f8714cb 100644 --- a/macosx/HBAdvancedController.h +++ b/macosx/HBAdvancedController.h @@ -13,7 +13,7 @@ */ @interface HBAdvancedController : NSViewController -@property (nonatomic, readwrite, strong) HBVideo *videoSettings; +@property (nonatomic, readwrite, weak) HBVideo *videoSettings; @property (nonatomic, readwrite, getter=isHidden) BOOL hidden; @property (nonatomic, readwrite, getter=isEnabled) BOOL enabled; diff --git a/macosx/HBAudioController.h b/macosx/HBAudioController.h index 6af06693c..1385d15d2 100644 --- a/macosx/HBAudioController.h +++ b/macosx/HBAudioController.h @@ -13,6 +13,6 @@ */ @interface HBAudioController : NSViewController -@property (nonatomic, readwrite, unsafe_unretained) HBAudio *audio; +@property (nonatomic, readwrite, weak) HBAudio *audio; @end diff --git a/macosx/HBAudioTrack.h b/macosx/HBAudioTrack.h index 76590973f..f46f854f5 100644 --- a/macosx/HBAudioTrack.h +++ b/macosx/HBAudioTrack.h @@ -41,8 +41,8 @@ extern NSString *keyAudioBitrate; @property (nonatomic, strong) NSNumber *drc; @property (nonatomic, strong) NSNumber *gain; @property (nonatomic, strong) NSNumber *videoContainerTag; -@property (nonatomic, unsafe_unretained) id<HBAudioTrackDataSource> dataSource; -@property (nonatomic, unsafe_unretained) id<HBAudioTrackDelegate> delegate; +@property (nonatomic, weak) id<HBAudioTrackDataSource> dataSource; +@property (nonatomic, weak) id<HBAudioTrackDelegate> delegate; @property (nonatomic, strong) NSMutableArray *codecs; @property (nonatomic, strong) NSMutableArray *mixdowns; diff --git a/macosx/HBChapterTitlesController.h b/macosx/HBChapterTitlesController.h index 5cf628a49..106261615 100644 --- a/macosx/HBChapterTitlesController.h +++ b/macosx/HBChapterTitlesController.h @@ -13,6 +13,6 @@ */ @interface HBChapterTitlesController : NSViewController -@property (nonatomic, readwrite, unsafe_unretained) HBJob *job; +@property (nonatomic, readwrite, weak) HBJob *job; @end diff --git a/macosx/HBCodingUtilities.h b/macosx/HBCodingUtilities.h index fd825971d..c8eb3763e 100644 --- a/macosx/HBCodingUtilities.h +++ b/macosx/HBCodingUtilities.h @@ -21,6 +21,8 @@ #define decodeObjectOrFail(x, class) x = [HBCodingUtilities decodeObjectOfClass:class forKey:OBJC_STRINGIFY(x) decoder:decoder]; if (x == nil) {NSLog(@"Failed to decode: %@", OBJC_STRINGIFY(x)); goto fail;} +NS_ASSUME_NONNULL_BEGIN + @interface HBCodingUtilities : NSObject /** @@ -37,6 +39,8 @@ * * @return the decoder object. */ -+ (id)decodeObjectOfClass:(Class)aClass forKey:(NSString *)key decoder:(NSCoder *)decoder; ++ (nullable id)decodeObjectOfClass:(Class)aClass forKey:(NSString *)key decoder:(NSCoder *)decoder; @end + +NS_ASSUME_NONNULL_END diff --git a/macosx/HBController.m b/macosx/HBController.m index 5074eded0..076a7a336 100644 --- a/macosx/HBController.m +++ b/macosx/HBController.m @@ -58,7 +58,7 @@ /// The HBCore used for scanning. @property (nonatomic, strong) HBCore *core; -@property (unsafe_unretained, nonatomic, readwrite) NSColor *labelColor; +@property (nonatomic, readwrite) NSColor *labelColor; @end diff --git a/macosx/HBCore.h b/macosx/HBCore.h index 58ecb43ca..1d7a4e279 100644 --- a/macosx/HBCore.h +++ b/macosx/HBCore.h @@ -11,6 +11,8 @@ @class HBPicture; @class HBTitle; +NS_ASSUME_NONNULL_BEGIN + // These constants specify the current state of HBCore. typedef NS_ENUM(NSUInteger, HBState) { HBStateIdle = HB_STATE_IDLE, ///< HB is doing nothing @@ -116,7 +118,7 @@ typedef void (^HBCoreCompletionHandler)(BOOL success); /** * An array of HBTitles found by the latest scan. */ -@property (nonatomic, readonly) NSArray *titles; +@property (nonatomic, readonly, nullable) NSArray *titles; /** * This function converts an image created by libhb (specified via index) @@ -129,10 +131,10 @@ typedef void (^HBCoreCompletionHandler)(BOOL success); * * @return a CGImageRef of the wanted image, NULL if the index is out of bounds. */ -- (CGImageRef)copyImageAtIndex:(NSUInteger)index - forTitle:(HBTitle *)title - pictureFrame:(HBPicture *)frame - deinterlace:(BOOL)deinterlace CF_RETURNS_RETAINED; +- (nullable CGImageRef)copyImageAtIndex:(NSUInteger)index + forTitle:(HBTitle *)title + pictureFrame:(HBPicture *)frame + deinterlace:(BOOL)deinterlace CF_RETURNS_RETAINED; /** * Initiates an asynchronous encode operation and returns immediately. @@ -162,3 +164,5 @@ typedef void (^HBCoreCompletionHandler)(BOOL success); - (void)resume; @end + +NS_ASSUME_NONNULL_END diff --git a/macosx/HBDVDDetector.h b/macosx/HBDVDDetector.h index 6e761f8de..3e7692a7b 100644 --- a/macosx/HBDVDDetector.h +++ b/macosx/HBDVDDetector.h @@ -7,14 +7,11 @@ * It may be used under the terms of the GNU General Public License. */ -#import <Cocoa/Cocoa.h> +#import <Foundation/Foundation.h> +NS_ASSUME_NONNULL_BEGIN @interface HBDVDDetector : NSObject -{ - NSString *path; - NSString *bsdName; -} + (HBDVDDetector *)detectorForPath: (NSString *)aPath; - (HBDVDDetector *)initWithPath: (NSString *)aPath NS_DESIGNATED_INITIALIZER; @@ -22,4 +19,6 @@ @property (nonatomic, getter=isVideoDVD, readonly) BOOL videoDVD; @property (nonatomic, readonly, copy) NSString *devicePath; -@end
\ No newline at end of file +@end + +NS_ASSUME_NONNULL_END
\ No newline at end of file diff --git a/macosx/HBDVDDetector.m b/macosx/HBDVDDetector.m index 8db9d36f2..50be26b61 100644 --- a/macosx/HBDVDDetector.m +++ b/macosx/HBDVDDetector.m @@ -28,6 +28,10 @@ @implementation HBDVDDetector +{ + NSString *path; + NSString *bsdName; +} + (HBDVDDetector *)detectorForPath: (NSString *)aPath { diff --git a/macosx/HBFilters.h b/macosx/HBFilters.h index 9d13a018b..1d1cdb9ff 100644 --- a/macosx/HBFilters.h +++ b/macosx/HBFilters.h @@ -7,6 +7,8 @@ #import <Foundation/Foundation.h> #import "HBPresetCoding.h" +NS_ASSUME_NONNULL_BEGIN + extern NSString * const HBFiltersChangedNotification; /** @@ -34,3 +36,5 @@ extern NSString * const HBFiltersChangedNotification; @property (nonatomic, readwrite) BOOL grayscale; @end + +NS_ASSUME_NONNULL_END diff --git a/macosx/HBJob.h b/macosx/HBJob.h index baaeda771..d9aca7953 100644 --- a/macosx/HBJob.h +++ b/macosx/HBJob.h @@ -19,6 +19,8 @@ #import "HBDistributedArray.h" +NS_ASSUME_NONNULL_BEGIN + extern NSString *HBContainerChangedNotification; extern NSString *HBChaptersChangedNotification; @@ -45,7 +47,7 @@ typedef NS_ENUM(NSUInteger, HBJobState){ /// Current state of the job. @property (nonatomic, readwrite) HBJobState state; -@property (nonatomic, readwrite, assign) HBTitle *title; +@property (nonatomic, readwrite, assign, nullable) HBTitle *title; @property (nonatomic, readonly) int titleIdx; @property (nonatomic, readwrite, copy) NSString *presetName; @@ -75,3 +77,5 @@ typedef NS_ENUM(NSUInteger, HBJobState){ @property (nonatomic, readonly) NSMutableArray *chapterTitles; @end + +NS_ASSUME_NONNULL_END diff --git a/macosx/HBPicture.h b/macosx/HBPicture.h index cc0f3dfd8..a717a4c69 100644 --- a/macosx/HBPicture.h +++ b/macosx/HBPicture.h @@ -9,6 +9,8 @@ @class HBTitle; +NS_ASSUME_NONNULL_BEGIN + extern NSString * const HBPictureChangedNotification; /** @@ -49,3 +51,4 @@ extern NSString * const HBPictureChangedNotification; @end +NS_ASSUME_NONNULL_END diff --git a/macosx/HBPictureController.h b/macosx/HBPictureController.h index 1460fa9e2..07dbfe40b 100644 --- a/macosx/HBPictureController.h +++ b/macosx/HBPictureController.h @@ -14,6 +14,6 @@ @property (nonatomic, readwrite, strong) HBFilters *filters; @property (nonatomic, readwrite, strong) HBPicture *picture; -@property (nonatomic, readwrite, unsafe_unretained) NSWindowController *previewWindow; +@property (nonatomic, readwrite, weak) NSWindowController *previewWindow; @end diff --git a/macosx/HBPreset.h b/macosx/HBPreset.h index 1b74bcd3a..10cf192d5 100644 --- a/macosx/HBPreset.h +++ b/macosx/HBPreset.h @@ -7,6 +7,8 @@ #import <Foundation/Foundation.h> #import "HBTreeNode.h" +NS_ASSUME_NONNULL_BEGIN + typedef NS_ENUM(NSUInteger, HBPresetFormat) { HBPresetFormatPlist, HBPresetFormatJson, @@ -60,7 +62,7 @@ typedef NS_ENUM(NSUInteger, HBPresetFormat) { /** * A long textual description of the preset. */ -@property (nonatomic, copy) NSString *presetDescription; +@property (nonatomic, copy, nullable) NSString *presetDescription; /** * Whether the preset is one of the HandBrake built-in ones or not. @@ -75,7 +77,7 @@ typedef NS_ENUM(NSUInteger, HBPresetFormat) { /** * The actual content of the preset. */ -@property (nonatomic, strong) NSDictionary *content; +@property (nonatomic, strong, nullable) NSDictionary *content; /** * A dictionary representation of the preset. @@ -83,3 +85,6 @@ typedef NS_ENUM(NSUInteger, HBPresetFormat) { @property (readonly, copy) NSDictionary *dictionary; @end + +NS_ASSUME_NONNULL_END + diff --git a/macosx/HBPreset.m b/macosx/HBPreset.m index 4fcb82495..12c9017f0 100644 --- a/macosx/HBPreset.m +++ b/macosx/HBPreset.m @@ -29,7 +29,10 @@ _name = [title copy]; _isBuiltIn = builtIn; _content = [content copy]; - _presetDescription = [content[@"PresetDescription"] copy]; + if ([content[@"PresetDescription"] isKindOfClass:[NSString class]]) + { + _presetDescription = [content[@"PresetDescription"] copy]; + } } return self; } diff --git a/macosx/HBPresetsManager.h b/macosx/HBPresetsManager.h index 4921768e9..f9fbd9770 100644 --- a/macosx/HBPresetsManager.h +++ b/macosx/HBPresetsManager.h @@ -4,7 +4,9 @@ Homepage: <http://handbrake.fr/>. It may be used under the terms of the GNU General Public License. */ -#import <Cocoa/Cocoa.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN @class HBPreset; @@ -64,7 +66,7 @@ extern NSString *HBPresetsChangedNotification; * * @return The index path whose corresponding value is equal to the preset. Returns nil if not found. */ -- (NSIndexPath *)indexPathOfPreset:(HBPreset *)preset; +- (nullable NSIndexPath *)indexPathOfPreset:(HBPreset *)preset; /** * Adds back the built in presets. @@ -72,3 +74,5 @@ extern NSString *HBPresetsChangedNotification; - (void)generateBuiltInPresets; @end + +NS_ASSUME_NONNULL_END diff --git a/macosx/HBPresetsViewController.h b/macosx/HBPresetsViewController.h index 7dffd5f73..baa130117 100644 --- a/macosx/HBPresetsViewController.h +++ b/macosx/HBPresetsViewController.h @@ -20,7 +20,7 @@ - (instancetype)initWithPresetManager:(HBPresetsManager *)presetManager; -@property (nonatomic, readwrite, unsafe_unretained) id<HBPresetsViewControllerDelegate> delegate; +@property (nonatomic, readwrite, weak) id<HBPresetsViewControllerDelegate> delegate; - (IBAction)exportPreset:(id)sender; - (IBAction)importPreset:(id)sender; @@ -30,7 +30,7 @@ - (IBAction)insertFolder:(id)sender; -@property (unsafe_unretained, nonatomic, readonly) HBPreset *selectedPreset; +@property (nonatomic, readonly, weak) HBPreset *selectedPreset; @property (nonatomic, readonly) NSUInteger indexOfSelectedItem; @property (nonatomic, readwrite, getter=isEnabled) BOOL enabled; diff --git a/macosx/HBPreviewController.h b/macosx/HBPreviewController.h index 866c2a45d..d3f1faaca 100644 --- a/macosx/HBPreviewController.h +++ b/macosx/HBPreviewController.h @@ -11,6 +11,6 @@ @interface HBPreviewController : NSWindowController <NSWindowDelegate> @property (nonatomic, strong) HBPreviewGenerator *generator; -@property (nonatomic, readwrite, unsafe_unretained) NSWindowController *pictureSettingsWindow; +@property (nonatomic, readwrite, weak) NSWindowController *pictureSettingsWindow; @end diff --git a/macosx/HBPreviewGenerator.h b/macosx/HBPreviewGenerator.h index 4aa019c99..9ca549d9f 100644 --- a/macosx/HBPreviewGenerator.h +++ b/macosx/HBPreviewGenerator.h @@ -6,6 +6,8 @@ #import <Foundation/Foundation.h> +NS_ASSUME_NONNULL_BEGIN + @class HBCore; @class HBJob; @@ -22,12 +24,12 @@ @interface HBPreviewGenerator : NSObject -@property (nonatomic, unsafe_unretained) id <HBPreviewGeneratorDelegate> delegate; +@property (nonatomic, weak, nullable) id <HBPreviewGeneratorDelegate> delegate; - (instancetype)initWithCore:(HBCore *)core job:(HBJob *)job NS_DESIGNATED_INITIALIZER; /* Still image generator */ -- (CGImageRef) copyImageAtIndex: (NSUInteger) index shouldCache: (BOOL) cache CF_RETURNS_RETAINED; +- (nullable CGImageRef) copyImageAtIndex: (NSUInteger) index shouldCache: (BOOL) cache CF_RETURNS_RETAINED; @property (nonatomic, readonly) NSUInteger imagesCount; @property (nonatomic, readonly) CGSize imageSize; - (void) purgeImageCache; @@ -39,3 +41,5 @@ - (void) cancel; @end + +NS_ASSUME_NONNULL_END diff --git a/macosx/HBPreviewGenerator.m b/macosx/HBPreviewGenerator.m index a29b4e8c2..d3fb4ffee 100644 --- a/macosx/HBPreviewGenerator.m +++ b/macosx/HBPreviewGenerator.m @@ -16,8 +16,8 @@ @interface HBPreviewGenerator () @property (nonatomic, readonly) NSCache *picturePreviews; -@property (unsafe_unretained, nonatomic, readonly) HBCore *scanCore; -@property (unsafe_unretained, nonatomic, readonly) HBJob *job; +@property (nonatomic, readonly, weak) HBCore *scanCore; +@property (nonatomic, readonly, strong) HBJob *job; @property (nonatomic, strong) HBCore *core; diff --git a/macosx/HBQueueController.h b/macosx/HBQueueController.h index 9e497d8c5..c0efaba17 100644 --- a/macosx/HBQueueController.h +++ b/macosx/HBQueueController.h @@ -7,6 +7,8 @@ #import <Cocoa/Cocoa.h> #import <Growl/Growl.h> +NS_ASSUME_NONNULL_BEGIN + @class HBAppDelegate; @class HBController; @class HBOutputPanelController; @@ -18,8 +20,8 @@ /// The HBCore used for encoding. @property (nonatomic, readonly) HBCore *core; -@property (nonatomic, unsafe_unretained) HBController *controller; -@property (nonatomic, unsafe_unretained) HBAppDelegate *delegate; +@property (nonatomic, weak, nullable) HBController *controller; +@property (nonatomic, weak, nullable) HBAppDelegate *delegate; @property (nonatomic, readonly) NSUInteger count; @property (nonatomic, readonly) NSUInteger pendingItemsCount; @@ -41,3 +43,6 @@ - (IBAction)togglePauseResume:(id)sender; @end + +NS_ASSUME_NONNULL_END + diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m index 2a86bc5bc..406611df7 100644 --- a/macosx/HBQueueController.m +++ b/macosx/HBQueueController.m @@ -751,7 +751,7 @@ { // We pause the encode here so that it doesn't finish right after and then // screw up the sync while the window is open - [self togglePauseResume:nil]; + [self togglePauseResume:self]; NSString *alertTitle = [NSString stringWithFormat:NSLocalizedString(@"Stop This Encode and Remove It?", nil)]; @@ -790,7 +790,7 @@ // state, if it paused, it will resume encoding and vice versa. // In this case, we are paused from the calling window, so calling // [self togglePauseResume:nil]; Again will resume encoding - [self togglePauseResume:nil]; + [self togglePauseResume:self]; if (returnCode == NSAlertSecondButtonReturn) { @@ -986,7 +986,7 @@ { // We pause the encode here so that it doesn't finish right after and then // screw up the sync while the window is open - [self togglePauseResume:nil]; + [self togglePauseResume:self]; NSString *alertTitle = [NSString stringWithFormat:NSLocalizedString(@"Stop This Encode and Remove It ?", nil)]; // Which window to attach the sheet to? NSWindow *docWindow = nil; diff --git a/macosx/HBRange.h b/macosx/HBRange.h index 203b6b24c..bf18279b8 100644 --- a/macosx/HBRange.h +++ b/macosx/HBRange.h @@ -8,6 +8,8 @@ @class HBTitle; +NS_ASSUME_NONNULL_BEGIN + extern NSString *HBRangeChangedNotification; typedef NS_ENUM(NSUInteger, HBRangeType) { @@ -42,6 +44,8 @@ typedef NS_ENUM(NSUInteger, HBRangeType) { @property (nonatomic, readonly) NSString *duration; -@property (nonatomic, readwrite, unsafe_unretained) HBTitle *title; +@property (nonatomic, readwrite, weak, nullable) HBTitle *title; @end + +NS_ASSUME_NONNULL_END diff --git a/macosx/HBStateFormatter.h b/macosx/HBStateFormatter.h index f5b97f2fb..823230929 100644 --- a/macosx/HBStateFormatter.h +++ b/macosx/HBStateFormatter.h @@ -7,6 +7,8 @@ #import <Foundation/Foundation.h> #include "hb.h" +NS_ASSUME_NONNULL_BEGIN + /** * Instances of HBStateFormatter format and conver a hb_state_t struct to a textual representation. */ @@ -18,7 +20,7 @@ * @param s hb_state_t * @param title the title of the current job */ -- (NSString *)stateToString:(hb_state_t)s title:(NSString *)title; +- (NSString *)stateToString:(hb_state_t)s title:(nullable NSString *)title; /** * Returns a CGFloat containing the completion percent. @@ -39,3 +41,5 @@ @property (nonatomic, readwrite) BOOL showPassNumber; @end + +NS_ASSUME_NONNULL_END diff --git a/macosx/HBSubtitlesController.h b/macosx/HBSubtitlesController.h index df72a30dd..2be943cd8 100644 --- a/macosx/HBSubtitlesController.h +++ b/macosx/HBSubtitlesController.h @@ -13,6 +13,6 @@ */ @interface HBSubtitlesController : NSViewController -@property (nonatomic, readwrite, unsafe_unretained) HBSubtitles *subtitles; +@property (nonatomic, readwrite, weak) HBSubtitles *subtitles; @end diff --git a/macosx/HBTitle.h b/macosx/HBTitle.h index b60af075c..137ea1b09 100644 --- a/macosx/HBTitle.h +++ b/macosx/HBTitle.h @@ -7,6 +7,8 @@ #import <Foundation/Foundation.h> #include "hb.h" +NS_ASSUME_NONNULL_BEGIN + /** * HBTitles is an interface to the low-level hb_title_t. * the properties are lazy-loaded. @@ -53,3 +55,5 @@ @property (nonatomic, readonly) NSArray *chapters; @end + +NS_ASSUME_NONNULL_END diff --git a/macosx/HBTitleSelectionController.h b/macosx/HBTitleSelectionController.h index 3dda1984b..226340347 100644 --- a/macosx/HBTitleSelectionController.h +++ b/macosx/HBTitleSelectionController.h @@ -6,6 +6,8 @@ #import <Cocoa/Cocoa.h> +NS_ASSUME_NONNULL_BEGIN + @protocol HBTitleSelectionDelegate <NSObject> - (void)didSelectIndexes:(NSIndexSet *)indexes; @@ -17,3 +19,5 @@ - (instancetype)initWithTitles:(NSArray *)titles delegate:(id<HBTitleSelectionDelegate>)delegate; @end + +NS_ASSUME_NONNULL_END diff --git a/macosx/HBTitleSelectionController.m b/macosx/HBTitleSelectionController.m index e7d4d4a70..63622a093 100644 --- a/macosx/HBTitleSelectionController.m +++ b/macosx/HBTitleSelectionController.m @@ -12,7 +12,7 @@ @property (nonatomic, readonly) NSArray *titles; @property (nonatomic, readonly) NSMutableArray *selection; -@property (nonatomic, readonly, unsafe_unretained) id<HBTitleSelectionDelegate> delegate; +@property (nonatomic, readonly, weak) id<HBTitleSelectionDelegate> delegate; @end diff --git a/macosx/HBTreeNode.h b/macosx/HBTreeNode.h index b4c93f40e..be40a6125 100644 --- a/macosx/HBTreeNode.h +++ b/macosx/HBTreeNode.h @@ -6,6 +6,8 @@ #import <Foundation/Foundation.h> +NS_ASSUME_NONNULL_BEGIN + /** * Notify a delegate that something changed in the tree. * KVO observing a tree looked complicated an expensive, so this is a lightweight @@ -29,7 +31,7 @@ @property (nonatomic, readonly) NSMutableArray *children; @property (nonatomic) BOOL isLeaf; -@property (nonatomic, unsafe_unretained) id<HBTreeNodeDelegate> delegate; +@property (nonatomic, weak) id<HBTreeNodeDelegate> delegate; /** * Executes a given block using each object in the tree, starting with the root object and continuing through the tree to the last object. @@ -45,7 +47,7 @@ * * @return The index path whose corresponding value is equal to the preset. Returns nil if not found. */ -- (NSIndexPath *)indexPathOfObject:(id)obj; +- (nullable NSIndexPath *)indexPathOfObject:(id)obj; /** * Removes the object at the specified index path. @@ -62,3 +64,6 @@ - (void)removeObjectFromChildrenAtIndex:(NSUInteger)index; @end + +NS_ASSUME_NONNULL_END + diff --git a/macosx/HBUtilities.h b/macosx/HBUtilities.h index eed1cafcd..de4fe2036 100644 --- a/macosx/HBUtilities.h +++ b/macosx/HBUtilities.h @@ -6,6 +6,8 @@ #import <Foundation/Foundation.h> +NS_ASSUME_NONNULL_BEGIN + @interface HBUtilities : NSObject /** @@ -16,7 +18,7 @@ /** * Returns the url of the current <user>/Library/Application Support/HandBrake folder. */ -+ (NSURL *)appSupportURL; ++ (nullable NSURL *)appSupportURL; /** * Writes a message to standard error. * The message will show up in the output panel and in the activity log. @@ -46,3 +48,6 @@ videoCodec:(uint32_t)codec; @end + +NS_ASSUME_NONNULL_END + diff --git a/macosx/HBUtilities.m b/macosx/HBUtilities.m index 9471d5a27..eab00968e 100644 --- a/macosx/HBUtilities.m +++ b/macosx/HBUtilities.m @@ -23,7 +23,7 @@ NSURL *appSupportURL = [[[fileManager URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask] firstObject] URLByAppendingPathComponent:@"HandBrake"]; - if (![fileManager fileExistsAtPath:appSupportURL.path]) + if (appSupportURL && ![fileManager fileExistsAtPath:appSupportURL.path]) { [fileManager createDirectoryAtPath:appSupportURL.path withIntermediateDirectories:YES attributes:nil error:NULL]; } diff --git a/macosx/HBVideo.h b/macosx/HBVideo.h index 2b564d9be..9b593f869 100644 --- a/macosx/HBVideo.h +++ b/macosx/HBVideo.h @@ -9,6 +9,8 @@ @class HBJob; +NS_ASSUME_NONNULL_BEGIN + extern NSString * const HBVideoChangedNotification; /** @@ -46,7 +48,9 @@ extern NSString * const HBVideoChangedNotification; @property (nonatomic, readwrite) BOOL fastDecode; -@property (nonatomic, readwrite, unsafe_unretained) HBJob *job; +@property (nonatomic, readwrite, weak) HBJob *job; @property (nonatomic, readonly) NSString *completeTune; @end + +NS_ASSUME_NONNULL_END diff --git a/macosx/HBVideoController.h b/macosx/HBVideoController.h index 6ea8bc41c..b3725eaa7 100644 --- a/macosx/HBVideoController.h +++ b/macosx/HBVideoController.h @@ -16,6 +16,6 @@ - (instancetype)initWithAdvancedController:(HBAdvancedController *)advancedController; -@property (nonatomic, readwrite, unsafe_unretained) HBJob *job; +@property (nonatomic, readwrite, weak) HBJob *job; @end diff --git a/macosx/HBVideoController.m b/macosx/HBVideoController.m index 54a0e2d13..f67a11025 100644 --- a/macosx/HBVideoController.m +++ b/macosx/HBVideoController.m @@ -37,7 +37,7 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; } @property (nonatomic, strong, readwrite) HBAdvancedController *advancedController; -@property (nonatomic, readwrite, unsafe_unretained) HBVideo *video; +@property (nonatomic, readwrite, weak) HBVideo *video; @property (nonatomic, readwrite) BOOL presetViewEnabled; |