Replaced every instance of NSEnumerator with for/in loops
parent
8d19b2538a
commit
3e057adf56
|
@ -57,9 +57,7 @@
|
|||
[output setVolume: volume];
|
||||
|
||||
@synchronized(chainQueue) {
|
||||
NSEnumerator *enumerator = [chainQueue objectEnumerator];
|
||||
id anObject;
|
||||
while (anObject = [enumerator nextObject])
|
||||
for (id anObject in chainQueue)
|
||||
{
|
||||
[anObject setShouldContinue:NO];
|
||||
}
|
||||
|
|
|
@ -195,7 +195,6 @@ escapeForLastFM(NSString *string)
|
|||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
AudioScrobblerClient *client = [[AudioScrobblerClient alloc] init];
|
||||
mach_timespec_t timeout = { 5, 0 };
|
||||
NSEnumerator *enumerator = nil;
|
||||
NSString *command = nil;
|
||||
NSString *response = nil;
|
||||
in_port_t port = 33367;
|
||||
|
@ -205,10 +204,10 @@ escapeForLastFM(NSString *string)
|
|||
|
||||
// Get the first command to be sent
|
||||
@synchronized([self queue]) {
|
||||
enumerator = [[self queue] objectEnumerator];
|
||||
command = [[enumerator nextObject] retain];
|
||||
|
||||
[[self queue] removeObjectIdenticalTo:command];
|
||||
if ([[self queue] count]) {
|
||||
command = [[self queue] objectAtIndex:0];
|
||||
[[self queue] removeObjectAtIndex:0];
|
||||
}
|
||||
}
|
||||
|
||||
if(nil != command) {
|
||||
|
|
|
@ -89,9 +89,7 @@ NSURL *resolveAliases(NSURL *url)
|
|||
NSMutableArray *newSubpathsDirs = [[NSMutableArray alloc] init];
|
||||
NSMutableArray *newSubpaths = [[NSMutableArray alloc] init];
|
||||
|
||||
NSEnumerator *e = [contents objectEnumerator];
|
||||
NSString *s;
|
||||
while ((s = [e nextObject]))
|
||||
for (NSString *s in contents)
|
||||
{
|
||||
if ([s characterAtIndex:0] == '.')
|
||||
{
|
||||
|
|
|
@ -138,10 +138,9 @@ The footer at the end of APE tagged files (can also optionally be at the front o
|
|||
-(NSDictionary*) convertToCogTag {
|
||||
//NSLog(@"Converting ape tag to cog tag");
|
||||
NSMutableDictionary* d = [NSMutableDictionary dictionaryWithCapacity:6];
|
||||
NSEnumerator *e = [fields objectEnumerator];
|
||||
ApeTagItem* item;
|
||||
ApeTagItem* item;
|
||||
int n = 0;
|
||||
while ((item = [e nextObject]) != nil) {
|
||||
for (item in fields) {
|
||||
if (![[item tag] compare:APE_TAG_FIELD_ARTIST]) { [d setObject:[item getString] forKey:@"artist"]; n++;}
|
||||
if (![[item tag] compare:APE_TAG_FIELD_ALBUM]) {[d setObject:[item getString] forKey:@"album"]; n++;}
|
||||
if (![[item tag] compare:APE_TAG_FIELD_TITLE]) {[d setObject:[item getString] forKey:@"title"]; n++;}
|
||||
|
@ -158,9 +157,8 @@ The footer at the end of APE tagged files (can also optionally be at the front o
|
|||
-(NSData*) pack {
|
||||
int len = 0, num = 0;
|
||||
NSMutableData* d = [NSMutableData dataWithCapacity:8];
|
||||
NSEnumerator *e = [fields objectEnumerator];
|
||||
id item;
|
||||
while ((item = [e nextObject]) != nil)
|
||||
id item;
|
||||
for (item in fields)
|
||||
{
|
||||
NSData* i = [item pack];
|
||||
[d appendData:i];
|
||||
|
|
|
@ -98,10 +98,8 @@
|
|||
|
||||
NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet];
|
||||
|
||||
NSString *line;
|
||||
NSScanner *scanner = nil;
|
||||
NSEnumerator *e = [[contents componentsSeparatedByString:@"\n"] objectEnumerator];
|
||||
while (line = [e nextObject])
|
||||
for (NSString *line in [contents componentsSeparatedByString:@"\n"])
|
||||
{
|
||||
[scanner release];
|
||||
scanner = [[NSScanner alloc] initWithString:line];
|
||||
|
@ -277,9 +275,7 @@
|
|||
|
||||
- (CueSheetTrack *)track:(NSString *)fragment
|
||||
{
|
||||
CueSheetTrack *t;
|
||||
NSEnumerator *e = [tracks objectEnumerator];
|
||||
while (t = [e nextObject]) {
|
||||
for (CueSheetTrack *t in tracks) {
|
||||
if ([[t track] isEqualToString:fragment]) {
|
||||
return t;
|
||||
}
|
||||
|
|
|
@ -33,9 +33,7 @@
|
|||
|
||||
CueSheet *cuesheet = [CueSheet cueSheetWithFile:[url path]];
|
||||
|
||||
NSEnumerator *e = [[cuesheet tracks] objectEnumerator];
|
||||
CueSheetTrack *track;
|
||||
while (track = [e nextObject]) {
|
||||
for (CueSheetTrack *track in [cuesheet tracks]) {
|
||||
[tracks addObject:[NSURL URLWithString:[[url absoluteString] stringByAppendingFormat:@"#%@", [track track]]]];
|
||||
}
|
||||
|
||||
|
|
|
@ -33,9 +33,7 @@
|
|||
CueSheet *cuesheet = [CueSheet cueSheetWithFile:[url path]];
|
||||
|
||||
NSArray *tracks = [cuesheet tracks];
|
||||
CueSheetTrack *track;
|
||||
NSEnumerator *e = [tracks objectEnumerator];
|
||||
while (track = [e nextObject])
|
||||
for (CueSheetTrack *track in tracks)
|
||||
{
|
||||
if ([[url fragment] isEqualToString:[track track]])
|
||||
{
|
||||
|
|
|
@ -93,12 +93,12 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
NSString *entry;
|
||||
NSEnumerator *e = [[contents componentsSeparatedByString:@"\n"] objectEnumerator];
|
||||
NSMutableArray *entries = [NSMutableArray array];
|
||||
|
||||
while ((entry = [[e nextObject] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]))
|
||||
{
|
||||
for (NSString *entry in [contents componentsSeparatedByString:@"\n"])
|
||||
{
|
||||
entry = [entry stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
|
||||
if ([entry hasPrefix:@"#"] || [entry isEqualToString:@""]) //Ignore extra info
|
||||
continue;
|
||||
|
||||
|
|
|
@ -99,8 +99,10 @@
|
|||
NSEnumerator *e = [[contents componentsSeparatedByString:@"\n"] objectEnumerator];
|
||||
NSMutableArray *entries = [NSMutableArray array];
|
||||
|
||||
while ((entry = [[e nextObject] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]))
|
||||
{
|
||||
for (NSString *entry in [contents componentsSeparatedByString:@"\n"])
|
||||
{
|
||||
entry = [entry stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
|
||||
NSScanner *scanner = [[NSScanner alloc] initWithString:entry];
|
||||
NSString *lhs = nil;
|
||||
NSString *rhs = nil;
|
||||
|
|
|
@ -97,10 +97,7 @@
|
|||
NSArray *fileNames = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil];
|
||||
NSArray *imageFileNames = [fileNames pathsMatchingExtensions:[NSImage imageFileTypes]];
|
||||
|
||||
NSEnumerator *imageEnumerator = [imageFileNames objectEnumerator];
|
||||
NSString *fileName;
|
||||
|
||||
while (fileName = [imageEnumerator nextObject]) {
|
||||
for (NSString *fileName in imageFileNames) {
|
||||
if ([TagLibMetadataReader isCoverFile:fileName]) {
|
||||
image = [NSData dataWithContentsOfFile:[path stringByAppendingPathComponent:fileName]];
|
||||
break;
|
||||
|
@ -118,10 +115,7 @@
|
|||
|
||||
+ (BOOL)isCoverFile:(NSString *)fileName
|
||||
{
|
||||
NSEnumerator *coverEnumerator = [[TagLibMetadataReader coverNames] objectEnumerator];
|
||||
NSString *coverFileName;
|
||||
|
||||
while (coverFileName = [coverEnumerator nextObject]) {
|
||||
for (NSString *coverFileName in [TagLibMetadataReader coverNames]) {
|
||||
if ([[[[fileName lastPathComponent] stringByDeletingPathExtension] lowercaseString] hasSuffix:coverFileName]) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -348,9 +348,7 @@ static AppleRemote* sharedInstance=nil;
|
|||
|
||||
- (NSString*) validCookieSubstring: (NSString*) cookieString {
|
||||
if (cookieString == nil || [cookieString length] == 0) return nil;
|
||||
NSEnumerator* keyEnum = [[self cookieToButtonMapping] keyEnumerator];
|
||||
NSString* key;
|
||||
while(key = [keyEnum nextObject]) {
|
||||
for (NSString *key in [[self cookieToButtonMapping] allKeys]) {
|
||||
NSRange range = [cookieString rangeOfString:key];
|
||||
if (range.location == 0) return key;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue