Housecleaning: Cleaned up a bunch of warnings

And a bunch of potential memory leaks, and some misbehavior that could
occur due to not checking for errors properly.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2025-06-24 03:44:38 -07:00
parent d220667deb
commit 234fb63267
26 changed files with 92 additions and 85 deletions

View file

@ -872,7 +872,7 @@ static void convert_be_to_le(uint8_t *buffer, size_t bitsPerSample, size_t bytes
if(!inputChanged) {
memcpy(&tempData[buffer_adder], inputBuffer, samplesRead * 2);
inputBuffer = &tempData[buffer_adder];
inputChanged = YES;
//inputChanged = YES;
}
convert_u16_to_s16((int16_t *)inputBuffer, samplesRead);
}
@ -912,10 +912,10 @@ static void convert_be_to_le(uint8_t *buffer, size_t bitsPerSample, size_t bytes
vDSP_vflt32((const int *)inputBuffer, 1, (float *)(&tempData[buffer_adder]), 1, samplesRead);
float scale = (1ULL << 31) / gain;
vDSP_vsdiv((const float *)(&tempData[buffer_adder]), 1, &scale, (float *)(&tempData[buffer_adder]), 1, samplesRead);
bitsPerSample = 32;
//bitsPerSample = 32;
bytesReadFromInput = samplesRead * sizeof(float);
isUnsigned = NO;
isFloat = YES;
//isUnsigned = NO;
//isFloat = YES;
inputBuffer = &tempData[buffer_adder];
}

View file

