Commit 88857130 authored by David Fuhrmann's avatar David Fuhrmann

macosx: remove unneeded containsObject calls, fix UInt underflow, fix array cleaning

parent c1622c2c
...@@ -1516,21 +1516,19 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1516,21 +1516,19 @@ static VLCMain *_o_sharedMainInstance = nil;
if (pos.f_float > .05 && pos.f_float < .95 && dur > 180) { if (pos.f_float > .05 && pos.f_float < .95 && dur > 180) {
[mutDict setObject:[NSNumber numberWithInt:current_pos_in_sec] forKey:url]; [mutDict setObject:[NSNumber numberWithInt:current_pos_in_sec] forKey:url];
if ([mediaList containsObject:url])
[mediaList removeObject:url]; [mediaList removeObject:url];
[mediaList addObject:url]; [mediaList addObject:url];
if (mediaList.count > 30) { NSUInteger mediaListCount = mediaList.count;
NSUInteger count = mediaList.count; if (mediaListCount > 30) {
for (NSUInteger x = 0; x < 30 - count; x++) { for (NSUInteger x = 0; x < mediaListCount - 30; x++) {
[mutDict removeObjectForKey:mediaList[x]]; [mutDict removeObjectForKey:[mediaList objectAtIndex:0]];
[mediaList removeObject:mediaList[x]]; [mediaList removeObjectAtIndex:0];
} }
} }
} else { } else {
if ([mediaList containsObject:url]) { [mutDict removeObjectForKey:url];
[mutDict removeObjectForKey:url]; [mediaList removeObject:url];
[mediaList removeObject:url];
}
} }
[defaults setObject:mutDict forKey:@"recentlyPlayedMedia"]; [defaults setObject:mutDict forKey:@"recentlyPlayedMedia"];
[defaults setObject:mediaList forKey:@"recentlyPlayedMediaList"]; [defaults setObject:mediaList forKey:@"recentlyPlayedMediaList"];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment