mirror of
https://github.com/zxing/zxing.git
synced 2025-01-13 04:07:27 -08:00
Workaround for codes that fail to include (required) final TERMINATOR mode indicator
git-svn-id: https://zxing.googlecode.com/svn/trunk@351 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
19dbe047fd
commit
1c9b906442
|
@ -60,7 +60,12 @@ final class DecodedBitStreamParser {
|
||||||
Mode mode;
|
Mode mode;
|
||||||
do {
|
do {
|
||||||
// While still another segment to read...
|
// While still another segment to read...
|
||||||
mode = Mode.forBits(bits.readBits(4)); // mode is encoded by 4 bits
|
if (bits.available() == 0) {
|
||||||
|
// OK, assume we're done. Really, a TERMINATOR mode should have been recorded here
|
||||||
|
mode = Mode.TERMINATOR;
|
||||||
|
} else {
|
||||||
|
mode = Mode.forBits(bits.readBits(4)); // mode is encoded by 4 bits
|
||||||
|
}
|
||||||
if (!mode.equals(Mode.TERMINATOR)) {
|
if (!mode.equals(Mode.TERMINATOR)) {
|
||||||
// How many characters will follow, encoded in this mode?
|
// How many characters will follow, encoded in this mode?
|
||||||
int count = bits.readBits(mode.getCharacterCountBits(version));
|
int count = bits.readBits(mode.getCharacterCountBits(version));
|
||||||
|
|
Loading…
Reference in a new issue