r10124: revert change for openmcl that broke clsql
[uffi.git] / src / strings.lisp
index 89c41b2ec03a8ca4d240d449a134c33c92c2a2ef..c63d943e2c8e3496fb89056de87df03bb722bab1 100644 (file)
@@ -190,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))))
   )
 
 
@@ -347,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))))))