Revision: 28488
http://sourceforge.net/p/bibdesk/svn/28488
Author: hofman
Date: 2023-12-30 16:53:51 +0000 (Sat, 30 Dec 2023)
Log Message:
-----------
Use ARC for yaz framework
Modified Paths:
--------------
trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMConnection.m
trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMQuery.m
trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMRecord.m
trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMResultSet.m
trunk/bibdesk_vendorsrc/indexdata/yaz/objc/yaz.xcodeproj/project.pbxproj
Modified: trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMConnection.m
===================================================================
--- trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMConnection.m 2023-12-30
16:41:55 UTC (rev 28487)
+++ trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMConnection.m 2023-12-30
16:53:51 UTC (rev 28488)
@@ -92,16 +92,9 @@
- (void)dealloc
{
- [_results release]; // will destroy the result sets
if (_connection)
ZOOM_connection_destroy(_connection);
_connection = NULL;
- [_hostName release];
- [_dataBase release];
- [_charSetName release];
- [_connectHost release];
- [_options release];
- [super dealloc];
}
- (id)propertyList;
@@ -131,9 +124,7 @@
// options from the plist override any default options we've set (noop is
self is nil)
NSDictionary *options = [plist objectForKey:@"_options"];
- NSEnumerator *keyEnumerator = [options keyEnumerator];
- NSString *key;
- while (key = [keyEnumerator nextObject]) {
+ for (NSString *key in options) {
// this will update the connection's options and our _options ivar
[self setOption:[options objectForKey:key] forKey:key];
}
@@ -213,9 +204,8 @@
// could add NSNull record, but it's possible that this is only a
temporary failure (e.g. network outage)
}
else {
- resultSet = [[ZOOMResultSet allocWithZone:[self zone]]
initWithZoomResultSet:r charSet:_charSetName];
+ resultSet = [[ZOOMResultSet alloc] initWithZoomResultSet:r
charSet:_charSetName];
[_results setObject:resultSet forKey:query];
- [resultSet release];
}
}
return resultSet;
Modified: trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMQuery.m
===================================================================
--- trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMQuery.m 2023-12-30
16:41:55 UTC (rev 28487)
+++ trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMQuery.m 2023-12-30
16:53:51 UTC (rev 28488)
@@ -37,7 +37,7 @@
+ (id)queryWithCCLString:(NSString *)queryString config:(NSString *)confString;
{
- return [[[self allocWithZone:[self zone]] initWithCCLString:queryString
config:confString] autorelease];
+ return [[self alloc] initWithCCLString:queryString config:confString];
}
+ (NSString *)defaultConfigString;
@@ -88,7 +88,6 @@
// Accented chars don't seem to be handled properly by some servers,
but they appear to work if the accents are removed first, so the sender may
wish to do that transformation. I tried passing a MARC-8 string, but it either
returns 0 results or wrong results.
status = ZOOM_query_ccl2rpn(_query, [_queryString UTF8String], conf,
&error, &errstring, &errorPosition);
if (status) {
- [self release];
self = nil;
}
}
@@ -98,12 +97,10 @@
- (void)dealloc
{
ZOOM_query_destroy(_query);
- [_queryString release];
- [_config release];
- [super dealloc];
+ _query = NULL;
}
-- (id)copyWithZone:(NSZone *)zone { return [self retain]; }
+- (id)copyWithZone:(NSZone *)zone { return self; }
- (NSUInteger)hash { return [_queryString hash]; }
@@ -138,7 +135,7 @@
if (self) {
const char *config_cstr = config ? [config UTF8String] : [ZOOMQuery
defaultConfigCString];
size_t len = strlen(config_cstr) + 1;
- char *copy = NSZoneMalloc([self zone], len * sizeof(char));
+ char *copy = malloc(len * sizeof(char));
// copy so that we can free it later
strncpy(copy, config_cstr, len);
@@ -149,8 +146,8 @@
- (void)dealloc
{
- NSZoneFree([self zone], (void *)_config);
- [super dealloc];
+ free((void *)_config);
+ _config = NULL;
}
- (NSString *)stringForObjectValue:(id)obj { return obj; }
Modified: trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMRecord.m
===================================================================
--- trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMRecord.m 2023-12-30
16:41:55 UTC (rev 28487)
+++ trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMRecord.m 2023-12-30
16:53:51 UTC (rev 28488)
@@ -128,7 +128,7 @@
+ (id)recordWithZoomRecord:(ZOOM_record)record charSet:(NSString *)charSetName;
{
- return [[[self allocWithZone:[self zone]] initWithZoomRecord:record
charSet:charSetName] autorelease];
+ return [[self alloc] initWithZoomRecord:record charSet:charSetName];
}
- (id)initWithZoomRecord:(ZOOM_record)record charSet:(NSString *)charSetName;
@@ -139,7 +139,7 @@
if (self) {
// copy it, since the owning result set could go away
_record = ZOOM_record_clone(record);
- _representations = [[NSMutableDictionary allocWithZone:[self zone]]
init];
+ _representations = [[NSMutableDictionary alloc] init];
_charSetName = [charSetName copy];
}
return self;
@@ -153,9 +153,7 @@
- (void)dealloc
{
ZOOM_record_destroy(_record);
- [_representations release];
- [_charSetName release];
- [super dealloc];
+ _record = NULL;
}
- (id)valueForUndefinedKey:(NSString *)aKey
@@ -174,7 +172,6 @@
if (nil == string) {
string = [self copyStringValueForKey:@"render"];
[_representations setObject:string forKey:renderKey];
- [string release];
}
return string;
}
@@ -185,7 +182,6 @@
if (nil == string) {
string = [self copyStringValueForKey:@"raw"];
[_representations setObject:string forKey:rawKey];
- [string release];
}
return string;
}
@@ -196,7 +192,6 @@
if (nil == string) {
string = [self copyStringValueForKey:@"opac"];
[_representations setObject:string forKey:opacKey];
- [string release];
}
return string;
}
@@ -203,7 +198,7 @@
- (NSString *)stringValueForKey:(NSString *)aKey;
{
- return [[self copyStringValueForKey:aKey] autorelease];
+ return [self copyStringValueForKey:aKey];
}
- (ZOOMSyntaxType)syntaxType;
@@ -240,7 +235,6 @@
{
int e = yaz_iconv_error(cd);
if (e != YAZ_ICONV_E2BIG) {
- [outputData release];
outputData = nil;
break;
}
@@ -283,7 +277,7 @@
- (NSString *)guessedCharSetName;
{
NSStringEncoding enc = [self guessedEncoding];
- return (kCFStringEncodingInvalidId != enc) ? (NSString
*)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding(enc))
: @"MARC-8";
+ return (kCFStringEncodingInvalidId != enc) ? (__bridge NSString
*)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding(enc))
: @"MARC-8";
}
/* MARC-8 is a common encoding for MARC, but useless everywhere else. We can
pass "render;charset=marc-8,utf-8" to specify a source and destination charset,
but yaz defaults to UTF-8 as destination.
@@ -313,17 +307,16 @@
NSStringEncoding enc = [NSString
ZOOM_encodingWithIANACharSetName:_charSetName];
if (kCFStringEncodingInvalidId != enc) {
// We'll hope that the sender knows the correct encoding; this is
required for e.g. XML that is explicitly encoded as iso-8859-1 (COPAC does
this).
- nsString = [[NSString allocWithZone:[self zone]]
initWithBytes:bytes length:length encoding:enc];
+ nsString = [[NSString alloc] initWithBytes:bytes length:length
encoding:enc];
} else if((utf8Data = copyMARC8BytesToUTF8(bytes, length))) {
// now we've assumed it was MARC-8
- nsString = [[NSString allocWithZone:[self zone]]
initWithData:utf8Data encoding:NSUTF8StringEncoding];
- [utf8Data release];
+ nsString = [[NSString alloc] initWithData:utf8Data
encoding:NSUTF8StringEncoding];
}
// should mainly be useful for debugging
if (nil == nsString && kCFStringEncodingInvalidId != fallbackEncoding)
- nsString = [[NSString allocWithZone:[self zone]]
initWithBytes:bytes length:length encoding:fallbackEncoding];
+ nsString = [[NSString alloc] initWithBytes:bytes length:length
encoding:fallbackEncoding];
}
return nsString ? nsString : [@"" copy];
}
@@ -340,11 +333,10 @@
NSData *data = nil;
if (length > 0)
- data = [[NSData allocWithZone:[self zone]] initWithBytes:bytes
length:length];;
+ data = [[NSData alloc] initWithBytes:bytes length:length];;
// if a given key fails, set to empty data so we don't compute it again
[_representations setObject:(data ? data : [NSData data]) forKey:aKey];
- [data release];
}
@end
Modified: trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMResultSet.m
===================================================================
--- trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMResultSet.m 2023-12-30
16:41:55 UTC (rev 28487)
+++ trunk/bibdesk_vendorsrc/indexdata/yaz/objc/ZOOMResultSet.m 2023-12-30
16:53:51 UTC (rev 28488)
@@ -50,8 +50,7 @@
- (void)dealloc
{
ZOOM_resultset_destroy(_resultSet);
- [_charSetName release];
- [super dealloc];
+ _resultSet = NULL;
}
- (NSUInteger)countOfRecords;
@@ -81,7 +80,6 @@
NSParameterAssert(NSMaxRange(range) <= [self countOfRecords]);
NSMutableArray *array = [NSMutableArray arrayWithCapacity:count];
- NSZone *zone = [self zone];
// since we're using a small buffer, we can keep everything on the stack
ZOOM_record recordBuffer[BATCH_SIZE];
@@ -104,9 +102,8 @@
for (i = 0; i < count; i++) {
rec = recordBuffer[i];
if (rec) {
- record = [[ZOOMRecord allocWithZone:zone]
initWithZoomRecord:rec charSet:_charSetName];
+ record = [[ZOOMRecord alloc] initWithZoomRecord:rec
charSet:_charSetName];
[array addObject:record];
- [record release];
}
}
Modified:
trunk/bibdesk_vendorsrc/indexdata/yaz/objc/yaz.xcodeproj/project.pbxproj
===================================================================
--- trunk/bibdesk_vendorsrc/indexdata/yaz/objc/yaz.xcodeproj/project.pbxproj
2023-12-30 16:41:55 UTC (rev 28487)
+++ trunk/bibdesk_vendorsrc/indexdata/yaz/objc/yaz.xcodeproj/project.pbxproj
2023-12-30 16:53:51 UTC (rev 28488)
@@ -1259,6 +1259,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = F92B98C60B45E9C60089909F
/* Default-Build-Settings.xcconfig */;
buildSettings = {
+ CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1;
@@ -1281,6 +1282,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = F92B98C60B45E9C60089909F
/* Default-Build-Settings.xcconfig */;
buildSettings = {
+ CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1;
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