Repository navigation
util: Move platform.c file helpers into platform-file.c - #1443
Merged
Merged
Conversation
Refs obs-rust#262 (slice 3, files). Behavior-neutral extraction before the Rust port: os_wfopen, os_fopen, os_fgetsize, os_stat (Windows), os_fseeki64, os_ftelli64, os_fread_mbs, os_fread_utf8, os_quick_read_*/os_quick_write_* (incl. _safe) and os_get_file_size move verbatim from libobs/util/platform.c.h into libobs/util/platform-file.c.h, in the same libobs.platform unity group and precompiled header. The oracle compiles both files. The five host conditionals move with the code (platform-ifdef baseline 5 -> 5). test_platform_file characterizes what test_platform leaves uncovered: os_wfopen, os_fread_mbs, os_fgetsize restoring the position, seeks past 4 GiB, os_stat, zero-length writes and NULL paths. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
|
Windows/macOS evidence for this PR, from the stacked port #1444, whose head (
The full app builds (Build / Windows, macOS) are still path-scoped off in both PRs. BUILD.md's |
swilk19
marked this pull request as ready for review
October 18, 2026 22:42
zackees
approved these changes
Oct 18, 2026
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.
Refs #262 (slice 3, files).
Behavior-neutral extraction, as the testing policy asks before a partial-file port:
os_wfopen,os_fopen,os_fgetsize,os_stat(Windows),os_fseeki64/os_ftelli64,os_fread_mbs/os_fread_utf8,os_quick_read_*/os_quick_write_*(incl._safe) andos_get_file_sizemove verbatim fromlibobs/util/platform.c.hintolibobs/util/platform-file.c.h(both halves checked withdiffagainst the original). No Rust, no signature, header or behavior change.libobs.platformunity group andlibobs-platform.pch.h(it needs the same_FILE_OFFSET_BITS 64).rust/obs-c-oracle/oracle/platform.cincludes both files, so the oracle still runs the real C.platform.c.h5 →platform-file.c.h5, total unchanged).New characterization test
test_platform_file(tests.d/fragment, plus the Cargo C-test manifest) for whattest_platformdoesn't cover:os_wfopenwith a non-ASCII path,os_fread_mbscalled directly (it leaves the position at EOF: characterized, not endorsed),os_fgetsizerestoring the position,os_fseeki64/os_ftelli64past 4 GiB,os_staton a file, directory and missing path, zero-length writes, and NULL paths.Local:
./unittestgreen, with 305/305 cmocka tests passing against bothlibobsandlibobs-with-rust, includingtest_platform_file../lint: build-groups, ifdef ratchet, clang-format and gersemi pass. Windows locally (xwin, clang-cl oracle): 499/508 obs-util tests pass; the 9 failures are WSL-only (UNC working directory, interop process spawns) and are in pipe/abs-path code outside this slice.Windows/macOS: this changes a unity group, and the moved code has Windows branches, but PR CI scopes it Linux-only. Per BUILD.md ("Verifying a change"), could a maintainer dispatch the full build (
gh workflow run ci.yml --ref <branch>)? I don't have dispatch rights. Kept as a draft until Windows passes. The Rust port (RED, then GREEN) follows in a separate PR.🤖 Generated with Claude Code