more indent cleanup SDL-1.3
authorSam Lantinga <slouken@libsdl.org>
Sun, 28 May 2006 18:16:36 +0000
branchSDL-1.3
changeset 1664cd3db072ba8a
parent 1663 11775724e3fe
child 1665 28193f833b2b
more indent cleanup
Makefile.in
src/audio/alsa/SDL_alsa_audio.c
src/main/macosx/SDLMain.m
src/video/qtopia/SDL_QWin.cc
     1.1 --- a/Makefile.in	Sun May 28 13:29:03 2006 +0000
     1.2 +++ b/Makefile.in	Sun May 28 18:16:36 2006 +0000
     1.3 @@ -130,8 +130,7 @@
     1.4  	find . \( \
     1.5  	    -name '*.h' -o \
     1.6  	    -name '*.c' -o \
     1.7 -	    -name '*.cc' -o \
     1.8 -	    -name '*.m' \) \
     1.9 +	    -name '*.cc' \) \
    1.10  	    -exec indent {} \;
    1.11  
    1.12  clean:
     2.1 --- a/src/audio/alsa/SDL_alsa_audio.c	Sun May 28 13:29:03 2006 +0000
     2.2 +++ b/src/audio/alsa/SDL_alsa_audio.c	Sun May 28 18:16:36 2006 +0000
     2.3 @@ -106,17 +106,16 @@
     2.4                                                            * params,
     2.5                                                            snd_pcm_uframes_t
     2.6                                                            val, int *dir);
     2.7 -static
     2.8 -    snd_pcm_sframes_t (*SDL_NAME (snd_pcm_hw_params_get_period_size)) (const
     2.9 -                                                                       snd_pcm_hw_params_t
    2.10 -                                                                       *
    2.11 -                                                                       params);
    2.12 -static unsigned
    2.13 -    int (*SDL_NAME (snd_pcm_hw_params_set_periods_near)) (snd_pcm_t * pcm,
    2.14 -                                                          snd_pcm_hw_params_t
    2.15 -                                                          * params,
    2.16 -                                                          unsigned int val,
    2.17 -                                                          int *dir);
    2.18 +static snd_pcm_sframes_t
    2.19 +    (*SDL_NAME (snd_pcm_hw_params_get_period_size)) (const
    2.20 +                                                     snd_pcm_hw_params_t
    2.21 +                                                     * params);
    2.22 +static unsigned int
    2.23 +    (*SDL_NAME (snd_pcm_hw_params_set_periods_near)) (snd_pcm_t * pcm,
    2.24 +                                                      snd_pcm_hw_params_t
    2.25 +                                                      * params,
    2.26 +                                                      unsigned int val,
    2.27 +                                                      int *dir);
    2.28  static int (*SDL_NAME (snd_pcm_hw_params_get_periods)) (snd_pcm_hw_params_t *
    2.29                                                          params);
    2.30  static int (*SDL_NAME (snd_pcm_hw_params)) (snd_pcm_t * pcm,
     3.1 --- a/src/main/macosx/SDLMain.m	Sun May 28 13:29:03 2006 +0000
     3.2 +++ b/src/main/macosx/SDLMain.m	Sun May 28 18:16:36 2006 +0000
     3.3 @@ -7,179 +7,162 @@
     3.4  
     3.5  #import "SDL.h"
     3.6  #import "SDLMain.h"
     3.7 -#import <sys/param.h>           /* for MAXPATHLEN */
     3.8 +#import <sys/param.h> /* for MAXPATHLEN */
     3.9  #import <unistd.h>
    3.10  
    3.11  /* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
    3.12   but the method still is there and works. To avoid warnings, we declare
    3.13   it ourselves here. */
    3.14 -@ interface NSApplication (SDL_Missing_Methods) - (void) setAppleMenu:(NSMenu
    3.15 - *)
    3.16 -    menu;
    3.17 +@interface NSApplication(SDL_Missing_Methods)
    3.18 +- (void)setAppleMenu:(NSMenu *)menu;
    3.19  @end
    3.20 +
    3.21  /* Use this flag to determine whether we use SDLMain.nib or not */
    3.22  #define		SDL_USE_NIB_FILE	0
    3.23 +
    3.24  /* Use this flag to determine whether we use CPS (docking) or not */
    3.25  #define		SDL_USE_CPS		1
    3.26  #ifdef SDL_USE_CPS
    3.27  /* Portions of CPS.h */
    3.28 -     typedef struct CPSProcessSerNum
    3.29 -     {
    3.30 -         UInt32
    3.31 -             lo;
    3.32 -         UInt32
    3.33 -             hi;
    3.34 -     } CPSProcessSerNum;
    3.35 +typedef struct CPSProcessSerNum
    3.36 +{
    3.37 +	UInt32		lo;
    3.38 +	UInt32		hi;
    3.39 +} CPSProcessSerNum;
    3.40  
    3.41 -     extern
    3.42 -         OSErr
    3.43 -     CPSGetCurrentProcess (CPSProcessSerNum * psn);
    3.44 -     extern
    3.45 -         OSErr
    3.46 -     CPSEnableForegroundOperation (CPSProcessSerNum * psn, UInt32 _arg2,
    3.47 -                                   UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
    3.48 -     extern
    3.49 -         OSErr
    3.50 -     CPSSetFrontProcess (CPSProcessSerNum * psn);
    3.51 +extern OSErr	CPSGetCurrentProcess( CPSProcessSerNum *psn);
    3.52 +extern OSErr 	CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
    3.53 +extern OSErr	CPSSetFrontProcess( CPSProcessSerNum *psn);
    3.54  
    3.55  #endif /* SDL_USE_CPS */
    3.56  
    3.57 -     static int
    3.58 -         gArgc;
    3.59 -     static char **
    3.60 -         gArgv;
    3.61 -     static
    3.62 -         BOOL
    3.63 -         gFinderLaunch;
    3.64 -     static
    3.65 -         BOOL
    3.66 -         gCalledAppMainline = FALSE;
    3.67 +static int    gArgc;
    3.68 +static char  **gArgv;
    3.69 +static BOOL   gFinderLaunch;
    3.70 +static BOOL   gCalledAppMainline = FALSE;
    3.71  
    3.72 -     static NSString *
    3.73 -     getApplicationName (void)
    3.74 +static NSString *getApplicationName(void)
    3.75  {
    3.76      NSDictionary *dict;
    3.77      NSString *appName = 0;
    3.78  
    3.79      /* Determine the application name */
    3.80 -    dict =
    3.81 -        (NSDictionary *) CFBundleGetInfoDictionary (CFBundleGetMainBundle ());
    3.82 +    dict = (NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
    3.83      if (dict)
    3.84 -      appName =[dict objectForKey:@"CFBundleName"];
    3.85 -
    3.86 +        appName = [dict objectForKey: @"CFBundleName"];
    3.87 +    
    3.88      if (![appName length])
    3.89 -        appName =[[NSProcessInfo processInfo] processName];
    3.90 +        appName = [[NSProcessInfo processInfo] processName];
    3.91  
    3.92      return appName;
    3.93  }
    3.94  
    3.95  #if SDL_USE_NIB_FILE
    3.96  /* A helper category for NSString */
    3.97 -@interface NSString (ReplaceSubString) - (NSString *) stringByReplacingRange:(NSRange)
    3.98 -     aRange
    3.99 -     with:(NSString *)
   3.100 -    aString;
   3.101 +@interface NSString (ReplaceSubString)
   3.102 +- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
   3.103  @end
   3.104  #endif
   3.105 -@ interface SDLApplication:NSApplication
   3.106 -    @ end @ implementation SDLApplication
   3.107 +
   3.108 +@interface SDLApplication : NSApplication
   3.109 +@end
   3.110 +
   3.111 +@implementation SDLApplication
   3.112  /* Invoked from the Quit menu item */
   3.113 -- (void) terminate:(id) sender
   3.114 +- (void)terminate:(id)sender
   3.115  {
   3.116      /* Post a SDL_QUIT event */
   3.117      SDL_Event event;
   3.118      event.type = SDL_QUIT;
   3.119 -    SDL_PushEvent (&event);
   3.120 +    SDL_PushEvent(&event);
   3.121  }
   3.122 +@end
   3.123  
   3.124 -@end
   3.125  /* The main class of the application, the application's delegate */
   3.126 -    @ implementation SDLMain
   3.127 +@implementation SDLMain
   3.128 +
   3.129  /* Set the working directory to the .app's parent directory */
   3.130 -- (void) setupWorkingDirectory:(BOOL) shouldChdir {
   3.131 -    if (shouldChdir) {
   3.132 +- (void) setupWorkingDirectory:(BOOL)shouldChdir
   3.133 +{
   3.134 +    if (shouldChdir)
   3.135 +    {
   3.136          char parentdir[MAXPATHLEN];
   3.137 -        CFURLRef url = CFBundleCopyBundleURL (CFBundleGetMainBundle ());
   3.138 -        CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent (0, url);
   3.139 -        if (CFURLGetFileSystemRepresentation
   3.140 -            (url2, true, (UInt8 *) parentdir, MAXPATHLEN)) {
   3.141 -            assert (chdir (parentdir) == 0);    /* chdir to the binary app's parent */
   3.142 -        }
   3.143 -        CFRelease (url);
   3.144 -        CFRelease (url2);
   3.145 -    }
   3.146 +		CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
   3.147 +		CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
   3.148 +		if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, MAXPATHLEN)) {
   3.149 +	        assert ( chdir (parentdir) == 0 );   /* chdir to the binary app's parent */
   3.150 +		}
   3.151 +		CFRelease(url);
   3.152 +		CFRelease(url2);
   3.153 +	}
   3.154  
   3.155  }
   3.156  
   3.157  #if SDL_USE_NIB_FILE
   3.158  
   3.159  /* Fix menu to contain the real app name instead of "SDL App" */
   3.160 --(void) fixMenu:(NSMenu *)
   3.161 -     aMenu
   3.162 -     withAppName:(NSString *)
   3.163 -    appName
   3.164 +- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
   3.165  {
   3.166      NSRange aRange;
   3.167      NSEnumerator *enumerator;
   3.168      NSMenuItem *menuItem;
   3.169  
   3.170 -  aRange =[[aMenu title] rangeOfString:@"SDL App"];
   3.171 +    aRange = [[aMenu title] rangeOfString:@"SDL App"];
   3.172      if (aRange.length != 0)
   3.173 -      [aMenu setTitle: [[aMenu title] stringByReplacingRange: aRange with:appName]];
   3.174 +        [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
   3.175  
   3.176 -    enumerator =[[aMenu itemArray] objectEnumerator];
   3.177 -    while ((menuItem =[enumerator nextObject])) {
   3.178 -      aRange =[[menuItem title] rangeOfString:@"SDL App"];
   3.179 +    enumerator = [[aMenu itemArray] objectEnumerator];
   3.180 +    while ((menuItem = [enumerator nextObject]))
   3.181 +    {
   3.182 +        aRange = [[menuItem title] rangeOfString:@"SDL App"];
   3.183          if (aRange.length != 0)
   3.184 -          [menuItem setTitle: [[menuItem title] stringByReplacingRange: aRange with:appName]];
   3.185 +            [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
   3.186          if ([menuItem hasSubmenu])
   3.187 -          [self fixMenu: [menuItem submenu] withAppName:appName];
   3.188 +            [self fixMenu:[menuItem submenu] withAppName:appName];
   3.189      }
   3.190 -    [aMenu sizeToFit];
   3.191 +    [ aMenu sizeToFit ];
   3.192  }
   3.193  
   3.194  #else
   3.195  
   3.196 -static void
   3.197 -setApplicationMenu (void)
   3.198 +static void setApplicationMenu(void)
   3.199  {
   3.200      /* warning: this code is very odd */
   3.201      NSMenu *appleMenu;
   3.202      NSMenuItem *menuItem;
   3.203      NSString *title;
   3.204      NSString *appName;
   3.205 +    
   3.206 +    appName = getApplicationName();
   3.207 +    appleMenu = [[NSMenu alloc] initWithTitle:@""];
   3.208 +    
   3.209 +    /* Add menu items */
   3.210 +    title = [@"About " stringByAppendingString:appName];
   3.211 +    [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
   3.212  
   3.213 -    appName = getApplicationName ();
   3.214 -  appleMenu =[[NSMenu alloc] initWithTitle:@""];
   3.215 +    [appleMenu addItem:[NSMenuItem separatorItem]];
   3.216  
   3.217 -    /* Add menu items */
   3.218 -  title =[@"About " stringByAppendingString:appName];
   3.219 -  [appleMenu addItemWithTitle: title action: @selector (orderFrontStandardAboutPanel: )keyEquivalent:@""];
   3.220 +    title = [@"Hide " stringByAppendingString:appName];
   3.221 +    [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
   3.222  
   3.223 -  [appleMenu addItem:[NSMenuItem separatorItem]];
   3.224 +    menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
   3.225 +    [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
   3.226  
   3.227 -  title =[@"Hide " stringByAppendingString:appName];
   3.228 -  [appleMenu addItemWithTitle: title action: @selector (hide: )keyEquivalent:@"h"];
   3.229 +    [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
   3.230  
   3.231 -  menuItem = (NSMenuItem *)[appleMenu addItemWithTitle: @"Hide Others" action: @selector (hideOtherApplications: )keyEquivalent:@"h"];
   3.232 -  [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask |
   3.233 -     NSCommandKeyMask)];
   3.234 +    [appleMenu addItem:[NSMenuItem separatorItem]];
   3.235  
   3.236 -  [appleMenu addItemWithTitle: @"Show All" action: @selector (unhideAllApplications: )keyEquivalent:@""];
   3.237 +    title = [@"Quit " stringByAppendingString:appName];
   3.238 +    [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
   3.239  
   3.240 -  [appleMenu addItem:[NSMenuItem separatorItem]];
   3.241 -
   3.242 -  title =[@"Quit " stringByAppendingString:appName];
   3.243 -  [appleMenu addItemWithTitle: title action: @selector (terminate: )keyEquivalent:@"q"];
   3.244 -
   3.245 -
   3.246 +    
   3.247      /* Put menu into the menubar */
   3.248 -  menuItem =[[NSMenuItem alloc] initWithTitle: @"" action: nil keyEquivalent:@""];
   3.249 -  [menuItem setSubmenu:appleMenu];
   3.250 -  [[NSApp mainMenu] addItem:menuItem];
   3.251 +    menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
   3.252 +    [menuItem setSubmenu:appleMenu];
   3.253 +    [[NSApp mainMenu] addItem:menuItem];
   3.254  
   3.255      /* Tell the application object that this is now the application menu */
   3.256 -  [NSApp setAppleMenu:appleMenu];
   3.257 +    [NSApp setAppleMenu:appleMenu];
   3.258  
   3.259      /* Finally give up our references to the objects */
   3.260      [appleMenu release];
   3.261 @@ -187,27 +170,26 @@
   3.262  }
   3.263  
   3.264  /* Create a window menu */
   3.265 -static void
   3.266 -setupWindowMenu (void)
   3.267 +static void setupWindowMenu(void)
   3.268  {
   3.269 -    NSMenu *windowMenu;
   3.270 -    NSMenuItem *windowMenuItem;
   3.271 -    NSMenuItem *menuItem;
   3.272 +    NSMenu      *windowMenu;
   3.273 +    NSMenuItem  *windowMenuItem;
   3.274 +    NSMenuItem  *menuItem;
   3.275  
   3.276 -  windowMenu =[[NSMenu alloc] initWithTitle:@"Window"];
   3.277 -
   3.278 +    windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
   3.279 +    
   3.280      /* "Minimize" item */
   3.281 -  menuItem =[[NSMenuItem alloc] initWithTitle: @"Minimize" action: @selector (performMiniaturize: )keyEquivalent:@"m"];
   3.282 -  [windowMenu addItem:menuItem];
   3.283 +    menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
   3.284 +    [windowMenu addItem:menuItem];
   3.285      [menuItem release];
   3.286 -
   3.287 +    
   3.288      /* Put menu into the menubar */
   3.289 -  windowMenuItem =[[NSMenuItem alloc] initWithTitle: @"Window" action: nil keyEquivalent:@""];
   3.290 -  [windowMenuItem setSubmenu:windowMenu];
   3.291 -  [[NSApp mainMenu] addItem:windowMenuItem];
   3.292 -
   3.293 +    windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
   3.294 +    [windowMenuItem setSubmenu:windowMenu];
   3.295 +    [[NSApp mainMenu] addItem:windowMenuItem];
   3.296 +    
   3.297      /* Tell the application object that this is now the window menu */
   3.298 -  [NSApp setWindowsMenu:windowMenu];
   3.299 +    [NSApp setWindowsMenu:windowMenu];
   3.300  
   3.301      /* Finally give up our references to the objects */
   3.302      [windowMenu release];
   3.303 @@ -215,39 +197,37 @@
   3.304  }
   3.305  
   3.306  /* Replacement for NSApplicationMain */
   3.307 -static void
   3.308 -CustomApplicationMain (int argc, char **argv)
   3.309 +static void CustomApplicationMain (int argc, char **argv)
   3.310  {
   3.311 -    NSAutoreleasePool *pool =[[NSAutoreleasePool alloc] init];
   3.312 -    SDLMain *sdlMain;
   3.313 +    NSAutoreleasePool	*pool = [[NSAutoreleasePool alloc] init];
   3.314 +    SDLMain				*sdlMain;
   3.315  
   3.316      /* Ensure the application object is initialised */
   3.317      [SDLApplication sharedApplication];
   3.318 -
   3.319 +    
   3.320  #ifdef SDL_USE_CPS
   3.321      {
   3.322          CPSProcessSerNum PSN;
   3.323          /* Tell the dock about us */
   3.324 -        if (!CPSGetCurrentProcess (&PSN))
   3.325 -            if (!CPSEnableForegroundOperation
   3.326 -                (&PSN, 0x03, 0x3C, 0x2C, 0x1103))
   3.327 -                if (!CPSSetFrontProcess (&PSN))
   3.328 +        if (!CPSGetCurrentProcess(&PSN))
   3.329 +            if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
   3.330 +                if (!CPSSetFrontProcess(&PSN))
   3.331                      [SDLApplication sharedApplication];
   3.332      }
   3.333  #endif /* SDL_USE_CPS */
   3.334  
   3.335      /* Set up the menubar */
   3.336 -  [NSApp setMainMenu:[[NSMenu alloc] init]];
   3.337 -    setApplicationMenu ();
   3.338 -    setupWindowMenu ();
   3.339 +    [NSApp setMainMenu:[[NSMenu alloc] init]];
   3.340 +    setApplicationMenu();
   3.341 +    setupWindowMenu();
   3.342  
   3.343      /* Create SDLMain and make it the app delegate */
   3.344 -    sdlMain =[[SDLMain alloc] init];
   3.345 -  [NSApp setDelegate:sdlMain];
   3.346 -
   3.347 +    sdlMain = [[SDLMain alloc] init];
   3.348 +    [NSApp setDelegate:sdlMain];
   3.349 +    
   3.350      /* Start the main event loop */
   3.351      [NSApp run];
   3.352 -
   3.353 +    
   3.354      [sdlMain release];
   3.355      [pool release];
   3.356  }
   3.357 @@ -270,34 +250,34 @@
   3.358   *
   3.359   * This message is ignored once the app's mainline has been called.
   3.360   */
   3.361 --(BOOL) application:(NSApplication *)
   3.362 -     theApplication openFile:(NSString *) filename
   3.363 +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
   3.364  {
   3.365      const char *temparg;
   3.366      size_t arglen;
   3.367      char *arg;
   3.368      char **newargv;
   3.369  
   3.370 -    if (!gFinderLaunch)         /* MacOS is passing command line args. */
   3.371 +    if (!gFinderLaunch)  /* MacOS is passing command line args. */
   3.372          return FALSE;
   3.373  
   3.374 -    if (gCalledAppMainline)     /* app has started, ignore this document. */
   3.375 +    if (gCalledAppMainline)  /* app has started, ignore this document. */
   3.376          return FALSE;
   3.377  
   3.378 -    temparg =[filename UTF8String];
   3.379 -    arglen = SDL_strlen (temparg) + 1;
   3.380 -    arg = (char *) SDL_malloc (arglen);
   3.381 +    temparg = [filename UTF8String];
   3.382 +    arglen = SDL_strlen(temparg) + 1;
   3.383 +    arg = (char *) SDL_malloc(arglen);
   3.384      if (arg == NULL)
   3.385          return FALSE;
   3.386  
   3.387 -    newargv = (char **) realloc (gArgv, sizeof (char *) * (gArgc + 2));
   3.388 -    if (newargv == NULL) {
   3.389 -        SDL_free (arg);
   3.390 +    newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
   3.391 +    if (newargv == NULL)
   3.392 +    {
   3.393 +        SDL_free(arg);
   3.394          return FALSE;
   3.395      }
   3.396      gArgv = newargv;
   3.397  
   3.398 -    SDL_strlcpy (arg, temparg, arglen);
   3.399 +    SDL_strlcpy(arg, temparg, arglen);
   3.400      gArgv[gArgc++] = arg;
   3.401      gArgv[gArgc] = NULL;
   3.402      return TRUE;
   3.403 @@ -305,15 +285,16 @@
   3.404  
   3.405  
   3.406  /* Called when the internal event loop has just started running */
   3.407 --(void) applicationDidFinishLaunching:(NSNotification *) note {
   3.408 +- (void) applicationDidFinishLaunching: (NSNotification *) note
   3.409 +{
   3.410      int status;
   3.411  
   3.412      /* Set the working directory to the .app's parent directory */
   3.413 -  [self setupWorkingDirectory:gFinderLaunch];
   3.414 +    [self setupWorkingDirectory:gFinderLaunch];
   3.415  
   3.416  #if SDL_USE_NIB_FILE
   3.417      /* Set the main menu to contain the real app name instead of "SDL App" */
   3.418 -  [self fixMenu: [NSApp mainMenu] withAppName:getApplicationName ()];
   3.419 +    [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
   3.420  #endif
   3.421  
   3.422      /* Hand off to main application code */
   3.423 @@ -321,59 +302,64 @@
   3.424      status = SDL_main (gArgc, gArgv);
   3.425  
   3.426      /* We're done, thank you for playing */
   3.427 -    exit (status);
   3.428 +    exit(status);
   3.429  }
   3.430 +@end
   3.431  
   3.432 -@end @ implementation NSString (ReplaceSubString) - (NSString *) stringByReplacingRange:(NSRange)
   3.433 -     aRange
   3.434 -     with:(NSString *)
   3.435 -    aString
   3.436 +
   3.437 +@implementation NSString (ReplaceSubString)
   3.438 +
   3.439 +- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
   3.440  {
   3.441      unsigned int bufferSize;
   3.442 -    unsigned int selfLen =[self length];
   3.443 -    unsigned int aStringLen =[aString length];
   3.444 +    unsigned int selfLen = [self length];
   3.445 +    unsigned int aStringLen = [aString length];
   3.446      unichar *buffer;
   3.447      NSRange localRange;
   3.448      NSString *result;
   3.449  
   3.450      bufferSize = selfLen + aStringLen - aRange.length;
   3.451 -    buffer = NSAllocateMemoryPages (bufferSize * sizeof (unichar));
   3.452 -
   3.453 +    buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar));
   3.454 +    
   3.455      /* Get first part into buffer */
   3.456      localRange.location = 0;
   3.457      localRange.length = aRange.location;
   3.458 -  [self getCharacters: buffer range:localRange];
   3.459 -
   3.460 +    [self getCharacters:buffer range:localRange];
   3.461 +    
   3.462      /* Get middle part into buffer */
   3.463      localRange.location = 0;
   3.464      localRange.length = aStringLen;
   3.465 -  [aString getCharacters: (buffer + aRange.location) range:localRange];
   3.466 -
   3.467 +    [aString getCharacters:(buffer+aRange.location) range:localRange];
   3.468 +     
   3.469      /* Get last part into buffer */
   3.470      localRange.location = aRange.location + aRange.length;
   3.471      localRange.length = selfLen - localRange.location;
   3.472 -  [self getCharacters: (buffer + aRange.location + aStringLen) range:localRange];
   3.473 -
   3.474 +    [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
   3.475 +    
   3.476      /* Build output string */
   3.477 -  result =[NSString stringWithCharacters: buffer length:bufferSize];
   3.478 -
   3.479 -    NSDeallocateMemoryPages (buffer, bufferSize);
   3.480 -
   3.481 +    result = [NSString stringWithCharacters:buffer length:bufferSize];
   3.482 +    
   3.483 +    NSDeallocateMemoryPages(buffer, bufferSize);
   3.484 +    
   3.485      return result;
   3.486  }
   3.487  
   3.488  @end
   3.489 +
   3.490 +
   3.491 +
   3.492  #ifdef main
   3.493  #  undef main
   3.494  #endif
   3.495 +
   3.496 +
   3.497  /* Main entry point to executable - should *not* be SDL_main! */
   3.498 -    int
   3.499 -main (int argc, char **argv)
   3.500 +int main (int argc, char **argv)
   3.501  {
   3.502      /* Copy the arguments into a global variable */
   3.503      /* This is passed if we are launched by double-clicking */
   3.504 -    if (argc >= 2 && strncmp (argv[1], "-psn", 4) == 0) {
   3.505 -        gArgv = (char **) SDL_malloc (sizeof (char *) * 2);
   3.506 +    if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
   3.507 +        gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
   3.508          gArgv[0] = argv[0];
   3.509          gArgv[1] = NULL;
   3.510          gArgc = 1;
   3.511 @@ -381,17 +367,18 @@
   3.512      } else {
   3.513          int i;
   3.514          gArgc = argc;
   3.515 -        gArgv = (char **) SDL_malloc (sizeof (char *) * (argc + 1));
   3.516 +        gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
   3.517          for (i = 0; i <= argc; i++)
   3.518              gArgv[i] = argv[i];
   3.519          gFinderLaunch = NO;
   3.520      }
   3.521  
   3.522  #if SDL_USE_NIB_FILE
   3.523 -  [SDLApplication poseAsClass:[NSApplication class]];
   3.524 +    [SDLApplication poseAsClass:[NSApplication class]];
   3.525      NSApplicationMain (argc, argv);
   3.526  #else
   3.527      CustomApplicationMain (argc, argv);
   3.528  #endif
   3.529      return 0;
   3.530  }
   3.531 +
     4.1 --- a/src/video/qtopia/SDL_QWin.cc	Sun May 28 13:29:03 2006 +0000
     4.2 +++ b/src/video/qtopia/SDL_QWin.cc	Sun May 28 18:16:36 2006 +0000
     4.3 @@ -265,12 +265,12 @@
     4.4  }
     4.5  
     4.6  // desktop, SL-A300 etc
     4.7 -bool
     4.8 -SDL_QWin::repaintRotation0 (const QRect & rect)
     4.9 +/* *INDENT-OFF* */
    4.10 +bool SDL_QWin::repaintRotation0 (const QRect & rect)
    4.11  {
    4.12      if (my_image->width () == width ()) {
    4.13 -        uchar *fb = (uchar *) my_painter->frameBuffer ();
    4.14 -        uchar *buf = (uchar *) my_image->bits ();
    4.15 +        uchar * fb = (uchar *) my_painter->frameBuffer ();
    4.16 +        uchar * buf = (uchar *) my_image->bits ();
    4.17          if (rect == my_image->rect ()) {
    4.18              SDL_memcpy (fb, buf, width () * height () * 2);
    4.19          } else {
    4.20 @@ -279,8 +279,7 @@
    4.21              int fblineadd = my_painter->lineStep ();
    4.22              int buflineadd = my_image->bytesPerLine ();
    4.23              fb += (rect.left () << 1) + rect.top () * my_painter->lineStep ();
    4.24 -            buf +=
    4.25 -                (rect.left () << 1) + rect.top () * my_image->bytesPerLine ();
    4.26 +            buf += (rect.left () << 1) + rect.top () * my_image->bytesPerLine ();
    4.27              while (h--) {
    4.28                  SDL_memcpy (fb, buf, wd);
    4.29                  fb += fblineadd;
    4.30 @@ -295,21 +294,22 @@
    4.31  #endif
    4.32      return true;
    4.33  }
    4.34 +/* *INDENT-ON* */
    4.35  
    4.36  
    4.37  // Sharp Zaurus SL-5500 etc 
    4.38 -bool
    4.39 -SDL_QWin::repaintRotation3 (const QRect & rect)
    4.40 +/* *INDENT-OFF* */
    4.41 +bool SDL_QWin::repaintRotation3 (const QRect & rect)
    4.42  {
    4.43      if (my_image->width () == width ()) {
    4.44 -        ushort *fb = (ushort *) my_painter->frameBuffer ();
    4.45 -        ushort *buf = (ushort *) my_image->bits ();
    4.46 +        ushort * fb = (ushort *) my_painter->frameBuffer ();
    4.47 +        ushort * buf = (ushort *) my_image->bits ();
    4.48          gs_fastRotateBlit_3 (fb, buf, rect);
    4.49      } else {
    4.50          // landscape mode
    4.51          if (screenRotation == SDL_QT_ROTATION_90) {
    4.52 -            uchar *fb = (uchar *) my_painter->frameBuffer ();
    4.53 -            uchar *buf = (uchar *) my_image->bits ();
    4.54 +            uchar * fb = (uchar *) my_painter->frameBuffer ();
    4.55 +            uchar * buf = (uchar *) my_image->bits ();
    4.56              if (rect == my_image->rect ()) {
    4.57                  SDL_memcpy (fb, buf, width () * height () * 2);
    4.58              } else {
    4.59 @@ -336,8 +336,8 @@
    4.60              int buflineadd = my_image->bytesPerLine () - (rect.width () << 1);
    4.61              int w;
    4.62  
    4.63 -            uchar *fb = (uchar *) my_painter->frameBuffer ();
    4.64 -            uchar *buf = (uchar *) my_image->bits ();
    4.65 +            uchar * fb = (uchar *) my_painter->frameBuffer ();
    4.66 +            uchar * buf = (uchar *) my_image->bits ();
    4.67  
    4.68              fb +=
    4.69                  ((my_painter->width () -
    4.70 @@ -363,10 +363,11 @@
    4.71      }
    4.72      return true;
    4.73  }
    4.74 +/* *INDENT-ON* */
    4.75  
    4.76  // ipaq 3800...
    4.77 -bool
    4.78 -SDL_QWin::repaintRotation1 (const QRect & rect)
    4.79 +/* *INDENT-OFF* */
    4.80 +bool SDL_QWin::repaintRotation1 (const QRect & rect)
    4.81  {
    4.82      if (my_image->width () == width ()) {
    4.83          ushort *fb = (ushort *) my_painter->frameBuffer ();
    4.84 @@ -377,6 +378,7 @@
    4.85      }
    4.86      return true;
    4.87  }
    4.88 +/* *INDENT-ON* */
    4.89  
    4.90  void
    4.91  SDL_QWin::repaintRect (const QRect & rect)