mirror of
https://github.com/apache/cordova-plugin-file-transfer.git
synced 2026-04-28 00:02:49 +08:00
[CB-4480] Fix up a couple Unsigned->Signed mistakes from previous commit.
Also - thanks to Klaus Schmidt for the original patch for this fix.
This commit is contained in:
committed by
Steven Gill
parent
fbbfff122a
commit
a59755ec72
@@ -209,7 +209,7 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
|
||||
NSData* postBodyAfterFile = [[NSString stringWithFormat:@"\r\n--%@--\r\n", kFormBoundary] dataUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
long long totalPayloadLength = [postBodyBeforeFile length] + [fileData length] + [postBodyAfterFile length];
|
||||
[req setValue:[[NSNumber numberWithUnsignedLongLong:totalPayloadLength] stringValue] forHTTPHeaderField:@"Content-Length"];
|
||||
[req setValue:[[NSNumber numberWithLongLong:totalPayloadLength] stringValue] forHTTPHeaderField:@"Content-Length"];
|
||||
|
||||
if (chunkedMode) {
|
||||
CFReadStreamRef readStream = NULL;
|
||||
@@ -535,7 +535,7 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
|
||||
if (uploadResponse != nil) {
|
||||
[uploadResult setObject:uploadResponse forKey:@"response"];
|
||||
}
|
||||
[uploadResult setObject:[NSNumber numberWithUnsignedLongLong:self.bytesTransfered] forKey:@"bytesSent"];
|
||||
[uploadResult setObject:[NSNumber numberWithLongLong:self.bytesTransfered] forKey:@"bytesSent"];
|
||||
[uploadResult setObject:[NSNumber numberWithInt:self.responseCode] forKey:@"responseCode"];
|
||||
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:uploadResult];
|
||||
} else {
|
||||
@@ -683,8 +683,8 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
|
||||
}
|
||||
NSMutableDictionary* downloadProgress = [NSMutableDictionary dictionaryWithCapacity:3];
|
||||
[downloadProgress setObject:[NSNumber numberWithBool:lengthComputable] forKey:@"lengthComputable"];
|
||||
[downloadProgress setObject:[NSNumber numberWithUnsignedLongLong:self.bytesTransfered] forKey:@"loaded"];
|
||||
[downloadProgress setObject:[NSNumber numberWithUnsignedLongLong:self.bytesExpected] forKey:@"total"];
|
||||
[downloadProgress setObject:[NSNumber numberWithLongLong:self.bytesTransfered] forKey:@"loaded"];
|
||||
[downloadProgress setObject:[NSNumber numberWithLongLong:self.bytesExpected] forKey:@"total"];
|
||||
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:downloadProgress];
|
||||
[result setKeepCallbackAsBool:true];
|
||||
[self.command.commandDelegate sendPluginResult:result callbackId:callbackId];
|
||||
@@ -697,8 +697,8 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
|
||||
NSMutableDictionary* uploadProgress = [NSMutableDictionary dictionaryWithCapacity:3];
|
||||
|
||||
[uploadProgress setObject:[NSNumber numberWithBool:true] forKey:@"lengthComputable"];
|
||||
[uploadProgress setObject:[NSNumber numberWithUnsignedLongLong:totalBytesWritten] forKey:@"loaded"];
|
||||
[uploadProgress setObject:[NSNumber numberWithUnsignedLongLong:totalBytesExpectedToWrite] forKey:@"total"];
|
||||
[uploadProgress setObject:[NSNumber numberWithLongLong:totalBytesWritten] forKey:@"loaded"];
|
||||
[uploadProgress setObject:[NSNumber numberWithLongLong:totalBytesExpectedToWrite] forKey:@"total"];
|
||||
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:uploadProgress];
|
||||
[result setKeepCallbackAsBool:true];
|
||||
[self.command.commandDelegate sendPluginResult:result callbackId:callbackId];
|
||||
|
||||
Reference in New Issue
Block a user