Authored by kenny

on a 32bit machine,long long type transfer to NSInteger may become negative. e.g…

…. (NSInteger)9223372036854775807
@@ -257,7 +257,8 @@ didReceiveResponse:(NSURLResponse *)response @@ -257,7 +257,8 @@ didReceiveResponse:(NSURLResponse *)response
257 257
258 //'304 Not Modified' is an exceptional one 258 //'304 Not Modified' is an exceptional one
259 if (![response respondsToSelector:@selector(statusCode)] || (((NSHTTPURLResponse *)response).statusCode < 400 && ((NSHTTPURLResponse *)response).statusCode != 304)) { 259 if (![response respondsToSelector:@selector(statusCode)] || (((NSHTTPURLResponse *)response).statusCode < 400 && ((NSHTTPURLResponse *)response).statusCode != 304)) {
260 - NSInteger expected = response.expectedContentLength > 0 ? (NSInteger)response.expectedContentLength : 0; 260 + NSInteger expected = (NSInteger)response.expectedContentLength;
  261 + expected = expected > 0 ? expected : 0;
261 self.expectedSize = expected; 262 self.expectedSize = expected;
262 for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) { 263 for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) {
263 progressBlock(0, expected, self.request.URL); 264 progressBlock(0, expected, self.request.URL);