@@ -50,8 +50,8 @@ - (void)setAppleMenu:(NSMenu *)menu;
50
50
51
51
static int gArgc ;
52
52
static char **gArgv ;
53
- static BOOL gFinderLaunch ;
54
- static BOOL gCalledAppMainline = FALSE ;
53
+ static bool gFinderLaunch ;
54
+ static bool gCalledAppMainline = false ;
55
55
56
56
static NSString *getApplicationName (void )
57
57
{
@@ -62,7 +62,7 @@ - (void)setAppleMenu:(NSMenu *)menu;
62
62
dict = (NSDictionary *)CFBundleGetInfoDictionary (CFBundleGetMainBundle ());
63
63
if (dict)
64
64
appName = [dict objectForKey: @" CFBundleName" ];
65
-
65
+
66
66
if (![appName length ])
67
67
appName = [[NSProcessInfo processInfo ] processName ];
68
68
@@ -94,7 +94,7 @@ - (void)terminate:(id)sender
94
94
@implementation SDLMain
95
95
96
96
/* Set the working directory to the .app's parent directory */
97
- - (void ) setupWorkingDirectory : (BOOL )shouldChdir
97
+ - (void ) setupWorkingDirectory : (bool )shouldChdir
98
98
{
99
99
if (shouldChdir)
100
100
{
@@ -144,10 +144,10 @@ static void setApplicationMenu(void)
144
144
NSMenuItem *menuItem;
145
145
NSString *title;
146
146
NSString *appName;
147
-
147
+
148
148
appName = getApplicationName ();
149
149
appleMenu = [[NSMenu alloc ] initWithTitle: @" " ];
150
-
150
+
151
151
/* Add menu items */
152
152
title = [@" About " stringByAppendingString: appName];
153
153
[appleMenu addItemWithTitle: title action: @selector (orderFrontStandardAboutPanel: ) keyEquivalent: @" " ];
@@ -167,7 +167,7 @@ static void setApplicationMenu(void)
167
167
title = [@" Quit " stringByAppendingString: appName];
168
168
[appleMenu addItemWithTitle: title action: @selector (terminate: ) keyEquivalent: @" q" ];
169
169
170
-
170
+
171
171
/* Put menu into the menubar */
172
172
menuItem = [[NSMenuItem alloc ] initWithTitle: @" " action: nil keyEquivalent: @" " ];
173
173
[menuItem setSubmenu: appleMenu];
@@ -189,17 +189,17 @@ static void setupWindowMenu(void)
189
189
NSMenuItem *menuItem;
190
190
191
191
windowMenu = [[NSMenu alloc ] initWithTitle: @" Window" ];
192
-
192
+
193
193
/* "Minimize" item */
194
194
menuItem = [[NSMenuItem alloc ] initWithTitle: @" Minimize" action: @selector (performMiniaturize: ) keyEquivalent: @" m" ];
195
195
[windowMenu addItem: menuItem];
196
196
[menuItem release ];
197
-
197
+
198
198
/* Put menu into the menubar */
199
199
windowMenuItem = [[NSMenuItem alloc ] initWithTitle: @" Window" action: nil keyEquivalent: @" " ];
200
200
[windowMenuItem setSubmenu: windowMenu];
201
201
[[NSApp mainMenu ] addItem: windowMenuItem];
202
-
202
+
203
203
/* Tell the application object that this is now the window menu */
204
204
[NSApp setWindowsMenu: windowMenu];
205
205
@@ -216,7 +216,7 @@ static void CustomApplicationMain (int argc, char **argv)
216
216
217
217
/* Ensure the application object is initialised */
218
218
[SDLApplication sharedApplication ];
219
-
219
+
220
220
#ifdef SDL_USE_CPS
221
221
{
222
222
CPSProcessSerNum PSN;
@@ -236,10 +236,10 @@ static void CustomApplicationMain (int argc, char **argv)
236
236
/* Create SDLMain and make it the app delegate */
237
237
sdlMain = [[SDLMain alloc ] init ];
238
238
[NSApp setDelegate: sdlMain];
239
-
239
+
240
240
/* Start the main event loop */
241
241
[NSApp run ];
242
-
242
+
243
243
[sdlMain release ];
244
244
[pool release ];
245
245
}
@@ -262,37 +262,37 @@ static void CustomApplicationMain (int argc, char **argv)
262
262
*
263
263
* This message is ignored once the app's mainline has been called.
264
264
*/
265
- - (BOOL )application : (NSApplication *)theApplication openFile : (NSString *)filename
265
+ - (bool )application : (NSApplication *)theApplication openFile : (NSString *)filename
266
266
{
267
267
const char *temparg;
268
268
size_t arglen;
269
269
char *arg;
270
270
char **newargv;
271
271
272
272
if (!gFinderLaunch ) /* MacOS is passing command line args. */
273
- return FALSE ;
273
+ return false ;
274
274
275
275
if (gCalledAppMainline ) /* app has started, ignore this document. */
276
- return FALSE ;
276
+ return false ;
277
277
278
278
temparg = [filename UTF8String ];
279
279
arglen = SDL_strlen (temparg) + 1 ;
280
280
arg = (char *) SDL_malloc (arglen);
281
281
if (arg == NULL )
282
- return FALSE ;
282
+ return false ;
283
283
284
284
newargv = (char **) realloc (gArgv , sizeof (char *) * (gArgc + 2 ));
285
285
if (newargv == NULL )
286
286
{
287
287
SDL_free (arg);
288
- return FALSE ;
288
+ return false ;
289
289
}
290
290
gArgv = newargv;
291
291
292
292
SDL_strlcpy (arg, temparg, arglen);
293
293
gArgv [gArgc ++] = arg;
294
294
gArgv [gArgc ] = NULL ;
295
- return TRUE ;
295
+ return true ;
296
296
}
297
297
298
298
@@ -310,7 +310,7 @@ - (void) applicationDidFinishLaunching: (NSNotification *) note
310
310
#endif
311
311
312
312
/* Hand off to main application code */
313
- gCalledAppMainline = TRUE ;
313
+ gCalledAppMainline = true ;
314
314
status = SDL_main (gArgc , gArgv );
315
315
316
316
/* We're done, thank you for playing */
@@ -332,27 +332,27 @@ - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
332
332
333
333
bufferSize = selfLen + aStringLen - aRange.length ;
334
334
buffer = NSAllocateMemoryPages (bufferSize*sizeof (unichar ));
335
-
335
+
336
336
/* Get first part into buffer */
337
337
localRange.location = 0 ;
338
338
localRange.length = aRange.location ;
339
339
[self getCharacters: buffer range: localRange];
340
-
340
+
341
341
/* Get middle part into buffer */
342
342
localRange.location = 0 ;
343
343
localRange.length = aStringLen;
344
344
[aString getCharacters: (buffer+aRange.location) range: localRange];
345
-
345
+
346
346
/* Get last part into buffer */
347
347
localRange.location = aRange.location + aRange.length ;
348
348
localRange.length = selfLen - localRange.location ;
349
349
[self getCharacters: (buffer+aRange.location+aStringLen) range: localRange];
350
-
350
+
351
351
/* Build output string */
352
352
result = [NSString stringWithCharacters: buffer length: bufferSize];
353
-
353
+
354
354
NSDeallocateMemoryPages (buffer, bufferSize);
355
-
355
+
356
356
return result;
357
357
}
358
358
0 commit comments