[Bf-blender-cvs] [7a5da6a16ca] blenloader-api: improve naming

Jacques Lucke noreply at git.blender.org
Sun Mar 8 12:39:28 CET 2020


Commit: 7a5da6a16ca9adc7700bbf8e69cd4d4548345ca1
Author: Jacques Lucke
Date:   Sun Mar 8 12:03:13 2020 +0100
Branches: blenloader-api
https://developer.blender.org/rB7a5da6a16ca9adc7700bbf8e69cd4d4548345ca1

improve naming

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

M	source/blender/blenkernel/intern/colortools.c
M	source/blender/blenkernel/intern/curveprofile.c
M	source/blender/blenkernel/intern/pointcache.c
M	source/blender/blenloader/BLO_callback_api.h
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/modifiers/intern/MOD_bevel.c
M	source/blender/modifiers/intern/MOD_cloth.c
M	source/blender/modifiers/intern/MOD_dynamicpaint.c
M	source/blender/modifiers/intern/MOD_hook.c
M	source/blender/modifiers/intern/MOD_meshdeform.c
M	source/blender/modifiers/intern/MOD_particlesystem.c
M	source/blender/modifiers/intern/MOD_surfacedeform.c
M	source/blender/modifiers/intern/MOD_warp.c
M	source/blender/modifiers/intern/MOD_weightvgedit.c

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

diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index f2d4548091a..082022946c6 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -198,7 +198,7 @@ void BKE_curvemapping_blo_read_struct(struct BloReader *reader, struct CurveMapp
   cumap->flag &= ~CUMA_PREMULLED;
 
   for (int i = 0; i < CM_TOT; i++) {
-    BLO_read_update_address(reader, cumap->cm[i].curve);
+    BLO_read_data_address(reader, cumap->cm[i].curve);
     cumap->cm[i].table = NULL;
     cumap->cm[i].premultable = NULL;
   }
diff --git a/source/blender/blenkernel/intern/curveprofile.c b/source/blender/blenkernel/intern/curveprofile.c
index 62427294ba1..9bbc4496370 100644
--- a/source/blender/blenkernel/intern/curveprofile.c
+++ b/source/blender/blenkernel/intern/curveprofile.c
@@ -1081,7 +1081,7 @@ void BKE_curveprofile_blo_write_ptr(BloWriter *writer, const CurveProfile *profi
 
 void BKE_curveprofile_blo_read_struct(BloReader *reader, CurveProfile *profile)
 {
-  BLO_read_update_address(reader, profile->path);
+  BLO_read_data_address(reader, profile->path);
   profile->table = NULL;
   profile->segments = NULL;
 }
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index d2d3a893d35..85e8b2f11d1 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -3410,7 +3410,7 @@ static void file_read_pointcache_cb(BloReader *reader, void *data)
   PTCacheExtra *extra;
   int i;
   for (i = 0; i < BPHYS_TOT_DATA; i++) {
-    BLO_read_update_address(reader, pm->data[i]);
+    BLO_read_data_address(reader, pm->data[i]);
 
     /* the cache saves non-struct data without DNA */
     if (pm->data[i] && ptcache_data_struct[i][0] == '\0' &&
@@ -3427,7 +3427,7 @@ static void file_read_pointcache_cb(BloReader *reader, void *data)
   BLO_read_list(reader, &pm->extradata, NULL);
 
   for (extra = pm->extradata.first; extra; extra = extra->next) {
-    BLO_read_update_address(reader, extra->data);
+    BLO_read_data_address(reader, extra->data);
   }
 }
 
@@ -3464,11 +3464,11 @@ void BKE_ptcache_blo_read(struct BloReader *reader,
       }
     }
 
-    BLO_read_update_address(reader, *ocache);
+    BLO_read_data_address(reader, *ocache);
   }
   else if (*ocache) {
     /* old "single" caches need to be linked too */
-    BLO_read_update_address(reader, *ocache);
+    BLO_read_data_address(reader, *ocache);
     file_read_pointcache(reader, *ocache);
     if (force_disk) {
       (*ocache)->flag |= PTCACHE_DISK_CACHE;
diff --git a/source/blender/blenloader/BLO_callback_api.h b/source/blender/blenloader/BLO_callback_api.h
index d408f69665c..280c83f81f0 100644
--- a/source/blender/blenloader/BLO_callback_api.h
+++ b/source/blender/blenloader/BLO_callback_api.h
@@ -43,27 +43,27 @@ void BLO_write_float3_array(BloWriter *writer, int size, const float *data_ptr);
 /* API for file reading.
  **********************************************/
 
-void *BLO_read_new_address(BloReader *reader, const void *old_address);
+void *BLO_read_get_new_data_address(BloReader *reader, const void *old_address);
 bool BLO_read_requires_endian_switch(BloReader *reader);
-#define BLO_read_update_address(reader, ptr) ptr = BLO_read_new_address(reader, ptr)
+#define BLO_read_data_address(reader, ptr) ptr = BLO_read_get_new_data_address(reader, ptr)
 
-typedef void (*BloLinkListFn)(BloReader *reader, void *data);
-void BLO_read_list(BloReader *reader, struct ListBase *list, BloLinkListFn callback);
+typedef void (*BloReadListFn)(BloReader *reader, void *data);
+void BLO_read_list(BloReader *reader, struct ListBase *list, BloReadListFn callback);
 
 #define BLO_read_int32_array(reader, array_size, ptr) \
-  BLO_read_update_address(reader, ptr); \
+  BLO_read_data_address(reader, ptr); \
   if (BLO_read_requires_endian_switch(reader)) { \
     BLI_endian_switch_int32_array((int32_t *)ptr, array_size); \
   }
 
 #define BLO_read_uint32_array(reader, array_size, ptr) \
-  BLO_read_update_address(reader, ptr); \
+  BLO_read_data_address(reader, ptr); \
   if (BLO_read_requires_endian_switch(reader)) { \
     BLI_endian_switch_uint32_array((uint32_t *)ptr, array_size); \
   }
 
 #define BLO_read_float_array(reader, array_size, ptr) \
-  BLO_read_update_address(reader, ptr); \
+  BLO_read_data_address(reader, ptr); \
   if (BLO_read_requires_endian_switch(reader)) { \
     BLI_endian_switch_float_array((float *)ptr, array_size); \
   }
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index becd57c63d6..ac5989f37ab 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -709,6 +709,11 @@ static BloReader *wrap_reader(FileData *fd)
   return (BloReader *)fd;
 }
 
+static FileData *unwrap_reader(BloReader *reader)
+{
+  return (FileData *)reader;
+}
+
 static void switch_endian_bh4(BHead4 *bhead)
 {
   /* the ID_.. codes */
@@ -11547,19 +11552,19 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
   BKE_main_free(main_newid);
 }
 
-void *BLO_read_new_address(BloReader *reader, const void *old_address)
+void *BLO_read_get_new_data_address(BloReader *reader, const void *old_address)
 {
-  return newdataadr((FileData *)reader, old_address);
+  return newdataadr(unwrap_reader(reader), old_address);
 }
 
 bool BLO_read_requires_endian_switch(BloReader *reader)
 {
-  return (((FileData *)reader)->flags & FD_FLAGS_SWITCH_ENDIAN) != 0;
+  return (unwrap_reader(reader)->flags & FD_FLAGS_SWITCH_ENDIAN) != 0;
 }
 
-void BLO_read_list(BloReader *reader, struct ListBase *list, BloLinkListFn callback)
+void BLO_read_list(BloReader *reader, struct ListBase *list, BloReadListFn callback)
 {
-  link_list_ex((FileData *)reader, list, (link_list_cb)callback);
+  link_list_ex(unwrap_reader(reader), list, (link_list_cb)callback);
 }
 
 /** \} */
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 6b9bec6a326..fa974b7a0da 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -389,6 +389,11 @@ static BloWriter *wrap_writer(WriteData *wd)
   return (BloWriter *)wd;
 }
 
+static WriteData *unwrap_writer(BloWriter *writer)
+{
+  return (WriteData *)writer;
+}
+
 /** \} */
 
 /* -------------------------------------------------------------------- */
@@ -4015,7 +4020,7 @@ bool BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int w
 
 void BLO_write_raw(BloWriter *writer, int size_in_bytes, const void *data_ptr)
 {
-  writedata((WriteData *)writer, DATA, size_in_bytes, data_ptr);
+  writedata(unwrap_writer(writer), DATA, size_in_bytes, data_ptr);
 }
 
 void BLO_write_struct_by_name(BloWriter *writer, const char *struct_name, const void *data_ptr)
@@ -4035,7 +4040,7 @@ void BLO_write_struct_array_by_name(BloWriter *writer,
 
 void BLO_write_struct_by_id(BloWriter *writer, int struct_id, const void *data_ptr)
 {
-  writestruct_nr((WriteData *)writer, DATA, struct_id, 1, data_ptr);
+  writestruct_nr(unwrap_writer(writer), DATA, struct_id, 1, data_ptr);
 }
 
 void BLO_write_struct_array_by_id(BloWriter *writer,
@@ -4043,12 +4048,12 @@ void BLO_write_struct_array_by_id(BloWriter *writer,
                                   int array_size,
                                   const void *data_ptr)
 {
-  writestruct_nr((WriteData *)writer, DATA, struct_id, array_size, data_ptr);
+  writestruct_nr(unwrap_writer(writer), DATA, struct_id, array_size, data_ptr);
 }
 
 int BLO_get_struct_id_by_name(BloWriter *writer, const char *struct_name)
 {
-  int struct_id = DNA_struct_find_nr(((WriteData *)writer)->sdna, struct_name);
+  int struct_id = DNA_struct_find_nr(unwrap_writer(writer)->sdna, struct_name);
   BLI_assert(struct_id >= 0);
   return struct_id;
 }
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index f9e6890294a..565db85bf4c 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -276,7 +276,7 @@ static void bloWrite(BloWriter *writer, const ModifierData *md)
 static void bloRead(BloReader *reader, ModifierData *md)
 {
   BevelModifierData *bmd = (BevelModifierData *)md;
-  BLO_read_update_address(reader, bmd->custom_profile);
+  BLO_read_data_address(reader, bmd->custom_profile);
   if (bmd->custom_profile) {
     BKE_curveprofile_blo_read_struct(reader, bmd->custom_profile);
   }
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index f7061b153af..3045aae2fbf 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -268,8 +268,8 @@ static void bloRead(BloReader *reader, ModifierData *md)
   clmd->clothObject = NULL;
   clmd->hairdata = NULL;
 
-  BLO_read_update_address(reader, clmd->sim_parms);
-  BLO_read_update_address(reader, clmd->coll_parms);
+  BLO_read_data_address(reader, clmd->sim_parms);
+  BLO_read_data_address(reader, clmd->coll_parms);
 
   BKE_ptcache_blo_read(reader, &clmd->ptcaches, &clmd->point_cache, 0);
 
@@ -280,7 +280,7 @@ static void bloRead(BloReader *reader, ModifierData *md)
 
     clmd->sim_parms->reset = 0;
 
-    BLO_read_update_address(reader, clmd->sim_parms->effector_weights);
+    BLO_read_data_address(reader, clmd->sim_parms->effector_weights);
 
     if (clmd->sim_parms->effector_weights == NULL) {
       clmd->sim_parms->effector_weights = BKE_effector_add_weights(NULL);
diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c
index 076266048b2..c10039b5113 100644
--- a/source/blender/modifiers/intern/MOD_dynamicpaint.c
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -134,7 +134,7 @@ static void bloRead(BloReader *reader, ModifierData *md)
   DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
 
   if (pmd->canvas) {
-    BLO_read_update_address(reader, pmd->canvas);
+    BLO_read_data_address(reader, pmd->canvas);
     pmd->canvas->pmd = pmd;
     pmd->canv

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list