mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-24 20:14:28 -04:00
MAXICODE: Zero-pad US postcodes that lack "+4" (Annex B.1.4a)
Adapted from OkapiBarcode, with stricter interpretation (only pad if "+4" totally absent), props Daniel Gredler gs1: update to latest gs1-syntax-dictionary (linter mm -> mi) bwipp: update to latest
This commit is contained in:
parent
c1666cf350
commit
752c1fae5d
6 changed files with 96 additions and 50 deletions
|
@ -3933,7 +3933,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
|
|||
char *escaped = is_escaped ? (char *) z_alloca(expected_len + 1) : NULL;
|
||||
char *hibc = is_hibc ? (char *) z_alloca(expected_len + 2 + 1) : NULL;
|
||||
char *maxi = symbology == BARCODE_MAXICODE && primary
|
||||
? (char *) z_alloca(expected_len + strlen(primary) + 6 + 9 + 1) : NULL;
|
||||
? (char *) z_alloca(expected_len + strlen(primary) + 4 + 6 + 9 + 1) : NULL;
|
||||
char *vin = is_vin_international ? (char *) z_alloca(expected_len + 1 + 1) : NULL;
|
||||
char *c25inter = have_c25inter ? (char *) z_alloca(expected_len + 13 + 1 + 1) : NULL;
|
||||
char *upcean = is_upcean ? (char *) z_alloca(expected_len + 1 + 1) : NULL;
|
||||
|
@ -4045,8 +4045,13 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
|
|||
sprintf(maxi + maxi_len, "%-6.*s\035%.*s\035%.*s\035", primary_len - 6, primary,
|
||||
3, primary + primary_len - 6, 3, primary + primary_len - 3);
|
||||
} else {
|
||||
sprintf(maxi + maxi_len, "%.*s\035%.*s\035%.*s\035", primary_len - 6, primary,
|
||||
3, primary + primary_len - 6, 3, primary + primary_len - 3);
|
||||
if (primary_len == 11 && primary[5] == '8' && primary[6] == '4' && primary[7] == '0') {
|
||||
sprintf(maxi + maxi_len, "%.*s0000\035%.*s\035%.*s\035", primary_len - 6, primary,
|
||||
3, primary + primary_len - 6, 3, primary + primary_len - 3);
|
||||
} else {
|
||||
sprintf(maxi + maxi_len, "%.*s\035%.*s\035%.*s\035", primary_len - 6, primary,
|
||||
3, primary + primary_len - 6, 3, primary + primary_len - 3);
|
||||
}
|
||||
}
|
||||
#else
|
||||
sprintf(maxi + maxi_len, "%.*s\035%.*s\035%.*s\035", primary_len - 6, primary,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue