[vlc-commits] Bonjour: do not silently call objectAtIndexedSubscript and objectForKeyedSubscript

Jean-Baptiste Kempf git at videolan.org
Wed Dec 21 20:25:04 CET 2016


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Dec 21 20:23:21 2016 +0100| [b755f6990faa9ea446cccc73a4756f2a2e805b14] | committer: Jean-Baptiste Kempf

Bonjour: do not silently call objectAtIndexedSubscript and objectForKeyedSubscript

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b755f6990faa9ea446cccc73a4756f2a2e805b14
---

 modules/services_discovery/bonjour.m | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/modules/services_discovery/bonjour.m b/modules/services_discovery/bonjour.m
index 3181fbf..3e20382 100644
--- a/modules/services_discovery/bonjour.m
+++ b/modules/services_discovery/bonjour.m
@@ -177,24 +177,24 @@ NSString *const VLCBonjourRendererDemux         = @"VLCBonjourRendererDemux";
 
     msg_Info(_p_this, "starting discovery");
     for (NSDictionary *protocol in VLCSupportedProtocols) {
-        msg_Info(_p_this, "looking up %s", [protocol[VLCBonjourProtocolName] UTF8String]);
+        msg_Info(_p_this, "looking up %s", [[protocol objectForKey: VLCBonjourProtocolName] UTF8String]);
 
         /* Only discover services if we actually have a module that can handle those */
-        if (!module_exists([protocol[VLCBonjourProtocolName] UTF8String]) && !_isRendererDiscovery) {
-            msg_Info(_p_this, "no module for %s, skipping", [protocol[VLCBonjourProtocolName] UTF8String]);
+        if (!module_exists([[protocol objectForKey: VLCBonjourProtocolName] UTF8String]) && !_isRendererDiscovery) {
+            msg_Info(_p_this, "no module for %s, skipping", [[protocol objectForKey: VLCBonjourProtocolName] UTF8String]);
             continue;
         }
 
         /* Only discover hosts it they match the current mode (renderer or service) */
-        if ([protocol[VLCBonjourIsRenderer] boolValue] != _isRendererDiscovery) {
-            msg_Info(_p_this, "%s does not match current discovery mode, skipping", [protocol[VLCBonjourProtocolName] UTF8String]);
+        if ([[protocol objectForKey: VLCBonjourIsRenderer] boolValue] != _isRendererDiscovery) {
+            msg_Info(_p_this, "%s does not match current discovery mode, skipping", [[protocol objectForKey: VLCBonjourProtocolName] UTF8String]);
             continue;
         }
 
         NSNetServiceBrowser *serviceBrowser = [[NSNetServiceBrowser alloc] init];
         [serviceBrowser setDelegate:self];
-        msg_Info(_p_this, "starting discovery for type %s", [protocol[VLCBonjourProtocolServiceName] UTF8String]);
-        [serviceBrowser searchForServicesOfType:protocol[VLCBonjourProtocolServiceName] inDomain:@"local."];
+        msg_Info(_p_this, "starting discovery for type %s", [[protocol objectForKey: VLCBonjourProtocolServiceName] UTF8String]);
+        [serviceBrowser searchForServicesOfType:[protocol objectForKey: VLCBonjourProtocolServiceName] inDomain:@"local."];
         [discoverers addObject:serviceBrowser];
         [protocols addObject:protocol];
     }
@@ -254,9 +254,9 @@ NSString *const VLCBonjourRendererDemux         = @"VLCBonjourRendererDemux";
         [_resolvedNetServices removeObjectAtIndex:index];
 
         if (_isRendererDiscovery) {
-            [self removeRawRendererItem:_inputItemsForNetServices[index]];
+            [self removeRawRendererItem:[_inputItemsForNetServices objectAtIndex:index]];
         } else {
-            [self removeRawInputItem:_inputItemsForNetServices[index]];
+            [self removeRawInputItem:[_inputItemsForNetServices objectAtIndex:index]];
         }
 
         /* Remove item pointer from our lookup array */
@@ -271,8 +271,8 @@ NSString *const VLCBonjourRendererDemux         = @"VLCBonjourRendererDemux";
         NSString *serviceType = aNetService.type;
         NSString *protocol = nil;
         for (NSDictionary *protocolDefinition in _activeProtocols) {
-            if ([serviceType isEqualToString:protocolDefinition[VLCBonjourProtocolServiceName]]) {
-                protocol = protocolDefinition[VLCBonjourProtocolName];
+            if ([serviceType isEqualToString:[protocolDefinition objectForKey:VLCBonjourProtocolServiceName]]) {
+                protocol = [protocolDefinition objectForKey:VLCBonjourProtocolName];
             }
         }
 



More information about the vlc-commits mailing list