Skip to content

Commit

Permalink
DMDecoder: prioritize mirrored format error over normal checksum error
Browse files Browse the repository at this point in the history
If the symbol is mirrored and has a format error, it could be successfully
error checked and is therefore certainly a mirrored symbol. The old code
hid that fact by instead returning a non-mirrored checksum error.

Found while looking at #774.
  • Loading branch information
axxel committed Apr 25, 2024
1 parent c4668ab commit 092047c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/datamatrix/DMDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ DecoderResult Decode(const BitMatrix& bits)
//TODO:
// * unify bit mirroring helper code with QRReader?
// * rectangular symbols with the a size of 8 x Y are not supported a.t.m.
if (auto mirroredRes = DoDecode(FlippedL(bits)); mirroredRes.isValid()) {
if (auto mirroredRes = DoDecode(FlippedL(bits)); mirroredRes.error().type() != Error::Checksum) {
mirroredRes.setIsMirrored(true);
return mirroredRes;
}
Expand Down

0 comments on commit 092047c

Please sign in to comment.