mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-22 11:15:16 -04:00
Updated error handling
This commit is contained in:
parent
79efc11936
commit
844dfdebef
23 changed files with 286 additions and 353 deletions
|
@ -706,12 +706,12 @@ int pdf417enc(struct zint_symbol *symbol, unsigned char source[])
|
|||
errno = 0;
|
||||
|
||||
if((symbol->option_1 < -1) || (symbol->option_1 > 8)) {
|
||||
strcpy(symbol->errtxt, "warning: security value out of range");
|
||||
strcpy(symbol->errtxt, "Security value out of range [551]");
|
||||
symbol->option_1 = -1;
|
||||
errno = WARN_INVALID_OPTION;
|
||||
}
|
||||
if((symbol->option_2 < 0) || (symbol->option_2 > 30)) {
|
||||
strcpy(symbol->errtxt, "warning: number of columns out of range");
|
||||
strcpy(symbol->errtxt, "Number of columns out of range [552]");
|
||||
symbol->option_2 = 0;
|
||||
errno = WARN_INVALID_OPTION;
|
||||
}
|
||||
|
@ -723,23 +723,23 @@ int pdf417enc(struct zint_symbol *symbol, unsigned char source[])
|
|||
if(codeerr != 0) {
|
||||
switch(codeerr) {
|
||||
case 1:
|
||||
strcpy(symbol->errtxt, "error: no such file or file unreadable (PDF error 1)");
|
||||
strcpy(symbol->errtxt, "No such file or file unreadable [553]");
|
||||
errno = ERROR_INVALID_OPTION;
|
||||
break;
|
||||
case 2:
|
||||
strcpy(symbol->errtxt, "error: input string too long (PDF error 2)");
|
||||
strcpy(symbol->errtxt, "Input string too long [554]");
|
||||
errno = ERROR_TOO_LONG;
|
||||
break;
|
||||
case 3:
|
||||
strcpy(symbol->errtxt, "error: number of codewords per row too small (PDF error 3)");
|
||||
strcpy(symbol->errtxt, "Number of codewords per row too small [555]");
|
||||
errno = WARN_INVALID_OPTION;
|
||||
break;
|
||||
case 4:
|
||||
strcpy(symbol->errtxt, "error: data too long for specified number of columns (PDF error 4)");
|
||||
strcpy(symbol->errtxt, "Data too long for specified number of columns [556]");
|
||||
errno = ERROR_TOO_LONG;
|
||||
break;
|
||||
default:
|
||||
strcpy(symbol->errtxt, "error: something strange happened");
|
||||
strcpy(symbol->errtxt, "Something strange happened [557]");
|
||||
errno = ERROR_ENCODING_PROBLEM;
|
||||
break;
|
||||
}
|
||||
|
@ -807,11 +807,11 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[])
|
|||
/* This is where it all changes! */
|
||||
|
||||
if(mclength > 126) {
|
||||
strcpy(symbol->errtxt, "error: input data too long");
|
||||
strcpy(symbol->errtxt, "Input data too long [841]");
|
||||
return ERROR_TOO_LONG;
|
||||
}
|
||||
if(symbol->option_2 > 4) {
|
||||
strcpy(symbol->errtxt, "warning: specified width out of range");
|
||||
strcpy(symbol->errtxt, "Specified width out of range [842]");
|
||||
symbol->option_2 = 0;
|
||||
codeerr = WARN_INVALID_OPTION;
|
||||
}
|
||||
|
@ -823,21 +823,21 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[])
|
|||
if((symbol->option_2 == 1) && (mclength > 20)) {
|
||||
/* the user specified 1 column but the data doesn't fit - go to automatic */
|
||||
symbol->option_2 = 0;
|
||||
strcpy(symbol->errtxt, "warning: specified symbol size too small for data");
|
||||
strcpy(symbol->errtxt, "Specified symbol size too small for data [843]");
|
||||
codeerr = WARN_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if((symbol->option_2 == 2) && (mclength > 37)) {
|
||||
/* the user specified 2 columns but the data doesn't fit - go to automatic */
|
||||
symbol->option_2 = 0;
|
||||
strcpy(symbol->errtxt, "warning: specified symbol size too small for data");
|
||||
strcpy(symbol->errtxt, "Specified symbol size too small for data [844]");
|
||||
codeerr = WARN_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if((symbol->option_2 == 3) && (mclength > 82)) {
|
||||
/* the user specified 3 columns but the data doesn't fit - go to automatic */
|
||||
symbol->option_2 = 0;
|
||||
strcpy(symbol->errtxt, "warning: specified symbol size too small for data");
|
||||
strcpy(symbol->errtxt, "Specified symbol size too small for data [845]");
|
||||
codeerr = WARN_INVALID_OPTION;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue