From: Chris Hanson Date: Wed, 17 May 2017 02:38:10 +0000 (-0700) Subject: Fix string-for-primitive as pointed out by Matt. X-Git-Tag: mit-scheme-pucked-9.2.12~14^2~57 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=05e217ed7f1f34e3cfd26158161d5cfef9a86809;p=mit-scheme.git Fix string-for-primitive as pointed out by Matt. --- diff --git a/src/runtime/ustring.scm b/src/runtime/ustring.scm index d0b54b951..2cada76b3 100644 --- a/src/runtime/ustring.scm +++ b/src/runtime/ustring.scm @@ -2065,12 +2065,12 @@ USA. (else (every-loop char-8-bit? ustring3-ref string start end)))))) (define (string-for-primitive string) - (if (and (not (slice? string)) + (if (and (or (legacy-string? string) + (and (ustring? string) + (fix:= 1 (ustring-cp-size string)))) (let ((end (string-length string))) - (case (ustring-cp-size string) - ((1) (every-loop char-ascii? ustring1-ref string 0 end)) - ((2) (every-loop char-ascii? ustring2-ref string 0 end)) - (else (every-loop char-ascii? ustring3-ref string 0 end))))) + (every-loop (lambda (cp) (fix:< cp #x80)) + cp1-ref string 0 end))) string (string->utf8 string)))