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

Jacques Lucke noreply at git.blender.org
Sat Mar 7 16:24:15 CET 2020


Commit: 7c08cd508addf7572faedb0380fde149662aa06f
Author: Jacques Lucke
Date:   Sat Mar 7 12:21:10 2020 +0100
Branches: blenloader-api
https://developer.blender.org/rB7c08cd508addf7572faedb0380fde149662aa06f

improve naming

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

M	source/blender/blenloader/BLO_readfile.h
M	source/blender/blenloader/BLO_writefile.h
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c

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

diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index df1d9bc3d1f..e0466cfaccb 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -176,10 +176,10 @@ struct BlendThumbnail *BLO_thumbnail_from_file(const char *filepath);
 extern const struct bTheme U_theme_default;
 extern const struct UserDef U_default;
 
-typedef struct BloReadData BloReadData;
+typedef struct BloReader BloReader;
 
-void *BLO_read_new_address(BloReadData *rd, const void *old_address);
-bool BLO_read_requires_endian_switch(BloReadData *rd);
+void *BLO_read_new_address(BloReader *reader, const void *old_address);
+bool BLO_read_requires_endian_switch(BloReader *reader);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h
index db29ea5e5c0..18c410bc416 100644
--- a/source/blender/blenloader/BLO_writefile.h
+++ b/source/blender/blenloader/BLO_writefile.h
@@ -40,26 +40,26 @@ extern bool BLO_write_file_mem(struct Main *mainvar,
                                struct MemFile *current,
                                int write_flags);
 
-typedef struct BloWriteData BloWriteData;
+typedef struct BloWriter BloWriter;
 
-void BLO_write_data(BloWriteData *wd, const void *data_ptr, int length);
-void BLO_write_struct_by_name(BloWriteData *wd, const char *struct_name, const void *data_ptr);
-void BLO_write_struct_array_by_name(BloWriteData *wd,
+void BLO_write_data(BloWriter *writer, const void *data_ptr, int length);
+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,
                                     const void *data_ptr,
                                     int array_size);
-void BLO_write_struct_by_id(BloWriteData *wd, int struct_id, const void *data_ptr);
-void BLO_write_struct_array_by_id(BloWriteData *wd,
+void BLO_write_struct_by_id(BloWriter *writer, int struct_id, const void *data_ptr);
+void BLO_write_struct_array_by_id(BloWriter *writer,
                                   int struct_id,
                                   const void *data_ptr,
                                   int array_size);
 
-int BLO_get_struct_id_by_name(BloWriteData *wd, const char *struct_name);
-#define BLO_get_struct_id(wd, struct_name) BLO_get_struct_id_by_name(wd, ##struct_name)
+int BLO_get_struct_id_by_name(BloWriter *writer, const char *struct_name);
+#define BLO_get_struct_id(writer, struct_name) BLO_get_struct_id_by_name(writer, ##struct_name)
 
-#define BLO_write_struct(wd, struct_name, data_ptr) \
-  BLO_write_struct_by_id(wd, BLO_get_struct_id(struct_name), data_ptr)
-#define BLO_write_struct_array(wd, struct_name, data_ptr, array_size) \
-  BLO_write_struct_array_by_id(wd, BLO_get_struct_id(struct_name), data_ptr, array_size)
+#define BLO_write_struct(writer, struct_name, data_ptr) \
+  BLO_write_struct_by_id(writer, BLO_get_struct_id(struct_name), data_ptr)
+#define BLO_write_struct_array(writer, struct_name, data_ptr, array_size) \
+  BLO_write_struct_array_by_id(writer, BLO_get_struct_id(struct_name), data_ptr, array_size)
 
 #endif
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index bdf10977b6f..3deae368ee0 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -11879,14 +11879,14 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
   BKE_main_free(main_newid);
 }
 
-void *BLO_read_new_address(BloReadData *rd, const void *old_address)
+void *BLO_read_new_address(BloReader *reader, const void *old_address)
 {
-  return newdataadr((FileData *)rd, old_address);
+  return newdataadr((FileData *)reader, old_address);
 }
 
-bool BLO_read_requires_endian_switch(BloReadData *rd)
+bool BLO_read_requires_endian_switch(BloReader *reader)
 {
-  return (((FileData *)rd)->flags & FD_FLAGS_SWITCH_ENDIAN) != 0;
+  return (((FileData *)reader)->flags & FD_FLAGS_SWITCH_ENDIAN) != 0;
 }
 
 /** \} */
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 49b920debc0..14cb8c6b2c3 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -4173,42 +4173,42 @@ bool BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int w
   return (err == 0);
 }
 
-void BLO_write_data(BloWriteData *wd, const void *data_ptr, int length)
+void BLO_write_data(BloWriter *writer, const void *data_ptr, int length)
 {
-  writedata((WriteData *)wd, DATA, length, data_ptr);
+  writedata((WriteData *)writer, DATA, length, data_ptr);
 }
 
-void BLO_write_struct_by_name(BloWriteData *wd, const char *struct_name, const void *data_ptr)
+void BLO_write_struct_by_name(BloWriter *writer, const char *struct_name, const void *data_ptr)
 {
-  int struct_id = BLO_get_struct_id_by_name(wd, struct_name);
-  BLO_write_struct_by_id(wd, struct_id, data_ptr);
+  int struct_id = BLO_get_struct_id_by_name(writer, struct_name);
+  BLO_write_struct_by_id(writer, struct_id, data_ptr);
 }
 
-void BLO_write_struct_array_by_name(BloWriteData *wd,
+void BLO_write_struct_array_by_name(BloWriter *writer,
                                     const char *struct_name,
                                     const void *data_ptr,
                                     int array_size)
 {
-  int struct_id = BLO_get_struct_id_by_name(wd, struct_name);
-  BLO_write_struct_array_by_id(wd, struct_id, data_ptr, array_size);
+  int struct_id = BLO_get_struct_id_by_name(writer, struct_name);
+  BLO_write_struct_array_by_id(writer, struct_id, data_ptr, array_size);
 }
 
-void BLO_write_struct_by_id(BloWriteData *wd, int struct_id, const void *data_ptr)
+void BLO_write_struct_by_id(BloWriter *writer, int struct_id, const void *data_ptr)
 {
-  writestruct_nr((WriteData *)wd, DATA, struct_id, 1, data_ptr);
+  writestruct_nr((WriteData *)writer, DATA, struct_id, 1, data_ptr);
 }
 
-void BLO_write_struct_array_by_id(BloWriteData *wd,
+void BLO_write_struct_array_by_id(BloWriter *writer,
                                   int struct_id,
                                   const void *data_ptr,
                                   int array_size)
 {
-  writestruct_nr((WriteData *)wd, DATA, struct_id, array_size, data_ptr);
+  writestruct_nr((WriteData *)writer, DATA, struct_id, array_size, data_ptr);
 }
 
-int BLO_get_struct_id_by_name(BloWriteData *wd, const char *struct_name)
+int BLO_get_struct_id_by_name(BloWriter *writer, const char *struct_name)
 {
-  int struct_id = DNA_struct_find_nr(((WriteData *)wd)->sdna, struct_name);
+  int struct_id = DNA_struct_find_nr(((WriteData *)writer)->sdna, struct_name);
   BLI_assert(struct_id >= 0);
   return struct_id;
 }



More information about the Bf-blender-cvs mailing list