mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 11:47:26 -08:00
Fix bug #1502 that PDF417 barcodes without initial latch to Text compaction mode fail to decode (#1503)
* Fixed bug that barcodes without initial latch to text encoding failed to decode
This commit is contained in:
parent
87f540f5bd
commit
427ece8ae7
|
@ -104,11 +104,10 @@ final class DecodedBitStreamParser {
|
|||
static DecoderResult decode(int[] codewords, String ecLevel) throws FormatException {
|
||||
StringBuilder result = new StringBuilder(codewords.length * 2);
|
||||
Charset encoding = StandardCharsets.ISO_8859_1;
|
||||
// Get compaction mode
|
||||
int codeIndex = 1;
|
||||
int code = codewords[codeIndex++];
|
||||
int codeIndex = textCompaction(codewords, 1, result);
|
||||
PDF417ResultMetadata resultMetadata = new PDF417ResultMetadata();
|
||||
while (codeIndex < codewords[0]) {
|
||||
int code = codewords[codeIndex++];
|
||||
switch (code) {
|
||||
case TEXT_COMPACTION_MODE_LATCH:
|
||||
codeIndex = textCompaction(codewords, codeIndex, result);
|
||||
|
@ -154,11 +153,6 @@ final class DecodedBitStreamParser {
|
|||
codeIndex = textCompaction(codewords, codeIndex, result);
|
||||
break;
|
||||
}
|
||||
if (codeIndex < codewords.length) {
|
||||
code = codewords[codeIndex++];
|
||||
} else {
|
||||
throw FormatException.getFormatInstance();
|
||||
}
|
||||
}
|
||||
if (result.length() == 0 && resultMetadata.getFileId() == null) {
|
||||
throw FormatException.getFormatInstance();
|
||||
|
|
Loading…
Reference in a new issue