Module Name: src Committed By: riastradh Date: Fri Aug 16 19:31:48 UTC 2024
Modified Files: src/lib/libc/locale: mbrtoc8.3 Log Message: mbrtoc8(3): Simplify return value language. PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libc/locale/mbrtoc8.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/locale/mbrtoc8.3 diff -u src/lib/libc/locale/mbrtoc8.3:1.2 src/lib/libc/locale/mbrtoc8.3:1.3 --- src/lib/libc/locale/mbrtoc8.3:1.2 Fri Aug 16 18:35:19 2024 +++ src/lib/libc/locale/mbrtoc8.3 Fri Aug 16 19:31:48 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: mbrtoc8.3,v 1.2 2024/08/16 18:35:19 uwe Exp $ +.\" $NetBSD: mbrtoc8.3,v 1.3 2024/08/16 19:31:48 riastradh Exp $ .\" .\" Copyright (c) 2024 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -181,11 +181,9 @@ function returns: .Bl -tag -width Li .It Li 0 .Bq null -if within the next -.Fa n -bytes at -.Fa s -the first multibyte character is null. +if +.Nm +decoded a null multibyte character. .It Ar i .Bq code unit where @@ -194,40 +192,32 @@ where .Ar i \*(Le .Fa n , -if either -.Fa ps -is in the initial conversion state or the previous call to +if .Nm -with -.Fa ps -had not yielded an incomplete UTF-8 code unit, and within the first +consumed .Ar i -bytes at -.Fa s -a Unicode scalar value was decoded. +bytes of input to decode the next multibyte character, yielding a +(nonnull) UTF-8 code unit, either a Unicode scalar value in the +US-ASCII range or a leading byte in the UTF-8 encoding of a scalar +value. .It Li (size_t)-3 .Bq continuation -if the previous call to +if +.Nm +consumed no bytes of input but yielded a (nonnull) UTF-8 code unit, the +next trailing byte in the UTF-8 encoding of a Unicode scalar value +previously decoded by .Nm with -.Fa ps -had yielded an incomplete UTF-8 code unit for a Unicode scalar value -outside the US-ASCII range; no additional input is consumed in this -case. +.Fa ps . .It Li (size_t)-2 .Bq incomplete -if either -.Fa ps -is in the initial conversion state or the previous call to +if .Nm -with -.Fa ps -had not yielded an incomplete UTF-8 code unit, and within the first +found an incomplete multibyte character after all .Fa n -bytes at -.Fa s , -including any previously buffered input, no complete Unicode scalar -value could be decoded. +bytes of input, and saved its state to restart in the next call with +.Fa ps . .It Li (size_t)-1 .Bq error if any encoding error was detected;