You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2013/03/23 01:05:19 UTC

[09/13] ios commit: [CB-1285] replaced debugging copy (per byte) with block copy in data splice, removed logging

[CB-1285] replaced debugging copy (per byte) with block copy in data splice, removed logging


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/7ab72465
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/7ab72465
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/7ab72465

Branch: refs/heads/master
Commit: 7ab7246556ad5c40c1eb886404d21093e7d2599a
Parents: ac0cb7c
Author: lorinbeer <lo...@adobe.com>
Authored: Fri Mar 22 15:38:17 2013 -0700
Committer: lorinbeer <lo...@adobe.com>
Committed: Fri Mar 22 15:38:17 2013 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVCamera.m           |   19 ++++++++++++-------
 CordovaLib/Classes/CDVJpegHeaderWriter.m |   19 ++++++++++++-------
 2 files changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/7ab72465/CordovaLib/Classes/CDVCamera.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCamera.m b/CordovaLib/Classes/CDVCamera.m
index bba339d..9bf326a 100644
--- a/CordovaLib/Classes/CDVCamera.m
+++ b/CordovaLib/Classes/CDVCamera.m
@@ -318,26 +318,31 @@ static NSSet* org_apache_cordova_validArrowDirections;
                 NSMutableData * ddata = [NSMutableData dataWithCapacity: [data length]];
                 NSMakeRange(0,4);
                 int loc = 0;
-                //         CDVImageHeaderWriter * me = [[CDVImageHeaderWriter alloc] init];
-                
+                bool done = false;
                 // read the jpeg data until we encounter the app1==0xFFE1 marker
                 while (loc+1 < [data length]) {
                     NSData * blag = [data subdataWithRange: NSMakeRange(loc,2)];
                     if( [[blag description] isEqualToString : @"<ffe1>"]) {
-                        // read the next
+                        // read the APP1 block size bits
                         NSString * the = [exifWriter hexStringFromData:[data subdataWithRange: NSMakeRange(loc+2,2)]];
                         NSNumber * app1width = [exifWriter numericFromHexString:the];
-                        
+                        //consume the original app1 block
                         NSData * blag = [data subdataWithRange: NSMakeRange(loc,[app1width intValue])];
                         [ddata appendData:exifdata];
                         // advance our loc marker past app1
                         loc += [app1width intValue] + 2;
-                        
+                        done = true;
                     } else {
-                        [ddata appendData:blag];
-                        loc += 2;
+                        if(!done) {
+                            [ddata appendData:blag];
+                            loc += 2;
+                        } else {
+                            break;
+                        }
                     }
                 }
+                // copy the remaining data
+                [ddata appendData:[data subdataWithRange: NSMakeRange(loc,[data length]-loc)]];
                 data = ddata;
             }
 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/7ab72465/CordovaLib/Classes/CDVJpegHeaderWriter.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVJpegHeaderWriter.m b/CordovaLib/Classes/CDVJpegHeaderWriter.m
index c6bba1e..5273262 100644
--- a/CordovaLib/Classes/CDVJpegHeaderWriter.m
+++ b/CordovaLib/Classes/CDVJpegHeaderWriter.m
@@ -17,6 +17,14 @@
  under the License.
  */
 
+//
+//  CDVImageHeaderWriter.m
+//  CordovaLib
+//
+//  Created by Lorin Beer on 2012-10-02.
+//
+//
+
 /**
  * creates an IFD field
  * Bytes 0-1 Tag code
@@ -137,13 +145,14 @@ const uint mTiffLength = 0x2a; // after byte align bits, next to bits are 0x002a
     subExifIFD = [self createExifIFDFromDict: [datadict objectForKey:@"{Exif}"] withFormatDict: SubIFDTagFormatDict isIFD0:NO];
 
     // construct the complete app1 data block
-    app1 = [[NSMutableString alloc] initWithFormat: @"%@%04x%@%@%@%@",
+    app1 = [[NSMutableString alloc] initWithFormat: @"%@%04x%@%@%@%@%@",
             app1marker,
-            16+[exifIFD length]/2,
+            16+[exifIFD length]/2+[subExifIFD length]/2/*16+[exifIFD length]/2*/,
             exifmarker,
             tiffheader,
             ifd0offset,
-            exifIFD];
+            exifIFD,
+            subExifIFD];
      
     return app1;
 }
@@ -225,7 +234,6 @@ const uint mTiffLength = 0x2a; // after byte align bits, next to bits are 0x002a
 // Creates an exif formatted exif information file directory entry
 - (NSString*) createIFDElement: (NSString*) elementName withFormatDict : (NSDictionary*) formatdict withElementData : (NSString*) data  {
     NSArray * fielddata = [formatdict objectForKey: elementName];// format data of desired field
-    NSLog(@"%@", [data description]);
     if (fielddata) {
         // format string @"%@%@%@%@", tag number, data format, components, value
         NSNumber * dataformat = [fielddata objectAtIndex:1];
@@ -366,7 +374,6 @@ const uint mTiffLength = 0x2a; // after byte align bits, next to bits are 0x002a
               withResultNumerator: numerator
             withResultDenominator: denominator];
     
-    NSLog(@"%@ %d %d %@", @"Hi Int values", [*numerator intValue], [*denominator intValue],[fractionlist description]);
     return [self formatFractionList: fractionlist];
 }
 
@@ -401,7 +408,6 @@ const uint mTiffLength = 0x2a; // after byte align bits, next to bits are 0x002a
     int i = 0;
     int den = 0;
     int num = 0;
-    NSLog(@"%@",[fractionlist description]);
     if ([fractionlist count] == 1) {
         *numerator = [NSNumber numberWithInt:[[fractionlist objectAtIndex:0] intValue]];
         *denominator = @1;
@@ -444,7 +450,6 @@ const uint mTiffLength = 0x2a; // after byte align bits, next to bits are 0x002a
 - (NSString*) formatRationalWithNumerator: (NSNumber*) numerator withDenominator: (NSNumber*) denominator asSigned: (Boolean) signedFlag {
     NSMutableString * str = [[NSMutableString alloc] initWithCapacity:16];
     if (signedFlag) {
-        NSLog(@"Formatting as SIGNED rational");
         long num = [numerator longValue];
         long den = [denominator longValue];
         [str appendFormat: @"%08lx%08lx", num >= 0 ? num : ~ABS(num) + 1, num >= 0 ? den : ~ABS(den) + 1];