Skip to content

facade: libobs/util/platform.c and profiler-io.c: move 7 platform conditionals into platform-<os> files #874

Closed

Description

@zackees

Part of #847.

platform.c is not swapped for Rust under ENABLE_RUST_LIBOBS (only base/bmem/config-file/dstr/pipe/profiler/utf8 are); profiler-io.c is compiled in both builds. Targets: util/platform-windows.c, platform-nix.c, platform-cocoa.m.

Class totals: (a) movable 7, (b) stays - public header 0, (c) Rust-ported 0. Total: 7. Line numbers on origin/master.

file:line macro branch class proposed function / target
libobs/util/platform.c:37 _MSC_VER os_fopen mode converted to wide char a os_fopen Windows body in platform-windows.c
libobs/util/platform.c:57 _WIN32 wide-char fopen (UTF-8 path to wcs) a same
libobs/util/platform.c:92 _WIN32 os_stat implementation using wide stat a move to platform-windows.c
libobs/util/platform.c:125 _MSC_VER os_fseeki64: _fseeki64 vs fseeko a os_fseeki64/os_ftelli64 in platform-windows.c and platform-nix.c
libobs/util/platform.c:134 _MSC_VER os_ftelli64: _ftelli64 vs ftello a same
libobs/util/profiler-io.c:343 _WIN32 gzopen_w with wide filename a os_gzopen(const char*,const char*) in platform-.c
libobs/util/profiler-io.c:360 _WIN32 gzclose_w vs gzclose a os_gzclose in platform-.c

Classes: (a) movable behind per-platform files; (b) public-header ABI/export/type selection, stays; (c) already replaced by the Rust port (platform code isolated in src/platform/). Macro column abbreviates the #if expression; ! means negated, elif means an #elif line.

Test approach: Existing cmocka util tests (Tier 2 Linux Rust OFF/ON) incl. os_fopen/os_fseeko; Windows branch via native build; add a characterization test of os_fopen/os_stat on a UTF-8 path.

Each move is one function per facade entry, mechanical, so upstream merges stay manageable; the ratchet baseline (step 1) drops by the moved count.

Activity

  1. zackees commented on Oct 24, 2026

    @zackees
    MemberAuthor

    Claiming: #874. The 7 conditionals are still on master: libobs/util/platform-file.c.h (5, from platform.c) and profiler-io.c.h (2).

    1. RED: a ci/ facade test asserting these two files have no host conditionals and that the Windows/nix bodies live in platform-windows.c.h / platform-nix.c.h.
    2. GREEN: move os_fopen/os_stat/os_fseeki64/os_ftelli64 bodies into the host files (all are C-only ported-* groups, so the build sets match). The gz open/close move behind a private (non-public) header. Lower the ratchet baseline by 7.
      No public header changes. PR today.
  2. added
    claimed
    on Oct 24, 2026
  3. zackees commented on Oct 24, 2026

    @zackees
    MemberAuthor

    #2016 removes 1 of the 7 conditionals: gzclose replaces the Windows-only gzclose_w branch. The other 6 need more than a mechanical move.

    • Oracle: rust/obs-c-oracle/oracle/platform.c compiles platform-file.c.h on its own with oracle_ renames. If the bodies move into platform-nix.c.h / platform-windows.c.h, the same renames have to be added to oracle/platform_nix_posix.c and oracle/platform_windows.c.
    • MinGW: os_wfopen, os_fseeki64 and os_ftelli64 branch on _MSC_VER, not _WIN32. So MinGW has a third variant: UTF-8 conversion plus fopen, fseeko and ftello. build.rs drops platform_windows.c for windows-gnu (rust: Port libobs/util/platform-windows.c to obs-util #707), so after a plain move the windows-gnu oracle would have no oracle_os_fopen. It needs either a MinGW home for those bodies or a decision that windows-gnu stops using them.
    • gzopen: the gzopen_w branch in profiler-io.c.h needs a host gzopen helper behind a private header, plus zlib in the windows/posix host PCHs. The profiler-io oracle unit would then need it too.

    I'm releasing the remainder after #2016. Releasing #874 (rest).

  4. moved this from In progress to Triage in obs-rust Multiviewon Oct 25, 2026
  5. removed
    claimed
    on Oct 25, 2026
  6. added
    P3
    size:M
    on Oct 25, 2026
  7. zackees commented on Oct 25, 2026

    @zackees
    MemberAuthor

    /ready

    Triage: scoped (7 conditionals, 1 removed by #2016). The remaining 6 have the oracle constraint described above (rust/obs-c-oracle/oracle/platform.c builds platform-file.c.h alone with oracle_ renames), so a PR has to keep the oracle building those bodies. Acceptance: the 6 moved into the host files, the oracle and the Tier 3 differential tests unchanged and green, and the ratchet baseline lowered. P3, size:M.

  8. added
    ready
    on Oct 25, 2026
  9. zackees commented on Oct 25, 2026

    @zackees
    MemberAuthor

    Claiming: #874 (the remaining 6). Plan: move the bodies into the host files, keep the oracle building them (including windows-gnu), lower the ratchet baseline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3readysize:M

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions