From 379ee79702d526dc258cc234bdb89b3e1c961157 Mon Sep 17 00:00:00 2001 From: srowen Date: Sat, 7 May 2011 13:43:23 +0000 Subject: [PATCH] Used-supplied workaround for encoders which append spurious latch to ASCII at end of bit stream git-svn-id: https://zxing.googlecode.com/svn/trunk@1759 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- .../zxing/datamatrix/decoder/DecodedBitStreamParser.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java b/core/src/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java index b390fb908..859848b88 100644 --- a/core/src/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java +++ b/core/src/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java @@ -168,7 +168,12 @@ final class DecodedBitStreamParser { //throw ReaderException.getInstance(); // Ignore this symbol for now } else if (oneByte >= 242) { // Not to be used in ASCII encodation - throw FormatException.getFormatInstance(); + // ... but work around encoders that end with 254, latch back to ASCII + if (oneByte == 254 && bits.available() == 0) { + // Ignore + } else { + throw FormatException.getFormatInstance(); + } } } while (bits.available() > 0); return ASCII_ENCODE;