summaryrefslogtreecommitdiff
path: root/src/lib_ffi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib_ffi.c')
-rw-r--r--src/lib_ffi.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib_ffi.c b/src/lib_ffi.c
index 361c3ba1..e88b6f54 100644
--- a/src/lib_ffi.c
+++ b/src/lib_ffi.c
@@ -74,7 +74,7 @@ static void *ffi_checkptr(lua_State *L, int narg, CTypeID id)
74 void *p; 74 void *p;
75 if (o >= L->top) 75 if (o >= L->top)
76 lj_err_arg(L, narg, LJ_ERR_NOVAL); 76 lj_err_arg(L, narg, LJ_ERR_NOVAL);
77 lj_cconv_ct_tv(cts, ctype_get(cts, id), (uint8_t *)&p, o, 0); 77 lj_cconv_ct_tv(cts, ctype_get(cts, id), (uint8_t *)&p, o, CCF_ARG(narg));
78 return p; 78 return p;
79} 79}
80 80
@@ -86,7 +86,8 @@ static int32_t ffi_checkint(lua_State *L, int narg)
86 int32_t i; 86 int32_t i;
87 if (o >= L->top) 87 if (o >= L->top)
88 lj_err_arg(L, narg, LJ_ERR_NOVAL); 88 lj_err_arg(L, narg, LJ_ERR_NOVAL);
89 lj_cconv_ct_tv(cts, ctype_get(cts, CTID_INT32), (uint8_t *)&i, o, 0); 89 lj_cconv_ct_tv(cts, ctype_get(cts, CTID_INT32), (uint8_t *)&i, o,
90 CCF_ARG(narg));
90 return i; 91 return i;
91} 92}
92 93
@@ -444,9 +445,11 @@ LJLIB_CF(ffi_string) LJLIB_REC(.)
444 size_t len; 445 size_t len;
445 if (o+1 < L->top) { 446 if (o+1 < L->top) {
446 len = (size_t)ffi_checkint(L, 2); 447 len = (size_t)ffi_checkint(L, 2);
447 lj_cconv_ct_tv(cts, ctype_get(cts, CTID_P_CVOID), (uint8_t *)&p, o, 0); 448 lj_cconv_ct_tv(cts, ctype_get(cts, CTID_P_CVOID), (uint8_t *)&p, o,
449 CCF_ARG(1));
448 } else { 450 } else {
449 lj_cconv_ct_tv(cts, ctype_get(cts, CTID_P_CCHAR), (uint8_t *)&p, o, 0); 451 lj_cconv_ct_tv(cts, ctype_get(cts, CTID_P_CCHAR), (uint8_t *)&p, o,
452 CCF_ARG(1));
450 len = strlen(p); 453 len = strlen(p);
451 } 454 }
452 L->top = o+1; /* Make sure this is the last item on the stack. */ 455 L->top = o+1; /* Make sure this is the last item on the stack. */