Commit Graph

4 Commits

Author SHA1 Message Date
Yunus Shaikh 433bf1ebc2 fix(libc): map _Towctrans descriptors 1 and 2 to lower and upper case
_Towctrans passed the guest's descriptor to the host towctrans.
Dinkumware's <wctype.h> (xwcc.h) defines towlower(wc) as
_Towctrans(wc, 1) and towupper(wc) as _Towctrans(wc, 2), the values
FreeBSD's wctrans.c also uses for "tolower" and "toupper". UCRT reads
1 as toupper and other nonzero values as tolower, so on Windows
towlower(L'A') returned L'A' and towupper(L'a') returned L'a', while
towlower(L'a') returned L'A'. The host wint_t is 16 bits there, which
also turned WEOF into 0xffff. glibc's wctrans_t is a pointer to a
table that towctrans reads, so on Linux descriptor 1 or 2 is
dereferenced as an address.

_Towctrans now takes the guest's 32-bit wint_t and size_t descriptor.
1 and 2 map 0..255 through the C locale tables behind _Getptolower and
_Getptoupper and return other values unchanged. Any other descriptor
sets errno to EINVAL and returns wc unchanged, as FreeBSD's
towctrans_l does.
2026-10-11 16:05:26 -07:00
Nahuel Genchi 2b83a533b8 test(libc): match the immortal classic locale and run guest_locale in ctest 2026-10-07 00:00:12 -03:00
boykopovar 9a4c8eab8b fix(libc): update locale signatures + add sysv abi to math funcs 2026-09-24 22:57:49 +03:00
boykopovar c9a82af00c fix(libc): add guest-compatible c++ locale abi 2026-09-24 10:51:11 +03:00