-
Notifications
You must be signed in to change notification settings - Fork 116
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 #220 bcd length encoding #221
Conversation
Thanks for opening this PR! Can you update the godoc comments to mention what that integer represents? |
the godoc of the Encode method? |
Yep, thanks. |
Codecov ReportPatch coverage:
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## master #221 +/- ##
==========================================
+ Coverage 73.18% 73.19% +0.01%
==========================================
Files 41 41
Lines 1995 1996 +1
==========================================
+ Hits 1460 1461 +1
Misses 326 326
Partials 209 209
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
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.
I'm not sure that there is an issue with BCD encoding and prefixes. In the issue #220 specified length does not match the length of the value that is set to the field. Here is my comment about it: #220 (comment)
Maybe, we should add length validation to avoid such issues (#58).
sure, thanks a lot. |
Here's is my proposition for fixing the bcd length encoding. This also fixes the variable encoding where an odd length was encoded with the next even number.
The problem I had with bcd is that there is no way to find out whether the length of original data was odd or even, that's why the
Encoder interface, Encode
return type change.I couldn't come up with a more elegant solution.