Skip to content

Commit

Permalink
Merge pull request #72 from huysentruitw/patch-2
Browse files Browse the repository at this point in the history
Fix bug in DataMatrix padding algorithm
  • Loading branch information
boombuler authored Feb 9, 2022
2 parents abf40d2 + 608a8ad commit 65580ac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion datamatrix/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ func addPadding(data []byte, toCount int) []byte {
}
for len(data) < toCount {
R := ((149 * (len(data) + 1)) % 253) + 1
data = append(data, byte((129+R)%254))
tmp := 129 + R;
if (tmp > 254) {
tmp = tmp - 254
}

data = append(data, byte(tmp))
}
return data
}

0 comments on commit 65580ac

Please sign in to comment.