Revision: 29965
http://sourceforge.net/p/bibdesk/svn/29965
Author: hofman
Date: 2026-01-20 16:49:17 +0000 (Tue, 20 Jan 2026)
Log Message:
-----------
enumerate in called method
Modified Paths:
--------------
trunk/bibdesk/BDSKFileSearchIndex.m
Modified: trunk/bibdesk/BDSKFileSearchIndex.m
===================================================================
--- trunk/bibdesk/BDSKFileSearchIndex.m 2026-01-20 10:32:57 UTC (rev 29964)
+++ trunk/bibdesk/BDSKFileSearchIndex.m 2026-01-20 16:49:17 UTC (rev 29965)
@@ -332,40 +332,44 @@
return YES;
}
-- (void)indexFileURL:(NSURL *)aURL{
- id signature = signatureForURL(aURL);
-
- if ([[signatures objectForKey:aURL] isEqual:signature] == NO) {
- // either the file was not indexed, or it has changed
+- (void)indexFileURLs:(id<NSFastEnumeration>)fileURLs{
+ for (NSURL *aURL in fileURLs) {
+ id signature = signatureForURL(aURL);
+ if ([[signatures objectForKey:aURL] isEqual:signature] == NO) {
+ // either the file was not indexed, or it has changed
+
+ SKDocumentRef skDocument = SKDocumentCreateWithURL((__bridge
CFURLRef)aURL);
+
+ BDSKPOSTCONDITION(skDocument);
+
+ if (skDocument != NULL) {
+
+ BDSKASSERT(signature);
+ [signatures setObject:signature forKey:aURL];
+
+ SKIndexAddDocument(skIndex, skDocument, NULL, TRUE);
+ CFRelease(skDocument);
+ }
+ }
+ }
+}
+
+- (void)removeFileURLs:(id<NSFastEnumeration>)fileURLs{
+ for (NSURL *aURL in fileURLs) {
SKDocumentRef skDocument = SKDocumentCreateWithURL((__bridge
CFURLRef)aURL);
BDSKPOSTCONDITION(skDocument);
if (skDocument != NULL) {
+ [signatures removeObjectForKey:aURL];
- BDSKASSERT(signature);
- [signatures setObject:signature forKey:aURL];
-
- SKIndexAddDocument(skIndex, skDocument, NULL, TRUE);
+ SKIndexRemoveDocument(skIndex, skDocument);
CFRelease(skDocument);
}
}
}
-- (void)removeFileURL:(NSURL *)aURL{
- SKDocumentRef skDocument = SKDocumentCreateWithURL((__bridge
CFURLRef)aURL);
-
- BDSKPOSTCONDITION(skDocument);
-
- if (skDocument != NULL) {
- [signatures removeObjectForKey:aURL];
-
- SKIndexRemoveDocument(skIndex, skDocument);
- CFRelease(skDocument);
- }
-}
-
- (void)indexFileURLs:(id<NSFastEnumeration>)urlsToAdd forIdentifierURL:(NSURL
*)identifierURL
{
// SKIndexSetProperties is more generally useful, but is really slow when
creating the index
@@ -380,8 +384,7 @@
[rwLock unlock];
}
- for (NSURL *url in urlsToAdd)
- [self indexFileURL:url];
+ [self indexFileURLs:urlsToAdd];
// the caller is responsible for updating the delegate, so we can throttle
initial indexing
}
@@ -404,8 +407,7 @@
}
[rwLock unlock];
- for (NSURL *url in toRemove)
- [self removeFileURL:url];
+ [self removeFileURLs:toRemove];
// the caller is responsible for updating the delegate, so we can throttle
initial indexing
}
@@ -549,6 +551,7 @@
[self didUpdate];
NSMutableSet *URLsToRemove = [[NSMutableSet alloc]
initWithArray:[signatures allKeys]];
+ NSMutableSet *URLsToAdd = [[NSMutableSet alloc] init];
NSMutableArray *itemsToAdd = [[NSMutableArray alloc] init];
double totalObjectCount = [items count];
@@ -585,10 +588,8 @@
}
// remove URLs we could not find in the database
- if ([self shouldKeepRunning] && [URLsToRemove count]) {
- for (NSURL *url in URLsToRemove)
- [self removeFileURL:url];
- }
+ if ([self shouldKeepRunning] && [URLsToRemove count])
+ [self removeFileURLs:URLsToRemove];
[self didUpdate];
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