mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Issue 894 fix unsigned byte issue in unrandomize 255 state that prevented some codes from working in base 256 mode
git-svn-id: https://zxing.googlecode.com/svn/trunk@2016 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
957e179e63
commit
52befe2c8f
|
@ -473,7 +473,7 @@ final class DecodedBitStreamParser {
|
|||
if (bits.available() < 8) {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
bytes[i] = unrandomize255State(bits.readBits(8), codewordPosition++);
|
||||
bytes[i] = (byte) unrandomize255State(bits.readBits(8), codewordPosition++);
|
||||
}
|
||||
byteSegments.add(bytes);
|
||||
try {
|
||||
|
@ -486,11 +486,11 @@ final class DecodedBitStreamParser {
|
|||
/**
|
||||
* See ISO 16022:2006, Annex B, B.2
|
||||
*/
|
||||
private static byte unrandomize255State(int randomizedBase256Codeword,
|
||||
private static int unrandomize255State(int randomizedBase256Codeword,
|
||||
int base256CodewordPosition) {
|
||||
int pseudoRandomNumber = ((149 * base256CodewordPosition) % 255) + 1;
|
||||
int tempVariable = randomizedBase256Codeword - pseudoRandomNumber;
|
||||
return (byte) (tempVariable >= 0 ? tempVariable : tempVariable + 256);
|
||||
return tempVariable >= 0 ? tempVariable : tempVariable + 256;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue