Revision: 5639
http://skim-app.svn.sourceforge.net/skim-app/?rev=5639&view=rev
Author: hofman
Date: 2009-09-03 19:34:24 +0000 (Thu, 03 Sep 2009)
Log Message:
-----------
64-bit safety for Spotlight importer and QL generator
Modified Paths:
--------------
trunk/QuickLook-Skim/SKQLConverter.m
trunk/SkimImporter/GetMetadataForFile.m
Modified: trunk/QuickLook-Skim/SKQLConverter.m
===================================================================
--- trunk/QuickLook-Skim/SKQLConverter.m 2009-09-03 19:24:42 UTC (rev
5638)
+++ trunk/QuickLook-Skim/SKQLConverter.m 2009-09-03 19:34:24 UTC (rev
5639)
@@ -32,6 +32,7 @@
*/
#import "SKQLConverter.h"
+#include <tgmath.h>
static NSString *_noteFontName = @"LucidaHandwriting-Italic";
static const CGFloat _noteIndent = 20.0;
@@ -49,7 +50,7 @@
if ([files containsObject:fileName]) {
pdfFile = fileName;
} else {
- unsigned int idx = [[files
valueForKeyPath:@"pathExtension.lowercaseString"] indexOfObject:@"pdf"];
+ NSUInteger idx = [[files
valueForKeyPath:@"pathExtension.lowercaseString"] indexOfObject:@"pdf"];
if (idx != NSNotFound)
pdfFile = [files objectAtIndex:idx];
}
@@ -74,9 +75,9 @@
static char hexChars[16] = "0123456789abcdef";
if ([color alphaComponent] < 1.0)
color = [[NSColor controlBackgroundColor]
blendedColorWithFraction:[color alphaComponent] ofColor:[color
colorWithAlphaComponent:1.0]];
- int red = (int)roundf(255 * [color redComponent]);
- int green = (int)roundf(255 * [color greenComponent]);
- int blue = (int)roundf(255 * [color blueComponent]);
+ NSInteger red = (NSInteger)round(255 * [color redComponent]);
+ NSInteger green = (NSInteger)round(255 * [color greenComponent]);
+ NSInteger blue = (NSInteger)round(255 * [color blueComponent]);
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]];
}
@@ -86,7 +87,7 @@
unichar *ptr, *begin, *end;
NSMutableString *result;
NSString *string;
- int length;
+ NSInteger length;
#define APPEND_PREVIOUS() \
string = [[NSString alloc] initWithCharacters:begin length:(ptr - begin)];
\
@@ -110,7 +111,7 @@
while (ptr < end) {
if (*ptr > 127) {
APPEND_PREVIOUS();
- [result appendFormat:@"&#%d;", (int)*ptr];
+ [result appendFormat:@"&#%ld;", (long)*ptr];
} else if (*ptr == '&') {
APPEND_PREVIOUS();
[result appendString:@"&"];
@@ -164,13 +165,13 @@
NSString *contents = [note objectForKey:@"contents"];
NSString *text = [[note objectForKey:@"text"] string];
NSColor *color = [note objectForKey:@"color"];
- unsigned int pageIndex = [[note objectForKey:@"pageIndex"]
unsignedIntValue];
+ NSUInteger pageIndex = [[note objectForKey:@"pageIndex"]
unsignedIntegerValue];
NSURL *imgURL = [(NSURL *)CFBundleCopyResourceURL(bundle,
(CFStringRef)type, CFSTR("png"), NULL) autorelease];
- int start;
+ NSInteger start;
[attrString appendAttributedString:imageAttachmentForPath([imgURL
path])];
[attrString addAttribute:NSBackgroundColorAttributeName
value:color range:NSMakeRange([attrString length] - 1, 1)];
- [attrString appendAttributedString:[[[NSAttributedString alloc]
initWithString:[NSString stringWithFormat:@"%@ (page %i)\n", type, pageIndex+1]
attributes:attrs] autorelease]];
+ [attrString appendAttributedString:[[[NSAttributedString alloc]
initWithString:[NSString stringWithFormat:@"%@ (page %ld)\n", type,
(long)(pageIndex+1)] attributes:attrs] autorelease]];
start = [attrString length];
[attrString appendAttributedString:[[[NSAttributedString alloc]
initWithString:contents attributes:noteAttrs] autorelease]];
if (text) {
@@ -204,8 +205,8 @@
NSString *contents = [note objectForKey:@"contents"];
NSString *text = [[note objectForKey:@"text"] string];
NSColor *color = [note objectForKey:@"color"];
- unsigned int pageIndex = [[note objectForKey:@"pageIndex"]
unsignedIntValue];
- [htmlString appendFormat:@"<dt><img src=\"cid:%@.png\"
style=\"background-color:#...@\" />%@ (page %i)</dt>", type,
hexStringWithColor(color), type, pageIndex+1];
+ NSUInteger pageIndex = [[note objectForKey:@"pageIndex"]
unsignedIntegerValue];
+ [htmlString appendFormat:@"<dt><img src=\"cid:%@.png\"
style=\"background-color:#...@\" />%@ (page %ld)</dt>", type,
hexStringWithColor(color), type, (long)(pageIndex+1)];
[htmlString appendFormat:@"<dd>%@", HTMLEscapeString(contents)];
if (text)
[htmlString appendFormat:@"<div class=\"note-text\">%@</div>",
HTMLEscapeString(text)];
Modified: trunk/SkimImporter/GetMetadataForFile.m
===================================================================
--- trunk/SkimImporter/GetMetadataForFile.m 2009-09-03 19:24:42 UTC (rev
5638)
+++ trunk/SkimImporter/GetMetadataForFile.m 2009-09-03 19:34:24 UTC (rev
5639)
@@ -49,14 +49,14 @@
if (text != NULL)
*text = [pdfDoc string];
if (info != NULL) {
- unsigned int pageCount = [pdfDoc pageCount];
+ NSUInteger pageCount = [pdfDoc pageCount];
NSSize size = pageCount ? [[pdfDoc pageAtIndex:0]
boundsForBox:kPDFDisplayBoxCropBox].size : NSZeroSize;
NSMutableDictionary *mutableInfo = [[[pdfDoc documentAttributes]
mutableCopy] autorelease];
[mutableInfo setValue:[NSString stringWithFormat: @"%d.%d",
[pdfDoc majorVersion], [pdfDoc minorVersion]] forKey:@"Version"];
[mutableInfo setValue:[NSNumber numberWithBool:[pdfDoc
isEncrypted]] forKey:@"Encrypted"];
- [mutableInfo setValue:[NSNumber numberWithUnsignedInt:pageCount]
forKey:@"PageCount"];
- [mutableInfo setValue:[NSNumber numberWithFloat:size.width]
forKey:@"PageWidth"];
- [mutableInfo setValue:[NSNumber numberWithFloat:size.height]
forKey:@"PageHeight"];
+ [mutableInfo setValue:[NSNumber
numberWithUnsignedInteger:pageCount] forKey:@"PageCount"];
+ [mutableInfo setValue:[NSNumber numberWithDouble:size.width]
forKey:@"PageWidth"];
+ [mutableInfo setValue:[NSNumber numberWithDouble:size.height]
forKey:@"PageHeight"];
*info = mutableInfo;
}
[pdfDoc release];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit