Revision: 29366
http://sourceforge.net/p/bibdesk/svn/29366
Author: hofman
Date: 2025-07-25 15:41:40 +0000 (Fri, 25 Jul 2025)
Log Message:
-----------
enumerate using block
Modified Paths:
--------------
trunk/bibdesk/BibItem.m
Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m 2025-07-25 15:34:48 UTC (rev 29365)
+++ trunk/bibdesk/BibItem.m 2025-07-25 15:41:40 UTC (rev 29366)
@@ -4157,8 +4157,8 @@
return;
NSMutableArray *keysToRemove = [NSMutableArray new];
- NSMutableArray *unresolvedFiles = [NSMutableArray new];
- NSMutableArray *unresolvedURLs = [NSMutableArray new];
+ NSMutableArray *unresolvedFiles = nil;
+ NSMutableArray *unresolvedURLs = nil;
NSUInteger i = 0;
@@ -4174,6 +4174,8 @@
[files addObject:aFile];
}
else {
+ if (unresolvedFiles == nil)
+ unresolvedFiles = [NSMutableArray new];
[unresolvedFiles addObject:value];
NSLog(@"*** error *** -[BDSKLinkedFile
initWithBase64String:delegate:] failed (%@ of %@)", key, [self citeKey]);
}
@@ -4195,6 +4197,8 @@
[files addObject:aURL];
}
else {
+ if (unresolvedURLs == nil)
+ unresolvedURLs = [NSMutableArray new];
[unresolvedURLs addObject:value];
NSLog(@"*** error *** -[BDSKLinkedFile initWithURLString:] failed
(%@ of %@)", key, [self citeKey]);
}
@@ -4204,20 +4208,18 @@
if ([owner fileURL])
[files makeObjectsPerformSelector:@selector(updateWithPath:)
withObject:nil];
- NSUInteger unresolvedFileCount = [unresolvedFiles count],
unresolvedURLCount = [unresolvedURLs count];
-
// remove from pubFields to avoid duplication when saving
[pubFields removeObjectsForKeys:keysToRemove];
// add unresolved URLs back in, and make sure the remaining keys are
contiguous
- if (unresolvedFileCount) {
- for (i = 0; i < unresolvedFileCount; i++)
- [pubFields setObject:[unresolvedFiles objectAtIndex:i]
forKey:[NSString stringWithFormat:@"Bdsk-File-%lu", (unsigned long)(i + 1)]];
- }
- if (unresolvedURLCount) {
- for (i = 0; i < unresolvedURLCount; i++)
- [pubFields setObject:[unresolvedURLs objectAtIndex:i]
forKey:[NSString stringWithFormat:@"Bdsk-Url-%lu", (unsigned long)(i + 1)]];
- }
+ if (unresolvedFiles)
+ [unresolvedFiles enumerateObjectsUsingBlock:^(NSString *value,
NSUInteger idx, BOOL *stop){
+ [pubFields setObject:value forKey:[NSString
stringWithFormat:@"Bdsk-File-%lu", (unsigned long)(idx + 1)]];
+ }];
+ if (unresolvedURLs)
+ [unresolvedURLs enumerateObjectsUsingBlock:^(NSString *value,
NSUInteger idx, BOOL *stop){
+ [pubFields setObject:value forKey:[NSString
stringWithFormat:@"Bdsk-Url-%lu", (unsigned long)(idx + 1)]];
+ }];
biFlags.createdFilesArray = YES;
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