Page MenuHomeFreeBSD

libc: iconv: add mb_cur_min for encoder traits
ClosedPublic

Authored by kevans on Feb 22 2022, 5:25 PM.

Details

Summary

A future commit will actually implement //IGNORE so that applications
using base iconv can, e.g., sanitize UTF-8 strings. To do this, the
iconv_std module needs to be able to determine the minimum width for any
given encoding so that it can skip that many bytes in the input buffer.
This is mainly an issue for UTF-16 and UTF-32.

This commit bumps shlib versions to 5 for libiconv modules to reflect
the ABI change. It also fixes OptionalObsoleteFiles to remove the
libiconv modules if WITHOUT_ICONV is in use.

Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

thj added inline comments.
lib/libc/iconv/citrus_stdenc_template.h
53

I can't track down the resolution of encoding info. This define always being one seems to exclude the 'otherwise specified' part of the comment, is the minimum changed somewhere else?

lib/libc/iconv/citrus_stdenc_template.h
53

These are all kind of whacky, but this file is actually part of the module template and only gets #include'd at the bottom of a module.c, so the module is free to #define it and we'll use that instead below. The below methods are declared in the module's .h, which is what libiconv uses.

This revision was not accepted when it landed; it landed in state Needs Review.Aug 29 2022, 11:22 PM
This revision was automatically updated to reflect the committed changes.