@ -146,7 +146,6 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA
- (BOOL)fullInit {
if(enableEqualizer) {
AudioComponentDescription desc;
NSError *err;
desc.componentType = kAudioUnitType_Effect;
desc.componentSubType = kAudioUnitSubType_GraphicEQ;
@ -161,8 +160,8 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA
return NO;
}
OSStatus _err = AudioComponentInstanceNew(comp, &_eq);
if(err) {
OSStatus status = AudioComponentInstanceNew(comp, &_eq);
if(status != noErr) {
return NO;
}
@ -209,8 +208,8 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA
AudioUnitReset(_eq, kAudioUnitScope_Global, 0);
_err = AudioUnitInitialize(_eq);
if(_err != noErr) {
status = AudioUnitInitialize(_eq);
if(status != noErr) {
return NO;
}

View file

@ -27,6 +27,7 @@ static void * kDSPHRTFNodeContext = &kDSPHRTFNodeContext;
static NSString *CogPlaybackDidResetHeadTracking = @"CogPlaybackDigResetHeadTracking";
#ifdef MOTION_MANAGER
static simd_float4x4 convertMatrix(CMRotationMatrix r) {
simd_float4x4 matrix = {
simd_make_float4(r.m33, -r.m31, r.m32, 0.0f),
@ -37,7 +38,6 @@ static simd_float4x4 convertMatrix(CMRotationMatrix r) {
return matrix;
}
#ifdef MOTION_MANAGER
static NSLock *motionManagerLock = nil;
API_AVAILABLE(macos(14.0)) static CMHeadphoneMotionManager *motionManager = nil;
static DSPHRTFNode *registeredMotionListener = nil;

View file

@ -191,7 +191,7 @@
- (void)reconnectInputAndReplumb {
Node *finalNode = nil;
if(rubberbandNode) {
if(DSPsLaunched) {
finalNode = [[controller bufferChain] finalNode];
if(finalNode) {
[rubberbandNode setPreviousNode:finalNode];

View file

@ -891,7 +891,6 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEFINES_MODULE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
@ -944,7 +943,6 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_NO_COMMON_BLOCKS = YES;

View file

@ -351,17 +351,9 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
AudioObjectAddPropertyListener(kAudioObjectSystemObject, &theAddress, default_device_changed, (__bridge void *_Nullable)(self));
defaultdevicelistenerapplied = YES;
}
} else {
err = noErr;
}
if(err != noErr) {
DLog(@"No output device with ID %d could be found.", deviceID);
return err;
}
return err;
return noErr;
}
- (BOOL)setOutputDeviceWithDeviceDict:(NSDictionary *)deviceDict {
@ -415,15 +407,18 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
.mElement = kAudioObjectPropertyElementMaster
};
__Verify_noErr(AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &theAddress, 0, NULL, &propsize));
OSStatus status = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &theAddress, 0, NULL, &propsize);
if(status != noErr) return;
UInt32 nDevices = propsize / (UInt32)sizeof(AudioDeviceID);
AudioDeviceID *devids = (AudioDeviceID *)malloc(propsize);
__Verify_noErr(AudioObjectGetPropertyData(kAudioObjectSystemObject, &theAddress, 0, NULL, &propsize, devids));
status = AudioObjectGetPropertyData(kAudioObjectSystemObject, &theAddress, 0, NULL, &propsize, devids);
if(status != noErr) return;
theAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
AudioDeviceID systemDefault;
propsize = sizeof(systemDefault);
__Verify_noErr(AudioObjectGetPropertyData(kAudioObjectSystemObject, &theAddress, 0, NULL, &propsize, &systemDefault));
status = AudioObjectGetPropertyData(kAudioObjectSystemObject, &theAddress, 0, NULL, &propsize, &systemDefault);
if(status != noErr) return;
theAddress.mScope = kAudioDevicePropertyScopeOutput;
@ -431,17 +426,23 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
UInt32 isAlive = 0;
propsize = sizeof(isAlive);
theAddress.mSelector = kAudioDevicePropertyDeviceIsAlive;
__Verify_noErr(AudioObjectGetPropertyData(devids[i], &theAddress, 0, NULL, &propsize, &isAlive));
status = AudioObjectGetPropertyData(devids[i], &theAddress, 0, NULL, &propsize, &isAlive);
if(status != noErr) return;
if(!isAlive) continue;
CFStringRef name = NULL;
propsize = sizeof(name);
theAddress.mSelector = kAudioDevicePropertyDeviceNameCFString;
__Verify_noErr(AudioObjectGetPropertyData(devids[i], &theAddress, 0, NULL, &propsize, &name));
status = AudioObjectGetPropertyData(devids[i], &theAddress, 0, NULL, &propsize, &name);
if(status != noErr) return;
propsize = 0;
theAddress.mSelector = kAudioDevicePropertyStreamConfiguration;
__Verify_noErr(AudioObjectGetPropertyDataSize(devids[i], &theAddress, 0, NULL, &propsize));
status = AudioObjectGetPropertyDataSize(devids[i], &theAddress, 0, NULL, &propsize);
if(status != noErr) {
if(name) CFRelease(name);
return;
}
if(propsize < sizeof(UInt32)) {
if(name) CFRelease(name);
@ -449,7 +450,15 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
}
AudioBufferList *bufferList = (AudioBufferList *)malloc(propsize);
__Verify_noErr(AudioObjectGetPropertyData(devids[i], &theAddress, 0, NULL, &propsize, bufferList));
if(!bufferList) {
if(name) CFRelease(name);
return;
}
status = AudioObjectGetPropertyData(devids[i], &theAddress, 0, NULL, &propsize, bufferList);
if(status != noErr) {
if(name) CFRelease(name);
return;
}
UInt32 bufferCount = bufferList->mNumberBuffers;
free(bufferList);
@ -466,7 +475,7 @@ current_device_listener(AudioObjectID inObjectID, UInt32 inNumberAddresses, cons
systemDefault,
&stop);
CFRelease(name);
if(name) CFRelease(name);
if(stop) {
break;

View file

@ -60,7 +60,6 @@ static void
_init_buffers(int fft_size) {
if(fft_size != _fft_size) {
fft_free();
_fft_size = 0;
_dftSetup = vDSP_DFT_zrop_CreateSetup(NULL, fft_size * 2, vDSP_DFT_FORWARD);
if(!_dftSetup) return;
@ -136,4 +135,5 @@ void __attribute__((destructor)) fft_free(void) {
_window = NULL;
_rawSpectrum = NULL;
_dftSetup = NULL;
_fft_size = 0;
}

View file

@ -1044,8 +1044,8 @@ static int hdcd_envelope(int32_t *samples, int count, int stride, int gain, int
/* hold a steady level */
if (gain == 0x800000) {
if (count > 0)
samples += count * stride;
/*if (count > 0)
samples += count * stride;*/
} else {
while (--count >= 0) {
APPLY_GAIN(*samples, gain);

View file

@ -139,7 +139,7 @@ static void vorbis_lpc_predict(float *coeff, float *prime, int m, float *data, l
}
void lpc_extrapolate2(float *const data, const size_t data_len, const int nch, const int lpc_order, const size_t extra_bkwd, const size_t extra_fwd, void **extrapolate_buffer, size_t *extrapolate_buffer_size) {
const size_t max_to_prime = (data_len < lpc_order) ? data_len : lpc_order;
//const size_t max_to_prime = (data_len < lpc_order) ? data_len : lpc_order;
const size_t min_data_len = (data_len < lpc_order) ? lpc_order : data_len;
const size_t tdata_size = sizeof(float) * (extra_bkwd + min_data_len + extra_fwd);
@ -153,6 +153,7 @@ void lpc_extrapolate2(float *const data, const size_t data_len, const int nch, c
if(new_size > *extrapolate_buffer_size) {
*extrapolate_buffer = realloc(*extrapolate_buffer, new_size);
*extrapolate_buffer_size = new_size;
if(!*extrapolate_buffer) return;
}
double *aut = (double *)(*extrapolate_buffer);

View file

@ -44,6 +44,7 @@ static void samples_len(unsigned* r1, unsigned* r2, unsigned N, unsigned M)
{
if (r1 == 0 || r2 == 0) return;
unsigned v = local_gcd(*r1, *r2); // v = 300
if (v == 0) return;
*r1 /= v; *r2 /= v; // r1 = 147; r2 = 160 == 1/300th of second
unsigned n = (v + N-1) / N; // n = 300/20 = 15 times
unsigned z = max(*r1, *r2); // z = 160

View file

@ -130,6 +130,7 @@ static VisualizationController *_sharedController = nil;
@synchronized(self) {
if(!sampleRate) {
free(visAudioTemp);
if(outPCM) bzero(outPCM, 4096 * sizeof(float));
if(outFFT) bzero(outFFT, 2048 * sizeof(float));
return;

View file

@ -55,7 +55,6 @@
if(path) {
[panel setDirectoryURL:[NSURL fileURLWithPath:path]];
}
[panel setTitle:@"Open to choose tree path"];
NSInteger result = [panel runModal];
if(result == NSModalResponseOK) {
[[SandboxBroker sharedSandboxBroker] addFolderIfMissing:[panel URL]];

View file

@ -452,8 +452,6 @@ static void *playlistControllerContext = &playlistControllerContext;
float fontSize = [[[NSUserDefaultsController sharedUserDefaultsController] defaults] floatForKey:@"fontSize"];
BOOL cellRating = NO;
if(pe) {
cellIdentifier = [tableColumn identifier];
NSUInteger index = [cellIdentifiers indexOfObject:cellIdentifier];
@ -527,7 +525,6 @@ static void *playlistControllerContext = &playlistControllerContext;
rating = 5;
cellText = [@"" stringByPaddingToLength:rating withString:filledStar startingAtIndex:0];
cellText = [cellText stringByPaddingToLength:5 withString:emptyStar startingAtIndex:0];
cellRating = YES;
break;
}

View file

@ -536,6 +536,7 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path) {
NSString *tagName = [PlaylistEntry metaTagForKey:key];
NSString *lowerKey = [tagName lowercaseString];
id valueObj = [metadata objectForKey:key];
id genericValue;
NSArray *values = nil;
NSString *firstValue = nil;
NSData *dataValue = nil;
@ -544,15 +545,22 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path) {
if([values count]) {
firstValue = values[0];
}
genericValue = values;
} else if([valueObj isKindOfClass:[NSString class]]) {
firstValue = (NSString *)valueObj;
values = @[firstValue];
genericValue = values;
} else if([valueObj isKindOfClass:[NSNumber class]]) {
NSNumber *numberValue = (NSNumber *)valueObj;
firstValue = [numberValue stringValue];
values = @[firstValue];
genericValue = values;
} else if([valueObj isKindOfClass:[NSData class]]) {
dataValue = (NSData *)valueObj;
genericValue = dataValue;
} else {
// Unknown object in metadata block
genericValue = valueObj;
}
if([lowerKey isEqualToString:@"bitrate"]) {
self.bitrate = [firstValue intValue];
@ -593,7 +601,7 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path) {
} else if([lowerKey isEqualToString:@"albumart"]) {
self.albumArt = dataValue;
} else {
[metaDict setObject:values forKey:key];
[metaDict setObject:genericValue forKey:key];
}
}
self.metadataBlob = [NSDictionary dictionaryWithDictionary:metaDict];

View file

@ -578,6 +578,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
[containerQueue waitUntilAllOperationsAreFinished];
progress = weakProgress;
[self setProgressJobStatus:progress];
[containerTask finish];
}
@ -682,8 +683,6 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
DLog(@"Valid urls: %@", validURLs);
progress = 0.0;
// Create actual entries
int count = (int)[validURLs count];
if(xmlData) count += [[xmlData objectForKey:@"entries"] count];
@ -867,10 +866,10 @@ NSURL *_Nullable urlForPath(NSString *_Nullable path);
double progressstep;
if(metadataLoadInProgress && [queueThisJob count]) {
if(metadataLoadInProgress) {
progressstep = 100.0 / (double)([queueThisJob count] + 1);
progress = progressstep;
} else if([queueThisJob count]) {
} else {
[self beginProgress:NSLocalizedString(@"ProgressActionLoadingMetadata", @"")];
[self beginProgressJob:NSLocalizedString(@"ProgressSubActionLoadingMetadata", @"") percentOfTotal:50.0];

View file

@ -166,7 +166,7 @@ static SInt64 getSizeProc(void *clientData) {
asbdSize = sizeof(asbd);
err = ExtAudioFileGetProperty(_in, kExtAudioFileProperty_FileDataFormat, &asbdSize, &asbd);
if(err != noErr) {
err = ExtAudioFileDispose(_in);
/*err =*/ ExtAudioFileDispose(_in);
return NO;
}
@ -174,7 +174,7 @@ static SInt64 getSizeProc(void *clientData) {
size = sizeof(total);
err = ExtAudioFileGetProperty(_in, kExtAudioFileProperty_FileLengthFrames, &size, &total);
if(err != noErr) {
err = ExtAudioFileDispose(_in);
/*err =*/ ExtAudioFileDispose(_in);
return NO;
}
totalFrames = total;
@ -182,7 +182,7 @@ static SInt64 getSizeProc(void *clientData) {
size = sizeof(afi);
err = ExtAudioFileGetProperty(_in, kExtAudioFileProperty_AudioFile, &size, &afi);
if(err != noErr) {
err = ExtAudioFileDispose(_in);
/*err =*/ ExtAudioFileDispose(_in);
return NO;
}
@ -193,7 +193,7 @@ static SInt64 getSizeProc(void *clientData) {
if(err == kAudioFileUnsupportedPropertyError) {
formatBitsPerSample = 0; // floating point formats apparently don't return this any more
} else {
err = ExtAudioFileDispose(_in);
/*err =*/ ExtAudioFileDispose(_in);
return NO;
}
}
@ -202,36 +202,36 @@ static SInt64 getSizeProc(void *clientData) {
size = sizeof(_bitrate);
err = AudioFileGetProperty(afi, kAudioFilePropertyBitRate, &size, &_bitrate);
if(err != noErr) {
err = ExtAudioFileDispose(_in);
/*err =*/ ExtAudioFileDispose(_in);
return NO;
}
err = AudioFileGetPropertyInfo(afi, kAudioFilePropertyChannelLayout, &size, NULL);
if(err != noErr || size == 0) {
err = ExtAudioFileDispose(_in);
/*err =*/ ExtAudioFileDispose(_in);
return NO;
}
AudioChannelLayout *acl = malloc(size);
err = AudioFileGetProperty(afi, kAudioFilePropertyChannelLayout, &size, acl);
if(err != noErr) {
free(acl);
err = ExtAudioFileDispose(_in);
/*err =*/ ExtAudioFileDispose(_in);
return NO;
}
uint32_t config = 0;
for(uint32_t i = 0; i < acl->mNumberChannelDescriptions; ++i) {
int channelNumber = ffat_get_channel_id(acl->mChannelDescriptions[i].mChannelLabel);
if(channelNumber >= 0) {
if(config & (1 << channelNumber)) {
if(channelNumber >= 0 && channelNumber <= 31) {
if(config & (1U << channelNumber)) {
free(acl);
err = ExtAudioFileDispose(_in);
/*err =*/ ExtAudioFileDispose(_in);
return NO;
}
config |= 1 << channelNumber;
} else {
free(acl);
err = ExtAudioFileDispose(_in);
/*err =*/ ExtAudioFileDispose(_in);
return NO;
}
}
@ -246,7 +246,7 @@ static SInt64 getSizeProc(void *clientData) {
size = sizeof(formatName);
err = AudioFormatGetProperty(kAudioFormatProperty_FormatName, asbdSize, &asbd, &size, &formatName);
if(err != noErr) {
err = ExtAudioFileDispose(_in);
/*err =*/ ExtAudioFileDispose(_in);
return NO;
}
@ -298,7 +298,7 @@ static SInt64 getSizeProc(void *clientData) {
err = ExtAudioFileSetProperty(_in, kExtAudioFileProperty_ClientDataFormat, sizeof(result), &result);
if(noErr != err) {
err = ExtAudioFileDispose(_in);
/*err =*/ ExtAudioFileDispose(_in);
return NO;
}

View file

@ -39,7 +39,6 @@
NSMutableArray *tracks = [NSMutableArray array];
BOOL embedded = NO;
CueSheet *cuesheet = nil;
NSDictionary *fileMetadata;
@ -79,7 +78,6 @@
if(sheetString && [sheetString length]) {
cuesheet = [CueSheet cueSheetWithString:sheetString withFilename:[url path]];
}
embedded = YES;
} else
cuesheet = [CueSheet cueSheetWithFile:[url path]];

View file

@ -47,8 +47,6 @@
AVFormatContext *formatCtx = NULL;
AVIOContext *ioCtx = NULL;
BOOL isStream = NO;
uint8_t *buffer = NULL;
FFMPEGReader *reader = nil;
@ -61,8 +59,6 @@
[source close];
source = nil;
isStream = YES;
formatCtx = avformat_alloc_context();
if(!formatCtx) {
ALog(@"Unable to allocate AVFormat context");
@ -112,8 +108,8 @@
}
int streamIndex = -1;
int metadataIndex = -1;
int attachedPicIndex = -1;
//int metadataIndex = -1;
//int attachedPicIndex = -1;
AVCodecParameters *codecPar;
for(i = 0; i < formatCtx->nb_streams; i++) {
@ -123,9 +119,9 @@
DLog(@"audio codec found");
streamIndex = i;
} else if(codecPar->codec_id == AV_CODEC_ID_TIMED_ID3) {
metadataIndex = i;
//metadataIndex = i;
} else if(stream->disposition & AV_DISPOSITION_ATTACHED_PIC) {
attachedPicIndex = i;
//attachedPicIndex = i;
} else {
stream->discard = AVDISCARD_ALL;
}

View file

@ -798,7 +798,7 @@ static void setDictionary(NSMutableDictionary *dict, NSString *tag, NSString *va
int seekBytesSkip = 0;
int errcode;
int errcode = 0;
int8_t *targetBuf = (int8_t *)buf;
memset(buf, 0, bytesToRead);

View file

@ -197,7 +197,6 @@
[panel setCanChooseFiles:NO];
[panel setFloatingPanel:YES];
[panel setDirectoryURL:[NSURL fileURLWithPath:pi.path]];
[panel setTitle:@"Open to add path"];
NSInteger result = [panel runModal];
if(result == NSModalResponseOK) {
[sandboxPathBehaviorController addUrl:[panel URL]];

View file

@ -2,6 +2,6 @@
@interface NSDictionary (Optional)
+ (NSDictionary *)initWithOptionalObjects:(const id _Nonnull [_Nullable])objects forKeys:(id<NSCopying> const[])keys count:(NSUInteger)cnt;
+ (NSDictionary *_Nonnull)initWithOptionalObjects:(const id _Nullable [_Nullable])objects forKeys:(id<NSCopying> const _Nullable [_Nullable])keys count:(NSUInteger)cnt;
@end

View file

@ -2,11 +2,13 @@
@implementation NSDictionary (Optional)
+ (NSDictionary *)initWithOptionalObjects:(const id _Nonnull [_Nullable])objects forKeys:(id<NSCopying> const[])keys count:(NSUInteger)cnt {
+ (NSDictionary *_Nonnull)initWithOptionalObjects:(const id _Nullable [_Nullable])objects forKeys:(id<NSCopying> const _Nullable [_Nullable])keys count:(NSUInteger)cnt {
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
for(NSUInteger i = 0; i < cnt; ++i) {
if(keys[i] && objects[i]) {
[dictionary setObject:objects[i] forKey:keys[i]];
if(keys && objects && cnt) {
for(NSUInteger i = 0; i < cnt; ++i) {
if(keys[i] && objects[i]) {
[dictionary setObject:objects[i] forKey:keys[i]];
}
}
}
return [NSDictionary dictionaryWithDictionary:dictionary];

View file

@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (SandboxBroker *)sharedSandboxBroker;
+ (NSURL *)urlWithoutFragment:(NSURL *)url;
+ (NSURL *_Nullable)urlWithoutFragment:(NSURL *)url;
+ (BOOL)isPath:(NSURL *)path aSubdirectoryOf:(NSURL *)directory;
+ (void)cleanupFolderAccess;
@ -28,8 +28,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)requestFolderForFile:(NSURL *)fileUrl;
- (const void *)beginFolderAccess:(NSURL *)fileUrl;
- (void)endFolderAccess:(const void *)handle;
- (const void *_Nullable)beginFolderAccess:(NSURL *)fileUrl;
- (void)endFolderAccess:(const void *_Nullable)handle;
- (BOOL)areAllPathsSafe:(NSArray *)urls;

View file

@ -96,11 +96,11 @@ static SandboxBroker *kSharedSandboxBroker = nil;
return [NSClassFromString(@"PlaylistController") sharedPersistentContainer];
}
+ (NSURL *)urlWithoutFragment:(NSURL *)url {
+ (NSURL *_Nullable)urlWithoutFragment:(NSURL *)url {
if(![url isFileURL]) return url;
NSString *s = [url path];
if(!s) return NULL; // Cool, the resource no longer exists!
if(!s) return nil; // Cool, the resource no longer exists!
NSRange fragmentRange = [s rangeOfString:@"#"
options:NSBackwardsSearch];
@ -116,12 +116,12 @@ static SandboxBroker *kSharedSandboxBroker = nil;
}
- (id)init {
id _self = [super init];
if(_self) {
self = [super init];
if(self) {
storage = [[NSMutableArray alloc] init];
}
return _self;
return self;
}
- (void)shutdown {
@ -421,7 +421,7 @@ static inline void dispatch_async_reentrant(dispatch_queue_t queue, dispatch_blo
}];
}
- (const void *)beginFolderAccess:(NSURL *)fileUrl {
- (const void *_Nullable)beginFolderAccess:(NSURL *)fileUrl {
if(!fileUrl) return NULL;
NSURL *folderUrl = [SandboxBroker urlWithoutFragment:fileUrl];
if(!folderUrl || ![folderUrl isFileURL]) return NULL;
@ -459,7 +459,7 @@ static inline void dispatch_async_reentrant(dispatch_queue_t queue, dispatch_blo
return NULL;
}
- (void)endFolderAccess:(const void *)handle {
- (void)endFolderAccess:(const void *_Nullable)handle {
if(!handle) return;
SandboxEntry *entry = CFBridgingRelease(handle);
if(!entry) return;

View file

@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic) BOOL isListening;
@property(nonatomic) BOOL isWorking;
+ (SpectrumViewSK *)createGuardWithFrame:(NSRect)frame;
+ (SpectrumViewSK *_Nullable)createGuardWithFrame:(NSRect)frame;
- (void)enableCameraControl;
- (void)startPlayback;

View file

@ -56,7 +56,7 @@ extern NSString *CogPlaybackDidStopNotificiation;
@implementation SpectrumViewSK
+ (SpectrumViewSK *)createGuardWithFrame:(NSRect)frame {
+ (SpectrumViewSK *_Nullable)createGuardWithFrame:(NSRect)frame {
if (![NSUserDefaults.standardUserDefaults boolForKey:@"spectrumSceneKit"])
return nil;