Skip to content

Commit 8bf91f2

Browse files
committed
unix: Fix compile warnings for ffi module on 64-bit machine.
1 parent 4729a0c commit 8bf91f2

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

unix/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ include ../py/py.mk
1111

1212
# compiler settings
1313
CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 -DUNIX
14+
CFLAGS += -I/usr/lib/libffi-3.0.13/include
1415
LDFLAGS = -lm -ldl -lffi
1516

1617
# Debugging/Optimization

unix/ffi.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static ffi_type *get_ffi_type(mp_obj_t o_in)
8282
nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_OSError, "Unknown type"));
8383
}
8484

85-
static mp_obj_t return_ffi_value(int val, char type)
85+
static mp_obj_t return_ffi_value(ffi_arg val, char type)
8686
{
8787
switch (type) {
8888
case 's': {
@@ -242,7 +242,7 @@ mp_obj_t ffifunc_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *
242242
assert(n_kw == 0);
243243
assert(n_args == self->cif.nargs);
244244

245-
int values[n_args];
245+
ffi_arg values[n_args];
246246
void *valueptrs[n_args];
247247
int i;
248248
for (i = 0; i < n_args; i++) {
@@ -253,17 +253,17 @@ mp_obj_t ffifunc_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *
253253
values[i] = mp_obj_int_get(a);
254254
} else if (MP_OBJ_IS_STR(a) || MP_OBJ_IS_TYPE(a, &bytes_type)) {
255255
const char *s = mp_obj_str_get_str(a);
256-
values[i] = (int)s;
256+
values[i] = (ffi_arg)s;
257257
} else if (MP_OBJ_IS_TYPE(a, &fficallback_type)) {
258258
mp_obj_fficallback_t *p = a;
259-
values[i] = (int)p->func;
259+
values[i] = (ffi_arg)p->func;
260260
} else {
261261
assert(0);
262262
}
263263
valueptrs[i] = &values[i];
264264
}
265265

266-
int retval;
266+
ffi_arg retval;
267267
ffi_call(&self->cif, self->func, &retval, valueptrs);
268268
return return_ffi_value(retval, self->rettype);
269269
}

0 commit comments

Comments
 (0)