From 2faff4e76fb00bdc86bd2e658f5f8331d8a8825d Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Thu, 26 Dec 2019 17:57:29 +0000 Subject: [PATCH] Correct ECI but in DotCode Avoid creating codewords > 112 Fixes #174 reported by Milton Neal --- backend/dotcode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/dotcode.c b/backend/dotcode.c index 108c3dbb..877ee008 100644 --- a/backend/dotcode.c +++ b/backend/dotcode.c @@ -496,8 +496,8 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha // the next three codewords valued A, B & C encode the ECI value of // (A - 40) * 12769 + B * 113 + C + 40 (Section 5.2.1) int a, b, c; - a = (symbol->eci - 40) % 12769; - b = ((symbol->eci - 40) - (12769 * a)) % 113; + a = (symbol->eci - 40) / 12769; + b = ((symbol->eci - 40) - (12769 * a)) / 113; c = (symbol->eci - 40) - (12769 * a) - (113 * b); codeword_array[array_length] = a + 40;