[pygobject] Fix some warnings



commit 769645e00d6d055a4cd802454dbfc1bbfcbee691
Author: Simon van der Linden <svdlinden gnome org>
Date:   Thu Aug 12 14:11:55 2010 +0200

    Fix some warnings
    
    pyglib.c: In function â??pyglib_gerror_exception_checkâ??:
    pyglib.c:362: warning: format not a string literal and no format arguments
    pyglib.c:371: warning: format not a string literal and no format arguments
    
    gio.override: In function 'pygio_notify_allocate_buffer':
    gio.override:144:13: warning: format '%d' expects type 'int', but argument 3
    has type 'gsize'
    
    https://bugzilla.gnome.org/show_bug.cgi?id=625437

 gio/gio.override |    2 +-
 glib/pyglib.c    |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gio/gio.override b/gio/gio.override
index a2f4dda..7fdcb1c 100644
--- a/gio/gio.override
+++ b/gio/gio.override
@@ -141,7 +141,7 @@ pygio_notify_allocate_buffer(PyGIONotify *notify, gsize buffer_size)
     if (buffer_size > 0) {
         notify->buffer = g_slice_alloc(buffer_size);
         if (!notify->buffer) {
-            PyErr_Format(PyExc_MemoryError, "failed to allocate %d bytes", buffer_size);
+            PyErr_Format(PyExc_MemoryError, "failed to allocate %" G_GSIZE_FORMAT " bytes", buffer_size);
             return FALSE;
         }
 
diff --git a/glib/pyglib.c b/glib/pyglib.c
index a1bdbb9..01da551 100644
--- a/glib/pyglib.c
+++ b/glib/pyglib.c
@@ -359,7 +359,7 @@ pyglib_gerror_exception_check(GError **error)
     }
 
     g_set_error(error, g_quark_from_string(_PyUnicode_AsString(py_domain)),
-                _PyLong_AsLong(py_code), _PyUnicode_AsString(py_message));
+                _PyLong_AsLong(py_code), "%s", _PyUnicode_AsString(py_message));
 
     Py_DECREF(py_message);
     Py_DECREF(py_code);
@@ -368,7 +368,7 @@ pyglib_gerror_exception_check(GError **error)
 
 bad_gerror:
     Py_DECREF(value);
-    g_set_error(error, g_quark_from_static_string("pyglib"), 0, bad_gerror_message);
+    g_set_error(error, g_quark_from_static_string("pyglib"), 0, "%s", bad_gerror_message);
     PyErr_SetString(PyExc_ValueError, bad_gerror_message);
     PyErr_Print();
     return -2;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]