[PR #1873] [MERGED] fix(windows): Fix c_long ABI mismatch causing Windows CI failures #2647

Open
opened 2026-01-29 17:23:15 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1873
Author: @cfsmp3
Created: 12/21/2025
Status: Merged
Merged: 12/21/2025
Merged by: @cfsmp3

Base: masterHead: fix/windows-c_long-abi-mismatch


📝 Commits (3)

  • 2c67381 fix(windows): Fix c_long ABI mismatch in demuxer.rs
  • 9e19c58 refactor: Replace platform-dependent 'long' with 'int64_t'
  • 5458370 refactor: Replace c_longlong with i64 for consistency

📊 Changes

9 files changed (+22 additions, -22 deletions)

View changed files

📝 src/lib_ccx/asf_constants.h (+1 -1)
📝 src/lib_ccx/avc_functions.h (+6 -6)
📝 src/lib_ccx/ccx_decoders_608.h (+1 -1)
📝 src/lib_ccx/ccx_demuxer.h (+2 -2)
📝 src/lib_ccx/file_functions.c (+1 -1)
📝 src/lib_ccx/lib_ccx.h (+2 -2)
📝 src/lib_ccx/ts_functions.c (+1 -1)
📝 src/rust/src/common.rs (+3 -3)
📝 src/rust/src/libccxr_exports/demuxer.rs (+5 -5)

📄 Description

Summary

Fixes Windows-specific CI test failures caused by platform-dependent type issues in the C/Rust FFI layer.

Problem

The C type long has different sizes on different platforms:

  • Linux: 64-bit
  • Windows: 32-bit

This caused ABI mismatches when interfacing with Rust, since Rust's c_long matches the platform's long size.

Changes

1. Fix ABI mismatch in demuxer.rs (Commit 1)

The extern declaration for ccxr_add_current_pts used c_long, but the actual implementation uses i64:

// Before (WRONG on Windows)
fn ccxr_add_current_pts(ctx: *mut ccx_common_timing_ctx, pts: c_long);

// After (CORRECT)
fn ccxr_add_current_pts(ctx: *mut ccx_common_timing_ctx, pts: i64);

2. Replace all long with int64_t in C code (Commit 2)

Changed the following fields from long to int64_t:

File Fields Changed
asf_constants.h parsebufsize
avc_functions.h cc_databufsize, num_nal_unit_type_7, num_vcl_hrd, num_nal_hrd, num_jump_in_frames, num_unexpected_sei_length
ccx_decoders_608.h bytes_processed_608
ccx_demuxer.h capbufsize, capbuflen
lib_ccx.h ts_readstream() return type, FILEBUFFERSIZE

Also updated Rust code in common.rs to remove c_long casts (bindgen will now generate i64 for these fields).

Expected Impact

Should fix Windows-specific failures in:

  • Tests 226-230 (startcredits) - corrupted output
  • Tests 28, 37, 136 (General) - timing offsets
  • Possibly Test 21 (DVB) and Test 162 (spupng)

Test Plan

  • Builds successfully on Linux
  • Rust clippy passes with no warnings
  • Windows CI should show improvement in failing tests

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/1873 **Author:** [@cfsmp3](https://github.com/cfsmp3) **Created:** 12/21/2025 **Status:** ✅ Merged **Merged:** 12/21/2025 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `fix/windows-c_long-abi-mismatch` --- ### 📝 Commits (3) - [`2c67381`](https://github.com/CCExtractor/ccextractor/commit/2c67381d2b45cfefa3560836e40a484f090f8505) fix(windows): Fix c_long ABI mismatch in demuxer.rs - [`9e19c58`](https://github.com/CCExtractor/ccextractor/commit/9e19c58edff60ac7fdb1ea3443612daa1f0d1159) refactor: Replace platform-dependent 'long' with 'int64_t' - [`5458370`](https://github.com/CCExtractor/ccextractor/commit/54583703467a6e8d5bf943f91895bc8b9a070c59) refactor: Replace c_longlong with i64 for consistency ### 📊 Changes **9 files changed** (+22 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `src/lib_ccx/asf_constants.h` (+1 -1) 📝 `src/lib_ccx/avc_functions.h` (+6 -6) 📝 `src/lib_ccx/ccx_decoders_608.h` (+1 -1) 📝 `src/lib_ccx/ccx_demuxer.h` (+2 -2) 📝 `src/lib_ccx/file_functions.c` (+1 -1) 📝 `src/lib_ccx/lib_ccx.h` (+2 -2) 📝 `src/lib_ccx/ts_functions.c` (+1 -1) 📝 `src/rust/src/common.rs` (+3 -3) 📝 `src/rust/src/libccxr_exports/demuxer.rs` (+5 -5) </details> ### 📄 Description ## Summary Fixes Windows-specific CI test failures caused by platform-dependent type issues in the C/Rust FFI layer. ### Problem The C type `long` has different sizes on different platforms: - **Linux:** 64-bit - **Windows:** 32-bit This caused ABI mismatches when interfacing with Rust, since Rust's `c_long` matches the platform's `long` size. ### Changes #### 1. Fix ABI mismatch in demuxer.rs (Commit 1) The extern declaration for `ccxr_add_current_pts` used `c_long`, but the actual implementation uses `i64`: ```rust // Before (WRONG on Windows) fn ccxr_add_current_pts(ctx: *mut ccx_common_timing_ctx, pts: c_long); // After (CORRECT) fn ccxr_add_current_pts(ctx: *mut ccx_common_timing_ctx, pts: i64); ``` #### 2. Replace all `long` with `int64_t` in C code (Commit 2) Changed the following fields from `long` to `int64_t`: | File | Fields Changed | |------|----------------| | `asf_constants.h` | `parsebufsize` | | `avc_functions.h` | `cc_databufsize`, `num_nal_unit_type_7`, `num_vcl_hrd`, `num_nal_hrd`, `num_jump_in_frames`, `num_unexpected_sei_length` | | `ccx_decoders_608.h` | `bytes_processed_608` | | `ccx_demuxer.h` | `capbufsize`, `capbuflen` | | `lib_ccx.h` | `ts_readstream()` return type, `FILEBUFFERSIZE` | Also updated Rust code in `common.rs` to remove `c_long` casts (bindgen will now generate `i64` for these fields). ### Expected Impact Should fix Windows-specific failures in: - Tests 226-230 (startcredits) - corrupted output - Tests 28, 37, 136 (General) - timing offsets - Possibly Test 21 (DVB) and Test 162 (spupng) ## Test Plan - [x] Builds successfully on Linux - [x] Rust clippy passes with no warnings - [ ] Windows CI should show improvement in failing tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:23:15 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2647