Bug fix to unrandomization routine from sanfordsquires

git-svn-id: https://zxing.googlecode.com/svn/trunk@707 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2008-11-15 12:58:36 +00:00
parent 62d9959a3c
commit ce341d92aa

View file

@ -423,7 +423,7 @@ final class DecodedBitStreamParser {
count = 250 * (d1 - 249) + bits.readBits(8);
}
for (int i = 0; i < count; i++) {
result.append(unrandomize255State(bits.readBits(8), count));
result.append(unrandomize255State(bits.readBits(8), i));
}
}
@ -434,11 +434,7 @@ final class DecodedBitStreamParser {
int base256CodewordPosition) {
int pseudoRandomNumber = ((149 * base256CodewordPosition) % 255) + 1;
int tempVariable = randomizedBase256Codeword - pseudoRandomNumber;
if (tempVariable >= 0) {
return (char) tempVariable;
} else {
return (char) (tempVariable + 256);
}
return tempVariable >= 0 ? (char) tempVariable : (char) (tempVariable + 256);
}
}