Moved most enumerators to fast enumeration.
parent
00ef56a0ed
commit
b15e4f626a
|
@ -311,10 +311,8 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
|
||||||
{
|
{
|
||||||
//Need to convert to urls
|
//Need to convert to urls
|
||||||
NSMutableArray *urls = [NSMutableArray array];
|
NSMutableArray *urls = [NSMutableArray array];
|
||||||
NSEnumerator *e = [filenames objectEnumerator];
|
|
||||||
NSString *filename;
|
|
||||||
|
|
||||||
while (filename = [e nextObject])
|
for (NSString *filename in filenames)
|
||||||
{
|
{
|
||||||
[urls addObject:[NSURL fileURLWithPath:filename]];
|
[urls addObject:[NSURL fileURLWithPath:filename]];
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,8 @@
|
||||||
{
|
{
|
||||||
NSArray *urls = [AudioContainer urlsForContainerURL:url];
|
NSArray *urls = [AudioContainer urlsForContainerURL:url];
|
||||||
|
|
||||||
NSURL *u;
|
|
||||||
NSEnumerator *e = [urls objectEnumerator];
|
|
||||||
NSMutableArray *paths = [[NSMutableArray alloc] init];
|
NSMutableArray *paths = [[NSMutableArray alloc] init];
|
||||||
while (u = [e nextObject])
|
for (NSURL *u in urls)
|
||||||
{
|
{
|
||||||
ContainedNode *node = [[ContainedNode alloc] initWithDataSource:dataSource url:u];
|
ContainedNode *node = [[ContainedNode alloc] initWithDataSource:dataSource url:u];
|
||||||
NSLog(@"Node: %@", u);
|
NSLog(@"Node: %@", u);
|
||||||
|
|
|
@ -22,9 +22,8 @@
|
||||||
{
|
{
|
||||||
NSArray *contents = [[[NSFileManager defaultManager] directoryContentsAtPath:[url path]] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
|
NSArray *contents = [[[NSFileManager defaultManager] directoryContentsAtPath:[url path]] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
|
||||||
NSMutableArray *fullPaths = [[NSMutableArray alloc] init];
|
NSMutableArray *fullPaths = [[NSMutableArray alloc] init];
|
||||||
NSString *s;
|
|
||||||
NSEnumerator *e = [contents objectEnumerator];
|
for (NSString *s in contents)
|
||||||
while (s = [e nextObject])
|
|
||||||
{
|
{
|
||||||
[fullPaths addObject:[[url path] stringByAppendingPathComponent: s]];
|
[fullPaths addObject:[[url path] stringByAppendingPathComponent: s]];
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,10 +130,8 @@
|
||||||
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray*)items toPasteboard:(NSPasteboard*)pboard {
|
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray*)items toPasteboard:(NSPasteboard*)pboard {
|
||||||
//Get selected paths
|
//Get selected paths
|
||||||
NSMutableArray *urls = [NSMutableArray arrayWithCapacity:[items count]];
|
NSMutableArray *urls = [NSMutableArray arrayWithCapacity:[items count]];
|
||||||
NSEnumerator *e = [items objectEnumerator];
|
|
||||||
id p;
|
|
||||||
|
|
||||||
while (p = [e nextObject]) {
|
for (id p in items) {
|
||||||
[urls addObject:[p url]];
|
[urls addObject:[p url]];
|
||||||
}
|
}
|
||||||
NSLog(@"URLS: %@", urls);
|
NSLog(@"URLS: %@", urls);
|
||||||
|
|
|
@ -89,9 +89,7 @@ NSURL *resolveAliases(NSURL *url)
|
||||||
{
|
{
|
||||||
NSMutableArray *newSubpaths = [[NSMutableArray alloc] init];
|
NSMutableArray *newSubpaths = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
NSEnumerator *e = [contents objectEnumerator];
|
for (NSString *s in contents)
|
||||||
NSString *s;
|
|
||||||
while ((s = [e nextObject]))
|
|
||||||
{
|
{
|
||||||
if ([s characterAtIndex:0] == '.')
|
if ([s characterAtIndex:0] == '.')
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,5 @@ extern NSString *iTunesDropType;
|
||||||
-(void)moveObjectsInArrangedObjectsFromIndexes:(NSIndexSet*)indexSet toIndex:(unsigned int)insertIndex;
|
-(void)moveObjectsInArrangedObjectsFromIndexes:(NSIndexSet*)indexSet toIndex:(unsigned int)insertIndex;
|
||||||
|
|
||||||
- (NSIndexSet *)indexSetFromRows:(NSArray *)rows;
|
- (NSIndexSet *)indexSetFromRows:(NSArray *)rows;
|
||||||
- (int)rowsAboveRow:(int)row inIndexSet:(NSIndexSet *)indexSet;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -138,9 +138,8 @@ NSString *iTunesDropType = @"CorePasteboardFlavorType 0x6974756E";
|
||||||
- (NSIndexSet *)indexSetFromRows:(NSArray *)rows
|
- (NSIndexSet *)indexSetFromRows:(NSArray *)rows
|
||||||
{
|
{
|
||||||
NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet];
|
NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet];
|
||||||
NSEnumerator *rowEnumerator = [rows objectEnumerator];
|
|
||||||
NSNumber *idx;
|
for (NSNumber *idx in rows)
|
||||||
while (idx = [rowEnumerator nextObject])
|
|
||||||
{
|
{
|
||||||
[indexSet addIndex:[idx unsignedIntValue]];
|
[indexSet addIndex:[idx unsignedIntValue]];
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,9 +122,7 @@
|
||||||
if ([bestType isEqualToString:NSFilenamesPboardType]) {
|
if ([bestType isEqualToString:NSFilenamesPboardType]) {
|
||||||
NSMutableArray *urls = [[NSMutableArray alloc] init];
|
NSMutableArray *urls = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
NSEnumerator *e = [[[info draggingPasteboard] propertyListForType:NSFilenamesPboardType] objectEnumerator];
|
for (NSString *file in [[info draggingPasteboard] propertyListForType:NSFilenamesPboardType])
|
||||||
NSString *file;
|
|
||||||
while (file = [e nextObject])
|
|
||||||
{
|
{
|
||||||
[urls addObject:[NSURL fileURLWithPath:file]];
|
[urls addObject:[NSURL fileURLWithPath:file]];
|
||||||
}
|
}
|
||||||
|
@ -142,9 +140,7 @@
|
||||||
// Convert the iTunes URLs to URLs....MWAHAHAH!
|
// Convert the iTunes URLs to URLs....MWAHAHAH!
|
||||||
NSMutableArray *urls = [[NSMutableArray alloc] init];
|
NSMutableArray *urls = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
NSEnumerator *e = [[tracks allValues] objectEnumerator];
|
for (NSDictionary *trackInfo in [tracks allValues]) {
|
||||||
NSDictionary *trackInfo;
|
|
||||||
while (trackInfo = [e nextObject]) {
|
|
||||||
[urls addObject:[NSURL URLWithString:[trackInfo valueForKey:@"Location"]]];
|
[urls addObject:[NSURL URLWithString:[trackInfo valueForKey:@"Location"]]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,10 +162,7 @@
|
||||||
double tt = 0;
|
double tt = 0;
|
||||||
ldiv_t hoursAndMinutes;
|
ldiv_t hoursAndMinutes;
|
||||||
|
|
||||||
NSEnumerator *enumerator = [[self arrangedObjects] objectEnumerator];
|
for (PlaylistEntry *pe in [self arrangedObjects]) {
|
||||||
PlaylistEntry* pe;
|
|
||||||
|
|
||||||
while (pe = [enumerator nextObject]) {
|
|
||||||
tt += [[pe length] doubleValue];
|
tt += [[pe length] doubleValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,7 @@
|
||||||
|
|
||||||
//find the longest string display length in that column
|
//find the longest string display length in that column
|
||||||
float max_width = -1;
|
float max_width = -1;
|
||||||
id row;
|
for (id row in boundArray) {
|
||||||
NSEnumerator *enumerator = [boundArray objectEnumerator];
|
|
||||||
while (row = [enumerator nextObject]) {
|
|
||||||
|
|
||||||
[cell setObjectValue:row];
|
[cell setObjectValue:row];
|
||||||
|
|
||||||
|
|
|
@ -76,10 +76,7 @@
|
||||||
}
|
}
|
||||||
[fileHandle truncateFileAtOffset:0];
|
[fileHandle truncateFileAtOffset:0];
|
||||||
|
|
||||||
PlaylistEntry *pe;
|
for (PlaylistEntry *pe in [playlistController content])
|
||||||
NSEnumerator *e = [[playlistController content] objectEnumerator];
|
|
||||||
|
|
||||||
while (pe = [e nextObject])
|
|
||||||
{
|
{
|
||||||
NSString *path = [self relativePathFrom:filename toURL:[pe URL]];
|
NSString *path = [self relativePathFrom:filename toURL:[pe URL]];
|
||||||
[fileHandle writeData:[[path stringByAppendingString:@"\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
[fileHandle writeData:[[path stringByAppendingString:@"\n"] dataUsingEncoding:NSUTF8StringEncoding]];
|
||||||
|
@ -100,10 +97,8 @@
|
||||||
|
|
||||||
[fileHandle writeData:[[NSString stringWithFormat:@"[playlist]\nnumberOfEntries=%i\n\n",[[playlistController content] count]] dataUsingEncoding:NSUTF8StringEncoding]];
|
[fileHandle writeData:[[NSString stringWithFormat:@"[playlist]\nnumberOfEntries=%i\n\n",[[playlistController content] count]] dataUsingEncoding:NSUTF8StringEncoding]];
|
||||||
|
|
||||||
NSEnumerator *e = [[playlistController content] objectEnumerator];
|
|
||||||
PlaylistEntry *pe;
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
while (pe = [e nextObject])
|
for (PlaylistEntry *pe in [playlistController content])
|
||||||
{
|
{
|
||||||
NSString *path = [self relativePathFrom:filename toURL:[pe URL]];
|
NSString *path = [self relativePathFrom:filename toURL:[pe URL]];
|
||||||
NSString *entry = [NSString stringWithFormat:@"File%i=%@\n",i,path];
|
NSString *entry = [NSString stringWithFormat:@"File%i=%@\n",i,path];
|
||||||
|
@ -124,11 +119,9 @@
|
||||||
|
|
||||||
NSMutableArray *urls = [NSMutableArray array];
|
NSMutableArray *urls = [NSMutableArray array];
|
||||||
|
|
||||||
NSString *subpath;
|
|
||||||
NSArray *subpaths = [manager subpathsAtPath:path];
|
NSArray *subpaths = [manager subpathsAtPath:path];
|
||||||
NSEnumerator *e = [subpaths objectEnumerator];
|
|
||||||
|
|
||||||
while(subpath = [e nextObject])
|
for(NSString *subpath in subpaths)
|
||||||
{
|
{
|
||||||
NSString *absoluteSubpath = [NSString pathWithComponents:[NSArray arrayWithObjects:path,subpath,nil]];
|
NSString *absoluteSubpath = [NSString pathWithComponents:[NSArray arrayWithObjects:path,subpath,nil]];
|
||||||
|
|
||||||
|
@ -157,9 +150,8 @@
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
index = 0;
|
index = 0;
|
||||||
|
|
||||||
NSEnumerator *urlEnumerator = [urls objectEnumerator];
|
|
||||||
NSURL *url;
|
NSURL *url;
|
||||||
while (url = [urlEnumerator nextObject])
|
for (url in urls)
|
||||||
{
|
{
|
||||||
if ([url isFileURL]) {
|
if ([url isFileURL]) {
|
||||||
BOOL isDir;
|
BOOL isDir;
|
||||||
|
@ -199,8 +191,7 @@
|
||||||
sortedURLs = [expandedURLs copy];
|
sortedURLs = [expandedURLs copy];
|
||||||
}
|
}
|
||||||
|
|
||||||
urlEnumerator = [sortedURLs objectEnumerator];
|
for (url in sortedURLs)
|
||||||
while (url = [urlEnumerator nextObject])
|
|
||||||
{
|
{
|
||||||
//Container vs non-container url
|
//Container vs non-container url
|
||||||
if ([[self acceptableContainerTypes] containsObject:[[[url path] pathExtension] lowercaseString]]) {
|
if ([[self acceptableContainerTypes] containsObject:[[[url path] pathExtension] lowercaseString]]) {
|
||||||
|
@ -219,8 +210,7 @@
|
||||||
|
|
||||||
NSLog(@"Contained urls: %@", containedURLs);
|
NSLog(@"Contained urls: %@", containedURLs);
|
||||||
|
|
||||||
urlEnumerator = [fileURLs objectEnumerator];
|
for (url in fileURLs)
|
||||||
while (url = [urlEnumerator nextObject])
|
|
||||||
{
|
{
|
||||||
if (![[AudioPlayer schemes] containsObject:[url scheme]])
|
if (![[AudioPlayer schemes] containsObject:[url scheme]])
|
||||||
continue;
|
continue;
|
||||||
|
@ -239,8 +229,7 @@
|
||||||
|
|
||||||
NSLog(@"Valid urls: %@", validURLs);
|
NSLog(@"Valid urls: %@", validURLs);
|
||||||
|
|
||||||
urlEnumerator = [containedURLs objectEnumerator];
|
for (url in containedURLs)
|
||||||
while (url = [urlEnumerator nextObject])
|
|
||||||
{
|
{
|
||||||
if (![[AudioPlayer schemes] containsObject:[url scheme]])
|
if (![[AudioPlayer schemes] containsObject:[url scheme]])
|
||||||
continue;
|
continue;
|
||||||
|
@ -286,9 +275,8 @@
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
NSEnumerator *e = [entries objectEnumerator];
|
|
||||||
PlaylistEntry *pe;
|
PlaylistEntry *pe;
|
||||||
while (pe = [e nextObject])
|
for (pe in entries)
|
||||||
{
|
{
|
||||||
[pe readPropertiesThread];
|
[pe readPropertiesThread];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue