mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Simple changes from code inspection
git-svn-id: https://zxing.googlecode.com/svn/trunk@2899 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
21500405d5
commit
ad24a551aa
|
@ -47,12 +47,7 @@ public final class ExpandedProductResultParser extends ResultParser {
|
|||
// ExtendedProductParsedResult NOT created. Not a RSS Expanded barcode
|
||||
return null;
|
||||
}
|
||||
// Really neither of these should happen:
|
||||
String rawText = getMassagedText(result);
|
||||
if (rawText == null) {
|
||||
// ExtendedProductParsedResult NOT created. Input text is NULL
|
||||
return null;
|
||||
}
|
||||
|
||||
String productID = null;
|
||||
String sscc = null;
|
||||
|
|
|
@ -20,6 +20,7 @@ import com.google.zxing.Result;
|
|||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
@ -245,13 +246,12 @@ public final class VCardResultParser extends ResultParser {
|
|||
byte[] fragmentBytes = fragmentBuffer.toByteArray();
|
||||
String fragment;
|
||||
if (charset == null) {
|
||||
fragment = new String(fragmentBytes);
|
||||
fragment = new String(fragmentBytes, Charset.forName("UTF-8"));
|
||||
} else {
|
||||
try {
|
||||
fragment = new String(fragmentBytes, charset);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Yikes, well try anyway:
|
||||
fragment = new String(fragmentBytes);
|
||||
fragment = new String(fragmentBytes, Charset.forName("UTF-8"));
|
||||
}
|
||||
}
|
||||
fragmentBuffer.reset();
|
||||
|
|
|
@ -88,9 +88,6 @@ public final class PDF417Reader implements Reader, MultipleBarcodeReader {
|
|||
for (ResultPoint[] points : detectorResult.getPoints()) {
|
||||
DecoderResult decoderResult = PDF417ScanningDecoder.decode(detectorResult.getBits(), points[4], points[5],
|
||||
points[6], points[7], getMinCodewordWidth(points), getMaxCodewordWidth(points));
|
||||
if (decoderResult == null) {
|
||||
throw NotFoundException.getNotFoundInstance();
|
||||
}
|
||||
Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.PDF_417);
|
||||
result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel());
|
||||
PDF417ResultMetadata pdf417ResultMetadata = (PDF417ResultMetadata) decoderResult.getOther();
|
||||
|
|
|
@ -100,17 +100,13 @@ final class DecodedBitStreamParser {
|
|||
codeIndex = textCompaction(codewords, codeIndex, result);
|
||||
break;
|
||||
case BYTE_COMPACTION_MODE_LATCH:
|
||||
case BYTE_COMPACTION_MODE_LATCH_6:
|
||||
case MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
|
||||
codeIndex = byteCompaction(code, codewords, codeIndex, result);
|
||||
break;
|
||||
case NUMERIC_COMPACTION_MODE_LATCH:
|
||||
codeIndex = numericCompaction(codewords, codeIndex, result);
|
||||
break;
|
||||
case MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
|
||||
codeIndex = byteCompaction(code, codewords, codeIndex, result);
|
||||
break;
|
||||
case BYTE_COMPACTION_MODE_LATCH_6:
|
||||
codeIndex = byteCompaction(code, codewords, codeIndex, result);
|
||||
break;
|
||||
case BEGIN_MACRO_PDF417_CONTROL_BLOCK:
|
||||
codeIndex = decodeMacroBlock(codewords, codeIndex, resultMetadata);
|
||||
break;
|
||||
|
@ -220,21 +216,10 @@ final class DecodedBitStreamParser {
|
|||
textCompactionData[index++] = TEXT_COMPACTION_MODE_LATCH;
|
||||
break;
|
||||
case BYTE_COMPACTION_MODE_LATCH:
|
||||
codeIndex--;
|
||||
end = true;
|
||||
break;
|
||||
case BYTE_COMPACTION_MODE_LATCH_6:
|
||||
case NUMERIC_COMPACTION_MODE_LATCH:
|
||||
codeIndex--;
|
||||
end = true;
|
||||
break;
|
||||
case BEGIN_MACRO_PDF417_CONTROL_BLOCK:
|
||||
codeIndex--;
|
||||
end = true;
|
||||
break;
|
||||
case BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
|
||||
codeIndex--;
|
||||
end = true;
|
||||
break;
|
||||
case MACRO_PDF417_TERMINATOR:
|
||||
codeIndex--;
|
||||
end = true;
|
||||
|
@ -251,10 +236,6 @@ final class DecodedBitStreamParser {
|
|||
byteCompactionData[index] = code;
|
||||
index++;
|
||||
break;
|
||||
case BYTE_COMPACTION_MODE_LATCH_6:
|
||||
codeIndex--;
|
||||
end = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue