Revision: 28487
          http://sourceforge.net/p/bibdesk/svn/28487
Author:   hofman
Date:     2023-12-30 16:41:55 +0000 (Sat, 30 Dec 2023)
Log Message:
-----------
use ARC for quicklook generator

Modified Paths:
--------------
    trunk/QuickLook-BibDesk/BDSKSpotlightIconController.m
    trunk/QuickLook-BibDesk/BDSKSyntaxHighlighter.m
    trunk/QuickLook-BibDesk/GeneratePreviewForURL.m
    trunk/QuickLook-BibDesk/GenerateThumbnailForURL.m
    trunk/QuickLook-BibDesk/QuickLook-BibDesk.xcodeproj/project.pbxproj

Modified: trunk/QuickLook-BibDesk/BDSKSpotlightIconController.m
===================================================================
--- trunk/QuickLook-BibDesk/BDSKSpotlightIconController.m       2023-12-30 
15:50:00 UTC (rev 28486)
+++ trunk/QuickLook-BibDesk/BDSKSpotlightIconController.m       2023-12-30 
16:41:55 UTC (rev 28487)
@@ -62,9 +62,7 @@
 + (void)freeStatics
 {
     @synchronized(self) {
-        [controller release];
         controller = nil;
-        [applicationIcon release];
         applicationIcon = nil;
     }
 }
@@ -113,7 +111,6 @@
             dateFormatter = [[NSDateFormatter alloc] init];
             [dateFormatter setDateFormat:@"yyyy"];
         } else {
-            [self release];
             self = nil;
         }
     }
@@ -120,20 +117,10 @@
     return self;
 }
 
-- (void)dealloc
-{
-    [values release];
-    [dateFormatter release];
-    [window release];
-    [arrayController release];
-    [super dealloc];
-}
-
 static void addDictionaryWithAttributeAndValue(NSMutableArray *array, NSString 
*attribute, id value)
 {
     NSDictionary *dict = [[NSDictionary alloc] 
initWithObjectsAndKeys:attribute, @"attributeName", value ?: @"", 
@"attributeValue", nil];
     [array addObject:dict];
-    [dict release];
 }
 
 static void addConditionalDictionaryWithAttributeAndValue(NSMutableArray 
*array, NSString *attribute, id value)
@@ -141,7 +128,6 @@
     if (value != nil) {
         NSDictionary *dict = [[NSDictionary alloc] 
initWithObjectsAndKeys:attribute, @"attributeName", value ?: @"", 
@"attributeValue", nil];
         [array addObject:dict];
-        [dict release];
     }
 }
 

Modified: trunk/QuickLook-BibDesk/BDSKSyntaxHighlighter.m
===================================================================
--- trunk/QuickLook-BibDesk/BDSKSyntaxHighlighter.m     2023-12-30 15:50:00 UTC 
(rev 28486)
+++ trunk/QuickLook-BibDesk/BDSKSyntaxHighlighter.m     2023-12-30 16:41:55 UTC 
(rev 28487)
@@ -72,7 +72,7 @@
 
     NSCharacterSet *newlineSet = [NSCharacterSet newlineCharacterSet];
     
-    CFStringRef string = (CFStringRef)[attributedString string];
+    CFStringRef string = (__bridge CFStringRef)[attributedString string];
     CFIndex length = CFStringGetLength(string);
     SetColor([NSColor orangeColor], 0, length);
 
@@ -185,7 +185,7 @@
     }
     
     [attributedString addAttribute:NSFontAttributeName value:[NSFont 
userFixedPitchFontOfSize:10.0] range:NSMakeRange(0, [attributedString length])];
-    return [attributedString autorelease];
+    return attributedString;
 }
 
 @end

Modified: trunk/QuickLook-BibDesk/GeneratePreviewForURL.m
===================================================================
--- trunk/QuickLook-BibDesk/GeneratePreviewForURL.m     2023-12-30 15:50:00 UTC 
(rev 28486)
+++ trunk/QuickLook-BibDesk/GeneratePreviewForURL.m     2023-12-30 16:41:55 UTC 
(rev 28487)
@@ -45,162 +45,148 @@
 
 OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef 
preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options)
 {
-    NSAutoreleasePool *pool = [NSAutoreleasePool new];
-    
     OSStatus err = noErr;
     
-    if (UTTypeEqual(CFSTR("net.sourceforge.bibdesk.bdskcache"), 
contentTypeUTI)) {
-        
-        CFBundleRef bundle = QLPreviewRequestGetGeneratorBundle(preview);
-        CFURLRef templateURL = CFBundleCopyResourceURL(bundle, 
CFSTR("BibDeskQuickLook"), CFSTR("html"), NULL);
-        NSString *path = templateURL ? (NSString 
*)CFURLCopyFileSystemPath(templateURL, kCFURLPOSIXPathStyle) : nil;
+    @autoreleasepool {
 
-        if (templateURL) CFRelease(templateURL);
-        
-        if (nil == path) {
-            [pool release];
-            return fnfErr;
-        }
-        
-        NSMutableString *string = [[NSMutableString alloc] 
initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL];
-        [path release];
-        
-        NSMutableDictionary *mdItem = [[NSMutableDictionary alloc] 
initWithContentsOfURL:(NSURL *)url];
-        
-        // if we don't have a URL, show something useful (this is multivalued, 
but it uses the fallback case)
-        NSArray *whereFrom = [mdItem objectForKey:(NSString 
*)kMDItemWhereFroms];
-        if ([whereFrom count] == 0)
-            [mdItem setObject:@"No URL" forKey:(NSString *)kMDItemWhereFroms];
-        
-        NSDate *date = [mdItem 
objectForKey:@"net_sourceforge_bibdesk_publicationdate"];
-        if (date) {
-            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
-            [formatter setDateStyle:NSDateFormatterLongStyle];
-            NSString *dateString = [formatter stringFromDate:date];
-            if (dateString)
-                [mdItem setObject:dateString 
forKey:@"net_sourceforge_bibdesk_publicationdate"];
-            [formatter release];
-        }
-        
-        NSArray *keys = [mdItem allKeys];
-        for (NSString *key in keys) {
-            NSRange r = [string rangeOfString:key 
options:NSLiteralSearch|NSCaseInsensitiveSearch];
-            if (r.length) {
-                id obj = [mdItem objectForKey:key];
-                NSString *value = nil;
-                
-                if ([key isEqualToString:(NSString *)kMDItemAuthors] && [obj 
respondsToSelector:@selector(componentsJoinedByString:)])
-                    value = [obj componentsJoinedByString:@" and "];
-                else if ([key isEqualToString:(NSString *)kMDItemEditors] && 
[obj respondsToSelector:@selector(componentsJoinedByString:)])
-                    value = [obj componentsJoinedByString:@" and "];
-                else if ([key isEqualToString:(NSString *)kMDItemWhereFroms] 
&& [obj respondsToSelector:@selector(lastObject)])
-                    value = [obj lastObject];
-                else if ([key 
isEqualToString:@"net_sourceforge_bibdesk_owningfilepath"])
-                    value = [[NSURL fileURLWithPath:obj] absoluteString];
-                
-                // fallback
-                if (nil == value)
-                    value = [obj description];
-                
-                // now replace this and future occurrences of the string
-                [string replaceOccurrencesOfString:key withString:value 
options:NSCaseInsensitiveSearch|NSLiteralSearch range:NSMakeRange(r.location, 
[string length] - r.location)];
+        if (UTTypeEqual(CFSTR("net.sourceforge.bibdesk.bdskcache"), 
contentTypeUTI)) {
+            
+            CFBundleRef bundle = QLPreviewRequestGetGeneratorBundle(preview);
+            CFURLRef templateURL = CFBundleCopyResourceURL(bundle, 
CFSTR("BibDeskQuickLook"), CFSTR("html"), NULL);
+            NSString *path = templateURL ? (NSString 
*)CFBridgingRelease(CFURLCopyFileSystemPath(templateURL, kCFURLPOSIXPathStyle)) 
: nil;
+
+            if (templateURL) CFRelease(templateURL);
+            
+            if (nil == path) {
+                return fnfErr;
             }
-        }
             
-        NSDictionary *properties = [[NSDictionary alloc] 
initWithObjectsAndKeys:@"text/html", kQLPreviewPropertyMIMETypeKey, @"utf-8", 
kQLPreviewPropertyTextEncodingNameKey, nil];
-        CFDataRef data = (CFDataRef)[string 
dataUsingEncoding:NSUTF8StringEncoding];
-        if (nil != data) {
-            QLPreviewRequestSetDataRepresentation(preview, data, kUTTypeHTML, 
(CFDictionaryRef)properties);
-        } else{
-            err = 1;
-        }
-
-        [string release];
-        [mdItem release];
-        [properties release];
-        
-    } else if (UTTypeEqual(CFSTR("net.sourceforge.bibdesk.bdsksearch"), 
contentTypeUTI)) {
-        
-        NSMutableAttributedString *attributedString = 
[[NSMutableAttributedString alloc] init];
-        NSAttributedString *attrString;
-        
-        NSFont *keyFont = [NSFont userFixedPitchFontOfSize:11.0];
-        NSFont *valueFont = [NSFont userFixedPitchFontOfSize:12.0];
-        NSDictionary *keyAttrs = [NSDictionary 
dictionaryWithObjectsAndKeys:keyFont, NSFontAttributeName, nil];
-        NSDictionary *valueAttrs = [NSDictionary 
dictionaryWithObjectsAndKeys:valueFont, NSFontAttributeName, nil];
-        NSDictionary *dictionary = [NSDictionary 
dictionaryWithContentsOfURL:(NSURL *)url];
-        NSArray *keys = [NSArray arrayWithObjects:@"name", @"type", 
@"database", @"host", @"port", @"search term", nil];
-        for (NSString *key in keys) {
-            NSString *value = [dictionary objectForKey:key];
-            if (value == nil)
-                continue;
-            NSMutableString *label = [NSMutableString string];
-            [label appendString:[key capitalizedString]];
-            [label appendString:@":"];
-            while ([label length] < 13)
-                [label appendString:@" "];
-            value = [value stringByAppendingString:@"\n"];
-            attrString = [[NSAttributedString alloc] initWithString:label 
attributes:keyAttrs];
-            [attributedString appendAttributedString:attrString];
-            [attrString release];
-            attrString = [[NSAttributedString alloc] initWithString:value 
attributes:valueAttrs];
-            [attributedString appendAttributedString:attrString];
-            [attrString release];
-        }
-        
-        [attributedString fixAttributesInRange:NSMakeRange(0, 
[attributedString length])];
-        
-        CFDataRef data = (CFDataRef)[attributedString 
RTFFromRange:NSMakeRange(0, [attributedString length]) 
documentAttributes:[NSDictionary 
dictionaryWithObjectsAndKeys:NSRTFTextDocumentType, 
NSDocumentTypeDocumentAttribute, nil]];
-        
-        if (data) {
-            QLPreviewRequestSetDataRepresentation(preview, data, kUTTypeRTF, 
NULL);
-        } else {
-            err = 2;
-        }
-        
-        [attributedString release];
-
-    } else if (UTTypeConformsTo(contentTypeUTI, kUTTypePlainText)) {
-        
-        NSStringEncoding usedEncoding;
-        NSString *btString = [[NSString alloc] initWithContentsOfURL:(NSURL 
*)url usedEncoding:&usedEncoding error:NULL];
-        if (nil == btString)
-            btString = [[NSString alloc] initWithContentsOfURL:(NSURL *)url 
encoding:[NSString defaultCStringEncoding] error:NULL];
-        if (nil == btString)
-            btString = [[NSString alloc] initWithContentsOfURL:(NSURL *)url 
encoding:NSISOLatin1StringEncoding error:NULL];
-        
-        if (btString) {
-            if (UTTypeEqual(CFSTR("org.tug.tex.bibtex"), contentTypeUTI)) {
-                CFDataRef data = (CFDataRef)[BDSKSyntaxHighlighter 
RTFDataWithBibTeXString:btString];
-                if (data) {
-                    QLPreviewRequestSetDataRepresentation(preview, data, 
kUTTypeRTF, NULL);
-                } else {
-                    err = 2;
+            NSMutableString *string = [[NSMutableString alloc] 
initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL];
+            
+            NSMutableDictionary *mdItem = [[NSMutableDictionary alloc] 
initWithContentsOfURL:(__bridge NSURL *)url];
+            
+            // if we don't have a URL, show something useful (this is 
multivalued, but it uses the fallback case)
+            NSArray *whereFrom = [mdItem objectForKey:(NSString 
*)kMDItemWhereFroms];
+            if ([whereFrom count] == 0)
+                [mdItem setObject:@"No URL" forKey:(NSString 
*)kMDItemWhereFroms];
+            
+            NSDate *date = [mdItem 
objectForKey:@"net_sourceforge_bibdesk_publicationdate"];
+            if (date) {
+                NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
+                [formatter setDateStyle:NSDateFormatterLongStyle];
+                NSString *dateString = [formatter stringFromDate:date];
+                if (dateString)
+                    [mdItem setObject:dateString 
forKey:@"net_sourceforge_bibdesk_publicationdate"];
+            }
+            
+            NSArray *keys = [mdItem allKeys];
+            for (NSString *key in keys) {
+                NSRange r = [string rangeOfString:key 
options:NSLiteralSearch|NSCaseInsensitiveSearch];
+                if (r.length) {
+                    id obj = [mdItem objectForKey:key];
+                    NSString *value = nil;
+                    
+                    if ([key isEqualToString:(__bridge NSString 
*)kMDItemAuthors] && [obj 
respondsToSelector:@selector(componentsJoinedByString:)])
+                        value = [obj componentsJoinedByString:@" and "];
+                    else if ([key isEqualToString:(__bridge NSString 
*)kMDItemEditors] && [obj 
respondsToSelector:@selector(componentsJoinedByString:)])
+                        value = [obj componentsJoinedByString:@" and "];
+                    else if ([key isEqualToString:(__bridge NSString 
*)kMDItemWhereFroms] && [obj respondsToSelector:@selector(lastObject)])
+                        value = [obj lastObject];
+                    else if ([key 
isEqualToString:@"net_sourceforge_bibdesk_owningfilepath"])
+                        value = [[NSURL fileURLWithPath:obj] absoluteString];
+                    
+                    // fallback
+                    if (nil == value)
+                        value = [obj description];
+                    
+                    // now replace this and future occurrences of the string
+                    [string replaceOccurrencesOfString:key withString:value 
options:NSCaseInsensitiveSearch|NSLiteralSearch range:NSMakeRange(r.location, 
[string length] - r.location)];
                 }
             }
-            else {
-                // some other plain text type...
-                CFDataRef data = (CFDataRef)[btString 
dataUsingEncoding:NSUnicodeStringEncoding];
-                // encoding must be a CF encoding
-                NSNumber *encoding = [NSNumber 
numberWithUnsignedInteger:CFStringConvertNSStringEncodingToEncoding(NSUnicodeStringEncoding)];
-                NSDictionary *properties = [[NSDictionary alloc] 
initWithObjectsAndKeys:encoding, kQLPreviewPropertyStringEncodingKey, nil];
-                if (data) {
-                    QLPreviewRequestSetDataRepresentation(preview, data, 
kUTTypePlainText, (CFDictionaryRef)properties);
-                } else {
-                    err = 2;
+                
+            NSDictionary *properties = [[NSDictionary alloc] 
initWithObjectsAndKeys:@"text/html", kQLPreviewPropertyMIMETypeKey, @"utf-8", 
kQLPreviewPropertyTextEncodingNameKey, nil];
+            CFDataRef data = (__bridge CFDataRef)[string 
dataUsingEncoding:NSUTF8StringEncoding];
+            if (nil != data) {
+                QLPreviewRequestSetDataRepresentation(preview, data, 
kUTTypeHTML, (__bridge CFDictionaryRef)properties);
+            } else{
+                err = 1;
+            }
+            
+        } else if (UTTypeEqual(CFSTR("net.sourceforge.bibdesk.bdsksearch"), 
contentTypeUTI)) {
+            
+            NSMutableAttributedString *attributedString = 
[[NSMutableAttributedString alloc] init];
+            NSAttributedString *attrString;
+            
+            NSFont *keyFont = [NSFont userFixedPitchFontOfSize:11.0];
+            NSFont *valueFont = [NSFont userFixedPitchFontOfSize:12.0];
+            NSDictionary *keyAttrs = [NSDictionary 
dictionaryWithObjectsAndKeys:keyFont, NSFontAttributeName, nil];
+            NSDictionary *valueAttrs = [NSDictionary 
dictionaryWithObjectsAndKeys:valueFont, NSFontAttributeName, nil];
+            NSDictionary *dictionary = [NSDictionary 
dictionaryWithContentsOfURL:(__bridge NSURL *)url];
+            NSArray *keys = [NSArray arrayWithObjects:@"name", @"type", 
@"database", @"host", @"port", @"search term", nil];
+            for (NSString *key in keys) {
+                NSString *value = [dictionary objectForKey:key];
+                if (value == nil)
+                    continue;
+                NSMutableString *label = [NSMutableString string];
+                [label appendString:[key capitalizedString]];
+                [label appendString:@":"];
+                while ([label length] < 13)
+                    [label appendString:@" "];
+                value = [value stringByAppendingString:@"\n"];
+                attrString = [[NSAttributedString alloc] initWithString:label 
attributes:keyAttrs];
+                [attributedString appendAttributedString:attrString];
+                attrString = [[NSAttributedString alloc] initWithString:value 
attributes:valueAttrs];
+                [attributedString appendAttributedString:attrString];
+            }
+            
+            [attributedString fixAttributesInRange:NSMakeRange(0, 
[attributedString length])];
+            
+            CFDataRef data = (__bridge CFDataRef)[attributedString 
RTFFromRange:NSMakeRange(0, [attributedString length]) 
documentAttributes:[NSDictionary 
dictionaryWithObjectsAndKeys:NSRTFTextDocumentType, 
NSDocumentTypeDocumentAttribute, nil]];
+            
+            if (data) {
+                QLPreviewRequestSetDataRepresentation(preview, data, 
kUTTypeRTF, NULL);
+            } else {
+                err = 2;
+            }
+            
+        } else if (UTTypeConformsTo(contentTypeUTI, kUTTypePlainText)) {
+            
+            NSStringEncoding usedEncoding;
+            NSString *btString = [[NSString alloc] 
initWithContentsOfURL:(__bridge NSURL *)url usedEncoding:&usedEncoding 
error:NULL];
+            if (nil == btString)
+                btString = [[NSString alloc] initWithContentsOfURL:(__bridge 
NSURL *)url encoding:[NSString defaultCStringEncoding] error:NULL];
+            if (nil == btString)
+                btString = [[NSString alloc] initWithContentsOfURL:(__bridge 
NSURL *)url encoding:NSISOLatin1StringEncoding error:NULL];
+            
+            if (btString) {
+                if (UTTypeEqual(CFSTR("org.tug.tex.bibtex"), contentTypeUTI)) {
+                    CFDataRef data = (__bridge 
CFDataRef)[BDSKSyntaxHighlighter RTFDataWithBibTeXString:btString];
+                    if (data) {
+                        QLPreviewRequestSetDataRepresentation(preview, data, 
kUTTypeRTF, NULL);
+                    } else {
+                        err = 2;
+                    }
                 }
-                [properties release]; 
+                else {
+                    // some other plain text type...
+                    CFDataRef data = (__bridge CFDataRef)[btString 
dataUsingEncoding:NSUnicodeStringEncoding];
+                    // encoding must be a CF encoding
+                    NSNumber *encoding = [NSNumber 
numberWithUnsignedInteger:CFStringConvertNSStringEncodingToEncoding(NSUnicodeStringEncoding)];
+                    NSDictionary *properties = [[NSDictionary alloc] 
initWithObjectsAndKeys:encoding, kQLPreviewPropertyStringEncodingKey, nil];
+                    if (data) {
+                        QLPreviewRequestSetDataRepresentation(preview, data, 
kUTTypePlainText, (__bridge CFDictionaryRef)properties);
+                    } else {
+                        err = 2;
+                    }
+                }
+                
+            } else {
+                err = 3;
             }
-                
-            [btString release];
-        } else {
-            err = 3;
         }
+
     }
-
     
-    [pool release];
-    
     return err;
 }
 

Modified: trunk/QuickLook-BibDesk/GenerateThumbnailForURL.m
===================================================================
--- trunk/QuickLook-BibDesk/GenerateThumbnailForURL.m   2023-12-30 15:50:00 UTC 
(rev 28486)
+++ trunk/QuickLook-BibDesk/GenerateThumbnailForURL.m   2023-12-30 16:41:55 UTC 
(rev 28487)
@@ -62,7 +62,6 @@
     if (conditional == NO || value != nil) {
         NSDictionary *dict = [[NSDictionary alloc] 
initWithObjectsAndKeys:attribute, @"attributeName", value ?: @"", 
@"attributeValue", nil];
         [array addObject:dict];
-        [dict release];
     }
 }
 
@@ -90,8 +89,6 @@
     addDictionariesFromMultivaluedAttribute(values, @"Editors:", [anItem 
valueForKey:(NSString *)kMDItemEditors]);
     addDictionariesFromMultivaluedAttribute(values, @"Keywords:", [anItem 
valueForKey:(NSString *)kMDItemKeywords]);
     
-    [dateFormatter release];
-    
     return values;
 }
 
@@ -128,7 +125,6 @@
             attrString = [[BDSKSyntaxHighlighter 
highlightedStringWithBibTeXString:shortString] mutableCopy];
         else
             attrString = [[NSMutableAttributedString alloc] 
initWithString:shortString];
-        [content release];
     }
     
     if (attrString) {
@@ -153,13 +149,12 @@
         [string appendString:value];
         [string appendString:@"\n"];
         [[attrString mutableString] appendString:string];
-        [string release];
     }
     
     if (attrString) {
         NSFont *fpFont = [NSFont userFixedPitchFontOfSize:_fontSize];
         [attrString addAttribute:NSFontAttributeName value:fpFont 
range:NSMakeRange(0, [attrString length])];
-        NSMutableParagraphStyle *parStyle = [[[NSMutableParagraphStyle alloc] 
init] autorelease];
+        NSMutableParagraphStyle *parStyle = [[NSMutableParagraphStyle alloc] 
init];
         [parStyle setLineSpacing:_lineSpacing];
         [attrString addAttribute:NSParagraphStyleAttributeName value:parStyle 
range:NSMakeRange(0, [attrString length])];
     }
@@ -174,9 +169,8 @@
     NSRect pageRect = NSMakeRect(0, 0, size.width, size.height);
     NSRectFillUsingOperation(pageRect, NSCompositingOperationSourceOver);
     
-    NSURL *iconURL = (NSURL 
*)CFBundleCopyResourceURL(QLThumbnailRequestGetGeneratorBundle(thumbnail), 
CFSTR("FolderPenIcon"), CFSTR("icns"), NULL);
+    NSURL *iconURL = (NSURL 
*)CFBridgingRelease(CFBundleCopyResourceURL(QLThumbnailRequestGetGeneratorBundle(thumbnail),
 CFSTR("FolderPenIcon"), CFSTR("icns"), NULL));
     NSImage *appIcon = [[NSImage alloc] initWithContentsOfURL:iconURL];
-    [iconURL release];
     
     NSRect iconRect = NSZeroRect;
     // draw the icon smaller than the text container
@@ -186,7 +180,6 @@
     iconRect.origin.y = (size.height - iconSize.height) / 2;
     
     [appIcon drawInRect:iconRect fromRect:NSZeroRect 
operation:NSCompositingOperationSourceOver fraction:0.3];
-    [appIcon release];    
 }
 
 // creates a new NSTextStorage/NSLayoutManager/NSTextContainer system suitable 
for drawing in a thread
@@ -200,10 +193,6 @@
     // don't let the layout manager use its threaded layout (see header)
     [lm setBackgroundLayoutEnabled:NO];
     [textStorage addLayoutManager:lm];
-    // retained by layout manager
-    [tc release];
-    // retained by text storage
-    [lm release];
     
     return textStorage;
 }
