diff options
author | Bastien Montagne <bastien@blender.org> | 2020-09-20 19:41:50 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-09-20 19:41:50 +0300 |
commit | 5ea1049e7520c0f369d2a76811410b1274699e81 (patch) | |
tree | 5d7f5158b8c329b9a7e3b0fa5aa6ac2ce65701a1 /source/blender/blenloader/BLO_undofile.h | |
parent | 86c5d1f4aa07551b289619da501889a172a39e03 (diff) |
Sanitize type 'size' parameters in our read/write file code
This patch tries to sanitize the types of our size parameters across our read
and write code, which is currently fairly inconsistent (using `int`, `uint`,
`size_t`...), by using `size_t` everywhere. Since in Blender file themselves
we can only store chunk of size `MAX_INT`, added some asserts to ensure that
as well.
See {T79561} for details.
Differential Revision: https://developer.blender.org/D8672
Diffstat (limited to 'source/blender/blenloader/BLO_undofile.h')
-rw-r--r-- | source/blender/blenloader/BLO_undofile.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenloader/BLO_undofile.h b/source/blender/blenloader/BLO_undofile.h index f5527c13429..17b21096bf3 100644 --- a/source/blender/blenloader/BLO_undofile.h +++ b/source/blender/blenloader/BLO_undofile.h @@ -31,7 +31,7 @@ typedef struct { void *next, *prev; const char *buf; /** Size in bytes. */ - unsigned int size; + size_t size; /** When true, this chunk doesn't own the memory, it's shared with a previous #MemFileChunk */ bool is_identical; /** When true, this chunk is also identical to the one in the next step (used by undo code to @@ -72,7 +72,7 @@ void BLO_memfile_write_init(MemFileWriteData *mem_data, MemFile *reference_memfile); void BLO_memfile_write_finalize(MemFileWriteData *mem_data); -void BLO_memfile_chunk_add(MemFileWriteData *mem_data, const char *buf, unsigned int size); +void BLO_memfile_chunk_add(MemFileWriteData *mem_data, const char *buf, size_t size); /* exports */ extern void BLO_memfile_free(MemFile *memfile); |