diff --git a/backend/aztec.c b/backend/aztec.c index f503c20a..3917885e 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -672,7 +672,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[]) ecc_level = symbol->option_1; - if(ecc_level == -1) { + if((ecc_level == -1) || (ecc_level == 0)) { ecc_level = 2; } @@ -685,6 +685,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[]) /* Decide what size symbol to use - the smallest that fits the data */ compact = 0; /* 1 = Aztec Compact, 0 = Normal Aztec */ layers = 0; + switch(ecc_level) { /* For each level of error correction work out the smallest symbol which the data will fit in */ diff --git a/backend/composite.c b/backend/composite.c index 7c0268ae..5e0ec9b2 100644 --- a/backend/composite.c +++ b/backend/composite.c @@ -1761,6 +1761,8 @@ int composite(struct zint_symbol *symbol, unsigned char source[]) return error_number; } + if(cc_mode < 1 || cc_mode > 3) { cc_mode = 1; } + if(cc_mode == 1) { i = cc_binary_string(symbol, reduced, binary_string, cc_mode, &cc_width, &ecc_level, linear->width); if (i == ERROR_TOO_LONG) { diff --git a/backend/library.c b/backend/library.c index a3b40713..f59af0fe 100644 --- a/backend/library.c +++ b/backend/library.c @@ -430,7 +430,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source) if((symbol->symbology >= 112) && (symbol->symbology <= 127)) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z10]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } /* Everything from 128 up is Zint-specific */ if(symbol->symbology >= 140) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z11]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } - + if(error_number > 4) { error_tag(symbol->errtxt, error_number); return error_number; diff --git a/backend/micqr.c b/backend/micqr.c index b7e59977..9c2a0a20 100644 --- a/backend/micqr.c +++ b/backend/micqr.c @@ -2,7 +2,7 @@ /* libzint - the open source barcode library - Copyright (C) 2008 Robin Stuart + Copyright (C) 2009 Robin Stuart This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -713,6 +713,12 @@ int microqr(struct zint_symbol *symbol, unsigned char source[]) return ERROR_TOO_LONG; } + symbol_size = symbol->option_2; + + if((symbol_size < 0) || (symbol_size > 4)) { + symbol_size = 0; + } + /* Decide symbol size */ if(symbol_size == 0) { if(symbol->option_1 == 1) { /* ECC Level L */