bool QuickLookDocumentData::decode(IPC::ArgumentDecoder& decoder, QuickLookDocumentData& documentData) { uint64_t size; if (!decoder.decode(size)) return false; if (!size) return true; uint8_t* const buffer = static_cast<uint8_t*>(CFAllocatorAllocate(kCFAllocatorDefault, size, 0)); ASSERT(buffer); if (!decoder.decodeFixedLengthData(buffer, size, 1)) { CFAllocatorDeallocate(kCFAllocatorDefault, buffer); return false; } documentData.clear(); documentData.m_data.append(adoptCF(CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, buffer, size, kCFAllocatorDefault))); return true; }