作図ソフト dia の改良版
Révision | 980f70c22321d31c10b6c68fae0931cba5ec2a60 (tree) |
---|---|
l'heure | 2014-10-04 18:43:25 |
Auteur | Hans Breuer <hans@breu...> |
Commiter | Hans Breuer |
[warningectomy] format string is not a string literal
Now also fix dia_assert_true() declaration and use.
debug.c:39:15: warning: format string is not a string literal [-Wformat-nonliteral]
And followup warnings of the fix:
object.c:1109:49: warning: more '%' conversions than data arguments [-Wformat]
object.c:1118:45: warning: format specifies type 'char *' but the argument has
object.c:1118:22: warning: more '%' conversions than data arguments [-Wformat]
@@ -32,7 +32,8 @@ | ||
32 | 32 | * @return val |
33 | 33 | */ |
34 | 34 | gboolean |
35 | -dia_assert_true(gboolean val, gchar *format, ...) { | |
35 | +dia_assert_true(gboolean val, const gchar *format, ...) | |
36 | +{ | |
36 | 37 | va_list args; |
37 | 38 | if (!val) { |
38 | 39 | va_start(args, format); |
@@ -25,7 +25,8 @@ | ||
25 | 25 | |
26 | 26 | #include <stdio.h> |
27 | 27 | #include <stdarg.h> |
28 | +#include <glib.h> | |
28 | 29 | |
29 | -gboolean dia_assert_true(gboolean val, gchar *format, ...); | |
30 | +gboolean dia_assert_true(gboolean val, const gchar *format, ...) G_GNUC_PRINTF(2,3); | |
30 | 31 | |
31 | 32 | #endif |
@@ -1106,7 +1106,7 @@ dia_object_sanity_check(const DiaObject *obj, const gchar *msg) { | ||
1106 | 1106 | if (obj != NULL) { |
1107 | 1107 | dia_assert_true(obj->type->name != NULL && |
1108 | 1108 | g_utf8_validate(obj->type->name, -1, NULL), |
1109 | - "%s: Object %p has illegal type name %p (%s)\n", | |
1109 | + "%s: Object %p has illegal type name '%s'\n", | |
1110 | 1110 | msg, obj, obj->type->name); |
1111 | 1111 | /* Check the position vs. the bounding box */ |
1112 | 1112 | /* Check the handles */ |
@@ -1115,7 +1115,7 @@ dia_object_sanity_check(const DiaObject *obj, const gchar *msg) { | ||
1115 | 1115 | msg, obj, obj->num_handles); |
1116 | 1116 | if (obj->num_handles != 0) { |
1117 | 1117 | dia_assert_true(obj->handles != NULL, |
1118 | - "%s: Object %p has null handles\n", obj); | |
1118 | + "%s: Object %p has null handles\n", msg, obj); | |
1119 | 1119 | } |
1120 | 1120 | for (i = 0; i < obj->num_handles; i++) { |
1121 | 1121 | Handle *h = obj->handles[i]; |