[Bf-blender-cvs] [f9e4086b045] blenloader-api: write raw array utility

Jacques Lucke noreply at git.blender.org
Sat Mar 7 19:09:27 CET 2020


Commit: f9e4086b045e5abf2316bff114188db2501efbc3
Author: Jacques Lucke
Date:   Sat Mar 7 16:53:35 2020 +0100
Branches: blenloader-api
https://developer.blender.org/rBf9e4086b045e5abf2316bff114188db2501efbc3

write raw array utility

===================================================================

M	source/blender/blenloader/BLO_callback_api.h
M	source/blender/modifiers/intern/MOD_hook.c

===================================================================

diff --git a/source/blender/blenloader/BLO_callback_api.h b/source/blender/blenloader/BLO_callback_api.h
index 5257ca0ef33..faae9e157b1 100644
--- a/source/blender/blenloader/BLO_callback_api.h
+++ b/source/blender/blenloader/BLO_callback_api.h
@@ -12,6 +12,9 @@ typedef struct BloReader BloReader;
  **********************************************/
 
 void BLO_write_raw(BloWriter *writer, int size_in_bytes, const void *data_ptr);
+#define BLO_write_raw_array(writer, element_size, length, data_ptr) \
+  BLO_write_raw(writer, (element_size) * (length), data_ptr)
+
 void BLO_write_struct_by_name(BloWriter *writer, const char *struct_name, const void *data_ptr);
 void BLO_write_struct_array_by_name(BloWriter *writer,
                                     const char *struct_name,
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index 78a7bbe8450..89c9e03e512 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -131,7 +131,7 @@ static void bloWrite(BloWriter *writer, const ModifierData *md)
   if (hmd->curfalloff) {
     BKE_curvemapping_blo_write_ptr(writer, hmd->curfalloff);
   }
-  BLO_write_raw(writer, sizeof(int) * hmd->totindex, hmd->indexar);
+  BLO_write_raw_array(writer, sizeof(int), hmd->totindex, hmd->indexar);
 }
 
 struct HookData_cb {



More information about the Bf-blender-cvs mailing list