Commit cc879a05 authored by Ronald Oussoren's avatar Ronald Oussoren

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.
parent 51ee6564
...@@ -45,18 +45,13 @@ ...@@ -45,18 +45,13 @@
+ (id)getFactorySettingsForFileType: (NSString *)filetype; + (id)getFactorySettingsForFileType: (NSString *)filetype;
+ (id)newSettingsForFileType: (NSString *)filetype; + (id)newSettingsForFileType: (NSString *)filetype;
//- (id)init;
- (id)initForFileType: (NSString *)filetype; - (id)initForFileType: (NSString *)filetype;
- (id)initForFSDefaultFileType: (NSString *)filetype; - (id)initForFSDefaultFileType: (NSString *)filetype;
- (id)initForDefaultFileType: (NSString *)filetype; - (id)initForDefaultFileType: (NSString *)filetype;
//- (id)initWithFileSettings: (FileSettings *)source;
- (void)updateFromSource: (id <FileSettingsSource>)source; - (void)updateFromSource: (id <FileSettingsSource>)source;
- (NSString *)commandLineForScript: (NSString *)script; - (NSString *)commandLineForScript: (NSString *)script;
//- (void)applyFactorySettingsForFileType: (NSString *)filetype;
//- (void)saveDefaults;
//- (void)applyUserDefaults: (NSString *)filetype;
- (void)applyValuesFromDict: (NSDictionary *)dict; - (void)applyValuesFromDict: (NSDictionary *)dict;
- (void)reset; - (void)reset;
- (NSArray *) interpreters; - (NSArray *) interpreters;
......
...@@ -95,12 +95,6 @@ ...@@ -95,12 +95,6 @@
return self; return self;
} }
//- (id)init
//{
// self = [self initForFileType: @"Python Script"];
// return self;
//}
- (id)initForFSDefaultFileType: (NSString *)filetype - (id)initForFSDefaultFileType: (NSString *)filetype
{ {
int i; int i;
......
...@@ -37,20 +37,17 @@ ...@@ -37,20 +37,17 @@
{ {
NSApplication *app = [NSApplication sharedApplication]; NSApplication *app = [NSApplication sharedApplication];
[super close]; [super close];
if ([[app delegate] shouldTerminate]) if ([(MyAppDelegate*)[app delegate] shouldTerminate])
[app terminate: self]; [app terminate: self];
} }
- (void)load_defaults - (void)load_defaults
{ {
// if (settings) [settings release];
settings = [FileSettings newSettingsForFileType: filetype]; settings = [FileSettings newSettingsForFileType: filetype];
} }
- (void)update_display - (void)update_display
{ {
// [[self window] setTitle: script];
[interpreter setStringValue: [settings interpreter]]; [interpreter setStringValue: [settings interpreter]];
[honourhashbang setState: [settings honourhashbang]]; [honourhashbang setState: [settings honourhashbang]];
[debug setState: [settings debug]]; [debug setState: [settings debug]];
...@@ -109,12 +106,11 @@ ...@@ -109,12 +106,11 @@
BOOL show_ui; BOOL show_ui;
// ask the app delegate whether we should show the UI or not. // 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 release];
script = [fileName retain]; script = [fileName retain];
[filetype release]; [filetype release];
filetype = [type retain]; filetype = [type retain];
// if (settings) [settings release];
settings = [FileSettings newSettingsForFileType: filetype]; settings = [FileSettings newSettingsForFileType: filetype];
if (show_ui) { if (show_ui) {
[self update_display]; [self update_display];
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
- (void)update_display - (void)update_display
{ {
// [[self window] setTitle: script];
[interpreter reloadData]; [interpreter reloadData];
[interpreter setStringValue: [settings interpreter]]; [interpreter setStringValue: [settings interpreter]];
[honourhashbang setState: [settings honourhashbang]]; [honourhashbang setState: [settings honourhashbang]];
...@@ -41,7 +39,6 @@ ...@@ -41,7 +39,6 @@
[others setStringValue: [settings others]]; [others setStringValue: [settings others]];
[with_terminal setState: [settings with_terminal]]; [with_terminal setState: [settings with_terminal]];
// Not scriptargs, it isn't for preferences // Not scriptargs, it isn't for preferences
[commandline setStringValue: [settings commandLineForScript: @"<your script here>"]]; [commandline setStringValue: [settings commandLineForScript: @"<your script here>"]];
} }
......
...@@ -31,7 +31,7 @@ doscript(const char *command) ...@@ -31,7 +31,7 @@ doscript(const char *command)
"'----':utf8(@)", strlen(command), "'----':utf8(@)", strlen(command),
command); command);
if (err) { if (err) {
NSLog(@"AEBuildAppleEvent failed: %d\n", err); NSLog(@"AEBuildAppleEvent failed: %ld\n", (long)err);
return err; return err;
} }
...@@ -39,7 +39,7 @@ doscript(const char *command) ...@@ -39,7 +39,7 @@ doscript(const char *command)
err = AESendMessage(&evt, &res, kAEWaitReply, kAEDefaultTimeout); err = AESendMessage(&evt, &res, kAEWaitReply, kAEDefaultTimeout);
AEDisposeDesc(&evt); AEDisposeDesc(&evt);
if (err) { if (err) {
NSLog(@"AESendMessage failed: %d\n", err); NSLog(@"AESendMessage failed: %ld\n", (long)err);
return err; return err;
} }
// Check for any application errors // Check for any application errors
...@@ -47,12 +47,12 @@ doscript(const char *command) ...@@ -47,12 +47,12 @@ doscript(const char *command)
AEDisposeDesc(&res); AEDisposeDesc(&res);
if (!err) { if (!err) {
AEGetDescData(&desc, &err, sizeof(err)); AEGetDescData(&desc, &err, sizeof(err));
NSLog(@"Terminal returned an error: %d", err); NSLog(@"Terminal returned an error: %ld", (long)err);
AEDisposeDesc(&desc); AEDisposeDesc(&desc);
} else if (err == errAEDescNotFound) { } else if (err == errAEDescNotFound) {
err = noErr; err = noErr;
} else { } else {
NSLog(@"AEGetPArmDesc returned an error: %d", err); NSLog(@"AEGetPArmDesc returned an error: %ld", (long)err);
} }
return err; return err;
......
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