From 5f961b426b9bd25956e5364770c71c34c414d4e6 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Thu, 5 Apr 2018 11:30:44 +0200 Subject: build: use -Wconversion -Wno-sign-conversion. Fixes #191 In some cases changing the type used was enough, in some others I just force casted things as too many changes would be required and overflow unlikely (for array marshalling the cache uses gssize while the marshalling code uses garray and thus guint) My hope is that having this enabled will improve things gradually with future cleanups. --- gi/pygi-source.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'gi/pygi-source.c') diff --git a/gi/pygi-source.c b/gi/pygi-source.c index d09849f0..b49b7d58 100644 --- a/gi/pygi-source.c +++ b/gi/pygi-source.c @@ -27,6 +27,7 @@ #include "pygi-info.h" #include "pygi-boxed.h" #include "pygi-type.h" +#include "pygi-basictype.h" #include "pygboxed.h" #include "pygi-source.h" @@ -65,13 +66,16 @@ pyg_source_prepare(GSource *source, gint *timeout) goto bail; } - ret = PyObject_IsTrue(PyTuple_GET_ITEM(t, 0)); - *timeout = PYGLIB_PyLong_AsLong(PyTuple_GET_ITEM(t, 1)); + if (!pygi_gboolean_from_py (PyTuple_GET_ITEM(t, 0), &ret)) { + ret = FALSE; + goto bail; + } - if (*timeout == -1 && PyErr_Occurred()) { - ret = FALSE; - goto bail; - } + if (!pygi_gint_from_py (PyTuple_GET_ITEM(t, 1), timeout)) + { + ret = FALSE; + goto bail; + } got_err = FALSE; @@ -229,7 +233,7 @@ PyObject * pyg_source_set_callback(PyGObject *self_module, PyObject *args) { PyObject *self, *first, *callback, *cbargs = NULL, *data; - gint len; + Py_ssize_t len; len = PyTuple_Size (args); if (len < 2) { -- cgit v1.2.1