Repository navigation
fix(libc): parse and collate guest wide strings as 16-bit units - #1126
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
|
This looks like the same change as #1116: both add |
wcstod, wcstof, wcstold, wcstol, wcstoll, wcstoul, wcstoull, wcscoll and wcsxfrm still forwarded to the host's wchar_t functions, which use 32-bit units on Linux. The wcsto* functions now parse the ASCII prefix of the guest string with the narrow parsers, as the C locale accepts only ASCII white space and digits. wcscoll compares like wcscmp and wcsxfrm copies, as strcoll and strxfrm do in the C locale.
d726e27 to
5b0d283
Compare
|
Rebased onto current |
What
Follow-up to #1116, which listed the remaining host-
wchar_twide functions in TechnicalDebt. This moves the parsing and collation ones to 16-bit units:wcstol,wcstoll,wcstoul,wcstoull,wcstod,wcstof,wcstoldparse the ASCII prefix of the guest string with the same host parsers the narrowstrto*exports use, and map the end pointer back onto the guest string. In the C localeiswspaceis true only for the standard white-space characters andiswdigitonly for0-9(C11 7.30.2.1), so no character outside ASCII can be part of a number. A string with no conversion returns its start, as before.wcscollcompares likewcscmp, asstrcolldoes withstrcmp.wcsxfrmcopies the string when it fits and returns its length, the C-locale identity transformstrxfrmuses.wcsrtombsandswprintfstay on the host functions and stay in TechnicalDebt:wcsrtombsneeds the guest's multibyte encoding andmbstate_t, andswprintfon Windows goes throughFormatWideWindows, so moving it is a separate change.Tested
15.2.0posix-14.0.0-ucrt-r7), Release,-DBUILD_TESTING=ON, on currentmainwith fix(libc): read guest wide strings as 16-bit units #1116 appliedStrings.cppandGuestWideStrings.cppbuild without warnings, also with-Wall -Wextra.guest_wide_stringsnow also covers the parsers (sign, white space, hex with base 16 and 0, overflow toULLONG_MAX, no conversion,U+3000andU+0661stopping the parse, end pointers),wcscollandwcsxfrm.ctest -E 'agc|shader|recompiler|Vulkan|vulkan|video_out': 197/197 passed one79c971fwith fix(libc): read guest wide strings as 16-bit units #1116 applied, includingguest_wide_stringsandguest_wide_formatting. GPU tests not run.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)