diff options
author | Falk David <falkdavid@gmx.de> | 2020-09-12 13:17:47 +0300 |
---|---|---|
committer | Falk David <falkdavid@gmx.de> | 2020-09-12 13:17:47 +0300 |
commit | c00523aca49d7e6d3aadf1e4a230ae8fb67044cc (patch) | |
tree | 5e5cb8fd566b75726241a20bf229f989e6f46367 /source/blender/blenkernel/intern/packedFile.c | |
parent | 8156e948042a464ca40ca78c946874340a8421f4 (diff) | |
parent | 269ceb666b01b8cddbfb5babddf38546a41eba39 (diff) |
Merge branch 'greasepencil-edit-curve' into soc-2020-greasepencil-curvesoc-2020-greasepencil-curve
Diffstat (limited to 'source/blender/blenkernel/intern/packedFile.c')
-rw-r--r-- | source/blender/blenkernel/intern/packedFile.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 6793f5e1169..ac3686a021b 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -51,6 +51,8 @@ #include "BKE_sound.h" #include "BKE_volume.h" +#include "BLO_read_write.h" + int BKE_packedfile_seek(PackedFile *pf, int offset, int whence) { int oldseek = -1, seek = 0; @@ -852,3 +854,29 @@ void BKE_packedfile_id_unpack(Main *bmain, ID *id, ReportList *reports, enum ePF break; } } + +void BKE_packedfile_blend_write(BlendWriter *writer, PackedFile *pf) +{ + if (pf == NULL) { + return; + } + BLO_write_struct(writer, PackedFile, pf); + BLO_write_raw(writer, pf->size, pf->data); +} + +void BKE_packedfile_blend_read(BlendDataReader *reader, PackedFile **pf_p) +{ + BLO_read_packed_address(reader, pf_p); + PackedFile *pf = *pf_p; + if (pf == NULL) { + return; + } + + BLO_read_packed_address(reader, &pf->data); + if (pf->data == NULL) { + /* We cannot allow a PackedFile with a NULL data field, + * the whole code assumes this is not possible. See T70315. */ + printf("%s: NULL packedfile data, cleaning up...\n", __func__); + MEM_SAFE_FREE(pf); + } +} |