Revision: 28525
http://sourceforge.net/p/bibdesk/svn/28525
Author: hofman
Date: 2024-01-03 18:04:21 +0000 (Wed, 03 Jan 2024)
Log Message:
-----------
avoid and add a CFBridgingRelease
Modified Paths:
--------------
trunk/bibdesk/BDSKBibTeXParser.m
trunk/bibdesk/NSFileManager_BDSKExtensions.m
Modified: trunk/bibdesk/BDSKBibTeXParser.m
===================================================================
--- trunk/bibdesk/BDSKBibTeXParser.m 2024-01-03 17:51:39 UTC (rev 28524)
+++ trunk/bibdesk/BDSKBibTeXParser.m 2024-01-03 18:04:21 UTC (rev 28525)
@@ -631,11 +631,11 @@
CFAllocatorRef alloc = CFAllocatorGetDefault();
// we need to remove newlines and collapse whitespace before using
bt_split_name
- aName = (NSString
*)BDStringCreateByCollapsingAndTrimmingCharactersInSet(alloc, (__bridge
CFStringRef)aName, (__bridge CFCharacterSetRef)[NSCharacterSet
whitespaceAndNewlineCharacterSet]);
+ CFStringRef cfName =
BDStringCreateByCollapsingAndTrimmingCharactersInSet(alloc, (__bridge
CFStringRef)aName, (__bridge CFCharacterSetRef)[NSCharacterSet
whitespaceAndNewlineCharacterSet]);
// get the fastest encoding, since it usually allows us to get a pointer
to the contents
// the main reason for using CFString here is that it offers cString
create/get for any encoding
- CFStringEncoding encoding = CFStringGetFastestEncoding((__bridge
CFStringRef)aName);
+ CFStringEncoding encoding = CFStringGetFastestEncoding(cfName);
// if it's Unicode, switch to UTF-8 to avoid data loss (btparse doesn't
like unichars)
if(encoding >= kCFStringEncodingUnicode)
@@ -642,9 +642,9 @@
encoding = kCFStringEncodingUTF8;
const char *name_cstring = NULL;
- name_cstring = CFStringGetCStringPtr((__bridge CFStringRef)aName,
encoding);
+ name_cstring = CFStringGetCStringPtr(cfName, encoding);
BOOL shouldFree = NO;
- CFIndex fullLength = CFStringGetLength((__bridge CFStringRef)aName);
+ CFIndex fullLength = CFStringGetLength(cfName);
// CFStringGetCStringPtr will probably always fail for UTF-8, but it may
fail regardless
if(NULL == name_cstring){
@@ -668,14 +668,14 @@
relative to that overhead.
*/
char *buffer = (char *)CFAllocatorAllocate(alloc, requiredLength, 0);
- if(CFStringGetCString((__bridge CFStringRef)aName, buffer,
requiredLength, encoding)){
+ if(CFStringGetCString(cfName, buffer, requiredLength, encoding)){
name_cstring = buffer;
} else {
- [NSException raise:NSInternalInconsistencyException
format:@"Unable to convert string %@ to encoding %@", aName,
CFStringGetNameOfEncoding(encoding)];
+ [NSException raise:NSInternalInconsistencyException
format:@"Unable to convert string %@ to encoding %@", (__bridge id)aName,
CFStringGetNameOfEncoding(encoding)];
// this would work, but we shouldn't need a fallback to a
fallback...
CFAllocatorDeallocate(alloc, buffer);
shouldFree = NO;
- name_cstring = [aName UTF8String];
+ name_cstring = [(__bridge NSString *)aName UTF8String];
encoding = kCFStringEncodingUTF8;
}
}
@@ -687,7 +687,7 @@
theName = bt_split_name((char *)name_cstring, NULL, 0, 0);
[[BDSKErrorObjectController sharedErrorObjectController]
endObservingErrorsForPublication:pub];
- [aName release];
+ CFRelease(cfName);
if(shouldFree)
CFAllocatorDeallocate(alloc, (void *)name_cstring);
Modified: trunk/bibdesk/NSFileManager_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSFileManager_BDSKExtensions.m 2024-01-03 17:51:39 UTC
(rev 28524)
+++ trunk/bibdesk/NSFileManager_BDSKExtensions.m 2024-01-03 18:04:21 UTC
(rev 28525)
@@ -219,7 +219,7 @@
- (NSURL *)temporaryFileURLWithBasename:(NSString *)fileName {
if (fileName == nil)
- fileName = [(NSString *)BDCreateUniqueString() autorelease];
+ fileName = CFBridgingRelease(BDCreateUniqueString());
return [self uniqueFileURLWithName:fileName atURL:[NSURL
fileURLWithPath:temporaryBaseDirectory isDirectory:YES] isDirectory:YES];
}
@@ -284,7 +284,7 @@
return nil;
if ([baseName isEqualToString:@""])
- baseName = [(NSString *)BDCreateUniqueString() autorelease];
+ baseName = CFBridgingRelease(BDCreateUniqueString());
NSUInteger i = 0;
NSURL *fileURL = [NSURL fileURLWithPath:[temporaryBaseDirectory
stringByAppendingPathComponent:baseName] isDirectory:YES];
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