Revision: 24385 http://sourceforge.net/p/bibdesk/svn/24385 Author: hofman Date: 2019-11-11 14:57:49 +0000 (Mon, 11 Nov 2019) Log Message: ----------- get urls from subrange of array rather than first copying subrange
Modified Paths: -------------- trunk/bibdesk/NSMenu_BDSKExtensions.m Modified: trunk/bibdesk/NSMenu_BDSKExtensions.m =================================================================== --- trunk/bibdesk/NSMenu_BDSKExtensions.m 2019-11-11 07:30:33 UTC (rev 24384) +++ trunk/bibdesk/NSMenu_BDSKExtensions.m 2019-11-11 14:57:49 UTC (rev 24385) @@ -202,14 +202,14 @@ return [[[NSFileManager defaultManager] displayNameAtPath:[appURL path]] stringByDeletingPathExtension]; } -static inline NSArray *copyUniqueVersionedNamesAndURLsForURLs(NSArray *appURLs, NSURL *defaultAppURL) { +static inline NSArray *copyUniqueVersionedNamesAndURLsForURLsInRange(NSArray *appURLs, NSRange range, NSURL *defaultAppURL) { NSMutableArray *uniqueNamesAndURLs = [[NSMutableArray alloc] init]; - NSInteger i, count = [appURLs count]; + NSUInteger i; - if (count > 1) { + if (range.length > 1) { NSMutableSet *versionStrings = [[NSMutableSet alloc] init]; - for (i = 0; i < count; i++) { + for (i = range.location; i < NSMaxRange(range); i++) { NSURL *appURL = [appURLs objectAtIndex:i]; NSDictionary *appInfo = [[NSBundle bundleWithPath:[appURL path]] infoDictionary]; NSString *versionString = [appInfo objectForKey:@"CFBundleVersion"]; @@ -249,8 +249,8 @@ NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"versionNumber" ascending:NO selector:@selector(compare:)]; [uniqueNamesAndURLs sortUsingDescriptors:[NSArray arrayWithObject:sort]]; [sort release]; - } else if (count == 1) { - NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:[appURLs lastObject], @"appURL", nil]; + } else if (range.length == 1) { + NSDictionary *dict = [[NSDictionary alloc] initWithObjectsAndKeys:[appURLs objectAtIndex:range.location], @"appURL", nil]; [uniqueNamesAndURLs addObject:dict]; [dict release]; } @@ -282,7 +282,7 @@ j = i + 1; while (j < count && [displayNameForURL([appURLs objectAtIndex:j]) isEqualToString:appName]) j++; - namesAndURLs = copyUniqueVersionedNamesAndURLsForURLs([appURLs subarrayWithRange:NSMakeRange(i, j - i)], defaultAppURL); + namesAndURLs = copyUniqueVersionedNamesAndURLsForURLsInRange(appURLs, NSMakeRange(i, j - i), defaultAppURL); i = j - 1; subCount = [namesAndURLs count]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit