[vlc-devel] [PATCH 3/6] keychain: refactor

Thomas Guillem thomas at gllm.fr
Thu Oct 31 15:38:09 CET 2019


---
 modules/keystore/keychain.m | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/modules/keystore/keychain.m b/modules/keystore/keychain.m
index 9119e8543f3..c79b8bf5eb6 100644
--- a/modules/keystore/keychain.m
+++ b/modules/keystore/keychain.m
@@ -180,29 +180,32 @@ static void SetAccessibilityForQuery(vlc_keystore *p_keystore,
     int accessibilityType = var_InheritInteger(p_keystore, "keychain-accessibility-type");
     switch (accessibilityType) {
         case 1:
-            [query setObject:(__bridge id)kSecAttrAccessibleAfterFirstUnlock forKey:(__bridge id)kSecAttrAccessible];
+            secattr = kSecAttrAccessibleAfterFirstUnlock;
             break;
         case 2:
-            [query setObject:(__bridge id)kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly forKey:(__bridge id)kSecAttrAccessible];
+            secattr = kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly;
             break;
         case 3:
-            [query setObject:(__bridge id)kSecAttrAccessibleAlways forKey:(__bridge id)kSecAttrAccessible];
+            secattr = kSecAttrAccessibleAlways;
             break;
         case 4:
-            [query setObject:(__bridge id)kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly forKey:(__bridge id)kSecAttrAccessible];
+            secattr = kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly;
             break;
         case 5:
-            [query setObject:(__bridge id)kSecAttrAccessibleAlwaysThisDeviceOnly forKey:(__bridge id)kSecAttrAccessible];
+            secattr = kSecAttrAccessibleAlwaysThisDeviceOnly;
             break;
         case 6:
-            [query setObject:(__bridge id)kSecAttrAccessibleWhenUnlocked forKey:(__bridge id)kSecAttrAccessible];
+            secattr = kSecAttrAccessibleWhenUnlocked;
             break;
         case 7:
-            [query setObject:(__bridge id)kSecAttrAccessibleWhenUnlockedThisDeviceOnly forKey:(__bridge id)kSecAttrAccessible];
+            secattr = kSecAttrAccessibleWhenUnlockedThisDeviceOnly;
             break;
         default:
+            secattr = nil;
             break;
     }
+    if (secattr != nil)
+        [query setObject:(__bridge id)secattr forKey:(__bridge id)kSecAttrAccessible];
 }
 
 struct vlc2secattr
-- 
2.20.1



More information about the vlc-devel mailing list