aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPStringAdditions.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPStringAdditions.m')
-rw-r--r--Source/SPStringAdditions.m23
1 files changed, 11 insertions, 12 deletions
diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m
index 21059ba2..421ef4c1 100644
--- a/Source/SPStringAdditions.m
+++ b/Source/SPStringAdditions.m
@@ -164,7 +164,7 @@
{
NSMutableString *holder = [[NSMutableString alloc] init];
unichar theChar;
- int i;
+ NSUInteger i;
for(i = 0; i < [self length]; i++) {
theChar = [self characterAtIndex:i];
@@ -492,7 +492,7 @@
if([scriptPath hasPrefix:@"/"] && [fm fileExistsAtPath:scriptPath isDirectory:&isDir] && !isDir) {
NSString *script = [self substringWithRange:NSMakeRange(NSMaxRange(firstLineRange), [self length] - NSMaxRange(firstLineRange))];
NSError *writeError = nil;
- [script writeToFile:scriptFilePath atomically:YES encoding:NSUTF8StringEncoding error:writeError];
+ [script writeToFile:scriptFilePath atomically:YES encoding:NSUTF8StringEncoding error:&writeError];
if(writeError == nil) {
redirectForScript = YES;
[scriptHeaderArguments addObject:scriptFilePath];
@@ -504,7 +504,7 @@
} else {
[scriptHeaderArguments addObject:@"/bin/sh"];
NSError *writeError = nil;
- [self writeToFile:scriptFilePath atomically:YES encoding:NSUTF8StringEncoding error:writeError];
+ [self writeToFile:scriptFilePath atomically:YES encoding:NSUTF8StringEncoding error:&writeError];
if(writeError == nil) {
redirectForScript = YES;
[scriptHeaderArguments addObject:scriptFilePath];
@@ -673,12 +673,12 @@
// Read STDOUT saved to file
if([fm fileExistsAtPath:stdoutFilePath isDirectory:nil]) {
- NSString *stdout = [NSString stringWithContentsOfFile:stdoutFilePath encoding:NSUTF8StringEncoding error:nil];
- if(bashTask) [bashTask release];
+ NSString *stdoutContent = [NSString stringWithContentsOfFile:stdoutFilePath encoding:NSUTF8StringEncoding error:nil];
+ if(bashTask) [bashTask release], bashTask = nil;
[fm removeItemAtPath:stdoutFilePath error:nil];
- if(stdout != nil) {
+ if(stdoutContent != nil) {
if (status == 0) {
- return stdout;
+ return stdoutContent;
} else {
if(theError != NULL) {
if(status == 9 || userTerminated) return @"";
@@ -694,7 +694,7 @@
NSBeep();
}
if(status > SPBundleRedirectActionNone && status <= SPBundleRedirectActionLastCode)
- return stdout;
+ return stdoutContent;
else
return @"";
}
@@ -702,12 +702,11 @@
NSLog(@"Couldn't read return string from “%@” by using UTF-8 encoding.", self);
NSBeep();
}
- } else {
- if(bashTask) [bashTask release];
- [fm removeItemAtPath:stdoutFilePath error:nil];
- return @"";
}
+ if (bashTask) [bashTask release];
+ [fm removeItemAtPath:stdoutFilePath error:nil];
+ return @"";
}
/**