Revision: 14556
          http://sourceforge.net/p/skim-app/code/14556
Author:   hofman
Date:     2024-10-16 16:53:58 +0000 (Wed, 16 Oct 2024)
Log Message:
-----------
Declare variable in for loop to avoid making it strong

Modified Paths:
--------------
    trunk/PDFAnnotation_SKExtensions.m
    trunk/SKApplication.m
    trunk/SKBookmarkController.m
    trunk/SKInfoWindowController.m
    trunk/SKMainDocument.m
    trunk/SKMainWindowController.m
    trunk/SKMainWindowController_UI.m
    trunk/SKNotesDocument.m
    trunk/SKObtainCommand.m
    trunk/SKPDFSyncParser.m
    trunk/SKPreferenceController.m
    trunk/SKPresentationOptionsSheetController.m

Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m  2024-10-14 08:48:50 UTC (rev 14555)
+++ trunk/PDFAnnotation_SKExtensions.m  2024-10-16 16:53:58 UTC (rev 14556)
@@ -178,9 +178,8 @@
 + (PDFAnnotation *)newSkimNoteWithPaths:(NSArray *)paths {
     NSRect bounds = NSZeroRect;
     NSAffineTransform *transform = [NSAffineTransform transform];
-    NSBezierPath *path;
     
-    for (path in paths)
+    for (NSBezierPath *path in paths)
         bounds = NSUnionRect(bounds, [path nonEmptyBounds]);
     bounds = NSInsetRect(NSIntegralRect(bounds), -8.0, -8.0);
     [transform translateXBy:-NSMinX(bounds) yBy:-NSMinY(bounds)];
@@ -189,7 +188,7 @@
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
     PDFAnnotation *annotation = [[PDFAnnotationInk alloc] 
initSkimNoteWithBounds:bounds forType:SKNInkString];
 #pragma clang diagnostic pop
-    for (path in paths)
+    for (NSBezierPath *path in paths)
         [annotation addBezierPath:[transform transformBezierPath:path]];
     return annotation;
 }
@@ -381,10 +380,9 @@
 
 - (void)setBezierPaths:(NSArray *)newPaths {
     NSArray *paths = [[self paths] copy];
-    NSBezierPath *path;
-    for (path in paths)
+    for (NSBezierPath *path in paths)
         [self removeBezierPath:path];
-    for (path in newPaths)
+    for (NSBezierPath *path in newPaths)
         [self addBezierPath:path];
 }
 

Modified: trunk/SKApplication.m
===================================================================
--- trunk/SKApplication.m       2024-10-14 08:48:50 UTC (rev 14555)
+++ trunk/SKApplication.m       2024-10-16 16:53:58 UTC (rev 14556)
@@ -139,16 +139,15 @@
     if ([toSort count] > 1)
         [toSort sortUsingDescriptors:@[[[NSSortDescriptor alloc] 
initWithKey:@"title" ascending:YES 
selector:@selector(caseInsensitiveCompare:)]]];
     
-    for (item in auxItems)
-        [windowsMenu addItem:item];
+    for (NSMenuItem *anItem in auxItems)
+        [windowsMenu addItem:anItem];
     
