History log of /bionic/libc/bionic/wchar.cpp
Revision Date Author Comments
086bb382db3de7459bc5fad6bb1c257ca331b0e8 24-Sep-2014 Dan Albert <danalbert@google.com> Fix incorrect parameter types for locale funcs.

strtoll(3), strtoull(3), wcstoll(3), and wcstoull(3) all take an _int_
as a base, not a size_t. This is an ABI compatibility issue.

Bug: 17628622
Change-Id: I17f8eead34ce2112005899fc30162067573023ec
(cherry picked from commit 3c5037f1b3b747e79d17a5f717d9f9c365132d33)
938a8008a61ecb6e975aa974dbf30ea7e1f298e2 31-Jul-2014 Dan Albert <danalbert@google.com> Fix mbsrtowcs(3) src param for finished string.

A mistake I made while cleaning this up the first time through.
mbstrtowcs(3) sets the src param to null if it finishes the string.

Change-Id: I6263646e25d9537043b7025fd1dd6ae195f365e2
(cherry picked from commit b6cc8e00cd562bd0f81fe44a6bc646540a862f32)
4e5860958767ecc7bc455d2a5e1d2a2096a1c79f 20-Jul-2014 Dan Albert <danalbert@google.com> Fix mbsrtowcs(3)'s handling of len parameter.

The len parameter is a _maximum_ length. The previous code was treating
it as an exact length, causing the following typical call to fail:

mbsrtowcs(out, &in, sizeof(out), state); // sizeof(out) > strlen(in)

Change-Id: I48e474fd54ea5f122bc168a4d74bfe08704f28cc
(cherry picked from commit 6b55ba54eff4657cffe053b71e1c9cce2944a8a9)
dfb5ce42bcc5a275af49211c0bbe64c5ec3d2668 10-Jul-2014 Dan Albert <danalbert@google.com> Revert "Revert "Add locale aware APIs.""

This reverts commit 063e20c26943ec82ef1d53a544545e79054e93d3.

Change-Id: Ib8c9004efefe75a5346b3af50dfe37952d91eb21
e087eac404b0e30de427392065e2750acf92bd4a 09-Jul-2014 Dan Albert <danalbert@google.com> Add locale aware APIs.

Since we only support the C locale, we can just forward all of these to
their non-locale equivalents for correct behavior.

Change-Id: Ib7be71b7f636309c0cc3be1096a4c1f693f04fbb
063e20c26943ec82ef1d53a544545e79054e93d3 10-Jul-2014 Dan Albert <danalbert@google.com> Revert "Add locale aware APIs."

Accidentally verified against a dirty tree. Needs the companion change to libc++ to land upstream before I can submit this.

This reverts commit e087eac404b0e30de427392065e2750acf92bd4a.

Change-Id: I317ecd0923114f415eaad7603002f77feffb5e3f
7a7f9952c12b216fbf91fc4cdbb97045e8861115 02-Jun-2014 Dan Albert <danalbert@google.com> Adds functionality specified by uchar.h

mbrtoc32 and c32rtomb get their implementations from mbrtowc and wcrtomb. The
wc functions now simply call the c32 functions.

Bug: 14646575
Change-Id: I49d4b95fed0f9d790260c996c4d0f8bfd1686324
15a6310e4b745add324b07a5d3d297aa95a56f59 08-May-2014 Calin Juravle <calin@google.com> Support mb sequences across calls to mb*to*wcs* functions

Bug: 13077905
Change-Id: I5abdc7cc3c27c109b7900c94b112f18a95c35763
0d0ccfe2ce32e3669c66fe7575fedbd5ab0db410 02-May-2014 Elliott Hughes <enh@google.com> Fix wchar_t signedness problems found on x86-64.

The existing tests caught this.

Change-Id: I6269844ae4301fd2c596241a59e97eb67ef166fa
568c86a48955fd5479db53b68d59be04df633ec5 02-May-2014 Elliott Hughes <enh@google.com> Fix wchar.cpp signed/unsigned comparison build failure.

Change-Id: Id20b91f3d57c4430987b5cc88ac99c245801d73b
5a0aa3dee247a313f04252cf45608097695d5953 01-May-2014 Elliott Hughes <enh@google.com> 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
94336d8ecf795cfdde874a1e15977d68cfc7afc1 30-Apr-2014 Elliott Hughes <enh@google.com> Switch to OpenBSD stdio wide printf functions.

