[PR #1774] **[IMPROVEMENT]** Port hex_to_int from C to Rust #2501

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

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1774
Author: @ishwarthecodddr
Created: 11/29/2025
Status: 🔄 Open

Base: masterHead: port-hex-to-int


📝 Commits (10+)

  • 3e67f5d fix(708_output): replace sprintf with snprintf for buffer safety
  • 10e105d style: fix clang-format issues in macro definitions
  • 1e82253 fix(708_output): replace sprintf with snprintf for buffer safety
  • 2d355b6 style: fix clang-format issues in macro definitions
  • 9592e27 fix(rust): prevent panics in timing code when processing multiple files
  • 8a6b9e3 Initial plan
  • ef539fa Remove unintended Cargo.lock changes
  • c91f806 Initial plan
  • d6bae9b Port hex_to_int from C to Rust
  • 2cf6d06 cleaned commits

📊 Changes

7 files changed (+323 additions, -499 deletions)

View changed files

📝 src/lib_ccx/general_loop.c (+2 -2)
📝 src/lib_ccx/utility.c (+7 -0)
📝 src/rust/Cargo.lock (+277 -497)
src/rust/lib_ccxr/src/util/hex.rs (+28 -0)
📝 src/rust/lib_ccxr/src/util/mod.rs (+1 -0)
📝 src/rust/src/libccxr_exports/mod.rs (+1 -0)
src/rust/src/libccxr_exports/util.rs (+7 -0)

📄 Description

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.


🔄 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/1774 **Author:** [@ishwarthecodddr](https://github.com/ishwarthecodddr) **Created:** 11/29/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `port-hex-to-int` --- ### 📝 Commits (10+) - [`3e67f5d`](https://github.com/CCExtractor/ccextractor/commit/3e67f5da4b7c67fb7f008906368eaad152a2dfdc) fix(708_output): replace sprintf with snprintf for buffer safety - [`10e105d`](https://github.com/CCExtractor/ccextractor/commit/10e105defc14cebf95831c36d22c9ad3f8bf5653) style: fix clang-format issues in macro definitions - [`1e82253`](https://github.com/CCExtractor/ccextractor/commit/1e822535f18640e5722b97df94834582f27e7d79) fix(708_output): replace sprintf with snprintf for buffer safety - [`2d355b6`](https://github.com/CCExtractor/ccextractor/commit/2d355b6e0ef2a127cbb1bb8a1b3744e885094dec) style: fix clang-format issues in macro definitions - [`9592e27`](https://github.com/CCExtractor/ccextractor/commit/9592e27ab1bea63e61a41587884bcafb008446d9) fix(rust): prevent panics in timing code when processing multiple files - [`8a6b9e3`](https://github.com/CCExtractor/ccextractor/commit/8a6b9e301ce88ddd408c0280254047a404d54123) Initial plan - [`ef539fa`](https://github.com/CCExtractor/ccextractor/commit/ef539fa03b72ddea92a987f80304d5ca890eaba4) Remove unintended Cargo.lock changes - [`c91f806`](https://github.com/CCExtractor/ccextractor/commit/c91f8061a0bbff03753ad91ccee37d33d9eb040f) Initial plan - [`d6bae9b`](https://github.com/CCExtractor/ccextractor/commit/d6bae9b758a64c9c33cfb6e1ac9541f8af9eb978) Port hex_to_int from C to Rust - [`2cf6d06`](https://github.com/CCExtractor/ccextractor/commit/2cf6d06c253de56ed07c5228f4bfe1579134401f) cleaned commits ### 📊 Changes **7 files changed** (+323 additions, -499 deletions) <details> <summary>View changed files</summary> 📝 `src/lib_ccx/general_loop.c` (+2 -2) 📝 `src/lib_ccx/utility.c` (+7 -0) 📝 `src/rust/Cargo.lock` (+277 -497) ➕ `src/rust/lib_ccxr/src/util/hex.rs` (+28 -0) 📝 `src/rust/lib_ccxr/src/util/mod.rs` (+1 -0) 📝 `src/rust/src/libccxr_exports/mod.rs` (+1 -0) ➕ `src/rust/src/libccxr_exports/util.rs` (+7 -0) </details> ### 📄 Description <!-- Please prefix your pull request with one of the following: **[FEATURE]** **[FIX]** **[IMPROVEMENT]**. --> **In raising this pull request, I confirm the following (please check boxes):** - [*] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [*] 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](https://github.com/CCExtractor/ccextractor/blob/master/docs/CHANGES.TXT).** **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. --- <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:22:29 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2501