Revision: 28704
http://sourceforge.net/p/bibdesk/svn/28704
Author: hofman
Date: 2024-02-08 10:16:35 +0000 (Thu, 08 Feb 2024)
Log Message:
-----------
encode bytes for image description bitmap data. Allocate decoded bytes using
custom allocator.
Modified Paths:
--------------
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageDescription.m
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageDescription.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageDescription.m
2024-02-07 23:52:20 UTC (rev 28703)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVCGImageDescription.m
2024-02-08 10:16:35 UTC (rev 28704)
@@ -125,12 +125,10 @@
[aCoder encodeObject:_colorSpaceDescription
forKey:@"_colorSpaceDescription"];
if (_bitmapPtr) {
- CFDataRef data =
CFDataCreateWithBytesNoCopy(CFAllocatorGetDefault(), _bitmapPtr,
_bitmapPtrSize, NULL);
- [aCoder encodeObject:(__bridge NSData *)data
forKey:@"_bitmapData"];
- CFRelease(data);
+ [aCoder encodeBytes:(const uint8_t *)_bitmapPtr
length:_bitmapPtrSize forKey:@"_bitmapData"];
}
else {
- [aCoder encodeObject:(__bridge NSData *)_bitmapData
forKey:@"_bitmapData"];
+ [aCoder encodeBytes:(const uint8_t *)CFDataGetBytePtr(_bitmapData)
length:CFDataGetLength(_bitmapData) forKey:@"_bitmapData"];
}
[aCoder encodeBytes:(const uint8_t *)_decode length:[self
_decodeLength] forKey:@"_decode"];
@@ -174,11 +172,18 @@
_shouldInterpolate = [aDecoder
decodeIntegerForKey:@"_shouldInterpolate"];
_renderingIntent = (CGColorRenderingIntent)[aDecoder
decodeIntegerForKey:@"_renderingIntent"];
_colorSpaceDescription = [aDecoder
decodeObjectForKey:@"_colorSpaceDescription"];
- _bitmapData = (CFDataRef)CFBridgingRetain([aDecoder
decodeObjectForKey:@"_bitmapData"]);
-
+
+ NSUInteger len;
+ const uint8_t dataBytes = [aDecoder
decodeBytesForKey:@"_bitmapData" returnedLength:&len];
+ UInt8 *data = NULL;
+ if (len > 0) {
+ data = (UInt8 *)CFAllocatorAllocate(FVAllocatorGetDefault(),
len * sizeof(UInt8), 0);
+ memcpy(data, dataBytes, len);
+ }
+ _bitmapData = CFDataCreateWithBytesNoCopy(CFAllocatorGetDefault(),
data, len, FVAllocatorGetDefault());
+
_image = NULL;
- NSUInteger len;
const CGFloat *decode = (CGFloat *)[aDecoder
decodeBytesForKey:@"_decode" returnedLength:&len];
if (len > 0) {
_decode = NSZoneCalloc(NULL, len, sizeof(char));
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