Fix bugs found during GUI overhaul.

This commit is contained in:
hooper114 2009-04-26 22:04:01 +00:00
parent 96d6242412
commit f567430fea
4 changed files with 12 additions and 3 deletions

View File

@ -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 */

View File

@ -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) {

View File

@ -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;

View File

@ -2,7 +2,7 @@
/*
libzint - the open source barcode library
Copyright (C) 2008 Robin Stuart <robin@zint.org.uk>
Copyright (C) 2009 Robin Stuart <robin@zint.org.uk>
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 */