mirror of
https://git.code.sf.net/p/zint/code
synced 2026-05-14 18:13:53 +00:00
AUSPOST: support Null FCC (DPID all zeroes); TODO: BWIPP support
CODE128: properly fix not switching before FNC1 in 2nd position after alpha (commit [7b0767]) PLANET/KIX: adapt POSTNET to cater for both general: use static strings to save a few bytes (start/stop in particular); various other code fiddles postal: move tables into funcs
This commit is contained in:
@@ -54,10 +54,13 @@ static const char MSITable[10][8] = {
|
||||
|
||||
/* Not MSI/Plessey but the older Plessey standard */
|
||||
INTERNAL int zint_plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
static const char grid[9] = { 1, 1, 1, 1, 0, 1, 0, 0, 1 };
|
||||
static const char start[8] = { '3','1','3','1','1','3','3','1' };
|
||||
static const char stop[9] = { '3','3','1','3','1','1','3','1','3' };
|
||||
static const char checks[3] = { '1','3','1' }; /* Case 0 1st 2, case 1 2nd 2 */
|
||||
|
||||
int i;
|
||||
unsigned char checkptr[67 * 4 + 8] = {0};
|
||||
static const char grid[9] = {1, 1, 1, 1, 0, 1, 0, 0, 1};
|
||||
char dest[570]; /* 8 + 67 * 8 + 2 * 8 + 9 + 1 = 570 */
|
||||
char *d = dest;
|
||||
unsigned int check_digits = 0;
|
||||
@@ -74,7 +77,7 @@ INTERNAL int zint_plessey(struct zint_symbol *symbol, unsigned char source[], in
|
||||
}
|
||||
|
||||
/* Start character */
|
||||
memcpy(d, "31311331", 8);
|
||||
memcpy(d, start, 8);
|
||||
d += 8;
|
||||
|
||||
/* Data area */
|
||||
@@ -101,11 +104,11 @@ INTERNAL int zint_plessey(struct zint_symbol *symbol, unsigned char source[], in
|
||||
for (i = 0; i < 8; i++) {
|
||||
switch (checkptr[length * 4 + i]) {
|
||||
case 0:
|
||||
memcpy(d, "13", 2);
|
||||
memcpy(d, checks, 2);
|
||||
d += 2;
|
||||
break;
|
||||
case 1:
|
||||
memcpy(d, "31", 2);
|
||||
memcpy(d, checks + 1, 2);
|
||||
d += 2;
|
||||
check_digits |= (1 << i);
|
||||
break;
|
||||
@@ -113,7 +116,7 @@ INTERNAL int zint_plessey(struct zint_symbol *symbol, unsigned char source[], in
|
||||
}
|
||||
|
||||
/* Stop character */
|
||||
memcpy(d, "331311313", 9);
|
||||
memcpy(d, stop, 9);
|
||||
d += 9;
|
||||
|
||||
z_expand(symbol, dest, (int) (d - dest));
|
||||
@@ -327,6 +330,7 @@ static char *msi_plessey_mod1110(struct zint_symbol *symbol, const unsigned char
|
||||
}
|
||||
|
||||
INTERNAL int zint_msi_plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
|
||||
static const char stop_start[3] = { '1','2','1' }; /* All 3 stop, last 2 start */
|
||||
int error_number = 0;
|
||||
int i;
|
||||
char dest[766]; /* 2 + 92 * 8 + 3 * 8 + 3 + 1 = 766 */
|
||||
@@ -354,7 +358,7 @@ INTERNAL int zint_msi_plessey(struct zint_symbol *symbol, unsigned char source[]
|
||||
}
|
||||
|
||||
/* Start character */
|
||||
memcpy(d, "21", 2);
|
||||
memcpy(d, stop_start + 1, 2);
|
||||
d += 2;
|
||||
|
||||
switch (check_option) {
|
||||
@@ -372,7 +376,7 @@ INTERNAL int zint_msi_plessey(struct zint_symbol *symbol, unsigned char source[]
|
||||
}
|
||||
|
||||
/* Stop character */
|
||||
memcpy(d, "121", 3);
|
||||
memcpy(d, stop_start, 3);
|
||||
d += 3;
|
||||
|
||||
z_expand(symbol, dest, (int) (d - dest));
|
||||
|
||||
Reference in New Issue
Block a user