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

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

Original Pull Request: https://github.com/CCExtractor/ccextractor/pull/1873

State: closed
Merged: Yes


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

**Original Pull Request:** https://github.com/CCExtractor/ccextractor/pull/1873 **State:** closed **Merged:** Yes --- ## 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)
claunia added the pull-request label 2026-01-29 17:23:16 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2651