Skip to content

Conversation

@ishwarthecodddr
Copy link

In raising this pull request, I confirm the following (please check boxes):

  • [*] I have read and understood the contributors guide.
  • [*] I have checked that another pull request for this purpose does not exist.
  • [*] I have considered, and confirmed that this submission will be valuable to others.
  • [*] I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • [*] I give this submission freely, and claim no ownership to its content.
  • [*] I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • [*] I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

Description
This PR ports the hex_to_int utility function from C (src/lib_ccx/utility.c) to Rust (src/rust/lib_ccxr/src/util/hex.rs) as part of the ongoing Rust migration effort.
Changes
Created src/rust/lib_ccxr/src/util/hex.rs with the Rust implementation. Exposed the function via C-FFI in
src/rust/src/libccxr_exports/util.rs
Updated src/lib_ccx/utility.c to use the Rust implementation when DISABLE_RUST is not defined.

Changes :- Created src/rust/lib_ccxr/src/util/hex.rs with the Rust implementation.Exposed the function via C-FFI in src/rust/src/libccxr_exports/util.rs.
Updated :- src/lib_ccx/utility.c to use the Rust implementation when DISABLE_RUST is not defined.

Verification :- Ran cargo test -p lib_ccxr and verified that all tests passed, including the new
test_hex_to_int.

Copy link
Contributor

@cfsmp3 cfsmp3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work on this C-to-Rust port! I've done a deep review and the implementation is correct.

Results

  • ALL CI tests pass on Linux (237/237)
  • ✅ Would FIX 1 test that has never passed before (hardsubx sample 184)
  • ✅ Faithful port - Rust behavior exactly matches C behavior
  • ✅ Good test coverage with unit tests
  • ✅ Proper FFI export with extern "C" and #[no_mangle]
  • ✅ Correct conditional compilation pattern (#ifndef DISABLE_RUST)
  • ✅ Changelog updated

Before Merge

Please rebase on master - the PR has merge conflicts.

Windows Build Failure

The Windows build failure is due to vcpkg infrastructure issues, not your code. This is a known issue affecting multiple PRs.

Once rebased, this is ready to merge!


Note: Both the C and Rust versions only handle lowercase hex ('a'-'f'). While uppercase ('A'-'F') support could be a nice enhancement, that would be a separate PR - your port correctly matches the existing C behavior.

@ishwarthecodddr
Copy link
Author

Thanks @cfsmp3 for review and i have done the necessary changes , i think now it is ready to merge

@cfsmp3
Copy link
Contributor

cfsmp3 commented Dec 17, 2025 via email

@ishwarthecodddr
Copy link
Author

@cfsmp3 it's done now.

@ccextractor-bot
Copy link
Collaborator

CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 588ad52...:
Report Name Tests Passed
Broken 13/13
CEA-708 8/14
DVB 7/7
DVD 3/3
DVR-MS 2/2
General 27/27
Hardsubx 0/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 85/86
Teletext 21/21
WTV 13/13
XDS 34/34

NOTE: The following tests have been failing on the master branch as well as the PR:

Congratulations: Merging this PR would fix the following tests:

  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds 8e8229b88b..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 7236304cfc..., Last passed: Never
  • ccextractor --out=srt --latin1 06b3a9237d..., Last passed: Never
  • ccextractor --out=srt --latin1 83f8cceb74..., Last passed: Never
  • ccextractor --out=srt --latin1 611b4a9235..., Last passed: Never
  • ccextractor --out=srt --latin1 b46e9e8e3f..., Last passed: Never
  • ccextractor --out=srt --latin1 89e417e622..., Last passed: Never
  • ccextractor --out=srt --latin1 d59eadc4ed..., Last passed: Never
  • ccextractor --out=sami --latin1 --autoprogram --no-goptime 5b4e0a6034..., Last passed: Never
  • ccextractor --autoprogram --out=srt --latin1 --quant 0 85271be4d2..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 5ae2007a79..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 1e44efd810..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 add511677c..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 9a496d3828..., Last passed: Never
  • ccextractor --out=srt --latin1 --autoprogram 56c9f34548..., Last passed: Never
  • ccextractor --autoprogram --out=srt --latin1 e9b9008fdf..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 c032183ef0..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 d037c7509e..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 1974a299f0..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 132d7df7e9..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 99e5eaafdc..., Last passed: Never
  • ccextractor --autoprogram --out=srt --latin1 b22260d065..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla 7aad20907e..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla c41f73056a..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla 5d3a29f9f8..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla 70000200c0..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla 6dc772d881..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla dab1c1bd65..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla adce82fd39..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 01509e4d27..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla ab9cf8cfad..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --output-field 2 5d3a29f9f8..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --output-field 2 c41f73056a..., Last passed: Never
  • ccextractor --autoprogram --out=srt --latin1 --sentencecap c032183ef0..., Last passed: Never
  • ccextractor --autoprogram --out=bin --latin1 c032183ef0..., Last passed: Never
  • ccextractor --hauppauge --autoprogram --out=srt --latin1 a03b5b2a56..., Last passed: Never
  • ccextractor --autoprogram --out=srt --hauppauge --latin1 553d78e755..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --hauppauge --ucla --latin1 553d78e755..., Last passed: Never
  • ccextractor --out=txt c83f765c66..., Last passed: Never
  • ccextractor --out=ttxt c83f765c66..., Last passed: Never
  • ccextractor --out=spupng c83f765c66..., Last passed: Never
  • ccextractor --goptime c83f765c66..., Last passed: Never
  • ccextractor --unixts 5 --out=txt c83f765c66..., Last passed: Never
  • ccextractor --out=txt --datets c83f765c66..., Last passed: Never
  • ccextractor --out=txt --sects c83f765c66..., Last passed: Never
  • ccextractor --out=txt --lf c83f765c66..., Last passed: Never
  • ccextractor --in=es dc7169d7c4..., Last passed: Never
  • ccextractor --in=wtv b46e9e8e3f..., Last passed: Never
  • ccextractor --wtvmpeg2 10f0f77cf4..., Last passed: Never
  • ccextractor --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsnotbefore 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsnotafter 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsforatleast 1 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --startcreditsforatmost 2 --startcreditstext "CCextractor Start crdit Testing" c4dd893cb9..., Last passed: Never
  • ccextractor --endcreditstext "CCextractor Ends crdit Testing" addf5e2fc9..., Last passed: Never
  • ccextractor --endcreditsforatleast 3 --endcreditstext "CCextractor Ends crdit Testing" addf5e2fc9..., Last passed: Never
  • ccextractor --endcreditsforatmost 2 --endcreditstext "CCextractor Ends crdit Testing" addf5e2fc9..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --datets dcada745de..., Last passed: Never
  • ccextractor --out=srt --latin1 f23a544ba8..., Last passed: Never
  • ccextractor --out=srt --latin1 97cc394d87..., Last passed: Never
  • ccextractor --out=srt --latin1 10f0f77cf4..., Last passed: Never
  • ccextractor --out=srt --latin1 df3b4d62d3..., Last passed: Never
  • ccextractor --out=srt --latin1 d7e7dbdf68..., Last passed: Never
  • ccextractor --out=srt --latin1 76734ac4a7..., Last passed: Never
  • ccextractor --out=srt --latin1 c791382c94..., Last passed: Never
  • ccextractor --out=srt --latin1 f673b2f916..., Last passed: Never
  • ccextractor --out=srt --latin1 da75bdee47..., Last passed: Never
  • ccextractor --out=srt --latin1 bd6f33a669..., Last passed: Never
  • ccextractor --out=srt --latin1 0e5e6b26be..., Last passed: Never
  • ccextractor --out=srt --latin1 a226cc302d..., Last passed: Never
  • ccextractor --out=srt --latin1 ae6327683e..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds 725a49f871..., Last passed: Never
  • ccextractor --autoprogram --out=srt --latin1 --ucla b22260d065..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --xds --ucla c813e713a0..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds b992e0cccb..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds d0291cdcf6..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds c8dc039a88..., Last passed: Never
  • ccextractor --autoprogram --out=srt --latin1 --ucla 53339f3455..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds 83b03036a2..., Last passed: Never
  • ccextractor --autoprogram --out=ttxt --latin1 --ucla --xds 7d3f25c32c..., Last passed: Never
  • ccextractor --autoprogram --out=srt --latin1 --ucla 7d3f25c32c..., Last passed: Never

All tests passing on the master branch were passed completely.

Check the result page for more info.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants