Skip to content

fix: preserve leading zeros in customtxt - #2514

Open
hemanthGavara2007 wants to merge 1 commit into
CCExtractor:masterfrom
hemanthGavara2007:fix-customtxt-leading-zeros
Open

hemanthGavara2007 wants to merge 1 commit into
CCExtractor:masterfrom
hemanthGavara2007:fix-customtxt-leading-zeros

Conversation

@hemanthGavara2007

Copy link
Copy Markdown

[FIX] Preserve leading zeros in --customtxt argument

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

Reason for this PR:

  • This PR fixes a bug that I have personally experienced or that a real user has reported and for which a sample exists.
  • This PR adds new functionality.
  • This PR is porting code from C to Rust.

Sanity check:


Bug description

The --customtxt argument was defined as Option<u32>. When a value containing leading zeros was parsed, the zeros were discarded during integer conversion.

For example, 0000101 became 101, causing the existing seven-character validation to reject the value.

Reproduction instructions

  1. Build CCExtractor on macOS.

  2. Run the following command with a valid local video file:

    ./mac/ccextractor --customtxt 0000101 "/path/to/video.mp4"
  3. Previously, the leading zeros were lost during integer parsing, causing the seven-character validation to fail.

  4. With this fix, the value is preserved as a string and passes the seven-character validation.

Additional validation:

./mac/ccextractor --customtxt 123456 "/path/to/video.mp4"

This is correctly rejected with:

Error: Invalid customtxt value. It must be 7 digits long

Changes made

  • Changed customtxt from Option<u32> to Option<String>.
  • Preserved the existing seven-character validation.

@ccextractor-bot

Copy link
Copy Markdown
Collaborator
CCExtractor CI platform finished running the test files on linux. 171/238 tests matched the approved output:
Report Name Tests Passed
Broken 9/13
CEA-708 2/14
DVB 0/7
DVD 3/3
DVR-MS 2/2
General 26/28
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 68/86
Teletext 0/21
WTV 12/13
XDS 32/34

67 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.


Compared with the tip of master — test 10180, commit 2c1c1c6:

  • 0 pass there and fail here
  • 0 fail there and pass here
  • 0 fail on both, with different output
  • 67 fail on both, byte for byte the same

Compared with the commit this branch was cut from: the same run as the tip of master (test 10180), so the comparison above already covers it.


No test changes behaviour relative to the tip of master: every failure above fails there too, byte for byte. The approved output for those tests is out of date, which is a baseline to review rather than a regression in this branch.

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.

2 participants