[Bf-blender-cvs] [084d545202c] master: Cleanup: use BKE_packedfile prefix for function names

Campbell Barton noreply at git.blender.org
Sun Jul 7 16:19:51 CEST 2019


Commit: 084d545202c27fda5117817491c8d5761b4daafc
Author: Campbell Barton
Date:   Sun Jul 7 23:57:35 2019 +1000
Branches: master
https://developer.blender.org/rB084d545202c27fda5117817491c8d5761b4daafc

Cleanup: use BKE_packedfile prefix for function names

Avoid ambiguity with terms check & compare.

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

M	source/blender/blenkernel/BKE_packedFile.h
M	source/blender/blenkernel/intern/font.c
M	source/blender/blenkernel/intern/image.c
M	source/blender/blenkernel/intern/library.c
M	source/blender/blenkernel/intern/packedFile.c
M	source/blender/blenkernel/intern/sound.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/sound/sound_ops.c
M	source/blender/editors/space_image/image_ops.c
M	source/blender/editors/space_info/info_ops.c
M	source/blender/editors/util/ed_util.c
M	source/blender/makesrna/intern/rna_image_api.c
M	source/blender/makesrna/intern/rna_sound_api.c
M	source/blender/makesrna/intern/rna_vfont_api.c
M	source/blender/windowmanager/intern/wm_files.c

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

diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h
index ad0f474a730..9eeb2ba076e 100644
--- a/source/blender/blenkernel/BKE_packedFile.h
+++ b/source/blender/blenkernel/BKE_packedFile.h
@@ -34,49 +34,63 @@ struct VFont;
 struct bSound;
 
 /* pack */
-struct PackedFile *dupPackedFile(const struct PackedFile *pf_src);
-struct PackedFile *newPackedFile(struct ReportList *reports,
-                                 const char *filename,
-                                 const char *relabase);
-struct PackedFile *newPackedFileMemory(void *mem, int memlen);
+struct PackedFile *BKE_packedfile_duplicate(const struct PackedFile *pf_src);
+struct PackedFile *BKE_packedfile_new(struct ReportList *reports,
+                                      const char *filename,
+                                      const char *relabase);
+struct PackedFile *BKE_packedfile_new_from_memory(void *mem, int memlen);
 
-void packAll(struct Main *bmain, struct ReportList *reports, bool verbose);
-void packLibraries(struct Main *bmain, struct ReportList *reports);
+void BKE_packedfile_pack_all(struct Main *bmain, struct ReportList *reports, bool verbose);
+void BKE_packedfile_pack_all_libraries(struct Main *bmain, struct ReportList *reports);
 
 /* unpack */
-char *unpackFile(struct ReportList *reports,
-                 const char *ref_file_name,
-                 const char *abs_name,
-                 const char *local_name,
-                 struct PackedFile *pf,
-                 int how);
-int unpackVFont(struct Main *bmain, struct ReportList *reports, struct VFont *vfont, int how);
-int unpackSound(struct Main *bmain, struct ReportList *reports, struct bSound *sound, int how);
-int unpackImage(struct Main *bmain, struct ReportList *reports, struct Image *ima, int how);
-void unpackAll(struct Main *bmain, struct ReportList *reports, int how);
-int unpackLibraries(struct Main *bmain, struct ReportList *reports);
+char *BKE_packedfile_unpack_to_file(struct ReportList *reports,
+                                    const char *ref_file_name,
+                                    const char *abs_name,
+                                    const char *local_name,
+                                    struct PackedFile *pf,
+                                    int how);
+int BKE_packedfile_unpack_vfont(struct Main *bmain,
+                                struct ReportList *reports,
+                                struct VFont *vfont,
+                                int how);
+int BKE_packedfile_unpack_sound(struct Main *bmain,
+                                struct ReportList *reports,
+                                struct bSound *sound,
+                                int how);
+int BKE_packedfile_unpack_image(struct Main *bmain,
+                                struct ReportList *reports,
+                                struct Image *ima,
+                                int how);
+void BKE_packedfile_unpack_all(struct Main *bmain, struct ReportList *reports, int how);
+int BKE_packedfile_unpack_all_libraries(struct Main *bmain, struct ReportList *reports);
 
-int writePackedFile(struct ReportList *reports,
-                    const char *ref_file_name,
-                    const char *filename,
-                    struct PackedFile *pf,
-                    const bool guimode);
+int BKE_packedfile_write_to_file(struct ReportList *reports,
+                                 const char *ref_file_name,
+                                 const char *filename,
+                                 struct PackedFile *pf,
+                                 const bool guimode);
 
 /* free */
-void freePackedFile(struct PackedFile *pf);
+void BKE_packedfile_free(struct PackedFile *pf);
 
 /* info */
-int countPackedFiles(struct Main *bmain);
-int checkPackedFile(const char *ref_file_name, const char *filename, struct PackedFile *pf);
+int BKE_packedfile_count_all(struct Main *bmain);
+int BKE_packedfile_compare_to_file(const char *ref_file_name,
+                                   const char *filename,
+                                   struct PackedFile *pf);
 
 /* read */
-int seekPackedFile(struct PackedFile *pf, int offset, int whence);
-void rewindPackedFile(struct PackedFile *pf);
-int readPackedFile(struct PackedFile *pf, void *data, int size);
+int BKE_packedfile_seek(struct PackedFile *pf, int offset, int whence);
+void BKE_packedfile_rewind(struct PackedFile *pf);
+int BKE_packedfile_read(struct PackedFile *pf, void *data, int size);
 
 /* ID should be not NULL, return 1 if there's a packed file */
-bool BKE_pack_check(struct ID *id);
+bool BKE_packedfile_id_check(struct ID *id);
 /* ID should be not NULL, throws error when ID is Library */
