From 00e14b745723c1feb0d2b1abe37e19b8a55fc4b8 Mon Sep 17 00:00:00 2001 From: hooper114 Date: Fri, 21 Aug 2009 14:31:43 +0000 Subject: [PATCH] Correct check digit calculation bug --- backend/telepen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/telepen.c b/backend/telepen.c index 4a6740d7..744c102f 100644 --- a/backend/telepen.c +++ b/backend/telepen.c @@ -26,7 +26,7 @@ #include #include "common.h" -static char *TeleTable[128] = { "1111111111111111", "1131313111", "33313111", "1111313131", +static char *TeleTable[] = { "1111111111111111", "1131313111", "33313111", "1111313131", "3111313111", "11333131", "13133131", "111111313111", "31333111", "1131113131", "33113131", "1111333111", "3111113131", "1113133111", "1311133111", "111111113131", "3131113111", "11313331", "333331", "111131113111", "31113331", "1133113111", "1313113111", "1111113331", @@ -89,6 +89,7 @@ int telepen(struct zint_symbol *symbol, unsigned char source[]) } check_digit = 127 - (count % 127); + if(check_digit == 127) { check_digit = 0; } concat(dest, TeleTable[check_digit]); /* Stop character */ @@ -162,6 +163,7 @@ int telepen_num(struct zint_symbol *symbol, unsigned char source[]) } check_digit = 127 - (count % 127); + if(check_digit == 127) { check_digit = 0; } concat((char*)dest, TeleTable[check_digit]); /* Stop character */