Skip to content

Commit

Permalink
Fix create_bytes ec calc
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileyChris committed Mar 14, 2022
1 parent 91a1c4d commit df13967
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions qrcode/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,8 @@ def create_bytes(buffer: BitBuffer, rs_blocks: List[RSBlock]):

modPoly = rawPoly % rsPoly
current_ec = []
mod_offset = len(modPoly) - dcCount
for i in range(dcCount):
mod_offset = len(modPoly) - ecCount
for i in range(ecCount):
modIndex = i + mod_offset
current_ec.append(modPoly[modIndex] if (modIndex >= 0) else 0)

Expand All @@ -538,12 +538,14 @@ def create_bytes(buffer: BitBuffer, rs_blocks: List[RSBlock]):
data = []
for i in range(maxDcCount):
for dc in dcdata:
if i < len(dc):
data.append(dc[i])
if i >= len(dc):
break
data.append(dc[i])
for i in range(maxEcCount):
for ec in ecdata:
if i < len(ec):
data.append(ec[i])
if i >= len(ec):
break
data.append(ec[i])

return data

Expand Down

0 comments on commit df13967

Please sign in to comment.