Преглед изворни кода

Merge pull request #542 from aburgel/2.0-64bit

Fix various 64bit issues on 2.0-compat branch
Olivier Poitrey пре 12 година
родитељ
комит
706d5d139d
2 измењених фајлова са 15 додато и 15 уклоњено
  1. 12 12
      SDWebImage/SDWebImageManager.m
  2. 3 3
      SDWebImage/SDWebImagePrefetcher.m

+ 12 - 12
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];
@@ -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"])
@@ -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];
@@ -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"])

+ 3 - 3
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++;