Correct check digit calculation bug

This commit is contained in:
hooper114 2009-08-21 14:31:43 +00:00
parent a4c878bdbb
commit 00e14b7457

View File

@ -26,7 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "common.h" #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", "3111313111", "11333131", "13133131", "111111313111", "31333111", "1131113131", "33113131",
"1111333111", "3111113131", "1113133111", "1311133111", "111111113131", "3131113111", "1111333111", "3111113131", "1113133111", "1311133111", "111111113131", "3131113111",
"11313331", "333331", "111131113111", "31113331", "1133113111", "1313113111", "1111113331", "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); check_digit = 127 - (count % 127);
if(check_digit == 127) { check_digit = 0; }
concat(dest, TeleTable[check_digit]); concat(dest, TeleTable[check_digit]);
/* Stop character */ /* Stop character */
@ -162,6 +163,7 @@ int telepen_num(struct zint_symbol *symbol, unsigned char source[])
} }
check_digit = 127 - (count % 127); check_digit = 127 - (count % 127);
if(check_digit == 127) { check_digit = 0; }
concat((char*)dest, TeleTable[check_digit]); concat((char*)dest, TeleTable[check_digit]);
/* Stop character */ /* Stop character */