summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgnacio Casal Quinteiro <icq@gnome.org>2010-12-23 00:10:41 +0100
committerIgnacio Casal Quinteiro <icq@gnome.org>2010-12-23 00:33:58 +0100
commit0ee58113ecbea72784c52de928c041fc8fc88984 (patch)
treedecec47190d416a4c8f57c7a511f2a0c162c5a5e
parent78ea84cd91392400ebac5a361ef8793bfe928fd0 (diff)
downloadpygobject-0ee58113ecbea72784c52de928c041fc8fc88984.tar.gz
Fix warnings.
-rw-r--r--gi/pygi-argument.c16
-rw-r--r--gi/pygi-foreign-cairo.c13
-rw-r--r--gio/gfile.override5
-rw-r--r--glib/pyglib-python-compat.h3
-rw-r--r--glib/pyglib.c2
-rw-r--r--glib/pygmainloop.c3
6 files changed, 17 insertions, 25 deletions
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index 1479afd7..ec0fd5ff 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -397,7 +397,7 @@ check_number_release:
}
if (size != 1) {
- PyErr_Format (PyExc_TypeError, "Must be a one character string, not %i characters",
+ PyErr_Format (PyExc_TypeError, "Must be a one character string, not %ld characters",
size);
retval = 0;
break;
@@ -721,8 +721,7 @@ _pygi_argument_from_object (PyObject *object,
value = PyInt_AS_LONG (number);
} else
#endif
- if (PyLong_Check (number))
- value = PyLong_AsUnsignedLongLong (number);
+ value = PyLong_AsUnsignedLongLong (number);
arg.v_uint64 = value;
@@ -743,10 +742,9 @@ _pygi_argument_from_object (PyObject *object,
#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check (number)) {
value = PyInt_AS_LONG (number);
- } else
-#endif
- if (PyLong_Check (number))
- value = PyLong_AsLongLong (number);
+ } else
+#endif
+ value = PyLong_AsLongLong (number);
arg.v_int64 = value;
@@ -1348,10 +1346,10 @@ _pygi_argument_to_object (GIArgument *arg,
if (arg->v_uint32 == 0) {
object = PYGLIB_PyUnicode_FromString ("");
} else if (g_unichar_validate (arg->v_uint32)) {
- gchar utf8[7];
+ gchar utf8[6];
gint bytes;
- bytes = g_unichar_to_utf8 (arg->v_uint32, &utf8);
+ bytes = g_unichar_to_utf8 (arg->v_uint32, utf8);
object = PYGLIB_PyUnicode_FromStringAndSize ((char*)utf8, bytes);
} else {
/* TODO: Convert the error to an exception. */
diff --git a/gi/pygi-foreign-cairo.c b/gi/pygi-foreign-cairo.c
index ada59bf7..babe8b4b 100644
--- a/gi/pygi-foreign-cairo.c
+++ b/gi/pygi-foreign-cairo.c
@@ -126,7 +126,7 @@ cairo_surface_release (GIBaseInfo *base_info,
} \
if (l > INT_MAX || l < INT_MIN) { \
Py_DECREF(item); \
- PyErr_Format(PyExc_ValueError, "integer %l is out of range", l); \
+ PyErr_Format(PyExc_ValueError, "integer %ld is out of range", l); \
goto err; \
} \
i = (int)l; \
@@ -213,7 +213,7 @@ PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo")
{
Pycairo_IMPORT;
if (Pycairo_CAPI == NULL)
- return 0;
+ return PYGLIB_MODULE_ERROR_RETURN;
pygi_register_foreign_struct ("cairo",
"Context",
@@ -226,14 +226,5 @@ PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo")
cairo_surface_to_arg,
cairo_surface_from_arg,
cairo_surface_release);
-
-#ifdef PycairoRectangleInt_FromRectangleInt
- pygi_register_foreign_struct ("cairo",
- "RectangleInt",
- cairo_rectangle_int_to_arg,
- cairo_rectangle_int_from_arg,
- cairo_rectangle_int_release);
-#endif
-
}
PYGLIB_MODULE_END;
diff --git a/gio/gfile.override b/gio/gfile.override
index b50130cc..13019638 100644
--- a/gio/gfile.override
+++ b/gio/gfile.override
@@ -840,7 +840,7 @@ _wrap_g_file_set_attribute(PyGObject *self, PyObject *args, PyObject *kwargs)
static char *kwlist[] = { "attribute", "type", "value_p",
"flags", "cancellable", NULL };
GFileQueryInfoFlags flags = G_FILE_QUERY_INFO_NONE;
- int ret;
+ int ret = 0;
GCancellable *cancellable = NULL;
GError *error = NULL;
char *attribute;
@@ -883,7 +883,7 @@ _wrap_g_file_set_attribute(PyGObject *self, PyObject *args, PyObject *kwargs)
&error);
}
break;
-
+
case G_FILE_ATTRIBUTE_TYPE_BYTE_STRING:
{
char* s;
@@ -902,7 +902,6 @@ _wrap_g_file_set_attribute(PyGObject *self, PyObject *args, PyObject *kwargs)
&error);
}
break;
-
case G_FILE_ATTRIBUTE_TYPE_STRINGV:
{
diff --git a/glib/pyglib-python-compat.h b/glib/pyglib-python-compat.h
index 4a522317..8c1dd51a 100644
--- a/glib/pyglib-python-compat.h
+++ b/glib/pyglib-python-compat.h
@@ -112,6 +112,8 @@ static int _pyglib_init_##modname(PyObject *module)
/* Compilation on Python 2.x */
#if PY_VERSION_HEX < 0x03000000
+#define PYGLIB_MODULE_ERROR_RETURN
+
#define RO READONLY
#define PYGLIB_PyBaseString_Check(ob) (PyString_Check(ob) || PyUnicode_Check(ob))
@@ -176,6 +178,7 @@ PyTypeObject symbol = { \
#else
+#define PYGLIB_MODULE_ERROR_RETURN 0
#define PYGLIB_MODULE_START(symbol, modname) \
static struct PyModuleDef _##symbol##module = { \
diff --git a/glib/pyglib.c b/glib/pyglib.c
index c85a628e..03f9e915 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(PYGLIB_PyUnicode_AsString(py_domain)),
- PYGLIB_PyLong_AsLong(py_code), PYGLIB_PyUnicode_AsString(py_message));
+ PYGLIB_PyLong_AsLong(py_code), "%s", PYGLIB_PyUnicode_AsString(py_message));
Py_DECREF(py_message);
Py_DECREF(py_code);
diff --git a/glib/pygmainloop.c b/glib/pygmainloop.c
index de749711..cdb94ae5 100644
--- a/glib/pygmainloop.c
+++ b/glib/pygmainloop.c
@@ -158,8 +158,9 @@ pyg_signal_watch_check(GSource *source)
PySignalWatchSource *real_source = (PySignalWatchSource *)source;
GPollFD *poll_fd = &real_source->fd;
unsigned char dummy;
+ gssize ret;
if (poll_fd->revents & G_IO_IN)
- read(poll_fd->fd, &dummy, 1);
+ ret = read(poll_fd->fd, &dummy, 1);
#endif
state = pyglib_gil_state_ensure();