Commit Graph

13 Commits

Author SHA1 Message Date
Pedro F. Giffuni
45256214eb mbtowc(3): set errno to EILSEQ if an incomplete character is passed.
According to POSIX, The mbtowc() function shall fail if:
[EILSEQ] An invalid character sequence is detected.

Reviewed by:		bapt
Differential Revision:	https://reviews.freebsd.org/D5496

Obtained from:	OpenBSD (Ingo Schwarze)
MFC after:	1 month
2016-03-01 19:15:34 +00:00
David Chisnall
3c87aa1d3d Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a
load of _l suffixed versions of various standard library functions that use
the global locale, making them take an explicit locale parameter.  Also
adds support for per-thread locales.  This work was funded by the FreeBSD
Foundation.

Please test any code you have that uses the C standard locale functions!

Reviewed by:    das (gdtoa changes)
Approved by:    dim (mentor)
2011-11-20 14:45:42 +00:00
Tim J. Robbins
a351559479 Remove unnecessary #include directives. 2004-07-29 06:18:40 +00:00
Tim J. Robbins
e214931fbf Remove useless checks for characters longer than INT_MAX bytes. 2004-07-29 06:08:31 +00:00
Tim J. Robbins
6155c34adf Reduce overhead by calling internal versions of the multibyte conversion
functions directly wherever possible.
2004-05-12 14:26:54 +00:00
Tim J. Robbins
74f90def09 Prepare to handle state-dependent encodings. This mainly involves not
taking shortcuts when it comes to storing and passing around conversion
states.
2004-04-06 13:14:03 +00:00
Tim J. Robbins
998e124837 Implement mbtowc() in terms of mbrtowc(), and wctomb() in terms of wcrtomb(). 2003-08-07 07:59:36 +00:00
Tim J. Robbins
c5929b304e Handle boundary cases more correctly; mblen(s, 0) and mbtowc(NULL, s, 0)
return -1 regardless of what s points to, mbtowc(&w, s, 1) sets w to a
null wide character when s points to a null byte. This seems to be closer
to what most other implementations do, but the C99 standard contradicts
itself for these cases.
2002-10-28 08:24:46 +00:00
Tim J. Robbins
b6f33850e0 Style sweep. 2002-10-27 10:41:21 +00:00
Tim J. Robbins
58d38e2520 Style: One space between "restrict" qualifier and "*". 2002-09-06 11:24:06 +00:00
Tim J. Robbins
f0c6c306f9 Set errno to EILSEQ when invalid multibyte sequences are detected
(XSI extension to 1003.1-2001).
2002-09-03 01:09:47 +00:00
Tim J. Robbins
9771f1e24e Add restrict qualifiers to the arguments of mbstowcs, mbtowc() and
wcstombs().
2002-09-01 07:08:22 +00:00
Tim J. Robbins
7438fc3aa8 Split ansi.c into a separate source file for each function. 2002-08-31 11:26:55 +00:00