correct octets in c-string decoding errors
[sbcl.git] / src / code / target-sap.lisp
index edb3a16..17f7191 100644 (file)
            (fixnum offset))
   (sap-ref-8 sap offset))
 
+(defun sap-ref-octets (sap offset count)
+  (declare (type system-area-pointer sap)
+           (fixnum offset count))
+  (let ((buffer (make-array count :element-type '(unsigned-byte 8))))
+    (dotimes (i count)
+      (setf (aref buffer i) (sap-ref-8 sap (+ offset i))))
+    buffer))
+
 ;;; Return the 16-bit word at OFFSET bytes from SAP.
 (defun sap-ref-16 (sap offset)
   (declare (type system-area-pointer sap)