diff options
author | ritsuka <[email protected]> | 2015-01-19 15:35:35 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2015-01-19 15:35:35 +0000 |
commit | 2e7330affab701fb1443fec449e2b04690b32e33 (patch) | |
tree | b00b4de54ca6c26d5ecb7c13b15f344292b00988 | |
parent | ea82134f6199f79cb939781cb38dceaa1534dbc1 (diff) |
MacGui: enable and fix more compiler warnings in the Xcode project.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6772 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | macosx/Controller.h | 1 | ||||
-rw-r--r-- | macosx/HBAudioTrackPreset.h | 2 | ||||
-rw-r--r-- | macosx/HBCore.m | 2 | ||||
-rw-r--r-- | macosx/HBDistributedArray.m | 8 | ||||
-rw-r--r-- | macosx/HBFilters.m | 2 | ||||
-rw-r--r-- | macosx/HBJob.m | 1 | ||||
-rw-r--r-- | macosx/HBPreferencesController.m | 17 | ||||
-rw-r--r-- | macosx/HBPreviewController.m | 14 | ||||
-rw-r--r-- | macosx/HBPreviewGenerator.m | 10 | ||||
-rw-r--r-- | macosx/HBVideo.m | 8 | ||||
-rw-r--r-- | macosx/HBVideoController.m | 4 | ||||
-rw-r--r-- | macosx/HandBrake.xcodeproj/project.pbxproj | 14 | ||||
-rw-r--r-- | macosx/main.mm | 2 |
13 files changed, 43 insertions, 42 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index 499051225..fcdeaaaa8 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -21,7 +21,6 @@ @class HBOutputPanelController; @class HBPresetsViewController; @class HBPresetsManager; -@class HBDockTile; @class HBJob; diff --git a/macosx/HBAudioTrackPreset.h b/macosx/HBAudioTrackPreset.h index 9f6e09083..bc9475443 100644 --- a/macosx/HBAudioTrackPreset.h +++ b/macosx/HBAudioTrackPreset.h @@ -22,7 +22,7 @@ @property (nonatomic, readwrite) int bitRate; @property (nonatomic, readwrite) int gain; -@property (nonatomic, readwrite) float drc; +@property (nonatomic, readwrite) double drc; /** * Arrays of possible options for the track properties. diff --git a/macosx/HBCore.m b/macosx/HBCore.m index f516e9916..e3cf37d47 100644 --- a/macosx/HBCore.m +++ b/macosx/HBCore.m @@ -212,7 +212,7 @@ [HBUtilities writeToActivityLog:"%s scan done", self.name.UTF8String]; - return self.titles.count; + return (self.titles.count > 0); } - (void)cancelScan diff --git a/macosx/HBDistributedArray.m b/macosx/HBDistributedArray.m index c8b07ddcf..8dba9e5d1 100644 --- a/macosx/HBDistributedArray.m +++ b/macosx/HBDistributedArray.m @@ -195,20 +195,20 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk"; */ - (void)reload { - NSMutableArray *temp = nil;; + NSMutableArray *jobsArray = nil;; @try { - temp = [NSKeyedUnarchiver unarchiveObjectWithFile:self.fileURL.path]; + jobsArray = [NSKeyedUnarchiver unarchiveObjectWithFile:self.fileURL.path]; } @catch (NSException *exception) { - temp = nil; + jobsArray = nil; } // Swap the proxy objects representation with the new // one read from disk NSMutableArray *proxyArray = [NSMutableArray array]; - for (id anObject in temp) + for (id anObject in jobsArray) { NSString *uuid = [anObject uuid]; diff --git a/macosx/HBFilters.m b/macosx/HBFilters.m index c6d8216fe..0e7d77840 100644 --- a/macosx/HBFilters.m +++ b/macosx/HBFilters.m @@ -432,7 +432,7 @@ NSDictionary *_HandBrake_nlmeansTunesDict; self.deblock = [preset[@"PictureDeblock"] intValue]; } - self.grayscale = [preset[@"VideoGrayScale"] intValue]; + self.grayscale = [preset[@"VideoGrayScale"] boolValue]; } self.notificationsEnabled = YES; diff --git a/macosx/HBJob.m b/macosx/HBJob.m index c55e99fa8..5bff37510 100644 --- a/macosx/HBJob.m +++ b/macosx/HBJob.m @@ -145,6 +145,7 @@ NSString *HBContainerChangedNotification = @"HBContainerChangedNotificatio [_chapterTitles release]; [_uuid release]; + [_presetName release]; [super dealloc]; } diff --git a/macosx/HBPreferencesController.m b/macosx/HBPreferencesController.m index cd0874696..e53878cca 100644 --- a/macosx/HBPreferencesController.m +++ b/macosx/HBPreferencesController.m @@ -179,13 +179,12 @@ /*Opens the app browse window*/ - (IBAction) browseSendToApp: (id) sender { - NSOpenPanel * panel; - - panel = [NSOpenPanel openPanel]; - [panel setAllowsMultipleSelection: NO]; - [panel setCanChooseFiles: YES]; - [panel setCanChooseDirectories: NO ]; - NSString * sendToAppDirectory; + NSOpenPanel *panel = [NSOpenPanel openPanel]; + [panel setAllowsMultipleSelection:NO]; + [panel setCanChooseFiles:YES]; + [panel setCanChooseDirectories:NO]; + + NSString *sendToAppDirectory; if ([[NSUserDefaults standardUserDefaults] stringForKey:@"LastSendToAppDirectory"]) { sendToAppDirectory = [[NSUserDefaults standardUserDefaults] stringForKey:@"LastSendToAppDirectory"]; @@ -200,8 +199,8 @@ if (result == NSOKButton) { NSURL *sendToAppURL = [panel URL]; - NSURL *sendToAppDirectory = [sendToAppURL URLByDeletingLastPathComponent]; - [[NSUserDefaults standardUserDefaults] setObject:[sendToAppDirectory path] forKey:@"LastSendToAppDirectory"]; + NSURL *sendToAppDirectoryURL = [sendToAppURL URLByDeletingLastPathComponent]; + [[NSUserDefaults standardUserDefaults] setObject:[sendToAppDirectoryURL path] forKey:@"LastSendToAppDirectory"]; NSString *sendToAppName = [[sendToAppURL lastPathComponent] stringByDeletingPathExtension]; /* we set the name of the app to send to in the display field */ diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m index e921574c1..b139fa25d 100644 --- a/macosx/HBPreviewController.m +++ b/macosx/HBPreviewController.m @@ -35,17 +35,17 @@ { QTTime time = [self currentTime]; double timeInSeconds = (double)time.timeValue / time.timeScale; - UInt16 seconds = fmod(timeInSeconds, 60.0); - UInt16 minutes = fmod(timeInSeconds / 60.0, 60.0); - UInt16 hours = timeInSeconds / (60.0 * 60.0); - UInt16 milliseconds = (timeInSeconds - (int) timeInSeconds) * 1000; + UInt16 seconds = (UInt16)fmod(timeInSeconds, 60.0); + UInt16 minutes = (UInt16)fmod(timeInSeconds / 60.0, 60.0); + UInt16 hours = (UInt16)(timeInSeconds / (60.0 * 60.0)); + UInt16 milliseconds = (UInt16)(timeInSeconds - (int) timeInSeconds) * 1000; return [NSString stringWithFormat:@"%02d:%02d:%02d.%03d", hours, minutes, seconds, milliseconds]; } - (void) setCurrentTimeDouble: (double) value { long timeScale = [[self attributeForKey:QTMovieTimeScaleAttribute] longValue]; - [self setCurrentTime:QTMakeTime(value * timeScale, timeScale)]; + [self setCurrentTime:QTMakeTime((long long)value * timeScale, timeScale)]; } @end @@ -370,8 +370,8 @@ typedef enum ViewMode : NSUInteger { NSRect frame = [[self window] frame]; // Calculate border around content region of the frame - int borderX = frame.size.width - currentSize.width; - int borderY = frame.size.height - currentSize.height; + int borderX = (int)(frame.size.width - currentSize.width); + int borderY = (int)(frame.size.height - currentSize.height); // Make sure the frame is smaller than the screen NSSize maxSize = [[[self window] screen] visibleFrame].size; diff --git a/macosx/HBPreviewGenerator.m b/macosx/HBPreviewGenerator.m index 754ddaa1d..f58e157cb 100644 --- a/macosx/HBPreviewGenerator.m +++ b/macosx/HBPreviewGenerator.m @@ -7,18 +7,11 @@ #import "HBPreviewGenerator.h" #import "HBUtilities.h" -#import "Controller.h" #import "HBCore.h" #import "HBJob.h" #import "HBJob+HBJobConversion.h" -typedef enum EncodeState : NSUInteger { - EncodeStateIdle, - EncodeStateWorking, - EncodeStateCancelled, -} EncodeState; - @interface HBPreviewGenerator () @property (nonatomic, readonly, retain) NSMutableDictionary *picturePreviews; @@ -271,8 +264,6 @@ typedef enum EncodeState : NSUInteger { } } completationHandler:^(BOOL success) { - self.core = nil; - // Encode done, call the delegate and close libhb handle if (success) { @@ -282,6 +273,7 @@ typedef enum EncodeState : NSUInteger { { [self.delegate didCancelMovieCreation]; } + self.core = nil; }]; return YES; diff --git a/macosx/HBVideo.m b/macosx/HBVideo.m index 9fe897b16..b9e4b4435 100644 --- a/macosx/HBVideo.m +++ b/macosx/HBVideo.m @@ -404,7 +404,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; encodeBool(_twoPass); encodeBool(_turboTwoPass); - encodeInt(_advancedOptions); + encodeBool(_advancedOptions); encodeObject(_preset); encodeObject(_tune); encodeObject(_profile); @@ -434,7 +434,7 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; decodeBool(_twoPass); decodeBool(_turboTwoPass); - decodeInt(_advancedOptions); + decodeBool(_advancedOptions); decodeObject(_preset); decodeObject(_tune); decodeObject(_profile); @@ -624,10 +624,10 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; self.frameRate = intValue; // 2 Pass Encoding. - self.twoPass = [preset[@"VideoTwoPass"] intValue]; + self.twoPass = [preset[@"VideoTwoPass"] boolValue]; // Turbo 1st pass for 2 Pass Encoding. - self.turboTwoPass = [preset[@"VideoTurboTwoPass"] intValue]; + self.turboTwoPass = [preset[@"VideoTurboTwoPass"] boolValue]; self.notificationsEnabled = YES; } diff --git a/macosx/HBVideoController.m b/macosx/HBVideoController.m index e2d5d760d..5a22333ed 100644 --- a/macosx/HBVideoController.m +++ b/macosx/HBVideoController.m @@ -190,13 +190,13 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; granularity = [[NSUserDefaults standardUserDefaults] floatForKey:@"x264CqSliderFractional"]; } - [fVidQualitySlider setNumberOfTickMarks:((maxValue - minValue) * + [fVidQualitySlider setNumberOfTickMarks:(int)((maxValue - minValue) * (1.0f / granularity)) + 1]; // Replace the slider transformer with a new one, // configured with the new max/min/direction values. [fVidQualitySlider unbind:@"value"]; - HBQualityTransformer *transformer = [[[HBQualityTransformer alloc] initWithReversedDirection:direction min:minValue max:maxValue] autorelease]; + HBQualityTransformer *transformer = [[[HBQualityTransformer alloc] initWithReversedDirection:(direction != 0) min:minValue max:maxValue] autorelease]; [fVidQualitySlider bind:@"value" toObject:self withKeyPath:@"self.video.quality" options:@{NSValueTransformerBindingOption: transformer}]; } diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj index 30476e490..48805d713 100644 --- a/macosx/HandBrake.xcodeproj/project.pbxproj +++ b/macosx/HandBrake.xcodeproj/project.pbxproj @@ -1427,9 +1427,11 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; @@ -1447,13 +1449,16 @@ ); GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = NO; + GCC_WARN_SHADOW = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.6; OTHER_LDFLAGS = ( @@ -1473,9 +1478,11 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; @@ -1489,13 +1496,16 @@ GCC_ENABLE_OBJC_EXCEPTIONS = YES; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; - GCC_WARN_SHADOW = NO; + GCC_WARN_SHADOW = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; GCC_WARN_UNUSED_VARIABLE = YES; MACOSX_DEPLOYMENT_TARGET = 10.6; OTHER_LDFLAGS = ( diff --git a/macosx/main.mm b/macosx/main.mm index 6607ed3d2..1d7d6ed69 100644 --- a/macosx/main.mm +++ b/macosx/main.mm @@ -35,7 +35,7 @@ int main(int argc, const char **argv) // Tell sigaction to ignore the SIGINT signal // because we handle it already with gcd. - struct sigaction action = { 0 }; + struct sigaction action = { {0}, 0, 0 }; action.sa_handler = SIG_IGN; sigaction(SIGINT, &action, NULL); |