fix(libc): parse and collate guest wide strings as 16-bit units #1126
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1126"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Fishybeing on 2026-10-07T13:14:19Z.
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 #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 #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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T13:54:58Z.
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.
main)wcschr_nid_postfixwcscmp_nid_postfixwcscoll_nid_postfixwcscpy_nid_postfixwcslen_nid_postfixwcsncmp_nid_postfixwcsrchr_nid_postfixwcsspn_nid_postfixwcstod_nid_postfixwcstof_nid_postfixwmemchr_nid_postfixwmemcmp_nid_postfixwmemset_nid_postfixImported from boykopovar/AnyPS5. Originally posted by fisherjoey on 2026-10-08T05:24:39Z.
This looks like the same change as #1116: both add
wcslen_nid_postfix,wcscpy_nid_postfixandwmemcpy_nid_postfixtolibc/src/Strings.cppfor 16-bit guest wide strings, with aGuestWideStrings.cpptest under the sameguest_wide_stringsctest name. Linking so they can be compared.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T08:48:48Z.
Rebased onto current
main: the first commit was #1116's, already merged and identical tomainforStrings.cppand the test, so I dropped it; resolved the TechnicalDebt conflict (single "Wide-character conversions" line). Checked thewcsto*ASCII-prefix parsing and end pointers,wcscoll/wcsxfrmand the test values;guest_wide_stringsfails without the change and the full ctest passes (426/426). Merging once CI is green.