Add Royal Mail Mailmark to front end

This commit is contained in:
Robin Stuart 2018-02-09 20:55:17 +00:00
parent 59116f689d
commit 389bcce10f
5 changed files with 43 additions and 32 deletions

View file

@ -147,7 +147,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) {
int i, j;
if ((length != 22) && (length != 26)) {
strcpy(symbol->errtxt, "Invalid length input");
strcpy(symbol->errtxt, "580: Invalid length input");
return ZINT_ERROR_INVALID_DATA;
}
@ -159,28 +159,28 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) {
}
if (is_sane(RUBIDIUM, (unsigned char *) local_source, length) != 0) {
strcpy(symbol->errtxt, "Invalid characters or format in input data");
strcpy(symbol->errtxt, "581: Invalid characters or format in input data");
return ZINT_ERROR_INVALID_DATA;
}
// Format is in the range 0-4
format = ctoi(local_source[0]);
if ((format < 0) || (format > 4)) {
strcpy(symbol->errtxt, "Invalid format");
strcpy(symbol->errtxt, "582: Invalid format");
return ZINT_ERROR_INVALID_DATA;
}
// Version ID is in the range 1-4
version_id = ctoi(local_source[1]) - 1;
if ((version_id < 0) || (version_id > 3)) {
strcpy(symbol->errtxt, "Invalid Version ID");
strcpy(symbol->errtxt, "583: Invalid Version ID");
return ZINT_ERROR_INVALID_DATA;
}
// Class is in the range 0-9,A-E
class = ctoi(local_source[2]);
if ((class < 0) || (class > 14)) {
strcpy(symbol->errtxt, "Invalid Class");
strcpy(symbol->errtxt, "584: Invalid Class");
return ZINT_ERROR_INVALID_DATA;
}
@ -191,7 +191,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) {
supply_chain_id *= 10;
supply_chain_id += ctoi(local_source[i]);
} else {
strcpy(symbol->errtxt, "Invalid Supply Chain ID");
strcpy(symbol->errtxt, "585: Invalid Supply Chain ID");
return ZINT_ERROR_INVALID_DATA;
}
}
@ -203,7 +203,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) {
item_id *= 10;
item_id += (long) ctoi(local_source[i]);
} else {
strcpy(symbol->errtxt, "Invalid Item ID");
strcpy(symbol->errtxt, "586: Invalid Item ID");
return ZINT_ERROR_INVALID_DATA;
}
}
@ -258,7 +258,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) {
// Verify postcode type
if (postcode_type != 7) {
if (verify_postcode(postcode, postcode_type) != 0) {
strcpy(symbol->errtxt, "Invalid postcode");
strcpy(symbol->errtxt, "587: Invalid postcode");
return ZINT_ERROR_INVALID_DATA;
}
}
@ -624,9 +624,9 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) {
j += 2;
}
symbol->row_height[0] = 3;
symbol->row_height[0] = 4;
symbol->row_height[1] = 2;
symbol->row_height[2] = 3;
symbol->row_height[2] = 4;
symbol->rows = 3;
symbol->width = j - 1;