From 6c877f3aadc75242e9566f914d9f2b4173e94f93 Mon Sep 17 00:00:00 2001 From: Chrysostomos Nanakos Date: Fri, 20 Feb 2026 16:51:55 +0200 Subject: [PATCH] fix: use unsafeAddr for string-to-ptr cast in FFI callback Part of https://github.com/logos-storage/logos-storage-nim/issues/1366 Signed-off-by: Chrysostomos Nanakos --- library/ffi_types.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/ffi_types.nim b/library/ffi_types.nim index 38faf551..c766c3fd 100644 --- a/library/ffi_types.nim +++ b/library/ffi_types.nim @@ -19,7 +19,7 @@ const RET_PROGRESS*: cint = 3 ## Returns RET_OK as acknowledgment and call the callback ## with RET_OK code and the provided message. proc success*(callback: StorageCallback, msg: string, userData: pointer): cint = - callback(RET_OK, cast[ptr cchar](msg), cast[csize_t](len(msg)), userData) + callback(RET_OK, unsafeAddr msg[0], cast[csize_t](len(msg)), userData) return RET_OK