From cec3babc89625301a9b08195fbaf213997e8ab0b Mon Sep 17 00:00:00 2001 From: hooper114 Date: Sat, 4 Jul 2009 20:49:17 +0000 Subject: [PATCH] Check digit corrections from Massimo --- backend/2of5.c | 4 ++-- backend/upcean.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/2of5.c b/backend/2of5.c index a30ab05b..ba82d87e 100644 --- a/backend/2of5.c +++ b/backend/2of5.c @@ -272,11 +272,11 @@ int itf14(struct zint_symbol *symbol, unsigned char source[]) /* Calculate the check digit - the same method used for EAN-13 */ - for (i = h - 1; i >= 0; i--) + for (i = 12; i >= 0; i--) { count += ctoi(localstr[i]); - if (!((i%2) == 0)) + if ((i%2) == 0) { count += 2 * ctoi(localstr[i]); } diff --git a/backend/upcean.c b/backend/upcean.c index 7ac2fb97..0e10a896 100644 --- a/backend/upcean.c +++ b/backend/upcean.c @@ -133,6 +133,7 @@ void upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) for(i = 0; i < 11; i++) { equivalent[i] = '0'; } + if(num_system == 1) { equivalent[0] = temp[0]; } equivalent[1] = source[0]; equivalent[2] = source[1]; equivalent[11] = '\0';