Repository navigation
rust/obs-c-oracle: Replace the dstr conversion stubs with libobs code - #85
Merged
zackees merged 2 commits intoOct 10, 2026
Merged
Conversation
dstr_to_wcs, dstr_from_wcs, dstr_from_mbs and dstr_to_mbs run through the oracle's util/dstr.c, whose conversion helpers are stubs returning 0. Against those stubs, three of these four tests fail: every conversion yields NULL or nothing, where libobs converts. The empty dstr case passes, since NULL is libobs's answer too. Refs obs-rust#84 Co-Authored-By: Claude Opus 5.5 <[email protected]>
os_utf8_to_wcs_ptr, os_mbs_to_utf8_ptr and wchar_to_utf8 were stubs that returned 0 for every input, so the oracle's dstr_to_wcs, dstr_from_mbs and dstr_from_wcs failed where libobs converts. A port checked against them would have copied that failure (obs-rust#79 was the same problem with os_fopen). The oracle now compiles the real util/utf8.c, which converts with MultiByteToWideChar on Windows and in portable C elsewhere, as libobs does. oracle/platform_conv_host.c copies the platform.c conversions dstr.c reaches verbatim: os_{mbs,utf8}_to_wcs, os_wcs_to_utf8, and their _ptr forms plus os_mbs_to_utf8_ptr. It is a new file, so the os_fopen changes in obs-rust#82 do not conflict. Fixes obs-rust#84 Co-Authored-By: Claude Opus 5.5 <[email protected]>
6 tasks done
zackees
referenced
this pull request
in chriscoveries/obsrust-fork
Oct 10, 2026
The Windows oracle stub converted paths with MB_ERR_INVALID_CHARS and refused non-UTF-8 paths. libobs os_fopen goes through os_utf8_to_wcs_ptr and utf8_to_wchar (flags 0), substituting U+FFFD and attempting the mangled path. The oracle now calls the real conversion from platform_conv_host.c + util/utf8.c (#85) and mirrors platform.c / platform-windows.c for os_fopen, os_unlink, os_rename, os_safe_replace. non_utf8_filename_matches_oracle now runs on Windows. It is RED there: the oracle (like libobs) creates the U+FFFD-substituted file while the Rust core declines non-UTF-8 paths upfront. Refs #79 Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=31e492ec99b018c677d02a96412f6d1c30e372e4 secs=38 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791649374,"gate":"rust/all/fmt","host":"linux-x86_64","key":"8aa5b28fb4afc2904702ec9b93680280b753f6c5d3f5cdf9effe3ffd15292846","lane":"lint","parents":["11d60f0cc8ee82d2a15efcc6efd80acc2d6b60f5"],"secs":11,"stamp":"8823f1f258cdcf1fdcec7e217876da1d","tree":"31e492ec99b018c677d02a96412f6d1c30e372e4","v":1,"via":"run"} Ci-Attestation: {"at":1791649374,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"8aa5b28fb4afc2904702ec9b93680280b753f6c5d3f5cdf9effe3ffd15292846","lane":"lint","parents":["11d60f0cc8ee82d2a15efcc6efd80acc2d6b60f5"],"secs":11,"stamp":"2301a2226c55ad88c2b2bf6daca3a0a2","tree":"31e492ec99b018c677d02a96412f6d1c30e372e4","v":1,"via":"run"} Ci-Attestation: {"at":1791649374,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"a3028f92add1b468c524cfc3cbe728adccd979c6df36af8d02cd047f81d3e69a","lane":"rust-test","parents":["11d60f0cc8ee82d2a15efcc6efd80acc2d6b60f5"],"secs":7,"stamp":"7c38fb4c292d939a1c5b2540ba90a6a4","tree":"31e492ec99b018c677d02a96412f6d1c30e372e4","v":1,"via":"run"} Ci-Attestation: {"at":1791649374,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"cfe447ea48335660f96f390d752b3f752a654527c89a84ac9893cc731df6bae4","lane":"tier2-linux","parents":["11d60f0cc8ee82d2a15efcc6efd80acc2d6b60f5"],"secs":20,"stamp":"b493db31b8c6182780e30f331ee6387e","tree":"31e492ec99b018c677d02a96412f6d1c30e372e4","v":1,"via":"run"}
zackees
added a commit
that referenced
this pull request
Oct 10, 2026
…43) Phase 3 ports of libobs/util into the obs-util crate, each with a safe core, a C ABI shim, Tier 1 tests, a layout test where a struct crosses the ABI, and a proptest parity suite against the original C built as an oracle. ENABLE_RUST_LIBOBS=ON drops the matching C sources from libobs. - utf8: hidden and non-Windows only (Windows keeps the C utf8.c). - lexer.c: follows master's C, including the #48 strref ordering. - text-lookup: no longer crashes on an opening quote at end of line; the shim returns false for a NULL lookup. - dstr: follows master's #46/#47 fixes; strlist_split takes a NUL separator. Wide-char and printf helpers stay in dstr-libc.c. - bmem: Windows _aligned_* branch and the allocation counter. The oracle vendors uthash 2.3.0 (BSD-1-Clause) for text-lookup.c, since the Rust test runners have no uthash package. Refs #43 Rebased onto master after #61 (base), #66 (file-serializer) and #85 (real utf8.c in the oracle): the oracle's utf8.c/platform_conv_host.c now use oracle_* utf8 names so they no longer clash with the Rust shims; the dstr-conversion oracle test moved to obs-util and calls oracle_dstr_*; duplicate bcrash/os_fopen/bmemdup/os_*_ptr stand-ins were dropped in favour of master's base-variadic.c, file_serializer_host.c and platform_conv_host.c; utf8 shims are listed in rust-hidden.txt; the vendored uthash is excluded from clang-format. Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=f8f345fc846645c43b3c2eaa8beba80e61170919 secs=50 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791650348,"gate":"rust/all/fmt","host":"linux-x86_64","key":"5d788f859986e843d38c8eeda4bdd0dbf879a6b1ab69e87735fa7dc8a903072e","lane":"lint","parents":["e9d5e41e39e22729c453774feb82c8430e17a8f8"],"secs":15,"stamp":"b5ade2b00bc86726d90ce0af4807848f","tree":"f8f345fc846645c43b3c2eaa8beba80e61170919","v":1,"via":"run"} Ci-Attestation: {"at":1791650348,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"5d788f859986e843d38c8eeda4bdd0dbf879a6b1ab69e87735fa7dc8a903072e","lane":"lint","parents":["e9d5e41e39e22729c453774feb82c8430e17a8f8"],"secs":15,"stamp":"ada418f2ad1451744b412aa5f061905b","tree":"f8f345fc846645c43b3c2eaa8beba80e61170919","v":1,"via":"run"} Ci-Attestation: {"at":1791650348,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"2db21c07af54c47d710bfd0a2f9c401541637e3b4128840e6cfc5925e13df843","lane":"rust-test","parents":["e9d5e41e39e22729c453774feb82c8430e17a8f8"],"secs":10,"stamp":"05e830091e25865912b880bab7f6fd3a","tree":"f8f345fc846645c43b3c2eaa8beba80e61170919","v":1,"via":"run"} Ci-Attestation: {"at":1791650348,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"6cd30a151325eaae1cd37d93dd390e21ad24845efbac72b5338eb6cf7df95d20","lane":"tier2-linux","parents":["e9d5e41e39e22729c453774feb82c8430e17a8f8"],"secs":25,"stamp":"181b109c7353cb8952c42dfcf0124aad","tree":"f8f345fc846645c43b3c2eaa8beba80e61170919","v":1,"via":"run"}
This was referenced Oct 10, 2026
zackees
added a commit
that referenced
this pull request
Oct 10, 2026
…43) Phase 3 ports of libobs/util into the obs-util crate, each with a safe core, a C ABI shim, Tier 1 tests, a layout test where a struct crosses the ABI, and a proptest parity suite against the original C built as an oracle. ENABLE_RUST_LIBOBS=ON drops the matching C sources from libobs. - utf8: hidden and non-Windows only (Windows keeps the C utf8.c). - lexer.c: follows master's C, including the #48 strref ordering. - text-lookup: no longer crashes on an opening quote at end of line; the shim returns false for a NULL lookup. - dstr: follows master's #46/#47 fixes; strlist_split takes a NUL separator. Wide-char and printf helpers stay in dstr-libc.c. - bmem: Windows _aligned_* branch and the allocation counter. The oracle vendors uthash 2.3.0 (BSD-1-Clause) for text-lookup.c, since the Rust test runners have no uthash package. Refs #43 Rebased onto master after #61 (base), #66 (file-serializer) and #85 (real utf8.c in the oracle): the oracle's utf8.c/platform_conv_host.c now use oracle_* utf8 names so they no longer clash with the Rust shims; the dstr-conversion oracle test moved to obs-util and calls oracle_dstr_*; duplicate bcrash/os_fopen/bmemdup/os_*_ptr stand-ins were dropped in favour of master's base-variadic.c, file_serializer_host.c and platform_conv_host.c; utf8 shims are listed in rust-hidden.txt; the vendored uthash is excluded from clang-format. Rebased again onto master after #82/#83/#87/#97/#89: oracle build.rs keeps video_fourcc.c/task.c and drops the direct util/utf8.c (oracle/utf8.c already compiles it under oracle_* names, which platform_conv_host.c and #82's file_serializer_host.c use). Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=21926a8ffae3e3de7be0daaa6a529723f7497869 secs=50 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791654631,"gate":"rust/all/fmt","host":"linux-x86_64","key":"6277551b1197bae61a0a3563f9047b17c1e6d651b5cab860d7def119d1cbc569","lane":"lint","parents":["5502191074629b7f2e51dda6d89fa601ce22a01d"],"secs":12,"stamp":"92e0f34f8074164ecb0208cbd6f8ab26","tree":"21926a8ffae3e3de7be0daaa6a529723f7497869","v":1,"via":"run"} Ci-Attestation: {"at":1791654631,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"6277551b1197bae61a0a3563f9047b17c1e6d651b5cab860d7def119d1cbc569","lane":"lint","parents":["5502191074629b7f2e51dda6d89fa601ce22a01d"],"secs":12,"stamp":"4d3ace010dbaab4ed252006d22ec59aa","tree":"21926a8ffae3e3de7be0daaa6a529723f7497869","v":1,"via":"run"} Ci-Attestation: {"at":1791654631,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"c6b1b608fc16817859a28490ada2b38a926103a0094ec23e3bb7d594979793d7","lane":"rust-test","parents":["5502191074629b7f2e51dda6d89fa601ce22a01d"],"secs":18,"stamp":"d73d3c14d2d133a677293234ca581902","tree":"21926a8ffae3e3de7be0daaa6a529723f7497869","v":1,"via":"run"} Ci-Attestation: {"at":1791654631,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"d05a3c8a53e501ee21ca4d301b5ba053c0dccd6b86b39d46af0486606d1d851e","lane":"tier2-linux","parents":["5502191074629b7f2e51dda6d89fa601ce22a01d"],"secs":20,"stamp":"7dedfefe7e32a22a666716a1fd3efcb5","tree":"21926a8ffae3e3de7be0daaa6a529723f7497869","v":1,"via":"run"}
zackees
added a commit
that referenced
this pull request
Oct 10, 2026
…43) Phase 3 ports of libobs/util into the obs-util crate, each with a safe core, a C ABI shim, Tier 1 tests, a layout test where a struct crosses the ABI, and a proptest parity suite against the original C built as an oracle. ENABLE_RUST_LIBOBS=ON drops the matching C sources from libobs. - utf8: hidden and non-Windows only (Windows keeps the C utf8.c). - lexer.c: follows master's C, including the #48 strref ordering. - text-lookup: no longer crashes on an opening quote at end of line; the shim returns false for a NULL lookup. - dstr: follows master's #46/#47 fixes; strlist_split takes a NUL separator. Wide-char and printf helpers stay in dstr-libc.c. - bmem: Windows _aligned_* branch and the allocation counter. The oracle vendors uthash 2.3.0 (BSD-1-Clause) for text-lookup.c, since the Rust test runners have no uthash package. Refs #43 Rebased onto master after #61 (base), #66 (file-serializer) and #85 (real utf8.c in the oracle): the oracle's utf8.c/platform_conv_host.c now use oracle_* utf8 names so they no longer clash with the Rust shims; the dstr-conversion oracle test moved to obs-util and calls oracle_dstr_*; duplicate bcrash/os_fopen/bmemdup/os_*_ptr stand-ins were dropped in favour of master's base-variadic.c, file_serializer_host.c and platform_conv_host.c; utf8 shims are listed in rust-hidden.txt; the vendored uthash is excluded from clang-format. Rebased again onto master after #82/#83/#87/#97/#89/#98: oracle build.rs keeps video_fourcc.c/task.c and drops the direct util/utf8.c (oracle/utf8.c already compiles it under oracle_* names, which platform_conv_host.c and #82's file_serializer_host.c use). Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=1b426910df018155f8be2a2ed4dc5fd8b42d68a0 secs=17 lanes=lint:reused@12a747713c0b,rust-test:reused@8f0383f521c9,tier2-linux:run Ci-Attestation: {"at":1791655075,"gate":"rust/all/fmt","host":"linux-x86_64","key":"12a747713c0b7b727bbfb48e33e2c7c1aa431a3c77062fee88a56e5821c8b6c5","lane":"lint","parents":["84c80bce3c20e772d563e2c85b32ed5ac51020b4"],"secs":null,"stamp":"58719f015cf7d13d7f971c86c36023dd","tree":"1b426910df018155f8be2a2ed4dc5fd8b42d68a0","v":1,"via":"reused"} Ci-Attestation: {"at":1791655075,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"12a747713c0b7b727bbfb48e33e2c7c1aa431a3c77062fee88a56e5821c8b6c5","lane":"lint","parents":["84c80bce3c20e772d563e2c85b32ed5ac51020b4"],"secs":null,"stamp":"42c3a2e402903d1da67f91e332763625","tree":"1b426910df018155f8be2a2ed4dc5fd8b42d68a0","v":1,"via":"reused"} Ci-Attestation: {"at":1791655075,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"8f0383f521c9857941f5429d53f8403e48869775747f8ce4edeee1af4e935da8","lane":"rust-test","parents":["84c80bce3c20e772d563e2c85b32ed5ac51020b4"],"secs":null,"stamp":"814d385ae14911c99b750eff7d8faa6a","tree":"1b426910df018155f8be2a2ed4dc5fd8b42d68a0","v":1,"via":"reused"} Ci-Attestation: {"at":1791655401,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"2e94b41fc041e0c98bd1709f7ab30cb7f5b5b835b799b4c3abb2c5414d4b62ec","lane":"tier2-linux","parents":["84c80bce3c20e772d563e2c85b32ed5ac51020b4"],"secs":17,"stamp":"e6e3337d94f8a4dbafc4a9892b369084","tree":"1b426910df018155f8be2a2ed4dc5fd8b42d68a0","v":1,"via":"run"}
zackees
added a commit
that referenced
this pull request
Oct 10, 2026
…43) Phase 3 ports of libobs/util into the obs-util crate, each with a safe core, a C ABI shim, Tier 1 tests, a layout test where a struct crosses the ABI, and a proptest parity suite against the original C built as an oracle. ENABLE_RUST_LIBOBS=ON drops the matching C sources from libobs. - utf8: hidden and non-Windows only (Windows keeps the C utf8.c). - lexer.c: follows master's C, including the #48 strref ordering. - text-lookup: no longer crashes on an opening quote at end of line; the shim returns false for a NULL lookup. - dstr: follows master's #46/#47 fixes; strlist_split takes a NUL separator. Wide-char and printf helpers stay in dstr-libc.c. - bmem: Windows _aligned_* branch and the allocation counter. The oracle vendors uthash 2.3.0 (BSD-1-Clause) for text-lookup.c, since the Rust test runners have no uthash package. Refs #43 Rebased onto master after #61 (base), #66 (file-serializer) and #85 (real utf8.c in the oracle): the oracle's utf8.c/platform_conv_host.c now use oracle_* utf8 names so they no longer clash with the Rust shims; the dstr-conversion oracle test moved to obs-util and calls oracle_dstr_*; duplicate bcrash/os_fopen/bmemdup/os_*_ptr stand-ins were dropped in favour of master's base-variadic.c, file_serializer_host.c and platform_conv_host.c; utf8 shims are listed in rust-hidden.txt; the vendored uthash is excluded from clang-format. Rebased again onto master after #82/#83/#87/#97/#89/#98/#88: oracle build.rs keeps video_fourcc.c/task.c and drops the direct util/utf8.c (oracle/utf8.c already compiles it under oracle_* names, which platform_conv_host.c and #82's file_serializer_host.c use). Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=44ac22e2f9bf9093f2a87bc1c0860393942c7f05 secs=31 lanes=lint:reused@9b0282a9e1c3,rust-test:reused@e3680ff66806,tier2-linux:run Ci-Attestation: {"at":1791656844,"gate":"rust/all/fmt","host":"linux-x86_64","key":"9b0282a9e1c35c80eae0d4f0c7540b1c3b1c9f193daad522570bc7b20e609cdc","lane":"lint","parents":["07223a5abc85d40d9b7c016092ce37a672aca501"],"secs":null,"stamp":"ed3cee40895adfa7780a781e7ead1f4d","tree":"44ac22e2f9bf9093f2a87bc1c0860393942c7f05","v":1,"via":"reused"} Ci-Attestation: {"at":1791656844,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"9b0282a9e1c35c80eae0d4f0c7540b1c3b1c9f193daad522570bc7b20e609cdc","lane":"lint","parents":["07223a5abc85d40d9b7c016092ce37a672aca501"],"secs":null,"stamp":"9bde047cbb6c054fa18fa8143826c0c7","tree":"44ac22e2f9bf9093f2a87bc1c0860393942c7f05","v":1,"via":"reused"} Ci-Attestation: {"at":1791656844,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"e3680ff66806191a1385606c7996530d1becc162ef5a3444eeefce614a7d0c02","lane":"rust-test","parents":["07223a5abc85d40d9b7c016092ce37a672aca501"],"secs":null,"stamp":"46cf777b2d672af2f62536e2d4132bf2","tree":"44ac22e2f9bf9093f2a87bc1c0860393942c7f05","v":1,"via":"reused"} Ci-Attestation: {"at":1791657116,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"99939507781ddefb1aa7855e1a0c9b4af9092524f38999d7db36a74a20f1ccce","lane":"tier2-linux","parents":["07223a5abc85d40d9b7c016092ce37a672aca501"],"secs":31,"stamp":"8164638665d4208fabc4b0a768fbc870","tree":"44ac22e2f9bf9093f2a87bc1c0860393942c7f05","v":1,"via":"run"}
zackees
added a commit
that referenced
this pull request
Oct 10, 2026
…43) Phase 3 ports of libobs/util into the obs-util crate, each with a safe core, a C ABI shim, Tier 1 tests, a layout test where a struct crosses the ABI, and a proptest parity suite against the original C built as an oracle. ENABLE_RUST_LIBOBS=ON drops the matching C sources from libobs. - utf8: hidden and non-Windows only (Windows keeps the C utf8.c). - lexer.c: follows master's C, including the #48 strref ordering. - text-lookup: no longer crashes on an opening quote at end of line; the shim returns false for a NULL lookup. - dstr: follows master's #46/#47 fixes; strlist_split takes a NUL separator. Wide-char and printf helpers stay in dstr-libc.c. - bmem: Windows _aligned_* branch and the allocation counter. The oracle vendors uthash 2.3.0 (BSD-1-Clause) for text-lookup.c, since the Rust test runners have no uthash package. Refs #43 Rebased onto master after #61 (base), #66 (file-serializer) and #85 (real utf8.c in the oracle): the oracle's utf8.c/platform_conv_host.c now use oracle_* utf8 names so they no longer clash with the Rust shims; the dstr-conversion oracle test moved to obs-util and calls oracle_dstr_*; duplicate bcrash/os_fopen/bmemdup/os_*_ptr stand-ins were dropped in favour of master's base-variadic.c, file_serializer_host.c and platform_conv_host.c; utf8 shims are listed in rust-hidden.txt; the vendored uthash is excluded from clang-format. Rebased again onto master after #82/#83/#87/#97/#89/#98/#88/#105: oracle build.rs keeps video_fourcc.c/task.c and drops the direct util/utf8.c (oracle/utf8.c already compiles it under oracle_* names, which platform_conv_host.c and #82's file_serializer_host.c use). Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=58f2156a689831720a1e6ad9004041e400917579 secs=135 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791658556,"gate":"rust/all/fmt","host":"linux-x86_64","key":"e533312cff231c50944045005e90c2b48ce1920b317c9037a705bfda5b49ef4c","lane":"lint","parents":["930903b5e8c0cac6cec54edd05abeaacb825637c"],"secs":17,"stamp":"a33efc3cd6c98f3fbd2fa57e9a61a281","tree":"58f2156a689831720a1e6ad9004041e400917579","v":1,"via":"run"} Ci-Attestation: {"at":1791658556,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"e533312cff231c50944045005e90c2b48ce1920b317c9037a705bfda5b49ef4c","lane":"lint","parents":["930903b5e8c0cac6cec54edd05abeaacb825637c"],"secs":17,"stamp":"fb2d0a58bcefb05085a4b512fc916740","tree":"58f2156a689831720a1e6ad9004041e400917579","v":1,"via":"run"} Ci-Attestation: {"at":1791658556,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"1a00cb7a8eb7b67b33a108e748711133d604e544b254813435cc1ca5ea24cd26","lane":"rust-test","parents":["930903b5e8c0cac6cec54edd05abeaacb825637c"],"secs":22,"stamp":"d80b75173a27c995da2676193fa36904","tree":"58f2156a689831720a1e6ad9004041e400917579","v":1,"via":"run"} Ci-Attestation: {"at":1791658556,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"a950373231b455174e5c031fe578e1e48c61e04f0387195a7ddc0e265e371e15","lane":"tier2-linux","parents":["930903b5e8c0cac6cec54edd05abeaacb825637c"],"secs":96,"stamp":"f1c2d81609277e26492a5a3f3553cd9c","tree":"58f2156a689831720a1e6ad9004041e400917579","v":1,"via":"run"}
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #84.
rust/obs-c-oracle/oracle/file_serializer_host.cstubbed the three conversion helpers thatutil/dstr.ccalls,os_utf8_to_wcs_ptr,os_mbs_to_utf8_ptrandwchar_to_utf8. All three returned 0 for every input. Since #66 compilesdstr.cinto the oracle, itsdstr_to_wcs,dstr_from_mbs,dstr_from_wcsanddstr_to_mbsproduced NULL or nothing where libobs converts. #84 reported the first stub; the other two are the same bug in the next lines.The fix uses libobs's own code instead of new stand-ins:
build.rscompiles the realutil/utf8.c. Like libobs, it usesMultiByteToWideCharon Windows and the portable C decoder elsewhere. oracle os_utf8_to_wcs_ptr stub returns 0 for every input and is reachable from dstr_to_wcs #84 suggestedMultiByteToWideChardirectly, but libobs only does that on Windows:os_utf8_to_wcsgoes throughutf8_to_wchareverywhere.oracle/platform_conv_host.ccopies theplatform.cfunctionsdstr.creaches, verbatim:os_mbs_to_wcs,os_utf8_to_wcs,os_wcs_to_utf8, their_ptrforms, andos_mbs_to_utf8_ptr.file_serializer_host.c. The new code lives in its own file, so this merges cleanly with fix(oracle): match libobs U+FFFD substitution in the os_fopen stub #82, which editsos_fopenin that file (checked withgit merge-tree).Motivation and Context
A stub that answers differently from libobs makes the differential tests certify that difference, which is how #79 reached
file_serializer.rs. Here every conversion "failed", so the first port to compare a dstr conversion would have copied that.Heads-up for #68: it ports
utf8.cto Rust. Once it lands, itsutf8_to_wchar/wchar_to_utf8shims and this oracle's C copies will both define those names in test binaries. The removedwchar_to_utf8stub had the same clash, so #68 needed to handle it either way, for example by renaming these copies or dropping them in favour of the port.How Has This Been Tested?
Windows 11, MSVC 14.44.
tests/dstr_conversions.rspinsdstr_to_wcsanddstr_from_wcson UTF-8 with 2-, 3- and 4-byte sequences (a surrogate pair wherewchar_tis 16 bits). It also pinsdstr_from_mbs/dstr_to_mbson ASCII (the C locale) anddstr_to_wcsof an empty dstr (NULL, as in libobs).soldr cargo test --workspace(32 binaries) andpython ci/local_gate.py --lane lintpass.Linux and macOS (the non-Windows
utf8.cbranch, 32-bitwchar_t) are first exercised by this CI run.Types of changes
Checklist:
🤖 Generated with Claude Code