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
|
// ExtendedProductParsedResult NOT created. Not a RSS Expanded barcode
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Really neither of these should happen:
|
|
||||||
String rawText = getMassagedText(result);
|
String rawText = getMassagedText(result);
|
||||||
if (rawText == null) {
|
|
||||||
// ExtendedProductParsedResult NOT created. Input text is NULL
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
String productID = null;
|
String productID = null;
|
||||||
String sscc = null;
|
String sscc = null;
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.google.zxing.Result;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -245,13 +246,12 @@ public final class VCardResultParser extends ResultParser {
|
||||||
byte[] fragmentBytes = fragmentBuffer.toByteArray();
|
byte[] fragmentBytes = fragmentBuffer.toByteArray();
|
||||||
String fragment;
|
String fragment;
|
||||||
if (charset == null) {
|
if (charset == null) {
|
||||||
fragment = new String(fragmentBytes);
|
fragment = new String(fragmentBytes, Charset.forName("UTF-8"));
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
fragment = new String(fragmentBytes, charset);
|
fragment = new String(fragmentBytes, charset);
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
// Yikes, well try anyway:
|
fragment = new String(fragmentBytes, Charset.forName("UTF-8"));
|
||||||
fragment = new String(fragmentBytes);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fragmentBuffer.reset();
|
fragmentBuffer.reset();
|
||||||
|
|
|
@ -88,9 +88,6 @@ public final class PDF417Reader implements Reader, MultipleBarcodeReader {
|
||||||
for (ResultPoint[] points : detectorResult.getPoints()) {
|
for (ResultPoint[] points : detectorResult.getPoints()) {
|
||||||
DecoderResult decoderResult = PDF417ScanningDecoder.decode(detectorResult.getBits(), points[4], points[5],
|
DecoderResult decoderResult = PDF417ScanningDecoder.decode(detectorResult.getBits(), points[4], points[5],
|
||||||
points[6], points[7], getMinCodewordWidth(points), getMaxCodewordWidth(points));
|
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 result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.PDF_417);
|
||||||
result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel());
|
result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel());
|
||||||
PDF417ResultMetadata pdf417ResultMetadata = (PDF417ResultMetadata) decoderResult.getOther();
|
PDF417ResultMetadata pdf417ResultMetadata = (PDF417ResultMetadata) decoderResult.getOther();
|
||||||
|
|
|
@ -100,17 +100,13 @@ final class DecodedBitStreamParser {
|
||||||
codeIndex = textCompaction(codewords, codeIndex, result);
|
codeIndex = textCompaction(codewords, codeIndex, result);
|
||||||
break;
|
break;
|
||||||
case BYTE_COMPACTION_MODE_LATCH:
|
case BYTE_COMPACTION_MODE_LATCH:
|
||||||
|
case BYTE_COMPACTION_MODE_LATCH_6:
|
||||||
|
case MODE_SHIFT_TO_BYTE_COMPACTION_MODE:
|
||||||
codeIndex = byteCompaction(code, codewords, codeIndex, result);
|
codeIndex = byteCompaction(code, codewords, codeIndex, result);
|
||||||
break;
|
break;
|
||||||
case NUMERIC_COMPACTION_MODE_LATCH:
|
case NUMERIC_COMPACTION_MODE_LATCH:
|
||||||
codeIndex = numericCompaction(codewords, codeIndex, result);
|
codeIndex = numericCompaction(codewords, codeIndex, result);
|
||||||
break;
|
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:
|
case BEGIN_MACRO_PDF417_CONTROL_BLOCK:
|
||||||
codeIndex = decodeMacroBlock(codewords, codeIndex, resultMetadata);
|
codeIndex = decodeMacroBlock(codewords, codeIndex, resultMetadata);
|
||||||
break;
|
break;
|
||||||
|
@ -220,21 +216,10 @@ final class DecodedBitStreamParser {
|
||||||
textCompactionData[index++] = TEXT_COMPACTION_MODE_LATCH;
|
textCompactionData[index++] = TEXT_COMPACTION_MODE_LATCH;
|
||||||
break;
|
break;
|
||||||
case BYTE_COMPACTION_MODE_LATCH:
|
case BYTE_COMPACTION_MODE_LATCH:
|
||||||
codeIndex--;
|
case BYTE_COMPACTION_MODE_LATCH_6:
|
||||||
end = true;
|
|
||||||
break;
|
|
||||||
case NUMERIC_COMPACTION_MODE_LATCH:
|
case NUMERIC_COMPACTION_MODE_LATCH:
|
||||||
codeIndex--;
|
|
||||||
end = true;
|
|
||||||
break;
|
|
||||||
case BEGIN_MACRO_PDF417_CONTROL_BLOCK:
|
case BEGIN_MACRO_PDF417_CONTROL_BLOCK:
|
||||||
codeIndex--;
|
|
||||||
end = true;
|
|
||||||
break;
|
|
||||||
case BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
|
case BEGIN_MACRO_PDF417_OPTIONAL_FIELD:
|
||||||
codeIndex--;
|
|
||||||
end = true;
|
|
||||||
break;
|
|
||||||
case MACRO_PDF417_TERMINATOR:
|
case MACRO_PDF417_TERMINATOR:
|
||||||
codeIndex--;
|
codeIndex--;
|
||||||
end = true;
|
end = true;
|
||||||
|
@ -251,10 +236,6 @@ final class DecodedBitStreamParser {
|
||||||
byteCompactionData[index] = code;
|
byteCompactionData[index] = code;
|
||||||
index++;
|
index++;
|
||||||
break;
|
break;
|
||||||
case BYTE_COMPACTION_MODE_LATCH_6:
|
|
||||||
codeIndex--;
|
|
||||||
end = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue