Avoid warnings about implicit integer conversions that change the
signedness of an integer value (-Wsign-conversion).
Showing
7 changed files
with
47 additions
and
43 deletions
| @@ -193,7 +193,7 @@ static const NSUInteger kDomainSection = 1; | @@ -193,7 +193,7 @@ static const NSUInteger kDomainSection = 1; | ||
| 193 | - (UITextField *)textFieldInRow:(NSUInteger)row section:(NSUInteger)section | 193 | - (UITextField *)textFieldInRow:(NSUInteger)row section:(NSUInteger)section |
| 194 | { | 194 | { |
| 195 | return [[[[[self tableView] cellForRowAtIndexPath: | 195 | return [[[[[self tableView] cellForRowAtIndexPath: |
| 196 | - [NSIndexPath indexPathForRow:row inSection:section]] | 196 | + [NSIndexPath indexPathForRow:(NSInteger)row inSection:(NSInteger)section]] |
| 197 | contentView] subviews] objectAtIndex:0]; | 197 | contentView] subviews] objectAtIndex:0]; |
| 198 | } | 198 | } |
| 199 | 199 | ||
| @@ -471,8 +471,8 @@ static const NSUInteger kDomainSection = 1; | @@ -471,8 +471,8 @@ static const NSUInteger kDomainSection = 1; | ||
| 471 | [textField setAutocapitalizationType:UITextAutocapitalizationTypeNone]; | 471 | [textField setAutocapitalizationType:UITextAutocapitalizationTypeNone]; |
| 472 | [textField setAutocorrectionType:UITextAutocorrectionTypeNo]; | 472 | [textField setAutocorrectionType:UITextAutocorrectionTypeNo]; |
| 473 | 473 | ||
| 474 | - NSUInteger s = [indexPath section]; | 474 | + NSInteger s = [indexPath section]; |
| 475 | - NSUInteger r = [indexPath row]; | 475 | + NSInteger r = [indexPath row]; |
| 476 | 476 | ||
| 477 | if (s == kUsernameSection && r == kUsernameRow) { | 477 | if (s == kUsernameSection && r == kUsernameRow) { |
| 478 | [textField setPlaceholder:@"User"]; | 478 | [textField setPlaceholder:@"User"]; |
| @@ -81,7 +81,7 @@ | @@ -81,7 +81,7 @@ | ||
| 81 | zStream.avail_in = (unsigned int)length; | 81 | zStream.avail_in = (unsigned int)length; |
| 82 | zStream.avail_out = 0; | 82 | zStream.avail_out = 0; |
| 83 | 83 | ||
| 84 | - NSInteger bytesProcessedAlready = zStream.total_out; | 84 | + NSUInteger bytesProcessedAlready = zStream.total_out; |
| 85 | while (zStream.avail_out == 0) { | 85 | while (zStream.avail_out == 0) { |
| 86 | 86 | ||
| 87 | if (zStream.total_out-bytesProcessedAlready >= [outputData length]) { | 87 | if (zStream.total_out-bytesProcessedAlready >= [outputData length]) { |
| @@ -174,7 +174,7 @@ | @@ -174,7 +174,7 @@ | ||
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | // Attempt to deflate the chunk of data | 176 | // Attempt to deflate the chunk of data |
| 177 | - outputData = [compressor compressBytes:inputData length:readLength error:&theError shouldFinish:readLength < DATA_CHUNK_SIZE ]; | 177 | + outputData = [compressor compressBytes:inputData length:(NSUInteger)readLength error:&theError shouldFinish:readLength < DATA_CHUNK_SIZE]; |
| 178 | if (theError) { | 178 | if (theError) { |
| 179 | if (err) { | 179 | if (err) { |
| 180 | *err = theError; | 180 | *err = theError; |
| @@ -78,7 +78,7 @@ | @@ -78,7 +78,7 @@ | ||
| 78 | zStream.avail_in = (unsigned int)length; | 78 | zStream.avail_in = (unsigned int)length; |
| 79 | zStream.avail_out = 0; | 79 | zStream.avail_out = 0; |
| 80 | 80 | ||
| 81 | - NSInteger bytesProcessedAlready = zStream.total_out; | 81 | + NSUInteger bytesProcessedAlready = zStream.total_out; |
| 82 | while (zStream.avail_in != 0) { | 82 | while (zStream.avail_in != 0) { |
| 83 | 83 | ||
| 84 | if (zStream.total_out-bytesProcessedAlready >= [outputData length]) { | 84 | if (zStream.total_out-bytesProcessedAlready >= [outputData length]) { |
| @@ -155,7 +155,7 @@ | @@ -155,7 +155,7 @@ | ||
| 155 | while ([decompressor streamReady]) { | 155 | while ([decompressor streamReady]) { |
| 156 | 156 | ||
| 157 | // Read some data from the file | 157 | // Read some data from the file |
| 158 | - readLength = [inputStream read:inputData maxLength:DATA_CHUNK_SIZE]; | 158 | + readLength = [inputStream read:inputData maxLength:DATA_CHUNK_SIZE]; |
| 159 | 159 | ||
| 160 | // Make sure nothing went wrong | 160 | // Make sure nothing went wrong |
| 161 | if ([inputStream streamStatus] == NSStreamStatusError) { | 161 | if ([inputStream streamStatus] == NSStreamStatusError) { |
| @@ -171,7 +171,7 @@ | @@ -171,7 +171,7 @@ | ||
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | // Attempt to inflate the chunk of data | 173 | // Attempt to inflate the chunk of data |
| 174 | - outputData = [decompressor uncompressBytes:inputData length:readLength error:&theError]; | 174 | + outputData = [decompressor uncompressBytes:inputData length:(NSUInteger)readLength error:&theError]; |
| 175 | if (theError) { | 175 | if (theError) { |
| 176 | if (err) { | 176 | if (err) { |
| 177 | *err = theError; | 177 | *err = theError; |
| @@ -589,18 +589,21 @@ static NSOperationQueue *sharedQueue = nil; | @@ -589,18 +589,21 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 589 | [self setupPostBody]; | 589 | [self setupPostBody]; |
| 590 | NSInputStream *stream = [[[NSInputStream alloc] initWithFileAtPath:file] autorelease]; | 590 | NSInputStream *stream = [[[NSInputStream alloc] initWithFileAtPath:file] autorelease]; |
| 591 | [stream open]; | 591 | [stream open]; |
| 592 | - NSUInteger bytesRead; | ||
| 593 | while ([stream hasBytesAvailable]) { | 592 | while ([stream hasBytesAvailable]) { |
| 594 | 593 | ||
| 595 | unsigned char buffer[1024*256]; | 594 | unsigned char buffer[1024*256]; |
| 596 | - bytesRead = [stream read:buffer maxLength:sizeof(buffer)]; | 595 | + NSInteger bytesRead = [stream read:buffer maxLength:sizeof(buffer)]; |
| 597 | if (bytesRead == 0) { | 596 | if (bytesRead == 0) { |
| 597 | + // 0 indicates that the end of the buffer was reached. | ||
| 598 | + break; | ||
| 599 | + } else if (bytesRead < 0) { | ||
| 600 | + // A negative number means that the operation failed. | ||
| 598 | break; | 601 | break; |
| 599 | } | 602 | } |
| 600 | if ([self shouldStreamPostDataFromDisk]) { | 603 | if ([self shouldStreamPostDataFromDisk]) { |
| 601 | - [[self postBodyWriteStream] write:buffer maxLength:bytesRead]; | 604 | + [[self postBodyWriteStream] write:buffer maxLength:(NSUInteger)bytesRead]; |
| 602 | } else { | 605 | } else { |
| 603 | - [[self postBody] appendData:[NSData dataWithBytes:buffer length:bytesRead]]; | 606 | + [[self postBody] appendData:[NSData dataWithBytes:buffer length:(NSUInteger)bytesRead]]; |
| 604 | } | 607 | } |
| 605 | } | 608 | } |
| 606 | [stream close]; | 609 | [stream close]; |
| @@ -1343,7 +1346,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -1343,7 +1346,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 1343 | if (![self connectionInfo]) { | 1346 | if (![self connectionInfo]) { |
| 1344 | [self setConnectionInfo:[NSMutableDictionary dictionary]]; | 1347 | [self setConnectionInfo:[NSMutableDictionary dictionary]]; |
| 1345 | nextConnectionNumberToCreate++; | 1348 | nextConnectionNumberToCreate++; |
| 1346 | - [[self connectionInfo] setObject:[NSNumber numberWithInt:nextConnectionNumberToCreate] forKey:@"id"]; | 1349 | + [[self connectionInfo] setObject:[NSNumber numberWithInt:(int)nextConnectionNumberToCreate] forKey:@"id"]; |
| 1347 | [[self connectionInfo] setObject:[[self url] host] forKey:@"host"]; | 1350 | [[self connectionInfo] setObject:[[self url] host] forKey:@"host"]; |
| 1348 | [[self connectionInfo] setObject:[NSNumber numberWithInt:[[[self url] port] intValue]] forKey:@"port"]; | 1351 | [[self connectionInfo] setObject:[NSNumber numberWithInt:[[[self url] port] intValue]] forKey:@"port"]; |
| 1349 | [[self connectionInfo] setObject:[[self url] scheme] forKey:@"scheme"]; | 1352 | [[self connectionInfo] setObject:[[self url] scheme] forKey:@"scheme"]; |
| @@ -1412,7 +1415,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -1412,7 +1415,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 1412 | if (![self mainRequest]) { | 1415 | if (![self mainRequest]) { |
| 1413 | if ([self shouldResetUploadProgress]) { | 1416 | if ([self shouldResetUploadProgress]) { |
| 1414 | if ([self showAccurateProgress]) { | 1417 | if ([self showAccurateProgress]) { |
| 1415 | - [self incrementUploadSizeBy:[self postLength]]; | 1418 | + [self incrementUploadSizeBy:(long long)[self postLength]]; |
| 1416 | } else { | 1419 | } else { |
| 1417 | [self incrementUploadSizeBy:1]; | 1420 | [self incrementUploadSizeBy:1]; |
| 1418 | } | 1421 | } |
| @@ -1759,7 +1762,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -1759,7 +1762,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 1759 | // We will remove this from any progress display, as kCFStreamPropertyHTTPRequestBytesWrittenCount does not tell us how much data has actually be written | 1762 | // We will remove this from any progress display, as kCFStreamPropertyHTTPRequestBytesWrittenCount does not tell us how much data has actually be written |
| 1760 | if ([self uploadBufferSize] == 0 && [self totalBytesSent] != [self postLength]) { | 1763 | if ([self uploadBufferSize] == 0 && [self totalBytesSent] != [self postLength]) { |
| 1761 | [self setUploadBufferSize:[self totalBytesSent]]; | 1764 | [self setUploadBufferSize:[self totalBytesSent]]; |
| 1762 | - [self incrementUploadSizeBy:-[self uploadBufferSize]]; | 1765 | + [self incrementUploadSizeBy:-(long long)[self uploadBufferSize]]; |
| 1763 | } | 1766 | } |
| 1764 | 1767 | ||
| 1765 | unsigned long long value = 0; | 1768 | unsigned long long value = 0; |
| @@ -1819,7 +1822,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -1819,7 +1822,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 1819 | 1822 | ||
| 1820 | -(void)removeUploadProgressSoFar | 1823 | -(void)removeUploadProgressSoFar |
| 1821 | { | 1824 | { |
| 1822 | - long long progressToRemove = -[self totalBytesSent]; | 1825 | + long long progressToRemove = -(long long)[self totalBytesSent]; |
| 1823 | [ASIHTTPRequest performSelector:@selector(request:didSendBytes:) onTarget:&queue withObject:self amount:&progressToRemove callerToRetain:self]; | 1826 | [ASIHTTPRequest performSelector:@selector(request:didSendBytes:) onTarget:&queue withObject:self amount:&progressToRemove callerToRetain:self]; |
| 1824 | [ASIHTTPRequest performSelector:@selector(request:didSendBytes:) onTarget:&uploadProgressDelegate withObject:self amount:&progressToRemove callerToRetain:self]; | 1827 | [ASIHTTPRequest performSelector:@selector(request:didSendBytes:) onTarget:&uploadProgressDelegate withObject:self amount:&progressToRemove callerToRetain:self]; |
| 1825 | [ASIHTTPRequest updateProgressIndicator:&uploadProgressDelegate withProgress:0 ofTotal:[self postLength]]; | 1828 | [ASIHTTPRequest updateProgressIndicator:&uploadProgressDelegate withProgress:0 ofTotal:[self postLength]]; |
| @@ -1827,7 +1830,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -1827,7 +1830,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 1827 | #if NS_BLOCKS_AVAILABLE | 1830 | #if NS_BLOCKS_AVAILABLE |
| 1828 | if(bytesSentBlock){ | 1831 | if(bytesSentBlock){ |
| 1829 | unsigned long long totalSize = [self postLength]; | 1832 | unsigned long long totalSize = [self postLength]; |
| 1830 | - [self performBlockOnMainThread:^{ if (bytesSentBlock) { bytesSentBlock(progressToRemove, totalSize); }}]; | 1833 | + [self performBlockOnMainThread:^{ if (bytesSentBlock) { bytesSentBlock((unsigned long long)progressToRemove, totalSize); }}]; |
| 1831 | } | 1834 | } |
| 1832 | #endif | 1835 | #endif |
| 1833 | } | 1836 | } |
| @@ -2243,7 +2246,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -2243,7 +2246,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 2243 | } else { | 2246 | } else { |
| 2244 | [theRequest setContentLength:length]; | 2247 | [theRequest setContentLength:length]; |
| 2245 | if ([self showAccurateProgress] && [self shouldResetDownloadProgress]) { | 2248 | if ([self showAccurateProgress] && [self shouldResetDownloadProgress]) { |
| 2246 | - [theRequest incrementDownloadSizeBy:[theRequest contentLength]+[theRequest partialDownloadSize]]; | 2249 | + [theRequest incrementDownloadSizeBy:(long long)[theRequest contentLength]+(long long)[theRequest partialDownloadSize]]; |
| 2247 | } | 2250 | } |
| 2248 | } | 2251 | } |
| 2249 | 2252 | ||
| @@ -3304,18 +3307,18 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3304,18 +3307,18 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3304 | [self setDataDecompressor:[ASIDataDecompressor decompressor]]; | 3307 | [self setDataDecompressor:[ASIDataDecompressor decompressor]]; |
| 3305 | } | 3308 | } |
| 3306 | NSError *err = nil; | 3309 | NSError *err = nil; |
| 3307 | - inflatedData = [[self dataDecompressor] uncompressBytes:buffer length:bytesRead error:&err]; | 3310 | + inflatedData = [[self dataDecompressor] uncompressBytes:buffer length:(NSUInteger)bytesRead error:&err]; |
| 3308 | if (err) { | 3311 | if (err) { |
| 3309 | [self failWithError:err]; | 3312 | [self failWithError:err]; |
| 3310 | return; | 3313 | return; |
| 3311 | } | 3314 | } |
| 3312 | } | 3315 | } |
| 3313 | 3316 | ||
| 3314 | - [self setTotalBytesRead:[self totalBytesRead]+bytesRead]; | 3317 | + [self setTotalBytesRead:[self totalBytesRead]+(NSUInteger)bytesRead]; |
| 3315 | [self setLastActivityTime:[NSDate date]]; | 3318 | [self setLastActivityTime:[NSDate date]]; |
| 3316 | 3319 | ||
| 3317 | // For bandwidth measurement / throttling | 3320 | // For bandwidth measurement / throttling |
| 3318 | - [ASIHTTPRequest incrementBandwidthUsedInLastSecond:bytesRead]; | 3321 | + [ASIHTTPRequest incrementBandwidthUsedInLastSecond:(NSUInteger)bytesRead]; |
| 3319 | 3322 | ||
| 3320 | // If we need to redirect, and have automatic redirect on, and might be resuming a download, let's do nothing with the content | 3323 | // If we need to redirect, and have automatic redirect on, and might be resuming a download, let's do nothing with the content |
| 3321 | if ([self needsRedirect] && [self shouldRedirect] && [self allowResumeForFileDownloads]) { | 3324 | if ([self needsRedirect] && [self shouldRedirect] && [self allowResumeForFileDownloads]) { |
| @@ -3338,7 +3341,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3338,7 +3341,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3338 | if ([self isResponseCompressed] && ![self shouldWaitToInflateCompressedResponses]) { | 3341 | if ([self isResponseCompressed] && ![self shouldWaitToInflateCompressedResponses]) { |
| 3339 | data = inflatedData; | 3342 | data = inflatedData; |
| 3340 | } else { | 3343 | } else { |
| 3341 | - data = [NSData dataWithBytes:buffer length:bytesRead]; | 3344 | + data = [NSData dataWithBytes:buffer length:(NSUInteger)bytesRead]; |
| 3342 | } | 3345 | } |
| 3343 | [self performSelectorOnMainThread:@selector(passOnReceivedData:) withObject:data waitUntilDone:[NSThread isMainThread]]; | 3346 | [self performSelectorOnMainThread:@selector(passOnReceivedData:) withObject:data waitUntilDone:[NSThread isMainThread]]; |
| 3344 | 3347 | ||
| @@ -3352,7 +3355,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3352,7 +3355,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3352 | if ([[self responseHeaders] objectForKey:@"Content-Range"]) { | 3355 | if ([[self responseHeaders] objectForKey:@"Content-Range"]) { |
| 3353 | append = YES; | 3356 | append = YES; |
| 3354 | } else { | 3357 | } else { |
| 3355 | - [self incrementDownloadSizeBy:-[self partialDownloadSize]]; | 3358 | + [self incrementDownloadSizeBy:-(long long)[self partialDownloadSize]]; |
| 3356 | [self setPartialDownloadSize:0]; | 3359 | [self setPartialDownloadSize:0]; |
| 3357 | } | 3360 | } |
| 3358 | } | 3361 | } |
| @@ -3361,7 +3364,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3361,7 +3364,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3361 | [[self fileDownloadOutputStream] open]; | 3364 | [[self fileDownloadOutputStream] open]; |
| 3362 | 3365 | ||
| 3363 | } | 3366 | } |
| 3364 | - [[self fileDownloadOutputStream] write:buffer maxLength:bytesRead]; | 3367 | + [[self fileDownloadOutputStream] write:buffer maxLength:(NSUInteger)bytesRead]; |
| 3365 | 3368 | ||
| 3366 | if ([self isResponseCompressed] && ![self shouldWaitToInflateCompressedResponses]) { | 3369 | if ([self isResponseCompressed] && ![self shouldWaitToInflateCompressedResponses]) { |
| 3367 | 3370 | ||
| @@ -3383,7 +3386,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3383,7 +3386,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3383 | if ([self isResponseCompressed] && ![self shouldWaitToInflateCompressedResponses]) { | 3386 | if ([self isResponseCompressed] && ![self shouldWaitToInflateCompressedResponses]) { |
| 3384 | [rawResponseData appendData:inflatedData]; | 3387 | [rawResponseData appendData:inflatedData]; |
| 3385 | } else { | 3388 | } else { |
| 3386 | - [rawResponseData appendBytes:buffer length:bytesRead]; | 3389 | + [rawResponseData appendBytes:buffer length:(NSUInteger)bytesRead]; |
| 3387 | } | 3390 | } |
| 3388 | } | 3391 | } |
| 3389 | } | 3392 | } |
| @@ -3589,7 +3592,7 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3589,7 +3592,7 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3589 | } else { | 3592 | } else { |
| 3590 | [theRequest setRawResponseData:[NSMutableData dataWithData:[[self downloadCache] cachedResponseDataForURL:[self url]]]]; | 3593 | [theRequest setRawResponseData:[NSMutableData dataWithData:[[self downloadCache] cachedResponseDataForURL:[self url]]]]; |
| 3591 | } | 3594 | } |
| 3592 | - [theRequest setContentLength:[[[self responseHeaders] objectForKey:@"Content-Length"] longLongValue]]; | 3595 | + [theRequest setContentLength:(unsigned long long)[[[self responseHeaders] objectForKey:@"Content-Length"] longLongValue]]; |
| 3593 | [theRequest setTotalBytesRead:[self contentLength]]; | 3596 | [theRequest setTotalBytesRead:[self contentLength]]; |
| 3594 | 3597 | ||
| 3595 | [theRequest parseStringEncodingFromHeaders]; | 3598 | [theRequest parseStringEncodingFromHeaders]; |
| @@ -3938,8 +3941,9 @@ static NSOperationQueue *sharedQueue = nil; | @@ -3938,8 +3941,9 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 3938 | // If your PAC file is larger than 16KB, you're just being cruel. | 3941 | // If your PAC file is larger than 16KB, you're just being cruel. |
| 3939 | uint8_t buf[16384]; | 3942 | uint8_t buf[16384]; |
| 3940 | NSInteger len = [(NSInputStream *)stream read:buf maxLength:16384]; | 3943 | NSInteger len = [(NSInputStream *)stream read:buf maxLength:16384]; |
| 3941 | - if (len) { | 3944 | + // Append only if something was actually read. |
| 3942 | - [[self PACFileData] appendBytes:(const void *)buf length:len]; | 3945 | + if (len > 0) { |
| 3946 | + [[self PACFileData] appendBytes:(const void *)buf length:(NSUInteger)len]; | ||
| 3943 | } | 3947 | } |
| 3944 | 3948 | ||
| 3945 | } else if (eventCode == NSStreamEventErrorOccurred || eventCode == NSStreamEventEndEncountered) { | 3949 | } else if (eventCode == NSStreamEventErrorOccurred || eventCode == NSStreamEventEndEncountered) { |
| @@ -4821,14 +4825,14 @@ static NSOperationQueue *sharedQueue = nil; | @@ -4821,14 +4825,14 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 4821 | + (NSString*)base64forData:(NSData*)theData { | 4825 | + (NSString*)base64forData:(NSData*)theData { |
| 4822 | 4826 | ||
| 4823 | const uint8_t* input = (const uint8_t*)[theData bytes]; | 4827 | const uint8_t* input = (const uint8_t*)[theData bytes]; |
| 4824 | - NSInteger length = [theData length]; | 4828 | + NSUInteger length = [theData length]; |
| 4825 | 4829 | ||
| 4826 | static char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; | 4830 | static char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; |
| 4827 | 4831 | ||
| 4828 | NSMutableData* data = [NSMutableData dataWithLength:((length + 2) / 3) * 4]; | 4832 | NSMutableData* data = [NSMutableData dataWithLength:((length + 2) / 3) * 4]; |
| 4829 | uint8_t* output = (uint8_t*)data.mutableBytes; | 4833 | uint8_t* output = (uint8_t*)data.mutableBytes; |
| 4830 | 4834 | ||
| 4831 | - NSInteger i,i2; | 4835 | + NSUInteger i,i2; |
| 4832 | for (i=0; i < length; i += 3) { | 4836 | for (i=0; i < length; i += 3) { |
| 4833 | NSInteger value = 0; | 4837 | NSInteger value = 0; |
| 4834 | for (i2=0; i2<3; i2++) { | 4838 | for (i2=0; i2<3; i2++) { |
| @@ -4839,10 +4843,10 @@ static NSOperationQueue *sharedQueue = nil; | @@ -4839,10 +4843,10 @@ static NSOperationQueue *sharedQueue = nil; | ||
| 4839 | } | 4843 | } |
| 4840 | 4844 | ||
| 4841 | NSInteger theIndex = (i / 3) * 4; | 4845 | NSInteger theIndex = (i / 3) * 4; |
| 4842 | - output[theIndex + 0] = table[(value >> 18) & 0x3F]; | 4846 | + output[theIndex + 0] = (uint8_t)table[(value >> 18) & 0x3F]; |
| 4843 | - output[theIndex + 1] = table[(value >> 12) & 0x3F]; | 4847 | + output[theIndex + 1] = (uint8_t)table[(value >> 12) & 0x3F]; |
| 4844 | - output[theIndex + 2] = (i + 1) < length ? table[(value >> 6) & 0x3F] : '='; | 4848 | + output[theIndex + 2] = (i + 1) < length ? (uint8_t)table[(value >> 6) & 0x3F] : '='; |
| 4845 | - output[theIndex + 3] = (i + 2) < length ? table[(value >> 0) & 0x3F] : '='; | 4849 | + output[theIndex + 3] = (i + 2) < length ? (uint8_t)table[(value >> 0) & 0x3F] : '='; |
| 4846 | } | 4850 | } |
| 4847 | 4851 | ||
| 4848 | return [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease]; | 4852 | return [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease]; |
| @@ -61,7 +61,7 @@ static NSLock *readLock = nil; | @@ -61,7 +61,7 @@ static NSLock *readLock = nil; | ||
| 61 | [readLock unlock]; | 61 | [readLock unlock]; |
| 62 | NSInteger rv = [stream read:buffer maxLength:toRead]; | 62 | NSInteger rv = [stream read:buffer maxLength:toRead]; |
| 63 | if (rv > 0) | 63 | if (rv > 0) |
| 64 | - [ASIHTTPRequest incrementBandwidthUsedInLastSecond:rv]; | 64 | + [ASIHTTPRequest incrementBandwidthUsedInLastSecond:(NSUInteger)rv]; |
| 65 | return rv; | 65 | return rv; |
| 66 | } | 66 | } |
| 67 | 67 |
| @@ -159,7 +159,7 @@ | @@ -159,7 +159,7 @@ | ||
| 159 | } | 159 | } |
| 160 | } | 160 | } |
| 161 | [request buildPostBody]; | 161 | [request buildPostBody]; |
| 162 | - [self request:nil incrementUploadSizeBy:[request postLength]]; | 162 | + [self request:nil incrementUploadSizeBy:(long long)[request postLength]]; |
| 163 | 163 | ||
| 164 | 164 | ||
| 165 | } else { | 165 | } else { |
| @@ -233,7 +233,7 @@ | @@ -233,7 +233,7 @@ | ||
| 233 | 233 | ||
| 234 | - (void)request:(ASIHTTPRequest *)request didReceiveBytes:(long long)bytes | 234 | - (void)request:(ASIHTTPRequest *)request didReceiveBytes:(long long)bytes |
| 235 | { | 235 | { |
| 236 | - [self setBytesDownloadedSoFar:[self bytesDownloadedSoFar]+bytes]; | 236 | + [self setBytesDownloadedSoFar:[self bytesDownloadedSoFar]+(unsigned long long)bytes]; |
| 237 | if ([self downloadProgressDelegate]) { | 237 | if ([self downloadProgressDelegate]) { |
| 238 | [ASIHTTPRequest updateProgressIndicator:&downloadProgressDelegate withProgress:[self bytesDownloadedSoFar] ofTotal:[self totalBytesToDownload]]; | 238 | [ASIHTTPRequest updateProgressIndicator:&downloadProgressDelegate withProgress:[self bytesDownloadedSoFar] ofTotal:[self totalBytesToDownload]]; |
| 239 | } | 239 | } |
| @@ -241,7 +241,7 @@ | @@ -241,7 +241,7 @@ | ||
| 241 | 241 | ||
| 242 | - (void)request:(ASIHTTPRequest *)request didSendBytes:(long long)bytes | 242 | - (void)request:(ASIHTTPRequest *)request didSendBytes:(long long)bytes |
| 243 | { | 243 | { |
| 244 | - [self setBytesUploadedSoFar:[self bytesUploadedSoFar]+bytes]; | 244 | + [self setBytesUploadedSoFar:[self bytesUploadedSoFar]+(unsigned long long)bytes]; |
| 245 | if ([self uploadProgressDelegate]) { | 245 | if ([self uploadProgressDelegate]) { |
| 246 | [ASIHTTPRequest updateProgressIndicator:&uploadProgressDelegate withProgress:[self bytesUploadedSoFar] ofTotal:[self totalBytesToUpload]]; | 246 | [ASIHTTPRequest updateProgressIndicator:&uploadProgressDelegate withProgress:[self bytesUploadedSoFar] ofTotal:[self totalBytesToUpload]]; |
| 247 | } | 247 | } |
| @@ -249,12 +249,12 @@ | @@ -249,12 +249,12 @@ | ||
| 249 | 249 | ||
| 250 | - (void)request:(ASIHTTPRequest *)request incrementDownloadSizeBy:(long long)newLength | 250 | - (void)request:(ASIHTTPRequest *)request incrementDownloadSizeBy:(long long)newLength |
| 251 | { | 251 | { |
| 252 | - [self setTotalBytesToDownload:[self totalBytesToDownload]+newLength]; | 252 | + [self setTotalBytesToDownload:[self totalBytesToDownload]+(unsigned long long)newLength]; |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | - (void)request:(ASIHTTPRequest *)request incrementUploadSizeBy:(long long)newLength | 255 | - (void)request:(ASIHTTPRequest *)request incrementUploadSizeBy:(long long)newLength |
| 256 | { | 256 | { |
| 257 | - [self setTotalBytesToUpload:[self totalBytesToUpload]+newLength]; | 257 | + [self setTotalBytesToUpload:[self totalBytesToUpload]+(unsigned long long)newLength]; |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | 260 |
| @@ -442,9 +442,9 @@ const SCNetworkReachabilityFlags kConnectionDown = kSCNetworkReachabilityFlagsC | @@ -442,9 +442,9 @@ const SCNetworkReachabilityFlags kConnectionDown = kSCNetworkReachabilityFlagsC | ||
| 442 | if (flags & kSCNetworkReachabilityFlagsIsWWAN) { return kReachableViaWWAN; } | 442 | if (flags & kSCNetworkReachabilityFlagsIsWWAN) { return kReachableViaWWAN; } |
| 443 | 443 | ||
| 444 | // Clear moot bits. | 444 | // Clear moot bits. |
| 445 | - flags &= ~kSCNetworkReachabilityFlagsReachable; | 445 | + flags &= ~(uint32_t)kSCNetworkReachabilityFlagsReachable; |
| 446 | - flags &= ~kSCNetworkReachabilityFlagsIsDirect; | 446 | + flags &= ~(uint32_t)kSCNetworkReachabilityFlagsIsDirect; |
| 447 | - flags &= ~kSCNetworkReachabilityFlagsIsLocalAddress; // kInternetConnection is local. | 447 | + flags &= ~(uint32_t)kSCNetworkReachabilityFlagsIsLocalAddress; // kInternetConnection is local. |
| 448 | 448 | ||
| 449 | // Reachability Flag Status: -R ct---xx Connection down. | 449 | // Reachability Flag Status: -R ct---xx Connection down. |
| 450 | if (flags == kConnectionDown) { return kNotReachable; } | 450 | if (flags == kConnectionDown) { return kNotReachable; } |
-
Please register or login to post a comment