[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mbrtowc test fails on Solaris 11

From: Daiki Ueno
Subject: mbrtowc test fails on Solaris 11
Date: Wed, 01 Oct 2014 17:18:38 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)


On Solaris 11, a couple of mbrtowc tests fails:

  FAIL: test-mbrtowc3.sh

  test-mbrtowc.c:116: assertion 'wc == (wchar_t) 0xBADFACE' failed

  FAIL: test-mbrtowc4.sh

  test-mbrtowc.c:303: assertion 'ret == 1' failed

The former case checks if the WC value is unchanged around the call:

  memset (&state, 0, sizeof (mbstate_t));
  mbrtowc (&wc, NULL, 7, &state);

As the Solaris manual page[1] states that PWC and N are ignored if S is
NULL, it seems like a bug in the system mbrtowc.

The latter case checks if the return value of mbrtowc, when scanning a
string starting with "\271\201", under the zh_CN.GB18030 locale.

  char input[] = "B\250\271\201\060\211\070er";
  memset (&state, '\0', sizeof (mbstate_t));
  wc = (wchar_t) 0xBADFACE;
  ret = mbrtowc (&wc, input + 2, 7, &state);
  ASSERT (ret == 1);

However, "\271\201" is a valid GB18030 sequence which encodes U+7B92.
Maybe it should expect ret == 2?

[1]  http://docs.oracle.com/cd/E36784_01/html/E36874/mbrtowc-3c.html

Daiki Ueno

reply via email to

[Prev in Thread] Current Thread [Next in Thread]