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/BLO_read_write.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/BLO_read_write.h')
-rw-r--r--source/blender/blenloader/BLO_read_write.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenloader/BLO_read_write.h b/source/blender/blenloader/BLO_read_write.h
index 8a6811444af..e3ba7480b18 100644
--- a/source/blender/blenloader/BLO_read_write.h
+++ b/source/blender/blenloader/BLO_read_write.h
@@ -143,13 +143,13 @@ void blo_write_id_struct(BlendWriter *writer,
blo_write_id_struct(writer, BLO_get_struct_id(writer, struct_name), id_address, id)
/* Write raw data. */
-void BLO_write_raw(BlendWriter *writer, int size_in_bytes, const void *data_ptr);
-void BLO_write_int32_array(BlendWriter *writer, int size, const int32_t *data_ptr);
-void BLO_write_uint32_array(BlendWriter *writer, int size, const uint32_t *data_ptr);
-void BLO_write_float_array(BlendWriter *writer, int size, const float *data_ptr);
-void BLO_write_float3_array(BlendWriter *writer, int size, const float *data_ptr);
-void BLO_write_pointer_array(BlendWriter *writer, int size, const void *data_ptr);
-void BLO_write_string(BlendWriter *writer, const char *str);
+void BLO_write_raw(BlendWriter *writer, size_t size_in_bytes, const void *data_ptr);
+void BLO_write_int32_array(BlendWriter *writer, uint num, const int32_t *data_ptr);
+void BLO_write_uint32_array(BlendWriter *writer, uint num, const uint32_t *data_ptr);
+void BLO_write_float_array(BlendWriter *writer, uint num, const float *data_ptr);
+void BLO_write_float3_array(BlendWriter *writer, uint num, const float *data_ptr);
+void BLO_write_pointer_array(BlendWriter *writer, uint num, const void *data_ptr);
+void BLO_write_string(BlendWriter *writer, const char *data_ptr);
/* Misc. */
bool BLO_write_is_undo(BlendWriter *writer);