X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fstrings.lisp;h=c63d943e2c8e3496fb89056de87df03bb722bab1;hb=24be2fb19ccbfb39ee2cfbc2ae3c49f4728c0dc5;hp=0f01e97ba1245103f0c8f8b5affaaa3f0ef019dc;hpb=dc12f6625ed6c85ad380525d01c0726100bf7a3d;p=uffi.git diff --git a/src/strings.lisp b/src/strings.lisp index 0f01e97..c63d943 100644 --- a/src/strings.lisp +++ b/src/strings.lisp @@ -157,10 +157,11 @@ that LW/CMU automatically converts strings from c-calls." nil (if (eq ,locale :none) (fast-native-to-string ,obj ,length) - (excl:native-to-string - ,obj - ,@(when length (list :length length)) - :truncate (not ,null-terminated-p)))) + (values + (excl:native-to-string + ,obj + ,@(when length (list :length length)) + :truncate (not ,null-terminated-p))))) #+lispworks `(if (fli:null-pointer-p ,obj) nil @@ -189,8 +190,9 @@ that LW/CMU automatically converts strings from c-calls." `(if (ccl:%null-ptr-p ,obj) nil #+(and mcl (not openmcl)) (ccl:%get-cstring ,obj 0 ,@(if length (list length) nil)) - #+openmcl (let ((str (ccl:%get-cstring ,obj))) - ,(if length '(subseq str 0 length) 'str))) + #+openmcl ,@(if length + `((ccl:%str-from-ptr ,obj ,length)) + `((ccl:%get-cstring ,obj)))) ) @@ -346,4 +348,4 @@ that LW/CMU automatically converts strings from c-calls." (let* ((len (or len (strlen s))) (str (make-string len))) (dotimes (i len str) - (setf (schar str i) (code-char (uffi:deref-array s '(:array :byte) i)))))) + (setf (schar str i) (code-char (uffi:deref-array s '(:array :unsigned-byte) i))))))