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:
authorBastien Montagne <bastien@blender.org>2020-09-20 19:41:50 +0300
committerBastien Montagne <bastien@blender.org>2020-09-20 19:41:50 +0300
commit5ea1049e7520c0f369d2a76811410b1274699e81 (patch)
tree5d7f5158b8c329b9a7e3b0fa5aa6ac2ce65701a1 /source/blender/blenloader/intern/readfile.h
parent86c5d1f4aa07551b289619da501889a172a39e03 (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/intern/readfile.h')
-rw-r--r--source/blender/blenloader/intern/readfile.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h
index e63b0c1909b..c479e3e589b 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -61,10 +61,10 @@ enum eFileDataFlag {
typedef int64_t off64_t;
#endif
-typedef int(FileDataReadFn)(struct FileData *filedata,
- void *buffer,
- unsigned int size,
- bool *r_is_memchunk_identical);
+typedef ssize_t(FileDataReadFn)(struct FileData *filedata,
+ void *buffer,
+ size_t size,
+ bool *r_is_memchunk_identical);
typedef off64_t(FileDataSeekFn)(struct FileData *filedata, off64_t offset, int whence);
typedef struct FileData {
@@ -72,8 +72,8 @@ typedef struct FileData {
ListBase bhead_list;
enum eFileDataFlag flags;
bool is_eof;
- int buffersize;
- int64_t file_offset;
+ size_t buffersize;
+ off64_t file_offset;
FileDataReadFn *read;
FileDataSeekFn *seek;