• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

作図ソフト dia の改良版


Commit MetaInfo

Révision980f70c22321d31c10b6c68fae0931cba5ec2a60 (tree)
l'heure2014-10-04 18:43:25
AuteurHans Breuer <hans@breu...>
CommiterHans Breuer

Message de Log

[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]

g_vprintf(format, args);
~

And followup warnings of the fix:

object.c:1109:49: warning: more '%' conversions than data arguments [-Wformat]

"%s: Object %p has illegal type name %p (%s)\n",
~

object.c:1118:45: warning: format specifies type 'char *' but the argument has

type 'const DiaObject *' (aka 'const struct _DiaObject *') [-Wformat]
"%s: Object %p has null handles\n", obj);

object.c:1118:22: warning: more '%' conversions than data arguments [-Wformat]

"%s: Object %p has null handles\n", obj);
~

Change Summary

Modification

--- a/lib/debug.c
+++ b/lib/debug.c
@@ -32,7 +32,8 @@
3232 * @return val
3333 */
3434 gboolean
35-dia_assert_true(gboolean val, gchar *format, ...) {
35+dia_assert_true(gboolean val, const gchar *format, ...)
36+{
3637 va_list args;
3738 if (!val) {
3839 va_start(args, format);
--- a/lib/debug.h
+++ b/lib/debug.h
@@ -25,7 +25,8 @@
2525
2626 #include <stdio.h>
2727 #include <stdarg.h>
28+#include <glib.h>
2829
29-gboolean dia_assert_true(gboolean val, gchar *format, ...);
30+gboolean dia_assert_true(gboolean val, const gchar *format, ...) G_GNUC_PRINTF(2,3);
3031
3132 #endif
--- a/lib/object.c
+++ b/lib/object.c
@@ -1106,7 +1106,7 @@ dia_object_sanity_check(const DiaObject *obj, const gchar *msg) {
11061106 if (obj != NULL) {
11071107 dia_assert_true(obj->type->name != NULL &&
11081108 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",
11101110 msg, obj, obj->type->name);
11111111 /* Check the position vs. the bounding box */
11121112 /* Check the handles */
@@ -1115,7 +1115,7 @@ dia_object_sanity_check(const DiaObject *obj, const gchar *msg) {
11151115 msg, obj, obj->num_handles);
11161116 if (obj->num_handles != 0) {
11171117 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);
11191119 }
11201120 for (i = 0; i < obj->num_handles; i++) {
11211121 Handle *h = obj->handles[i];