27 Apr 19:46
byte-vector-≥os-string: Should ensure terminating NUL
From: Ivan Shmakov <ivan <at> theory.asu.ru>
Subject: byte-vector-≥os-string: Should ensure terminating NUL
Newsgroups: gmane.lisp.scheme.scheme48
Date: 2008-04-27 17:50:19 GMT
Subject: byte-
Newsgroups: gmane.lisp.scheme.scheme48
Date: 2008-04-27 17:50:19 GMT
Currently `byte-(Continue reading)vector-≥os-string' assumes that the byte vector passed contains terminating NUL. Hence I suggest the following patch. ;; Before: (x->os-string (byte-vector 33)) ; => #{OS-string ("US-ASCII" "ANSI_X3.4-1968") ""} ;; After: (x->os-string (byte-vector 33)) ; => #{OS-string ("US-ASCII" "ANSI_X3.4-1968") "!"} scheme/rts/os-string.scm (byte-vector-≥os-string): Call `byte-vector-copy-z' instead of `byte-vector-copy'. (byte-vector-copy-z): Renamed function from... (byte-vector-copy): ... this name; ensure that the byte vector to be returned is NUL-terminated. diff -r 293c27a240bc scheme/rts/os-string.scm --- a/scheme/rts/os-string.scm Wed Apr 16 18:45:32 2008 +0700 +++ b/scheme/rts/os-string.scm Mon Apr 28 00:30:12 2008 +0700 @@ -57,7 +57,7 @@ c #f))) (define (byte-vector-≥os-string b) - (let ((c (byte-vector-copy b))) + (let ((c (byte-vector-copy-z b))) (make-immutable! b) (make-os-string (current-os-string-text-codec) #f c)))
RSS Feed