diff --git a/Audio/Plugin.h b/Audio/Plugin.h index 1bbd29d83..524820c11 100644 --- a/Audio/Plugin.h +++ b/Audio/Plugin.h @@ -12,6 +12,7 @@ - (long)tell; - (long)read:(void *)buffer amount:(long)amount; //reads UP TO amount, returns amount read. - (void)close; +- (void)dealloc; @end @protocol CogContainer @@ -39,6 +40,8 @@ - (void)close; @optional +- (void)dealloc; + - (BOOL)setTrack:(NSURL *)track; //These are in NSObject, so as long as you are a subclass of that, you are ok. diff --git a/Audio/PluginController.m b/Audio/PluginController.m index e06fc6fdb..a33b13727 100644 --- a/Audio/PluginController.m +++ b/Audio/PluginController.m @@ -242,7 +242,7 @@ static PluginController *sharedPluginController = nil; - (NSArray *) urlsForContainerURL:(NSURL *)url { - NSString *ext = [[url path] pathExtension]; + NSString *ext = [url pathExtension]; NSArray *containerSet = [containers objectForKey:[ext lowercaseString]]; NSString *classString; if (containerSet) { @@ -265,7 +265,7 @@ static PluginController *sharedPluginController = nil; //Note: Source is assumed to already be opened. - (id) audioDecoderForSource:(id )source { - NSString *ext = [[[source url] path] pathExtension]; + NSString *ext = [[source url] pathExtension]; NSArray *decoders = [decodersByExtension objectForKey:[ext lowercaseString]]; NSString *classString; if (decoders) { @@ -287,7 +287,7 @@ static PluginController *sharedPluginController = nil; - (NSDictionary *)metadataForURL:(NSURL *)url { - NSString *ext = [[url path] pathExtension]; + NSString *ext = [url pathExtension]; NSArray *readers = [metadataReaders objectForKey:[ext lowercaseString]]; NSString *classString; if (readers) { @@ -311,7 +311,7 @@ static PluginController *sharedPluginController = nil; //If no properties reader is defined, use the decoder's properties. - (NSDictionary *)propertiesForURL:(NSURL *)url { - NSString *ext = [[url path] pathExtension]; + NSString *ext = [url pathExtension]; id source = [self audioSourceForURL:url]; if (![source open:url]) diff --git a/Cog.xcodeproj/xcshareddata/xcschemes/Cog.xcscheme b/Cog.xcodeproj/xcshareddata/xcschemes/Cog.xcscheme index 23eb2ce7e..fe28cbf20 100644 --- a/Cog.xcodeproj/xcshareddata/xcschemes/Cog.xcscheme +++ b/Cog.xcodeproj/xcshareddata/xcschemes/Cog.xcscheme @@ -62,11 +62,6 @@ - - )s { - [s retain]; - [source release]; source = s; } diff --git a/Plugins/CoreAudio/CoreAudioDecoder.m b/Plugins/CoreAudio/CoreAudioDecoder.m index 240cd68ba..6b6634a7a 100644 --- a/Plugins/CoreAudio/CoreAudioDecoder.m +++ b/Plugins/CoreAudio/CoreAudioDecoder.m @@ -40,6 +40,11 @@ } } +- (void) dealloc +{ + [self close]; +} + - (BOOL)open:(id)source; { OSStatus err; diff --git a/Plugins/CueSheet/CueSheetDecoder.m b/Plugins/CueSheet/CueSheetDecoder.m index 9ca2d82ca..4b2e3ea7c 100644 --- a/Plugins/CueSheet/CueSheetDecoder.m +++ b/Plugins/CueSheet/CueSheetDecoder.m @@ -119,6 +119,10 @@ track = nil; } +- (void)dealloc { + [self close]; +} + - (BOOL)setTrack:(NSURL *)url { //Same file, just next track...this may be unnecessary since frame-based decoding is done now... diff --git a/Plugins/Dumb/DumbContainer.m b/Plugins/Dumb/DumbContainer.m index b77e518c3..b0a100687 100755 --- a/Plugins/Dumb/DumbContainer.m +++ b/Plugins/Dumb/DumbContainer.m @@ -94,7 +94,7 @@ int scanCallback(void *data, int startOrder, long length) dumbfile_seek( df, 0, SEEK_SET ); DUH *duh; - NSString *ext = [[[url path] pathExtension] lowercaseString]; + NSString *ext = [[url pathExtension] lowercaseString]; duh = dumb_read_any_quick(df, [ext isEqualToString:@"mod"] ? 0 : 1, 0); dumbfile_close(df); diff --git a/Plugins/Dumb/DumbDecoder.m b/Plugins/Dumb/DumbDecoder.m index 3058aebe8..2f8ccc2b2 100755 --- a/Plugins/Dumb/DumbDecoder.m +++ b/Plugins/Dumb/DumbDecoder.m @@ -134,6 +134,17 @@ DUMBFILE *dumbfile_open_memory_and_free(char *data, long size) } } +- (id)init +{ + self = [super init]; + if (self) { + sampptr = NULL; + dsr = NULL; + duh = NULL; + } + return self; +} + int callbackLoop(void *data) { long * loops = (long *) data; @@ -176,7 +187,7 @@ int callbackLoop(void *data) dumbfile_seek( df, 0, SEEK_SET ); - NSString *ext = [[[[s url] path] pathExtension] lowercaseString]; + NSString *ext = [[[s url] pathExtension] lowercaseString]; duh = dumb_read_any(df, [ext isEqualToString:@"mod"] ? 0 : 1, subsong); if (!duh) { @@ -339,6 +350,11 @@ int callbackLoop(void *data) } } +- (void)dealloc +{ + [self close]; +} + - (void)setSource:(id)s { source = s; diff --git a/Plugins/Dumb/DumbMetadataReader.m b/Plugins/Dumb/DumbMetadataReader.m index fe00c3381..802de7332 100644 --- a/Plugins/Dumb/DumbMetadataReader.m +++ b/Plugins/Dumb/DumbMetadataReader.m @@ -56,7 +56,7 @@ } DUH *duh; - NSString *ext = [[[url path] pathExtension] lowercaseString]; + NSString *ext = [[url pathExtension] lowercaseString]; duh = dumb_read_any_quick(df, [ext isEqualToString:@"mod"] ? 0 : 1, 0); dumbfile_close(df); diff --git a/Plugins/FFMPEG/FFMPEGDecoder.m b/Plugins/FFMPEG/FFMPEGDecoder.m index 452e43ff3..fd57ecb31 100644 --- a/Plugins/FFMPEG/FFMPEGDecoder.m +++ b/Plugins/FFMPEG/FFMPEGDecoder.m @@ -57,6 +57,18 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op) } } +- (id)init +{ + self = [super init]; + if (self) { + lastReadPacket = NULL; + lastDecodedFrame = NULL; + codecCtx = NULL; + formatCtx = NULL; + } + return self; +} + - (BOOL)open:(id)s { int errcode, i; @@ -181,6 +193,11 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op) if (formatCtx) { avformat_close_input(&(formatCtx)); formatCtx = NULL; } } +- (void)dealloc +{ + [self close]; +} + - (int)readAudio:(void *)buf frames:(UInt32)frames { if ( totalFrames && framesRead >= totalFrames ) diff --git a/Plugins/FileSource/FileSource.m b/Plugins/FileSource/FileSource.m index 6d6e6a7cd..58c6af1bd 100644 --- a/Plugins/FileSource/FileSource.m +++ b/Plugins/FileSource/FileSource.m @@ -146,8 +146,6 @@ - (void)setURL:(NSURL *)url { - [url retain]; - [_url release]; _url = url; } @@ -160,8 +158,6 @@ - (void)dealloc { [self close]; [self setURL:nil]; - - [super dealloc]; } @end diff --git a/Plugins/FileSource/FileSource.xcodeproj/project.pbxproj b/Plugins/FileSource/FileSource.xcodeproj/project.pbxproj index b9a0d7ea1..5261ecb01 100644 --- a/Plugins/FileSource/FileSource.xcodeproj/project.pbxproj +++ b/Plugins/FileSource/FileSource.xcodeproj/project.pbxproj @@ -287,6 +287,7 @@ 1DEB913F08733D840010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; ENABLE_TESTABILITY = YES; GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -302,6 +303,7 @@ 1DEB914008733D840010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; CODE_SIGN_IDENTITY = "Developer ID Application"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_WARN_ABOUT_RETURN_TYPE = YES; diff --git a/Plugins/Flac/FlacDecoder.m b/Plugins/Flac/FlacDecoder.m index 916d5875c..af814c646 100644 --- a/Plugins/Flac/FlacDecoder.m +++ b/Plugins/Flac/FlacDecoder.m @@ -260,6 +260,11 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS blockBuffer = NULL; } +- (void)dealloc +{ + [self close]; +} + - (long)seek:(long)sample { if (!FLAC__stream_decoder_seek_absolute(decoder, sample)) diff --git a/Plugins/GME/GameDecoder.m b/Plugins/GME/GameDecoder.m index 20f515d69..52825185b 100755 --- a/Plugins/GME/GameDecoder.m +++ b/Plugins/GME/GameDecoder.m @@ -29,6 +29,15 @@ gme_err_t readCallback( void* data, void* out, long count ) return 0; //Return 0 for no error } +- (id)init +{ + self = [super init]; + if (self) { + emu = NULL; + } + return self; +} + - (BOOL)open:(id)s { [self setSource:s]; @@ -40,7 +49,7 @@ gme_err_t readCallback( void* data, void* out, long count ) gme_err_t error; - NSString *ext = [[[[source url] path] pathExtension] lowercaseString]; + NSString *ext = [[[source url] pathExtension] lowercaseString]; gme_type_t type = gme_identify_extension([ext UTF8String]); if (!type) @@ -170,6 +179,11 @@ gme_err_t readCallback( void* data, void* out, long count ) } } +- (void)dealloc +{ + [self close]; +} + + (NSArray *)fileTypes { return [NSArray arrayWithObjects:@"ay", @"gbs", @"hes", @"kss", @"nsf", @"nsfe", @"sap", @"sfm", @"sgc", @"spc", @"vgm", @"vgz", nil]; diff --git a/Plugins/GME/GameMetadataReader.m b/Plugins/GME/GameMetadataReader.m index c9cb9b3b3..3c8c9462f 100644 --- a/Plugins/GME/GameMetadataReader.m +++ b/Plugins/GME/GameMetadataReader.m @@ -42,7 +42,7 @@ if (![source seekable]) return 0; - NSString *ext = [[[url path] pathExtension] lowercaseString]; + NSString *ext = [[url pathExtension] lowercaseString]; gme_type_t type = gme_identify_extension([ext UTF8String]); if (!type) diff --git a/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm b/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm index d936dffcf..512b81868 100644 --- a/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm +++ b/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm @@ -179,6 +179,17 @@ static psf_file_callbacks source_callbacks = } } +- (id)init +{ + self = [super init]; + if (self) { + type = 0; + emulatorCore = NULL; + emulatorExtra = NULL; + } + return self; +} + - (NSDictionary *)metadata { return metadataList; @@ -1471,6 +1482,11 @@ static int usf_info(void * context, const char * name, const char * value) currentUrl = nil; } +- (void)dealloc +{ + [self close]; +} + - (long)seek:(long)frame { if (frame < framesRead || emulatorCore == NULL) { diff --git a/Plugins/Hively/Hively/HVLDecoder.m b/Plugins/Hively/Hively/HVLDecoder.m index 8283d0acf..5ef0ef201 100755 --- a/Plugins/Hively/Hively/HVLDecoder.m +++ b/Plugins/Hively/Hively/HVLDecoder.m @@ -184,6 +184,11 @@ void oneTimeInit() } } +- (void)dealloc +{ + [self close]; +} + + (NSArray *)fileTypes { return [NSArray arrayWithObjects:@"hvl", @"ahx", nil]; diff --git a/Plugins/MIDI/MIDI/MIDIMetadataReader.mm b/Plugins/MIDI/MIDI/MIDIMetadataReader.mm index f677593c9..cc0808208 100644 --- a/Plugins/MIDI/MIDI/MIDIMetadataReader.mm +++ b/Plugins/MIDI/MIDI/MIDIMetadataReader.mm @@ -50,7 +50,7 @@ midi_container midi_file; - if ( !midi_processor::process_file( data, [[[url absoluteString] pathExtension] UTF8String], midi_file) ) + if ( !midi_processor::process_file( data, [[url pathExtension] UTF8String], midi_file) ) return 0; int track_num; diff --git a/Plugins/Musepack/MusepackDecoder.m b/Plugins/Musepack/MusepackDecoder.m index c4e242417..4dd75a254 100644 --- a/Plugins/Musepack/MusepackDecoder.m +++ b/Plugins/Musepack/MusepackDecoder.m @@ -175,6 +175,12 @@ mpc_bool_t CanSeekProc(mpc_reader *p_reader) demux = NULL; } [source close]; + source = nil; +} + +- (void)dealloc +{ + [self close]; } - (long)seek:(long)sample diff --git a/Plugins/Opus/Opus.xcodeproj/project.pbxproj b/Plugins/Opus/Opus.xcodeproj/project.pbxproj index 2becd0a24..309f12392 100644 --- a/Plugins/Opus/Opus.xcodeproj/project.pbxproj +++ b/Plugins/Opus/Opus.xcodeproj/project.pbxproj @@ -323,7 +323,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; - CLANG_ENABLE_OBJC_ARC = NO; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Opus/Opus-Prefix.pch"; @@ -346,7 +345,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = YES; - CLANG_ENABLE_OBJC_ARC = NO; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Opus/Opus-Prefix.pch"; diff --git a/Plugins/Opus/Opus/OpusDecoder.m b/Plugins/Opus/Opus/OpusDecoder.m index 1456dd1a3..2cb666e67 100644 --- a/Plugins/Opus/Opus/OpusDecoder.m +++ b/Plugins/Opus/Opus/OpusDecoder.m @@ -16,20 +16,20 @@ int sourceRead(void *_stream, unsigned char *_ptr, int _nbytes) { - id source = (id)_stream; + id source = (__bridge id)_stream; return (int) [source read:_ptr amount:_nbytes]; } int sourceSeek(void *_stream, opus_int64 _offset, int _whence) { - id source = (id)_stream; + id source = (__bridge id)_stream; return ([source seek:_offset whence:_whence] ? 0 : -1); } int sourceClose(void *_stream) { - id source = (id)_stream; + id source = (__bridge id)_stream; [source close]; return 0; @@ -37,7 +37,7 @@ int sourceClose(void *_stream) opus_int64 sourceTell(void *_stream) { - id source = (id)_stream; + id source = (__bridge id)_stream; return [source tell]; } @@ -54,7 +54,7 @@ opus_int64 sourceTell(void *_stream) - (BOOL)open:(id)s { - source = [s retain]; + source = s; OpusFileCallbacks callbacks = { .read = sourceRead, @@ -64,7 +64,7 @@ opus_int64 sourceTell(void *_stream) }; int error; - opusRef = op_open_callbacks(source, &callbacks, NULL, 0, &error); + opusRef = op_open_callbacks((__bridge void *)source, &callbacks, NULL, 0, &error); if (!opusRef) { @@ -125,7 +125,12 @@ opus_int64 sourceTell(void *_stream) opusRef = NULL; [source close]; - [source release]; + source = nil; +} + +- (void)dealloc +{ + [self close]; } - (long)seek:(long)frame diff --git a/Plugins/Shorten/ShortenDecoder.mm b/Plugins/Shorten/ShortenDecoder.mm index e236f0af9..b7b80436e 100644 --- a/Plugins/Shorten/ShortenDecoder.mm +++ b/Plugins/Shorten/ShortenDecoder.mm @@ -81,6 +81,11 @@ shn_unload(handle);*/ } +- (void)dealloc +{ + [self close]; +} + - (NSDictionary *)properties { return [NSDictionary dictionaryWithObjectsAndKeys: diff --git a/Plugins/SilenceDecoder/SilenceDecoder.xcodeproj/project.pbxproj b/Plugins/SilenceDecoder/SilenceDecoder.xcodeproj/project.pbxproj index 4400231c4..2288123b3 100644 --- a/Plugins/SilenceDecoder/SilenceDecoder.xcodeproj/project.pbxproj +++ b/Plugins/SilenceDecoder/SilenceDecoder.xcodeproj/project.pbxproj @@ -225,7 +225,6 @@ 83F9D7EF1A884B44007ABEC2 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_ENABLE_OBJC_ARC = NO; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = SilenceDecoder/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; @@ -240,7 +239,6 @@ 83F9D7F01A884B44007ABEC2 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_ENABLE_OBJC_ARC = NO; CODE_SIGN_IDENTITY = "Developer ID Application"; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = SilenceDecoder/Info.plist; diff --git a/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m b/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m index 48485c376..91fdde348 100755 --- a/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m +++ b/Plugins/SilenceDecoder/SilenceDecoder/SilenceDecoder.m @@ -79,8 +79,6 @@ enum { channels = 2 }; - (void)setSource:(id)s { - [s retain]; - [source release]; source = s; } diff --git a/Plugins/SilenceDecoder/SilenceDecoder/SilenceSource.m b/Plugins/SilenceDecoder/SilenceDecoder/SilenceSource.m index 4cfdc025c..3596a4400 100644 --- a/Plugins/SilenceDecoder/SilenceDecoder/SilenceSource.m +++ b/Plugins/SilenceDecoder/SilenceDecoder/SilenceSource.m @@ -55,8 +55,6 @@ - (void)setURL:(NSURL *)url { - [url retain]; - [_url release]; _url = url; } @@ -69,8 +67,6 @@ - (void)dealloc { [self close]; [self setURL:nil]; - - [super dealloc]; } @end diff --git a/Plugins/Syntrax/Syntrax/jxsDecoder.m b/Plugins/Syntrax/Syntrax/jxsDecoder.m index 253cfa81b..af7e19ec6 100755 --- a/Plugins/Syntrax/Syntrax/jxsDecoder.m +++ b/Plugins/Syntrax/Syntrax/jxsDecoder.m @@ -58,6 +58,16 @@ BOOL probe_length( Song * synSong, unsigned long * intro_length, unsigned long * return YES; } +- (id)init +{ + self = [super init]; + if (self) { + synSong = NULL; + synPlayer = NULL; + } + return self; +} + - (BOOL)open:(id)s { [s seek:0 whence:SEEK_END]; @@ -221,6 +231,11 @@ BOOL probe_length( Song * synSong, unsigned long * intro_length, unsigned long * } } +- (void)dealloc +{ + [self close]; +} + + (NSArray *)fileTypes { return [NSArray arrayWithObjects:@"jxs", nil]; diff --git a/Plugins/Vorbis/VorbisDecoder.m b/Plugins/Vorbis/VorbisDecoder.m index 5445a7600..dd034cd16 100644 --- a/Plugins/Vorbis/VorbisDecoder.m +++ b/Plugins/Vorbis/VorbisDecoder.m @@ -122,6 +122,11 @@ long sourceTell(void *datasource) source = nil; } +- (void)dealloc +{ + [self close]; +} + - (long)seek:(long)frame { ov_pcm_seek(&vorbisRef, frame); diff --git a/Plugins/WavPack/WavPackDecoder.m b/Plugins/WavPack/WavPackDecoder.m index 574209768..8a0649b36 100644 --- a/Plugins/WavPack/WavPackDecoder.m +++ b/Plugins/WavPack/WavPackDecoder.m @@ -85,6 +85,15 @@ int32_t WriteBytesProc(void *ds, void *data, int32_t bcount) return -1; } +- (id)init +{ + self = [super init]; + if (self) + { + wpc = NULL; + } + return self; +} - (BOOL)open:(id)s { @@ -225,10 +234,18 @@ int32_t WriteBytesProc(void *ds, void *data, int32_t bcount) - (void)close { - WavpackCloseFile(wpc); + if (wpc) { + WavpackCloseFile(wpc); + wpc = NULL; + } source = nil; } +- (void)dealloc +{ + [self close]; +} + - (void)setSource:(id)s { source = s; diff --git a/Plugins/modplay/modplay/modDecoder.m b/Plugins/modplay/modplay/modDecoder.m index da9b76218..55bd30137 100755 --- a/Plugins/modplay/modplay/modDecoder.m +++ b/Plugins/modplay/modplay/modDecoder.m @@ -116,6 +116,16 @@ BOOL xm_probe_length( unsigned long * intro_length, unsigned long * loop_length, return YES; } +- (id)init +{ + self = [super init]; + if (self) { + player = NULL; + data = NULL; + } + return self; +} + - (BOOL)open:(id)s { [s seek:0 whence:SEEK_END]; @@ -343,6 +353,11 @@ BOOL xm_probe_length( unsigned long * intro_length, unsigned long * loop_length, } } +- (void)dealloc +{ + [self close]; +} + + (NSArray *)fileTypes { return [NSArray arrayWithObjects:@"s3m", @"s3z", @"xm", @"xmz", @"mo3", @"umx", nil]; diff --git a/Plugins/playptmod/playptmod/ptmodDecoder.m b/Plugins/playptmod/playptmod/ptmodDecoder.m index 204a0fdbb..82eead888 100755 --- a/Plugins/playptmod/playptmod/ptmodDecoder.m +++ b/Plugins/playptmod/playptmod/ptmodDecoder.m @@ -248,6 +248,11 @@ BOOL probe_length( void * ptmod, unsigned long * intro_length, unsigned long * l } } +- (void)dealloc +{ + [self close]; +} + + (NSArray *)fileTypes { return [NSArray arrayWithObjects:@"mod", @"mdz", @"stk", @"m15", @"fst", nil]; diff --git a/Plugins/sidplay/SidDecoder.mm b/Plugins/sidplay/SidDecoder.mm index d5c202744..621d94491 100755 --- a/Plugins/sidplay/SidDecoder.mm +++ b/Plugins/sidplay/SidDecoder.mm @@ -43,7 +43,7 @@ const SidTuneInfo * info = tune->getInfo(); - n_channels = info->isStereo() ? 2 : 1; + n_channels = info->sidChips(); length = 3 * 60 * 44100; @@ -74,9 +74,9 @@ SidConfig conf = engine->config(); conf.frequency = 44100; - conf.playback = info->isStereo() ? SidConfig::STEREO : SidConfig::MONO; + conf.playback = (info->sidChips() > 1) ? SidConfig::STEREO : SidConfig::MONO; conf.sidEmulation = builder; - if (engine->config(conf) < 0) + if (!engine->config(conf)) return NO; renderedTotal = 0; @@ -222,10 +222,13 @@ } } +- (void)dealloc +{ + [self close]; +} + - (void)setSource:(id)s { - [s retain]; - [source release]; source = s; } diff --git a/Plugins/sidplay/sidplay.xcodeproj/project.pbxproj b/Plugins/sidplay/sidplay.xcodeproj/project.pbxproj index 025ae0139..01dc7a672 100644 --- a/Plugins/sidplay/sidplay.xcodeproj/project.pbxproj +++ b/Plugins/sidplay/sidplay.xcodeproj/project.pbxproj @@ -314,7 +314,6 @@ 8314D6391A354DFE00EEE8E6 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_ENABLE_OBJC_ARC = NO; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = sidplay/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; @@ -329,7 +328,6 @@ 8314D63A1A354DFE00EEE8E6 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_ENABLE_OBJC_ARC = NO; CODE_SIGN_IDENTITY = "Developer ID Application"; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = sidplay/Info.plist; diff --git a/Plugins/vgmstream/vgmstream.xcodeproj/project.pbxproj b/Plugins/vgmstream/vgmstream.xcodeproj/project.pbxproj index fa6d2b478..caec708e4 100644 --- a/Plugins/vgmstream/vgmstream.xcodeproj/project.pbxproj +++ b/Plugins/vgmstream/vgmstream.xcodeproj/project.pbxproj @@ -315,7 +315,6 @@ 836F6B2318BDB80D0095E648 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_ENABLE_OBJC_ARC = NO; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "vgmstream/vgmstream-Prefix.pch"; @@ -338,7 +337,6 @@ 836F6B2418BDB80D0095E648 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_ENABLE_OBJC_ARC = NO; CODE_SIGN_IDENTITY = "Developer ID Application"; COMBINE_HIDPI_IMAGES = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; diff --git a/Plugins/vgmstream/vgmstream/VGMDecoder.m b/Plugins/vgmstream/vgmstream/VGMDecoder.m index 5815247e6..8757735cf 100644 --- a/Plugins/vgmstream/vgmstream/VGMDecoder.m +++ b/Plugins/vgmstream/vgmstream/VGMDecoder.m @@ -12,23 +12,27 @@ typedef struct _COGSTREAMFILE { STREAMFILE sf; - id file; + void *file; off_t offset; char name[PATH_LIMIT]; } COGSTREAMFILE; static void cogsf_seek(COGSTREAMFILE *this, off_t offset) { - if ([this->file seek:offset whence:SEEK_SET] != 0) + NSObject* _file = (__bridge NSObject *)(this->file); + id __unsafe_unretained file = (id) _file; + if ([file seek:offset whence:SEEK_SET] != 0) this->offset = offset; else - this->offset = [this->file tell]; + this->offset = [file tell]; } static off_t cogsf_get_size(COGSTREAMFILE *this) { - off_t offset = [this->file tell]; - [this->file seek:0 whence:SEEK_END]; - off_t size = [this->file tell]; - [this->file seek:offset whence:SEEK_SET]; + NSObject* _file = (__bridge NSObject *)(this->file); + id __unsafe_unretained file = (id) _file; + off_t offset = [file tell]; + [file seek:0 whence:SEEK_END]; + off_t size = [file tell]; + [file seek:offset whence:SEEK_SET]; return size; } @@ -42,17 +46,19 @@ static void cogsf_get_name(COGSTREAMFILE *this, char *buffer, size_t length) { } static size_t cogsf_read(COGSTREAMFILE *this, uint8_t *dest, off_t offset, size_t length) { + NSObject* _file = (__bridge NSObject *)(this->file); + id __unsafe_unretained file = (id) _file; size_t read; if (this->offset != offset) cogsf_seek(this, offset); - read = [this->file read:dest amount:length]; + read = [file read:dest amount:length]; if (read > 0) this->offset += read; return read; } static void cogsf_close(COGSTREAMFILE *this) { - [this->file release]; + CFBridgingRelease(this->file); free(this); } @@ -75,7 +81,7 @@ static STREAMFILE *cogsf_create(id file, const char *path) { streamfile->sf.get_realname = (void*)cogsf_get_name; streamfile->sf.open = (void*)cogsf_open; streamfile->sf.close = (void*)cogsf_close; - streamfile->file = [file retain]; + streamfile->file = (void*)CFBridgingRetain(file); streamfile->offset = 0; strncpy(streamfile->name, path, sizeof(streamfile->name)); @@ -210,6 +216,12 @@ err1: - (void)close { close_vgmstream( stream ); + stream = NULL; +} + +- (void)dealloc +{ + [self close]; } + (NSArray *)fileTypes