1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
From: Uli Schlachter <psychon@znc.in>
Subject: [PATCH] callable: Fix enum return from C functions
According to [1], return values smaller than sizeof(long) are returned
as ffi_arg or ffi_sarg. Thus, the code here needs to use ffi_sarg
instead of int to work correctly.
This fixes a test failure on s390x that boils down to
cairo_pattern_get_type() returning 2, but the C code here turns that
into a value of 0.
A big "thank" you to Debian and specifically to Mattia Rizzolo for
giving me access to a porterbox so that I could debug this myself.
[1]: https://linux.die.net/man/3/ffi_call
Signed-off-by: Uli Schlachter <psychon@znc.in>
Bug-Debian: https://bugs.debian.org/879956
Origin: upstream, https://github.com/pavouk/lgi/commit/a127f82af7b60fd4f76b694317eb77ff4c62bbf7
---
lgi/callable.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lgi/callable.c b/lgi/callable.c
index 62387ed..86b7ed3 100644
--- a/lgi/callable.c
+++ b/lgi/callable.c
@@ -769,7 +769,7 @@ callable_param_2lua (lua_State *L, Param *param, GIArgument *arg,
args + callable->has_self);
else
{
- union { GIArgument arg; int i; } *u = (gpointer) arg;
+ union { GIArgument arg; ffi_sarg i; } *u = (gpointer) arg;
lua_pushnumber (L, u->i);
}
}
|