Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFalk David <falkdavid@gmx.de>2020-09-12 13:17:47 +0300
committerFalk David <falkdavid@gmx.de>2020-09-12 13:17:47 +0300
commitc00523aca49d7e6d3aadf1e4a230ae8fb67044cc (patch)
tree5e5cb8fd566b75726241a20bf229f989e6f46367 /source/blender/blenkernel/intern/packedFile.c
parent8156e948042a464ca40ca78c946874340a8421f4 (diff)
parent269ceb666b01b8cddbfb5babddf38546a41eba39 (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.c28
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);
+ }
+}