/*! * \brief Constructs the cpio archive * * \note The output data is dynamically allocated. It should be `free()`'d * when it is no longer needed. * * \param cpio CCpioFile object * \param data Output data * \param size Size of output data * * \return true on success or false on failure and error set appropriately * * \sa CpioFile::createData() */ bool mbp_cpiofile_create_data(CCpioFile *cpio, unsigned char **data, size_t *size) { CAST(cpio); std::vector<unsigned char> vData; if (cf->createData(&vData)) { vector_to_data(vData, reinterpret_cast<void **>(data), size); return true; } else { return false; } }
/*! * \brief Constructs the boot image binary data * * \note The output data is dynamically allocated. It should be free()'d * when it is no longer needed. * * \param bootImage CBootImage object * \param data Output data * \param size Size of output data * * \sa BootImage::create() */ bool mbp_bootimage_create_data(const CBootImage *bootImage, unsigned char **data, size_t *size) { CCAST(bootImage); std::vector<unsigned char> vData; if (bi->create(&vData)) { vector_to_data(vData, reinterpret_cast<void **>(data), size); return true; } else { return false; } }
/*! * \brief Constructs the boot image binary data * * \note The output data is dynamically allocated. It should be free()'d * when it is no longer needed. * * \param bootImage CBootImage object * \param data Output data * \param size Size of output data * * \sa BootImage::create() */ void mbp_bootimage_create_data(const CBootImage *bootImage, void **data, size_t *size) { CCAST(bootImage); std::vector<unsigned char> vData = bi->create(); vector_to_data(vData, data, size); }