-void BKE_unpack_id(struct Main *bmain, struct ID *id, struct ReportList *reports, int how);
+void BKE_packedfile_id_unpack(struct Main *bmain,
+                              struct ID *id,
+                              struct ReportList *reports,
+                              int how);
 
 #endif
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 3f8fc697c6c..a0216e9b413 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -86,7 +86,7 @@ void BKE_vfont_free_data(struct VFont *vfont)
   }
 
   if (vfont->temp_pf) {
-    freePackedFile(vfont->temp_pf); /* NULL when the font file can't be found on disk */
+    BKE_packedfile_free(vfont->temp_pf); /* NULL when the font file can't be found on disk */
     vfont->temp_pf = NULL;
   }
 }
@@ -97,7 +97,7 @@ void BKE_vfont_free(struct VFont *vf)
   BKE_vfont_free_data(vf);
 
   if (vf->packedfile) {
-    freePackedFile(vf->packedfile);
+    BKE_packedfile_free(vf->packedfile);
     vf->packedfile = NULL;
   }
 }
@@ -114,7 +114,7 @@ void BKE_vfont_copy_data(Main *UNUSED(bmain),
   vfont_dst->temp_pf = NULL;
 
   if (vfont_dst->packedfile) {
-    vfont_dst->packedfile = dupPackedFile(vfont_dst->packedfile);
+    vfont_dst->packedfile = BKE_packedfile_duplicate(vfont_dst->packedfile);
   }
 
   if (vfont_dst->data) {
@@ -148,7 +148,7 @@ static PackedFile *get_builtin_packedfile(void)
 
     memcpy(mem, builtin_font_data, builtin_font_size);
 
-    return newPackedFileMemory(mem, builtin_font_size);
+    return BKE_packedfile_new_from_memory(mem, builtin_font_size);
   }
 }
 
@@ -183,14 +183,15 @@ static VFontData *vfont_get_data(VFont *vfont)
 
         /* We need to copy a tmp font to memory unless it is already there */
         if (vfont->temp_pf == NULL) {
-          vfont->temp_pf = dupPackedFile(pf);
+          vfont->temp_pf = BKE_packedfile_duplicate(pf);
         }
       }
       else {
-        pf = newPackedFile(NULL, vfont->name, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id));
+        pf = BKE_packedfile_new(NULL, vfont->name, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id));
 
         if (vfont->temp_pf == NULL) {
-          vfont->temp_pf = newPackedFile(NULL, vfont->name, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id));
+          vfont->temp_pf = BKE_packedfile_new(
+              NULL, vfont->name, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id));
         }
       }
       if (!pf) {
@@ -208,7 +209,7 @@ static VFontData *vfont_get_data(VFont *vfont)
     if (pf) {
       vfont->data = BLI_vfontdata_from_freetypefont(pf);
       if (pf != vfont->packedfile) {
-        freePackedFile(pf);
+        BKE_packedfile_free(pf);
       }
     }
 
@@ -234,7 +235,7 @@ void BKE_vfont_init(VFont *vfont)
     }
 
     /* Free the packed file */
-    freePackedFile(pf);
+    BKE_packedfile_free(pf);
   }
 }
 
@@ -253,7 +254,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
   }
   else {
     BLI_split_file_part(filepath, filename, sizeof(filename));
-    pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain));
+    pf = BKE_packedfile_new(NULL, filepath, BKE_main_blendfile_path(bmain));
 
     is_builtin = false;
   }
@@ -279,13 +280,13 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath)
 
       /* Do not add FO_BUILTIN_NAME to temporary listbase */
       if (!STREQ(filename, FO_BUILTIN_NAME)) {
-        vfont->temp_pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain));
+        vfont->temp_pf = BKE_packedfile_new(NULL, filepath, BKE_main_blendfile_path(bmain));
       }
     }
 
     /* Free the packed file */
     if (!vfont || vfont->packedfile != pf) {
-      freePackedFile(pf);
+      BKE_packedfile_free(pf);
     }
   }
 
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 72bad56990f..f03ca46b34e 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -198,7 +198,7 @@ static void image_free_packedfiles(Image *ima)
   while (ima->packedfiles.last) {
     ImagePackedFile *imapf = ima->packedfiles.last;
     if (imapf->packedfile) {
-      freePackedFile(imapf->packedfile);
+      BKE_packedfile_free(imapf->packedfile);
     }
     BLI_remlink(&ima->packedfiles, imapf);
     MEM_freeN(imapf);
@@ -377,7 +377,7 @@ static void copy_image_packedfiles(ListBase *lb_dst, const ListBase *lb_src)
     STRNCPY(imapf_dst->filepath, imapf_src->filepath);
 
     if (imapf_src->packedfile) {
-      imapf_dst->packedfile = dupPackedFile(imapf_src->packedfile);
+      imapf_dst->packedfile = BKE_packedfile_duplicate(imapf_src->packedfile);
     }
 
     BLI_addtail(lb_dst, imapf_dst);
@@ -838,7 +838,7 @@ void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath)
   if (totfiles == 1) {
     ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image packed file");
     BLI_addtail(&ima->packedfiles, imapf);
-    imapf->packedfile = newPackedFile(reports, ima->name, basepath);
+    imapf->packedfile = BKE_packedfile_new(reports, ima->name, basepath);
     if (imapf->packedfile) {
       STRNCPY(imapf->filepath, ima->name);
     }
@@ -852,7 +852,7 @@ void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath)
       ImagePackedFile *imapf = MEM_mallocN(sizeof(ImagePackedFile), "Image packed file");
       BLI_addtail(&ima->packedfiles, imapf);
 
-      imapf->packedfile = newPackedFile(reports, iv->fi

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list