Fix nullability warnings in builds using the macOS 10.12 SDK.

Fixes #70.
This commit is contained in:
Kyle Neideck 2016-08-22 00:42:55 +10:00
parent dad87b57b6
commit 23fd57713d
8 changed files with 28 additions and 7 deletions

View file

@ -699,6 +699,8 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
@ -795,6 +797,8 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
@ -856,6 +860,8 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;

View file

@ -246,7 +246,8 @@ static float const kSlidersSnapWithin = 5;
- (void) setUpWithApp:(NSRunningApplication*)app context:(BGMAppVolumes*)ctx {
#pragma unused (ctx)
[self setStringValue:[app localizedName]];
NSString* name = app.localizedName ? (NSString*)app.localizedName : @"";
[self setStringValue:name];
}
@end

View file

@ -249,6 +249,7 @@ OSStatus BGMPlayThrough::Start()
CAMemoryBarrier();
// Start our IOProcs
Assert(mInputDeviceIOProcID != NULL && mOutputDeviceIOProcID != NULL, "BGMPlayThrough::Start: Null IO proc ID");
mInputDevice.StartIOProc(mInputDeviceIOProcID);
// mOutputDevice.SetIOBufferSize(512);
mOutputDevice.StartIOProc(mOutputDeviceIOProcID);
@ -538,6 +539,7 @@ OSStatus BGMPlayThrough::InputDeviceIOProc(AudioObjectID inDevice,
// Stop this IOProc if the main thread has told us to
if(refCon->mInputDeviceIOProcShouldStop)
{
Assert(refCon->mInputDeviceIOProcID != NULL, "BGMPlayThrough::InputDeviceIOProc: !mInputDeviceIOProcID");
refCon->mInputDevice.StopIOProc(refCon->mInputDeviceIOProcID);
CAMemoryBarrier();
refCon->mInputDeviceIOProcShouldStop = false;
@ -580,6 +582,7 @@ OSStatus BGMPlayThrough::OutputDeviceIOProc(AudioObjectID inDevice,
// Stop this IOProc if the main thread has told us to
if(refCon->mOutputDeviceIOProcShouldStop)
{
Assert(refCon->mOutputDeviceIOProcID != NULL, "BGMPlayThrough::OutputDeviceIOProc: !mOutputDeviceIOProcID");
refCon->mOutputDevice.StopIOProc(refCon->mOutputDeviceIOProcID);
CAMemoryBarrier();
refCon->mOutputDeviceIOProcShouldStop = false;

View file

@ -116,8 +116,8 @@ private:
private:
CARingBuffer mBuffer;
AudioDeviceIOProcID mInputDeviceIOProcID;
AudioDeviceIOProcID mOutputDeviceIOProcID;
AudioDeviceIOProcID __nullable mInputDeviceIOProcID;
AudioDeviceIOProcID __nullable mOutputDeviceIOProcID;
CAHALAudioDevice mInputDevice { kAudioDeviceUnknown };
CAHALAudioDevice mOutputDevice { kAudioDeviceUnknown };

View file

@ -107,7 +107,11 @@ static BGMMusicPlayer* sSelectedMusicPlayer;
return self;
}
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
- (__nullable id) eventDidFail:(const AppleEvent*)event withError:(NSError*)error {
#else
- (id) eventDidFail:(const AppleEvent*)event withError:(NSError*)error {
#endif
// SBApplicationDelegate method. So far, this just logs the error.
#if DEBUG

View file

@ -249,7 +249,8 @@ id<NSObject> didLaunchToken, didTerminateToken;
// the colours from the built-in NSColorLists.
//
// TODO: Is it possible to make the tick mark grey as well?
BOOL darkMode = [@"Dark" isEqualToString:[[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"]];
NSString* __nullable appleInterfaceStyle = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
BOOL darkMode = [appleInterfaceStyle isEqualToString:@"Dark"];
NSDictionary* attributes = @{ NSFontAttributeName: [NSFont menuBarFontOfSize:0], // Default font size
NSForegroundColorAttributeName: [NSColor colorWithHue:0
saturation:0

View file

@ -34,8 +34,8 @@
#pragma clang assume_nonnull begin
static NSXPCListenerEndpoint* sBGMAppEndpoint = nil;
static NSXPCConnection* sBGMAppConnection = nil;
static NSXPCListenerEndpoint* __nullable sBGMAppEndpoint = nil;
static NSXPCConnection* __nullable sBGMAppConnection = nil;
@implementation BGMXPCHelperService {
NSXPCConnection* connection;
@ -73,7 +73,7 @@ static NSXPCConnection* sBGMAppConnection = nil;
if (!sBGMAppConnection && sBGMAppEndpoint) {
// Create a new connection to BGMApp from the endpoint
@synchronized(self) {
sBGMAppConnection = [[NSXPCConnection alloc] initWithListenerEndpoint:sBGMAppEndpoint];
sBGMAppConnection = [[NSXPCConnection alloc] initWithListenerEndpoint:(NSXPCListenerEndpoint* __nonnull)sBGMAppEndpoint];
NSAssert(sBGMAppConnection, @"NSXPCConnection::initWithListenerEndpoint returned nil");
[sBGMAppConnection setRemoteObjectInterface:[NSXPCInterface interfaceWithProtocol:@protocol(BGMAppXPCProtocol)]];

View file

@ -521,6 +521,9 @@
1CB8B35E1BBBB69C000E2DD1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_ASSIGN_ENUM = YES;
CLANG_WARN_EMPTY_BODY = YES;
@ -560,6 +563,9 @@
1CB8B35F1BBBB69C000E2DD1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_ASSIGN_ENUM = YES;
CLANG_WARN_EMPTY_BODY = YES;