summaryrefslogtreecommitdiff
path: root/tests/stdio_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-04-30 22:03:12 -0700
committerElliott Hughes <enh@google.com>2014-05-01 14:46:54 -0700
commit5a0aa3dee247a313f04252cf45608097695d5953 (patch)
tree1bbc0d1e4e60717285b17b40ab155bdfbace5e37 /tests/stdio_test.cpp
parent9fb53dd4dbaa7633c234d9da8417827fa3d3c32f (diff)
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
Diffstat (limited to 'tests/stdio_test.cpp')
0 files changed, 0 insertions, 0 deletions