Skip to content

Commit b272cb7

Browse files
committed
Issue #1 - resolves error on encoding 14 character binary
Resolves other length issues, caused by generation of double the number of codewords than expected when a qr version reaches its data capacity
1 parent dbde75a commit b272cb7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/qrcode.erl

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ generate_ecc(<<>>, [], Acc) ->
8787
generate_ecc0(Bin, Count, TotalLength, BlockLength, Acc) when byte_size(Bin) >= BlockLength, Count > 0 ->
8888
<<Block:BlockLength/binary, Bin0/binary>> = Bin,
8989
EC = qrcode_reedsolomon:encode(Block, TotalLength - BlockLength),
90-
generate_ecc0(Bin0, Count, TotalLength, BlockLength, [{Block, EC}|Acc]);
90+
generate_ecc0(Bin0, Count - 1, TotalLength, BlockLength, [{Block, EC}|Acc]);
9191
generate_ecc0(Bin, Count, TotalLength, BlockLength, Acc) when Count > 0 ->
9292
Block = pad_block(Bin, BlockLength),
9393
EC = qrcode_reedsolomon:encode(Block, TotalLength - BlockLength),

0 commit comments

Comments
 (0)