From 5ea1049e7520c0f369d2a76811410b1274699e81 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 20 Sep 2020 18:41:50 +0200 Subject: 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 --- source/blender/blenloader/BLO_undofile.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenloader/BLO_undofile.h') 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); -- cgit v1.2.3