[COMMITTED] a68: fix call to _libga68_u8_mbtouc in ga68-posix.c

Jose E. Marchesi jemarch@gnu.org
Fri Oct 31 17:53:40 GMT 2025


---
 libga68/ga68-posix.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libga68/ga68-posix.c b/libga68/ga68-posix.c
index cd8104cdc51..abab89e4ae3 100644
--- a/libga68/ga68-posix.c
+++ b/libga68/ga68-posix.c
@@ -261,8 +261,9 @@ _libga68_posixfgetc (int fd)
     }
 
   uint32_t res;
-  int length = _libga68_u8_mbtouc (&res, (const uint8_t *) &u8c, 1);
-  if (res == REPLACEMENT_CHARACTER || length != 1)
+  int num_units = morechars + 1;
+  int length = _libga68_u8_mbtouc (&res, (const uint8_t *) &u8c, num_units);
+  if (res == REPLACEMENT_CHARACTER || length != num_units)
     return REPLACEMENT_CHARACTER;
   else
     return res;
-- 
2.30.2



More information about the Algol68 mailing list