You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/08/02 19:53:45 UTC
ios commit: [CB-4480] Using 64 bit ints to store file size
Updated Branches:
refs/heads/2.9.x 8af3e8089 -> e09dc3526
[CB-4480] Using 64 bit ints to store file size
Thanks to Klaus Schmidt for the original patch.
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/e09dc352
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/e09dc352
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/e09dc352
Branch: refs/heads/2.9.x
Commit: e09dc3526e1ddbe34c55249720d38d65957d94d7
Parents: 8af3e80
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Aug 2 13:52:55 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Aug 2 13:52:55 2013 -0400
----------------------------------------------------------------------
CordovaLib/Classes/CDVFileTransfer.h | 6 +++---
CordovaLib/Classes/CDVFileTransfer.m | 22 +++++++++++-----------
2 files changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e09dc352/CordovaLib/Classes/CDVFileTransfer.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFileTransfer.h b/CordovaLib/Classes/CDVFileTransfer.h
index 35e3fdd..0f5f1a5 100644
--- a/CordovaLib/Classes/CDVFileTransfer.h
+++ b/CordovaLib/Classes/CDVFileTransfer.h
@@ -60,7 +60,7 @@ extern NSString* const kOptionsKeyCookie;
@interface CDVFileTransferDelegate : NSObject {}
-- (void)updateBytesExpected:(NSInteger)newBytesExpected;
+- (void)updateBytesExpected:(long long)newBytesExpected;
- (void)cancelTransfer:(NSURLConnection*)connection;
@property (strong) NSMutableData* responseData; // atomic
@@ -73,8 +73,8 @@ extern NSString* const kOptionsKeyCookie;
@property (nonatomic, copy) NSString* target;
@property (nonatomic, copy) NSString* mimeType;
@property (assign) int responseCode; // atomic
-@property (nonatomic, assign) NSInteger bytesTransfered;
-@property (nonatomic, assign) NSInteger bytesExpected;
+@property (nonatomic, assign) long long bytesTransfered;
+@property (nonatomic, assign) long long bytesExpected;
@property (nonatomic, assign) BOOL trustAllHosts;
@property (strong) NSFileHandle* targetFileHandle;
@property (nonatomic, strong) CDVFileTransferEntityLengthRequest* entityLengthRequest;
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/e09dc352/CordovaLib/Classes/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFileTransfer.m b/CordovaLib/Classes/CDVFileTransfer.m
index 0f6b174..1513e2c 100644
--- a/CordovaLib/Classes/CDVFileTransfer.m
+++ b/CordovaLib/Classes/CDVFileTransfer.m
@@ -47,8 +47,8 @@ NSString* const kFormBoundary = @"+++++org.apache.cordova.formBoundary";
static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
{
UInt8* bytes = (UInt8*)[data bytes];
- NSUInteger bytesToWrite = [data length];
- NSUInteger totalBytesWritten = 0;
+ long long bytesToWrite = [data length];
+ long long totalBytesWritten = 0;
while (totalBytesWritten < bytesToWrite) {
CFIndex result = CFWriteStreamWrite(stream,
@@ -206,8 +206,8 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
DLog(@"fileData length: %d", [fileData length]);
NSData* postBodyAfterFile = [[NSString stringWithFormat:@"\r\n--%@--\r\n", kFormBoundary] dataUsingEncoding:NSUTF8StringEncoding];
- NSUInteger totalPayloadLength = [postBodyBeforeFile length] + [fileData length] + [postBodyAfterFile length];
- [req setValue:[[NSNumber numberWithInteger:totalPayloadLength] stringValue] forHTTPHeaderField:@"Content-Length"];
+ long long totalPayloadLength = [postBodyBeforeFile length] + [fileData length] + [postBodyAfterFile length];
+ [req setValue:[[NSNumber numberWithLongLong:totalPayloadLength] stringValue] forHTTPHeaderField:@"Content-Length"];
if (chunkedMode) {
CFReadStreamRef readStream = NULL;
@@ -533,7 +533,7 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
if (uploadResponse != nil) {
[uploadResult setObject:uploadResponse forKey:@"response"];
}
- [uploadResult setObject:[NSNumber numberWithInt: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 {
@@ -663,9 +663,9 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
[self updateProgress];
}
-- (void)updateBytesExpected:(NSInteger)newBytesExpected
+- (void)updateBytesExpected:(long long)newBytesExpected
{
- DLog(@"Updating bytesExpected to %d", newBytesExpected);
+ DLog(@"Updating bytesExpected to %lld", newBytesExpected);
self.bytesExpected = newBytesExpected;
[self updateProgress];
}
@@ -681,8 +681,8 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
}
NSMutableDictionary* downloadProgress = [NSMutableDictionary dictionaryWithCapacity:3];
[downloadProgress setObject:[NSNumber numberWithBool:lengthComputable] forKey:@"lengthComputable"];
- [downloadProgress setObject:[NSNumber numberWithInt:self.bytesTransfered] forKey:@"loaded"];
- [downloadProgress setObject:[NSNumber numberWithInt: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];
@@ -695,8 +695,8 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
NSMutableDictionary* uploadProgress = [NSMutableDictionary dictionaryWithCapacity:3];
[uploadProgress setObject:[NSNumber numberWithBool:true] forKey:@"lengthComputable"];
- [uploadProgress setObject:[NSNumber numberWithInt:totalBytesWritten] forKey:@"loaded"];
- [uploadProgress setObject:[NSNumber numberWithInt: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];