You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by om...@apache.org on 2016/04/14 00:50:37 UTC

[1/2] cordova-plugin-camera git commit: CB-10873 Avoid crash due to usage of uninitialized variable when writing geolocation data to image destination

Repository: cordova-plugin-camera
Updated Branches:
  refs/heads/master 82c9f4524 -> 4202fff7a


CB-10873 Avoid crash due to usage of uninitialized variable when writing geolocation data to image destination


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/def399fe
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/def399fe
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/def399fe

Branch: refs/heads/master
Commit: def399fe51bcad825d35c475336b28fe8b2f2bfb
Parents: 82c9f45
Author: Omar Mefire <om...@gmail.com>
Authored: Tue Apr 12 17:46:42 2016 -0700
Committer: Omar Mefire <om...@gmail.com>
Committed: Wed Apr 13 15:49:50 2016 -0700

----------------------------------------------------------------------
 src/ios/CDVCamera.m | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/def399fe/src/ios/CDVCamera.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m
index 1fae2e2..6bb1936 100644
--- a/src/ios/CDVCamera.m
+++ b/src/ios/CDVCamera.m
@@ -358,6 +358,7 @@ static NSString* toBase64(NSData* data) {
                 // use image unedited as requested , don't resize
                 data = UIImageJPEGRepresentation(image, 1.0);
             } else {
+                data = UIImageJPEGRepresentation(image, [options.quality floatValue] / 100.0f);
                 if (options.usesGeolocation) {
                     NSDictionary* controllerMetadata = [info objectForKey:@"UIImagePickerControllerMediaMetadata"];
                     if (controllerMetadata) {
@@ -374,8 +375,6 @@ static NSString* toBase64(NSData* data) {
                         }
                         [[self locationManager] startUpdatingLocation];
                     }
-                } else {
-                    data = UIImageJPEGRepresentation(image, [options.quality floatValue] / 100.0f);
                 }
             }
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[2/2] cordova-plugin-camera git commit: CB-10873 - Avoid crash due to usage of uninitialized variable when writing geolocation data to image destination - Properly handle 'CameraUsesGeolocation' option by properly setting geolocation data in EXIF

Posted by om...@apache.org.
CB-10873
    - Avoid crash due to usage of uninitialized variable when writing geolocation data to image destination
    - Properly handle 'CameraUsesGeolocation' option by properly setting geolocation data in EXIF header in all cases

 This closes #205


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/4202fff7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/4202fff7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/4202fff7

Branch: refs/heads/master
Commit: 4202fff7ac361b72f6e37d375ff65b0c207a6d0d
Parents: def399f
Author: Omar Mefire <om...@gmail.com>
Authored: Wed Apr 13 12:14:46 2016 -0700
Committer: Omar Mefire <om...@gmail.com>
Committed: Wed Apr 13 15:49:51 2016 -0700

----------------------------------------------------------------------
 src/ios/CDVCamera.m | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/4202fff7/src/ios/CDVCamera.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVCamera.m b/src/ios/CDVCamera.m
index 6bb1936..42dd469 100644
--- a/src/ios/CDVCamera.m
+++ b/src/ios/CDVCamera.m
@@ -359,22 +359,23 @@ static NSString* toBase64(NSData* data) {
                 data = UIImageJPEGRepresentation(image, 1.0);
             } else {
                 data = UIImageJPEGRepresentation(image, [options.quality floatValue] / 100.0f);
-                if (options.usesGeolocation) {
-                    NSDictionary* controllerMetadata = [info objectForKey:@"UIImagePickerControllerMediaMetadata"];
-                    if (controllerMetadata) {
-                        self.data = data;
-                        self.metadata = [[NSMutableDictionary alloc] init];
-                        
-                        NSMutableDictionary* EXIFDictionary = [[controllerMetadata objectForKey:(NSString*)kCGImagePropertyExifDictionary]mutableCopy];
-                        if (EXIFDictionary)	{
-                            [self.metadata setObject:EXIFDictionary forKey:(NSString*)kCGImagePropertyExifDictionary];
-                        }
-                        
-                        if (IsAtLeastiOSVersion(@"8.0")) {
-                            [[self locationManager] performSelector:NSSelectorFromString(@"requestWhenInUseAuthorization") withObject:nil afterDelay:0];
-                        }
-                        [[self locationManager] startUpdatingLocation];
+            }
+            
+            if (options.usesGeolocation) {
+                NSDictionary* controllerMetadata = [info objectForKey:@"UIImagePickerControllerMediaMetadata"];
+                if (controllerMetadata) {
+                    self.data = data;
+                    self.metadata = [[NSMutableDictionary alloc] init];
+                    
+                    NSMutableDictionary* EXIFDictionary = [[controllerMetadata objectForKey:(NSString*)kCGImagePropertyExifDictionary]mutableCopy];
+                    if (EXIFDictionary)	{
+                        [self.metadata setObject:EXIFDictionary forKey:(NSString*)kCGImagePropertyExifDictionary];
+                    }
+                    
+                    if (IsAtLeastiOSVersion(@"8.0")) {
+                        [[self locationManager] performSelector:NSSelectorFromString(@"requestWhenInUseAuthorization") withObject:nil afterDelay:0];
                     }
+                    [[self locationManager] startUpdatingLocation];
                 }
             }
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org