From 2fe1acc4d40f641da39ef481a93dee5e98b25aea Mon Sep 17 00:00:00 2001 From: hooper114 Date: Sat, 8 Nov 2008 16:05:51 +0000 Subject: [PATCH] Corrected detection of all zeros and all ones in a block. --- backend/aztec.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/backend/aztec.c b/backend/aztec.c index 1e165ac3..bbf73eb6 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -216,6 +216,10 @@ int aztec_text_process(unsigned char source[], char binary_string[]) } } + for(i = 0; i < maplength; i++) { + printf("%d %d\n", charmap[i], typemap[i]); + } + for(i = 0; i < 20000; i++) { binary_string[i] = '\0'; } @@ -541,6 +545,8 @@ int aztec_text_process(unsigned char source[], char binary_string[]) } + printf("%s\n", binary_string); + if(strlen(binary_string) > 14970) { return ERROR_TOO_LONG; } @@ -669,7 +675,6 @@ int aztec(struct zint_symbol *symbol, unsigned char source[]) count = 0; for(i = 0; i <= data_length; i++) { remainder = i % codeword_size; - if(binary_string[i] == '1') count++; if(remainder == codeword_size - 1) { /* Last bit of codeword */ if(count == codeword_size - 1) { @@ -684,6 +689,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[]) } count = 0; } + if(binary_string[i] == '1') count++; adjusted_string[j] = binary_string[i]; j++; } @@ -699,6 +705,8 @@ int aztec(struct zint_symbol *symbol, unsigned char source[]) concat(adjusted_string, "1"); } adjusted_length = strlen(adjusted_string); + printf("\nbitlen %d\n", codeword_size); + printf("%s\n", adjusted_string); count = 0; for(i = (adjusted_length - codeword_size); i < adjusted_length; i++) { @@ -736,7 +744,6 @@ int aztec(struct zint_symbol *symbol, unsigned char source[]) count = 0; for(i = 0; i <= data_length; i++) { remainder = i % codeword_size; - if(binary_string[i] == '1') count++; if(remainder == codeword_size - 1) { /* Last bit of codeword */ if(count == codeword_size - 1) { @@ -751,6 +758,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[]) } count = 0; } + if(binary_string[i] == '1') count++; adjusted_string[j] = binary_string[i]; j++; }