diff --git a/OrigamiEngine.podspec b/OrigamiEngine.podspec index 3e8f31e..a18f08b 100644 --- a/OrigamiEngine.podspec +++ b/OrigamiEngine.podspec @@ -1,13 +1,13 @@ Pod::Spec.new do |s| s.name = "OrigamiEngine" - s.version = "1.0.14" + s.version = "1.0.15" s.summary = "Lightweight iOS/OSX audio engine with flac, cue, mp3, m4a, m3u support." s.homepage = "https://github.com/ap4y/OrigamiEngine.git" s.license = 'MIT' s.author = { "ap4y" => "lod@pisem.net" } - s.source = { :git => "https://github.com/ap4y/OrigamiEngine.git", :tag => "1.0.14", :submodules => true } + s.source = { :git => "https://github.com/ap4y/OrigamiEngine.git", :tag => "1.0.15", :submodules => true } s.default_subspec = 'Core' - s.requires_arc = false + s.requires_arc = true s.ios.deployment_target = '5.0' s.osx.deployment_target = '10.7' diff --git a/OrigamiEngine.xcodeproj/project.pbxproj b/OrigamiEngine.xcodeproj/project.pbxproj index f5b6447..24562d3 100644 --- a/OrigamiEngine.xcodeproj/project.pbxproj +++ b/OrigamiEngine.xcodeproj/project.pbxproj @@ -510,7 +510,7 @@ 959B580015CEE13C00D44955 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0460; + LastUpgradeCheck = 0820; }; buildConfigurationList = 959B580315CEE13C00D44955 /* Build configuration list for PBXProject "OrigamiEngine" */; compatibilityVersion = "Xcode 3.2"; @@ -664,7 +664,6 @@ 9502C29F16C591C00054F4E3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CLANG_CXX_LIBRARY = "libc++"; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -696,7 +695,6 @@ 9502C2A016C591C00054F4E3 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CLANG_CXX_LIBRARY = "libc++"; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -729,15 +727,24 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -745,10 +752,14 @@ ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; @@ -757,19 +768,30 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; @@ -834,6 +856,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "OrigamiEngine/OrigamiEngine-Prefix.pch"; INFOPLIST_FILE = "OrigamiEngineTests/OrigamiEngineTests-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "origami.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = octest; }; @@ -850,6 +873,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "OrigamiEngine/OrigamiEngine-Prefix.pch"; INFOPLIST_FILE = "OrigamiEngineTests/OrigamiEngineTests-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "origami.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = octest; }; diff --git a/OrigamiEngine/ORGMConverter.m b/OrigamiEngine/ORGMConverter.m index cc2d1bd..b28f813 100644 --- a/OrigamiEngine/ORGMConverter.m +++ b/OrigamiEngine/ORGMConverter.m @@ -35,9 +35,9 @@ @interface ORGMConverter () { void *writeBuf; } -@property (retain, nonatomic) ORGMInputUnit *inputUnit; -@property (unsafe_unretained, nonatomic) ORGMOutputUnit *outputUnit; -@property (retain, nonatomic) NSMutableData *convertedData; +@property (strong, nonatomic) ORGMInputUnit *inputUnit; +@property (weak, nonatomic) ORGMOutputUnit *outputUnit; +@property (strong, nonatomic) NSMutableData *convertedData; @end @implementation ORGMConverter @@ -58,9 +58,8 @@ - (id)initWithInputUnit:(ORGMInputUnit *)inputUnit { - (void)dealloc { free(callbackBuffer); free(writeBuf); - [_convertedData release]; + _inputUnit = nil; - [super dealloc]; } #pragma mark - public @@ -158,7 +157,7 @@ - (int)convert:(void *)dest amount:(int)amount { ioData.mBuffers[0].mNumberChannels = _outputFormat.mChannelsPerFrame; ioData.mNumberBuffers = 1; - err = AudioConverterFillComplexBuffer(_converter, ACInputProc, self, &ioNumberFrames, &ioData, NULL); + err = AudioConverterFillComplexBuffer(_converter, ACInputProc, (__bridge void * _Nullable)(self), &ioNumberFrames, &ioData, NULL); int amountRead = ioData.mBuffers[0].mDataByteSize; if (err == kAudioConverterErr_InvalidInputSize) { amountRead += [self convert:dest + amountRead amount:amount - amountRead]; @@ -171,7 +170,7 @@ static OSStatus ACInputProc(AudioConverterRef inAudioConverter, UInt32* ioNumberDataPackets, AudioBufferList* ioData, AudioStreamPacketDescription** outDataPacketDescription, void* inUserData) { - ORGMConverter *converter = (ORGMConverter *)inUserData; + ORGMConverter *converter = (__bridge ORGMConverter *)inUserData; OSStatus err = noErr; int amountToWrite; diff --git a/OrigamiEngine/ORGMEngine.h b/OrigamiEngine/ORGMEngine.h index b364db8..490e299 100644 --- a/OrigamiEngine/ORGMEngine.h +++ b/OrigamiEngine/ORGMEngine.h @@ -61,12 +61,12 @@ typedef enum : NSInteger { @discussion Value will be provided only for the `ORGMEngineStateError`, with other states this propertie will return `nil`. */ -@property (retain, nonatomic, readonly) NSError *currentError; +@property (strong, nonatomic, readonly) NSError *currentError; /** The object that conforms ORGMEngineDelegate protocol and acts as the delegate. */ -@property (unsafe_unretained, nonatomic) id delegate; +@property (weak, nonatomic) id delegate; /** Starts new playback process from corresponding source with provided output type of output unit. diff --git a/OrigamiEngine/ORGMEngine.m b/OrigamiEngine/ORGMEngine.m index 7c129d1..e240f48 100644 --- a/OrigamiEngine/ORGMEngine.m +++ b/OrigamiEngine/ORGMEngine.m @@ -29,11 +29,11 @@ #import "ORGMCommonProtocols.h" @interface ORGMEngine () -@property (retain, nonatomic) ORGMInputUnit *input; -@property (retain, nonatomic) ORGMOutputUnit *output; -@property (retain, nonatomic) ORGMConverter *converter; +@property (strong, nonatomic) ORGMInputUnit *input; +@property (strong, nonatomic) ORGMOutputUnit *output; +@property (strong, nonatomic) ORGMConverter *converter; @property (assign, nonatomic) ORGMEngineState currentState; -@property (retain, nonatomic) NSError *currentError; +@property (strong, nonatomic) NSError *currentError; @end @implementation ORGMEngine @@ -53,10 +53,6 @@ - (id)init { - (void)dealloc { [self removeObserver:self forKeyPath:@"currentState"]; - [_input release]; - [_output release]; - [_converter release]; - [super dealloc]; } #pragma mark - public @@ -75,7 +71,6 @@ - (void)playUrl:(NSURL *)url withOutputUnitClass:(Class)outputUnitClass { ORGMInputUnit *input = [[ORGMInputUnit alloc] init]; self.input = input; - [input release]; if (![_input openWithUrl:url]) { self.currentState = ORGMEngineStateError; @@ -91,13 +86,11 @@ - (void)playUrl:(NSURL *)url withOutputUnitClass:(Class)outputUnitClass { ORGMConverter *converter = [[ORGMConverter alloc] initWithInputUnit:_input]; self.converter = converter; - [converter release]; ORGMOutputUnit *output = [[outputUnitClass alloc] initWithConverter:_converter]; output.outputFormat = _outputFormat; self.output = output; [_output setVolume:_volume]; - [output release]; if (![_converter setupWithOutputUnit:_output]) { self.currentState = ORGMEngineStateError; diff --git a/OrigamiEngine/ORGMInputUnit.m b/OrigamiEngine/ORGMInputUnit.m index 1a5a6c5..8c5a08a 100644 --- a/OrigamiEngine/ORGMInputUnit.m +++ b/OrigamiEngine/ORGMInputUnit.m @@ -54,10 +54,6 @@ - (id)init { - (void)dealloc { [self close]; free(inputBuffer); - [_decoder release]; - [_source release]; - [_data release]; - [super dealloc]; } #pragma mark - public diff --git a/OrigamiEngine/ORGMOutputUnit.m b/OrigamiEngine/ORGMOutputUnit.m index 30495df..13ce9d9 100644 --- a/OrigamiEngine/ORGMOutputUnit.m +++ b/OrigamiEngine/ORGMOutputUnit.m @@ -32,7 +32,7 @@ @interface ORGMOutputUnit () { AudioStreamBasicDescription _format; unsigned long long _amountPlayed; } -@property (retain, nonatomic) ORGMConverter *converter; +@property (strong, nonatomic) ORGMConverter *converter; - (int)readData:(void *)ptr amount:(int)amount; @end @@ -53,7 +53,6 @@ - (id)initWithConverter:(ORGMConverter *)converter { - (void)dealloc { [self stop]; - [super dealloc]; } #pragma mark - public @@ -130,7 +129,7 @@ static OSStatus Sound_Renderer(void *inRefCon, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) { - ORGMOutputUnit *output = (ORGMOutputUnit *)inRefCon; + ORGMOutputUnit *output = (__bridge ORGMOutputUnit *)inRefCon; OSStatus err = noErr; void *readPointer = ioData->mBuffers[0].mData; @@ -229,7 +228,7 @@ - (BOOL)setup { size); renderCallback.inputProc = Sound_Renderer; - renderCallback.inputProcRefCon = self; + renderCallback.inputProcRefCon = (__bridge void * _Nullable)(self); AudioUnitSetProperty(outputUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &renderCallback, diff --git a/OrigamiEngine/ORGMPluginManager.h b/OrigamiEngine/ORGMPluginManager.h index 62b7edf..1e2a9df 100644 --- a/OrigamiEngine/ORGMPluginManager.h +++ b/OrigamiEngine/ORGMPluginManager.h @@ -34,7 +34,7 @@ /** Custom plugin resolver that is used during plugin resolution process. Plugin manager fallbacks to the default implementation if `resolver` is empty or it returned `nil` value. */ -@property (nonatomic, unsafe_unretained) id resolver; +@property (nonatomic, weak) id resolver; + (ORGMPluginManager *)sharedManager; @@ -82,4 +82,4 @@ - (id)sourceForURL:(NSURL *)url error:(NSError **)error; - (id)decoderForSource:(id)source error:(NSError **)error; - (NSArray *)urlsForContainerURL:(NSURL *)url error:(NSError **)error; -@end \ No newline at end of file +@end diff --git a/OrigamiEngine/ORGMPluginManager.m b/OrigamiEngine/ORGMPluginManager.m index 6a6088e..d3f1213 100644 --- a/OrigamiEngine/ORGMPluginManager.m +++ b/OrigamiEngine/ORGMPluginManager.m @@ -89,13 +89,6 @@ - (id)init { return self; } -- (void)dealloc { - [_sources release]; - [_decoders release]; - [_containers release]; - [super dealloc]; -} - - (id)sourceForURL:(NSURL *)url error:(NSError **)error { id result; if (_resolver && (result = [_resolver sourceForURL:url error:error])) { @@ -115,7 +108,7 @@ - (void)dealloc { } return nil; } - return [[[source alloc] init] autorelease]; + return [[source alloc] init]; } - (id)decoderForSource:(id)source error:(NSError **)error { @@ -142,7 +135,7 @@ - (void)dealloc { return nil; } - return [[[decoder alloc] init] autorelease]; + return [[decoder alloc] init] ; } - (NSArray *)urlsForContainerURL:(NSURL *)url error:(NSError **)error { diff --git a/OrigamiEngine/Plugins/CoreAudioDecoder.m b/OrigamiEngine/Plugins/CoreAudioDecoder.m index e8fc6b2..ee497eb 100644 --- a/OrigamiEngine/Plugins/CoreAudioDecoder.m +++ b/OrigamiEngine/Plugins/CoreAudioDecoder.m @@ -39,16 +39,13 @@ @interface CoreAudioDecoder () { float frequency; long totalFrames; } -@property (retain, nonatomic) NSMutableDictionary *metadata; +@property (strong, nonatomic) NSMutableDictionary *metadata; @end @implementation CoreAudioDecoder - (void)dealloc { [self close]; - [_source release]; - [_metadata release]; - [super dealloc]; } #pragma mark - ORGMDecoder @@ -63,7 +60,7 @@ + (NSArray *)fileTypes { return nil; } - return [sAudioExtensions autorelease]; + return sAudioExtensions; } - (NSDictionary *)properties { @@ -103,8 +100,8 @@ - (int)readAudio:(void *)buf frames:(UInt32)frames { - (BOOL)open:(id)source { self.metadata = [NSMutableDictionary dictionary]; - _source = [source retain]; - OSStatus result = AudioFileOpenWithCallbacks(_source, audioFile_ReadProc, NULL, + _source = source; + OSStatus result = AudioFileOpenWithCallbacks((__bridge void * _Nonnull)(_source), audioFile_ReadProc, NULL, audioFile_GetSizeProc, NULL, 0, &_audioFile); @@ -229,7 +226,7 @@ - (NSMutableDictionary *)metadataForFile:(AudioFileID)audioFile { err = AudioFileGetProperty(audioFile, kAudioFilePropertyInfoDictionary, &dataSize, &dictionary); if (err != noErr) return result; - result = [NSMutableDictionary dictionaryWithDictionary:(NSDictionary *)dictionary]; + result = [NSMutableDictionary dictionaryWithDictionary:(__bridge NSDictionary *)dictionary]; CFRelease(dictionary); err = AudioFileGetPropertyInfo(audioFile, @@ -244,7 +241,7 @@ - (NSMutableDictionary *)metadataForFile:(AudioFileID)audioFile { &image); if (image) { [self.metadata setObject:image forKey:@"picture"]; - CFRelease(image); + CFRelease((__bridge CFTypeRef)(image)); } } else if ((image = [self imageDataFromID3Tag:audioFile])) { @@ -290,7 +287,7 @@ - (NSData *)imageDataFromID3Tag:(AudioFileID)audioFile { &id3TagSize, &id3Dict); - NSDictionary *tagDict = [NSDictionary dictionaryWithDictionary:(NSDictionary *)id3Dict]; + NSDictionary *tagDict = [NSDictionary dictionaryWithDictionary:(__bridge NSDictionary *)id3Dict]; free(rawID3Tag); CFRelease(id3Dict); @@ -311,7 +308,7 @@ static OSStatus audioFile_ReadProc(void *inClientData, UInt32 requestCount, void *buffer, UInt32 *actualCount) { - id source = inClientData; + id source = (__bridge id)(inClientData); // Skip potential id3v1 tags over HTTP connection if ([NSStringFromClass([source class]) isEqualToString:@"HTTPSource"] && @@ -328,7 +325,7 @@ static OSStatus audioFile_ReadProc(void *inClientData, } static SInt64 audioFile_GetSizeProc(void *inClientData) { - id source = inClientData; + id source = (__bridge id)(inClientData); SInt64 len = [source size]; return len; } diff --git a/OrigamiEngine/Plugins/CueSheet.m b/OrigamiEngine/Plugins/CueSheet.m index f829a5d..9aa8331 100644 --- a/OrigamiEngine/Plugins/CueSheet.m +++ b/OrigamiEngine/Plugins/CueSheet.m @@ -42,11 +42,6 @@ - (id)initWithURL:(NSURL *)url { return self; } -- (void)dealloc { - [_tracks release]; - [super dealloc]; -} - #pragma mark - private - (void)parseFileWithUrl:(NSURL *)url { NSStringEncoding encoding; @@ -159,18 +154,16 @@ - (void)parseFileWithUrl:(NSURL *)url { if (![scanner scanUpToString:@"\"" intoString:&artist]) continue; } else if ([command isEqualToString:@"TITLE"]) { - NSString **titleDest; + if (![scanner scanString:@"\"" intoString:nil]) + continue; + if (!path) { - titleDest = &album; - } else { - titleDest = &title; - } - - if (![scanner scanString:@"\"" intoString:nil]) + if (![scanner scanUpToString:@"\"" intoString: &album]) continue; - - if (![scanner scanUpToString:@"\"" intoString:titleDest]) + } else { + if (![scanner scanUpToString:@"\"" intoString: &title]) continue; + } } else if ([command isEqualToString:@"REM"]) { NSString *type; if (![scanner scanUpToCharactersFromSet:whitespace intoString:&type]) diff --git a/OrigamiEngine/Plugins/CueSheetContainer.m b/OrigamiEngine/Plugins/CueSheetContainer.m index c0fd673..456671f 100644 --- a/OrigamiEngine/Plugins/CueSheetContainer.m +++ b/OrigamiEngine/Plugins/CueSheetContainer.m @@ -47,7 +47,6 @@ + (NSArray *)urlsForContainerURL:(NSURL *)url { [tracks addObject:formattedUrl]; }]; - [cuesheet release]; return tracks; } diff --git a/OrigamiEngine/Plugins/CueSheetDecoder.m b/OrigamiEngine/Plugins/CueSheetDecoder.m index 79da4ed..4ad87f1 100644 --- a/OrigamiEngine/Plugins/CueSheetDecoder.m +++ b/OrigamiEngine/Plugins/CueSheetDecoder.m @@ -32,20 +32,15 @@ @interface CueSheetDecoder () { long trackStart; long trackEnd; } -@property (retain, nonatomic) id source; -@property (retain, nonatomic) id decoder; -@property (retain, nonatomic) CueSheet *cuesheet; +@property (strong, nonatomic) id source; +@property (strong, nonatomic) id decoder; +@property (strong, nonatomic) CueSheet *cuesheet; @end @implementation CueSheetDecoder - (void)dealloc { [self close]; - [_decoder release]; - [_source release]; - [_cuesheet release]; - - [super dealloc]; } #pragma mark - ORGMDecoder @@ -58,7 +53,7 @@ - (NSDictionary *)properties { NSMutableDictionary *properties = [[_decoder properties] mutableCopy]; [properties setObject:[NSNumber numberWithLong:(trackEnd - trackStart)] forKey:@"totalFrames"]; - return [properties autorelease]; + return properties; } - (NSDictionary *)metadata { @@ -94,7 +89,7 @@ - (int)readAudio:(void *)buf frames:(UInt32)frames { - (BOOL)open:(id)s { NSURL *url = [s url]; - self.cuesheet = [[[CueSheet alloc] initWithURL:url] autorelease]; + self.cuesheet = [[CueSheet alloc] initWithURL:url]; ORGMPluginManager *pluginManager = [ORGMPluginManager sharedManager]; for (int i = 0; i < _cuesheet.tracks.count; i++) { diff --git a/OrigamiEngine/Plugins/CueSheetTrack.h b/OrigamiEngine/Plugins/CueSheetTrack.h index dd59c89..4c83a24 100644 --- a/OrigamiEngine/Plugins/CueSheetTrack.h +++ b/OrigamiEngine/Plugins/CueSheetTrack.h @@ -22,7 +22,7 @@ // THE SOFTWARE. @interface CueSheetTrack : NSObject -@property (retain, nonatomic, readonly) NSURL *url; +@property (strong, nonatomic, readonly) NSURL *url; @property (copy, nonatomic, readonly) NSString *track; @property (copy, nonatomic, readonly) NSString *artist; @property (copy, nonatomic, readonly) NSString *album; diff --git a/OrigamiEngine/Plugins/CueSheetTrack.m b/OrigamiEngine/Plugins/CueSheetTrack.m index 1bc801d..93c636e 100644 --- a/OrigamiEngine/Plugins/CueSheetTrack.m +++ b/OrigamiEngine/Plugins/CueSheetTrack.m @@ -24,7 +24,7 @@ #import "CueSheetTrack.h" @interface CueSheetTrack () -@property (retain, nonatomic) NSURL *url; +@property (strong, nonatomic) NSURL *url; @property (copy, nonatomic) NSString *track; @property (copy, nonatomic) NSString *artist; @property (copy, nonatomic) NSString *album; @@ -45,14 +45,14 @@ + (id)trackWithURL:(NSURL *)url genre:(NSString *)genre year:(NSString *)year { - return [[[CueSheetTrack alloc] initWithURL:url + return [[CueSheetTrack alloc] initWithURL:url track:track time:seconds artist:artist album:album title:title genre:genre - year:year] autorelease]; + year:year]; } - (id)initWithURL:(NSURL *)url @@ -80,16 +80,4 @@ - (id)initWithURL:(NSURL *)url return self; } -- (void)dealloc { - [_track release]; - [_url release]; - [_artist release]; - [_album release]; - [_title release]; - [_genre release]; - [_year release]; - - [super dealloc]; -} - @end diff --git a/OrigamiEngine/Plugins/FileSource.m b/OrigamiEngine/Plugins/FileSource.m index 5a53879..7ed9b74 100644 --- a/OrigamiEngine/Plugins/FileSource.m +++ b/OrigamiEngine/Plugins/FileSource.m @@ -26,15 +26,13 @@ @interface FileSource () { FILE *_fd; } -@property (retain, nonatomic) NSURL *url; +@property (strong, nonatomic) NSURL *url; @end @implementation FileSource - (void)dealloc { [self close]; - [_url release]; - [super dealloc]; } #pragma mark - ORGMSource diff --git a/OrigamiEngine/Plugins/FlacDecoder.m b/OrigamiEngine/Plugins/FlacDecoder.m index 3010830..62b087d 100644 --- a/OrigamiEngine/Plugins/FlacDecoder.m +++ b/OrigamiEngine/Plugins/FlacDecoder.m @@ -39,8 +39,8 @@ @interface FlacDecoder () { long totalFrames; } -@property (retain, nonatomic) NSMutableDictionary *metadata; -@property (retain, nonatomic) id source; +@property (strong, nonatomic) NSMutableDictionary *metadata; +@property (strong, nonatomic) id source; @property (assign, nonatomic) BOOL endOfStream; - (FLAC__StreamDecoder *)decoder; @@ -56,9 +56,6 @@ @implementation FlacDecoder - (void)dealloc { [self close]; - [_metadata release]; - [source release]; - [super dealloc]; } #pragma mark - ORGMDecoder @@ -137,7 +134,7 @@ - (BOOL)open:(id)s { WriteCallback, MetadataCallback, ErrorCallback, - self + (__bridge void *)(self) ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { return NO; } @@ -189,7 +186,7 @@ FLAC__StreamDecoderReadStatus ReadCallback(const FLAC__StreamDecoder *decoder, FLAC__byte blockBuffer[], size_t *bytes, void *client_data) { - FlacDecoder *flacDecoder = (FlacDecoder *)client_data; + FlacDecoder *flacDecoder = (__bridge FlacDecoder *)client_data; *bytes = [[flacDecoder source] read:blockBuffer amount:*bytes]; if(*bytes == 0) { @@ -204,7 +201,7 @@ FLAC__StreamDecoderReadStatus ReadCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderSeekStatus SeekCallback(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) { - FlacDecoder *flacDecoder = (FlacDecoder *)client_data; + FlacDecoder *flacDecoder = (__bridge FlacDecoder *)client_data; if(![[flacDecoder source] seek:(long)absolute_byte_offset whence:SEEK_SET]) return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; @@ -215,7 +212,7 @@ FLAC__StreamDecoderSeekStatus SeekCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderTellStatus TellCallback(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) { - FlacDecoder *flacDecoder = (FlacDecoder *)client_data; + FlacDecoder *flacDecoder = (__bridge FlacDecoder *)client_data; off_t pos; if((pos = [[flacDecoder source] tell]) < 0) { @@ -227,14 +224,14 @@ FLAC__StreamDecoderTellStatus TellCallback(const FLAC__StreamDecoder *decoder, } FLAC__bool EOFCallback(const FLAC__StreamDecoder *decoder, void *client_data) { - FlacDecoder *flacDecoder = (FlacDecoder *)client_data; + FlacDecoder *flacDecoder = (__bridge FlacDecoder *)client_data; return (FLAC__bool)[flacDecoder endOfStream]; } FLAC__StreamDecoderLengthStatus LengthCallback(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) { - FlacDecoder *flacDecoder = (FlacDecoder *)client_data; + FlacDecoder *flacDecoder = (__bridge FlacDecoder *)client_data; if ([[flacDecoder source] seekable]) { long currentPos = [[flacDecoder source] tell]; @@ -255,7 +252,7 @@ FLAC__StreamDecoderWriteStatus WriteCallback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const sampleblockBuffer[], void *client_data) { - FlacDecoder *flacDecoder = (FlacDecoder *)client_data; + FlacDecoder *flacDecoder = (__bridge FlacDecoder *)client_data; void *blockBuffer = [flacDecoder blockBuffer]; @@ -322,7 +319,7 @@ void MetadataCallback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { if (metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { - FlacDecoder *flacDecoder = (FlacDecoder *)client_data; + FlacDecoder *flacDecoder = (__bridge FlacDecoder *)client_data; FLAC__StreamMetadata_VorbisComment comment = metadata->data.vorbis_comment; FLAC__uint32 count = metadata->data.vorbis_comment.num_comments; for (int i = 0; i < count; i++) { @@ -334,13 +331,13 @@ void MetadataCallback(const FLAC__StreamDecoder *decoder, [flacDecoder.metadata setObject:value forKey:[key lowercaseString]]; } } else if (metadata->type == FLAC__METADATA_TYPE_PICTURE) { - FlacDecoder *flacDecoder = (FlacDecoder *)client_data; + FlacDecoder *flacDecoder = (__bridge FlacDecoder *)client_data; FLAC__StreamMetadata_Picture picture = metadata->data.picture; NSData *picture_data = [NSData dataWithBytes:picture.data length:picture.data_length]; [flacDecoder.metadata setObject:picture_data forKey:@"picture"]; } else if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { - FlacDecoder *flacDecoder = (FlacDecoder *)client_data; + FlacDecoder *flacDecoder = (__bridge FlacDecoder *)client_data; flacDecoder->channels = metadata->data.stream_info.channels; flacDecoder->frequency = metadata->data.stream_info.sample_rate; diff --git a/OrigamiEngine/Plugins/HTTPSource.m b/OrigamiEngine/Plugins/HTTPSource.m index 57adb85..5cf9743 100644 --- a/OrigamiEngine/Plugins/HTTPSource.m +++ b/OrigamiEngine/Plugins/HTTPSource.m @@ -31,9 +31,9 @@ @interface HTTPSource () { BOOL _connectionDidFail; } -@property (retain, nonatomic) NSURLConnection *urlConnection; -@property (retain, nonatomic) NSMutableURLRequest *request; -@property (retain, nonatomic) NSFileHandle *fileHandle; +@property (strong, nonatomic) NSURLConnection *urlConnection; +@property (strong, nonatomic) NSMutableURLRequest *request; +@property (strong, nonatomic) NSFileHandle *fileHandle; @end @implementation HTTPSource @@ -43,11 +43,6 @@ @implementation HTTPSource - (void)dealloc { [self close]; [_fileHandle closeFile]; - [_fileHandle release]; - [_urlConnection release]; - [_request release]; - - [super dealloc]; } #pragma mark - ORGMSource @@ -72,7 +67,6 @@ - (BOOL)open:(NSURL *)url { delegate:self startImmediately:NO]; self.urlConnection = connection; - [connection release]; if ([NSThread isMainThread]) { [_urlConnection start]; diff --git a/OrigamiEngine/Plugins/OpusFileDecoder.m b/OrigamiEngine/Plugins/OpusFileDecoder.m index 869560c..ccf75ef 100644 --- a/OrigamiEngine/Plugins/OpusFileDecoder.m +++ b/OrigamiEngine/Plugins/OpusFileDecoder.m @@ -30,8 +30,8 @@ @interface OpusFileDecoder () { long totalFrames; } -@property (retain, nonatomic) NSMutableDictionary *metadata; -@property (retain, nonatomic) id source; +@property (strong, nonatomic) NSMutableDictionary *metadata; +@property (strong, nonatomic) id source; @end @@ -40,9 +40,6 @@ @implementation OpusFileDecoder - (void)dealloc { [self close]; - [_metadata release]; - [source release]; - [super dealloc]; } #pragma mark - ORGMDecoder @@ -87,7 +84,7 @@ - (BOOL)open:(id)s { }; int rc; - decoder = op_open_callbacks(source, &callbacks, NULL, 0, &rc); + decoder = op_open_callbacks((__bridge void *)(source), &callbacks, NULL, 0, &rc); if (rc != 0) return NO; @@ -143,20 +140,20 @@ - (void)parseMetadata { static int ReadCallback(void *stream, unsigned char *ptr, int nbytes) { - id source = stream; + id source = (__bridge id)(stream); int result = [source read:ptr amount:nbytes]; return result; } static int SeekCallback(void *stream, opus_int64 offset, int whence) { - id source = stream; + id source = (__bridge id)(stream); return [source seek:(long)offset whence:whence] ? 0 : -1; } static opus_int64 TellCallback(void *stream) { - id source = stream; + id source = (__bridge id)(stream); return [source tell]; }