Add trailing spaces to Mailmark if not present in input data

This commit is contained in:
Robin Stuart 2018-02-10 07:26:33 +00:00
parent 389bcce10f
commit f655eabc12
2 changed files with 22 additions and 5 deletions

View File

@ -146,12 +146,27 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) {
int check_count;
int i, j;
if ((length != 22) && (length != 26)) {
strcpy(symbol->errtxt, "580: Invalid length input");
return ZINT_ERROR_INVALID_DATA;
if (length > 26) {
strcpy(symbol->errtxt, "580: Input too long");
return ZINT_ERROR_TOO_LONG;
}
strcpy(local_source, (char*) source);
if (length < 22) {
for (i = length; i <= 22; i++) {
strcat(local_source, " ");
}
length = 22;
}
if ((length > 22) && (length < 26)) {
for (i = length; i <= 26; i++) {
strcat(local_source, " ");
}
length = 26;
}
to_upper((unsigned char*) local_source);
if (symbol->debug) {
@ -159,7 +174,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) {
}
if (is_sane(RUBIDIUM, (unsigned char *) local_source, length) != 0) {
strcpy(symbol->errtxt, "581: Invalid characters or format in input data");
strcpy(symbol->errtxt, "581: Invalid characters in input data");
return ZINT_ERROR_INVALID_DATA;
}

View File

@ -1726,7 +1726,9 @@ generated by Zint.
Developed in 2014 as a replacement for RM4SCC this 4-state symbol includes
Reed Solomon error correction. Input is a pre-formatted alpanumeric string of
22 (for Barcode C) or 26 (for Barcode L) characters, producing a symbol with
66 or 78 bars respectively.
66 or 78 bars respectively. Some of the permitted inputs include a number of
trailing space characters - these will be appended by Zint if not included in
the input data.
6.5.5 USPS OneCode
------------------