From 8557121c01f072f7e194c93c1e545e0b51ed563d Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 10 Jun 2017 10:31:43 -0700 Subject: ffi: bugfix: string semantics on typedef-d chars. The problem is that if we have a typedef like (typedef x char) then (array 256 x) will not do string conversion in the manner of (array 256 char). This is because the raw syntax is checked for the symbol char, rather than inspecting the type object. * ffi.c (ffi_type_compile): When checking whether the array element is a char, bchar or wchar, look at the syntax in the compiled type object, not the raw syntax. The compiled type object is the original type pulled from behind the typedef alias and has the symbol char, bchar or wchar as its syntax. --- ffi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ffi.c') diff --git a/ffi.c b/ffi.c index 3871cd7d..2fa7495c 100644 --- a/ffi.c +++ b/ffi.c @@ -3068,11 +3068,11 @@ val ffi_type_compile(val syntax) self, syntax, nao); } - if (eltype_syntax == char_s) + if (etft->syntax == char_s) tft->char_conv = 1; - else if (eltype_syntax == wchar_s) + else if (etft->syntax == wchar_s) tft->wchar_conv = 1; - else if (eltype_syntax == bchar_s) + else if (etft->syntax == bchar_s) tft->bchar_conv = 1; return type; } -- cgit v1.2.3