(3.3->default) Issue #18377: Code cleanup in Python Launcher

This changeset fixes a number of compiler warnings in the Python Launcher
binary for OSX. It also cleans up whitespace usage in those sources.
This commit is contained in:
Ronald Oussoren 2013-07-07 09:54:08 +02:00
commit 071029fac6
8 changed files with 77 additions and 95 deletions

View File

@ -45,18 +45,13 @@
+ (id)getFactorySettingsForFileType: (NSString *)filetype;
+ (id)newSettingsForFileType: (NSString *)filetype;
//- (id)init;
- (id)initForFileType: (NSString *)filetype;
- (id)initForFSDefaultFileType: (NSString *)filetype;
- (id)initForDefaultFileType: (NSString *)filetype;
//- (id)initWithFileSettings: (FileSettings *)source;
- (void)updateFromSource: (id <FileSettingsSource>)source;
- (NSString *)commandLineForScript: (NSString *)script;
//- (void)applyFactorySettingsForFileType: (NSString *)filetype;
//- (void)saveDefaults;
//- (void)applyUserDefaults: (NSString *)filetype;
- (void)applyValuesFromDict: (NSDictionary *)dict;
- (void)reset;
- (NSArray *) interpreters;

View File

@ -95,12 +95,6 @@
return self;
}
//- (id)init
//{
// self = [self initForFileType: @"Python Script"];
// return self;
//}
- (id)initForFSDefaultFileType: (NSString *)filetype
{
int i;

View File

@ -37,20 +37,17 @@
{
NSApplication *app = [NSApplication sharedApplication];
[super close];
if ([[app delegate] shouldTerminate])
if ([(MyAppDelegate*)[app delegate] shouldTerminate])
[app terminate: self];
}
- (void)load_defaults
{
// if (settings) [settings release];
settings = [FileSettings newSettingsForFileType: filetype];
}
- (void)update_display
{
// [[self window] setTitle: script];
[interpreter setStringValue: [settings interpreter]];
[honourhashbang setState: [settings honourhashbang]];
[debug setState: [settings debug]];
@ -109,12 +106,11 @@
BOOL show_ui;
// ask the app delegate whether we should show the UI or not.
show_ui = [[[NSApplication sharedApplication] delegate] shouldShowUI];
show_ui = [(MyAppDelegate*)[[NSApplication sharedApplication] delegate] shouldShowUI];
[script release];
script = [fileName retain];
[filetype release];
filetype = [type retain];
// if (settings) [settings release];
settings = [FileSettings newSettingsForFileType: filetype];
if (show_ui) {
[self update_display];

View File

@ -27,8 +27,6 @@
- (void)update_display
{
// [[self window] setTitle: script];
[interpreter reloadData];
[interpreter setStringValue: [settings interpreter]];
[honourhashbang setState: [settings honourhashbang]];
@ -41,7 +39,6 @@
[others setStringValue: [settings others]];
[with_terminal setState: [settings with_terminal]];
// Not scriptargs, it isn't for preferences
[commandline setStringValue: [settings commandLineForScript: @"<your script here>"]];
}

View File

@ -31,7 +31,7 @@ doscript(const char *command)
"'----':utf8(@)", strlen(command),
command);
if (err) {
NSLog(@"AEBuildAppleEvent failed: %d\n", err);
NSLog(@"AEBuildAppleEvent failed: %ld\n", (long)err);
return err;
}
@ -39,7 +39,7 @@ doscript(const char *command)
err = AESendMessage(&evt, &res, kAEWaitReply, kAEDefaultTimeout);
AEDisposeDesc(&evt);
if (err) {
NSLog(@"AESendMessage failed: %d\n", err);
NSLog(@"AESendMessage failed: %ld\n", (long)err);
return err;
}
// Check for any application errors
@ -47,12 +47,12 @@ doscript(const char *command)
AEDisposeDesc(&res);
if (!err) {
AEGetDescData(&desc, &err, sizeof(err));
NSLog(@"Terminal returned an error: %d", err);
NSLog(@"Terminal returned an error: %ld", (long)err);
AEDisposeDesc(&desc);
} else if (err == errAEDescNotFound) {
err = noErr;
} else {
NSLog(@"AEGetPArmDesc returned an error: %d", err);
NSLog(@"AEGetPArmDesc returned an error: %ld", (long)err);
}
return err;