From c1a45135b3f5e10a6e0a66eba71ee5e87674bbcd Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Sun, 7 Jul 2019 00:37:56 -0700 Subject: [PATCH] Remove unnecessary cleanup code that impeded cases where multiple decoders could handle a single file type. --- Plugins/APL/APLDecoder.m | 1 - Plugins/AdPlug/AdPlug/AdPlugDecoder.mm | 5 ----- Plugins/ArchiveSource/ArchiveSource/ArchiveSource.m | 1 - Plugins/CoreAudio/CoreAudioDecoder.m | 1 - Plugins/CueSheet/CueSheetDecoder.m | 1 - Plugins/FileSource/FileSource.m | 1 - Plugins/Flac/FlacDecoder.m | 2 -- Plugins/GME/GameDecoder.m | 4 ---- Plugins/MIDI/MIDI/MIDIDecoder.mm | 2 -- Plugins/Musepack/MusepackDecoder.m | 2 -- Plugins/OpenMPT/OpenMPT/OMPTDecoder.mm | 5 ----- Plugins/Opus/Opus/OpusDecoder.m | 6 ------ Plugins/Shorten/ShortenDecoder.mm | 1 - Plugins/Vorbis/VorbisDecoder.m | 6 ------ Plugins/sidplay/SidDecoder.mm | 5 ----- 15 files changed, 43 deletions(-) diff --git a/Plugins/APL/APLDecoder.m b/Plugins/APL/APLDecoder.m index d6ee61346..98f99593d 100644 --- a/Plugins/APL/APLDecoder.m +++ b/Plugins/APL/APLDecoder.m @@ -32,7 +32,6 @@ return NO; NSURL *url = [s url]; - [s close]; apl = [APLFile createWithFile:[url path]]; diff --git a/Plugins/AdPlug/AdPlug/AdPlugDecoder.mm b/Plugins/AdPlug/AdPlug/AdPlugDecoder.mm index 8f3aef61f..c610b2032 100755 --- a/Plugins/AdPlug/AdPlug/AdPlugDecoder.mm +++ b/Plugins/AdPlug/AdPlug/AdPlugDecoder.mm @@ -138,11 +138,6 @@ - (void)close { [self cleanUp]; - - if (source) { - [source close]; - [self setSource:nil]; - } } - (void)dealloc diff --git a/Plugins/ArchiveSource/ArchiveSource/ArchiveSource.m b/Plugins/ArchiveSource/ArchiveSource/ArchiveSource.m index 9a88ee7a9..23c9d5d59 100644 --- a/Plugins/ArchiveSource/ArchiveSource/ArchiveSource.m +++ b/Plugins/ArchiveSource/ArchiveSource/ArchiveSource.m @@ -184,7 +184,6 @@ static BOOL g_parse_unpack_path(NSString * src, NSString ** archive, NSString ** - (void)dealloc { [self close]; - [self setURL:nil]; } @end diff --git a/Plugins/CoreAudio/CoreAudioDecoder.m b/Plugins/CoreAudio/CoreAudioDecoder.m index 6b6634a7a..2e2114f8d 100644 --- a/Plugins/CoreAudio/CoreAudioDecoder.m +++ b/Plugins/CoreAudio/CoreAudioDecoder.m @@ -50,7 +50,6 @@ OSStatus err; NSURL *url = [source url]; - [source close]; //There's no room for your kind around here! err = ExtAudioFileOpenURL((__bridge CFURLRef)url, &_in); if(noErr != err) { diff --git a/Plugins/CueSheet/CueSheetDecoder.m b/Plugins/CueSheet/CueSheetDecoder.m index 538cac2e9..18b42ecad 100644 --- a/Plugins/CueSheet/CueSheetDecoder.m +++ b/Plugins/CueSheet/CueSheetDecoder.m @@ -48,7 +48,6 @@ } NSURL *url = [s url]; - [s close]; cuesheet = [CueSheet cueSheetWithFile:[url path]]; diff --git a/Plugins/FileSource/FileSource.m b/Plugins/FileSource/FileSource.m index 8a7f18a2f..7dc82fb08 100644 --- a/Plugins/FileSource/FileSource.m +++ b/Plugins/FileSource/FileSource.m @@ -157,7 +157,6 @@ - (void)dealloc { [self close]; - [self setURL:nil]; } @end diff --git a/Plugins/Flac/FlacDecoder.m b/Plugins/Flac/FlacDecoder.m index af814c646..6b3d2c861 100644 --- a/Plugins/Flac/FlacDecoder.m +++ b/Plugins/Flac/FlacDecoder.m @@ -253,8 +253,6 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS { free(blockBuffer); } - [source close]; - [self setSource:nil]; decoder = NULL; blockBuffer = NULL; diff --git a/Plugins/GME/GameDecoder.m b/Plugins/GME/GameDecoder.m index 336685ec9..6179bcd03 100755 --- a/Plugins/GME/GameDecoder.m +++ b/Plugins/GME/GameDecoder.m @@ -200,10 +200,6 @@ gme_err_t readCallback( void* data, void* out, long count ) gme_delete(emu); emu = NULL; } - if (source) { - [source close]; - [self setSource:nil]; - } } - (void)dealloc diff --git a/Plugins/MIDI/MIDI/MIDIDecoder.mm b/Plugins/MIDI/MIDI/MIDIDecoder.mm index dccd0dbb2..8ace1d098 100755 --- a/Plugins/MIDI/MIDI/MIDIDecoder.mm +++ b/Plugins/MIDI/MIDI/MIDIDecoder.mm @@ -341,8 +341,6 @@ static OSType getOSType(const char * in_) { delete player; player = NULL; - [source close]; - source = nil; } - (void)dealloc diff --git a/Plugins/Musepack/MusepackDecoder.m b/Plugins/Musepack/MusepackDecoder.m index 4dd75a254..3536ce492 100644 --- a/Plugins/Musepack/MusepackDecoder.m +++ b/Plugins/Musepack/MusepackDecoder.m @@ -174,8 +174,6 @@ mpc_bool_t CanSeekProc(mpc_reader *p_reader) mpc_demux_exit(demux); demux = NULL; } - [source close]; - source = nil; } - (void)dealloc diff --git a/Plugins/OpenMPT/OpenMPT/OMPTDecoder.mm b/Plugins/OpenMPT/OpenMPT/OMPTDecoder.mm index 37947ed0b..69fcfdfe7 100755 --- a/Plugins/OpenMPT/OpenMPT/OMPTDecoder.mm +++ b/Plugins/OpenMPT/OpenMPT/OMPTDecoder.mm @@ -153,11 +153,6 @@ static void g_push_archive_extensions(std::vector & list) - (void)close { [self cleanUp]; - - if (source) { - [source close]; - [self setSource:nil]; - } } - (void)dealloc diff --git a/Plugins/Opus/Opus/OpusDecoder.m b/Plugins/Opus/Opus/OpusDecoder.m index 2cb666e67..0208d97d2 100644 --- a/Plugins/Opus/Opus/OpusDecoder.m +++ b/Plugins/Opus/Opus/OpusDecoder.m @@ -29,9 +29,6 @@ int sourceSeek(void *_stream, opus_int64 _offset, int _whence) int sourceClose(void *_stream) { - id source = (__bridge id)_stream; - [source close]; - return 0; } @@ -123,9 +120,6 @@ opus_int64 sourceTell(void *_stream) { op_free(opusRef); opusRef = NULL; - - [source close]; - source = nil; } - (void)dealloc diff --git a/Plugins/Shorten/ShortenDecoder.mm b/Plugins/Shorten/ShortenDecoder.mm index b7b80436e..0eddbd6a2 100644 --- a/Plugins/Shorten/ShortenDecoder.mm +++ b/Plugins/Shorten/ShortenDecoder.mm @@ -13,7 +13,6 @@ - (BOOL)open:(id)source { NSURL *url = [source url]; - [source close]; if (![[url scheme] isEqualToString:@"file"]) return NO; diff --git a/Plugins/Vorbis/VorbisDecoder.m b/Plugins/Vorbis/VorbisDecoder.m index dd034cd16..97c77da0b 100644 --- a/Plugins/Vorbis/VorbisDecoder.m +++ b/Plugins/Vorbis/VorbisDecoder.m @@ -27,9 +27,6 @@ int sourceSeek(void *datasource, ogg_int64_t offset, int whence) int sourceClose(void *datasource) { - id source = (__bridge id)datasource; - [source close]; - return 0; } @@ -117,9 +114,6 @@ long sourceTell(void *datasource) - (void)close { ov_clear(&vorbisRef); - - [source close]; - source = nil; } - (void)dealloc diff --git a/Plugins/sidplay/SidDecoder.mm b/Plugins/sidplay/SidDecoder.mm index baaab0cce..87dbdbe02 100755 --- a/Plugins/sidplay/SidDecoder.mm +++ b/Plugins/sidplay/SidDecoder.mm @@ -215,11 +215,6 @@ - (void)close { [self cleanUp]; - - if (source) { - [source close]; - [self setSource:nil]; - } } - (void)dealloc