From 5ddf28ffbb3b439ecd064a8c0d8e7db4e8d49d17 Mon Sep 17 00:00:00 2001 From: hooper114 Date: Wed, 8 Jul 2009 21:37:22 +0000 Subject: [PATCH] Further adjustment for odd-length Mode C blocks --- backend/code128.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/backend/code128.c b/backend/code128.c index f79a2045..bf1ce25c 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -675,24 +675,21 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[]) for(i = 0; i < read; i++) { if(set[i] == 'C') { if(reduced[i] == '[') { - if(c_count % 2) { - set[i - c_count] = 'B'; - c_count = 0; - } else { - c_count += 2; - } + if(c_count % 2) { set[i - c_count] = 'B'; } + c_count = 0; } else { c_count++; } } else { - if(c_count % 2) - set[i - c_count] = 'B'; + if(c_count % 2) { set[i - c_count] = 'B'; } c_count = 0; } } - if(c_count % 2) { - set[i - c_count] = 'B'; - } + if(c_count % 2) { set[i - c_count] = 'B'; } + + /* for(i = 0; i < read; i++) { + printf("char %c mode %c\n", reduced[i], set[i]); + } */ /* Now we can calculate how long the barcode is going to be - and stop it from being too long */