mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
FFI: Don't force zero terminator on string to array conversion.
This commit is contained in:
parent
96ef87bdfd
commit
705f593ffc
@ -545,10 +545,8 @@ void lj_cconv_ct_tv(CTState *cts, CType *d,
|
|||||||
CTSize sz = str->len+1;
|
CTSize sz = str->len+1;
|
||||||
if (!ctype_isinteger(dc->info) || dc->size != 1)
|
if (!ctype_isinteger(dc->info) || dc->size != 1)
|
||||||
goto err_conv;
|
goto err_conv;
|
||||||
if (d->size != 0 && d->size < sz) {
|
if (d->size != 0 && d->size < sz)
|
||||||
sz = d->size-1;
|
sz = d->size;
|
||||||
dp[sz] = '\0';
|
|
||||||
}
|
|
||||||
memcpy(dp, strdata(str), sz);
|
memcpy(dp, strdata(str), sz);
|
||||||
return;
|
return;
|
||||||
} else { /* Otherwise pass it as a const char[]. */
|
} else { /* Otherwise pass it as a const char[]. */
|
||||||
|
Loading…
Reference in New Issue
Block a user