Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #603 from akhenakh/64bits_support

64bits support (fix #572, fix #504, fix #494)
  • Loading branch information...
commit 853ad83647441d2a081c05f1e05da0e004dc3fbf 2 parents 8f8228e + 77fad5c
@rs authored
View
3  README.md
@@ -16,8 +16,9 @@ It provides:
- A guarantee that main thread will never be blocked
- Performances!
- Use GCD and ARC
+- Arm64 support
-NOTE: The version 3.0 of SDWebImage isn't fully backward compatible with 2.0 and requires iOS 5.0
+NOTE: The version 3.0 of SDWebImage isn't fully backward compatible with 2.0 and requires iOS 5.1.1
minimum deployement version. If you need iOS < 5.0 support, please use the last [2.0 version](https://github.com/rs/SDWebImage/tree/2.0-compat).
[How is SDWebImage better than X?](https://github.com/rs/SDWebImage/wiki/How-is-SDWebImage-better-than-X%3F)
View
17 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;
View
6 SDWebImage/SDImageCache.h
@@ -45,7 +45,7 @@ typedef enum SDImageCacheType SDImageCacheType;
/**
* The maximum size of the cache, in bytes.
*/
-@property (assign, nonatomic) unsigned long long maxCacheSize;
+@property (assign, nonatomic) NSUInteger maxCacheSize;
/**
* Returns global shared cache instance
@@ -153,7 +153,7 @@ typedef enum SDImageCacheType SDImageCacheType;
/**
* Get the size used by the disk cache
*/
-- (unsigned long long)getSize;
+- (NSUInteger)getSize;
/**
* Get the number of images in the disk cache
@@ -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
View
18 SDWebImage/SDImageCache.m
@@ -423,7 +423,7 @@ - (void)cleanDisk
NSDate *expirationDate = [NSDate dateWithTimeIntervalSinceNow:-self.maxCacheAge];
NSMutableDictionary *cacheFiles = [NSMutableDictionary dictionary];
- unsigned long long currentCacheSize = 0;
+ NSUInteger currentCacheSize = 0;
// Enumerate all of the files in the cache directory. This loop has two purposes:
//
@@ -449,7 +449,7 @@ - (void)cleanDisk
// Store a reference to this file and account for its total size.
NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey];
- currentCacheSize += [totalAllocatedSize unsignedLongLongValue];
+ currentCacheSize += [totalAllocatedSize unsignedIntegerValue];
[cacheFiles setObject:resourceValues forKey:fileURL];
}
@@ -458,7 +458,7 @@ - (void)cleanDisk
if (self.maxCacheSize > 0 && currentCacheSize > self.maxCacheSize)
{
// Target half of our maximum cache size for this cleanup pass.
- const unsigned long long desiredCacheSize = self.maxCacheSize / 2;
+ const NSUInteger desiredCacheSize = self.maxCacheSize / 2;
// Sort the remaining cache files by their last modification time (oldest first).
NSArray *sortedFiles = [cacheFiles keysSortedByValueWithOptions:NSSortConcurrent
@@ -474,7 +474,7 @@ - (void)cleanDisk
{
NSDictionary *resourceValues = cacheFiles[fileURL];
NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey];
- currentCacheSize -= [totalAllocatedSize unsignedLongLongValue];
+ currentCacheSize -= [totalAllocatedSize unsignedIntegerValue];
if (currentCacheSize < desiredCacheSize)
{
@@ -508,9 +508,9 @@ - (void)backgroundCleanDisk
});
}
-- (unsigned long long)getSize
+- (NSUInteger)getSize
{
- unsigned long long size = 0;
+ NSUInteger size = 0;
NSDirectoryEnumerator *fileEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:self.diskCachePath];
for (NSString *fileName in fileEnumerator)
{
@@ -533,14 +533,14 @@ - (int)getDiskCount
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 @@ - (void)calculateSizeWithCompletionBlock:(void (^)(NSUInteger fileCount, unsigne
{
NSNumber *fileSize;
[fileURL getResourceValue:&fileSize forKey:NSURLFileSizeKey error:NULL];
- totalSize += [fileSize unsignedLongLongValue];
+ totalSize += [fileSize unsignedIntegerValue];
fileCount += 1;
}
View
2  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);
/**
View
6 SDWebImage/SDWebImageDownloader.m
@@ -115,7 +115,7 @@ - (NSInteger)maxConcurrentDownloads
return _downloadQueue.maxConcurrentOperationCount;
}
-- (id<SDWebImageOperation>)downloadImageWithURL:(NSURL *)url options:(SDWebImageDownloaderOptions)options progress:(void (^)(NSUInteger, long long))progressBlock completed:(void (^)(UIImage *, NSData *, NSError *, BOOL))completedBlock
+- (id<SDWebImageOperation>)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 @@ - (NSInteger)maxConcurrentDownloads
{
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 @@ - (NSInteger)maxConcurrentDownloads
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)
View
4 SDWebImage/SDWebImageDownloaderOperation.m
@@ -19,7 +19,7 @@ @interface SDWebImageDownloaderOperation ()
@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 @@ @implementation SDWebImageDownloaderOperation
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]))
{
Please sign in to comment.
Something went wrong with that request. Please try again.