Change-Id: Icf4f8685d021ec6b7482ca1cc021ce8184098e4a
c932225e1061dc57fc4bf2d6203d9737f4f989fa 30-Apr-2014 Elliott Hughes <enh@google.com> Switch to OpenBSD stdio wide get/put functions.

Change-Id: I71f8769cdea874e55d397ca7682d9d4e659d3dcb
01ae00f3170ad0e36c1657f6ff8c89dfa730fd37 30-Apr-2014 Elliott Hughes <enh@google.com> Switch to the OpenBSD implementations of the wide scanf functions.

This also gets us the C99 wcstoimax and wcstoumax, and a working fgetwc and
ungetwc, all of which are needed in the implementation.

This also brings several other files closer to upstream.

Change-Id: I23b025a8237a6dbb9aa50d2a96765ea729a85579
770491fb4ff85891bbe71aaf4dcec7f22e53abdb 30-Apr-2014 Elliott Hughes <enh@google.com> Fix build (signed char issue).

Change-Id: I05d78f4c1599ed9a0c1285f9eb1e89bc2f55c24d
3d7a0d9b08ecab054b2dff8332507644de3690b0 29-Apr-2014 Elliott Hughes <enh@google.com> Switch to the OpenBSD wcsto* functions.

This replaces a partial set of non-functional functions with a complete
set of functions, all of which actually work.

This requires us to implement mbsnrtowcs and wcsnrtombs which completes
the set of what we need for libc++.

The mbsnrtowcs is basically a copy & paste of wcsnrtombs, but I'm going
to go straight to looking at using the OpenBSD UTF-8 implementation rather
than keep polishing our home-grown turd.

(This patch also opportunistically switches us over to upstream btowc,
mbrlen, and wctob, since they're all trivially expressed in terms of
other functions.)

Change-Id: I0f81443840de0f1aa73b96f0b51988976793a323
0a5e26da1eae6b75a89695faf2e057c5c4717721 29-Apr-2014 Elliott Hughes <enh@google.com> Add mbtowc and fix mbrtowc.

Change-Id: I48786cd82587e61188d40f6fd6e11ac05e857ae9
d299bcfdad959a3a0adf1683605b15a1c3b3ab66 29-Apr-2014 Elliott Hughes <enh@google.com> Replace our broken wcswcs with the working upstream one.

Change-Id: I2952684df5674d10f0564d92c2cd42597725c0e3
1b836ee6f8e5c0f61d67c1f014819a066366ab6f 18-Apr-2014 Elliott Hughes <enh@google.com> Fix a wchar.wcstombs_wcrtombs test failure.

Looks like I screwed up a last-minute refactor and didn't re-run the tests.

Change-Id: I90a710ae66a313a9812859650aa0b4e8c6bc57f9
0549371bd74ba7c7a5a16c2a7d6cc17dbe0e6f97 18-Apr-2014 Elliott Hughes <enh@google.com> Upgrade to current vfprintf.

This gets us various bug fixes and missing C99 functionality.

Bug: https://code.google.com/p/android/issues/detail?id=64886
Change-Id: Ie9f8ac569e9b5eec1e4a1faacfe2c21662eaf895
40b05791278f9ac6ff842670e80899c7cd15276f 15-Apr-2014 Elliott Hughes <enh@google.com> Add iswblank for libcxx.

We have similar degenerate implementations for all the other isw* functions,
so it's weird to exclude just one.

Change-Id: I659b97930e68598826c4882bb59f4146870fb6a0
77e944fd46728075fe632bcb5211da9daf5b7e68 05-Apr-2014 Elliott Hughes <enh@google.com> Implement wctomb(3) for ltrace.

This is an implementation in the style of the rest: char == byte.

We might want to come back and implement UTF-8, but this is enough for ltrace.

Bug: 13747066
Change-Id: Ib2b63609c9014fdef9a8491e067467c4fc5ae3cc
29c7f0b4d18f812267c2194b85204e19e41d0387 23-Oct-2012 Elliott Hughes <enh@google.com> Move setlocale(3) and the wchar stubs over to .cpp.

Also separate out the C++ files so we can use -Werror on them. I'd
rather wait for LOCAL_CPPFLAGS to be in AOSP, but this also lets us
see which files still need to be sorted into one bucket or the other.

Change-Id: I6acc1f7c043935c70a3b089f705d218b9aaaba0a