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
Fix for bug #593 #594
Conversation
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) { |
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.
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.
Thanks for comments, did the changes. |
@@ -90,6 +108,10 @@ public void testEncodeWithFunc4() throws WriterException { | |||
assertEquals(expected, actual); | |||
} | |||
|
|||
private static BitArray matrixToArray(BitMatrix result) { |
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.
This is just used one place, and it doesn't really make something into an array, just returns one row right?
OK minus two more tiny comments, this seems fine |
Removed a private one-liner method used exactly once, alphabetized imports.
Done. |
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.