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/01/12 02:02:32 UTC

ios commit: Fixes static analyzer error for using mktemp (substituted with mkstemp)

Updated Branches:
  refs/heads/master 7e388ad7a -> 08edbc329


Fixes static analyzer error for using mktemp (substituted with mkstemp)


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

Branch: refs/heads/master
Commit: 08edbc329dbeee28a0a331d477a5d7ea6805283a
Parents: 7e388ad
Author: Shazron Abdullah <sh...@apache.org>
Authored: Fri Jan 11 17:02:07 2013 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Jan 11 17:02:25 2013 -0800

----------------------------------------------------------------------
 CordovaLib/Classes/CDVContact.m |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/08edbc32/CordovaLib/Classes/CDVContact.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVContact.m b/CordovaLib/Classes/CDVContact.m
index 469e743..ea05885 100644
--- a/CordovaLib/Classes/CDVContact.m
+++ b/CordovaLib/Classes/CDVContact.m
@@ -1314,8 +1314,10 @@ static NSDictionary* org_apache_cordova_contacts_defaultFields = nil;
         NSString* filePath = [NSString stringWithFormat:@"%@/photo_XXXXX", docsPath];
         char template[filePath.length + 1];
         strcpy(template, [filePath cStringUsingEncoding:NSASCIIStringEncoding]);
-        char* filename = mktemp(template);
-        filePath = [NSString stringWithCString:filename encoding:NSASCIIStringEncoding];
+        mkstemp(template);
+        filePath = [[NSFileManager defaultManager]
+            stringWithFileSystemRepresentation:template
+                                        length:strlen(template)];
 
         // save file
         if ([data writeToFile:filePath options:NSAtomicWrite error:&err]) {