put-u8: Always write a single byte, regardless of the port encoding.
authorMark H Weaver <mhw@netris.org>
Wed, 1 May 2019 09:20:36 +0000 (05:20 -0400)
committerMark H Weaver <mhw@netris.org>
Tue, 7 May 2019 08:41:15 +0000 (04:41 -0400)
Previously, 'put-u8' used textual I/O to write a single character,
relying on the usual practice of setting the port encoding to ISO-8859-1
for binary ports.

* libguile/r6rs-ports.c (scm_put_u8): Use 'scm_c_write', not 'scm_putc'.

libguile/r6rs-ports.c

index c1cbbdf3051b6f33c653705a8b041f41161b81b6..16c148090c3291786c426e94ec280b128cda5404 100644 (file)
@@ -570,7 +570,7 @@ SCM_DEFINE (scm_put_u8, "put-u8", 2, 0, 0,
   SCM_VALIDATE_BINARY_OUTPUT_PORT (1, port);
   c_octet = scm_to_uint8 (octet);
 
-  scm_putc ((char) c_octet, port);
+  scm_c_write (port, &c_octet, 1);
 
   return SCM_UNSPECIFIED;
 }