platform_bionic/libc
Elliott Hughes 5a0aa3dee2 Switch to a working UTF-8 mb/wc implementation.
Although glibc gets by with an 8-byte mbstate_t, OpenBSD uses 12 bytes (of
the 128 bytes it reserves!).

We can actually implement UTF-8 encoding/decoding with a 0-byte mbstate_t
which means we can make things work on LP32 too, as long as we accept the
limitation that the caller needs to present us with a complete sequence
before we'll process it.

Our behavior is fine when going from characters to bytes; we just
update the source wchar_t** to say how far through the input we got.

I'll come back and use the 4 bytes we do have to cope with byte sequences
split across multiple input buffers. The fact that we don't support
UTF-8 sequences longer than 4 bytes plus the fact that the first byte of
a UTF-8 sequence encodes the length means we shouldn't need the other
fields OpenBSD used (at the cost of some recomputation in cases where a
sequence is split across buffers).

This patch also makes the minimal changes necessary to setlocale(3) to
make us behave like glibc when an app requests UTF-8. (The difference
being that our "C" locale is the same as our "C.UTF-8" locale.)

Change-Id: Ied327a8c4643744b3611bf6bb005a9b389ba4c2f
2014-05-01 14:46:54 -07:00
..
arch-arm LP64 shouldn't include the non-standard <time64.h> cruft. 2014-04-22 13:55:58 -07:00
arch-arm64 Clean up <machine/ieee.h>. 2014-04-16 16:31:17 -07:00
arch-common/bionic AArch64: Add initial support for AArch64 2013-12-16 17:00:22 -08:00
arch-mips LP64 shouldn't include the non-standard <time64.h> cruft. 2014-04-22 13:55:58 -07:00
arch-mips64 Clean up <machine/ieee.h>. 2014-04-16 16:31:17 -07:00
arch-x86 LP64 shouldn't include the non-standard <time64.h> cruft. 2014-04-22 13:55:58 -07:00
arch-x86_64 Clean up <machine/ieee.h>. 2014-04-16 16:31:17 -07:00
bionic Switch to a working UTF-8 mb/wc implementation. 2014-05-01 14:46:54 -07:00
dns bionic: Replace iface with opaque netid in resolver. 2014-04-01 16:25:49 -04:00
include Make SIGRTMIN hide the real-time signals we use internally. 2014-04-30 10:06:09 -07:00
kernel Make SIGRTMIN hide the real-time signals we use internally. 2014-04-30 10:06:09 -07:00
private Allow liblog to pass failure reasons to debuggerd. 2014-04-23 14:52:49 -07:00
stdio Switch to the OpenBSD implementations of the wide scanf functions. 2014-04-29 16:28:56 -07:00
stdlib Switch to the upstream OpenBSD getenv/putenv/setenv implementation. 2014-04-22 17:41:00 -07:00
tools Fix for libgcc compat generation script. 2014-04-18 17:34:20 -07:00
tzcode Don't use so much stack in tzcode. 2014-04-25 21:51:26 -07:00
unistd Reimplement clock(3) and switch to OpenBSD time(3). 2014-03-11 13:37:11 -07:00
upstream-dlmalloc
upstream-freebsd Adds quick_exit(3) and at_quick_exit(3) from freebsd 2014-04-29 19:17:00 -07:00
upstream-netbsd Clean up and document our hacks for building BSD source. 2014-04-21 17:13:46 -07:00
upstream-openbsd Switch to a working UTF-8 mb/wc implementation. 2014-05-01 14:46:54 -07:00
zoneinfo Upgrade to tzdata2014b. 2014-04-02 14:43:27 -07:00
Android.mk Switch to a working UTF-8 mb/wc implementation. 2014-05-01 14:46:54 -07:00
crt.mk Reconfig libc's Android.mk to build for multilib 2014-02-12 13:58:34 -08:00
MODULE_LICENSE_BSD
NOTICE Regenerate the NOTICE files. 2014-04-16 17:01:12 -07:00
SYSCALLS.TXT Implement _Exit(3). 2014-04-08 17:16:13 -07:00