Navigation Menu

Skip to content
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

Fix for bug #593 #594

Merged
merged 6 commits into from May 8, 2016
Merged

Fix for bug #593 #594

merged 6 commits into from May 8, 2016

Conversation

tanelihuuskonen
Copy link
Contributor

I fixed bug #593 and added one test case. My commits look a bit funny as I forgot the commandment, "Thou shalt not amend an already published commit."

I know the licensing policy and agree to it.

Bug #593 was misleadingly reported as pertaining to another project, but
testing revealed it affected this project as well.  The Code128 encoding
algorithm failed when an odd number of digits were followed by FNC1 and
other digits.  The code selection algorithm was rewritten.  A test case
showing the bug was added, and an old test case was updated to expect
the result of the new algorithm  -  another valid encoding of the same
length as the old one.
Bug #593 was misleadingly reported as pertaining to another project, but
testing revealed it affected this project as well.  The Code128 encoding
algorithm failed when an odd number of digits were followed by FNC1 and
other digits.  The code selection algorithm was rewritten.  A test case
showing the bug was added, and an old test case was updated to expect
the result of the new algorithm  -  another valid encoding of the same
length as the old one.
Removed imports I didn't use after all.
int end = start + length;
// Returns 1 for FNC_1, 2 for a pair of digits, -1 for a single digit,
// 0 otherwise
private static int codeCLength(CharSequence value, int start) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it clearer just to make a private enum to express the possible return types?

Added a private enum and changed some names to improve readability.
Also some trivial cosmetic changes.
@tanelihuuskonen
Copy link
Contributor Author

Thanks for comments, did the changes.

@@ -90,6 +108,10 @@ public void testEncodeWithFunc4() throws WriterException {
assertEquals(expected, actual);
}

private static BitArray matrixToArray(BitMatrix result) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just used one place, and it doesn't really make something into an array, just returns one row right?

@srowen
Copy link
Contributor

srowen commented May 8, 2016

OK minus two more tiny comments, this seems fine

Removed a private one-liner method used exactly once, alphabetized
imports.
@tanelihuuskonen
Copy link
Contributor Author

Done.

@srowen srowen merged commit f0dfcdf into zxing:master May 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants