Authored by Naoki Morita

Merge branch 'master' of github.com:rs/SDWebImage

@@ -193,7 +193,7 @@ Common Problems @@ -193,7 +193,7 @@ Common Problems
193 193
194 ### Using dynamic image size with UITableViewCell 194 ### Using dynamic image size with UITableViewCell
195 195
196 -UITableView determins the size of the image by the first image set for a cell. If your remote images 196 +UITableView determines the size of the image by the first image set for a cell. If your remote images
197 don't have the same size as your placeholder image, you may experience strange anamorphic scaling issue. 197 don't have the same size as your placeholder image, you may experience strange anamorphic scaling issue.
198 The following article gives a way to workaround this issue: 198 The following article gives a way to workaround this issue:
199 199
@@ -48,7 +48,6 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { @@ -48,7 +48,6 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
48 static id instance; 48 static id instance;
49 dispatch_once(&once, ^{ 49 dispatch_once(&once, ^{
50 instance = [self new]; 50 instance = [self new];
51 - kPNGSignatureData = [NSData dataWithBytes:kPNGSignatureBytes length:8];  
52 }); 51 });
53 return instance; 52 return instance;
54 } 53 }
@@ -61,6 +60,9 @@ BOOL ImageDataHasPNGPreffix(NSData *data) { @@ -61,6 +60,9 @@ BOOL ImageDataHasPNGPreffix(NSData *data) {
61 if ((self = [super init])) { 60 if ((self = [super init])) {
62 NSString *fullNamespace = [@"com.hackemist.SDWebImageCache." stringByAppendingString:ns]; 61 NSString *fullNamespace = [@"com.hackemist.SDWebImageCache." stringByAppendingString:ns];
63 62
  63 + // initialise PNG signature data
  64 + kPNGSignatureData = [NSData dataWithBytes:kPNGSignatureBytes length:8];
  65 +
64 // Create IO serial queue 66 // Create IO serial queue
65 _ioQueue = dispatch_queue_create("com.hackemist.SDWebImageCache", DISPATCH_QUEUE_SERIAL); 67 _ioQueue = dispatch_queue_create("com.hackemist.SDWebImageCache", DISPATCH_QUEUE_SERIAL);
66 68
@@ -194,7 +194,9 @@ @@ -194,7 +194,9 @@
194 194
195 if (error.code != NSURLErrorNotConnectedToInternet && error.code != NSURLErrorCancelled && error.code != NSURLErrorTimedOut) { 195 if (error.code != NSURLErrorNotConnectedToInternet && error.code != NSURLErrorCancelled && error.code != NSURLErrorTimedOut) {
196 @synchronized (self.failedURLs) { 196 @synchronized (self.failedURLs) {
197 - [self.failedURLs addObject:url]; 197 + if (![self.failedURLs containsObject:url]) {
  198 + [self.failedURLs addObject:url];
  199 + }
198 } 200 }
199 } 201 }
200 } 202 }