-    for (item in mainItems) {
-        [windowsMenu addItem:item];
-        NSDocument *doc = [[[item target] windowController] document];
+    for (NSMenuItem *anItem in mainItems) {
+        [windowsMenu addItem:anItem];
+        NSDocument *doc = [[[anItem target] windowController] document];
         NSArray *subArray = [subItems objectForKey:doc];
         if ([subArray count]) {
-            NSMenuItem *subItem;
-            for (subItem in subArray)
+            for (NSMenuItem *subItem in subArray)
                 [windowsMenu addItem:subItem];
         }
         [subItems removeObjectForKey:doc];
@@ -156,8 +155,8 @@
     
     if ([subItems count]) {
         for (NSDocument *doc in subItems) {
-            for (item in [subItems objectForKey:doc])
-                [windowsMenu addItem:item];
+            for (NSMenuItem *anItem in [subItems objectForKey:doc])
+                [windowsMenu addItem:anItem];
         }
     }
 }

Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m        2024-10-14 08:48:50 UTC (rev 14555)
+++ trunk/SKBookmarkController.m        2024-10-16 16:53:58 UTC (rev 14556)
@@ -664,28 +664,28 @@
                     NSMenuItem *item = [menu 
addItemWithSubmenuAndTitle:NSLocalizedString(@"Current Document", @"Menu item 
title")];
                     [item setRepresentedObject:fileURL];
                     NSMenu *submenu = [item submenu];
-                    for (bm in currentBookmarks)
-                        [self addItemForBookmark:bm toMenu:submenu isFolder:NO 
isAlternate:NO];
+                    for (SKBookmark *aBm in currentBookmarks)
+                        [self addItemForBookmark:aBm toMenu:submenu 
isFolder:NO isAlternate:NO];
                 }
             }
             if ([menu numberOfItems] > 0 && [bookmarks count] > 0)
                 [menu addItem:[NSMenuItem separatorItem]];
-            for (bm in bookmarks) {
-                switch ([bm bookmarkType]) {
+            for (SKBookmark *aBm in bookmarks) {
+                switch ([aBm bookmarkType]) {
                     case SKBookmarkTypeFolder:
-                        [self addItemForBookmark:bm toMenu:menu isFolder:YES 
isAlternate:NO];
-                        if (containsFolders(bm) == NO)
+                        [self addItemForBookmark:aBm toMenu:menu isFolder:YES 
isAlternate:NO];
+                        if (containsFolders(aBm) == NO)
                             [self addItemForBookmark:bm toMenu:menu 
isFolder:NO isAlternate:YES];
                         break;
                     case SKBookmarkTypeSession:
-                        [self addItemForBookmark:bm toMenu:menu isFolder:NO 
isAlternate:NO];
-                        [self addItemForBookmark:bm toMenu:menu isFolder:YES 
isAlternate:YES];
+                        [self addItemForBookmark:aBm toMenu:menu isFolder:NO 
isAlternate:NO];
+                        [self addItemForBookmark:aBm toMenu:menu isFolder:YES 
isAlternate:YES];
                         break;
                     case SKBookmarkTypeSeparator:
                         [menu addItem:[NSMenuItem separatorItem]];
                         break;
                     default:
-                        [self addItemForBookmark:bm toMenu:menu isFolder:NO 
isAlternate:NO];
+                        [self addItemForBookmark:aBm toMenu:menu isFolder:NO 
isAlternate:NO];
                         break;
                 }
             }

Modified: trunk/SKInfoWindowController.m
===================================================================
--- trunk/SKInfoWindowController.m      2024-10-14 08:48:50 UTC (rev 14555)
+++ trunk/SKInfoWindowController.m      2024-10-16 16:53:58 UTC (rev 14556)
@@ -148,9 +148,8 @@
     }
     
     NSArray *tables = [NSArray arrayWithObjects:summaryTableView, 
attributesTableView, nil];
-    NSTableView *tv;
     CGFloat width = 0.0;
-    for (tv in tables) {
+    for (NSTableView *tv in tables) {
         NSTableColumn *tc = [tv tableColumnWithIdentifier:LABEL_COLUMN_ID];
         NSCell *cell = [tc dataCell];
         NSArray *keys = [tv isEqual:summaryTableView] ? summaryKeys : 
attributesKeys;
@@ -162,7 +161,7 @@
             width = fmax(width, ceil([cell cellSize].width));
         }
     }
-    for (tv in tables) {
+    for (NSTableView *tv in tables) {
         NSTableColumn *tc = [tv tableColumnWithIdentifier:LABEL_COLUMN_ID];
         [tc setWidth:width];
         [tc setResizingMask:NSTableColumnNoResizing];

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2024-10-14 08:48:50 UTC (rev 14555)
+++ trunk/SKMainDocument.m      2024-10-16 16:53:58 UTC (rev 14556)
@@ -1461,14 +1461,13 @@
         
         if ([editorCmd isAbsolutePath] == NO) {
             NSMutableArray *searchPaths = [NSMutableArray 
arrayWithObjects:@"/usr/bin", @"/usr/local/bin", nil];
-            NSString *path;
             NSString *toolPath;
             NSBundle *appBundle;
             NSFileManager *fm = [NSFileManager defaultManager];
             
             if ([editorPreset isEqualToString:@""] == NO) {
-                if ((path = [[NSWorkspace sharedWorkspace] 
fullPathForApplication:editorPreset]) &&
-                    (appBundle = [NSBundle bundleWithPath:path])) {
+                NSString *path = [[NSWorkspace sharedWorkspace] 
fullPathForApplication:editorPreset];
+                if (path && (appBundle = [NSBundle bundleWithPath:path])) {
                     if ((path = [[appBundle bundlePath] 
stringByDeletingLastPathComponent]))
                         [searchPaths insertObject:path atIndex:0];
                     if ((path = [[appBundle bundlePath] 
stringByAppendingPathComponent:@"Contents"]))
@@ -1487,7 +1486,7 @@
                 [searchPaths addObjectsFromArray:[[fm 
applicationSupportDirectoryURLs] valueForKey:@"path"]];
             }
             
-            for (path in searchPaths) {
+            for (NSString *path in searchPaths) {
                 toolPath = [path stringByAppendingPathComponent:editorCmd];
                 if ([fm isExecutableFileAtPath:toolPath]) {
                     editorCmd = toolPath;

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2024-10-14 08:48:50 UTC (rev 14555)
+++ trunk/SKMainWindowController.m      2024-10-16 16:53:58 UTC (rev 14556)
@@ -995,9 +995,8 @@
             // remove the current annotations
             [pdfView setCurrentAnnotation:nil];
         }
-        PDFAnnotation *annotation;
         mwcFlags.addOrRemoveNotesInBulk = 1;
-        for (annotation in [notesToRemove copy]) {
+        for (PDFAnnotation *annotation in [notesToRemove copy]) {
             [pageIndexes addIndex:[annotation pageIndex]];
             PDFAnnotation *popup = [annotation popup];
             if (popup)
@@ -1951,8 +1950,8 @@
     
     if ([result count] > maxCount) {
         maxCount = [result count];
-        for (result in groupedSearchResults)
-            [result setMaxCount:maxCount];
+        for (SKGroupedSearchResult *aResult in groupedSearchResults)
+            [aResult setMaxCount:maxCount];
     }
     
     if (mwcFlags.highlightAllSearchResults) {
@@ -3024,9 +3023,9 @@
     NSMutableIndexSet *selPageIndexes = [NSMutableIndexSet indexSet];
     NSEnumerationOptions options = [sortDesc ascending] ? 0 : 
NSEnumerationReverse;
     
-    for (selAnnotation in [self selectedNotes]) {
-        if ([selAnnotation pageIndex] != NSNotFound)
-            [selPageIndexes addIndex:[selAnnotation pageIndex]];
+    for (PDFAnnotation *annotation in [self selectedNotes]) {
+        if ([annotation pageIndex] != NSNotFound)
+            [selPageIndexes addIndex:[annotation pageIndex]];
     }
     
     if ([orderedNotes count] == 0 || [selPageIndexes containsIndex:pageIndex])

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2024-10-14 08:48:50 UTC (rev 14555)
+++ trunk/SKMainWindowController_UI.m   2024-10-16 16:53:58 UTC (rev 14556)
@@ -931,13 +931,12 @@
         NSMutableArray *copiedItems = [NSMutableArray array];
         NSMutableAttributedString *attrString = [[NSMutableAttributedString 
alloc] init];
         BOOL isAttributed = NO;
-        id item;
         
-        for (item in [self noteItems:items]) {
+        for (id item in [self noteItems:items]) {
             if ([item isMovable])
                 [copiedItems addObject:item];
         }
-        for (item in items) {
+        for (id item in items) {
             if ([attrString length])
                 [attrString replaceCharactersInRange:NSMakeRange([attrString 
length], 0) withString:@"\n\n"];
             if ([(PDFAnnotation *)item type] == nil && [[(SKNoteText *)item 
note] isNote]) {

Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m     2024-10-14 08:48:50 UTC (rev 14555)
+++ trunk/SKNotesDocument.m     2024-10-16 16:53:58 UTC (rev 14556)
@@ -751,16 +751,14 @@
     NSMutableArray *copiedItems = [NSMutableArray array];
     NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] 
init];
     BOOL isAttributed = NO;
-    PDFAnnotation *item;
     
-    for (item in items) {
-        if ([item type] == nil)
-            item = [(SKNoteText *)item note];
+    for (PDFAnnotation *item in items) {
+        PDFAnnotation *anItem = [item type] ? item : [(SKNoteText *)item note];
         
-        if ([copiedItems containsObject:item] == NO && [item isMarkup] == NO)
-            [copiedItems addObject:item];
+        if ([copiedItems containsObject:anItem] == NO && [anItem isMarkup] == 
NO)
+            [copiedItems addObject:anItem];
     }
-    for (item in items) {
+    for (PDFAnnotation *item in items) {
         if ([attrString length])
             [attrString replaceCharactersInRange:NSMakeRange([attrString 
length], 0) withString:@"\n\n"];
         if ([item type] == nil && [[(SKNoteText *)item note] isNote]) {

Modified: trunk/SKObtainCommand.m
===================================================================
--- trunk/SKObtainCommand.m     2024-10-14 08:48:50 UTC (rev 14555)
+++ trunk/SKObtainCommand.m     2024-10-16 16:53:58 UTC (rev 14556)
@@ -113,8 +113,8 @@
         } else {
             desc = [NSAppleEventDescriptor listDescriptor];
             NSInteger i = 0;
-            for (page in pages)
-                [desc insertDescriptor:[[page objectSpecifier] descriptor] 
atIndex:++i];
+            for (PDFPage *aPage in pages)
+                [desc insertDescriptor:[[aPage objectSpecifier] descriptor] 
atIndex:++i];
         }
     }
     return desc;

Modified: trunk/SKPDFSyncParser.m
===================================================================
--- trunk/SKPDFSyncParser.m     2024-10-14 08:48:50 UTC (rev 14555)
+++ trunk/SKPDFSyncParser.m     2024-10-16 16:53:58 UTC (rev 14556)
@@ -193,12 +193,11 @@
     BOOL rv = NO;
     if (pageIndex < [pages count]) {
         
-        SKPDFSyncRecord *record = nil;
         SKPDFSyncRecord *beforeRecord = nil;
         SKPDFSyncRecord *afterRecord = nil;
         NSMutableDictionary *atRecords = [NSMutableDictionary dictionary];
         
-        for (record in [pages objectAtIndex:pageIndex]) {
+        for (SKPDFSyncRecord *record in [pages objectAtIndex:pageIndex]) {
             if ([record line] == 0)
                 continue;
             NSPoint p = [record point];
@@ -217,7 +216,7 @@
             }
         }
         
-        record = nil;
+        SKPDFSyncRecord *record = nil;
         if ([atRecords count]) {
             NSNumber *nearest = [[[atRecords allKeys] 
sortedArrayUsingSelector:@selector(compare:)] objectAtIndex:0];
             record = [atRecords objectForKey:nearest];
@@ -256,12 +255,11 @@
     NSArray *theLines = [lines objectForKey:file];
     if (theLines) {
         
-        SKPDFSyncRecord *record = nil;
         SKPDFSyncRecord *beforeRecord = nil;
         SKPDFSyncRecord *afterRecord = nil;
         NSMutableArray *atRecords = [NSMutableArray array];
         
-        for (record in theLines) {
+        for (SKPDFSyncRecord *record in theLines) {
             if ([record pageIndex] == NSNotFound)
                 continue;
             NSInteger l = [record line];
@@ -276,6 +274,7 @@
             }
         }
         
+        SKPDFSyncRecord *record = nil;
         if ([atRecords count]) {
             record = [atRecords firstObject];
             for (SKPDFSyncRecord *atRecord in atRecords) {

Modified: trunk/SKPreferenceController.m
===================================================================
--- trunk/SKPreferenceController.m      2024-10-14 08:48:50 UTC (rev 14555)
+++ trunk/SKPreferenceController.m      2024-10-16 16:53:58 UTC (rev 14556)
@@ -177,9 +177,8 @@
     CGFloat width = 0.0;
     NSRect frame;
     NSSize size;
-    NSViewController<SKPreferencePane> *pane;
     NSView *view;
-    for (pane in preferencePanes) {
+    for (NSViewController<SKPreferencePane> *pane in preferencePanes) {
         view = [pane view];
         size = [view fittingSize];
         width = fmax(width, size.width);

Modified: trunk/SKPresentationOptionsSheetController.m
===================================================================
--- trunk/SKPresentationOptionsSheetController.m        2024-10-14 08:48:50 UTC 
(rev 14555)
+++ trunk/SKPresentationOptionsSheetController.m        2024-10-16 16:53:58 UTC 
(rev 14556)
@@ -136,11 +136,10 @@
     while ([notesDocumentPopUpButton numberOfItems] > 3)
         [notesDocumentPopUpButton removeItemAtIndex:[notesDocumentPopUpButton 
numberOfItems] - 1];
     
-    NSDocument *doc;
     NSDocument *document = [controller document];
     NSMutableArray *documents = [NSMutableArray array];
     NSUInteger pageCount = [[document pdfDocument] pageCount];
-    for (doc in [[NSDocumentController sharedDocumentController] documents]) {
+    for (NSDocument *doc in [[NSDocumentController sharedDocumentController] 
documents]) {
         if ([doc isPDFDocument] && doc != document && [[doc pdfDocument] 
pageCount] == pageCount)
             [documents addObject:doc];
     }
@@ -147,7 +146,7 @@
     NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] 
initWithKey:@"displayName" ascending:YES];
     [documents sortUsingDescriptors:@[sortDescriptor]];
     
-    for (doc in documents) {
+    for (NSDocument *doc in documents) {
         [notesDocumentPopUpButton addItemWithTitle:[doc displayName]];
         [[notesDocumentPopUpButton lastItem] setRepresentedObject:doc];
     }

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



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to