Revision: 28623
http://sourceforge.net/p/bibdesk/svn/28623
Author: hofman
Date: 2024-01-16 18:34:40 +0000 (Tue, 16 Jan 2024)
Log Message:
-----------
use objc for mutable data
Modified Paths:
--------------
trunk/bibdesk/BDSKFileSearchIndex.h
trunk/bibdesk/BDSKFileSearchIndex.m
Modified: trunk/bibdesk/BDSKFileSearchIndex.h
===================================================================
--- trunk/bibdesk/BDSKFileSearchIndex.h 2024-01-16 18:05:59 UTC (rev 28622)
+++ trunk/bibdesk/BDSKFileSearchIndex.h 2024-01-16 18:34:40 UTC (rev 28623)
@@ -67,7 +67,7 @@
@interface BDSKFileSearchIndex : NSObject {
SKIndexRef skIndex;
- CFMutableDataRef indexData;
+ NSMutableData *indexData;
NSMapTable *URLsForIdentifierURLs;
NSMapTable *identifierURLsForURLs;
NSMutableDictionary *signatures;
Modified: trunk/bibdesk/BDSKFileSearchIndex.m
===================================================================
--- trunk/bibdesk/BDSKFileSearchIndex.m 2024-01-16 18:05:59 UTC (rev 28622)
+++ trunk/bibdesk/BDSKFileSearchIndex.m 2024-01-16 18:34:40 UTC (rev 28623)
@@ -130,8 +130,6 @@
{
if(skIndex) CFRelease(skIndex);
skIndex = NULL;
- if (indexData) CFRelease(indexData);
- indexData = NULL;
}
- (BOOL)shouldKeepRunning {
@@ -280,7 +278,7 @@
NSMutableData *data = [NSMutableData data];
NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc]
initForWritingWithMutableData:data];
[archiver encodeObject:documentURL forKey:@"documentURL"];
- [archiver encodeObject:(__bridge NSMutableData *)indexData
forKey:@"indexData"];
+ [archiver encodeObject:indexData forKey:@"indexData"];
[archiver encodeObject:signatures forKey:@"signatures"];
[archiver finishEncoding];
[data writeToURL:indexCacheURL atomically:YES];
@@ -514,14 +512,13 @@
if (indexCacheURL) {
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc]
initForReadingWithData:[NSData dataWithContentsOfURL:indexCacheURL]];
- indexData = (CFMutableDataRef)CFBridgingRetain([[unarchiver
decodeObjectForKey:@"indexData"] mutableCopy]);
+ indexData = [[unarchiver decodeObjectForKey:@"indexData"] mutableCopy];
if (indexData != NULL) {
- tmpIndex = SKIndexOpenWithMutableData(indexData, NULL);
+ tmpIndex = SKIndexOpenWithMutableData((__bridge
CFMutableDataRef)indexData, NULL);
if (tmpIndex) {
[signatures setDictionary:[unarchiver
decodeObjectForKey:@"signatures"]];
} else {
- CFRelease(indexData);
- indexData = NULL;
+ indexData = nil;
}
}
[unarchiver finishDecoding];
@@ -528,9 +525,9 @@
}
if (tmpIndex == NULL) {
- indexData = CFDataCreateMutable(CFAllocatorGetDefault(), 0);
+ indexData = [[NSMutableData alloc] init];
NSDictionary *options = @{(__bridge id)kSKMaximumTerms:@0, (__bridge
id)kSKMinTermLength:@3};
- tmpIndex = SKIndexCreateWithMutableData(indexData, NULL,
kSKIndexInverted, (__bridge CFDictionaryRef)options);
+ tmpIndex = SKIndexCreateWithMutableData((__bridge
CFMutableDataRef)indexData, NULL, kSKIndexInverted, (__bridge
CFDictionaryRef)options);
}
skIndex = tmpIndex;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit