From 21cd001f51b3e7713c7ca167e73694a4e9da1d65 Mon Sep 17 00:00:00 2001 From: Alex Burgel Date: Thu, 31 Oct 2013 15:00:59 -0400 Subject: [PATCH 1/3] Fix 64bit string formatting warnings --- SDWebImage/SDWebImagePrefetcher.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SDWebImage/SDWebImagePrefetcher.m b/SDWebImage/SDWebImagePrefetcher.m index 08096cd1..73370b5d 100644 --- a/SDWebImage/SDWebImagePrefetcher.m +++ b/SDWebImage/SDWebImagePrefetcher.m @@ -43,7 +43,7 @@ static SDWebImagePrefetcher *instance; - (void)reportStatus { NSUInteger total = [self.prefetchURLs count]; - NSLog(@"Finished prefetching (%d successful, %d skipped, timeElasped %.2f)", total - _skippedCount, _skippedCount, CFAbsoluteTimeGetCurrent() - _startedTime); + NSLog(@"Finished prefetching (%lu successful, %lu skipped, timeElasped %.2f)", (unsigned long)(total - _skippedCount), (unsigned long)_skippedCount, CFAbsoluteTimeGetCurrent() - _startedTime); } - (void)prefetchURLs:(NSArray *)urls @@ -75,7 +75,7 @@ static SDWebImagePrefetcher *instance; - (void)webImageManager:(SDWebImageManager *)imageManager didFinishWithImage:(UIImage *)image { _finishedCount++; - NSLog(@"Prefetched %d out of %d", _finishedCount, [self.prefetchURLs count]); + NSLog(@"Prefetched %lu out of %lu", (unsigned long)_finishedCount, (unsigned long)[self.prefetchURLs count]); if ([self.prefetchURLs count] > _requestedCount) { @@ -90,7 +90,7 @@ static SDWebImagePrefetcher *instance; - (void)webImageManager:(SDWebImageManager *)imageManager didFailWithError:(NSError *)error { _finishedCount++; - NSLog(@"Prefetched %d out of %d (Failed)", _finishedCount, [self.prefetchURLs count]); + NSLog(@"Prefetched %lu out of %lu (Failed)", (unsigned long)_finishedCount, (unsigned long)[self.prefetchURLs count]); // Add last failed _skippedCount++; From 06474aacb0899da5afc31d41656ebfd297f96ba9 Mon Sep 17 00:00:00 2001 From: Alex Burgel Date: Thu, 31 Oct 2013 15:01:41 -0400 Subject: [PATCH 2/3] Fix 64bit precision loss warnings --- SDWebImage/SDWebImageManager.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SDWebImage/SDWebImageManager.m b/SDWebImage/SDWebImageManager.m index a2087f16..ec82ae19 100644 --- a/SDWebImage/SDWebImageManager.m +++ b/SDWebImage/SDWebImageManager.m @@ -185,7 +185,7 @@ static SDWebImageManager *instance; { // Delegates notified, remove downloader and delegate // The delegate callbacks above may have modified the arrays, hence we search for the correct index - int idx = [downloadDelegates indexOfObjectIdenticalTo:delegate]; + NSUInteger idx = [downloadDelegates indexOfObjectIdenticalTo:delegate]; if (idx != NSNotFound) { [downloaders removeObjectAtIndex:idx]; @@ -292,7 +292,7 @@ static SDWebImageManager *instance; // Delegates notified, remove url and delegate // The delegate callbacks above may have modified the arrays, hence we search for the correct index - int removeIdx = [self indexOfDelegate:delegate waitingForURL:url]; + NSUInteger removeIdx = [self indexOfDelegate:delegate waitingForURL:url]; if (removeIdx != NSNotFound) { [cacheDelegates removeObjectAtIndex:removeIdx]; From 39f6b586cc637b4d58d6bd09a1b8490da66f6caa Mon Sep 17 00:00:00 2001 From: Alex Burgel Date: Thu, 31 Oct 2013 15:02:19 -0400 Subject: [PATCH 3/3] Fix crashes on 64bit devices by casting objc_msgSend calls --- SDWebImage/SDWebImageManager.m | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/SDWebImage/SDWebImageManager.m b/SDWebImage/SDWebImageManager.m index ec82ae19..4637105f 100644 --- a/SDWebImage/SDWebImageManager.m +++ b/SDWebImage/SDWebImageManager.m @@ -271,7 +271,7 @@ static SDWebImageManager *instance; } if ([delegate respondsToSelector:@selector(webImageManager:didFinishWithImage:forURL:)]) { - objc_msgSend(delegate, @selector(webImageManager:didFinishWithImage:forURL:), self, image, url); + ((void ( *)(id, SEL, id, id, id))objc_msgSend)(delegate, @selector(webImageManager:didFinishWithImage:forURL:), self, image, url); } if ([delegate respondsToSelector:@selector(webImageManager:didFinishWithImage:forURL:userInfo:)]) { @@ -280,7 +280,7 @@ static SDWebImageManager *instance; { userInfo = nil; } - objc_msgSend(delegate, @selector(webImageManager:didFinishWithImage:forURL:userInfo:), self, image, url, userInfo); + ((void ( *)(id, SEL, id, id, id, id))objc_msgSend)(delegate, @selector(webImageManager:didFinishWithImage:forURL:userInfo:), self, image, url, userInfo); } #if NS_BLOCKS_AVAILABLE if ([info objectForKey:@"success"]) @@ -379,7 +379,7 @@ static SDWebImageManager *instance; if ([delegate respondsToSelector:@selector(webImageManager:didProgressWithPartialImage:forURL:)]) { - objc_msgSend(delegate, @selector(webImageManager:didProgressWithPartialImage:forURL:), self, image, downloader.url); + ((void ( *)(id, SEL, id, id, id))objc_msgSend)(delegate, @selector(webImageManager:didProgressWithPartialImage:forURL:), self, image, downloader.url); } if ([delegate respondsToSelector:@selector(webImageManager:didProgressWithPartialImage:forURL:userInfo:)]) { @@ -388,7 +388,7 @@ static SDWebImageManager *instance; { userInfo = nil; } - objc_msgSend(delegate, @selector(webImageManager:didProgressWithPartialImage:forURL:userInfo:), self, image, downloader.url, userInfo); + ((void ( *)(id, SEL, id, id, id, id))objc_msgSend)(delegate, @selector(webImageManager:didProgressWithPartialImage:forURL:userInfo:), self, image, downloader.url, userInfo); } // Delegate notified. Break out and restart loop found = YES; @@ -430,7 +430,7 @@ static SDWebImageManager *instance; } if ([delegate respondsToSelector:@selector(webImageManager:didFinishWithImage:forURL:)]) { - objc_msgSend(delegate, @selector(webImageManager:didFinishWithImage:forURL:), self, image, downloader.url); + ((void ( *)(id, SEL, id, id, id))objc_msgSend)(delegate, @selector(webImageManager:didFinishWithImage:forURL:), self, image, downloader.url); } if ([delegate respondsToSelector:@selector(webImageManager:didFinishWithImage:forURL:userInfo:)]) { @@ -439,7 +439,7 @@ static SDWebImageManager *instance; { userInfo = nil; } - objc_msgSend(delegate, @selector(webImageManager:didFinishWithImage:forURL:userInfo:), self, image, downloader.url, userInfo); + ((void ( *)(id, SEL, id, id, id, id))objc_msgSend)(delegate, @selector(webImageManager:didFinishWithImage:forURL:userInfo:), self, image, downloader.url, userInfo); } #if NS_BLOCKS_AVAILABLE if ([info objectForKey:@"success"]) @@ -457,7 +457,7 @@ static SDWebImageManager *instance; } if ([delegate respondsToSelector:@selector(webImageManager:didFailWithError:forURL:)]) { - objc_msgSend(delegate, @selector(webImageManager:didFailWithError:forURL:), self, nil, downloader.url); + ((void ( *)(id, SEL, id, id, id))objc_msgSend)(delegate, @selector(webImageManager:didFailWithError:forURL:), self, nil, downloader.url); } if ([delegate respondsToSelector:@selector(webImageManager:didFailWithError:forURL:userInfo:)]) { @@ -466,7 +466,7 @@ static SDWebImageManager *instance; { userInfo = nil; } - objc_msgSend(delegate, @selector(webImageManager:didFailWithError:forURL:userInfo:), self, nil, downloader.url, userInfo); + ((void ( *)(id, SEL, id, id, id, id))objc_msgSend)(delegate, @selector(webImageManager:didFailWithError:forURL:userInfo:), self, nil, downloader.url, userInfo); } #if NS_BLOCKS_AVAILABLE if ([info objectForKey:@"failure"]) @@ -536,7 +536,7 @@ static SDWebImageManager *instance; } if ([delegate respondsToSelector:@selector(webImageManager:didFailWithError:forURL:)]) { - objc_msgSend(delegate, @selector(webImageManager:didFailWithError:forURL:), self, error, downloader.url); + ((void ( *)(id, SEL, id, id, id))objc_msgSend)(delegate, @selector(webImageManager:didFailWithError:forURL:), self, error, downloader.url); } if ([delegate respondsToSelector:@selector(webImageManager:didFailWithError:forURL:userInfo:)]) { @@ -545,7 +545,7 @@ static SDWebImageManager *instance; { userInfo = nil; } - objc_msgSend(delegate, @selector(webImageManager:didFailWithError:forURL:userInfo:), self, error, downloader.url, userInfo); + ((void ( *)(id, SEL, id, id, id, id))objc_msgSend)(delegate, @selector(webImageManager:didFailWithError:forURL:userInfo:), self, error, downloader.url, userInfo); } #if NS_BLOCKS_AVAILABLE if ([info objectForKey:@"failure"])