Revision: 5909
http://skim-app.svn.sourceforge.net/skim-app/?rev=5909&view=rev
Author: hofman
Date: 2009-10-19 11:12:21 +0000 (Mon, 19 Oct 2009)
Log Message:
-----------
use maptable and pointerarry categories instead of pointerarray category as we
only use the pointerarray methods in specific cases
Modified Paths:
--------------
trunk/NSWindowController_SKExtensions.m
trunk/PDFAnnotationMarkup_SKExtensions.m
trunk/PDFPage_SKExtensions.m
trunk/PDFSelection_SKExtensions.m
trunk/SKMainWindowController.m
trunk/SKMainWindowController_Actions.m
trunk/SKNotesDocument.m
trunk/SKPDFSyncRecord.m
trunk/SKPDFSynchronizerServer.m
trunk/Skim.xcodeproj/project.pbxproj
Added Paths:
-----------
trunk/NSMapTable_SKExtensions.h
trunk/NSMapTable_SKExtensions.m
trunk/NSPointerArray_SKExtensions.h
trunk/NSPointerArray_SKExtensions.m
Removed Paths:
-------------
trunk/NSPointerFunctions_SKExtensions.h
trunk/NSPointerFunctions_SKExtensions.m
Added: trunk/NSMapTable_SKExtensions.h
===================================================================
--- trunk/NSMapTable_SKExtensions.h (rev 0)
+++ trunk/NSMapTable_SKExtensions.h 2009-10-19 11:12:21 UTC (rev 5909)
@@ -0,0 +1,44 @@
+//
+// NSMapTable_SKExtensions.h
+// Skim
+//
+// Created by Christiaan on 10/19/09.
+/*
+ This software is Copyright (c) 2009
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
+...@interface NSMapTable (SKExtensions)
+- (id)initForCaseInsensitiveStringKeys;
+...@end
Added: trunk/NSMapTable_SKExtensions.m
===================================================================
--- trunk/NSMapTable_SKExtensions.m (rev 0)
+++ trunk/NSMapTable_SKExtensions.m 2009-10-19 11:12:21 UTC (rev 5909)
@@ -0,0 +1,82 @@
+//
+// NSMapTable_SKExtensions.m
+// Skim
+//
+// Created by Christiaan on 10/19/09.
+/*
+ This software is Copyright (c) 2009
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "NSMapTable_SKExtensions.h"
+
+
+...@implementation NSMapTable (SKExtensions)
+
+#define STACK_BUFFER_SIZE 256
+
+static BOOL caseInsensitiveStringEqual(const void *item1, const void *item2,
NSUInteger (*size)(const void *item)) {
+ return (CFStringGetLength(item1) == CFStringGetLength(item2) &&
CFStringCompareWithOptions(item1, item2, CFRangeMake(0,
CFStringGetLength(item1)), kCFCompareCaseInsensitive) == kCFCompareEqualTo);
+}
+
+static NSUInteger caseInsensitiveStringHash(const void *item, NSUInteger
(*size)(const void *item)) {
+ if(item == NULL) return 0;
+
+ NSUInteger hash = 0;
+ CFAllocatorRef allocator = CFGetAllocator(item);
+ CFIndex len = CFStringGetLength(item);
+
+ // use a generous length, in case the lowercase changes the number of
characters
+ UniChar *buffer, stackBuffer[STACK_BUFFER_SIZE];
+ if (len + 10 >= STACK_BUFFER_SIZE)
+ buffer = (UniChar *)CFAllocatorAllocate(allocator, (len + 10) *
sizeof(UniChar), 0);
+ else
+ buffer = stackBuffer;
+ CFStringGetCharacters(item, CFRangeMake(0, len), buffer);
+
+ // If we create the string with external characters,
CFStringGetCharactersPtr is guaranteed to succeed; since we're going to call
CFStringGetCharacters anyway in fastHash if CFStringGetCharactsPtr fails, let's
do it now when we lowercase the string
+ CFMutableStringRef mutableString =
CFStringCreateMutableWithExternalCharactersNoCopy(allocator, buffer, len, len +
10, (buffer != stackBuffer ? allocator : kCFAllocatorNull));
+ CFStringLowercase(mutableString, NULL);
+ hash = [(id)mutableString hash];
+ // if we used the allocator, this should free the buffer for us
+ CFRelease(mutableString);
+ return hash;
+}
+
+- (id)initForCaseInsensitiveStringKeys {
+ NSPointerFunctions *keyPointerFunctions = [NSPointerFunctions
pointerFunctionsWithOptions:NSPointerFunctionsStrongMemory |
NSPointerFunctionsObjectPersonality];
+ [keyPointerFunctions setIsEqualFunction:&caseInsensitiveStringEqual];
+ [keyPointerFunctions setHashFunction:&caseInsensitiveStringHash];
+ NSPointerFunctions *valuePointerFunctions = [NSPointerFunctions
pointerFunctionsWithOptions:NSPointerFunctionsStrongMemory |
NSPointerFunctionsObjectPersonality];
+ return [self initWithKeyPointerFunctions:keyPointerFunctions
valuePointerFunctions:valuePointerFunctions capacity:0];
+}
+
+...@end
Copied: trunk/NSPointerArray_SKExtensions.h (from rev 5853,
trunk/NSPointerFunctions_SKExtensions.h)
===================================================================
--- trunk/NSPointerArray_SKExtensions.h (rev 0)
+++ trunk/NSPointerArray_SKExtensions.h 2009-10-19 11:12:21 UTC (rev 5909)
@@ -0,0 +1,50 @@
+//
+// NSPointerArray_SKExtensions.h
+// Skim
+//
+// Created by Christiaan on 9/23/09.
+/*
+ This software is Copyright (c) 2009
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
+...@interface NSPointerArray (SKExtensions)
+
++ (id)rectPointerArray;
++ (id)rangePointerArray;
+- (id)initForStructPointersWithSizeFunction:(NSUInteger (*)(const void
*))sizeFunction descriptionFunction:(NSString *(*)(const void
*))descriptionFunction;
+- (id)initForRectPointers;
+- (id)initForRangePointers;
+
+...@end
Copied: trunk/NSPointerArray_SKExtensions.m (from rev 5853,
trunk/NSPointerFunctions_SKExtensions.m)
===================================================================
--- trunk/NSPointerArray_SKExtensions.m (rev 0)
+++ trunk/NSPointerArray_SKExtensions.m 2009-10-19 11:12:21 UTC (rev 5909)
@@ -0,0 +1,71 @@
+//
+// NSPointerArray_SKExtensions.m
+// Skim
+//
+// Created by Christiaan on 9/23/09.
+/*
+ This software is Copyright (c) 2009
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "NSPointerArray_SKExtensions.h"
+
+
+...@implementation NSPointerArray (SKExtensions)
+
+static NSUInteger rectSizeFunction(const void *item) { return sizeof(NSRect); }
+
+static NSUInteger rangeSizeFunction(const void *item) { return
sizeof(NSRange); }
+
+static NSString *rectDescriptionFunction(const void *item) { return
NSStringFromRect(*(NSRectPointer)item); }
+
+static NSString *rangeDescriptionFunction(const void *item) { return [NSString
stringWithFormat:@"(%lu, %lu)", (unsigned long)((*(NSRange *)item).location),
(unsigned long)((*(NSRange *)item).length)]; }
+
++ (id)rectPointerArray { return [[[self alloc] initForRectPointers]
autorelease]; }
+
++ (id)rangePointerArray { return [[[self alloc] initForRangePointers]
autorelease]; }
+
+- (id)initForStructPointersWithSizeFunction:(NSUInteger (*)(const void
*))sizeFunction descriptionFunction:(NSString *(*)(const void
*))descriptionFunction {
+ NSPointerFunctions *pointerFunctions = [NSPointerFunctions
pointerFunctionsWithOptions:NSPointerFunctionsMallocMemory |
NSPointerFunctionsCopyIn | NSPointerFunctionsStructPersonality];
+ [pointerFunctions setSizeFunction:sizeFunction];
+ [pointerFunctions setDescriptionFunction:descriptionFunction];
+ return [self initWithPointerFunctions:pointerFunctions];
+}
+
+- (id)initForRectPointers {
+ return [self initForStructPointersWithSizeFunction:&rectSizeFunction
descriptionFunction:&rectDescriptionFunction];
+}
+
+- (id)initForRangePointers {
+ return [self initForStructPointersWithSizeFunction:&rangeSizeFunction
descriptionFunction:&rangeDescriptionFunction];
+}
+
+...@end
Deleted: trunk/NSPointerFunctions_SKExtensions.h
===================================================================
--- trunk/NSPointerFunctions_SKExtensions.h 2009-10-18 21:14:27 UTC (rev
5908)
+++ trunk/NSPointerFunctions_SKExtensions.h 2009-10-19 11:12:21 UTC (rev
5909)
@@ -1,51 +0,0 @@
-//
-// NSPointerFunctions_SKExtensions.h
-// Skim
-//
-// Created by Christiaan on 9/23/09.
-/*
- This software is Copyright (c) 2009
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <Cocoa/Cocoa.h>
-
-
-...@interface NSPointerFunctions (SKExtensions)
-
-+ (id)strongObjectPointerFunctions;
-+ (id)integerPointerFunctions;
-+ (id)structPointerFunctionsWithSizeFunction:(NSUInteger (*)(const void
*))sizeFunction descriptionFunction:(NSString *(*)(const void
*))descriptionFunction;
-+ (id)rectPointerFunctions;
-+ (id)rangePointerFunctions;
-+ (id)caseInsensitiveStringPointerFunctions;
-
-...@end
Deleted: trunk/NSPointerFunctions_SKExtensions.m
===================================================================
--- trunk/NSPointerFunctions_SKExtensions.m 2009-10-18 21:14:27 UTC (rev
5908)
+++ trunk/NSPointerFunctions_SKExtensions.m 2009-10-19 11:12:21 UTC (rev
5909)
@@ -1,112 +0,0 @@
-//
-// NSPointerFunctions_SKExtensions.m
-// Skim
-//
-// Created by Christiaan on 9/23/09.
-/*
- This software is Copyright (c) 2009
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "NSPointerFunctions_SKExtensions.h"
-
-
-...@implementation NSPointerFunctions (SKExtensions)
-
-static NSUInteger rectSizeFunction(const void *item) { return sizeof(NSRect); }
-
-static NSUInteger rangeSizeFunction(const void *item) { return
sizeof(NSRange); }
-
-static NSString *rectDescriptionFunction(const void *item) { return
NSStringFromRect(*(NSRectPointer)item); }
-
-static NSString *rangeDescriptionFunction(const void *item) { return [NSString
stringWithFormat:@"(%lu, %lu)", (unsigned long)((*(NSRange *)item).location),
(unsigned long)((*(NSRange *)item).length)]; }
-
-#define STACK_BUFFER_SIZE 256
-
-static BOOL caseInsensitiveStringEqual(const void *item1, const void *item2,
NSUInteger (*size)(const void *item)) {
- return (CFStringGetLength(item1) == CFStringGetLength(item2) &&
CFStringCompareWithOptions(item1, item2, CFRangeMake(0,
CFStringGetLength(item1)), kCFCompareCaseInsensitive) == kCFCompareEqualTo);
-}
-
-static NSUInteger caseInsensitiveStringHash(const void *item, NSUInteger
(*size)(const void *item)) {
- if(item == NULL) return 0;
-
- NSUInteger hash = 0;
- CFAllocatorRef allocator = CFGetAllocator(item);
- CFIndex len = CFStringGetLength(item);
-
- // use a generous length, in case the lowercase changes the number of
characters
- UniChar *buffer, stackBuffer[STACK_BUFFER_SIZE];
- if (len + 10 >= STACK_BUFFER_SIZE)
- buffer = (UniChar *)CFAllocatorAllocate(allocator, (len + 10) *
sizeof(UniChar), 0);
- else
- buffer = stackBuffer;
- CFStringGetCharacters(item, CFRangeMake(0, len), buffer);
-
- // If we create the string with external characters,
CFStringGetCharactersPtr is guaranteed to succeed; since we're going to call
CFStringGetCharacters anyway in fastHash if CFStringGetCharactsPtr fails, let's
do it now when we lowercase the string
- CFMutableStringRef mutableString =
CFStringCreateMutableWithExternalCharactersNoCopy(allocator, buffer, len, len +
10, (buffer != stackBuffer ? allocator : kCFAllocatorNull));
- CFStringLowercase(mutableString, NULL);
- hash = [(id)mutableString hash];
- // if we used the allocator, this should free the buffer for us
- CFRelease(mutableString);
- return hash;
-}
-
-+ (id)strongObjectPointerFunctions {
- return [self pointerFunctionsWithOptions:NSPointerFunctionsStrongMemory |
NSPointerFunctionsObjectPersonality];
-}
-
-+ (id)integerPointerFunctions {
- return [self pointerFunctionsWithOptions:NSPointerFunctionsOpaqueMemory |
NSPointerFunctionsIntegerPersonality];
-}
-
-+ (id)structPointerFunctionsWithSizeFunction:(NSUInteger (*)(const void
*))sizeFunction descriptionFunction:(NSString *(*)(const void
*))descriptionFunction {
- NSPointerFunctions *pointerFunctions = [self
pointerFunctionsWithOptions:NSPointerFunctionsMallocMemory |
NSPointerFunctionsCopyIn | NSPointerFunctionsStructPersonality];
- [pointerFunctions setSizeFunction:sizeFunction];
- [pointerFunctions setDescriptionFunction:descriptionFunction];
- return pointerFunctions;
-}
-
-+ (id)rectPointerFunctions {
- return [self structPointerFunctionsWithSizeFunction:&rectSizeFunction
descriptionFunction:&rectDescriptionFunction];
-}
-
-+ (id)rangePointerFunctions {
- return [self structPointerFunctionsWithSizeFunction:&rangeSizeFunction
descriptionFunction:&rangeDescriptionFunction];
-}
-
-+ (id)caseInsensitiveStringPointerFunctions {
- NSPointerFunctions *pointerFunctions = [self
pointerFunctionsWithOptions:NSPointerFunctionsStrongMemory |
NSPointerFunctionsObjectPersonality];
- [pointerFunctions setIsEqualFunction:&caseInsensitiveStringEqual];
- [pointerFunctions setHashFunction:&caseInsensitiveStringHash];
- return pointerFunctions;
-}
-
-...@end
Modified: trunk/NSWindowController_SKExtensions.m
===================================================================
--- trunk/NSWindowController_SKExtensions.m 2009-10-18 21:14:27 UTC (rev
5908)
+++ trunk/NSWindowController_SKExtensions.m 2009-10-19 11:12:21 UTC (rev
5909)
@@ -38,7 +38,7 @@
#import "NSWindowController_SKExtensions.h"
#import "NSInvocation_SKExtensions.h"
-#import "NSPointerFunctions_SKExtensions.h"
+#import "NSPointerArray_SKExtensions.h"
@implementation NSWindowController (SKExtensions)
Modified: trunk/PDFAnnotationMarkup_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationMarkup_SKExtensions.m 2009-10-18 21:14:27 UTC (rev
5908)
+++ trunk/PDFAnnotationMarkup_SKExtensions.m 2009-10-19 11:12:21 UTC (rev
5909)
@@ -49,7 +49,7 @@
#import "NSData_SKExtensions.h"
#import "NSCharacterSet_SKExtensions.h"
#import "SKRuntime.h"
-#import "NSPointerFunctions_SKExtensions.h"
+#import "NSPointerArray_SKExtensions.h"
NSString *SKPDFAnnotationSelectionSpecifierKey = @"selectionSpecifier";
@@ -126,7 +126,7 @@
- (NSPointerArray *)lineRects {
NSPointerArray *lineRects = [lineRectsTable objectForKey:self];
if (lineRects == NULL) {
- lineRects = [[NSPointerArray alloc]
initWithPointerFunctions:[NSPointerFunctions rectPointerFunctions]];
+ lineRects = [[NSPointerArray alloc] initForRectPointers];
[lineRectsTable setObject:lineRects forKey:self];
[lineRects release];;
}
Modified: trunk/PDFPage_SKExtensions.m
===================================================================
--- trunk/PDFPage_SKExtensions.m 2009-10-18 21:14:27 UTC (rev 5908)
+++ trunk/PDFPage_SKExtensions.m 2009-10-19 11:12:21 UTC (rev 5909)
@@ -54,7 +54,7 @@
#import "PDFAnnotation_SKExtensions.h"
#import "PDFAnnotationMarkup_SKExtensions.h"
#import "PDFAnnotationInk_SKExtensions.h"
-#import "NSPointerFunctions_SKExtensions.h"
+#import "NSPointerArray_SKExtensions.h"
NSString *SKPDFPageBoundsDidChangeNotification =
@"SKPDFPageBoundsDidChangeNotification";
@@ -290,7 +290,7 @@
[lines sortUsingSelector:@selector(boundsCompare:)];
NSUInteger i, iMax = [lines count];
- NSPointerArray *fullLines = [[[NSPointerArray alloc]
initWithPointerFunctions:[NSPointerFunctions rectPointerFunctions]]
autorelease];
+ NSPointerArray *fullLines = [NSPointerArray rectPointerArray];
NSRect r1 = NSZeroRect;
for (i = 0; i < iMax; i++) {
Modified: trunk/PDFSelection_SKExtensions.m
===================================================================
--- trunk/PDFSelection_SKExtensions.m 2009-10-18 21:14:27 UTC (rev 5908)
+++ trunk/PDFSelection_SKExtensions.m 2009-10-19 11:12:21 UTC (rev 5909)
@@ -42,7 +42,7 @@
#import "PDFPage_SKExtensions.h"
#import "SKStringConstants.h"
#import "SKMainDocument.h"
-#import "NSPointerFunctions_SKExtensions.h"
+#import "NSPointerArray_SKExtensions.h"
#define ELLIPSIS_CHARACTER 0x2026
@@ -281,7 +281,7 @@
NSTextStorage *containerText = [dict objectForKey:@"text"];
NSPointerArray *textRanges = [dict objectForKey:@"ranges"];
NSUInteger ri, numRanges = [textRanges count];
- NSPointerArray *ranges = [[NSPointerArray alloc]
initWithPointerFunctions:[NSPointerFunctions rangePointerFunctions]];
+ NSPointerArray *ranges = [[NSPointerArray alloc]
initForRangePointers];
for (ri = 0; ri < numRanges; ri++) {
NSRange textRange = *(NSRange *)[textRanges pointerAtIndex:ri];
@@ -293,7 +293,7 @@
// now get the ranges, which can be any kind of specifier
NSInteger startIndex, endIndex, i, count, *indices;
- NSPointerArray *tmpRanges = [[NSPointerArray alloc]
initWithPointerFunctions:[NSPointerFunctions rangePointerFunctions]];
+ NSPointerArray *tmpRanges = [[NSPointerArray alloc]
initForRangePointers];
if ([specifier isKindOfClass:[NSPropertySpecifier class]]) {
// this should be the full range of characters, words, or
paragraphs
@@ -432,7 +432,7 @@
NSTextStorage *containerText = [container valueForKey:key];
if ([containerText isKindOfClass:[NSTextStorage class]] == NO ||
[containerText length] == 0)
continue;
- NSPointerArray *ranges = [[NSPointerArray alloc]
initWithPointerFunctions:[NSPointerFunctions rangePointerFunctions]];
+ NSPointerArray *ranges = [[NSPointerArray alloc]
initForRangePointers];
NSRange range = NSMakeRange(0, [containerText length]);
[ranges addPointer:&range];
NSMutableDictionary *dict = [[NSMutableDictionary alloc]
initWithObjectsAndKeys:ranges, @"ranges", containerText, @"text", container,
@"container", nil];
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2009-10-18 21:14:27 UTC (rev 5908)
+++ trunk/SKMainWindowController.m 2009-10-19 11:12:21 UTC (rev 5909)
@@ -99,7 +99,7 @@
#import "NSView_SKExtensions.h"
#import "NSResponder_SKExtensions.h"
#import "PDFOutline_SKExtensions.h"
-#import "NSPointerFunctions_SKExtensions.h"
+#import "NSPointerArray_SKExtensions.h"
#import "SKFloatMapTable.h"
#import "SKColorCell.h"
Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m 2009-10-18 21:14:27 UTC (rev
5908)
+++ trunk/SKMainWindowController_Actions.m 2009-10-19 11:12:21 UTC (rev
5909)
@@ -62,7 +62,7 @@
#import "SKLineInspector.h"
#import "NSEvent_SKExtensions.h"
#import "NSWindowController_SKExtensions.h"
-#import "NSPointerFunctions_SKExtensions.h"
+#import "NSPointerArray_SKExtensions.h"
@implementation SKMainWindowController (Actions)
@@ -626,7 +626,7 @@
NSInteger i, count = [[pdfView document] pageCount];
NSInteger rectCount = [rects count];
- NSPointerArray *oldRects = [[[NSPointerArray alloc]
initWithPointerFunctions:[NSPointerFunctions rectPointerFunctions]]
autorelease];
+ NSPointerArray *oldRects = [NSPointerArray rectPointerArray];
for (i = 0; i < count; i++) {
PDFPage *page = [[pdfView document] pageAtIndex:i];
NSRect rect = NSIntersectionRect(*(NSRectPointer)[rects
pointerAtIndex:i % rectCount], [page boundsForBox:kPDFDisplayBoxMediaBox]);
@@ -652,7 +652,7 @@
- (IBAction)cropAll:(id)sender {
NSRect rect[2] = {NSIntegralRect([pdfView currentSelectionRect]),
NSZeroRect};
- NSPointerArray *rectArray = [[[NSPointerArray alloc]
initWithPointerFunctions:[NSPointerFunctions rectPointerFunctions]]
autorelease];
+ NSPointerArray *rectArray = [NSPointerArray rectPointerArray];
BOOL emptySelection = NSIsEmptyRect(rect[0]);
if (emptySelection) {
@@ -697,7 +697,7 @@
}
- (IBAction)autoCropAll:(id)sender {
- NSPointerArray *rectArray = [[[NSPointerArray alloc]
initWithPointerFunctions:[NSPointerFunctions rectPointerFunctions]]
autorelease];
+ NSPointerArray *rectArray = [NSPointerArray rectPointerArray];
PDFDocument *pdfDoc = [pdfView document];
NSInteger i, iMax = [[pdfView document] pageCount];
@@ -719,7 +719,7 @@
}
- (IBAction)smartAutoCropAll:(id)sender {
- NSPointerArray *rectArray = [[[NSPointerArray alloc]
initWithPointerFunctions:[NSPointerFunctions rectPointerFunctions]]
autorelease];
+ NSPointerArray *rectArray = [NSPointerArray rectPointerArray];
PDFDocument *pdfDoc = [pdfView document];
NSInteger i, iMax = [pdfDoc pageCount];
NSSize size = NSZeroSize;
Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m 2009-10-18 21:14:27 UTC (rev 5908)
+++ trunk/SKNotesDocument.m 2009-10-19 11:12:21 UTC (rev 5909)
@@ -60,7 +60,7 @@
#import "SKAnnotationTypeImageCell.h"
#import "SKPrintableView.h"
#import "SKPDFView.h"
-#import "NSPointerFunctions_SKExtensions.h"
+#import "NSPointerArray_SKExtensions.h"
#import "SKFloatMapTable.h"
#import "NSColor_SKExtensions.h"
#import "SKColorCell.h"
Modified: trunk/SKPDFSyncRecord.m
===================================================================
--- trunk/SKPDFSyncRecord.m 2009-10-18 21:14:27 UTC (rev 5908)
+++ trunk/SKPDFSyncRecord.m 2009-10-19 11:12:21 UTC (rev 5909)
@@ -37,7 +37,7 @@
*/
#import "SKPDFSyncRecord.h"
-#import "NSPointerFunctions_SKExtensions.h"
+#import "NSPointerArray_SKExtensions.h"
@implementation SKPDFSyncRecord
Modified: trunk/SKPDFSynchronizerServer.m
===================================================================
--- trunk/SKPDFSynchronizerServer.m 2009-10-18 21:14:27 UTC (rev 5908)
+++ trunk/SKPDFSynchronizerServer.m 2009-10-19 11:12:21 UTC (rev 5909)
@@ -46,7 +46,7 @@
#import "NSFileManager_SKExtensions.h"
#import "NSString_SKExtensions.h"
#import "SKRuntime.h"
-#import "NSPointerFunctions_SKExtensions.h"
+#import "NSMapTable_SKExtensions.h"
#define PDFSYNC_TO_PDF(coord) ((CGFloat)coord / 65536.0)
@@ -296,7 +296,7 @@
if (lines)
[lines removeAllObjects];
else
- lines = [[NSMapTable alloc]
initWithKeyPointerFunctions:[NSPointerFunctions
caseInsensitiveStringPointerFunctions]
valuePointerFunctions:[NSPointerFunctions strongObjectPointerFunctions]
capacity:0];
+ lines = [[NSMapTable alloc] initForCaseInsensitiveStringKeys];
[self setSyncFileName:theFileName];
isPdfsync = YES;
@@ -537,7 +537,7 @@
if (filenames)
[filenames removeAllObjects];
else
- filenames = [[NSMapTable alloc]
initWithKeyPointerFunctions:[NSPointerFunctions
caseInsensitiveStringPointerFunctions]
valuePointerFunctions:[NSPointerFunctions strongObjectPointerFunctions]
capacity:0];
+ filenames = [[NSMapTable alloc] initForCaseInsensitiveStringKeys];
NSString *filename;
synctex_node_t node = synctex_scanner_input(scanner);
do {
Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj 2009-10-18 21:14:27 UTC (rev
5908)
+++ trunk/Skim.xcodeproj/project.pbxproj 2009-10-19 11:12:21 UTC (rev
5909)
@@ -85,6 +85,7 @@
CE2093910C5F9A8D009D3EFB /* BDSKGradientView.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE20938F0C5F9A8D009D3EFB /* BDSKGradientView.m
*/; };
CE209FAA0C9D38C6007C72F9 /* SKProgressController.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE209FA80C9D38C6007C72F9 /*
SKProgressController.m */; };
CE20B1950C9F23CC007C72F9 /* NSView_SKExtensions.m in Sources */
= {isa = PBXBuildFile; fileRef = CE20B1930C9F23CC007C72F9 /*
NSView_SKExtensions.m */; };
+ CE225ADD108C7458007BCDB5 /* NSMapTable_SKExtensions.m in
Sources */ = {isa = PBXBuildFile; fileRef = CE225ADC108C7458007BCDB5 /*
NSMapTable_SKExtensions.m */; };
CE2A1E630CE513E400A0499B /* RemoteControl.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE2A1E610CE513E300A0499B /* RemoteControl.m */;
};
CE2DE4920B85D48F00D0DA12 /* SKThumbnail.m in Sources */ = {isa
= PBXBuildFile; fileRef = CE2DE4910B85D48F00D0DA12 /* SKThumbnail.m */; };
CE2DE49D0B85D4F400D0DA12 /* SKFullScreenWindow.m in Sources */
= {isa = PBXBuildFile; fileRef = CE2DE49C0B85D4F400D0DA12 /*
SKFullScreenWindow.m */; };
@@ -111,7 +112,7 @@
CE41B2A70C08CFA900E36EB7 /* NSArray_SKExtensions.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE41B2A50C08CFA900E36EB7 /*
NSArray_SKExtensions.m */; };
CE41B2CC0C08D17100E36EB7 /* NSValue_SKExtensions.m in Sources
*/ = {isa = PBXBuildFile; fileRef = CE41B2CA0C08D17100E36EB7 /*
NSValue_SKExtensions.m */; };
CE4294A30BBD29120016FDC2 /* SKReadingBar.m in Sources */ = {isa
= PBXBuildFile; fileRef = CE4294A20BBD29120016FDC2 /* SKReadingBar.m */; };
- CE42B8EC106996C60091F588 /* NSPointerFunctions_SKExtensions.m
in Sources */ = {isa = PBXBuildFile; fileRef = CE42B8EB106996C60091F588 /*
NSPointerFunctions_SKExtensions.m */; };
+ CE42B8EC106996C60091F588 /* NSPointerArray_SKExtensions.m in
Sources */ = {isa = PBXBuildFile; fileRef = CE42B8EB106996C60091F588 /*
NSPointerArray_SKExtensions.m */; };
CE4373B40BB5440E00A56987 /* PSDocument.icns in Resources */ =
{isa = PBXBuildFile; fileRef = CE4373B30BB5440E00A56987 /* PSDocument.icns */;
};
CE4642E50DF5CBD900CFD8D2 /* PDFAnnotationText_SKExtensions.m in
Sources */ = {isa = PBXBuildFile; fileRef = CE4642E40DF5CBD900CFD8D2 /*
PDFAnnotationText_SKExtensions.m */; };
CE4643CF0DF6B5A400CFD8D2 /* SKJoinCommand.m in Sources */ =
{isa = PBXBuildFile; fileRef = CE4643CE0DF6B5A400CFD8D2 /* SKJoinCommand.m */;
};
@@ -619,6 +620,8 @@
CE209FA80C9D38C6007C72F9 /* SKProgressController.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= SKProgressController.m; sourceTree = "<group>"; };
CE20B1920C9F23CC007C72F9 /* NSView_SKExtensions.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
NSView_SKExtensions.h; sourceTree = "<group>"; };
CE20B1930C9F23CC007C72F9 /* NSView_SKExtensions.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= NSView_SKExtensions.m; sourceTree = "<group>"; };
+ CE225ADB108C7458007BCDB5 /* NSMapTable_SKExtensions.h */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path
= NSMapTable_SKExtensions.h; sourceTree = "<group>"; };
+ CE225ADC108C7458007BCDB5 /* NSMapTable_SKExtensions.m */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc;
path = NSMapTable_SKExtensions.m; sourceTree = "<group>"; };
CE2A1E600CE513E300A0499B /* RemoteControl.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
RemoteControl.h; sourceTree = "<group>"; };
CE2A1E610CE513E300A0499B /* RemoteControl.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= RemoteControl.m; sourceTree = "<group>"; };
CE2BD8170BD4127A00A5F4DB /* Sparkle.xcodeproj */ = {isa =
PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name =
Sparkle.xcodeproj; path = vendorsrc/andymatuschak/Sparkle/Sparkle.xcodeproj;
sourceTree = "<group>"; };
@@ -671,8 +674,8 @@
CE41B2CA0C08D17100E36EB7 /* NSValue_SKExtensions.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= NSValue_SKExtensions.m; sourceTree = "<group>"; };
CE4294A10BBD29120016FDC2 /* SKReadingBar.h */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path =
SKReadingBar.h; sourceTree = "<group>"; };
CE4294A20BBD29120016FDC2 /* SKReadingBar.m */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path
= SKReadingBar.m; sourceTree = "<group>"; };
- CE42B8EA106996C60091F588 /* NSPointerFunctions_SKExtensions.h
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.h; path = NSPointerFunctions_SKExtensions.h; sourceTree =
"<group>"; };
- CE42B8EB106996C60091F588 /* NSPointerFunctions_SKExtensions.m
*/ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.objc; path = NSPointerFunctions_SKExtensions.m; sourceTree =
"<group>"; };
+ CE42B8EA106996C60091F588 /* NSPointerArray_SKExtensions.h */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h;
path = NSPointerArray_SKExtensions.h; sourceTree = "<group>"; };
+ CE42B8EB106996C60091F588 /* NSPointerArray_SKExtensions.m */ =
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.objc; path = NSPointerArray_SKExtensions.m; sourceTree =
"<group>"; };
CE4373B30BB5440E00A56987 /* PSDocument.icns */ = {isa =
PBXFileReference; lastKnownFileType = image.icns; path = PSDocument.icns;
sourceTree = "<group>"; };
CE4642E30DF5CBD900CFD8D2 /* PDFAnnotationText_SKExtensions.h */
= {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.h; path = PDFAnnotationText_SKExtensions.h; sourceTree =
"<group>"; };
CE4642E40DF5CBD900CFD8D2 /* PDFAnnotationText_SKExtensions.m */
= {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
sourcecode.c.objc; path = PDFAnnotationText_SKExtensions.m; sourceTree =
"<group>"; };
@@ -1128,12 +1131,14 @@
CE5BEA170C7C635400EBDCF7 /*
NSGeometry_SKExtensions.m */,
CE0EB4D40DD054DC0034DF92 /*
NSInvocation_SKExtensions.h */,
CE0EB4D50DD054DC0034DF92 /*
NSInvocation_SKExtensions.m */,
+ CE225ADB108C7458007BCDB5 /*
NSMapTable_SKExtensions.h */,
+ CE225ADC108C7458007BCDB5 /*
NSMapTable_SKExtensions.m */,
CE3401E40E01388700A7FFE6 /*
NSNumber_SKExtensions.h */,
CE3401E50E01388700A7FFE6 /*
NSNumber_SKExtensions.m */,
CE6C03EE0BEDF759007BF0B5 /*
NSParagraphStyle_SKExtensions.h */,
CE6C03EF0BEDF759007BF0B5 /*
NSParagraphStyle_SKExtensions.m */,
- CE42B8EA106996C60091F588 /*
NSPointerFunctions_SKExtensions.h */,
- CE42B8EB106996C60091F588 /*
NSPointerFunctions_SKExtensions.m */,
+ CE42B8EA106996C60091F588 /*
NSPointerArray_SKExtensions.h */,
+ CE42B8EB106996C60091F588 /*
NSPointerArray_SKExtensions.m */,
CE1E301A0BDB9D5C0011D9DD /*
NSScanner_SKExtensions.h */,
CE1E301B0BDB9D5C0011D9DD /*
NSScanner_SKExtensions.m */,
CE38ECD10B8093B200A1B779 /*
NSString_SKExtensions.h */,
@@ -2114,10 +2119,11 @@
CE5BB0CF10515CCC00161B87 /* SKPDFDocument.m in
Sources */,
CE5BB0D310515D3100161B87 /* SKPDFPage.m in
Sources */,
CE5BB21610517AEF00161B87 /*
NSFileManager_SKExtensions.m in Sources */,
- CE42B8EC106996C60091F588 /*
NSPointerFunctions_SKExtensions.m in Sources */,
+ CE42B8EC106996C60091F588 /*
NSPointerArray_SKExtensions.m in Sources */,
CEA3DF6E106BDAC1002FB3DB /* SKFloatMapTable.m
in Sources */,
CEE73ECE106CEC1900419544 /* SKSeparatorCell.m
in Sources */,
CE0AEDC3107A137C000C075E /* SKColorCell.m in
Sources */,
+ CE225ADD108C7458007BCDB5 /*
NSMapTable_SKExtensions.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit