fix(libc): share multibyte state in fgetwc #10405
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10405"
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 MarcZX10 on 2026-10-23T21:51:26Z.
What
Implements
fgetwcthrough the existing guestmbrtowcconverter, preserving conversion state in the guestFILEarea at offset0x60. This follows the bundledlibc.prxcall pattern described in issue #8897: one 16-bit result unit per call, with state stored on the stream. A successful seek andfreopenreset the conversion state. Reads hold the host stream lock across the full character conversion; random-device streams use the existing host entropy provider.This addresses the
fgetwcportion of #8897. The remainingfgetwscases are tracked separately, so this PR does not close the issue. Console stream refill behavior and title-specific dynamic locale tables remain unverified and are recorded in the libc debt entry.Tested
Debian 12, Linux 6.1.0-53-amd64, GCC 12.2.0, Release, CMake configured with
BUILD_TESTING=ON.guest_standard_stream_testsandlibc.prx.ctest --test-dir build-fgetwc-full --output-on-failure -R '^guest_standard_streams$': passed (1/1).python3 tools/check_conventions.py --base upstream/mainpassed;git diff --checkis clean.Checklist
main; no other open PR implements the same functionNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T04:57:20Z.
Review: COMMENTED
Reviewed — reconcile request still open, reply answered
The head predates main's fgetwc surrogate fix and is CONFLICTING/DIRTY, so the reviewer's question has a checkable answer: this branch does not yet carry that behavior.
What I ran
84aec8b0acfor main's fix.Results
Findings
84aec8b0ac5, which adds pending low-surrogate handling to fgetwc.pending == 0 && byte >= 0xf0). Read, not run.Sources
github.com/boykopovar/AnyPS5@7d100f768e/core/libs/prx/libc/src/StandardStreams.cpp (L100-L156)github.com/boykopovar/AnyPS5@7d100f768e/core/libs/prx/libc/src/Multibyte.cpp (L73)github.com/boykopovar/AnyPS5@84aec8b0acNot verified