From d3a9a57a0d56c7a1f034d3cda263931e15ac530b Mon Sep 17 00:00:00 2001 From: Fabrice Aneche Date: Fri, 3 Jan 2014 17:14:13 -0800 Subject: [PATCH] support arm64 --- SDWebImage.xcodeproj/project.pbxproj | 17 +++++++++++++++-- SDWebImage/SDImageCache.h | 2 +- SDWebImage/SDImageCache.m | 6 +++--- SDWebImage/SDWebImageDownloader.h | 2 +- SDWebImage/SDWebImageDownloader.m | 6 +++--- SDWebImage/SDWebImageDownloaderOperation.m | 4 ++-- 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/SDWebImage.xcodeproj/project.pbxproj b/SDWebImage.xcodeproj/project.pbxproj index 09d28bb8..d074b5d9 100644 --- a/SDWebImage.xcodeproj/project.pbxproj +++ b/SDWebImage.xcodeproj/project.pbxproj @@ -835,6 +835,7 @@ 531041DE157EAFA400BBABC3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = NO; @@ -848,6 +849,7 @@ GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; IPHONEOS_DEPLOYMENT_TARGET = 5.0; + ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "SDWebImage+MKAnnotation"; SKIP_INSTALL = YES; @@ -858,6 +860,7 @@ 531041DF157EAFA400BBABC3 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = NO; @@ -881,6 +884,7 @@ 53761323155AD0D5005750A4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = NO; @@ -904,6 +908,7 @@ 53761324155AD0D5005750A4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = NO; @@ -927,6 +932,7 @@ 537D95BF17ECC1FE0097C263 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = NO; @@ -954,6 +960,7 @@ 537D95C017ECC1FE0097C263 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = NO; @@ -978,6 +985,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -1001,7 +1009,7 @@ GCC_WARN_UNUSED_PARAMETER = NO; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = Vendors/libwebp/src; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; PUBLIC_HEADERS_FOLDER_PATH = include/SDWebImage; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; @@ -1012,6 +1020,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; COPY_PHASE_STRIP = YES; GCC_PREPROCESSOR_DEFINITIONS = ""; GCC_TREAT_WARNINGS_AS_ERRORS = YES; @@ -1029,7 +1038,7 @@ GCC_WARN_UNUSED_PARAMETER = NO; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = Vendors/libwebp/src; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; PUBLIC_HEADERS_FOLDER_PATH = include/SDWebImage; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; @@ -1040,6 +1049,8 @@ 539F912D16316D2D00160719 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; + IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -1047,6 +1058,8 @@ 539F912E16316D2D00160719 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; + IPHONEOS_DEPLOYMENT_TARGET = 5.1.1; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; diff --git a/SDWebImage/SDImageCache.h b/SDWebImage/SDImageCache.h index 5c8d8147..81c9d257 100644 --- a/SDWebImage/SDImageCache.h +++ b/SDWebImage/SDImageCache.h @@ -163,7 +163,7 @@ typedef enum SDImageCacheType SDImageCacheType; /** * Asynchronously calculate the disk cache's size. */ -- (void)calculateSizeWithCompletionBlock:(void (^)(NSUInteger fileCount, unsigned long long totalSize))completionBlock; +- (void)calculateSizeWithCompletionBlock:(void (^)(NSUInteger fileCount, NSUInteger totalSize))completionBlock; /** * Check if image exists in cache already diff --git a/SDWebImage/SDImageCache.m b/SDWebImage/SDImageCache.m index 07995df6..f0dab855 100644 --- a/SDWebImage/SDImageCache.m +++ b/SDWebImage/SDImageCache.m @@ -533,14 +533,14 @@ BOOL ImageDataHasPNGPreffix(NSData *data) return count; } -- (void)calculateSizeWithCompletionBlock:(void (^)(NSUInteger fileCount, unsigned long long totalSize))completionBlock +- (void)calculateSizeWithCompletionBlock:(void (^)(NSUInteger fileCount, NSUInteger totalSize))completionBlock { NSURL *diskCacheURL = [NSURL fileURLWithPath:self.diskCachePath isDirectory:YES]; dispatch_async(self.ioQueue, ^ { NSUInteger fileCount = 0; - unsigned long long totalSize = 0; + NSUInteger totalSize = 0; NSFileManager *fileManager = [NSFileManager defaultManager]; NSDirectoryEnumerator *fileEnumerator = [fileManager enumeratorAtURL:diskCacheURL @@ -552,7 +552,7 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { NSNumber *fileSize; [fileURL getResourceValue:&fileSize forKey:NSURLFileSizeKey error:NULL]; - totalSize += [fileSize unsignedLongLongValue]; + totalSize += [fileSize unsignedIntegerValue]; fileCount += 1; } diff --git a/SDWebImage/SDWebImageDownloader.h b/SDWebImage/SDWebImageDownloader.h index 03e1558b..adb24cb1 100644 --- a/SDWebImage/SDWebImageDownloader.h +++ b/SDWebImage/SDWebImageDownloader.h @@ -57,7 +57,7 @@ typedef enum extern NSString *const SDWebImageDownloadStartNotification; extern NSString *const SDWebImageDownloadStopNotification; -typedef void(^SDWebImageDownloaderProgressBlock)(NSUInteger receivedSize, long long expectedSize); +typedef void(^SDWebImageDownloaderProgressBlock)(NSUInteger receivedSize, NSUInteger expectedSize); typedef void(^SDWebImageDownloaderCompletedBlock)(UIImage *image, NSData *data, NSError *error, BOOL finished); /** diff --git a/SDWebImage/SDWebImageDownloader.m b/SDWebImage/SDWebImageDownloader.m index 4cf59571..6f8ab90a 100644 --- a/SDWebImage/SDWebImageDownloader.m +++ b/SDWebImage/SDWebImageDownloader.m @@ -115,7 +115,7 @@ static NSString *const kCompletedCallbackKey = @"completed"; return _downloadQueue.maxConcurrentOperationCount; } -- (id)downloadImageWithURL:(NSURL *)url options:(SDWebImageDownloaderOptions)options progress:(void (^)(NSUInteger, long long))progressBlock completed:(void (^)(UIImage *, NSData *, NSError *, BOOL))completedBlock +- (id)downloadImageWithURL:(NSURL *)url options:(SDWebImageDownloaderOptions)options progress:(void (^)(NSUInteger, NSUInteger))progressBlock completed:(void (^)(UIImage *, NSData *, NSError *, BOOL))completedBlock { __block SDWebImageDownloaderOperation *operation; __weak SDWebImageDownloader *wself = self; @@ -139,7 +139,7 @@ static NSString *const kCompletedCallbackKey = @"completed"; { request.allHTTPHeaderFields = wself.HTTPHeaders; } - operation = [SDWebImageDownloaderOperation.alloc initWithRequest:request options:options progress:^(NSUInteger receivedSize, long long expectedSize) + operation = [SDWebImageDownloaderOperation.alloc initWithRequest:request options:options progress:^(NSUInteger receivedSize, NSUInteger expectedSize) { if (!wself) return; SDWebImageDownloader *sself = wself; @@ -183,7 +183,7 @@ static NSString *const kCompletedCallbackKey = @"completed"; return operation; } -- (void)addProgressCallback:(void (^)(NSUInteger, long long))progressBlock andCompletedBlock:(void (^)(UIImage *, NSData *data, NSError *, BOOL))completedBlock forURL:(NSURL *)url createCallback:(void (^)())createCallback +- (void)addProgressCallback:(void (^)(NSUInteger, NSUInteger))progressBlock andCompletedBlock:(void (^)(UIImage *, NSData *data, NSError *, BOOL))completedBlock forURL:(NSURL *)url createCallback:(void (^)())createCallback { // The URL will be used as the key to the callbacks dictionary so it cannot be nil. If it is nil immediately call the completed block with no image or data. if(url == nil) diff --git a/SDWebImage/SDWebImageDownloaderOperation.m b/SDWebImage/SDWebImageDownloaderOperation.m index 4d4f94e0..38d77026 100644 --- a/SDWebImage/SDWebImageDownloaderOperation.m +++ b/SDWebImage/SDWebImageDownloaderOperation.m @@ -19,7 +19,7 @@ @property (assign, nonatomic, getter = isExecuting) BOOL executing; @property (assign, nonatomic, getter = isFinished) BOOL finished; -@property (assign, nonatomic) long long expectedSize; +@property (assign, nonatomic) NSUInteger expectedSize; @property (strong, nonatomic) NSMutableData *imageData; @property (strong, nonatomic) NSURLConnection *connection; @property (strong, atomic) NSThread *thread; @@ -36,7 +36,7 @@ BOOL responseFromCached; } -- (id)initWithRequest:(NSURLRequest *)request options:(SDWebImageDownloaderOptions)options progress:(void (^)(NSUInteger, long long))progressBlock completed:(void (^)(UIImage *, NSData *, NSError *, BOOL))completedBlock cancelled:(void (^)())cancelBlock +- (id)initWithRequest:(NSURLRequest *)request options:(SDWebImageDownloaderOptions)options progress:(void (^)(NSUInteger, NSUInteger))progressBlock completed:(void (^)(UIImage *, NSData *, NSError *, BOOL))completedBlock cancelled:(void (^)())cancelBlock { if ((self = [super init])) {