mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2025-12-06 02:40:26 -08:00
ffi: convert-to-foreign-string: ensure a cstring
The function operates on base_string while if it was supplied with an extended string then ecl_base_char array became ecl_character, and that lead to bad copies. To fix it we ensure that the passes string is first coerced to cstring.
This commit is contained in:
parent
77ceb401f9
commit
fad7073f10
1 changed files with 2 additions and 2 deletions
|
|
@ -473,9 +473,9 @@ translate ASCII and binary strings."
|
||||||
|
|
||||||
Converts a Lisp string to a foreign string. Memory should be freed
|
Converts a Lisp string to a foreign string. Memory should be freed
|
||||||
with free-foreign-object."
|
with free-foreign-object."
|
||||||
(let ((lisp-string (string string-designator))
|
(let ((cstring (convert-to-cstring (string string-designator)))
|
||||||
(foreign-type '(* :char)))
|
(foreign-type '(* :char)))
|
||||||
(c-inline (lisp-string foreign-type) (t t) t
|
(c-inline (cstring foreign-type) (t t) t
|
||||||
"{
|
"{
|
||||||
cl_object lisp_string = #0;
|
cl_object lisp_string = #0;
|
||||||
cl_index size = lisp_string->base_string.fillp;
|
cl_index size = lisp_string->base_string.fillp;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue