Distinguish byte-order state and shift-state.
Reported by Tomas Kalibera <tomas.kalibera@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gnu-libiconv/2024-12/msg00000.html>.
* lib/converters.h (struct conv_struct): Add field 'ibyteorder'.
* lib/iconv_open2.h: Initialize the ibyteorder field.
* lib/ucs2.h (ucs2_mbtowc): Use the ibyteorder field instead of the
istate field.
* lib/ucs4.h (ucs4_mbtowc): Likewise.
* lib/utf16.h (utf16_mbtowc): Likewise.
* lib/utf32.h (utf32_mbtowc): Likewise.
* tests/test-bom-state.c: New file.
* tests/Makefile.in (check): Run test-bom-state.
(test-bom-state, test-bom-state.@OBJEXT@): New targets.
(clean): Remove test-bom-state.
(SOURCE_FILES): Add test-bom-state.c.
* NEWS: Mention the change.
10 files changed