cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject [07/13] ios commit: [CB-1285] readded public helper functions supporting splice into existing jpeg nsdata operation
Date Sat, 23 Mar 2013 00:05:17 GMT
[CB-1285] readded public helper functions supporting splice into existing jpeg nsdata operation


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

Branch: refs/heads/master
Commit: 9e648940473c36d39bff6bba02c9a41896560033
Parents: 8a605b3
Author: lorinbeer <lorin@adobe.com>
Authored: Fri Mar 22 12:24:01 2013 -0700
Committer: lorinbeer <lorin@adobe.com>
Committed: Fri Mar 22 12:24:01 2013 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVJpegHeaderWriter.h |   14 ++---------
 CordovaLib/Classes/CDVJpegHeaderWriter.m |   28 +++++++++++++++++-------
 2 files changed, 23 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9e648940/CordovaLib/Classes/CDVJpegHeaderWriter.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVJpegHeaderWriter.h b/CordovaLib/Classes/CDVJpegHeaderWriter.h
index 07f6b2c..9382af7 100644
--- a/CordovaLib/Classes/CDVJpegHeaderWriter.h
+++ b/CordovaLib/Classes/CDVJpegHeaderWriter.h
@@ -17,14 +17,6 @@
  under the License.
  */
 
-//
-//  CDVImageHeaderWriter.h
-//  CordovaLib
-//
-//  Created by Lorin Beer on 2012-10-02.
-//
-//
-
 #import <Foundation/Foundation.h>
 
 @interface CDVJpegHeaderWriter : NSObject {
@@ -32,7 +24,7 @@
     NSDictionary * IFD0TagFormatDict;
 }
 
-
+- (NSString*) createExifAPP1 : (NSDictionary*) datadict;
 - (NSString*) formattedHexStringFromDecimalNumber: (NSNumber*) numb 
                                        withPlaces: (NSNumber*) width;
 - (NSString*) formatNumberWithLeadingZeroes: (NSNumber*) numb 
@@ -40,7 +32,6 @@
 - (NSString*) decimalToUnsignedRational: (NSNumber*) numb
                     withResultNumerator: (NSNumber**) numerator
                   withResultDenominator: (NSNumber**) denominator;
-
 - (void) continuedFraction: (double) val
           withFractionList: (NSMutableArray*) fractionlist 
                withHorizon: (int) horizon;
@@ -48,10 +39,11 @@
 - (void) splitDouble: (double) val 
          withIntComponent: (int*) rightside 
          withFloatRemainder: (double*) leftside;
-
 - (NSString*) formatRationalWithNumerator: (NSNumber*) numerator
                           withDenominator: (NSNumber*) denominator
                                asSigned: (Boolean) signedFlag;
+- (NSString*) hexStringFromData : (NSData*) data;
+- (NSNumber*) numericFromHexString : (NSString *) hexstring;
 
 /*
 - (void) readExifMetaData : (NSData*) imgdata;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/9e648940/CordovaLib/Classes/CDVJpegHeaderWriter.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVJpegHeaderWriter.m b/CordovaLib/Classes/CDVJpegHeaderWriter.m
index be35721..c6bba1e 100644
--- a/CordovaLib/Classes/CDVJpegHeaderWriter.m
+++ b/CordovaLib/Classes/CDVJpegHeaderWriter.m
@@ -17,14 +17,6 @@
  under the License.
  */
 
-//
-//  CDVImageHeaderWriter.m
-//  CordovaLib
-//
-//  Created by Lorin Beer on 2012-10-02.
-//
-//
-
 /**
  * creates an IFD field
  * Bytes 0-1 Tag code
@@ -468,4 +460,24 @@ const uint mTiffLength = 0x2a; // after byte align bits, next to bits
are 0x002a
     *leftside = val - *rightside;
 }
 
+
+//
+- (NSString*) hexStringFromData : (NSData*) data {
+    //overflow detection
+    const unsigned char *dataBuffer = [data bytes];
+    return [[NSString alloc] initWithFormat: @"%02x%02x",
+            (unsigned char)dataBuffer[0],
+            (unsigned char)dataBuffer[1]];
+}
+
+// convert a hex string to a number
+- (NSNumber*) numericFromHexString : (NSString *) hexstring {
+    NSScanner * scan = NULL;
+    unsigned int numbuf= 0;
+    
+    scan = [NSScanner scannerWithString:hexstring];
+    [scan scanHexInt:&numbuf];
+    return [NSNumber numberWithInt:numbuf];
+}
+
 @end


Mime
View raw message