fix bytes-convert-end
The `bytes-convert-end` function didn't set up a proper decoding. Make sure that it at least does nothing for encodings where there's nothing to do.
This commit is contained in:
parent
a915433b02
commit
d4742a0618
|
@ -996,6 +996,17 @@
|
||||||
(let-values ([(s2 n2 status2) (bytes-convert c2 s)])
|
(let-values ([(s2 n2 status2) (bytes-convert c2 s)])
|
||||||
(bytes->string/utf-8 s2)))))
|
(bytes->string/utf-8 s2)))))
|
||||||
|
|
||||||
|
;; Check that `bytes-convert-end` does nothing for UTF-8 and UTF-16 conversion:
|
||||||
|
(let ([c (bytes-open-converter "platform-UTF-16" "platform-UTF-8")])
|
||||||
|
(test-values '(#"" complete)
|
||||||
|
(lambda () (bytes-convert-end c))))
|
||||||
|
(let ([c (bytes-open-converter "platform-UTF-8" "platform-UTF-16")])
|
||||||
|
(test-values '(#"" complete)
|
||||||
|
(lambda () (bytes-convert-end c))))
|
||||||
|
(let ([c (bytes-open-converter "UTF-8-permissive" "UTF-8")])
|
||||||
|
(test-values '(#"" complete)
|
||||||
|
(lambda () (bytes-convert-end c))))
|
||||||
|
|
||||||
(when (eq? (system-type) 'windows)
|
(when (eq? (system-type) 'windows)
|
||||||
(let ([c (bytes-open-converter "platform-UTF-8-permissive" "platform-UTF-16")])
|
(let ([c (bytes-open-converter "platform-UTF-8-permissive" "platform-UTF-16")])
|
||||||
;; Check that we use all 6 bytes of #"\355\240\200\355\260\200" or none
|
;; Check that we use all 6 bytes of #"\355\240\200\355\260\200" or none
|
||||||
|
|
|
@ -4696,7 +4696,7 @@ static Scheme_Object *convert_one(const char *who, int opos, int argc, Scheme_Ob
|
||||||
scheme_get_substring_indices(who, argv[1], argc, argv, 2, 3, &istart, &ifinish);
|
scheme_get_substring_indices(who, argv[1], argc, argv, 2, 3, &istart, &ifinish);
|
||||||
} else {
|
} else {
|
||||||
istart = 0;
|
istart = 0;
|
||||||
ifinish = 4; /* This is really a guess about how much space we need for a shift terminator */
|
ifinish = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > opos) {
|
if (argc > opos) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user