aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Resources/English.lproj/SPQLPluginConnectionBundleTemplate.html2
-rw-r--r--Resources/English.lproj/SPQLPluginSQLTemplate.html2
-rw-r--r--Source/GeneratePreviewForURL.m23
3 files changed, 17 insertions, 10 deletions
diff --git a/Resources/English.lproj/SPQLPluginConnectionBundleTemplate.html b/Resources/English.lproj/SPQLPluginConnectionBundleTemplate.html
index 02e5601d..c97fb4bc 100644
--- a/Resources/English.lproj/SPQLPluginConnectionBundleTemplate.html
+++ b/Resources/English.lproj/SPQLPluginConnectionBundleTemplate.html
@@ -14,7 +14,7 @@ body {
<table>
<tr>
<td valign="right">
-<img width="128" heigth="128" src="data:image/auto;base64,%@">
+<img width="128" height="128" src="data:image/auto;base64,%@">
</td>
<td>
<center>
diff --git a/Resources/English.lproj/SPQLPluginSQLTemplate.html b/Resources/English.lproj/SPQLPluginSQLTemplate.html
index d9f55c09..65ba2a3c 100644
--- a/Resources/English.lproj/SPQLPluginSQLTemplate.html
+++ b/Resources/English.lproj/SPQLPluginSQLTemplate.html
@@ -14,7 +14,7 @@ body {
<table>
<tr>
<td valign="right">
-<img width="128" heigth="128" src="data:image/auto;base64,%@">
+<img width="128" height="128" src="data:image/auto;base64,%@">
</td>
<td>
<center>
diff --git a/Source/GeneratePreviewForURL.m b/Source/GeneratePreviewForURL.m
index 841fca8d..0fd6514d 100644
--- a/Source/GeneratePreviewForURL.m
+++ b/Source/GeneratePreviewForURL.m
@@ -394,17 +394,17 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
// compose the html and perform syntax highlighting
// read the file and try to get a proper encoding
- NSString *sqlText = [NSString stringWithContentsOfFile:[myURL path] encoding:sqlEncoding error:&readError];
- NSMutableString *sqlHTML = [NSMutableString string];
- NSString *truncatedString = @"";
+ NSString *sqlText = [[NSString alloc] initWithContentsOfFile:[myURL path] encoding:sqlEncoding error:&readError];
+ NSMutableString *sqlHTML = [[NSMutableString alloc] init];
+ NSString *truncatedString = [[NSString alloc] init];
if(readError != nil) {
// cocoa tries to detect the encoding
- sqlText = [NSString stringWithContentsOfFile:[myURL path] usedEncoding:&sqlEncoding error:&readError];
+ sqlText = [[NSString alloc] initWithContentsOfFile:[myURL path] usedEncoding:&sqlEncoding error:&readError];
// fall back to latin1 if no sqlText couldn't read
if(sqlText == nil) {
sqlEncoding = NSISOLatin1StringEncoding;
- sqlText = [NSString stringWithContentsOfFile:[myURL path] encoding:sqlEncoding error:&readError];
+ sqlText = [[NSString alloc] initWithContentsOfFile:[myURL path] encoding:sqlEncoding error:&readError];
}
}
@@ -415,8 +415,12 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
// truncate large files since Finder blocks
if([filesize unsignedLongValue] > kMaxSQLFileSize) {
- sqlText = [sqlText substringToIndex:kMaxSQLFileSize-1];
- truncatedString = @"\n ✂ ...";
+ NSString *truncatedSqlText = [[NSString alloc] initWithString:[sqlText substringToIndex:kMaxSQLFileSize-1]];
+ [sqlText release];
+ sqlText = [[NSString alloc] initWithString:truncatedSqlText];
+ [truncatedSqlText release];
+ [truncatedString release];
+ truncatedString = [[NSString alloc] initWithString:@"\n ✂ ..."];
}
NSRange textRange = NSMakeRange(0, [sqlText length]);
@@ -467,6 +471,8 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
}
[sqlHTML appendString:truncatedString];
+ [sqlText release];
+ [truncatedString release];
}
html = [[NSMutableString alloc] initWithString:[NSString stringWithFormat:template,
@@ -475,7 +481,8 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
sqlHTML
]];
- previewHeight = 495;
+ previewHeight = 495;
+ [sqlHTML release];
} else {