summaryrefslogtreecommitdiffstats
path: root/regex.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-01-17 22:25:52 -0800
committerKaz Kyheku <kaz@kylheku.com>2020-01-17 22:25:52 -0800
commit7a6a9a21090a36ae094b3a4746a6dd371bd653cb (patch)
treeb42ddabde29112ef85eafbd248b18ca0efdf4c1d /regex.h
parentc77bf6fb483c5bce7d5c5fc13fa04471d12ee2ff (diff)
downloadtxr-7a6a9a21090a36ae094b3a4746a6dd371bd653cb.tar.gz
txr-7a6a9a21090a36ae094b3a4746a6dd371bd653cb.tar.bz2
txr-7a6a9a21090a36ae094b3a4746a6dd371bd653cb.zip
ffi: fix broken char handling in undimensioned arrays.
The undimensioned (array <type>) and (zarray <type>) types are not doing UTF-8 conversion when <type> is char or zchar, or doing what they are supposed to with the FFI character types, which is inconsistent from their dimensioned counterparts. * ffi.c (ffi_varray_dynsize): if the element type is marked for character conversion, then do the size calculation for char and zchar by measuring the UTF-8 coded size. (ffi_varray_alloc): Call ffi_varray_dynsize to get the size, to benefit from the char handling. Thus when FFI allocates buffers for a variable length array, it will allocate correct size required for the UTF-8 encoded string. (ffi_varray_put, ffi_varray_in): Here we must call ffi_varray_dynsize and divide by the element type to get the proper numer of elements. Then we must check for character conversion and handle the cases. (ffi_varray_null_term_in): Check for character conversion cases and route those through ffi_varray_in, which handles null-terminated strings. * tests/017/ffi-misc.tl: New file. * tests/017/ffi-misc.expected: New file.
Diffstat (limited to 'regex.h')
0 files changed, 0 insertions, 0 deletions