Changeset 5381


Ignore:
Timestamp:
Oct 19, 2006, 12:20:02 PM (18 years ago)
Author:
Gary Byers
Message:

Careful BLTing strings to/from foreign memory.

Location:
trunk/ccl/examples
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/examples/cocoa-editor.lisp

    r2133 r5381  
    379379                      (len (length chars)))
    380380                 (unless (zerop len)
    381                    (%copy-ivector-to-ptr chars 0 bytes pos len)
     381                   (%cstr-pointer chars (%inc-ptr bytes pos) nil)
    382382                   (incf pos len))
    383383                 (when next
    384                    (setf (%get-byte bytes pos) (char-code #\return))
    385384                   (when cp/m-p
     385                     (setf (%get-byte bytes pos) (char-code #\return))
    386386                     (incf pos)
    387387                   (setf (%get-byte bytes pos) (char-code #\linefeed)) 
  • trunk/ccl/examples/cocoa-listener.lisp

    r4916 r5381  
    113113           (data-length (send (the ns:ns-data data) 'length))
    114114           (buffer (hemlock-document-buffer document))
    115            (string (make-string data-length))
     115           (string (%str-from-ptr (send data 'bytes) data-length))
    116116           (fh filehandle))
    117       (%copy-ptr-to-ivector (send data 'bytes) 0 string 0 data-length)
    118117      (enqueue-buffer-operation
    119118       buffer
     
    155154         (bytes (send data 'mutable-bytes)))
    156155    (declare (type ns:ns-file-handle filehandle))
    157     (%copy-ivector-to-ptr string 0 bytes 0 len)
     156    (%cstr-pointer string bytes nil)
    158157    (send filehandle :write-data data)
    159158    (send filehandle 'synchronize-file)))
Note: See TracChangeset for help on using the changeset viewer.