Replace NSData by NSUInteger in connection:didReceiveData:
Signed-off-by: Mattt Thompson <m@mattt.me>
This commit is contained in:
parent
3c6bec4207
commit
472ba1c66a
1 changed files with 4 additions and 3 deletions
|
|
@ -738,16 +738,17 @@ didReceiveResponse:(NSURLResponse *)response
|
||||||
- (void)connection:(NSURLConnection __unused *)connection
|
- (void)connection:(NSURLConnection __unused *)connection
|
||||||
didReceiveData:(NSData *)data
|
didReceiveData:(NSData *)data
|
||||||
{
|
{
|
||||||
|
NSUInteger length = [data length];
|
||||||
if ([self.outputStream hasSpaceAvailable]) {
|
if ([self.outputStream hasSpaceAvailable]) {
|
||||||
const uint8_t *dataBuffer = (uint8_t *) [data bytes];
|
const uint8_t *dataBuffer = (uint8_t *) [data bytes];
|
||||||
[self.outputStream write:&dataBuffer[0] maxLength:[data length]];
|
[self.outputStream write:&dataBuffer[0] maxLength:length];
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
self.totalBytesRead += [data length];
|
self.totalBytesRead += length;
|
||||||
|
|
||||||
if (self.downloadProgress) {
|
if (self.downloadProgress) {
|
||||||
self.downloadProgress([data length], self.totalBytesRead, self.response.expectedContentLength);
|
self.downloadProgress(length, self.totalBytesRead, self.response.expectedContentLength);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue