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/09/13 00:46:00 UTC

ios commit: [CB-4687] - Fix Xcode 5 static analyzer issues

Updated Branches:
  refs/heads/master 70b568512 -> 7a8c659ad


[CB-4687] - Fix Xcode 5 static analyzer issues


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

Branch: refs/heads/master
Commit: 7a8c659ad25c2dc5190f213e53aaad2954d63603
Parents: 70b5685
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu Sep 12 15:45:52 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Sep 12 15:45:52 2013 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVWhitelist.m | 45 ++++++++++++++++++----------------
 1 file changed, 24 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/7a8c659a/CordovaLib/Classes/CDVWhitelist.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWhitelist.m b/CordovaLib/Classes/CDVWhitelist.m
index 14bdd53..5a9fb7e 100644
--- a/CordovaLib/Classes/CDVWhitelist.m
+++ b/CordovaLib/Classes/CDVWhitelist.m
@@ -50,27 +50,30 @@ NSString* const kCDVDefaultSchemeName = @"cdv-default-scheme";
 
 - (id)initWithScheme:(NSString*)scheme host:(NSString*)host port:(NSString*)port path:(NSString*)path
 {
-    if ((scheme == nil) || [scheme isEqualToString:@"*"]) {
-        _scheme = nil;
-    } else {
-        _scheme = [NSRegularExpression regularExpressionWithPattern:[CDVWhitelistPattern regexFromPattern:scheme allowWildcards:NO] options:0 error:nil];
-    }
-    if ([host isEqualToString:@"*"]) {
-        _host = nil;
-    } else if ([host hasPrefix:@"*."]) {
-        _host = [NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"([a-z0-9.-]*\\.)?%@", [CDVWhitelistPattern regexFromPattern:[host substringFromIndex:2] allowWildcards:false]] options:0 error:nil];
-    } else {
-        _host = [NSRegularExpression regularExpressionWithPattern:[CDVWhitelistPattern regexFromPattern:host allowWildcards:NO] options:0 error:nil];
-    }
-    if ((port == nil) || [port isEqualToString:@"*"]) {
-        _port = nil;
-    } else {
-        _port = [[NSNumber alloc] initWithInteger:[port integerValue]];
-    }
-    if ((path == nil) || [path isEqualToString:@"/*"]) {
-        _path = nil;
-    } else {
-        _path = [NSRegularExpression regularExpressionWithPattern:[CDVWhitelistPattern regexFromPattern:path allowWildcards:YES] options:0 error:nil];
+    self = [super init];  // Potentially change "self"
+    if (self) {
+        if ((scheme == nil) || [scheme isEqualToString:@"*"]) {
+            _scheme = nil;
+        } else {
+            _scheme = [NSRegularExpression regularExpressionWithPattern:[CDVWhitelistPattern regexFromPattern:scheme allowWildcards:NO] options:0 error:nil];
+        }
+        if ([host isEqualToString:@"*"]) {
+            _host = nil;
+        } else if ([host hasPrefix:@"*."]) {
+            _host = [NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"([a-z0-9.-]*\\.)?%@", [CDVWhitelistPattern regexFromPattern:[host substringFromIndex:2] allowWildcards:false]] options:0 error:nil];
+        } else {
+            _host = [NSRegularExpression regularExpressionWithPattern:[CDVWhitelistPattern regexFromPattern:host allowWildcards:NO] options:0 error:nil];
+        }
+        if ((port == nil) || [port isEqualToString:@"*"]) {
+            _port = nil;
+        } else {
+            _port = [[NSNumber alloc] initWithInteger:[port integerValue]];
+        }
+        if ((path == nil) || [path isEqualToString:@"/*"]) {
+            _path = nil;
+        } else {
+            _path = [NSRegularExpression regularExpressionWithPattern:[CDVWhitelistPattern regexFromPattern:path allowWildcards:YES] options:0 error:nil];
+        }
     }
     return self;
 }