Permalink
Browse files

converted to arc

  • Loading branch information...
1 parent bc3f460 commit e3677137bf5e360926edb26ba174bd3a054e94b9 @artifacts committed Nov 10, 2013
@@ -105,6 +105,8 @@
0569DECC1328AD9C00B3D016 /* DateParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 0569DE931328AD9C00B3D016 /* DateParser.m */; };
058339CD150CB747005A6D55 /* AFHTTPURLProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 058339CB150CB747005A6D55 /* AFHTTPURLProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
058339CE150CB747005A6D55 /* AFHTTPURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = 058339CC150CB747005A6D55 /* AFHTTPURLProtocol.m */; };
+ 05F1D1CA182F9D0400C2D295 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0566AE3A1332D7E300583E6A /* SystemConfiguration.framework */; };
+ 05F1D1CB182F9D0B00C2D295 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 0566AE571332DA2500583E6A /* libz.dylib */; };
379B6930177CBC38001174E8 /* crypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0569DE6B1328AD9C00B3D016 /* crypt.h */; };
379B6931177CBC38001174E8 /* ioapi.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0569DE6D1328AD9C00B3D016 /* ioapi.h */; };
379B6932177CBC38001174E8 /* mztools.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0569DE701328AD9C00B3D016 /* mztools.h */; };
@@ -279,6 +281,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 05F1D1CB182F9D0B00C2D295 /* libz.dylib in Frameworks */,
+ 05F1D1CA182F9D0400C2D295 /* SystemConfiguration.framework in Frameworks */,
051B387C1328AACA0057F2F5 /* UIKit.framework in Frameworks */,
051B387D1328AACA0057F2F5 /* Foundation.framework in Frameworks */,
051B387F1328AACA0057F2F5 /* CoreGraphics.framework in Frameworks */,
@@ -775,6 +779,7 @@
armv6,
"$(ARCHS_STANDARD_32_BIT)",
);
+ CLANG_ENABLE_OBJC_ARC = YES;
DSTROOT = /tmp/AFCache_iOS.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "src/iOS/AFCache-iOS-Prefix.pch";
@@ -796,9 +801,9 @@
"$(DEVELOPER_LIBRARY_DIR)/Frameworks",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = "AFCache-iOSTests/AFCache-iOSTests-Prefix.pch";
+ GCC_PREFIX_HEADER = "test/iOS/AFCache-iOSTests-Prefix.pch";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
- INFOPLIST_FILE = "AFCache-iOSTests/AFCache-iOSTests-Info.plist";
+ INFOPLIST_FILE = "test/iOS/AFCache-iOSTests-Info.plist";
OTHER_LDFLAGS = (
"-framework",
SenTestingKit,
@@ -869,6 +874,7 @@
armv6,
"$(ARCHS_STANDARD_32_BIT)",
);
+ CLANG_ENABLE_OBJC_ARC = YES;
DSTROOT = /tmp/AFCache_iOS.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "src/iOS/AFCache-iOS-Prefix.pch";
@@ -888,6 +894,7 @@
armv6,
"$(ARCHS_STANDARD_32_BIT)",
);
+ CLANG_ENABLE_OBJC_ARC = YES;
DSTROOT = /tmp/AFCache_iOS.dst;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "src/iOS/AFCache-iOS-Prefix.pch";
@@ -909,9 +916,9 @@
"$(DEVELOPER_LIBRARY_DIR)/Frameworks",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = "AFCache-iOSTests/AFCache-iOSTests-Prefix.pch";
+ GCC_PREFIX_HEADER = "test/iOS/AFCache-iOSTests-Prefix.pch";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
- INFOPLIST_FILE = "AFCache-iOSTests/AFCache-iOSTests-Info.plist";
+ INFOPLIST_FILE = "test/iOS/AFCache-iOSTests-Info.plist";
OTHER_LDFLAGS = (
"-framework",
SenTestingKit,
@@ -930,9 +937,9 @@
"$(DEVELOPER_LIBRARY_DIR)/Frameworks",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
- GCC_PREFIX_HEADER = "AFCache-iOSTests/AFCache-iOSTests-Prefix.pch";
+ GCC_PREFIX_HEADER = "test/iOS/AFCache-iOSTests-Prefix.pch";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
- INFOPLIST_FILE = "AFCache-iOSTests/AFCache-iOSTests-Info.plist";
+ INFOPLIST_FILE = "test/iOS/AFCache-iOSTests-Info.plist";
OTHER_LDFLAGS = (
"-framework",
SenTestingKit,
View
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "AFCache"
- s.version = "0.8.2"
+ s.version = "0.9.0"
s.summary = "AFCache is an HTTP disk cache for use on iPhone/iPad and OSX."
s.description = <<-DESC
@@ -25,6 +25,7 @@ Pod::Spec.new do |s|
s.ios.source_files = 'src/iOS/**/*.{h,m}'
s.osx.source_files = 'src/OSX/**/*.{h,m}'
+ s.requires_arc = true
# s.framework = 'SomeFramework'
# s.frameworks = 'SomeFramework', 'AnotherFramework'
@@ -26,10 +26,10 @@
unzFile _unzFile;
NSString* _password;
- id _delegate;
+ id __unsafe_unretained _delegate;
}
-@property (nonatomic, assign) id delegate;
+@property (nonatomic, unsafe_unretained) id delegate;
-(BOOL) CreateZipFile2:(NSString*) zipFile;
-(BOOL) CreateZipFile2:(NSString*) zipFile Password:(NSString*) password;
@@ -39,7 +39,6 @@ -(void) dealloc
[self CloseZipFile2];
self.delegate = nil;
- [super dealloc];
}
-(BOOL) CreateZipFile2:(NSString*) zipFile
@@ -261,7 +260,6 @@ -(BOOL) UnzipFileTo:(NSString*) path overWrite:(BOOL) overwrite
}
}
- [orgDate release];
orgDate = nil;
}
@@ -305,8 +303,6 @@ -(NSDate*) Date1980
initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *date = [gregorian dateFromComponents:comps];
- [comps release];
- [gregorian release];
return date;
}
@@ -90,35 +90,34 @@ - (void)consumePackageArchive:(AFCacheableItem*)cacheableItem userData:(NSDictio
userData, @"userData",
nil];
- [packageArchiveQueue_ addOperation:[[[NSInvocationOperation alloc] initWithTarget:self
+ [packageArchiveQueue_ addOperation:[[NSInvocationOperation alloc] initWithTarget:self
selector:@selector(unzipWithArguments:)
- object:arguments] autorelease]];
+ object:arguments]];
}
- (void)unzipWithArguments:(NSDictionary*)arguments {
- NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ @autoreleasepool {
- AFLog(@"starting to unzip archive");
+ AFLog(@"starting to unzip archive");
- // get arguments from dictionary
- NSString* pathToZip = [arguments objectForKey:@"pathToZip"];
- AFCacheableItem* cacheableItem = [arguments objectForKey:@"cacheableItem"];
- NSString* urlCacheStorePath = [arguments objectForKey:@"urlCacheStorePath"];
+ // get arguments from dictionary
+ NSString* pathToZip = [arguments objectForKey:@"pathToZip"];
+ AFCacheableItem* cacheableItem = [arguments objectForKey:@"cacheableItem"];
+ __unsafe_unretained NSString* urlCacheStorePath = [arguments objectForKey:@"urlCacheStorePath"];
BOOL preservePackageInfo = [[arguments objectForKey:@"preservePackageInfo"] boolValue];
NSDictionary *userData = [arguments objectForKey:@"userData"];
- ZipArchive *zip = [[ZipArchive alloc] init];
- BOOL success = [zip UnzipOpenFile:pathToZip];
+ ZipArchive *zip = [[ZipArchive alloc] init];
+ BOOL success = [zip UnzipOpenFile:pathToZip];
[zip UnzipFileTo:[pathToZip stringByDeletingLastPathComponent] overWrite:YES];
[zip UnzipCloseFile];
- [zip release];
if (success == YES) {
- NSString *pathToManifest = [NSString stringWithFormat:@"%@/%@", urlCacheStorePath, @"manifest.afcache"];
+ __unsafe_unretained NSString *pathToManifest = [NSString stringWithFormat:@"%@/%@", urlCacheStorePath, @"manifest.afcache"];
- AFPackageInfo *packageInfo;
- NSURL *itemURL = cacheableItem.url;
+ __unsafe_unretained AFPackageInfo *packageInfo;
+ __unsafe_unretained NSURL *itemURL = cacheableItem.url;
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:@selector(newPackageInfoByImportingCacheManifestAtPath:intoCacheStoreWithPath:withPackageURL:)]];
[inv setTarget:self];
@@ -133,18 +132,17 @@ - (void)unzipWithArguments:(NSDictionary*)arguments {
[inv performSelectorOnMainThread:@selector(invoke) withObject:nil waitUntilDone:YES];
[inv getReturnValue:&packageInfo];
- [packageInfo retain];
// store information about the imported items
if (preservePackageInfo == YES) {
[packageInfo.userData addEntriesFromDictionary:userData];
[[AFCache sharedInstance].packageInfos setObject:packageInfo forKey:[cacheableItem.url absoluteString]];
}
else
- {
- NSError *error = nil;
- [[NSFileManager defaultManager] removeItemAtPath:pathToZip error:&error];
- }
+ {
+ NSError *error = nil;
+ [[NSFileManager defaultManager] removeItemAtPath:pathToZip error:&error];
+ }
if (((id)cacheableItem.delegate) == self) {
NSAssert(false, @"you may not assign the AFCache singleton as a delegate.");
@@ -155,7 +153,6 @@ - (void)unzipWithArguments:(NSDictionary*)arguments {
waitUntilDone:YES];
[self performSelectorOnMainThread:@selector(archive) withObject:nil waitUntilDone:YES];
- [packageInfo autorelease];
AFLog(@"finished unzipping archive");
} else {
AFLog(@"Unzipping failed. Broken archive?");
@@ -164,7 +161,7 @@ - (void)unzipWithArguments:(NSDictionary*)arguments {
waitUntilDone:YES];
}
- [pool release];
+ }
}
@@ -191,7 +188,7 @@ - (AFPackageInfo*)newPackageInfoByImportingCacheManifestAtPath:(NSString*)manife
NSArray *entries = [manifest componentsSeparatedByString:@"\n"];
NSMutableDictionary* cacheInfoDictionary = [NSMutableDictionary dictionary];
- DateParser* dateParser = [[[DateParser alloc] init] autorelease];
+ DateParser* dateParser = [[DateParser alloc] init];
for (NSString *entry in entries) {
line++;
if ([entry length] == 0) {
@@ -251,22 +248,19 @@ - (AFPackageInfo*)newPackageInfoByImportingCacheManifestAtPath:(NSString*)manife
#warning BK: textEncodingName always nil here
#endif
- info.response = [[[NSURLResponse alloc] initWithURL: [NSURL URLWithString: URL]
+ info.response = [[NSURLResponse alloc] initWithURL: [NSURL URLWithString: URL]
MIMEType:mimeType
expectedContentLength: contentLength
- textEncodingName: nil]
- autorelease];
+ textEncodingName: nil];
[resourceURLs addObject:URL];
[cacheInfoDictionary setObject:info forKey:URL];
- [info release];
}
packageInfo.resourceURLs = [NSArray arrayWithArray:resourceURLs];
- [resourceURLs release];
// import generated cacheInfos in to the AFCache info store
[self storeCacheInfo:cacheInfoDictionary];
@@ -332,7 +326,7 @@ - (AFCacheableItem *)importObjectForURL:(NSURL *)url data:(NSData *)data
[self importCacheableItem:item withData:data];
- return [item autorelease];
+ return item;
}
}
View
@@ -119,11 +119,11 @@ typedef struct NetworkTimeoutIntervals {
@property BOOL cacheEnabled;
-@property (nonatomic, retain) NSMutableDictionary *cacheInfoStore;
-@property (nonatomic, retain) NSMutableDictionary *pendingConnections;
-@property (nonatomic, retain) NSDictionary *suffixToMimeTypeMap;
-@property (nonatomic, retain) NSMutableDictionary *packageInfos;
-@property (nonatomic, retain) NSDictionary *clientItems;
+@property (nonatomic, strong) NSMutableDictionary *cacheInfoStore;
+@property (nonatomic, strong) NSMutableDictionary *pendingConnections;
+@property (nonatomic, strong) NSDictionary *suffixToMimeTypeMap;
+@property (nonatomic, strong) NSMutableDictionary *packageInfos;
+@property (nonatomic, strong) NSDictionary *clientItems;
@property (nonatomic, assign) double maxItemFileSize;
@property (nonatomic, assign) double diskCacheDisplacementTresholdSize;
@property (nonatomic, assign) NetworkTimeoutIntervals networkTimeoutIntervals;
@@ -132,13 +132,13 @@ typedef struct NetworkTimeoutIntervals {
/*
* the current items in the download queue
*/
-@property (nonatomic, readonly) NSArray *itemsInDownloadQueue;
+@property (unsafe_unretained, nonatomic, readonly) NSArray *itemsInDownloadQueue;
/*
* change your user agent - do not abuse it
*/
-@property (nonatomic, retain) NSString* userAgent;
+@property (nonatomic, strong) NSString* userAgent;
/*
Oops, something went wrong.

0 comments on commit e367713

Please sign in to comment.