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>2010-12-04 14:44:56 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-04 14:44:56 +0300
commit0271ad6322775de43f0c3f790f070b975861aa7d (patch)
tree4c2cc979df62437344d13efa69e50c13ca948d8f /source/blender
parent471d304df1492e95c611b2d5666d7befeac27272 (diff)
Give functions that use printf style formatting GCC format attributes so if incorrect formatting is used the compiler will warn of this.
found & fixed 2x incorrect formatting args.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_modifier.h6
-rw-r--r--source/blender/blenkernel/BKE_report.h6
-rw-r--r--source/blender/blenlib/BLI_dynstr.h6
-rw-r--r--source/blender/blenlib/BLI_string.h12
-rw-r--r--source/blender/makesrna/RNA_access.h12
-rw-r--r--source/blender/makesrna/intern/rna_ID.c2
-rw-r--r--source/blender/makesrna/intern/rna_access.c2
-rw-r--r--source/blender/makesrna/intern/rna_animation.c2
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c8
-rw-r--r--source/blender/makesrna/intern/rna_render.c2
-rw-r--r--source/blender/makesrna/intern/rna_ui.c6
-rw-r--r--source/blender/makesrna/intern/rna_wm.c4
-rw-r--r--source/blender/windowmanager/intern/wm_files.c2
13 files changed, 49 insertions, 21 deletions
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 306debc442c..97bef6ab565 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -294,7 +294,11 @@ int modifier_couldBeCage(struct Scene *scene, struct ModifierData *md)
int modifier_isCorrectableDeformed(struct ModifierData *md);
int modifier_sameTopology(ModifierData *md);
int modifier_isEnabled(struct Scene *scene, struct ModifierData *md, int required_mode);
-void modifier_setError(struct ModifierData *md, const char *format, ...);
+void modifier_setError(struct ModifierData *md, const char *format, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 2, 3)));
+#endif
+;
void modifiers_foreachObjectLink(struct Object *ob,
ObjectWalkFunc walk,
diff --git a/source/blender/blenkernel/BKE_report.h b/source/blender/blenkernel/BKE_report.h
index d7b7801d697..b84808a7ddd 100644
--- a/source/blender/blenkernel/BKE_report.h
+++ b/source/blender/blenkernel/BKE_report.h
@@ -45,7 +45,11 @@ void BKE_reports_init(ReportList *reports, int flag);
void BKE_reports_clear(ReportList *reports);
void BKE_report(ReportList *reports, ReportType type, const char *message);
-void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...);
+void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 3, 4)));
+#endif
+;
void BKE_reports_prepend(ReportList *reports, const char *prepend);
void BKE_reports_prependf(ReportList *reports, const char *prepend, ...);
diff --git a/source/blender/blenlib/BLI_dynstr.h b/source/blender/blenlib/BLI_dynstr.h
index c5158264e72..34e77007d95 100644
--- a/source/blender/blenlib/BLI_dynstr.h
+++ b/source/blender/blenlib/BLI_dynstr.h
@@ -75,7 +75,11 @@ void BLI_dynstr_nappend (DynStr *ds, const char *cstr, int len);
* @param ds The DynStr to append to.
* @param format The printf format string to use.
*/
-void BLI_dynstr_appendf (DynStr *ds, const char *format, ...);
+void BLI_dynstr_appendf (DynStr *ds, const char *format, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 2, 3)));
+#endif
+;
void BLI_dynstr_vappendf (DynStr *ds, const char *format, va_list args);
/**
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 73178cd693f..01ad70c31fb 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -102,13 +102,21 @@ char *BLI_replacestr(char *str, const char *oldText, const char *newText);
/*
* Replacement for snprintf
*/
-int BLI_snprintf(char *buffer, size_t count, const char *format, ...);
+int BLI_snprintf(char *buffer, size_t count, const char *format, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 3, 4)));
+#endif
+;
/*
* Print formatted string into a newly mallocN'd string
* and return it.
*/
-char *BLI_sprintfN(const char *format, ...);
+char *BLI_sprintfN(const char *format, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 1, 2)));
+#endif
+;
/**
* Compare two strings
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index ac8c3229011..333e0d4bd2c 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -928,8 +928,16 @@ void RNA_parameter_length_set_data(ParameterList *parms, PropertyRNA *parm, void
int RNA_function_call(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms);
int RNA_function_call_lookup(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, const char *identifier, ParameterList *parms);
-int RNA_function_call_direct(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, FunctionRNA *func, const char *format, ...);
-int RNA_function_call_direct_lookup(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, ...);
+int RNA_function_call_direct(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, FunctionRNA *func, const char *format, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 5, 6)));
+#endif
+;
+int RNA_function_call_direct_lookup(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 5, 6)));
+#endif
+;
int RNA_function_call_direct_va(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, FunctionRNA *func, const char *format, va_list args);
int RNA_function_call_direct_va_lookup(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, va_list args);
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index bc803415c7c..63a2c5d41d4 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -224,7 +224,7 @@ StructRNA *rna_IDPropertyGroup_register(const bContext *C, ReportList *reports,
* owns the string pointer which it could potentually free while blender
* is running. */
if(strlen(identifier) >= sizeof(((IDProperty *)NULL)->name)) {
- BKE_reportf(reports, RPT_ERROR, "registering id property class: '%s' is too long, maximum length is %d.", identifier, sizeof(((IDProperty *)NULL)->name));
+ BKE_reportf(reports, RPT_ERROR, "registering id property class: '%s' is too long, maximum length is %d.", identifier, (int)sizeof(((IDProperty *)NULL)->name));
return NULL;
}
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 9ec21b13695..77ff78fc9bf 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -3771,7 +3771,7 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
BLI_dynstr_appendf(dynstr, "'%s'", identifier);
}
else {
- BLI_dynstr_appendf(dynstr, "'<UNKNOWN ENUM>'", identifier);
+ BLI_dynstr_append(dynstr, "'<UNKNOWN ENUM>'");
}
break;
}
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 85f070b3162..203f84118d8 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -173,7 +173,7 @@ static StructRNA *rna_KeyingSetInfo_register(const bContext *C, ReportList *repo
return NULL;
if (strlen(identifier) >= sizeof(dummyksi.idname)) {
- BKE_reportf(reports, RPT_ERROR, "registering keying set info class: '%s' is too long, maximum length is %d.", identifier, sizeof(dummyksi.idname));
+ BKE_reportf(reports, RPT_ERROR, "registering keying set info class: '%s' is too long, maximum length is %d.", identifier, (int)sizeof(dummyksi.idname));
return NULL;
}
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 7b49edb9158..dd989d05441 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -962,17 +962,17 @@ static char *rna_VertexGroupElement_path(PointerRNA *ptr)
static char *rna_MeshFace_path(PointerRNA *ptr)
{
- return BLI_sprintfN("faces[%d]", (MFace*)ptr->data - ((Mesh*)ptr->id.data)->mface);
+ return BLI_sprintfN("faces[%d]", (int)((MFace*)ptr->data - ((Mesh*)ptr->id.data)->mface));
}
static char *rna_MeshEdge_path(PointerRNA *ptr)
{
- return BLI_sprintfN("edges[%d]", (MEdge*)ptr->data - ((Mesh*)ptr->id.data)->medge);
+ return BLI_sprintfN("edges[%d]", (int)((MEdge*)ptr->data - ((Mesh*)ptr->id.data)->medge));
}
static char *rna_MeshVertex_path(PointerRNA *ptr)
{
- return BLI_sprintfN("vertices[%d]", (MVert*)ptr->data - ((Mesh*)ptr->id.data)->mvert);
+ return BLI_sprintfN("vertices[%d]", (int)((MVert*)ptr->data - ((Mesh*)ptr->id.data)->mvert));
}
static char *rna_MeshTextureFaceLayer_path(PointerRNA *ptr)
@@ -1015,7 +1015,7 @@ static char *rna_MeshColor_path(PointerRNA *ptr)
static char *rna_MeshSticky_path(PointerRNA *ptr)
{
- return BLI_sprintfN("sticky[%d]", (MSticky*)ptr->data - ((Mesh*)ptr->id.data)->msticky);
+ return BLI_sprintfN("sticky[%d]", (int)((MSticky*)ptr->data - ((Mesh*)ptr->id.data)->msticky));
}
static char *rna_MeshIntPropertyLayer_path(PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index ae965b237cd..800947ac881 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -124,7 +124,7 @@ static StructRNA *rna_RenderEngine_register(const bContext *C, ReportList *repor
return NULL;
if(strlen(identifier) >= sizeof(dummyet.idname)) {
- BKE_reportf(reports, RPT_ERROR, "registering render engine class: '%s' is too long, maximum length is %d.", identifier, sizeof(dummyet.idname));
+ BKE_reportf(reports, RPT_ERROR, "registering render engine class: '%s' is too long, maximum length is %d.", identifier, (int)sizeof(dummyet.idname));
return NULL;
}
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index f2c33f354c2..1275c435158 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -180,7 +180,7 @@ static StructRNA *rna_Panel_register(const bContext *C, ReportList *reports, voi
return NULL;
if(strlen(identifier) >= sizeof(dummypt.idname)) {
- BKE_reportf(reports, RPT_ERROR, "registering panel class: '%s' is too long, maximum length is %d.", identifier, sizeof(dummypt.idname));
+ BKE_reportf(reports, RPT_ERROR, "registering panel class: '%s' is too long, maximum length is %d.", identifier, (int)sizeof(dummypt.idname));
return NULL;
}
@@ -283,7 +283,7 @@ static StructRNA *rna_Header_register(const bContext *C, ReportList *reports, vo
return NULL;
if(strlen(identifier) >= sizeof(dummyht.idname)) {
- BKE_reportf(reports, RPT_ERROR, "registering header class: '%s' is too long, maximum length is %d.", identifier, sizeof(dummyht.idname));
+ BKE_reportf(reports, RPT_ERROR, "registering header class: '%s' is too long, maximum length is %d.", identifier, (int)sizeof(dummyht.idname));
return NULL;
}
@@ -401,7 +401,7 @@ static StructRNA *rna_Menu_register(const bContext *C, ReportList *reports, void
return NULL;
if(strlen(identifier) >= sizeof(dummymt.idname)) {
- BKE_reportf(reports, RPT_ERROR, "registering menu class: '%s' is too long, maximum length is %d.", identifier, sizeof(dummymt.idname));
+ BKE_reportf(reports, RPT_ERROR, "registering menu class: '%s' is too long, maximum length is %d.", identifier, (int)sizeof(dummymt.idname));
return NULL;
}
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 86ad964247f..bf00f625f42 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -854,7 +854,7 @@ static StructRNA *rna_Operator_register(const bContext *C, ReportList *reports,
}
if(strlen(identifier) >= sizeof(dummyop.idname)) {
- BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s' is too long, maximum length is %d.", identifier, sizeof(dummyop.idname));
+ BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s' is too long, maximum length is %d.", identifier, (int)sizeof(dummyop.idname));
return NULL;
}
@@ -924,7 +924,7 @@ static StructRNA *rna_MacroOperator_register(const bContext *C, ReportList *repo
}
if(strlen(identifier) >= sizeof(dummyop.idname)) {
- BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s' is too long, maximum length is %d.", identifier, sizeof(dummyop.idname));
+ BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s' is too long, maximum length is %d.", identifier, (int)sizeof(dummyop.idname));
return NULL;
}
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index c4cd0fe99d6..fe0edf18dd1 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -625,7 +625,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
/* send the OnSave event */
for (li= G.main->library.first; li; li= li->id.next) {
if (strcmp(li->filepath, di) == 0) {
- BKE_reportf(reports, RPT_ERROR, "Can't overwrite used library '%f'", di);
+ BKE_reportf(reports, RPT_ERROR, "Can't overwrite used library '%.200s'", di);
return -1;
}
}