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:47:04 UTC

git commit: [CB-4480] Using 64 bit ints to store file size

Updated Branches:
  refs/heads/dev ca080886e -> 5f9bcb8da


[CB-4480] Using 64 bit ints to store file size


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/commit/5f9bcb8d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/5f9bcb8d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/5f9bcb8d

Branch: refs/heads/dev
Commit: 5f9bcb8da8cd40850ee7998ddc70a062fb0ae49a
Parents: ca08088
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Aug 2 13:46:47 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Aug 2 13:46:47 2013 -0400

----------------------------------------------------------------------
 src/ios/CDVFileTransfer.h |  6 +++---
 src/ios/CDVFileTransfer.m | 22 +++++++++++-----------
 2 files changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/5f9bcb8d/src/ios/CDVFileTransfer.h
----------------------------------------------------------------------
diff --git a/src/ios/CDVFileTransfer.h b/src/ios/CDVFileTransfer.h
index 2231ee3..8e8211d 100644
--- a/src/ios/CDVFileTransfer.h
+++ b/src/ios/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-plugin-file-transfer/blob/5f9bcb8d/src/ios/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVFileTransfer.m b/src/ios/CDVFileTransfer.m
index 92070d1..d1aef24 100644
--- a/src/ios/CDVFileTransfer.m
+++ b/src/ios/CDVFileTransfer.m
@@ -49,8 +49,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,
@@ -208,8 +208,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 numberWithUnsignedLongLong: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 numberWithInt:self.bytesTransfered] forKey:@"bytesSent"];
+            [uploadResult setObject:[NSNumber numberWithUnsignedLongLong:self.bytesTransfered] forKey:@"bytesSent"];
             [uploadResult setObject:[NSNumber numberWithInt:self.responseCode] forKey:@"responseCode"];
             result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:uploadResult];
         } else {
@@ -665,9 +665,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];
 }
@@ -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 numberWithInt:self.bytesTransfered] forKey:@"loaded"];
-        [downloadProgress setObject:[NSNumber numberWithInt:self.bytesExpected] forKey:@"total"];
+        [downloadProgress setObject:[NSNumber numberWithUnsignedLongLong:self.bytesTransfered] forKey:@"loaded"];
+        [downloadProgress setObject:[NSNumber numberWithUnsignedLongLong: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 numberWithInt:totalBytesWritten] forKey:@"loaded"];
-        [uploadProgress setObject:[NSNumber numberWithInt:totalBytesExpectedToWrite] forKey:@"total"];
+        [uploadProgress setObject:[NSNumber numberWithUnsignedLongLong:totalBytesWritten] forKey:@"loaded"];
+        [uploadProgress setObject:[NSNumber numberWithUnsignedLongLong:totalBytesExpectedToWrite] forKey:@"total"];
         CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:uploadProgress];
         [result setKeepCallbackAsBool:true];
         [self.command.commandDelegate sendPluginResult:result callbackId:callbackId];