Author: lgross
Date: Thu Nov 14 18:13:37 2013
New Revision: 1542005

URL: http://svn.apache.org/r1542005
Log:
Fixed uploaded bytes value in progress callback method: Value now reflects the 
size of actual uploaded data rather than the base64 encoded size

Modified:
    chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj
    chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m

Modified: chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj
URL: 
http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj?rev=1542005&r1=1542004&r2=1542005&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj 
(original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS.xcodeproj/project.pbxproj Thu 
Nov 14 18:13:37 2013
@@ -866,7 +866,7 @@
                8280729A15153DE800EF635C /* Project object */ = {
                        isa = PBXProject;
                        attributes = {
-                               LastUpgradeCheck = 0460;
+                               LastUpgradeCheck = 0500;
                                ORGANIZATIONNAME = "Apache Software Foundation";
                        };
                        buildConfigurationList = 8280729D15153DE800EF635C /* 
Build configuration list for PBXProject "ObjectiveCMIS" */;
@@ -1091,9 +1091,10 @@
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                ALWAYS_SEARCH_USER_PATHS = NO;
-                               ARCHS = "$(ARCHS_STANDARD_32_BIT)";
                                CLANG_ENABLE_OBJC_ARC = YES;
+                               CLANG_WARN_BOOL_CONVERSION = YES;
                                CLANG_WARN_CONSTANT_CONVERSION = YES;
+                               CLANG_WARN_EMPTY_BODY = YES;
                                CLANG_WARN_ENUM_CONVERSION = YES;
                                CLANG_WARN_INT_CONVERSION = YES;
                                CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -1107,10 +1108,14 @@
                                );
                                GCC_SYMBOLS_PRIVATE_EXTERN = NO;
                                GCC_VERSION = 
com.apple.compilers.llvm.clang.1_0;
+                               GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
                                GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNDECLARED_SELECTOR = YES;
                                GCC_WARN_UNINITIALIZED_AUTOS = YES;
+                               GCC_WARN_UNUSED_FUNCTION = YES;
                                GCC_WARN_UNUSED_VARIABLE = YES;
                                IPHONEOS_DEPLOYMENT_TARGET = 5.1;
+                               ONLY_ACTIVE_ARCH = YES;
                                "OTHER_CFLAGS[arch=*]" = "-DDEBUG";
                                SDKROOT = iphoneos;
                                TARGETED_DEVICE_FAMILY = "1,2";
@@ -1121,17 +1126,21 @@
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                ALWAYS_SEARCH_USER_PATHS = NO;
-                               ARCHS = "$(ARCHS_STANDARD_32_BIT)";
                                CLANG_ENABLE_OBJC_ARC = YES;
+                               CLANG_WARN_BOOL_CONVERSION = YES;
                                CLANG_WARN_CONSTANT_CONVERSION = YES;
+                               CLANG_WARN_EMPTY_BODY = YES;
                                CLANG_WARN_ENUM_CONVERSION = YES;
                                CLANG_WARN_INT_CONVERSION = YES;
                                CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
                                COPY_PHASE_STRIP = YES;
                                GCC_C_LANGUAGE_STANDARD = gnu99;
                                GCC_VERSION = 
com.apple.compilers.llvm.clang.1_0;
+                               GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
                                GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNDECLARED_SELECTOR = YES;
                                GCC_WARN_UNINITIALIZED_AUTOS = YES;
+                               GCC_WARN_UNUSED_FUNCTION = YES;
                                GCC_WARN_UNUSED_VARIABLE = YES;
                                IPHONEOS_DEPLOYMENT_TARGET = 5.1;
                                SDKROOT = iphoneos;

Modified: 
chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m
URL: 
http://svn.apache.org/viewvc/chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m?rev=1542005&r1=1542004&r2=1542005&view=diff
==============================================================================
--- chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m 
(original)
+++ chemistry/objectivecmis/trunk/ObjectiveCMIS/Utils/CMISHttpUploadRequest.m 
Thu Nov 14 18:13:37 2013
@@ -236,6 +236,14 @@ authenticationProvider:(id<CMISAuthentic
 totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite
 {
     if (self.progressBlock) {
+        if (self.base64Encoding) {
+            // Show the actual transmitted raw data size to the user, not the 
base64 encoded size
+            totalBytesWritten = [CMISHttpUploadRequest 
rawEncodedLength:totalBytesWritten];
+            if (totalBytesWritten > totalBytesExpectedToWrite) {
+                totalBytesWritten = totalBytesExpectedToWrite;
+            }
+        }
+        
         if (self.bytesExpected == 0) {
             self.progressBlock((NSUInteger)totalBytesWritten, 
(NSUInteger)totalBytesExpectedToWrite);
         } else {
@@ -421,7 +429,7 @@ totalBytesExpectedToWrite:(NSInteger)tot
     NSString *end = [NSString stringWithFormat:@"%@%@", xmlContentEnd, 
xmlProperties];
     self.streamEndData = [end dataUsingEncoding:NSUTF8StringEncoding];
     
-    NSUInteger encodedLength = [CMISHttpUploadRequest 
base64EncodedLength:self.bytesExpected];
+    NSUInteger encodedLength = [CMISHttpUploadRequest 
base64EncodedLength:(NSUInteger)self.bytesExpected];
     encodedLength += start.length;
     encodedLength += end.length;
     self.encodedLength = encodedLength;
@@ -458,6 +466,17 @@ totalBytesExpectedToWrite:(NSInteger)tot
     return 4 * adjustedThirdPartOfSize;
 }
 
++ (NSUInteger)rawEncodedLength:(NSUInteger)base64EncodedSize
+{
+    if (0 == base64EncodedSize)
+    {
+        return 0;
+    }
+    NSUInteger adjustedFourthPartOfSize = (base64EncodedSize / 4) + ( (0 == 
base64EncodedSize % 4 ) ? 0 : 1 );
+    
+    return 3 * adjustedFourthPartOfSize;
+}
+
 - (void)stopSendWithStatus:(NSString *)statusString
 {
     if (nil != statusString) {


Reply via email to