Migrate DUMB plug-in to use ARC.

CQTexperiment
Chris Moeller 2016-05-03 00:58:19 -07:00
parent 21c948212b
commit 80aa1b7e25
3 changed files with 18 additions and 11 deletions

View File

@ -421,6 +421,7 @@
1DEB913F08733D840010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
@ -436,6 +437,7 @@
1DEB914008733D840010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;

View File

@ -13,6 +13,16 @@
#import "Logging.h"
@interface DumbCallbackData : NSObject
{
@public NSString * baseUrl;
@public NSMutableArray * tracks;
}
@end
@implementation DumbCallbackData
@end
@implementation DumbContainer
+ (NSArray *)fileTypes
@ -30,15 +40,10 @@
return 1.0f;
}
struct callbackData
{
NSString * baseUrl;
NSMutableArray * tracks;
};
int scanCallback(void *data, int startOrder, long length)
{
struct callbackData * cbData = ( struct callbackData * ) data;
NSObject* _cbData = (__bridge NSObject *)(data);
DumbCallbackData * cbData = (id) _cbData;
[cbData->tracks addObject:[NSURL URLWithString:[cbData->baseUrl stringByAppendingFormat:@"#%i", startOrder]]];
@ -95,9 +100,11 @@ int scanCallback(void *data, int startOrder, long length)
dumbfile_close(df);
if ( duh ) {
struct callbackData data = { [url absoluteString], tracks };
DumbCallbackData * data = [[DumbCallbackData alloc] init];
data->baseUrl = [url absoluteString];
data->tracks = tracks;
dumb_it_scan_for_playable_orders( duh_get_it_sigdata( duh ), scanCallback, &data );
dumb_it_scan_for_playable_orders( duh_get_it_sigdata( duh ), scanCallback, (__bridge void *)data );
}
}

View File

@ -341,8 +341,6 @@ int callbackLoop(void *data)
- (void)setSource:(id<CogSource>)s
{
[s retain];
[source release];
source = s;
}