citrus_euc's wcrtomb(3) never returns EILSEQ.

Issue #52 closed
Takehiko NOZAKI repo owner created an issue

here is test case.

#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <locale.h>
#include <string.h>
#include <wchar.h>

int
main(void)
{
        size_t ret;
        mbstate_t st;
        char b[MB_LEN_MAX];

        setlocale(LC_CTYPE, "ja_JP.eucJP");
        memset(&st, 0, sizeof(st));
        /* wchar_t is opaque object and implementation defined.
         * citrus's eucJP locale's wchar_t mapping is:
         *
         * GL:  US-ASCII        00000000 00000000 00000000 0xxxxxxx
         * GR:  JIS X 0208      00000000 00000000 1xxxxxxx 1xxxxxxx
         * SS2: JIS X 0201 KANA 00000000 00000000 00000000 1xxxxxxx
         * SS3: JIS X 0212      00000000 00000000 1xxxxxxx 0xxxxxxx
         *
         * so 0xffffffff(11111111 11111111 11111111 11111111) should be
         * EISEQ, but not.
         */
        ret = wcrtomb(b, (wchar_t)0xffffffff, &st);
        assert(ret == (size_t)-1);
        assert(errno == EILSEQ);
}

Comments (3)

  1. Log in to comment