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 <chris@include.gr>
This commit is contained in:
Chrysostomos Nanakos 2026-02-20 16:51:55 +02:00
parent 03aa6c5890
commit 6c877f3aad
No known key found for this signature in database

View File

@ -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