mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Add identifiers to error messages
To ease the debug process
This commit is contained in:
parent
5405035df1
commit
4561a66067
@ -67,12 +67,12 @@ int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int l
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 80) {
|
if (length > 80) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C01)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C02)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,12 +100,12 @@ int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], i
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 45) {
|
if (length > 45) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C03)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid character in data");
|
strcpy(symbol->errtxt, "Invalid character in data (C04)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,12 +132,12 @@ int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int len
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 45) {
|
if (length > 45) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C05)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C06)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,12 +165,12 @@ int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int le
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 80) {
|
if (length > 80) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C07)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C08)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,12 +203,12 @@ int interleaved_two_of_five(struct zint_symbol *symbol, const unsigned char sour
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 89) {
|
if (length > 89) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C09)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C0A)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,13 +263,13 @@ int itf14(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
if (length > 13) {
|
if (length > 13) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C0B)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid character in data");
|
strcpy(symbol->errtxt, "Invalid character in data (C0D)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,12 +305,12 @@ int dpleit(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
count = 0;
|
count = 0;
|
||||||
if (length > 13) {
|
if (length > 13) {
|
||||||
strcpy(symbol->errtxt, "Input wrong length");
|
strcpy(symbol->errtxt, "Input wrong length (C0E)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C0D)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,12 +341,12 @@ int dpident(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (length > 11) {
|
if (length > 11) {
|
||||||
strcpy(symbol->errtxt, "Input wrong length");
|
strcpy(symbol->errtxt, "Input wrong length (C0E)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C0F)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,16 +138,16 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
|||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strcpy(symbol->errtxt, "Auspost input is wrong length");
|
strcpy(symbol->errtxt, "Auspost input is wrong length (D01)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (D02)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (length > 8) {
|
if (length > 8) {
|
||||||
strcpy(symbol->errtxt, "Auspost input is too long");
|
strcpy(symbol->errtxt, "Auspost input is too long (D03)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
switch (symbol->symbology) {
|
switch (symbol->symbology) {
|
||||||
@ -169,7 +169,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
|||||||
h = strlen(localstr);
|
h = strlen(localstr);
|
||||||
error_number = is_sane(GDSET, (unsigned char *) localstr, h);
|
error_number = is_sane(GDSET, (unsigned char *) localstr, h);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (D04)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ int australia_post(struct zint_symbol *symbol, unsigned char source[], int lengt
|
|||||||
dpid[8] = '\0';
|
dpid[8] = '\0';
|
||||||
error_number = is_sane(NEON, (unsigned char *) dpid, strlen(dpid));
|
error_number = is_sane(NEON, (unsigned char *) dpid, strlen(dpid));
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in DPID");
|
strcpy(symbol->errtxt, "Invalid characters in DPID (D05)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -907,7 +907,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
comp_loop = 1;
|
comp_loop = 1;
|
||||||
}
|
}
|
||||||
if (gs1 && reader) {
|
if (gs1 && reader) {
|
||||||
strcpy(symbol->errtxt, "Cannot encode in GS1 and Reader Initialisation mode at the same time");
|
strcpy(symbol->errtxt, "Cannot encode in GS1 and Reader Initialisation mode at the same time (E01)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -916,12 +916,12 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
err_code = aztec_text_process(source, length, binary_string, gs1, symbol->eci);
|
err_code = aztec_text_process(source, length, binary_string, gs1, symbol->eci);
|
||||||
|
|
||||||
if (err_code != 0) {
|
if (err_code != 0) {
|
||||||
strcpy(symbol->errtxt, "Input too long or too many extended ASCII characters");
|
strcpy(symbol->errtxt, "Input too long or too many extended ASCII characters (E02)");
|
||||||
return err_code;
|
return err_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!((symbol->option_1 >= -1) && (symbol->option_1 <= 4))) {
|
if (!((symbol->option_1 >= -1) && (symbol->option_1 <= 4))) {
|
||||||
strcpy(symbol->errtxt, "Invalid error correction level - using default instead");
|
strcpy(symbol->errtxt, "Invalid error correction level - using default instead (E03)");
|
||||||
err_code = ZINT_WARN_INVALID_OPTION;
|
err_code = ZINT_WARN_INVALID_OPTION;
|
||||||
symbol->option_1 = -1;
|
symbol->option_1 = -1;
|
||||||
}
|
}
|
||||||
@ -1009,7 +1009,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (layers == 0) { /* Couldn't find a symbol which fits the data */
|
if (layers == 0) { /* Couldn't find a symbol which fits the data */
|
||||||
strcpy(symbol->errtxt, "Input too long (too many bits for selected ECC)");
|
strcpy(symbol->errtxt, "Input too long (too many bits for selected ECC) (E04)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1201,7 +1201,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (adjusted_length > data_maxsize) {
|
if (adjusted_length > data_maxsize) {
|
||||||
strcpy(symbol->errtxt, "Data too long for specified Aztec Code symbol size");
|
strcpy(symbol->errtxt, "Data too long for specified Aztec Code symbol size (E05)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1218,7 +1218,7 @@ int aztec(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (reader && (layers > 22)) {
|
if (reader && (layers > 22)) {
|
||||||
strcpy(symbol->errtxt, "Data too long for reader initialisation symbol");
|
strcpy(symbol->errtxt, "Data too long for reader initialisation symbol (E06)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1558,12 +1558,12 @@ int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length)
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
input_value = 0;
|
input_value = 0;
|
||||||
if (length > 3) {
|
if (length > 3) {
|
||||||
strcpy(symbol->errtxt, "Input too large");
|
strcpy(symbol->errtxt, "Input too large (E07)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number != 0) {
|
if (error_number != 0) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in input");
|
strcpy(symbol->errtxt, "Invalid characters in input (E08)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
switch (length) {
|
switch (length) {
|
||||||
@ -1579,7 +1579,7 @@ int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (input_value > 255) {
|
if (input_value > 255) {
|
||||||
strcpy(symbol->errtxt, "Input too large");
|
strcpy(symbol->errtxt, "Input too large (E09)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ int bmp_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
bmp_file = stdout;
|
bmp_file = stdout;
|
||||||
} else {
|
} else {
|
||||||
if (!(bmp_file = fopen(symbol->outfile, "wb"))) {
|
if (!(bmp_file = fopen(symbol->outfile, "wb"))) {
|
||||||
strcpy(symbol->errtxt, "Can't open output file");
|
strcpy(symbol->errtxt, "Can't open output file (F00)");
|
||||||
return ZINT_ERROR_FILE_ACCESS;
|
return ZINT_ERROR_FILE_ACCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -641,18 +641,18 @@ int codablock(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
/* option1: rows 0: automatic, 1..44 */
|
/* option1: rows 0: automatic, 1..44 */
|
||||||
rows = symbol->option_1;
|
rows = symbol->option_1;
|
||||||
if (rows > 44) {
|
if (rows > 44) {
|
||||||
strcpy(symbol->errtxt, "Row parameter not in 0..44");
|
strcpy(symbol->errtxt, "Row parameter not in 0..44 (D10)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
/* option_2: (usable data) columns: 0: automatic, 6..66 */
|
/* option_2: (usable data) columns: 0: automatic, 6..66 */
|
||||||
columns = symbol->option_2;
|
columns = symbol->option_2;
|
||||||
if ( ! (columns <= 0 || (columns >= 6 && columns <=66)) ) {
|
if ( ! (columns <= 0 || (columns >= 6 && columns <=66)) ) {
|
||||||
strcpy(symbol->errtxt, "Columns parameter not in 0,6..66");
|
strcpy(symbol->errtxt, "Columns parameter not in 0,6..66 (D11)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
/* GS1 not implemented */
|
/* GS1 not implemented */
|
||||||
if (symbol->input_mode == GS1_MODE) {
|
if (symbol->input_mode == GS1_MODE) {
|
||||||
strcpy(symbol->errtxt, "GS1 mode not supported");
|
strcpy(symbol->errtxt, "GS1 mode not supported (D12)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
@ -714,7 +714,7 @@ int codablock(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
Error=Columns2Rows(T,data,dataLength,&rows,&useColumns,pSet,&fillings);
|
Error=Columns2Rows(T,data,dataLength,&rows,&useColumns,pSet,&fillings);
|
||||||
}
|
}
|
||||||
if (Error != 0) {
|
if (Error != 0) {
|
||||||
strcpy(symbol->errtxt, "data string to long");
|
strcpy(symbol->errtxt, "data string to long (D13)");
|
||||||
return Error;
|
return Error;
|
||||||
}
|
}
|
||||||
/* Checksum */
|
/* Checksum */
|
||||||
|
@ -115,12 +115,12 @@ int code_11(struct zint_symbol *symbol, unsigned char source[], int length) { /*
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 121) {
|
if (length > 121) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C20)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(SODIUM, source, length);
|
error_number = is_sane(SODIUM, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C21)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
c_weight = 1;
|
c_weight = 1;
|
||||||
@ -203,16 +203,16 @@ int c39(struct zint_symbol *symbol, unsigned char source[], const size_t length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((symbol->symbology == BARCODE_LOGMARS) && (length > 59)) {
|
if ((symbol->symbology == BARCODE_LOGMARS) && (length > 59)) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C22)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
} else if (length > 74) {
|
} else if (length > 74) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C23)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
to_upper(source);
|
to_upper(source);
|
||||||
error_number = is_sane(SILVER, source, length);
|
error_number = is_sane(SILVER, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C24)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,12 +302,12 @@ int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length
|
|||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (length > 6) {
|
if (length > 6) {
|
||||||
strcpy(symbol->errtxt, "Input wrong length");
|
strcpy(symbol->errtxt, "Input wrong length (C25)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C26)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length
|
|||||||
localstr[7] = itoc(check_digit);
|
localstr[7] = itoc(check_digit);
|
||||||
localstr[8] = '\0';
|
localstr[8] = '\0';
|
||||||
if (localstr[7] == 'A') {
|
if (localstr[7] == 'A') {
|
||||||
strcpy(symbol->errtxt, "Invalid PZN Data");
|
strcpy(symbol->errtxt, "Invalid PZN Data (C27)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
error_number = c39(symbol, (unsigned char *) localstr, strlen(localstr));
|
error_number = c39(symbol, (unsigned char *) localstr, strlen(localstr));
|
||||||
@ -347,7 +347,7 @@ int ec39(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 74) {
|
if (length > 74) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C28)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ int ec39(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
for (i = 0; i < (unsigned int) length; i++) {
|
for (i = 0; i < (unsigned int) length; i++) {
|
||||||
if (source[i] > 127) {
|
if (source[i] > 127) {
|
||||||
/* Cannot encode extended ASCII */
|
/* Cannot encode extended ASCII */
|
||||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
strcpy(symbol->errtxt, "Invalid characters in input data (C29)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
strcat((char*) buffer, EC39Ctrl[source[i]]);
|
strcat((char*) buffer, EC39Ctrl[source[i]]);
|
||||||
@ -388,7 +388,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
strcpy(buffer, "");
|
strcpy(buffer, "");
|
||||||
|
|
||||||
if (length > 107) {
|
if (length > 107) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C2A)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
if (source[i] > 127) {
|
if (source[i] > 127) {
|
||||||
/* Cannot encode extended ASCII */
|
/* Cannot encode extended ASCII */
|
||||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
strcpy(symbol->errtxt, "Invalid characters in input data (C2B)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
strcat(buffer, C93Ctrl[source[i]]);
|
strcat(buffer, C93Ctrl[source[i]]);
|
||||||
@ -406,7 +406,7 @@ int c93(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
/* Now we can check the true length of the barcode */
|
/* Now we can check the true length of the barcode */
|
||||||
h = (int) strlen(buffer);
|
h = (int) strlen(buffer);
|
||||||
if (h > 107) {
|
if (h > 107) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C2C)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,12 +521,12 @@ int channel_code(struct zint_symbol *symbol, unsigned char source[], int length)
|
|||||||
target_value = 0;
|
target_value = 0;
|
||||||
|
|
||||||
if (length > 7) {
|
if (length > 7) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C2D)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C2E)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,7 +574,7 @@ int channel_code(struct zint_symbol *symbol, unsigned char source[], int length)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (range) {
|
if (range) {
|
||||||
strcpy(symbol->errtxt, "Value out of range");
|
strcpy(symbol->errtxt, "Value out of range (C2F)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1026,7 +1026,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
|
|
||||||
if (tp > 1480) {
|
if (tp > 1480) {
|
||||||
/* Data is too large for symbol */
|
/* Data is too large for symbol */
|
||||||
strcpy(symbol->errtxt, "Input data too long");
|
strcpy(symbol->errtxt, "Input data too long (E10)");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} while (sp < length);
|
} while (sp < length);
|
||||||
@ -1171,7 +1171,7 @@ int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigned int t
|
|||||||
/* Re-check length of data */
|
/* Re-check length of data */
|
||||||
if (tp > 1480) {
|
if (tp > 1480) {
|
||||||
/* Data is too large for symbol */
|
/* Data is too large for symbol */
|
||||||
strcpy(symbol->errtxt, "Input data too long");
|
strcpy(symbol->errtxt, "Input data too long (E11)");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -1204,7 +1204,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
int sub_version = 0;
|
int sub_version = 0;
|
||||||
|
|
||||||
if ((symbol->option_2 < 0) || (symbol->option_2 > 10)) {
|
if ((symbol->option_2 < 0) || (symbol->option_2 > 10)) {
|
||||||
strcpy(symbol->errtxt, "Invalid symbol size");
|
strcpy(symbol->errtxt, "Invalid symbol size (E12)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1217,11 +1217,11 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
int block_width;
|
int block_width;
|
||||||
|
|
||||||
if (length > 18) {
|
if (length > 18) {
|
||||||
strcpy(symbol->errtxt, "Input data too long");
|
strcpy(symbol->errtxt, "Input data too long (E13)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
if (is_sane(NEON, source, length) == ZINT_ERROR_INVALID_DATA) {
|
if (is_sane(NEON, source, length) == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid input data (Version S encodes numeric input only)");
|
strcpy(symbol->errtxt, "Invalid input data (Version S encodes numeric input only) (E14)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1331,7 +1331,7 @@ int code_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data_length > 38) {
|
if (data_length > 38) {
|
||||||
strcpy(symbol->errtxt, "Input data too long");
|
strcpy(symbol->errtxt, "Input data too long (E15)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
if (sourcelen > 160) {
|
if (sourcelen > 160) {
|
||||||
/* This only blocks rediculously long input - the actual length of the
|
/* This only blocks rediculously long input - the actual length of the
|
||||||
resulting barcode depends on the type of data, so this is trapped later */
|
resulting barcode depends on the type of data, so this is trapped later */
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C40)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,7 +482,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (glyph_count > 60.0) {
|
if (glyph_count > 60.0) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C41)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -707,13 +707,13 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t len
|
|||||||
if (length > 160) {
|
if (length > 160) {
|
||||||
/* This only blocks rediculously long input - the actual length of the
|
/* This only blocks rediculously long input - the actual length of the
|
||||||
resulting barcode depends on the type of data, so this is trapped later */
|
resulting barcode depends on the type of data, so this is trapped later */
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C42)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
if (source[i] == '\0') {
|
if (source[i] == '\0') {
|
||||||
/* Null characters not allowed! */
|
/* Null characters not allowed! */
|
||||||
strcpy(symbol->errtxt, "NULL character in input data");
|
strcpy(symbol->errtxt, "NULL character in input data (C43)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -843,7 +843,7 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t len
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (glyph_count > 60.0) {
|
if (glyph_count > 60.0) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C44)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1010,13 +1010,13 @@ int nve_18(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
sourcelen = length;
|
sourcelen = length;
|
||||||
|
|
||||||
if (sourcelen > 17) {
|
if (sourcelen > 17) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C45)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C46)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
zeroes = 17 - sourcelen;
|
zeroes = 17 - sourcelen;
|
||||||
@ -1051,13 +1051,13 @@ int ean_14(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
unsigned char ean128_equiv[20];
|
unsigned char ean128_equiv[20];
|
||||||
|
|
||||||
if (length > 13) {
|
if (length > 13) {
|
||||||
strcpy(symbol->errtxt, "Input wrong length");
|
strcpy(symbol->errtxt, "Input wrong length (C47)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid character in data");
|
strcpy(symbol->errtxt, "Invalid character in data (C48)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (input_length > 157) {
|
if (input_length > 157) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D20)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,7 +477,7 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (glyph_count > 77.0) {
|
if (glyph_count > 77.0) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D21)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,7 +509,7 @@ int code16k(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
m = 5;
|
m = 5;
|
||||||
}
|
}
|
||||||
if (gs1) {
|
if (gs1) {
|
||||||
strcpy(symbol->errtxt, "Cannot use both GS1 mode and Reader Initialisation");
|
strcpy(symbol->errtxt, "Cannot use both GS1 mode and Reader Initialisation (D22)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
} else {
|
} else {
|
||||||
if ((set[0] == 'B') && (set[1] == 'C')) {
|
if ((set[0] == 'B') && (set[1] == 'C')) {
|
||||||
|
@ -52,7 +52,7 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], const int length
|
|||||||
size_t h;
|
size_t h;
|
||||||
|
|
||||||
if (length > 81) {
|
if (length > 81) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D30)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
if (symbol->input_mode == GS1_MODE) {
|
if (symbol->input_mode == GS1_MODE) {
|
||||||
@ -64,7 +64,7 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], const int length
|
|||||||
|
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
if (source[i] > 127) {
|
if (source[i] > 127) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
strcpy(symbol->errtxt, "Invalid characters in input data (D31)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
if (gs1 && (source[i] == '['))
|
if (gs1 && (source[i] == '['))
|
||||||
@ -215,7 +215,7 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], const int length
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (codeword_count > 49) {
|
if (codeword_count > 49) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D32)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,11 +238,11 @@ int utf8toutf16(struct zint_symbol *symbol, const unsigned char source[], int va
|
|||||||
jpos++;
|
jpos++;
|
||||||
} else {
|
} else {
|
||||||
if ((source[bpos] >= 0x80) && (source[bpos] <= 0xbf)) {
|
if ((source[bpos] >= 0x80) && (source[bpos] <= 0xbf)) {
|
||||||
strcpy(symbol->errtxt, "Corrupt Unicode data");
|
strcpy(symbol->errtxt, "Corrupt Unicode data (B40)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
if ((source[bpos] >= 0xc0) && (source[bpos] <= 0xc1)) {
|
if ((source[bpos] >= 0xc0) && (source[bpos] <= 0xc1)) {
|
||||||
strcpy(symbol->errtxt, "Overlong encoding not supported");
|
strcpy(symbol->errtxt, "Overlong encoding not supported (B41)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ int utf8toutf16(struct zint_symbol *symbol, const unsigned char source[], int va
|
|||||||
jpos++;
|
jpos++;
|
||||||
} else
|
} else
|
||||||
if (source[bpos] >= 0xf0) {
|
if (source[bpos] >= 0xf0) {
|
||||||
strcpy(symbol->errtxt, "Unicode sequences of more than 3 bytes not supported");
|
strcpy(symbol->errtxt, "Unicode sequences of more than 3 bytes not supported (B42)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1170,7 +1170,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
if (!(((ninety[i] >= '0') && (ninety[i] <= '9')) || ((ninety[i] >= 'A') && (ninety[i] <= 'Z')))) {
|
if (!(((ninety[i] >= '0') && (ninety[i] <= '9')) || ((ninety[i] >= 'A') && (ninety[i] <= 'Z')))) {
|
||||||
if ((ninety[i] != '*') && (ninety[i] != ',') && (ninety[i] != '-') && (ninety[i] != '.') && (ninety[i] != '/')) {
|
if ((ninety[i] != '*') && (ninety[i] != ',') && (ninety[i] != '-') && (ninety[i] != '.') && (ninety[i] != '/')) {
|
||||||
/* An Invalid AI 90 character */
|
/* An Invalid AI 90 character */
|
||||||
strcpy(symbol->errtxt, "Invalid AI 90 data");
|
strcpy(symbol->errtxt, "Invalid AI 90 data (D40)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1529,7 +1529,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
|
|
||||||
if (latch == 1) {
|
if (latch == 1) {
|
||||||
/* Invalid characters in input data */
|
/* Invalid characters in input data */
|
||||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
strcpy(symbol->errtxt, "Invalid characters in input data (D41)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1735,7 +1735,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (target_bitsize == 0) {
|
if (target_bitsize == 0) {
|
||||||
strcpy(symbol->errtxt, "Input too long for selected 2d component");
|
strcpy(symbol->errtxt, "Input too long for selected 2d component (D42)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1778,7 +1778,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(binary_string) > 11805) { /* (2361 * 5) */
|
if (strlen(binary_string) > 11805) { /* (2361 * 5) */
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D43)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1797,7 +1797,7 @@ int cc_binary_string(struct zint_symbol *symbol, const char source[], char binar
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (target_bitsize == 0) {
|
if (target_bitsize == 0) {
|
||||||
strcpy(symbol->errtxt, "Input too long for selected 2d component");
|
strcpy(symbol->errtxt, "Input too long for selected 2d component (D44)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1914,19 +1914,19 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
pri_len = strlen(symbol->primary);
|
pri_len = strlen(symbol->primary);
|
||||||
if (pri_len == 0) {
|
if (pri_len == 0) {
|
||||||
strcpy(symbol->errtxt, "No primary (linear) message in 2D composite");
|
strcpy(symbol->errtxt, "No primary (linear) message in 2D composite (D45)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length > 2990) {
|
if (length > 2990) {
|
||||||
strcpy(symbol->errtxt, "2D component input data too long");
|
strcpy(symbol->errtxt, "2D component input data too long (D46)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_mode = symbol->option_1;
|
cc_mode = symbol->option_1;
|
||||||
if ((cc_mode == 3) && (symbol->symbology != BARCODE_EAN128_CC)) {
|
if ((cc_mode == 3) && (symbol->symbology != BARCODE_EAN128_CC)) {
|
||||||
/* CC-C can only be used with a GS1-128 linear part */
|
/* CC-C can only be used with a GS1-128 linear part */
|
||||||
strcpy(symbol->errtxt, "Invalid mode (CC-C only valid with GS1-128 linear component)");
|
strcpy(symbol->errtxt, "Invalid mode (CC-C only valid with GS1-128 linear component) (D47)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1939,7 +1939,7 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
/* Do a test run of encoding the linear component to establish its width */
|
/* Do a test run of encoding the linear component to establish its width */
|
||||||
linear_width = linear_dummy_run((unsigned char *) symbol->primary, pri_len);
|
linear_width = linear_dummy_run((unsigned char *) symbol->primary, pri_len);
|
||||||
if (linear_width == 0) {
|
if (linear_width == 0) {
|
||||||
strcpy(symbol->errtxt, "Invalid data");
|
strcpy(symbol->errtxt, "Invalid data (D48)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2065,7 +2065,7 @@ int composite(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
if (error_number != 0) {
|
if (error_number != 0) {
|
||||||
strcpy(symbol->errtxt, linear->errtxt);
|
strcpy(symbol->errtxt, linear->errtxt);
|
||||||
strcat(symbol->errtxt, " in linear component");
|
strcat(symbol->errtxt, " in linear component ");
|
||||||
ZBarcode_Delete(linear);
|
ZBarcode_Delete(linear);
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
@ -563,7 +563,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
|
|||||||
|
|
||||||
if (symbol->output_options & READER_INIT) {
|
if (symbol->output_options & READER_INIT) {
|
||||||
if (gs1) {
|
if (gs1) {
|
||||||
strcpy(symbol->errtxt, "Cannot encode in GS1 mode and Reader Initialisation at the same time");
|
strcpy(symbol->errtxt, "Cannot encode in GS1 mode and Reader Initialisation at the same time (E10)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
} else {
|
} else {
|
||||||
target[tp] = 234;
|
target[tp] = 234;
|
||||||
@ -1157,7 +1157,7 @@ int data_matrix_200(struct zint_symbol *symbol, const unsigned char source[], co
|
|||||||
binlen = dm200encode(symbol, source, binary, &last_mode, &inputlen, process_buffer, &process_p);
|
binlen = dm200encode(symbol, source, binary, &last_mode, &inputlen, process_buffer, &process_p);
|
||||||
|
|
||||||
if (binlen == 0) {
|
if (binlen == 0) {
|
||||||
strcpy(symbol->errtxt, "Data too long to fit in symbol");
|
strcpy(symbol->errtxt, "Data too long to fit in symbol (E11)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1193,7 +1193,7 @@ int data_matrix_200(struct zint_symbol *symbol, const unsigned char source[], co
|
|||||||
if (optionsize != -1) {
|
if (optionsize != -1) {
|
||||||
/* flag an error */
|
/* flag an error */
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
strcpy(symbol->errtxt, "Data does not fit in selected symbol size");
|
strcpy(symbol->errtxt, "Data does not fit in selected symbol size (E12)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1302,7 +1302,7 @@ int dmatrix(struct zint_symbol *symbol, const unsigned char source[], const int
|
|||||||
error_number = data_matrix_200(symbol, source, in_length);
|
error_number = data_matrix_200(symbol, source, in_length);
|
||||||
} else {
|
} else {
|
||||||
/* ECC 000 - 140 */
|
/* ECC 000 - 140 */
|
||||||
strcpy(symbol->errtxt, "Older Data Matrix standards are no longer supported");
|
strcpy(symbol->errtxt, "Older Data Matrix standards are no longer supported (E13)");
|
||||||
error_number = ZINT_ERROR_INVALID_OPTION;
|
error_number = ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1090,7 +1090,7 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((height > 200) || (width > 200)) {
|
if ((height > 200) || (width > 200)) {
|
||||||
strcpy(symbol->errtxt, "Specified symbol size is too large");
|
strcpy(symbol->errtxt, "Specified symbol size is too large (E20)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1124,7 +1124,7 @@ int dotcode(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||||||
if (data_length > 450) {
|
if (data_length > 450) {
|
||||||
// Larger data sets than this cause rsencode() to throw SIGSEGV
|
// Larger data sets than this cause rsencode() to throw SIGSEGV
|
||||||
// This should probably be fixed by somebody who understands what rsencode() does...
|
// This should probably be fixed by somebody who understands what rsencode() does...
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (E21)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ int gif_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
gif_file = stdout;
|
gif_file = stdout;
|
||||||
} else {
|
} else {
|
||||||
if (!(gif_file = fopen(symbol->outfile, "wb"))) {
|
if (!(gif_file = fopen(symbol->outfile, "wb"))) {
|
||||||
strcpy(symbol->errtxt, "Can't open output file");
|
strcpy(symbol->errtxt, "Can't open output file (F10)");
|
||||||
return ZINT_ERROR_FILE_ACCESS;
|
return ZINT_ERROR_FILE_ACCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1088,7 +1088,7 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], int le
|
|||||||
j++;
|
j++;
|
||||||
} while ((j < 7445) && (glyph == 0));
|
} while ((j < 7445) && (glyph == 0));
|
||||||
if (glyph == 0) {
|
if (glyph == 0) {
|
||||||
strcpy(symbol->errtxt, "Invalid character in input data");
|
strcpy(symbol->errtxt, "Invalid character in input data (E30)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
gbdata[i] = glyph;
|
gbdata[i] = glyph;
|
||||||
@ -1100,7 +1100,7 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], int le
|
|||||||
|
|
||||||
error_number = gm_encode(gbdata, length, binary, reader, symbol->eci);
|
error_number = gm_encode(gbdata, length, binary, reader, symbol->eci);
|
||||||
if (error_number != 0) {
|
if (error_number != 0) {
|
||||||
strcpy(symbol->errtxt, "Input data too long");
|
strcpy(symbol->errtxt, "Input data too long (E31)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1187,7 +1187,7 @@ int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], int le
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data_cw > data_max) {
|
if (data_cw > data_max) {
|
||||||
strcpy(symbol->errtxt, "Input data too long");
|
strcpy(symbol->errtxt, "Input data too long (E32)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,17 +79,17 @@ int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const s
|
|||||||
/* Detect extended ASCII characters */
|
/* Detect extended ASCII characters */
|
||||||
for (i = 0; i < src_len; i++) {
|
for (i = 0; i < src_len; i++) {
|
||||||
if (source[i] >= 128) {
|
if (source[i] >= 128) {
|
||||||
strcpy(symbol->errtxt, "Extended ASCII characters are not supported by GS1");
|
strcpy(symbol->errtxt, "Extended ASCII characters are not supported by GS1 (B50)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
if (source[i] < 32) {
|
if (source[i] < 32) {
|
||||||
strcpy(symbol->errtxt, "Control characters are not supported by GS1");
|
strcpy(symbol->errtxt, "Control characters are not supported by GS1 (B51)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source[0] != '[') {
|
if (source[0] != '[') {
|
||||||
strcpy(symbol->errtxt, "Data does not start with an AI");
|
strcpy(symbol->errtxt, "Data does not start with an AI (B52)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,31 +129,31 @@ int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const s
|
|||||||
|
|
||||||
if (bracket_level != 0) {
|
if (bracket_level != 0) {
|
||||||
/* Not all brackets are closed */
|
/* Not all brackets are closed */
|
||||||
strcpy(symbol->errtxt, "Malformed AI in input data (brackets don\'t match)");
|
strcpy(symbol->errtxt, "Malformed AI in input data (brackets don\'t match) (B53)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_bracket_level > 1) {
|
if (max_bracket_level > 1) {
|
||||||
/* Nested brackets */
|
/* Nested brackets */
|
||||||
strcpy(symbol->errtxt, "Found nested brackets in input data");
|
strcpy(symbol->errtxt, "Found nested brackets in input data (B54)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_ai_length > 4) {
|
if (max_ai_length > 4) {
|
||||||
/* AI is too long */
|
/* AI is too long */
|
||||||
strcpy(symbol->errtxt, "Invalid AI in input data (AI too long)");
|
strcpy(symbol->errtxt, "Invalid AI in input data (AI too long) (B55)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (min_ai_length <= 1) {
|
if (min_ai_length <= 1) {
|
||||||
/* AI is too short */
|
/* AI is too short */
|
||||||
strcpy(symbol->errtxt, "Invalid AI in input data (AI too short)");
|
strcpy(symbol->errtxt, "Invalid AI in input data (AI too short) (B56)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ai_latch == 1) {
|
if (ai_latch == 1) {
|
||||||
/* Non-numeric data in AI */
|
/* Non-numeric data in AI */
|
||||||
strcpy(symbol->errtxt, "Invalid AI in input data (non-numeric characters in AI)");
|
strcpy(symbol->errtxt, "Invalid AI in input data (non-numeric characters in AI) (B57)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const s
|
|||||||
for (i = 0; i < ai_count; i++) {
|
for (i = 0; i < ai_count; i++) {
|
||||||
if (data_length[i] == 0) {
|
if (data_length[i] == 0) {
|
||||||
/* No data for given AI */
|
/* No data for given AI */
|
||||||
strcpy(symbol->errtxt, "Empty data field in input data");
|
strcpy(symbol->errtxt, "Empty data field in input data (B58)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,13 +286,13 @@ int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const s
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (error_latch == 5) {
|
if (error_latch == 5) {
|
||||||
strcpy(symbol->errtxt, "Invalid data length for AI ");
|
strcpy(symbol->errtxt, "Invalid data length for AI (B59)");
|
||||||
strcat(symbol->errtxt, ai_string);
|
strcat(symbol->errtxt, ai_string);
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error_latch == 6) {
|
if (error_latch == 6) {
|
||||||
strcpy(symbol->errtxt, "Invalid AI value ");
|
strcpy(symbol->errtxt, "Invalid AI value (B60)");
|
||||||
strcat(symbol->errtxt, ai_string);
|
strcat(symbol->errtxt, ai_string);
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
@ -353,6 +353,6 @@ int ugs1_verify(struct zint_symbol *symbol, const unsigned char source[], const
|
|||||||
ustrcpy(reduced, (unsigned char*) temp);
|
ustrcpy(reduced, (unsigned char*) temp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
strcpy(symbol->errtxt, "ugs1_verify overflow");
|
strcpy(symbol->errtxt, "ugs1_verify overflow (B61)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
@ -1363,7 +1363,7 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||||||
j++;
|
j++;
|
||||||
} while ((j < 6793) && (glyph == 0));
|
} while ((j < 6793) && (glyph == 0));
|
||||||
if (glyph == 0) {
|
if (glyph == 0) {
|
||||||
strcpy(symbol->errtxt, "Unknown character in input data");
|
strcpy(symbol->errtxt, "Unknown character in input data (E40)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
} else {
|
} else {
|
||||||
gbdata[posn] = glyph;
|
gbdata[posn] = glyph;
|
||||||
@ -1434,7 +1434,7 @@ int han_xin(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (version == 85) {
|
if (version == 85) {
|
||||||
strcpy(symbol->errtxt, "Input too long for selected error correction level");
|
strcpy(symbol->errtxt, "Input too long for selected error correction level (E41)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,12 +271,12 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 32) {
|
if (length > 32) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D50)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(SODIUM, source, length);
|
error_number = is_sane(SODIUM, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (D51)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,11 +311,11 @@ int imail(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(tracker) != 20) {
|
if (strlen(tracker) != 20) {
|
||||||
strcpy(symbol->errtxt, "Invalid length tracking code");
|
strcpy(symbol->errtxt, "Invalid length tracking code (D52)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
if (strlen(zip) > 11) {
|
if (strlen(zip) > 11) {
|
||||||
strcpy(symbol->errtxt, "Invalid ZIP code");
|
strcpy(symbol->errtxt, "Invalid ZIP code (D53)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ int dump_plot(struct zint_symbol *symbol) {
|
|||||||
} else {
|
} else {
|
||||||
f = fopen(symbol->outfile, "w");
|
f = fopen(symbol->outfile, "w");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
strcpy(symbol->errtxt, "Could not open output file");
|
strcpy(symbol->errtxt, "Could not open output file (B01)");
|
||||||
return ZINT_ERROR_FILE_ACCESS;
|
return ZINT_ERROR_FILE_ACCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,13 +290,13 @@ static int hibc(struct zint_symbol *symbol, unsigned char source[], size_t lengt
|
|||||||
|
|
||||||
/* without "+" and check: max 110 characters in HIBC 2.6 */
|
/* without "+" and check: max 110 characters in HIBC 2.6 */
|
||||||
if (length > 110) {
|
if (length > 110) {
|
||||||
strcpy(symbol->errtxt, "Data too long for HIBC LIC");
|
strcpy(symbol->errtxt, "Data too long for HIBC LIC (B02)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
to_upper(source);
|
to_upper(source);
|
||||||
error_number = is_sane(TECHNETIUM, source, length);
|
error_number = is_sane(TECHNETIUM, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (B03)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,7 +543,6 @@ int ZBarcode_ValidID(int symbol_id) {
|
|||||||
case BARCODE_RM4SCC:
|
case BARCODE_RM4SCC:
|
||||||
case BARCODE_DATAMATRIX:
|
case BARCODE_DATAMATRIX:
|
||||||
case BARCODE_EAN14:
|
case BARCODE_EAN14:
|
||||||
case BARCODE_EAN14_CHK:
|
|
||||||
case BARCODE_NVE18:
|
case BARCODE_NVE18:
|
||||||
case BARCODE_JAPANPOST:
|
case BARCODE_JAPANPOST:
|
||||||
case BARCODE_KOREAPOST:
|
case BARCODE_KOREAPOST:
|
||||||
@ -646,7 +645,7 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
|
|||||||
case UNICODE_MODE:
|
case UNICODE_MODE:
|
||||||
error_number = utf_to_eci(symbol->eci, source, preprocessed, &in_length);
|
error_number = utf_to_eci(symbol->eci, source, preprocessed, &in_length);
|
||||||
if (error_number != 0) {
|
if (error_number != 0) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
strcpy(symbol->errtxt, "Invalid characters in input data (B04)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -763,7 +762,6 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
|
|||||||
case BARCODE_DAFT: error_number = daft_code(symbol, preprocessed, in_length);
|
case BARCODE_DAFT: error_number = daft_code(symbol, preprocessed, in_length);
|
||||||
break;
|
break;
|
||||||
case BARCODE_EAN14:
|
case BARCODE_EAN14:
|
||||||
case BARCODE_EAN14_CHK:
|
|
||||||
error_number = ean_14(symbol, preprocessed, in_length);
|
error_number = ean_14(symbol, preprocessed, in_length);
|
||||||
break;
|
break;
|
||||||
case BARCODE_AZRUNE: error_number = aztec_runes(symbol, preprocessed, in_length);
|
case BARCODE_AZRUNE: error_number = aztec_runes(symbol, preprocessed, in_length);
|
||||||
@ -820,7 +818,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
length = (int) ustrlen(source);
|
length = (int) ustrlen(source);
|
||||||
}
|
}
|
||||||
if (length == 0) {
|
if (length == 0) {
|
||||||
strcpy(symbol->errtxt, "No input data");
|
strcpy(symbol->errtxt, "No input data (B05)");
|
||||||
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_DATA);
|
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_DATA);
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
@ -840,7 +838,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
|
|
||||||
/* First check the symbology field */
|
/* First check the symbology field */
|
||||||
if (symbol->symbology < 1) {
|
if (symbol->symbology < 1) {
|
||||||
strcpy(symbol->errtxt, "Symbology out of range, using Code 128");
|
strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B06)");
|
||||||
symbol->symbology = BARCODE_CODE128;
|
symbol->symbology = BARCODE_CODE128;
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
@ -859,7 +857,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
symbol->symbology = BARCODE_UPCA;
|
symbol->symbology = BARCODE_UPCA;
|
||||||
}
|
}
|
||||||
if (symbol->symbology == 19) {
|
if (symbol->symbology == 19) {
|
||||||
strcpy(symbol->errtxt, "Codabar 18 not supported, using Codabar");
|
strcpy(symbol->errtxt, "Codabar 18 not supported, using Codabar (B07)");
|
||||||
symbol->symbology = BARCODE_CODABAR;
|
symbol->symbology = BARCODE_CODABAR;
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
@ -867,7 +865,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
symbol->symbology = BARCODE_UPCA;
|
symbol->symbology = BARCODE_UPCA;
|
||||||
}
|
}
|
||||||
if (symbol->symbology == 27) {
|
if (symbol->symbology == 27) {
|
||||||
strcpy(symbol->errtxt, "UPCD1 not supported");
|
strcpy(symbol->errtxt, "UPCD1 not supported (B08)");
|
||||||
error_number = ZINT_ERROR_INVALID_OPTION;
|
error_number = ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
if (symbol->symbology == 33) {
|
if (symbol->symbology == 33) {
|
||||||
@ -889,7 +887,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
symbol->symbology = BARCODE_NVE18;
|
symbol->symbology = BARCODE_NVE18;
|
||||||
}
|
}
|
||||||
if (symbol->symbology == 54) {
|
if (symbol->symbology == 54) {
|
||||||
strcpy(symbol->errtxt, "General Parcel Code not supported, using Code 128");
|
strcpy(symbol->errtxt, "General Parcel Code not supported, using Code 128 (B10)");
|
||||||
symbol->symbology = BARCODE_CODE128;
|
symbol->symbology = BARCODE_CODE128;
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
@ -903,7 +901,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
symbol->symbology = BARCODE_AUSPOST;
|
symbol->symbology = BARCODE_AUSPOST;
|
||||||
}
|
}
|
||||||
if (symbol->symbology == 73) {
|
if (symbol->symbology == 73) {
|
||||||
strcpy(symbol->errtxt, "Symbology out of range, using Code 128");
|
strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B11)");
|
||||||
symbol->symbology = BARCODE_CODE128;
|
symbol->symbology = BARCODE_CODE128;
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
@ -917,12 +915,12 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
symbol->symbology = BARCODE_EAN128;
|
symbol->symbology = BARCODE_EAN128;
|
||||||
}
|
}
|
||||||
if (symbol->symbology == 91) {
|
if (symbol->symbology == 91) {
|
||||||
strcpy(symbol->errtxt, "Symbology out of range, using Code 128");
|
strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B12)");
|
||||||
symbol->symbology = BARCODE_CODE128;
|
symbol->symbology = BARCODE_CODE128;
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
if ((symbol->symbology >= 94) && (symbol->symbology <= 96)) {
|
if ((symbol->symbology >= 94) && (symbol->symbology <= 96)) {
|
||||||
strcpy(symbol->errtxt, "Symbology out of range, using Code 128");
|
strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B13)");
|
||||||
symbol->symbology = BARCODE_CODE128;
|
symbol->symbology = BARCODE_CODE128;
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
@ -948,7 +946,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
symbol->symbology = BARCODE_HIBC_BLOCKF;
|
symbol->symbology = BARCODE_HIBC_BLOCKF;
|
||||||
}
|
}
|
||||||
if ((symbol->symbology == 113) || (symbol->symbology == 114)) {
|
if ((symbol->symbology == 113) || (symbol->symbology == 114)) {
|
||||||
strcpy(symbol->errtxt, "Symbology out of range, using Code 128");
|
strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B14)");
|
||||||
symbol->symbology = BARCODE_CODE128;
|
symbol->symbology = BARCODE_CODE128;
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
@ -956,13 +954,13 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
symbol->symbology = BARCODE_DOTCODE;
|
symbol->symbology = BARCODE_DOTCODE;
|
||||||
}
|
}
|
||||||
if ((symbol->symbology >= 117) && (symbol->symbology <= 127)) {
|
if ((symbol->symbology >= 117) && (symbol->symbology <= 127)) {
|
||||||
strcpy(symbol->errtxt, "Symbology out of range, using Code 128");
|
strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B15)");
|
||||||
symbol->symbology = BARCODE_CODE128;
|
symbol->symbology = BARCODE_CODE128;
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
/* Everything from 128 up is Zint-specific */
|
/* Everything from 128 up is Zint-specific */
|
||||||
if (symbol->symbology >= 143) {
|
if (symbol->symbology >= 143) {
|
||||||
strcpy(symbol->errtxt, "Symbology out of range, using Code 128");
|
strcpy(symbol->errtxt, "Symbology out of range, using Code 128 (B16)");
|
||||||
symbol->symbology = BARCODE_CODE128;
|
symbol->symbology = BARCODE_CODE128;
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
@ -975,12 +973,12 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((!(supports_eci(symbol->symbology))) && (symbol->eci != 3)) {
|
if ((!(supports_eci(symbol->symbology))) && (symbol->eci != 3)) {
|
||||||
strcpy(symbol->errtxt, "Symbology does not support ECI switching");
|
strcpy(symbol->errtxt, "Symbology does not support ECI switching (B17)");
|
||||||
error_number = ZINT_ERROR_INVALID_OPTION;
|
error_number = ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((symbol->eci < 3) || (symbol->eci > 26) || (symbol->eci == 14) || (symbol->eci == 19) || (symbol->eci == 25)) {
|
if ((symbol->eci < 3) || (symbol->eci > 26) || (symbol->eci == 14) || (symbol->eci == 19) || (symbol->eci == 25)) {
|
||||||
strcpy(symbol->errtxt, "Invalid or unsupported ECI mode");
|
strcpy(symbol->errtxt, "Invalid or unsupported ECI mode (B18)");
|
||||||
error_number = ZINT_ERROR_INVALID_OPTION;
|
error_number = ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -991,7 +989,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
if (symbol->input_mode == GS1_MODE) {
|
if (symbol->input_mode == GS1_MODE) {
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
if (source[i] == '\0') {
|
if (source[i] == '\0') {
|
||||||
strcpy(symbol->errtxt, "NULL characters not permitted in GS1 mode");
|
strcpy(symbol->errtxt, "NULL characters not permitted in GS1 mode (B19)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1002,7 +1000,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
}
|
}
|
||||||
length = ustrlen(local_source);
|
length = ustrlen(local_source);
|
||||||
} else {
|
} else {
|
||||||
strcpy(symbol->errtxt, "Selected symbology does not support GS1 mode");
|
strcpy(symbol->errtxt, "Selected symbology does not support GS1 mode (B20)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1011,7 +1009,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((symbol->dot_size < 0.01) || (symbol->dot_size > 20.0)) {
|
if ((symbol->dot_size < 0.01) || (symbol->dot_size > 20.0)) {
|
||||||
strcpy(symbol->errtxt, "Invalid dot size");
|
strcpy(symbol->errtxt, "Invalid dot size (B21)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1033,7 +1031,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
symbol->eci = get_best_eci(local_source, length);
|
symbol->eci = get_best_eci(local_source, length);
|
||||||
|
|
||||||
error_number = ZINT_WARN_USES_ECI;
|
error_number = ZINT_WARN_USES_ECI;
|
||||||
strcpy(symbol->errtxt, "Encoded data includes ECI codes");
|
strcpy(symbol->errtxt, "Encoded data includes ECI codes (B22)");
|
||||||
//printf("Data will encode with ECI %d\n", symbol->eci);
|
//printf("Data will encode with ECI %d\n", symbol->eci);
|
||||||
|
|
||||||
switch (symbol->symbology) {
|
switch (symbol->symbology) {
|
||||||
@ -1085,13 +1083,13 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) {
|
|||||||
case 270:
|
case 270:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strcpy(symbol->errtxt, "Invalid rotation angle");
|
strcpy(symbol->errtxt, "Invalid rotation angle (B23)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (symbol->output_options & BARCODE_DOTTY_MODE) {
|
if (symbol->output_options & BARCODE_DOTTY_MODE) {
|
||||||
if (!(is_matrix(symbol->symbology))) {
|
if (!(is_matrix(symbol->symbology))) {
|
||||||
strcpy(symbol->errtxt, "Selected symbology cannot be rendered as dots");
|
strcpy(symbol->errtxt, "Selected symbology cannot be rendered as dots (B24)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1136,19 +1134,19 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) {
|
|||||||
if (!(strcmp(output, "SVG"))) {
|
if (!(strcmp(output, "SVG"))) {
|
||||||
error_number = svg_plot(symbol);
|
error_number = svg_plot(symbol);
|
||||||
} else {
|
} else {
|
||||||
strcpy(symbol->errtxt, "Unknown output format");
|
strcpy(symbol->errtxt, "Unknown output format (B25)");
|
||||||
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION);
|
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION);
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strcpy(symbol->errtxt, "Unknown output format");
|
strcpy(symbol->errtxt, "Unknown output format (B26)");
|
||||||
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION);
|
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION);
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error_number == ZINT_ERROR_INVALID_OPTION) {
|
if (error_number == ZINT_ERROR_INVALID_OPTION) {
|
||||||
/* If libpng is not installed */
|
/* If libpng is not installed */
|
||||||
strcpy(symbol->errtxt, "Unknown output format");
|
strcpy(symbol->errtxt, "Unknown output format (B27)");
|
||||||
}
|
}
|
||||||
|
|
||||||
error_tag(symbol->errtxt, error_number);
|
error_tag(symbol->errtxt, error_number);
|
||||||
@ -1165,7 +1163,7 @@ int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle) {
|
|||||||
case 270:
|
case 270:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strcpy(symbol->errtxt, "Invalid rotation angle");
|
strcpy(symbol->errtxt, "Invalid rotation angle (B28)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1215,7 +1213,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename) {
|
|||||||
} else {
|
} else {
|
||||||
file = fopen(filename, "rb");
|
file = fopen(filename, "rb");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
strcpy(symbol->errtxt, "Unable to read input file");
|
strcpy(symbol->errtxt, "Unable to read input file (B29)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1226,7 +1224,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename) {
|
|||||||
|
|
||||||
if (fileLen > 7100) {
|
if (fileLen > 7100) {
|
||||||
/* The largest amount of data that can be encoded is 7089 numeric digits in QR Code */
|
/* The largest amount of data that can be encoded is 7089 numeric digits in QR Code */
|
||||||
strcpy(symbol->errtxt, "Input file too long");
|
strcpy(symbol->errtxt, "Input file too long (B30)");
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
@ -1235,7 +1233,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename) {
|
|||||||
/* Allocate memory */
|
/* Allocate memory */
|
||||||
buffer = (unsigned char *) malloc(fileLen * sizeof (unsigned char));
|
buffer = (unsigned char *) malloc(fileLen * sizeof (unsigned char));
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
strcpy(symbol->errtxt, "Internal memory error");
|
strcpy(symbol->errtxt, "Internal memory error (B31)");
|
||||||
if (strcmp(filename, "-"))
|
if (strcmp(filename, "-"))
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return ZINT_ERROR_MEMORY;
|
return ZINT_ERROR_MEMORY;
|
||||||
|
@ -585,7 +585,7 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], int lengt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((mode < 2) || (mode > 6)) { /* Only codes 2 to 6 supported */
|
if ((mode < 2) || (mode > 6)) { /* Only codes 2 to 6 supported */
|
||||||
strcpy(symbol->errtxt, "Invalid Maxicode Mode");
|
strcpy(symbol->errtxt, "Invalid Maxicode Mode (E50)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,13 +594,13 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], int lengt
|
|||||||
lp = strlen(symbol->primary);
|
lp = strlen(symbol->primary);
|
||||||
}
|
}
|
||||||
if (lp != 15) {
|
if (lp != 15) {
|
||||||
strcpy(symbol->errtxt, "Invalid Primary String");
|
strcpy(symbol->errtxt, "Invalid Primary String (E51)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 9; i < 15; i++) { /* check that country code and service are numeric */
|
for (i = 9; i < 15; i++) { /* check that country code and service are numeric */
|
||||||
if ((symbol->primary[i] < '0') || (symbol->primary[i] > '9')) {
|
if ((symbol->primary[i] < '0') || (symbol->primary[i] > '9')) {
|
||||||
strcpy(symbol->errtxt, "Invalid Primary String");
|
strcpy(symbol->errtxt, "Invalid Primary String (E52)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -643,7 +643,7 @@ int maxicode(struct zint_symbol *symbol, unsigned char local_source[], int lengt
|
|||||||
|
|
||||||
i = maxi_text_process(mode, local_source, length, symbol->eci);
|
i = maxi_text_process(mode, local_source, length, symbol->eci);
|
||||||
if (i == ZINT_ERROR_TOO_LONG) {
|
if (i == ZINT_ERROR_TOO_LONG) {
|
||||||
strcpy(symbol->errtxt, "Input data too long");
|
strcpy(symbol->errtxt, "Input data too long (E53)");
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,19 +67,19 @@ int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 6) {
|
if (length > 6) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C50)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C51)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
tester = atoi((char*) source);
|
tester = atoi((char*) source);
|
||||||
|
|
||||||
if ((tester < 3) || (tester > 131070)) {
|
if ((tester < 3) || (tester > 131070)) {
|
||||||
strcpy(symbol->errtxt, "Data out of range");
|
strcpy(symbol->errtxt, "Data out of range (C52)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ int pharma_two_calc(struct zint_symbol *symbol, unsigned char source[], char des
|
|||||||
tester = atoi((char*) source);
|
tester = atoi((char*) source);
|
||||||
|
|
||||||
if ((tester < 4) || (tester > 64570080)) {
|
if ((tester < 4) || (tester > 64570080)) {
|
||||||
strcpy(symbol->errtxt, "Data out of range");
|
strcpy(symbol->errtxt, "Data out of range (C53)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
error_number = 0;
|
error_number = 0;
|
||||||
@ -162,12 +162,12 @@ int pharma_two(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
strcpy(height_pattern, "");
|
strcpy(height_pattern, "");
|
||||||
|
|
||||||
if (length > 8) {
|
if (length > 8) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C54)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C55)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
error_number = pharma_two_calc(symbol, source, height_pattern);
|
error_number = pharma_two_calc(symbol, source, height_pattern);
|
||||||
@ -203,25 +203,25 @@ int codabar(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
strcpy(dest, "");
|
strcpy(dest, "");
|
||||||
|
|
||||||
if (length > 60) { /* No stack smashing please */
|
if (length > 60) { /* No stack smashing please */
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C56)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
to_upper(source);
|
to_upper(source);
|
||||||
error_number = is_sane(CALCIUM, source, length);
|
error_number = is_sane(CALCIUM, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C57)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
/* Codabar must begin and end with the characters A, B, C or D */
|
/* Codabar must begin and end with the characters A, B, C or D */
|
||||||
if ((source[0] != 'A') && (source[0] != 'B') && (source[0] != 'C')
|
if ((source[0] != 'A') && (source[0] != 'B') && (source[0] != 'C')
|
||||||
&& (source[0] != 'D')) {
|
&& (source[0] != 'D')) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C58)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((source[length - 1] != 'A') && (source[length - 1] != 'B') &&
|
if ((source[length - 1] != 'A') && (source[length - 1] != 'B') &&
|
||||||
(source[length - 1] != 'C') && (source[length - 1] != 'D')) {
|
(source[length - 1] != 'C') && (source[length - 1] != 'D')) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C59)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,12 +244,12 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
/* Validate the input */
|
/* Validate the input */
|
||||||
if (length > 8) {
|
if (length > 8) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C5A)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C5B)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ int pcx_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
pcx_file = stdout;
|
pcx_file = stdout;
|
||||||
} else {
|
} else {
|
||||||
if (!(pcx_file = fopen(symbol->outfile, "wb"))) {
|
if (!(pcx_file = fopen(symbol->outfile, "wb"))) {
|
||||||
strcpy(symbol->errtxt, "Can't open output file");
|
strcpy(symbol->errtxt, "Can't open output file (F20)");
|
||||||
return ZINT_ERROR_FILE_ACCESS;
|
return ZINT_ERROR_FILE_ACCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -833,12 +833,12 @@ int pdf417enc(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if ((symbol->option_1 < -1) || (symbol->option_1 > 8)) {
|
if ((symbol->option_1 < -1) || (symbol->option_1 > 8)) {
|
||||||
strcpy(symbol->errtxt, "Security value out of range");
|
strcpy(symbol->errtxt, "Security value out of range (D60)");
|
||||||
symbol->option_1 = -1;
|
symbol->option_1 = -1;
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
if ((symbol->option_2 < 0) || (symbol->option_2 > 30)) {
|
if ((symbol->option_2 < 0) || (symbol->option_2 > 30)) {
|
||||||
strcpy(symbol->errtxt, "Number of columns out of range");
|
strcpy(symbol->errtxt, "Number of columns out of range (D61)");
|
||||||
symbol->option_2 = 0;
|
symbol->option_2 = 0;
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
@ -850,23 +850,23 @@ int pdf417enc(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
if (codeerr != 0) {
|
if (codeerr != 0) {
|
||||||
switch (codeerr) {
|
switch (codeerr) {
|
||||||
case 1:
|
case 1:
|
||||||
strcpy(symbol->errtxt, "No such file or file unreadable");
|
strcpy(symbol->errtxt, "No such file or file unreadable (D62)");
|
||||||
error_number = ZINT_ERROR_INVALID_OPTION;
|
error_number = ZINT_ERROR_INVALID_OPTION;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
strcpy(symbol->errtxt, "Input string too long");
|
strcpy(symbol->errtxt, "Input string too long (D63)");
|
||||||
error_number = ZINT_ERROR_TOO_LONG;
|
error_number = ZINT_ERROR_TOO_LONG;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
strcpy(symbol->errtxt, "Number of codewords per row too small");
|
strcpy(symbol->errtxt, "Number of codewords per row too small (D64)");
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
strcpy(symbol->errtxt, "Data too long for specified number of columns");
|
strcpy(symbol->errtxt, "Data too long for specified number of columns (D65)");
|
||||||
error_number = ZINT_ERROR_TOO_LONG;
|
error_number = ZINT_ERROR_TOO_LONG;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strcpy(symbol->errtxt, "Something strange happened");
|
strcpy(symbol->errtxt, "Something strange happened (D66)");
|
||||||
error_number = ZINT_ERROR_ENCODING_PROBLEM;
|
error_number = ZINT_ERROR_ENCODING_PROBLEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -963,11 +963,11 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length)
|
|||||||
/* This is where it all changes! */
|
/* This is where it all changes! */
|
||||||
|
|
||||||
if (mclength > 126) {
|
if (mclength > 126) {
|
||||||
strcpy(symbol->errtxt, "Input data too long");
|
strcpy(symbol->errtxt, "Input data too long (D67)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
if (symbol->option_2 > 4) {
|
if (symbol->option_2 > 4) {
|
||||||
strcpy(symbol->errtxt, "Specified width out of range");
|
strcpy(symbol->errtxt, "Specified width out of range (D68)");
|
||||||
symbol->option_2 = 0;
|
symbol->option_2 = 0;
|
||||||
codeerr = ZINT_WARN_INVALID_OPTION;
|
codeerr = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
@ -987,21 +987,21 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length)
|
|||||||
if ((symbol->option_2 == 1) && (mclength > 20)) {
|
if ((symbol->option_2 == 1) && (mclength > 20)) {
|
||||||
/* the user specified 1 column but the data doesn't fit - go to automatic */
|
/* the user specified 1 column but the data doesn't fit - go to automatic */
|
||||||
symbol->option_2 = 0;
|
symbol->option_2 = 0;
|
||||||
strcpy(symbol->errtxt, "Specified symbol size too small for data");
|
strcpy(symbol->errtxt, "Specified symbol size too small for data (D69)");
|
||||||
codeerr = ZINT_WARN_INVALID_OPTION;
|
codeerr = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((symbol->option_2 == 2) && (mclength > 37)) {
|
if ((symbol->option_2 == 2) && (mclength > 37)) {
|
||||||
/* the user specified 2 columns but the data doesn't fit - go to automatic */
|
/* the user specified 2 columns but the data doesn't fit - go to automatic */
|
||||||
symbol->option_2 = 0;
|
symbol->option_2 = 0;
|
||||||
strcpy(symbol->errtxt, "Specified symbol size too small for data");
|
strcpy(symbol->errtxt, "Specified symbol size too small for data (D6A)");
|
||||||
codeerr = ZINT_WARN_INVALID_OPTION;
|
codeerr = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((symbol->option_2 == 3) && (mclength > 82)) {
|
if ((symbol->option_2 == 3) && (mclength > 82)) {
|
||||||
/* the user specified 3 columns but the data doesn't fit - go to automatic */
|
/* the user specified 3 columns but the data doesn't fit - go to automatic */
|
||||||
symbol->option_2 = 0;
|
symbol->option_2 = 0;
|
||||||
strcpy(symbol->errtxt, "Specified symbol size too small for data");
|
strcpy(symbol->errtxt, "Specified symbol size too small for data (D6B)");
|
||||||
codeerr = ZINT_WARN_INVALID_OPTION;
|
codeerr = ZINT_WARN_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,12 +60,12 @@ int plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 65) {
|
if (length > 65) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C70)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(SSET, source, length);
|
error_number = is_sane(SSET, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C71)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
checkptr = (unsigned char *) calloc(1, length * 4 + 8);
|
checkptr = (unsigned char *) calloc(1, length * 4 + 8);
|
||||||
@ -118,7 +118,7 @@ int msi_plessey(struct zint_symbol *symbol, unsigned char source[], int length)
|
|||||||
char dest[512]; /* 2 + 55 * 8 + 3 + 1 ~ 512 */
|
char dest[512]; /* 2 + 55 * 8 + 3 + 1 ~ 512 */
|
||||||
|
|
||||||
if (length > 55) {
|
if (length > 55) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C72)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ int msi_plessey_mod10(struct zint_symbol *symbol, unsigned char source[], int le
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 18) {
|
if (length > 18) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C73)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ int msi_plessey_mod1010(struct zint_symbol *symbol, unsigned char source[], cons
|
|||||||
|
|
||||||
if (src_len > 18) {
|
if (src_len > 18) {
|
||||||
/* No Entry Stack Smashers! limit because of str->number conversion*/
|
/* No Entry Stack Smashers! limit because of str->number conversion*/
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C74)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ int msi_plessey_mod11(struct zint_symbol *symbol, unsigned char source[], const
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (src_len > 55) {
|
if (src_len > 55) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C75)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,7 +381,7 @@ int msi_plessey_mod1110(struct zint_symbol *symbol, unsigned char source[], cons
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (src_len > 18) {
|
if (src_len > 18) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C76)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,7 +467,7 @@ int msi_handle(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number != 0) {
|
if (error_number != 0) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
strcpy(symbol->errtxt, "Invalid characters in input data (C77)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,14 +56,14 @@ struct mainprog_info_type {
|
|||||||
static void writepng_error_handler(png_structp png_ptr, png_const_charp msg) {
|
static void writepng_error_handler(png_structp png_ptr, png_const_charp msg) {
|
||||||
struct mainprog_info_type *graphic;
|
struct mainprog_info_type *graphic;
|
||||||
|
|
||||||
fprintf(stderr, "writepng libpng error: %s\n", msg);
|
fprintf(stderr, "writepng libpng error: %s (F30)\n", msg);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
graphic = (struct mainprog_info_type*) png_get_error_ptr(png_ptr);
|
graphic = (struct mainprog_info_type*) png_get_error_ptr(png_ptr);
|
||||||
if (graphic == NULL) {
|
if (graphic == NULL) {
|
||||||
/* we are completely hosed now */
|
/* we are completely hosed now */
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"writepng severe error: jmpbuf not recoverable; terminating.\n");
|
"writepng severe error: jmpbuf not recoverable; terminating. (F31)\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
graphic->outfile = stdout;
|
graphic->outfile = stdout;
|
||||||
} else {
|
} else {
|
||||||
if (!(graphic->outfile = fopen(symbol->outfile, "wb"))) {
|
if (!(graphic->outfile = fopen(symbol->outfile, "wb"))) {
|
||||||
strcpy(symbol->errtxt, "Can't open output file");
|
strcpy(symbol->errtxt, "Can't open output file (F32)");
|
||||||
return ZINT_ERROR_FILE_ACCESS;
|
return ZINT_ERROR_FILE_ACCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,21 +116,21 @@ int png_pixel_plot(struct zint_symbol *symbol, char *pixelbuf) {
|
|||||||
/* Set up error handling routine as proc() above */
|
/* Set up error handling routine as proc() above */
|
||||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, graphic, writepng_error_handler, NULL);
|
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, graphic, writepng_error_handler, NULL);
|
||||||
if (!png_ptr) {
|
if (!png_ptr) {
|
||||||
strcpy(symbol->errtxt, "Out of memory");
|
strcpy(symbol->errtxt, "Out of memory (F33)");
|
||||||
return ZINT_ERROR_MEMORY;
|
return ZINT_ERROR_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
info_ptr = png_create_info_struct(png_ptr);
|
info_ptr = png_create_info_struct(png_ptr);
|
||||||
if (!info_ptr) {
|
if (!info_ptr) {
|
||||||
png_destroy_write_struct(&png_ptr, NULL);
|
png_destroy_write_struct(&png_ptr, NULL);
|
||||||
strcpy(symbol->errtxt, "Out of memory");
|
strcpy(symbol->errtxt, "Out of memory (F34)");
|
||||||
return ZINT_ERROR_MEMORY;
|
return ZINT_ERROR_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* catch jumping here */
|
/* catch jumping here */
|
||||||
if (setjmp(graphic->jmpbuf)) {
|
if (setjmp(graphic->jmpbuf)) {
|
||||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||||
strcpy(symbol->errtxt, "libpng error occurred");
|
strcpy(symbol->errtxt, "libpng error occurred (F35)");
|
||||||
return ZINT_ERROR_MEMORY;
|
return ZINT_ERROR_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,12 +92,12 @@ int postnet(struct zint_symbol *symbol, unsigned char source[], char dest[], int
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 38) {
|
if (length > 38) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D80)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (D81)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
sum = 0;
|
sum = 0;
|
||||||
@ -158,12 +158,12 @@ int planet(struct zint_symbol *symbol, unsigned char source[], char dest[], int
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 38) {
|
if (length > 38) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D82)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (D83)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
sum = 0;
|
sum = 0;
|
||||||
@ -222,12 +222,12 @@ int korea_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
error_number = 0;
|
error_number = 0;
|
||||||
if (length > 6) {
|
if (length > 6) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D84)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (D85)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
zeroes = 6 - length;
|
zeroes = 6 - length;
|
||||||
@ -262,7 +262,7 @@ int fim(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
char dest[16] = {0};
|
char dest[16] = {0};
|
||||||
|
|
||||||
if (length > 1) {
|
if (length > 1) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D86)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ int fim(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
strcpy(dest, "1111131311111");
|
strcpy(dest, "1111131311111");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (D87)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -341,13 +341,13 @@ int royal_plot(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 50) {
|
if (length > 50) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D88)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
to_upper(source);
|
to_upper(source);
|
||||||
error_number = is_sane(KRSET, source, length);
|
error_number = is_sane(KRSET, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (D89)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
/*check = */rm4scc((char*) source, (unsigned char*) height_pattern, length);
|
/*check = */rm4scc((char*) source, (unsigned char*) height_pattern, length);
|
||||||
@ -387,13 +387,13 @@ int kix_code(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 18) {
|
if (length > 18) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D8A)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
to_upper(source);
|
to_upper(source);
|
||||||
error_number = is_sane(KRSET, source, length);
|
error_number = is_sane(KRSET, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (D8B)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,14 +435,14 @@ int daft_code(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
error_number = 0;
|
error_number = 0;
|
||||||
if (length > 50) {
|
if (length > 50) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D8C)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
to_upper((unsigned char*) source);
|
to_upper((unsigned char*) source);
|
||||||
error_number = is_sane(DAFTSET, (unsigned char*) source, length);
|
error_number = is_sane(DAFTSET, (unsigned char*) source, length);
|
||||||
|
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (D8D)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,12 +491,12 @@ int flattermarken(struct zint_symbol *symbol, unsigned char source[], int length
|
|||||||
error_number = 0;
|
error_number = 0;
|
||||||
|
|
||||||
if (length > 90) {
|
if (length > 90) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D8E)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, length);
|
error_number = is_sane(NEON, source, length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (D8F)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
*dest = '\0';
|
*dest = '\0';
|
||||||
@ -523,7 +523,7 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (length > 20) {
|
if (length > 20) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (D8G)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +538,7 @@ int japan_post(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
error_number = is_sane(SHKASUTSET, (unsigned char*) local_source, length);
|
error_number = is_sane(SHKASUTSET, (unsigned char*) local_source, length);
|
||||||
|
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (D8H)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
memset(inter, 'd', 20); /* Pad character CC4 */
|
memset(inter, 'd', 20); /* Pad character CC4 */
|
||||||
|
10
backend/ps.c
10
backend/ps.c
@ -105,7 +105,7 @@ int ps_plot(struct zint_symbol *symbol) {
|
|||||||
feps = fopen(symbol->outfile, "w");
|
feps = fopen(symbol->outfile, "w");
|
||||||
}
|
}
|
||||||
if (feps == NULL) {
|
if (feps == NULL) {
|
||||||
strcpy(symbol->errtxt, "Could not open output file");
|
strcpy(symbol->errtxt, "Could not open output file (F40)");
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
free(local_text);
|
free(local_text);
|
||||||
#endif
|
#endif
|
||||||
@ -117,7 +117,7 @@ int ps_plot(struct zint_symbol *symbol) {
|
|||||||
to_upper((unsigned char*) symbol->bgcolour);
|
to_upper((unsigned char*) symbol->bgcolour);
|
||||||
|
|
||||||
if (strlen(symbol->fgcolour) != 6) {
|
if (strlen(symbol->fgcolour) != 6) {
|
||||||
strcpy(symbol->errtxt, "Malformed foreground colour target");
|
strcpy(symbol->errtxt, "Malformed foreground colour target (F41)");
|
||||||
fclose(feps);
|
fclose(feps);
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
free(local_text);
|
free(local_text);
|
||||||
@ -125,7 +125,7 @@ int ps_plot(struct zint_symbol *symbol) {
|
|||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
if (strlen(symbol->bgcolour) != 6) {
|
if (strlen(symbol->bgcolour) != 6) {
|
||||||
strcpy(symbol->errtxt, "Malformed background colour target");
|
strcpy(symbol->errtxt, "Malformed background colour target (F42)");
|
||||||
fclose(feps);
|
fclose(feps);
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
free(local_text);
|
free(local_text);
|
||||||
@ -134,7 +134,7 @@ int ps_plot(struct zint_symbol *symbol) {
|
|||||||
}
|
}
|
||||||
error_number = is_sane(SSET, (unsigned char*) symbol->fgcolour, strlen(symbol->fgcolour));
|
error_number = is_sane(SSET, (unsigned char*) symbol->fgcolour, strlen(symbol->fgcolour));
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Malformed foreground colour target");
|
strcpy(symbol->errtxt, "Malformed foreground colour target (F43)");
|
||||||
fclose(feps);
|
fclose(feps);
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
free(local_text);
|
free(local_text);
|
||||||
@ -143,7 +143,7 @@ int ps_plot(struct zint_symbol *symbol) {
|
|||||||
}
|
}
|
||||||
error_number = is_sane(SSET, (unsigned char*) symbol->bgcolour, strlen(symbol->bgcolour));
|
error_number = is_sane(SSET, (unsigned char*) symbol->bgcolour, strlen(symbol->bgcolour));
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Malformed background colour target");
|
strcpy(symbol->errtxt, "Malformed background colour target (F44)");
|
||||||
fclose(feps);
|
fclose(feps);
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
free(local_text);
|
free(local_text);
|
||||||
|
18
backend/qr.c
18
backend/qr.c
@ -1513,7 +1513,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||||||
j++;
|
j++;
|
||||||
} while ((j < 6843) && (glyph == 0));
|
} while ((j < 6843) && (glyph == 0));
|
||||||
if (glyph == 0) {
|
if (glyph == 0) {
|
||||||
strcpy(symbol->errtxt, "Invalid character in input data");
|
strcpy(symbol->errtxt, "Invalid character in input data (E60)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
jisdata[i] = glyph;
|
jisdata[i] = glyph;
|
||||||
@ -1544,7 +1544,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (est_binlen > (8 * max_cw)) {
|
if (est_binlen > (8 * max_cw)) {
|
||||||
strcpy(symbol->errtxt, "Input too long for selected error correction level");
|
strcpy(symbol->errtxt, "Input too long for selected error correction level (E61)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2649,7 +2649,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (length > 35) {
|
if (length > 35) {
|
||||||
strcpy(symbol->errtxt, "Input data too long");
|
strcpy(symbol->errtxt, "Input data too long (E62)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2681,7 +2681,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||||||
j++;
|
j++;
|
||||||
} while ((j < 6843) && (glyph == 0));
|
} while ((j < 6843) && (glyph == 0));
|
||||||
if (glyph == 0) {
|
if (glyph == 0) {
|
||||||
strcpy(symbol->errtxt, "Invalid character in input data");
|
strcpy(symbol->errtxt, "Invalid character in input data (E63)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
jisdata[i] = glyph;
|
jisdata[i] = glyph;
|
||||||
@ -2718,7 +2718,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||||||
|
|
||||||
error_number = micro_qr_intermediate(binary_stream, jisdata, mode, length, &kanji_used, &alphanum_used, &byte_used);
|
error_number = micro_qr_intermediate(binary_stream, jisdata, mode, length, &kanji_used, &alphanum_used, &byte_used);
|
||||||
if (error_number != 0) {
|
if (error_number != 0) {
|
||||||
strcpy(symbol->errtxt, "Input data too long");
|
strcpy(symbol->errtxt, "Input data too long (E64)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2750,7 +2750,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||||||
version_valid[2] = 0;
|
version_valid[2] = 0;
|
||||||
}
|
}
|
||||||
if (binary_count[3] > 128) {
|
if (binary_count[3] > 128) {
|
||||||
strcpy(symbol->errtxt, "Input data too long");
|
strcpy(symbol->errtxt, "Input data too long (E65)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2761,7 +2761,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ecc_level == LEVEL_H) {
|
if (ecc_level == LEVEL_H) {
|
||||||
strcpy(symbol->errtxt, "Error correction level H not available");
|
strcpy(symbol->errtxt, "Error correction level H not available (E66)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2770,7 +2770,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||||||
version_valid[1] = 0;
|
version_valid[1] = 0;
|
||||||
version_valid[2] = 0;
|
version_valid[2] = 0;
|
||||||
if (binary_count[3] > 80) {
|
if (binary_count[3] > 80) {
|
||||||
strcpy(symbol->errtxt, "Input data too long");
|
strcpy(symbol->errtxt, "Input data too long (E67)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2784,7 +2784,7 @@ int microqr(struct zint_symbol *symbol, const unsigned char source[], int length
|
|||||||
version_valid[2] = 0;
|
version_valid[2] = 0;
|
||||||
}
|
}
|
||||||
if (binary_count[3] > 112) {
|
if (binary_count[3] > 112) {
|
||||||
strcpy(symbol->errtxt, "Input data too long");
|
strcpy(symbol->errtxt, "Input data too long (E68)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int
|
|||||||
char *rotated_pixbuf;
|
char *rotated_pixbuf;
|
||||||
|
|
||||||
if (!(rotated_pixbuf = (char *) malloc(image_width * image_height))) {
|
if (!(rotated_pixbuf = (char *) malloc(image_width * image_height))) {
|
||||||
printf("Insufficient memory for pixel buffer");
|
printf("Insufficient memory for pixel buffer (F50)");
|
||||||
return ZINT_ERROR_ENCODING_PROBLEM;
|
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,21 +117,21 @@ int save_raster_image_to_file(struct zint_symbol *symbol, int image_height, int
|
|||||||
to_upper((unsigned char*) symbol->bgcolour);
|
to_upper((unsigned char*) symbol->bgcolour);
|
||||||
|
|
||||||
if (strlen(symbol->fgcolour) != 6) {
|
if (strlen(symbol->fgcolour) != 6) {
|
||||||
strcpy(symbol->errtxt, "Malformed foreground colour target");
|
strcpy(symbol->errtxt, "Malformed foreground colour target (F51)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
if (strlen(symbol->bgcolour) != 6) {
|
if (strlen(symbol->bgcolour) != 6) {
|
||||||
strcpy(symbol->errtxt, "Malformed background colour target");
|
strcpy(symbol->errtxt, "Malformed background colour target (F52)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
error_number = is_sane(SSET, (unsigned char*) symbol->fgcolour, strlen(symbol->fgcolour));
|
error_number = is_sane(SSET, (unsigned char*) symbol->fgcolour, strlen(symbol->fgcolour));
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Malformed foreground colour target");
|
strcpy(symbol->errtxt, "Malformed foreground colour target (F53)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
error_number = is_sane(SSET, (unsigned char*) symbol->bgcolour, strlen(symbol->fgcolour));
|
error_number = is_sane(SSET, (unsigned char*) symbol->bgcolour, strlen(symbol->fgcolour));
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Malformed background colour target");
|
strcpy(symbol->errtxt, "Malformed background colour target (F54)");
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_
|
|||||||
image_height = (300 + (2 * yoffset * 2)) * scaler;
|
image_height = (300 + (2 * yoffset * 2)) * scaler;
|
||||||
|
|
||||||
if (!(pixelbuf = (char *) malloc(image_width * image_height))) {
|
if (!(pixelbuf = (char *) malloc(image_width * image_height))) {
|
||||||
printf("Insufficient memory for pixel buffer");
|
printf("Insufficient memory for pixel buffer (F55)");
|
||||||
return ZINT_ERROR_ENCODING_PROBLEM;
|
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < (image_width * image_height); i++) {
|
for (i = 0; i < (image_width * image_height); i++) {
|
||||||
@ -497,7 +497,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_
|
|||||||
hexagon_size = (int)scaler * 10;
|
hexagon_size = (int)scaler * 10;
|
||||||
|
|
||||||
if (!(scaled_hexagon = (char *) malloc(hexagon_size * hexagon_size))) {
|
if (!(scaled_hexagon = (char *) malloc(hexagon_size * hexagon_size))) {
|
||||||
printf("Insufficient memory for pixel buffer");
|
printf("Insufficient memory for pixel buffer (F56)");
|
||||||
free(scaled_hexagon);
|
free(scaled_hexagon);
|
||||||
return ZINT_ERROR_ENCODING_PROBLEM;
|
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||||
} else {
|
} else {
|
||||||
@ -607,7 +607,7 @@ int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int data_typ
|
|||||||
|
|
||||||
/* Apply scale options by creating another pixel buffer */
|
/* Apply scale options by creating another pixel buffer */
|
||||||
if (!(scaled_pixelbuf = (char *) malloc(scale_width * scale_height))) {
|
if (!(scaled_pixelbuf = (char *) malloc(scale_width * scale_height))) {
|
||||||
printf("Insufficient memory for pixel buffer");
|
printf("Insufficient memory for pixel buffer (F57)");
|
||||||
return ZINT_ERROR_ENCODING_PROBLEM;
|
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < (scale_width * scale_height); i++) {
|
for (i = 0; i < (scale_width * scale_height); i++) {
|
||||||
@ -782,7 +782,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
|||||||
image_height = 2 * (symbol->height + textoffset + yoffset + yoffset);
|
image_height = 2 * (symbol->height + textoffset + yoffset + yoffset);
|
||||||
|
|
||||||
if (!(pixelbuf = (char *) malloc(image_width * image_height))) {
|
if (!(pixelbuf = (char *) malloc(image_width * image_height))) {
|
||||||
printf("Insufficient memory for pixel buffer");
|
printf("Insufficient memory for pixel buffer (F58)");
|
||||||
return ZINT_ERROR_ENCODING_PROBLEM;
|
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < (image_width * image_height); i++) {
|
for (i = 0; i < (image_width * image_height); i++) {
|
||||||
@ -1085,7 +1085,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
|
|||||||
/* Apply scale options by creating another pixel buffer */
|
/* Apply scale options by creating another pixel buffer */
|
||||||
if (!(scaled_pixelbuf = (char *) malloc(scale_width * scale_height))) {
|
if (!(scaled_pixelbuf = (char *) malloc(scale_width * scale_height))) {
|
||||||
free(pixelbuf);
|
free(pixelbuf);
|
||||||
printf("Insufficient memory for pixel buffer");
|
printf("Insufficient memory for pixel buffer (F59)");
|
||||||
return ZINT_ERROR_ENCODING_PROBLEM;
|
return ZINT_ERROR_ENCODING_PROBLEM;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < (scale_width * scale_height); i++) {
|
for (i = 0; i < (scale_width * scale_height); i++) {
|
||||||
|
@ -170,12 +170,12 @@ int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
separator_row = 0;
|
separator_row = 0;
|
||||||
|
|
||||||
if (src_len > 13) {
|
if (src_len > 13) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C80)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, src_len);
|
error_number = is_sane(NEON, source, src_len);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C81)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -739,17 +739,17 @@ int rsslimited(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
|||||||
separator_row = 0;
|
separator_row = 0;
|
||||||
|
|
||||||
if (src_len > 13) {
|
if (src_len > 13) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C82)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
error_number = is_sane(NEON, source, src_len);
|
error_number = is_sane(NEON, source, src_len);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C83)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
if (src_len == 13) {
|
if (src_len == 13) {
|
||||||
if ((source[0] != '0') && (source[0] != '1')) {
|
if ((source[0] != '0') && (source[0] != '1')) {
|
||||||
strcpy(symbol->errtxt, "Input out of range");
|
strcpy(symbol->errtxt, "Input out of range (C84)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1386,7 +1386,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
if ((source[i] < '0') || (source[i] > '9')) {
|
if ((source[i] < '0') || (source[i] > '9')) {
|
||||||
if ((source[i] != '[') && (source[i] != ']')) {
|
if ((source[i] != '[') && (source[i] != ']')) {
|
||||||
/* Something is wrong */
|
/* Something is wrong */
|
||||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
strcpy(symbol->errtxt, "Invalid characters in input data (C85)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1718,7 +1718,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
|
|||||||
|
|
||||||
if (latch == 1) {
|
if (latch == 1) {
|
||||||
/* Invalid characters in input data */
|
/* Invalid characters in input data */
|
||||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
strcpy(symbol->errtxt, "Invalid characters in input data (C86)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ int svg_plot(struct zint_symbol *symbol) {
|
|||||||
fsvg = fopen(symbol->outfile, "w");
|
fsvg = fopen(symbol->outfile, "w");
|
||||||
}
|
}
|
||||||
if (fsvg == NULL) {
|
if (fsvg == NULL) {
|
||||||
strcpy(symbol->errtxt, "Could not open output file");
|
strcpy(symbol->errtxt, "Could not open output file (F60)");
|
||||||
return ZINT_ERROR_FILE_ACCESS;
|
return ZINT_ERROR_FILE_ACCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,24 +111,24 @@ int svg_plot(struct zint_symbol *symbol) {
|
|||||||
to_upper((unsigned char*) symbol->bgcolour);
|
to_upper((unsigned char*) symbol->bgcolour);
|
||||||
|
|
||||||
if (strlen(symbol->fgcolour) != 6) {
|
if (strlen(symbol->fgcolour) != 6) {
|
||||||
strcpy(symbol->errtxt, "Malformed foreground colour target");
|
strcpy(symbol->errtxt, "Malformed foreground colour target (F61)");
|
||||||
fclose(fsvg);
|
fclose(fsvg);
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
if (strlen(symbol->bgcolour) != 6) {
|
if (strlen(symbol->bgcolour) != 6) {
|
||||||
strcpy(symbol->errtxt, "Malformed background colour target");
|
strcpy(symbol->errtxt, "Malformed background colour target (F62)");
|
||||||
fclose(fsvg);
|
fclose(fsvg);
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
error_number = is_sane(SSET, (unsigned char*) symbol->fgcolour, strlen(symbol->fgcolour));
|
error_number = is_sane(SSET, (unsigned char*) symbol->fgcolour, strlen(symbol->fgcolour));
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Malformed foreground colour target");
|
strcpy(symbol->errtxt, "Malformed foreground colour target (F63)");
|
||||||
fclose(fsvg);
|
fclose(fsvg);
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
error_number = is_sane(SSET, (unsigned char*) symbol->bgcolour, strlen(symbol->bgcolour));
|
error_number = is_sane(SSET, (unsigned char*) symbol->bgcolour, strlen(symbol->bgcolour));
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Malformed background colour target");
|
strcpy(symbol->errtxt, "Malformed background colour target (F64)");
|
||||||
fclose(fsvg);
|
fclose(fsvg);
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ int telepen(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
if (src_len > 30) {
|
if (src_len > 30) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C90)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
/* Start character */
|
/* Start character */
|
||||||
@ -75,7 +75,7 @@ int telepen(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
for (i = 0; i < src_len; i++) {
|
for (i = 0; i < src_len; i++) {
|
||||||
if (source[i] > 126) {
|
if (source[i] > 126) {
|
||||||
/* Cannot encode extended ASCII */
|
/* Cannot encode extended ASCII */
|
||||||
strcpy(symbol->errtxt, "Invalid characters in input data");
|
strcpy(symbol->errtxt, "Invalid characters in input data (C91)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
strcat(dest, TeleTable[source[i]]);
|
strcat(dest, TeleTable[source[i]]);
|
||||||
@ -113,14 +113,14 @@ int telepen_num(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
|||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
if (temp_length > 60) {
|
if (temp_length > 60) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C92)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
ustrcpy(temp, source);
|
ustrcpy(temp, source);
|
||||||
to_upper(temp);
|
to_upper(temp);
|
||||||
error_number = is_sane(NEON, temp, temp_length);
|
error_number = is_sane(NEON, temp, temp_length);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C93)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ int telepen_num(struct zint_symbol *symbol, unsigned char source[], int src_len)
|
|||||||
|
|
||||||
for (i = 0; i < temp_length; i += 2) {
|
for (i = 0; i < temp_length; i += 2) {
|
||||||
if (temp[i] == 'X') {
|
if (temp[i] == 'X') {
|
||||||
strcpy(symbol->errtxt, "Invalid position of X in Telepen data");
|
strcpy(symbol->errtxt, "Invalid position of X in Telepen data (C94)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ int upca(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
|||||||
} else {
|
} else {
|
||||||
gtin[length - 1] = '\0';
|
gtin[length - 1] = '\0';
|
||||||
if (source[length - 1] != upc_check(gtin)) {
|
if (source[length - 1] != upc_check(gtin)) {
|
||||||
strcpy(symbol->errtxt, "Invalid check digit");
|
strcpy(symbol->errtxt, "Invalid check digit (C60)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
gtin[length - 1] = upc_check(gtin);
|
gtin[length - 1] = upc_check(gtin);
|
||||||
@ -229,7 +229,7 @@ int upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
|||||||
equivalent[10] = source[4];
|
equivalent[10] = source[4];
|
||||||
if (((source[2] == '0') || (source[2] == '1')) || (source[2] == '2')) {
|
if (((source[2] == '0') || (source[2] == '1')) || (source[2] == '2')) {
|
||||||
/* Note 1 - "X3 shall not be equal to 0, 1 or 2" */
|
/* Note 1 - "X3 shall not be equal to 0, 1 or 2" */
|
||||||
strcpy(symbol->errtxt, "Invalid UPC-E data");
|
strcpy(symbol->errtxt, "Invalid UPC-E data (C61)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -239,7 +239,7 @@ int upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
|||||||
equivalent[10] = source[4];
|
equivalent[10] = source[4];
|
||||||
if (source[3] == '0') {
|
if (source[3] == '0') {
|
||||||
/* Note 2 - "X4 shall not be equal to 0" */
|
/* Note 2 - "X4 shall not be equal to 0" */
|
||||||
strcpy(symbol->errtxt, "Invalid UPC-E data");
|
strcpy(symbol->errtxt, "Invalid UPC-E data (C62)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -254,7 +254,7 @@ int upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
|||||||
equivalent[10] = emode;
|
equivalent[10] = emode;
|
||||||
if (source[4] == '0') {
|
if (source[4] == '0') {
|
||||||
/* Note 3 - "X5 shall not be equal to 0" */
|
/* Note 3 - "X5 shall not be equal to 0" */
|
||||||
strcpy(symbol->errtxt, "Invalid UPC-E data");
|
strcpy(symbol->errtxt, "Invalid UPC-E data (C63)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -293,7 +293,7 @@ int upce(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
|||||||
hrt[8] = '\0';
|
hrt[8] = '\0';
|
||||||
} else {
|
} else {
|
||||||
if (hrt[7] != check_digit) {
|
if (hrt[7] != check_digit) {
|
||||||
strcpy(symbol->errtxt, "Invalid check digit");
|
strcpy(symbol->errtxt, "Invalid check digit (C64)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -400,7 +400,7 @@ int ean13(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
|||||||
} else {
|
} else {
|
||||||
gtin[length - 1] = '\0';
|
gtin[length - 1] = '\0';
|
||||||
if (source[length - 1] != ean_check(gtin)) {
|
if (source[length - 1] != ean_check(gtin)) {
|
||||||
strcpy(symbol->errtxt, "Invalid check digit");
|
strcpy(symbol->errtxt, "Invalid check digit (C65)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
gtin[length - 1] = ean_check(gtin);
|
gtin[length - 1] = ean_check(gtin);
|
||||||
@ -451,7 +451,7 @@ int ean8(struct zint_symbol *symbol, unsigned char source[], char dest[]) {
|
|||||||
} else {
|
} else {
|
||||||
gtin[length - 1] = '\0';
|
gtin[length - 1] = '\0';
|
||||||
if (source[length - 1] != upc_check(gtin)) {
|
if (source[length - 1] != upc_check(gtin)) {
|
||||||
strcpy(symbol->errtxt, "Invalid check digit");
|
strcpy(symbol->errtxt, "Invalid check digit (C66)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
gtin[length - 1] = upc_check(gtin);
|
gtin[length - 1] = upc_check(gtin);
|
||||||
@ -512,26 +512,26 @@ int isbn(struct zint_symbol *symbol, unsigned char source[], const unsigned int
|
|||||||
to_upper(source);
|
to_upper(source);
|
||||||
error_number = is_sane("0123456789X", source, src_len);
|
error_number = is_sane("0123456789X", source, src_len);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in input");
|
strcpy(symbol->errtxt, "Invalid characters in input (C67)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Input must be 9, 10 or 13 characters */
|
/* Input must be 9, 10 or 13 characters */
|
||||||
if (((src_len < 9) || (src_len > 13)) || ((src_len > 10) && (src_len < 13))) {
|
if (((src_len < 9) || (src_len > 13)) || ((src_len > 10) && (src_len < 13))) {
|
||||||
strcpy(symbol->errtxt, "Input wrong length");
|
strcpy(symbol->errtxt, "Input wrong length (C68)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src_len == 13) /* Using 13 character ISBN */ {
|
if (src_len == 13) /* Using 13 character ISBN */ {
|
||||||
if (!(((source[0] == '9') && (source[1] == '7')) &&
|
if (!(((source[0] == '9') && (source[1] == '7')) &&
|
||||||
((source[2] == '8') || (source[2] == '9')))) {
|
((source[2] == '8') || (source[2] == '9')))) {
|
||||||
strcpy(symbol->errtxt, "Invalid ISBN");
|
strcpy(symbol->errtxt, "Invalid ISBN (C69)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
check_digit = isbn13_check(source);
|
check_digit = isbn13_check(source);
|
||||||
if (source[src_len - 1] != check_digit) {
|
if (source[src_len - 1] != check_digit) {
|
||||||
strcpy(symbol->errtxt, "Incorrect ISBN check");
|
strcpy(symbol->errtxt, "Incorrect ISBN check (C6A)");
|
||||||
return ZINT_ERROR_INVALID_CHECK;
|
return ZINT_ERROR_INVALID_CHECK;
|
||||||
}
|
}
|
||||||
source[12] = '\0';
|
source[12] = '\0';
|
||||||
@ -542,7 +542,7 @@ int isbn(struct zint_symbol *symbol, unsigned char source[], const unsigned int
|
|||||||
if (src_len == 10) /* Using 10 digit ISBN */ {
|
if (src_len == 10) /* Using 10 digit ISBN */ {
|
||||||
check_digit = isbn_check(source);
|
check_digit = isbn_check(source);
|
||||||
if (check_digit != source[src_len - 1]) {
|
if (check_digit != source[src_len - 1]) {
|
||||||
strcpy(symbol->errtxt, "Incorrect ISBN check");
|
strcpy(symbol->errtxt, "Incorrect ISBN check (C6B)");
|
||||||
return ZINT_ERROR_INVALID_CHECK;
|
return ZINT_ERROR_INVALID_CHECK;
|
||||||
}
|
}
|
||||||
for (i = 13; i > 0; i--) {
|
for (i = 13; i > 0; i--) {
|
||||||
@ -566,7 +566,7 @@ int isbn(struct zint_symbol *symbol, unsigned char source[], const unsigned int
|
|||||||
/* Verify check digit */
|
/* Verify check digit */
|
||||||
check_digit = isbn_check(source);
|
check_digit = isbn_check(source);
|
||||||
if (check_digit != source[ustrlen(source) - 1]) {
|
if (check_digit != source[ustrlen(source) - 1]) {
|
||||||
strcpy(symbol->errtxt, "Incorrect SBN check");
|
strcpy(symbol->errtxt, "Incorrect SBN check (C6C)");
|
||||||
return ZINT_ERROR_INVALID_CHECK;
|
return ZINT_ERROR_INVALID_CHECK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -727,20 +727,20 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
writer = 0;
|
writer = 0;
|
||||||
|
|
||||||
if (src_len > 19) {
|
if (src_len > 19) {
|
||||||
strcpy(symbol->errtxt, "Input too long");
|
strcpy(symbol->errtxt, "Input too long (C6D)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
if (symbol->symbology != BARCODE_ISBNX) {
|
if (symbol->symbology != BARCODE_ISBNX) {
|
||||||
/* ISBN has it's own checking routine */
|
/* ISBN has it's own checking routine */
|
||||||
error_number = is_sane("0123456789+", source, src_len);
|
error_number = is_sane("0123456789+", source, src_len);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in data");
|
strcpy(symbol->errtxt, "Invalid characters in data (C6E)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error_number = is_sane("0123456789Xx", source, src_len);
|
error_number = is_sane("0123456789Xx", source, src_len);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
strcpy(symbol->errtxt, "Invalid characters in input");
|
strcpy(symbol->errtxt, "Invalid characters in input (C6F)");
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -799,7 +799,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
case 12:
|
case 12:
|
||||||
case 13: error_number = ean13(symbol, first_part, (char*) dest);
|
case 13: error_number = ean13(symbol, first_part, (char*) dest);
|
||||||
break;
|
break;
|
||||||
default: strcpy(symbol->errtxt, "Invalid length input");
|
default: strcpy(symbol->errtxt, "Invalid length input (C6G)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -829,7 +829,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
symbol->rows += 3;
|
symbol->rows += 3;
|
||||||
error_number = ean13(symbol, first_part, (char*) dest);
|
error_number = ean13(symbol, first_part, (char*) dest);
|
||||||
break;
|
break;
|
||||||
default: strcpy(symbol->errtxt, "Invalid length EAN input");
|
default: strcpy(symbol->errtxt, "Invalid length EAN input (C6H)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -838,7 +838,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
if ((ustrlen(first_part) == 11) || (ustrlen(first_part) == 12)) {
|
if ((ustrlen(first_part) == 11) || (ustrlen(first_part) == 12)) {
|
||||||
error_number = upca(symbol, first_part, (char*) dest);
|
error_number = upca(symbol, first_part, (char*) dest);
|
||||||
} else {
|
} else {
|
||||||
strcpy(symbol->errtxt, "Input wrong length");
|
strcpy(symbol->errtxt, "Input wrong length (C6I)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -856,7 +856,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
symbol->rows += 3;
|
symbol->rows += 3;
|
||||||
error_number = upca(symbol, first_part, (char*) dest);
|
error_number = upca(symbol, first_part, (char*) dest);
|
||||||
} else {
|
} else {
|
||||||
strcpy(symbol->errtxt, "UPCA input wrong length");
|
strcpy(symbol->errtxt, "UPCA input wrong length (C6J)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -865,7 +865,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
if ((ustrlen(first_part) >= 6) && (ustrlen(first_part) <= 8)) {
|
if ((ustrlen(first_part) >= 6) && (ustrlen(first_part) <= 8)) {
|
||||||
error_number = upce(symbol, first_part, (char*) dest);
|
error_number = upce(symbol, first_part, (char*) dest);
|
||||||
} else {
|
} else {
|
||||||
strcpy(symbol->errtxt, "Input wrong length");
|
strcpy(symbol->errtxt, "Input wrong length (C6K)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -883,7 +883,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
symbol->rows += 3;
|
symbol->rows += 3;
|
||||||
error_number = upce(symbol, first_part, (char*) dest);
|
error_number = upce(symbol, first_part, (char*) dest);
|
||||||
} else {
|
} else {
|
||||||
strcpy(symbol->errtxt, "UPCE input wrong length");
|
strcpy(symbol->errtxt, "UPCE input wrong length (C6L)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -909,7 +909,7 @@ int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) {
|
|||||||
strcat((char*) symbol->text, (char*) second_part);
|
strcat((char*) symbol->text, (char*) second_part);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strcpy(symbol->errtxt, "Invalid length input");
|
strcpy(symbol->errtxt, "Invalid length input (C6M)");
|
||||||
return ZINT_ERROR_TOO_LONG;
|
return ZINT_ERROR_TOO_LONG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ int batch_process(struct zint_symbol *symbol, char *filename, int mirror_mode, c
|
|||||||
if (strlen(format_string) < 127) {
|
if (strlen(format_string) < 127) {
|
||||||
strcpy(format_string, symbol->outfile);
|
strcpy(format_string, symbol->outfile);
|
||||||
} else {
|
} else {
|
||||||
strcpy(symbol->errtxt, "Format string too long");
|
strcpy(symbol->errtxt, "Format string too long (A01)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@ int batch_process(struct zint_symbol *symbol, char *filename, int mirror_mode, c
|
|||||||
} else {
|
} else {
|
||||||
file = fopen(filename, "rb");
|
file = fopen(filename, "rb");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
strcpy(symbol->errtxt, "Unable to read input file");
|
strcpy(symbol->errtxt, "Unable to read input file (A02)");
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -407,7 +407,7 @@ int batch_process(struct zint_symbol *symbol, char *filename, int mirror_mode, c
|
|||||||
posn++;
|
posn++;
|
||||||
}
|
}
|
||||||
if (posn > 7090) {
|
if (posn > 7090) {
|
||||||
fprintf(stderr, "On line %d: Input data too long\n", line_count);
|
fprintf(stderr, "On line %d: Input data too long (A03)\n", line_count);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
do {
|
do {
|
||||||
character = fgetc(file);
|
character = fgetc(file);
|
||||||
@ -416,7 +416,7 @@ int batch_process(struct zint_symbol *symbol, char *filename, int mirror_mode, c
|
|||||||
} while ((!feof(file)) && (line_count < 2000000000));
|
} while ((!feof(file)) && (line_count < 2000000000));
|
||||||
|
|
||||||
if (character != '\n') {
|
if (character != '\n') {
|
||||||
fprintf(stderr, "Warning: No newline at end of file\n");
|
fprintf(stderr, "Warning: No newline at end of file (A04)\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,7 +561,7 @@ int main(int argc, char **argv) {
|
|||||||
my_symbol->scale = (float) (atof(optarg));
|
my_symbol->scale = (float) (atof(optarg));
|
||||||
if (my_symbol->scale < 0.01) {
|
if (my_symbol->scale < 0.01) {
|
||||||
/* Zero and negative values are not permitted */
|
/* Zero and negative values are not permitted */
|
||||||
fprintf(stderr, "Invalid scale value\n");
|
fprintf(stderr, "Invalid scale value (A05)\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
my_symbol->scale = 1.0;
|
my_symbol->scale = 1.0;
|
||||||
}
|
}
|
||||||
@ -570,7 +570,7 @@ int main(int argc, char **argv) {
|
|||||||
my_symbol->dot_size = (float) (atof(optarg));
|
my_symbol->dot_size = (float) (atof(optarg));
|
||||||
if (my_symbol->dot_size < 0.01) {
|
if (my_symbol->dot_size < 0.01) {
|
||||||
/* Zero and negative values are not permitted */
|
/* Zero and negative values are not permitted */
|
||||||
fprintf(stderr, "Invalid dot radius value\n");
|
fprintf(stderr, "Invalid dot radius value (A06)\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
my_symbol->dot_size = 4.0 / 5.0;
|
my_symbol->dot_size = 4.0 / 5.0;
|
||||||
}
|
}
|
||||||
@ -578,26 +578,26 @@ int main(int argc, char **argv) {
|
|||||||
if (!strcmp(long_options[option_index].name, "border")) {
|
if (!strcmp(long_options[option_index].name, "border")) {
|
||||||
error_number = validator(NESET, optarg);
|
error_number = validator(NESET, optarg);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
fprintf(stderr, "Invalid border width\n");
|
fprintf(stderr, "Invalid border width (A07)\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 1000)) {
|
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 1000)) {
|
||||||
my_symbol->border_width = atoi(optarg);
|
my_symbol->border_width = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Border width out of range\n");
|
fprintf(stderr, "Border width out of range (A08)\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!strcmp(long_options[option_index].name, "height")) {
|
if (!strcmp(long_options[option_index].name, "height")) {
|
||||||
error_number = validator(NESET, optarg);
|
error_number = validator(NESET, optarg);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
fprintf(stderr, "Invalid symbol height\n");
|
fprintf(stderr, "Invalid symbol height (A09)\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 1000)) {
|
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 1000)) {
|
||||||
my_symbol->height = atoi(optarg);
|
my_symbol->height = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Symbol height out of range\n");
|
fprintf(stderr, "Symbol height out of range (A10)\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -606,7 +606,7 @@ int main(int argc, char **argv) {
|
|||||||
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 66)) {
|
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 66)) {
|
||||||
my_symbol->option_2 = atoi(optarg);
|
my_symbol->option_2 = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Number of columns out of range\n");
|
fprintf(stderr, "Number of columns out of range (A11)\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -614,7 +614,7 @@ int main(int argc, char **argv) {
|
|||||||
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 44)) {
|
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 44)) {
|
||||||
my_symbol->option_1 = atoi(optarg);
|
my_symbol->option_1 = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Number of rows out of range\n");
|
fprintf(stderr, "Number of rows out of range (A12)\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -622,7 +622,7 @@ int main(int argc, char **argv) {
|
|||||||
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 84)) {
|
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 84)) {
|
||||||
my_symbol->option_2 = atoi(optarg);
|
my_symbol->option_2 = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Invalid Version\n");
|
fprintf(stderr, "Invalid Version (A13)\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -630,7 +630,7 @@ int main(int argc, char **argv) {
|
|||||||
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 8)) {
|
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 8)) {
|
||||||
my_symbol->option_1 = atoi(optarg);
|
my_symbol->option_1 = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "ECC level out of range\n");
|
fprintf(stderr, "ECC level out of range (A14)\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -638,7 +638,7 @@ int main(int argc, char **argv) {
|
|||||||
if (strlen(optarg) <= 90) {
|
if (strlen(optarg) <= 90) {
|
||||||
strcpy(my_symbol->primary, optarg);
|
strcpy(my_symbol->primary, optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Primary data string too long");
|
fprintf(stderr, "Primary data string too long (A15)");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -646,7 +646,7 @@ int main(int argc, char **argv) {
|
|||||||
if ((optarg[0] >= '0') && (optarg[0] <= '6')) {
|
if ((optarg[0] >= '0') && (optarg[0] <= '6')) {
|
||||||
my_symbol->option_1 = optarg[0] - '0';
|
my_symbol->option_1 = optarg[0] - '0';
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Invalid mode\n");
|
fprintf(stderr, "Invalid mode (A16)\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -654,7 +654,7 @@ int main(int argc, char **argv) {
|
|||||||
/* Only certain inputs allowed */
|
/* Only certain inputs allowed */
|
||||||
error_number = validator(NESET, optarg);
|
error_number = validator(NESET, optarg);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
fprintf(stderr, "Invalid rotation parameter\n");
|
fprintf(stderr, "Invalid rotation parameter (A17)\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
switch (atoi(optarg)) {
|
switch (atoi(optarg)) {
|
||||||
@ -684,7 +684,7 @@ int main(int argc, char **argv) {
|
|||||||
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 30)) {
|
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 30)) {
|
||||||
my_symbol->eci = atoi(optarg);
|
my_symbol->eci = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Invalid ECI code\n");
|
fprintf(stderr, "Invalid ECI code (A18)\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -705,7 +705,7 @@ int main(int argc, char **argv) {
|
|||||||
case 'b':
|
case 'b':
|
||||||
error_number = validator(NESET, optarg);
|
error_number = validator(NESET, optarg);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
fprintf(stderr, "Invalid barcode type\n");
|
fprintf(stderr, "Invalid barcode type (A19)\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
my_symbol->symbology = atoi(optarg);
|
my_symbol->symbology = atoi(optarg);
|
||||||
@ -714,13 +714,13 @@ int main(int argc, char **argv) {
|
|||||||
case 'w':
|
case 'w':
|
||||||
error_number = validator(NESET, optarg);
|
error_number = validator(NESET, optarg);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
fprintf(stderr, "Invalid whitespace value\n");
|
fprintf(stderr, "Invalid whitespace value (A20)\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 1000)) {
|
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 1000)) {
|
||||||
my_symbol->whitespace_width = atoi(optarg);
|
my_symbol->whitespace_width = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Whitespace value out of range");
|
fprintf(stderr, "Whitespace value out of range (A21)");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -739,7 +739,7 @@ int main(int argc, char **argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Cannot define data in batch mode");
|
fprintf(stderr, "Cannot define data in batch mode (A22)");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -783,7 +783,7 @@ int main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "?? getopt error 0%o\n", c);
|
fprintf(stderr, "?? getopt error 0%o (A23)\n", c);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -797,7 +797,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (generated == 0) {
|
if (generated == 0) {
|
||||||
fprintf(stderr, "error: No data received, no symbol generated\n");
|
fprintf(stderr, "error: No data received, no symbol generated (A24)\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user