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:
authorCampbell Barton <ideasman42@gmail.com>2019-07-07 17:06:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-07-07 17:17:40 +0300
commit1357dd7d3cf2d0cb5c574fa518136a4654869493 (patch)
tree90da62d31f81cafc549e5ab224e1536c569297e7
parent084d545202c27fda5117817491c8d5761b4daafc (diff)
Cleanup: move enum unto BKE_packedFile.h
Use enum type for functions arguments. Removed -1 check in switch statement, this isn't needed.
-rw-r--r--source/blender/blenkernel/BKE_packedFile.h30
-rw-r--r--source/blender/blenkernel/intern/packedFile.c26
-rw-r--r--source/blender/makesdna/DNA_packedFile_types.h16
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c3
-rw-r--r--source/blender/makesrna/intern/rna_packedfile.c2
-rw-r--r--source/blender/makesrna/intern/rna_sound_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_vfont_api.c4
7 files changed, 49 insertions, 36 deletions
diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h
index 9eeb2ba076e..00a241c259a 100644
--- a/source/blender/blenkernel/BKE_packedFile.h
+++ b/source/blender/blenkernel/BKE_packedFile.h
@@ -33,6 +33,22 @@ struct ReportList;
struct VFont;
struct bSound;
+enum ePF_FileStatus {
+ PF_EQUAL = 0,
+ PF_DIFFERS = 1,
+ PF_NOFILE = 2,
+
+ PF_WRITE_ORIGINAL = 3,
+ PF_WRITE_LOCAL = 4,
+ PF_USE_LOCAL = 5,
+ PF_USE_ORIGINAL = 6,
+ PF_KEEP = 7,
+ PF_REMOVE = 8,
+ PF_NOOP = 9,
+
+ PF_ASK = 10,
+};
+
/* pack */
struct PackedFile *BKE_packedfile_duplicate(const struct PackedFile *pf_src);
struct PackedFile *BKE_packedfile_new(struct ReportList *reports,
@@ -49,20 +65,22 @@ char *BKE_packedfile_unpack_to_file(struct ReportList *reports,
const char *abs_name,
const char *local_name,
struct PackedFile *pf,
- int how);
+ enum ePF_FileStatus how);
int BKE_packedfile_unpack_vfont(struct Main *bmain,
struct ReportList *reports,
struct VFont *vfont,
- int how);
+ enum ePF_FileStatus how);
int BKE_packedfile_unpack_sound(struct Main *bmain,
struct ReportList *reports,
struct bSound *sound,
- int how);
+ enum ePF_FileStatus 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);
+ enum ePF_FileStatus how);
+void BKE_packedfile_unpack_all(struct Main *bmain,
+ struct ReportList *reports,
+ enum ePF_FileStatus how);
int BKE_packedfile_unpack_all_libraries(struct Main *bmain, struct ReportList *reports);
int BKE_packedfile_write_to_file(struct ReportList *reports,
@@ -91,6 +109,6 @@ bool BKE_packedfile_id_check(struct ID *id);
void BKE_packedfile_id_unpack(struct Main *bmain,
struct ID *id,
struct ReportList *reports,
- int how);
+ enum ePF_FileStatus how);
#endif
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index d4deb6ee7e5..966bee03b78 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -145,7 +145,7 @@ void BKE_packedfile_free(PackedFile *pf)
MEM_freeN(pf);
}
else {
- printf("BKE_packedfile_free: Trying to free a NULL pointer\n");
+ printf("%s: Trying to free a NULL pointer\n", __func__);
}
}
@@ -416,14 +416,13 @@ char *BKE_packedfile_unpack_to_file(ReportList *reports,
const char *abs_name,
const char *local_name,
PackedFile *pf,
- int how)
+ enum ePF_FileStatus how)
{
char *newname = NULL;
const char *temp = NULL;
if (pf != NULL) {
switch (how) {
- case -1:
case PF_KEEP:
break;
case PF_REMOVE:
@@ -469,7 +468,7 @@ char *BKE_packedfile_unpack_to_file(ReportList *reports,
}
break;
default:
- printf("BKE_packedfile_unpack_to_file: unknown return_value %d\n", how);
+ printf("%s: unknown return_value %u\n", __func__, how);
break;
}
@@ -526,7 +525,10 @@ static void unpack_generate_paths(const char *name,
}
}
-int BKE_packedfile_unpack_vfont(Main *bmain, ReportList *reports, VFont *vfont, int how)
+int BKE_packedfile_unpack_vfont(Main *bmain,
+ ReportList *reports,
+ VFont *vfont,
+ enum ePF_FileStatus how)
{
char localname[FILE_MAX], absname[FILE_MAX];
char *newname;
@@ -549,7 +551,10 @@ int BKE_packedfile_unpack_vfont(Main *bmain, ReportList *reports, VFont *vfont,
return (ret_value);
}
-int BKE_packedfile_unpack_sound(Main *bmain, ReportList *reports, bSound *sound, int how)
+int BKE_packedfile_unpack_sound(Main *bmain,
+ ReportList *reports,
+ bSound *sound,
+ enum ePF_FileStatus how)
{
char localname[FILE_MAX], absname[FILE_MAX];
char *newname;
@@ -576,7 +581,10 @@ int BKE_packedfile_unpack_sound(Main *bmain, ReportList *reports, bSound *sound,
return (ret_value);
}
-int BKE_packedfile_unpack_image(Main *bmain, ReportList *reports, Image *ima, int how)
+int BKE_packedfile_unpack_image(Main *bmain,
+ ReportList *reports,
+ Image *ima,
+ enum ePF_FileStatus how)
{
int ret_value = RET_ERROR;
@@ -680,7 +688,7 @@ void BKE_packedfile_pack_all_libraries(Main *bmain, ReportList *reports)
}
}
-void BKE_packedfile_unpack_all(Main *bmain, ReportList *reports, int how)
+void BKE_packedfile_unpack_all(Main *bmain, ReportList *reports, enum ePF_FileStatus how)
{
Image *ima;
VFont *vf;
@@ -732,7 +740,7 @@ bool BKE_packedfile_id_check(ID *id)
}
/* ID should be not NULL */
-void BKE_packedfile_id_unpack(Main *bmain, ID *id, ReportList *reports, int how)
+void BKE_packedfile_id_unpack(Main *bmain, ID *id, ReportList *reports, enum ePF_FileStatus how)
{
switch (GS(id->name)) {
case ID_IM: {
diff --git a/source/blender/makesdna/DNA_packedFile_types.h b/source/blender/makesdna/DNA_packedFile_types.h
index a8afa667158..8196e3098eb 100644
--- a/source/blender/makesdna/DNA_packedFile_types.h
+++ b/source/blender/makesdna/DNA_packedFile_types.h
@@ -30,20 +30,4 @@ typedef struct PackedFile {
void *data;
} PackedFile;
-enum ePF_FileStatus {
- PF_EQUAL = 0,
- PF_DIFFERS = 1,
- PF_NOFILE = 2,
-
- PF_WRITE_ORIGINAL = 3,
- PF_WRITE_LOCAL = 4,
- PF_USE_LOCAL = 5,
- PF_USE_ORIGINAL = 6,
- PF_KEEP = 7,
- PF_REMOVE = 8,
- PF_NOOP = 9,
-
- PF_ASK = 10,
-};
-
#endif /* PACKEDFILE_TYPES_H */
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index 0db099e3e1d..d167c650683 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -36,13 +36,14 @@
#include "RNA_define.h"
#include "RNA_enum_types.h"
+#include "BKE_packedFile.h"
+
#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
# include <errno.h>
# include "BKE_image.h"
-# include "BKE_packedFile.h"
# include "BKE_main.h"
# include "IMB_imbuf.h"
diff --git a/source/blender/makesrna/intern/rna_packedfile.c b/source/blender/makesrna/intern/rna_packedfile.c
index 0b1b48b1bd3..dda1c637f39 100644
--- a/source/blender/makesrna/intern/rna_packedfile.c
+++ b/source/blender/makesrna/intern/rna_packedfile.c
@@ -27,6 +27,8 @@
#include "RNA_define.h"
#include "RNA_enum_types.h"
+#include "BKE_packedFile.h"
+
#include "rna_internal.h"
const EnumPropertyItem rna_enum_unpack_method_items[] = {
diff --git a/source/blender/makesrna/intern/rna_sound_api.c b/source/blender/makesrna/intern/rna_sound_api.c
index 1482a08b893..2be0ed966f1 100644
--- a/source/blender/makesrna/intern/rna_sound_api.c
+++ b/source/blender/makesrna/intern/rna_sound_api.c
@@ -26,12 +26,12 @@
#include "RNA_define.h"
#include "RNA_enum_types.h"
+#include "BKE_packedFile.h"
+
#include "rna_internal.h"
#ifdef RNA_RUNTIME
-# include "BKE_packedFile.h"
-
static void rna_Sound_pack(bSound *sound, Main *bmain, ReportList *reports)
{
sound->packedfile = BKE_packedfile_new(reports, sound->name, ID_BLEND_PATH(bmain, &sound->id));
diff --git a/source/blender/makesrna/intern/rna_vfont_api.c b/source/blender/makesrna/intern/rna_vfont_api.c
index bdd73bbb3a6..a85dde5d8b1 100644
--- a/source/blender/makesrna/intern/rna_vfont_api.c
+++ b/source/blender/makesrna/intern/rna_vfont_api.c
@@ -26,12 +26,12 @@
#include "RNA_define.h"
#include "RNA_enum_types.h"
+#include "BKE_packedFile.h"
+
#include "rna_internal.h"
#ifdef RNA_RUNTIME
-# include "BKE_packedFile.h"
-
static void rna_VectorFont_pack(VFont *vfont, Main *bmain, ReportList *reports)
{
vfont->packedfile = BKE_packedfile_new(reports, vfont->name, ID_BLEND_PATH(bmain, &vfont->id));