Fix issues similar to 1776

git-svn-id: https://zxing.googlecode.com/svn/trunk@2887 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen@gmail.com 2013-09-08 20:50:01 +00:00
parent 7807214bbd
commit c43cf419c2
2 changed files with 9 additions and 2 deletions

View file

@ -441,6 +441,8 @@ public final class Code128Reader extends OneDReader {
}
int lastPatternSize = nextStart - lastStart;
// Check for ample whitespace following pattern, but, to do this we first need to remember that
// we fudged decoding CODE_STOP since it actually has 7 bars, not 6. There is a black bar left
// to read off. Would be slightly better to properly read. Here we just skip it:
@ -476,7 +478,7 @@ public final class Code128Reader extends OneDReader {
}
float left = (float) (startPatternInfo[1] + startPatternInfo[0]) / 2.0f;
float right = (float) (nextStart + lastStart) / 2.0f;
float right = lastStart + lastPatternSize / 2.0f;
int rawCodesSize = rawCodes.size();
byte[] rawBytes = new byte[rawCodesSize];

View file

@ -95,6 +95,11 @@ public final class Code93Reader extends OneDReader {
} while (decodedChar != '*');
result.deleteCharAt(result.length() - 1); // remove asterisk
int lastPatternSize = 0;
for (int counter : theCounters) {
lastPatternSize += counter;
}
// Should be at least one more black module
if (nextStart == end || !row.get(nextStart)) {
throw NotFoundException.getNotFoundInstance();
@ -112,7 +117,7 @@ public final class Code93Reader extends OneDReader {
String resultString = decodeExtended(result);
float left = (float) (start[1] + start[0]) / 2.0f;
float right = (float) (nextStart + lastStart) / 2.0f;
float right = lastStart + lastPatternSize / 2.0f;
return new Result(
resultString,
null,