Use Objective-C construct for..in instead of oldfashioned C (uikit)
authorKees Bakker <kees@ijzerbout.nl>
Wed, 28 Sep 2011 20:32:26 +0200
changeset 60070e647f56751d
parent 6006 889d89332de4
child 6008 73951a50e6db
Use Objective-C construct for..in instead of oldfashioned C (uikit)
src/video/uikit/SDL_uikitvideo.m
     1.1 --- a/src/video/uikit/SDL_uikitvideo.m	Tue Sep 27 23:49:24 2011 +0200
     1.2 +++ b/src/video/uikit/SDL_uikitvideo.m	Wed Sep 28 20:32:26 2011 +0200
     1.3 @@ -167,12 +167,9 @@
     1.4          return;
     1.5      }
     1.6  
     1.7 -    const int ismain = (uiscreen == [UIScreen mainScreen]);
     1.8 +    const BOOL ismain = (uiscreen == [UIScreen mainScreen]);
     1.9      const NSArray *modes = [uiscreen availableModes];
    1.10 -    const NSUInteger mode_count = [modes count];
    1.11 -    NSUInteger i;
    1.12 -    for (i = 0; i < mode_count; i++) {
    1.13 -        UIScreenMode *uimode = (UIScreenMode *) [modes objectAtIndex:i];
    1.14 +    for (UIScreenMode *uimode in [uiscreen availableModes]) {
    1.15          CGSize size = [uimode size];
    1.16          mode.format = SDL_PIXELFORMAT_ABGR8888;
    1.17          mode.refresh_rate = 0;
    1.18 @@ -245,12 +242,8 @@
    1.19          const CGRect rect = [uiscreen bounds];
    1.20          UIKit_AddDisplay(uiscreen, uiscreenmode, (int)rect.size.width, (int)rect.size.height);
    1.21      } else {
    1.22 -        const NSArray *screens = [UIScreen screens];
    1.23 -        const NSUInteger screen_count = [screens count];
    1.24 -        NSUInteger i;
    1.25 -        for (i = 0; i < screen_count; i++) {
    1.26 +        for (UIScreen *uiscreen in [UIScreen screens]) {
    1.27              // the main screen is the first element in the array.
    1.28 -            UIScreen *uiscreen = (UIScreen *) [screens objectAtIndex:i];
    1.29              UIScreenMode *uiscreenmode = [uiscreen currentMode];
    1.30              const CGSize size = [[uiscreen currentMode] size];
    1.31              UIKit_AddDisplay(uiscreen, uiscreenmode, (int)size.width, (int)size.height);