Revision: 28708
          http://sourceforge.net/p/bibdesk/svn/28708
Author:   hofman
Date:     2024-02-08 18:54:53 +0000 (Thu, 08 Feb 2024)
Log Message:
-----------
return NSData from function

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageCache.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageCache.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageCache.m  2024-02-08 
18:26:20 UTC (rev 28707)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageCache.m  2024-02-08 
18:54:53 UTC (rev 28708)
@@ -44,7 +44,7 @@
 #import <pthread.h>
 
 static CGImageRef FVCreateCGImageWithData(NSData *data);
-static CFDataRef FVCreateDataWithCGImage(CGImageRef image);
+static NSData *FVCreateDataWithCGImage(CGImageRef image);
 
 @implementation FVCGImageCache
 
@@ -104,7 +104,7 @@
 
 - (void)cacheImage:(CGImageRef)image forKey:(id)aKey;
 {
-    NSData *data = (NSData *)CFBridgingRelease(FVCreateDataWithCGImage(image));
+    NSData *data = FVCreateDataWithCGImage(image);
     [_cacheFile saveData:data forKey:aKey];
 }
 
@@ -189,16 +189,17 @@
     return toReturn;
 }
 
-static CFDataRef FVCreateDataWithCGImage(CGImageRef image)
+static NSData *FVCreateDataWithCGImage(CGImageRef image)
 {
+    NSData *data = nil;
 #if USE_IMAGEIO
-    CFMutableDataRef data = CFDataCreateMutable(CFAllocatorGetDefault(), 0);
-    CGImageDestinationRef dest = CGImageDestinationCreateWithData(data, 
IMAGEIO_TYPE, 1, NULL);
+    CFMutableDataRef mdata = CFDataCreateMutable(CFAllocatorGetDefault(), 0);
+    CGImageDestinationRef dest = CGImageDestinationCreateWithData(mdata, 
IMAGEIO_TYPE, 1, NULL);
     CGImageDestinationAddImage(dest, image, NULL);
     CGImageDestinationFinalize(dest);
     if (dest) CFRelease(dest);
+    data = (NSData *)CFBridgingRelease(mdata);
 #else
-    CFDataRef data = nil;
     FVCGImageDescription *imageDescription = [[FVCGImageDescription alloc] 
initWithImage:image];
     
     // do not call setLength:, even before writing the archive!
@@ -209,7 +210,7 @@
     [archiver encodeObject:imageDescription];
     [archiver finishEncoding];
     
-    data = (CFDataRef)CFBridgingRetain(mdata);
+    data = mdata;
 #endif    
     return data;
 }

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