Add identifiers to error messages

To ease the debug process
This commit is contained in:
Robin Stuart 2016-10-28 22:40:40 +01:00
parent 5405035df1
commit 4561a66067
35 changed files with 296 additions and 298 deletions

View file

@ -310,7 +310,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
if (sourcelen > 160) {
/* This only blocks rediculously long input - the actual length of the
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;
}
@ -482,7 +482,7 @@ int code_128(struct zint_symbol *symbol, unsigned char source[], int length) {
}
}
if (glyph_count > 60.0) {
strcpy(symbol->errtxt, "Input too long");
strcpy(symbol->errtxt, "Input too long (C41)");
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) {
/* This only blocks rediculously long input - the actual length of the
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;
}
for (i = 0; i < length; i++) {
if (source[i] == '\0') {
/* 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;
}
}
@ -843,7 +843,7 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[], const size_t len
}
}
if (glyph_count > 60.0) {
strcpy(symbol->errtxt, "Input too long");
strcpy(symbol->errtxt, "Input too long (C44)");
return ZINT_ERROR_TOO_LONG;
}
@ -1010,13 +1010,13 @@ int nve_18(struct zint_symbol *symbol, unsigned char source[], int length) {
sourcelen = length;
if (sourcelen > 17) {
strcpy(symbol->errtxt, "Input too long");
strcpy(symbol->errtxt, "Input too long (C45)");
return ZINT_ERROR_TOO_LONG;
}
error_number = is_sane(NEON, source, length);
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;
}
zeroes = 17 - sourcelen;
@ -1051,13 +1051,13 @@ int ean_14(struct zint_symbol *symbol, unsigned char source[], int length) {
unsigned char ean128_equiv[20];
if (length > 13) {
strcpy(symbol->errtxt, "Input wrong length");
strcpy(symbol->errtxt, "Input wrong length (C47)");
return ZINT_ERROR_TOO_LONG;
}
error_number = is_sane(NEON, source, length);
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;
}