Revision: 5782
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5782&view=rev
Author:   hofman
Date:     2009-09-22 20:46:04 +0000 (Tue, 22 Sep 2009)

Log Message:
-----------
use integers as keys for PDFSync records

Modified Paths:
--------------
    trunk/SKPDFSyncRecord.h
    trunk/SKPDFSyncRecord.m

Modified: trunk/SKPDFSyncRecord.h
===================================================================
--- trunk/SKPDFSyncRecord.h     2009-09-22 20:26:10 UTC (rev 5781)
+++ trunk/SKPDFSyncRecord.h     2009-09-22 20:46:04 UTC (rev 5782)
@@ -71,7 +71,7 @@
 #pragma mark -
 
 @interface SKPDFSyncRecords : NSObject {
-    NSMutableDictionary *records;
+    NSMapTable *records;
 }
 - (SKPDFSyncRecord *)recordForIndex:(NSInteger)recordIndex;
 @end

Modified: trunk/SKPDFSyncRecord.m
===================================================================
--- trunk/SKPDFSyncRecord.m     2009-09-22 20:26:10 UTC (rev 5781)
+++ trunk/SKPDFSyncRecord.m     2009-09-22 20:46:04 UTC (rev 5782)
@@ -114,7 +114,9 @@
 
 - (id)init {
     if (self = [super init]) {
-        records = [[NSMutableDictionary alloc] init];
+        NSPointerFunctions *keyFunctions = [NSPointerFunctions 
pointerFunctionsWithOptions:NSPointerFunctionsOpaqueMemory | 
NSPointerFunctionsIntegerPersonality];
+        NSPointerFunctions *valueFunctions = [NSPointerFunctions 
pointerFunctionsWithOptions:NSPointerFunctionsStrongMemory | 
NSPointerFunctionsObjectPersonality];
+        records = [[NSMapTable alloc] initWithKeyPointerFunctions:keyFunctions 
valuePointerFunctions:valueFunctions capacity:0];
     }
     return self;
 }
@@ -125,14 +127,12 @@
 }
 
 - (SKPDFSyncRecord *)recordForIndex:(NSInteger)recordIndex {
-    NSNumber *recordNumber = [[NSNumber alloc] initWithInteger:recordIndex];
-    SKPDFSyncRecord *record = [records objectForKey:recordNumber];
+    SKPDFSyncRecord *record = [records objectForKey:(id)recordIndex];
     if (record == nil) {
         record = [[SKPDFSyncRecord alloc] initWithRecordIndex:recordIndex];
-        [records setObject:record forKey:recordNumber];
+        [records setObject:record forKey:(id)recordIndex];
         [record release];
     }
-    [recordNumber release];
     return record;
 }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Come build with us! The BlackBerry® 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/devconf
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to