repair bytes-utf-8-ref for #\xFFFF result

This commit is contained in:
Matthew Flatt 2019-11-13 19:33:58 -07:00
parent ea7452a3ed
commit 0cd7cdaa1f
2 changed files with 8 additions and 2 deletions

View File

@ -1724,4 +1724,10 @@
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(test #\uFFFF bytes-utf-8-ref #"\357\277\277" 0)
(test #f bytes-utf-8-ref #"\357\277" 0)
(test #\nul bytes-utf-8-ref #"\357\277" 0 #\nul)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs)

View File

@ -1587,11 +1587,11 @@ byte_string_utf8_ref(int argc, Scheme_Object *argv[])
utf8_decode_x((unsigned char *)chars, istart, ifinish,
us, 0, 1,
&ipos, &opos,
0, 0, NULL, 0, perm ? 0xFFFF : 0);
0, 0, NULL, 0, perm ? 0xFFFFFF : 0);
if (opos < 1)
return scheme_false;
else if (us[0] == 0xFFFF)
else if (us[0] == 0xFFFFFF)
return perm;
else
return scheme_make_character(us[0]);