[pygobject: 1/2] all around: Fix some assumptions about the size of long
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject: 1/2] all around: Fix some assumptions about the size of long
- Date: Tue, 13 Mar 2018 18:57:22 +0000 (UTC)
commit 48b612406fd28274a1ab5b41698bdfda2b3bc2ae
Author: Mathieu Duponchelle <mathieu centricular com>
Date: Tue Mar 13 19:41:20 2018 +0100
all around: Fix some assumptions about the size of long
This was creating various issues on 64-bit Windows, where sizeof(long)
is usually 4.
gi/pygi-basictype.c | 6 +++---
gi/pygi-closure.c | 10 +++++-----
gi/pygi-value.c | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/gi/pygi-basictype.c b/gi/pygi-basictype.c
index ddb02f9b..cc4899ec 100644
--- a/gi/pygi-basictype.c
+++ b/gi/pygi-basictype.c
@@ -198,7 +198,7 @@ static gboolean
_pygi_marshal_from_py_gtype (PyObject *py_arg,
GIArgument *arg)
{
- long type_ = pyg_type_from_object (py_arg);
+ GType type_ = pyg_type_from_object (py_arg);
if (type_ == 0) {
PyErr_Format (PyExc_TypeError, "Must be gobject.GType, not %s",
@@ -206,7 +206,7 @@ _pygi_marshal_from_py_gtype (PyObject *py_arg,
return FALSE;
}
- arg->v_long = type_;
+ arg->v_size = type_;
return TRUE;
}
@@ -808,7 +808,7 @@ _pygi_marshal_to_py_basic_type (GIArgument *arg,
return PyFloat_FromDouble (arg->v_double);
case GI_TYPE_TAG_GTYPE:
- return pyg_type_wrapper_new ( (GType) arg->v_long);
+ return pyg_type_wrapper_new ( (GType) arg->v_size);
case GI_TYPE_TAG_UNICHAR:
return _pygi_marshal_to_py_unichar (arg);
diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c
index 42144e07..b764ab8f 100644
--- a/gi/pygi-closure.c
+++ b/gi/pygi-closure.c
@@ -84,7 +84,7 @@ _pygi_closure_assign_pyobj_to_retval (gpointer retval,
*((gdouble *) retval) = arg->v_double;
break;
case GI_TYPE_TAG_GTYPE:
- *((ffi_arg *) retval) = arg->v_ulong;
+ *((ffi_arg *) retval) = arg->v_size;
break;
case GI_TYPE_TAG_UNICHAR:
*((ffi_arg *) retval) = arg->v_uint32;
@@ -149,7 +149,7 @@ _pygi_closure_assign_pyobj_to_out_argument (gpointer out_arg,
*((gint64 *) out_arg) = arg->v_int64;
break;
case GI_TYPE_TAG_UINT64:
- *((glong *) out_arg) = arg->v_uint64;
+ *((guint64 *) out_arg) = arg->v_uint64;
break;
case GI_TYPE_TAG_FLOAT:
*((gfloat *) out_arg) = arg->v_float;
@@ -158,7 +158,7 @@ _pygi_closure_assign_pyobj_to_out_argument (gpointer out_arg,
*((gdouble *) out_arg) = arg->v_double;
break;
case GI_TYPE_TAG_GTYPE:
- *((gulong *) out_arg) = arg->v_ulong;
+ *((GType *) out_arg) = arg->v_size;
break;
case GI_TYPE_TAG_UNICHAR:
*((guint32 *) out_arg) = arg->v_uint32;
@@ -245,10 +245,10 @@ _pygi_closure_convert_ffi_arguments (PyGIInvokeArgState *state,
state[i].arg_value.v_uint32 = * (guint32 *) arg_pointer;
break;
case GI_TYPE_TAG_INT64:
- state[i].arg_value.v_int64 = * (glong *) arg_pointer;
+ state[i].arg_value.v_int64 = * (gint64 *) arg_pointer;
break;
case GI_TYPE_TAG_UINT64:
- state[i].arg_value.v_uint64 = * (glong *) arg_pointer;
+ state[i].arg_value.v_uint64 = * (guint64 *) arg_pointer;
break;
case GI_TYPE_TAG_FLOAT:
state[i].arg_value.v_float = * (gfloat *) arg_pointer;
diff --git a/gi/pygi-value.c b/gi/pygi-value.c
index 443597c2..87d397b3 100644
--- a/gi/pygi-value.c
+++ b/gi/pygi-value.c
@@ -86,7 +86,7 @@ _pygi_argument_from_g_value(const GValue *value,
arg.v_double = g_value_get_double (value);
break;
case GI_TYPE_TAG_GTYPE:
- arg.v_long = g_value_get_gtype (value);
+ arg.v_size = g_value_get_gtype (value);
break;
case GI_TYPE_TAG_UTF8:
case GI_TYPE_TAG_FILENAME:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]