Revision: 29602
          http://sourceforge.net/p/bibdesk/svn/29602
Author:   hofman
Date:     2025-09-18 16:11:05 +0000 (Thu, 18 Sep 2025)
Log Message:
-----------
use dictionary literals

Modified Paths:
--------------
    trunk/bibdesk/BDSKWebView.m

Modified: trunk/bibdesk/BDSKWebView.m
===================================================================
--- trunk/bibdesk/BDSKWebView.m 2025-09-18 16:05:28 UTC (rev 29601)
+++ trunk/bibdesk/BDSKWebView.m 2025-09-18 16:11:05 UTC (rev 29602)
@@ -232,21 +232,22 @@
     NSMutableArray *favicons = [NSMutableArray array];
     WebFrame *frame = [self mainFrame];
     NSArray *nodes = [[frame DOMDocument] 
nodesForXPath:@"/html/head/link[@rel='icon' or @rel='shortcut icon' or 
@rel='apple-touch-icon' or @rel='apple-touch-icon-precomposed']"];
+    NSArray *iconTypes = @[@"icon", @"shortcut icon", @"apple-touch-icon", 
@"apple-touch-icon-precomposed"];
     for (DOMElement *node in nodes) {
         NSString *url = [node getAttribute:@"href"];
         if (url == nil) continue;
-        NSUInteger type = [@[@"icon", @"shortcut icon", @"apple-touch-icon", 
@"apple-touch-icon-precomposed"] indexOfObject:[node getAttribute:@"rel"]];
+        NSUInteger type = [iconTypes indexOfObject:[node getAttribute:@"rel"]];
         NSArray *sizes = [[node getAttribute:@"sizes"] 
componentsSeparatedByString:@" "];
         BOOL foundSize = NO;
         for (NSString *sizeString in sizes) {
             NSArray *widthAndHeight = [[sizeString lowercaseString] 
componentsSeparatedByString:@"x"];
             if ([widthAndHeight count] == 2) {
-                [favicons addObject:[NSDictionary 
dictionaryWithObjectsAndKeys:url, @"url", [NSNumber 
numberWithInteger:[[widthAndHeight firstObject] integerValue]], @"width", 
[NSNumber numberWithInteger:[[widthAndHeight lastObject] integerValue]], 
@"height", [NSNumber numberWithUnsignedInteger:type], @"type", nil]];
+                [favicons addObject:@{@"url": url, @"type": [NSNumber 
numberWithUnsignedInteger:type], @"width": [NSNumber 
numberWithInteger:[[widthAndHeight firstObject] integerValue]], @"height": 
[NSNumber numberWithInteger:[[widthAndHeight lastObject] integerValue]]}];
                 foundSize = YES;
             }
         }
         if (foundSize == NO)
-            [favicons addObject:[NSDictionary 
dictionaryWithObjectsAndKeys:url, @"url", [NSNumber 
numberWithUnsignedInteger:type], @"type", nil]];
+            [favicons addObject:@{@"url": url, @"type": [NSNumber 
numberWithUnsignedInteger:type]}];
     }
     NSString *urlString = nil;
     if ([favicons count] > 1) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to