diff options
author | Jacques Lucke <jacques@blender.org> | 2020-08-28 17:57:28 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-08-28 17:57:34 +0300 |
commit | 62e2d92aed25fe4da91ed380719ec341b3e0074b (patch) | |
tree | 3356b28b91edd7de43dfb5ad5edbbf56e9a91547 | |
parent | 5086bdfe0bb69c8841b81f5f867acd5626038622 (diff) |
Blenloader: add api function for accessing packedfile address map
This is needed to move direct_link_packedfile out of readfile.c for T76372.
-rw-r--r-- | source/blender/blenloader/BLO_read_write.h | 3 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/blenloader/BLO_read_write.h b/source/blender/blenloader/BLO_read_write.h index ff3a82f708a..c2f3615725e 100644 --- a/source/blender/blenloader/BLO_read_write.h +++ b/source/blender/blenloader/BLO_read_write.h @@ -177,9 +177,12 @@ bool BLO_write_is_undo(BlendWriter *writer); */ void *BLO_read_get_new_data_address(BlendDataReader *reader, const void *old_address); +void *BLO_read_get_new_packed_address(BlendDataReader *reader, const void *old_address); #define BLO_read_data_address(reader, ptr_p) \ *((void **)ptr_p) = BLO_read_get_new_data_address((reader), *(ptr_p)) +#define BLO_read_packed_address(reader, ptr_p) \ + *((void **)ptr_p) = BLO_read_get_new_packed_address((reader), *(ptr_p)) typedef void (*BlendReadListFn)(BlendDataReader *reader, void *data); void BLO_read_list_cb(BlendDataReader *reader, struct ListBase *list, BlendReadListFn callback); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index e9dcd5dddae..84cb898a426 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2631,12 +2631,12 @@ static void direct_link_paint_curve(BlendDataReader *reader, PaintCurve *pc) /** \name Read PackedFile * \{ */ -static PackedFile *direct_link_packedfile(BlendDataReader *reader, PackedFile *oldpf) +static PackedFile *direct_link_packedfile(BlendDataReader *reader, PackedFile *pf) { - PackedFile *pf = newpackedadr(reader->fd, oldpf); + BLO_read_packed_address(reader, &pf); if (pf) { - pf->data = newpackedadr(reader->fd, pf->data); + 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. */ @@ -11089,6 +11089,11 @@ void *BLO_read_get_new_data_address(BlendDataReader *reader, const void *old_add return newdataadr(reader->fd, old_address); } +void *BLO_read_get_new_packed_address(BlendDataReader *reader, const void *old_address) +{ + return newpackedadr(reader->fd, old_address); +} + ID *BLO_read_get_new_id_address(BlendLibReader *reader, Library *lib, ID *id) { return newlibadr(reader->fd, lib, id); |