@@ -244,7 +233,6 @@
         [lm drawGlyphsForGlyphRange:glyphRange atPoint:usedRect.origin];
     }        
     CGContextRestoreGState(ctxt);
-    [textStorage release];    
 }
 
 /*
@@ -276,16 +264,14 @@
 static bool generateThumbnailForTextFile(QLThumbnailRequestRef thumbnail, 
CFURLRef url, bool isBibTeX)
 {
     bool didGenerate = false;
-    NSAutoreleasePool *pool = [NSAutoreleasePool new];
-
-    NSAttributedString *attrString = 
createAttributedStringWithContentsOfURLByGuessingEncoding((NSURL *)url, 
isBibTeX);
-    
-    if (attrString) {
-        drawIconForThumbnailWithAttributedString(thumbnail, attrString, 
_paperSize);
-        [attrString release];
-        didGenerate = true;
+    @autoreleasepool {
+        NSAttributedString *attrString = 
createAttributedStringWithContentsOfURLByGuessingEncoding((__bridge NSURL 
*)url, isBibTeX);
+        
+        if (attrString) {
+            drawIconForThumbnailWithAttributedString(thumbnail, attrString, 
_paperSize);
+            didGenerate = true;
+        }
     }
-    [pool release];
     
     return didGenerate;
 }
@@ -294,19 +280,16 @@
 static bool generateThumbnailForCacheFile(QLThumbnailRequestRef thumbnail, 
CFURLRef url, CGSize maxSize)
 {
     bool didGenerate = false;
-    NSAutoreleasePool *pool = [NSAutoreleasePool new];
-    
-    NSDictionary *dictionary = [NSDictionary 
dictionaryWithContentsOfURL:(NSURL *)url];
-    NSArray *values = createValuesForMetadata(dictionary);
-    NSAttributedString *attrString = createAttributedStringWithItems(values);
-    [values release];
-    
-    if (attrString) {
-        drawIconForThumbnailWithAttributedString(thumbnail, attrString, 
_paperSize);
-        [attrString release];
-        didGenerate = true;
+    @autoreleasepool {
+        NSDictionary *dictionary = [NSDictionary 
dictionaryWithContentsOfURL:(__bridge NSURL *)url];
+        NSArray *values = createValuesForMetadata(dictionary);
+        NSAttributedString *attrString = 
createAttributedStringWithItems(values);
+        
+        if (attrString) {
+            drawIconForThumbnailWithAttributedString(thumbnail, attrString, 
_paperSize);
+            didGenerate = true;
+        }
     }
-    [pool release];
     
     return didGenerate;
 }
@@ -315,19 +298,16 @@
 static bool generateThumbnailForSearchFile(QLThumbnailRequestRef thumbnail, 
CFURLRef url, CGSize maxSize)
 {
     bool didGenerate = false;
-    NSAutoreleasePool *pool = [NSAutoreleasePool new];
-    
-    NSDictionary *dictionary = [NSDictionary 
dictionaryWithContentsOfURL:(NSURL *)url];
-    NSArray *values = createValuesForSearch(dictionary);
-    NSAttributedString *attrString = createAttributedStringWithItems(values);
-    [values release];
-    
-    if (attrString) {
-        drawIconForThumbnailWithAttributedString(thumbnail, attrString, 
_paperSize);
-        [attrString release];
-        didGenerate = true;
+    @autoreleasepool {
+        NSDictionary *dictionary = [NSDictionary 
dictionaryWithContentsOfURL:(__bridge NSURL *)url];
+        NSArray *values = createValuesForSearch(dictionary);
+        NSAttributedString *attrString = 
createAttributedStringWithItems(values);
+        
+        if (attrString) {
+            drawIconForThumbnailWithAttributedString(thumbnail, attrString, 
_paperSize);
+            didGenerate = true;
+        }
     }
-    [pool release];
     
     return didGenerate;
 }
@@ -350,7 +330,7 @@
     /* fallback case: draw the file icon using Icon Services */
     if (false == didGenerate) {
         
-        NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:[(NSURL 
*)url path]];
+        NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:[(__bridge 
NSURL *)url path]];
         CGFloat size = MIN(maxSize.width, maxSize.height);
         NSRect drawFrame = NSMakeRect(0.0, 0.0, size, size);
         CGRect cgrect = *(CGRect *)&drawFrame;

Modified: trunk/QuickLook-BibDesk/QuickLook-BibDesk.xcodeproj/project.pbxproj
===================================================================
--- trunk/QuickLook-BibDesk/QuickLook-BibDesk.xcodeproj/project.pbxproj 
2023-12-30 15:50:00 UTC (rev 28486)
+++ trunk/QuickLook-BibDesk/QuickLook-BibDesk.xcodeproj/project.pbxproj 
2023-12-30 16:41:55 UTC (rev 28487)
@@ -257,6 +257,7 @@
                2CA3261F0896AD4900168862 /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               CLANG_ENABLE_OBJC_ARC = YES;
                                COMBINE_HIDPI_IMAGES = YES;
                                COPY_PHASE_STRIP = NO;
                                GCC_DYNAMIC_NO_PIC = NO;
@@ -276,6 +277,7 @@
                2CA326200896AD4900168862 /* Release */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
+                               CLANG_ENABLE_OBJC_ARC = YES;
                                COMBINE_HIDPI_IMAGES = YES;
                                GCC_DEBUGGING_SYMBOLS = full;
                                GCC_MODEL_TUNING = G5;

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

Reply via email to