kprintf: explicitly disable wchar support

This might get implemented later, even though
there is no real reason why we would need wchar
support in the kernel as it is UTF-8 native
main
anna 3 years ago
parent 14630c86bf
commit fb8bef86d5
Signed by: fef
GPG Key ID: EC22E476DC2D3D84

@ -312,17 +312,12 @@ void parse_fmt_sequence(struct fmt_sequence *sequence, const char **restrict pos
static ssize_t render_c(const struct fmt_sequence *sequence, va_list *ap)
{
ssize_t ret;
if (sequence->length_modifier == LENGTH_L) {
wchar_t val = (wchar_t)va_arg(*ap, wint_t);
ret = printer->write(printer, &val, sizeof(val));
} else {
char val = (char)va_arg(*ap, int);
ret = printer->write(printer, &val, sizeof(val));
}
/* we don't support wchars until we have a UTF-8 encoder */
if (sequence->length_modifier != LENGTH_DEFAULT)
return -1;
return ret;
char val = (char)va_arg(*ap, int);
return printer->write(printer, &val, sizeof(val));
}
static ssize_t render_s(const struct fmt_sequence *sequence, va_list *ap)
@ -331,7 +326,13 @@ static ssize_t render_s(const struct fmt_sequence *sequence, va_list *ap)
* the string is a wchar_t if LENGTH_L is set, but that would require
* a full UTF-8 encoder which i won't write in the near future. Cope.
*/
if (sequence->length_modifier != LENGTH_DEFAULT)
return -1;
const char *s = va_arg(*ap, char *);
if (s == nil)
return write_asciz("(null)");
if (sequence->max_precision)
return write_bytes(s, strnlen(s, sequence->max_precision));
else

Loading…
Cancel
Save