Looking through the documentation for CFDataRef I can’t see anything that will compress a CFDataRef after it has been created. For example, in my code I do something like this:
CFIndex byteSize = GetExportByteSize();
const UInt8 *exportData = GetExportDataPtr();
CFDataRef dataRef = CFDataCreate(kCFAllocatorDefault, exportData, byteSize);
CFDictionarySetValue(dict, kAS_ExportDataKey, dataRef);
Basically, I’m creating a CFDataRef from a chunk of memory that is about 2MB in size. Doesn’t sound like much but in practice for this application it is too much data.
Is it possible to compress the CFDataRef object after creation? Or might it be better to compress the raw data it points to first?
zlib.his one option.How much time do you want to spend developing this? How well can the data structure’s size be reduced using what you know of the input data? Is the implementation in zlib (or another lib) unacceptable?