From 4a6cf4075e4a652d26aa10c1b38ef8c83c4694c2 Mon Sep 17 00:00:00 2001 From: Joshua Suskalo Date: Wed, 15 Sep 2021 21:33:05 -0500 Subject: [PATCH] Ensure that there's no reflection on deserializing a string --- src/coffi/ffi.clj | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/coffi/ffi.clj b/src/coffi/ffi.clj index fa2f536..cb4bea4 100644 --- a/src/coffi/ffi.clj +++ b/src/coffi/ffi.clj @@ -380,18 +380,15 @@ (deserialize* type))) (defmethod deserialize* ::c-string - [obj _type] - (CLinker/toJavaString obj)) - -(defn serialize - []) + [addr _type] + (CLinker/toJavaString ^MemoryAddress addr)) (defn deserialize - "Deserializes an arbitrary type regardless of if it is primitive. + "Deserializes an arbitrary type. For types which have a primitive representation, this deserializes the primitive representation. For types which do not, this deserializes out of - a [[MemorySegment]]." + a segment." [obj type] ((if (primitive-type type) deserialize*