Audit of error codes

This commit is contained in:
Robin Stuart 2017-07-27 16:01:53 +01:00
parent 58e80a9ff7
commit 608b4b9134
38 changed files with 345 additions and 345 deletions

View file

@ -65,19 +65,19 @@ int pharma_one(struct zint_symbol *symbol, unsigned char source[], int length) {
char dest[64]; /* 17 * 2 + 1 */
if (length > 6) {
strcpy(symbol->errtxt, "Input too long (C50)");
strcpy(symbol->errtxt, "350: Input too long");
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 (C51)");
strcpy(symbol->errtxt, "351: Invalid characters in data");
return error_number;
}
tester = atoi((char*) source);
if ((tester < 3) || (tester > 131070)) {
strcpy(symbol->errtxt, "Data out of range (C52)");
strcpy(symbol->errtxt, "352: Data out of range");
return ZINT_ERROR_INVALID_DATA;
}
@ -120,7 +120,7 @@ int pharma_two_calc(struct zint_symbol *symbol, unsigned char source[], char des
tester = atoi((char*) source);
if ((tester < 4) || (tester > 64570080)) {
strcpy(symbol->errtxt, "Data out of range (C53)");
strcpy(symbol->errtxt, "353: Data out of range");
return ZINT_ERROR_INVALID_DATA;
}
error_number = 0;
@ -160,12 +160,12 @@ int pharma_two(struct zint_symbol *symbol, unsigned char source[], int length) {
strcpy(height_pattern, "");
if (length > 8) {
strcpy(symbol->errtxt, "Input too long (C54)");
strcpy(symbol->errtxt, "354: Input too long");
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 (C55)");
strcpy(symbol->errtxt, "355: Invalid characters in data");
return error_number;
}
error_number = pharma_two_calc(symbol, source, height_pattern);
@ -200,25 +200,25 @@ int codabar(struct zint_symbol *symbol, unsigned char source[], int length) {
strcpy(dest, "");
if (length > 60) { /* No stack smashing please */
strcpy(symbol->errtxt, "Input too long (C56)");
strcpy(symbol->errtxt, "356: Input too long");
return ZINT_ERROR_TOO_LONG;
}
to_upper(source);
error_number = is_sane(CALCIUM, source, length);
if (error_number == ZINT_ERROR_INVALID_DATA) {
strcpy(symbol->errtxt, "Invalid characters in data (C57)");
strcpy(symbol->errtxt, "357: Invalid characters in data");
return error_number;
}
/* Codabar must begin and end with the characters A, B, C or D */
if ((source[0] != 'A') && (source[0] != 'B') && (source[0] != 'C')
&& (source[0] != 'D')) {
strcpy(symbol->errtxt, "Invalid characters in data (C58)");
strcpy(symbol->errtxt, "358: Invalid characters in data");
return ZINT_ERROR_INVALID_DATA;
}
if ((source[length - 1] != 'A') && (source[length - 1] != 'B') &&
(source[length - 1] != 'C') && (source[length - 1] != 'D')) {
strcpy(symbol->errtxt, "Invalid characters in data (C59)");
strcpy(symbol->errtxt, "359: Invalid characters in data");
return ZINT_ERROR_INVALID_DATA;
}
@ -241,12 +241,12 @@ int code32(struct zint_symbol *symbol, unsigned char source[], int length) {
/* Validate the input */
if (length > 8) {
strcpy(symbol->errtxt, "Input too long (C5A)");
strcpy(symbol->errtxt, "360: Input too long");
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 (C5B)");
strcpy(symbol->errtxt, "361: Invalid characters in data");
return error_number;
}