Skip to content

Commit

Permalink
Port additional Issue 1776 changes
Browse files Browse the repository at this point in the history
git-svn-id: https://zxing.googlecode.com/svn/trunk@2890 59b500cc-1b3d-0410-9834-0bbf25fbcc57
  • Loading branch information
[email protected] committed Sep 9, 2013
1 parent 9a6ac33 commit 7606df6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cpp/core/src/zxing/oned/Code128Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ Ref<Result> Code128Reader::decodeRow(int rowNumber, Ref<BitArray> row) {

}

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:
Expand Down Expand Up @@ -469,7 +471,7 @@ Ref<Result> Code128Reader::decodeRow(int rowNumber, Ref<BitArray> row) {
}

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();
ArrayRef<char> rawBytes (rawCodesSize);
Expand Down
2 changes: 1 addition & 1 deletion cpp/core/src/zxing/oned/Code39Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Ref<Result> Code39Reader::decodeRow(int rowNumber, Ref<BitArray> row) {
}

float left = (float) (start[1] + start[0]) / 2.0f;
float right = (float) (nextStart + lastStart) / 2.0f;
float right = lastStart + lastPatternSize / 2.0f;

ArrayRef< Ref<ResultPoint> > resultPoints (2);
resultPoints[0] =
Expand Down
8 changes: 7 additions & 1 deletion cpp/core/src/zxing/oned/Code93Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ Ref<Result> Code93Reader::decodeRow(int rowNumber, Ref<BitArray> row) {
nextStart = row->getNextSet(nextStart);
} while (decodedChar != '*');
result.resize(result.length() - 1); // remove asterisk

// Look for whitespace after pattern:
int lastPatternSize = 0;
for (int i = 0, e = theCounters.size(); i < e; i++) {
lastPatternSize += theCounters[i];
}

// Should be at least one more black module
if (nextStart == end || !row->get(nextStart)) {
Expand All @@ -114,7 +120,7 @@ Ref<Result> Code93Reader::decodeRow(int rowNumber, Ref<BitArray> row) {
Ref<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;

ArrayRef< Ref<ResultPoint> > resultPoints (2);
resultPoints[0] =
Expand Down

0 comments on commit 7606df6

Please sign in to comment.