-
Notifications
You must be signed in to change notification settings - Fork 513
**[IMPROVEMENT]** Port hex_to_int from C to Rust #1774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
**[IMPROVEMENT]** Port hex_to_int from C to Rust #1774
Conversation
cfsmp3
left a comment
There was a problem hiding this 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.
|
Thanks @cfsmp3 for review and i have done the necessary changes , i think now it is ready to merge |
|
Maybe you haven't pushed yet?
…On Wed, Dec 17, 2025, 07:33 Ishwar ***@***.***> wrote:
*ishwarthecodddr* left a comment (CCExtractor/ccextractor#1774)
<#1774 (comment)>
Thanks @cfsmp3 <https://github.com/cfsmp3> for review and i have done the
necessary changes , i think now it is ready to merge
—
Reply to this email directly, view it on GitHub
<#1774 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABNMTWKWCBBH7ZAXKETGU334CD2LFAVCNFSM6AAAAACNRNOL6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMNRTHA3DQMZXGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
14d78c0 to
25fe3a2
Compare
|
@cfsmp3 it's done now. |
|
@ishwarthecodddr this needs rebase. Please remove CHANGES.txt there - no changes needed (this small thing shouldn't appear in the summary, it's not important to final users). Other than that, LGTM. |
Replace all sprintf calls with snprintf to prevent potential buffer overflows in CEA-708 output functions. Key changes: - dtvcc_change_pen_colors: add bounds checking for font color tags - dtvcc_change_pen_attribs: add bounds checking for italic/underline tags - dtvcc_write_srt: track buffer length with snprintf - dtvcc_write_transcript: add bounds checking for CC/mode labels - dtvcc_write_sami_header: use snprintf macro for all SAMI tags - dtvcc_write_sami_footer: use snprintf with length check - dtvcc_write_sami: add bounds checking for sync tags - dtvcc_write_scc_header: use snprintf for SCC header - add_needed_scc_labels: add buffer size parameter for safe writes - dtvcc_write_scc: use snprintf macro for all SCC formatting - dtvcc_writer_init: use snprintf for filename suffix 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Fix macro formatting to have 'do' and '{' on separate lines and
align backslashes consistently, as required by clang-format.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Replace all sprintf calls with snprintf to prevent potential buffer overflows in CEA-708 output functions. Key changes: - dtvcc_change_pen_colors: add bounds checking for font color tags - dtvcc_change_pen_attribs: add bounds checking for italic/underline tags - dtvcc_write_srt: track buffer length with snprintf - dtvcc_write_transcript: add bounds checking for CC/mode labels - dtvcc_write_sami_header: use snprintf macro for all SAMI tags - dtvcc_write_sami_footer: use snprintf with length check - dtvcc_write_sami: add bounds checking for sync tags - dtvcc_write_scc_header: use snprintf for SCC header - add_needed_scc_labels: add buffer size parameter for safe writes - dtvcc_write_scc: use snprintf macro for all SCC formatting - dtvcc_writer_init: use snprintf for filename suffix 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Fix macro formatting to have 'do' and '{' on separate lines and
align backslashes consistently, as required by clang-format.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Replace `.unwrap()` and `.expect()` calls with safe alternatives to prevent Rust panics when processing multiple files with different characteristics (e.g., DVD-type followed by HDTV-type). Changes: - Use `unwrap_or(0)` for all type conversions that could fail - Handle RwLock poisoning gracefully in apply_timing_info/write_back_from_timing_info - Add fps validation and millis capping in GopTimeCode::new() - Add fallback calculation in ccxr_calculate_ms_gop_time when GopTimeCode creation fails Fixes CCExtractor#1377 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-authored-by: Rahul-2k4 <[email protected]>
5324267 to
d6bae9b
Compare
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 6dcdb4b...:
Your PR breaks these cases:
Congratulations: Merging this PR would fix the following tests:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit a8ec286...:
Congratulations: Merging this PR would fix the following tests:
All tests passed completely. Check the result page for more info. |
|
Hi @ishwarthecodddr, this PR needs:
Let us know if you're still interested in completing this. |
|
Hi @ishwarthecodddr, this PR has some issues that need fixing: CI Failures:
Unrelated Changes:
Please:
The actual hex_to_int port looks fine, just needs these cleanup items. |
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
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.