diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-01 07:26:01 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-01 07:32:43 +0300 |
commit | c1ae12bf5e3dd77e1b814869dcb5766a0a51d594 (patch) | |
tree | b9de3a7dab39bbc8a6050398e1b25e6d1e5352b2 /source/blender/blenloader/intern/readfile.c | |
parent | 2c317457cbf2407c6fea136624ec5324a92b28ab (diff) |
Cleanup: dna_genfile API for accessing struct member offsets
- Rename `find_elem` to `elem_offset` (matching `elem_exists`).
- Remove unused `SDNA_StructMember` return argument.
- Return an offset instead of a pointer which was being converted
back into an offset by one caller,
in this case there was no way to tell the difference between
and element that doesn't exist and a struct member
at the start of the array.
Resolves UBSan warning raised in T81340.
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 5a995b3d750..ed35b5c5f8f 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1118,6 +1118,7 @@ static bool read_file_dna(FileData *fd, const char **r_error_message) fd->filesdna, fd->memsdna, fd->compflags); /* used to retrieve ID names from (bhead+1) */ fd->id_name_offs = DNA_elem_offset(fd->filesdna, "ID", "char", "name[]"); + BLI_assert(fd->id_name_offs != -1); return true; } |