Revision: 3271
http://skim-app.svn.sourceforge.net/skim-app/?rev=3271&view=rev
Author: amaxwell
Date: 2007-11-26 10:45:42 -0800 (Mon, 26 Nov 2007)
Log Message:
-----------
fix compile issues, replace alloca with malloc
works fine on 10.5.1
Modified Paths:
--------------
trunk/QuickLook-Skim/GeneratePreviewForURL.m
trunk/QuickLook-Skim/QuickLook-Skim.xcodeproj/project.pbxproj
trunk/QuickLook-Skim/SKQLConverter.m
Modified: trunk/QuickLook-Skim/GeneratePreviewForURL.m
===================================================================
--- trunk/QuickLook-Skim/GeneratePreviewForURL.m 2007-11-26 18:28:27 UTC
(rev 3270)
+++ trunk/QuickLook-Skim/GeneratePreviewForURL.m 2007-11-26 18:45:42 UTC
(rev 3271)
@@ -86,7 +86,7 @@
NSData *data = [[NSData alloc] initWithContentsOfURL:(NSURL *)url
options:NSUncachedRead error:NULL];
if (data) {
- NSString *htmlString = [SKQLConverter
htmlStringWithNotes:[NSKeyedUnarchiver unarchiveObjectWithData:data]
fontSize:_fontSize];
+ NSString *htmlString = [SKQLConverter
htmlStringWithNotes:[NSKeyedUnarchiver unarchiveObjectWithData:data]];
[data release];
if (data = [htmlString dataUsingEncoding:NSUTF8StringEncoding]) {
NSDictionary *props = [NSDictionary
dictionaryWithObjectsAndKeys:
Modified: trunk/QuickLook-Skim/QuickLook-Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/QuickLook-Skim/QuickLook-Skim.xcodeproj/project.pbxproj
2007-11-26 18:28:27 UTC (rev 3270)
+++ trunk/QuickLook-Skim/QuickLook-Skim.xcodeproj/project.pbxproj
2007-11-26 18:45:42 UTC (rev 3271)
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 42;
+ objectVersion = 44;
objects = {
/* Begin PBXBuildFile section */
Modified: trunk/QuickLook-Skim/SKQLConverter.m
===================================================================
--- trunk/QuickLook-Skim/SKQLConverter.m 2007-11-26 18:28:27 UTC (rev
3270)
+++ trunk/QuickLook-Skim/SKQLConverter.m 2007-11-26 18:45:42 UTC (rev
3271)
@@ -83,8 +83,8 @@
return [NSString stringWithFormat:@"%C%C%C%C%C%C", hexChars[red / 16],
hexChars[red % 16], hexChars[green / 16], hexChars[green % 16], hexChars[blue /
16], hexChars[blue % 16]];
}
-// Stolen from OmniFoundation
-static NSString *HTMLEscapeString(NSString *string)
+// Stolen from OmniFoundation; modified to use malloc instead of alloca()
+static NSString *HTMLEscapeString(NSString *htmlString)
{
unichar *ptr, *begin, *end;
NSMutableString *result;
@@ -97,10 +97,16 @@
[string release]; \
begin = ptr + 1;
- length = [self length];
- ptr = alloca(length * sizeof(unichar));
+ length = [htmlString length];
+ ptr = NSZoneMalloc(NULL, length * sizeof(unichar));
+ if (!ptr)
+ return nil;
+
+ // keep a pointer that we can free later
+ unichar *originalPtr = ptr;
+
end = ptr + length;
- [self getCharacters:ptr];
+ [htmlString getCharacters:ptr];
result = [NSMutableString stringWithCapacity:length];
begin = ptr;
@@ -131,6 +137,7 @@
ptr++;
}
APPEND_PREVIOUS();
+ NSZoneFree(NULL, originalPtr);
return result;
}
@@ -146,9 +153,12 @@
NSDictionary *noteAttrs = [NSDictionary
dictionaryWithObjectsAndKeys:noteFont, NSFontAttributeName, [NSParagraphStyle
defaultParagraphStyle], NSParagraphStyleAttributeName, nil];
NSDictionary *noteTextAttrs = [NSDictionary
dictionaryWithObjectsAndKeys:noteTextFont, NSFontAttributeName,
[NSParagraphStyle defaultParagraphStyle], NSParagraphStyleAttributeName, nil];
NSMutableParagraphStyle *noteParStyle = [[[NSParagraphStyle
defaultParagraphStyle] mutableCopy] autorelease];
+#warning _noteIndent removed?
+ /*
+
[noteParStyle setFirstLineHeadIndent:_noteIndent];
[noteParStyle setHeadIndent:_noteIndent];
-
+ */
if (notes) {
NSSortDescriptor *sortDescriptor = [[[NSSortDescriptor alloc]
initWithKey:@"pageIndex" ascending:YES] autorelease];
NSEnumerator *noteEnum = [[notes sortedArrayUsingDescriptors:[NSArray
arrayWithObject:sortDescriptor]] objectEnumerator];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit