From b272cb7c5a638e465926f5cdc86fd26dc139c823 Mon Sep 17 00:00:00 2001 From: Steven Charles Davis Date: Fri, 17 Jan 2014 12:00:02 -0600 Subject: [PATCH] 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 --- src/qrcode.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qrcode.erl b/src/qrcode.erl index dcd6e48..7cafabf 100644 --- a/src/qrcode.erl +++ b/src/qrcode.erl @@ -87,7 +87,7 @@ generate_ecc(<<>>, [], Acc) -> generate_ecc0(Bin, Count, TotalLength, BlockLength, Acc) when byte_size(Bin) >= BlockLength, Count > 0 -> <> = Bin, EC = qrcode_reedsolomon:encode(Block, TotalLength - BlockLength), - generate_ecc0(Bin0, Count, TotalLength, BlockLength, [{Block, EC}|Acc]); + generate_ecc0(Bin0, Count - 1, TotalLength, BlockLength, [{Block, EC}|Acc]); generate_ecc0(Bin, Count, TotalLength, BlockLength, Acc) when Count > 0 -> Block = pad_block(Bin, BlockLength), EC = qrcode_reedsolomon:encode(Block, TotalLength - BlockLength),