mirror of
https://git.code.sf.net/p/zint/code
synced 2025-06-01 07:38:26 -04:00
Expand ECI support and enforce binary mode when ECI is set
This commit is contained in:
parent
d818d1aecc
commit
451f0150d8
6 changed files with 52 additions and 10 deletions
|
@ -559,12 +559,10 @@ void numbprocess(int *chainemc, int *mclength, char chaine[], int start, int len
|
|||
/* 366 */
|
||||
static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_t length) {
|
||||
int i, k, j, indexchaine, indexliste, mode, longueur, loop, mccorrection[520], offset;
|
||||
int total, chainemc[2700], mclength, c1, c2, c3, dummy[35], codeerr;
|
||||
int total, chainemc[2700], mclength, c1, c2, c3, dummy[35];
|
||||
char pattern[580];
|
||||
int debug = symbol->debug;
|
||||
|
||||
codeerr = 0;
|
||||
|
||||
/* 456 */
|
||||
indexliste = 0;
|
||||
indexchaine = 0;
|
||||
|
@ -639,6 +637,11 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size
|
|||
}
|
||||
}
|
||||
|
||||
if (symbol->eci > 811799) {
|
||||
strcpy(symbol->errtxt, "Invalid ECI");
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
for (i = 0; i < indexliste; i++) {
|
||||
switch (liste[1][i]) {
|
||||
case TEX: /* 547 - text mode */
|
||||
|
@ -821,7 +824,7 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size
|
|||
symbol->width =(int)strlen(pattern);
|
||||
|
||||
/* 843 */
|
||||
return codeerr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 345 */
|
||||
|
@ -863,6 +866,9 @@ int pdf417enc(struct zint_symbol *symbol, unsigned char source[], const size_t l
|
|||
strcpy(symbol->errtxt, "Data too long for specified number of columns (D65)");
|
||||
error_number = ZINT_ERROR_TOO_LONG;
|
||||
break;
|
||||
case ZINT_ERROR_INVALID_OPTION:
|
||||
error_number = codeerr;
|
||||
break;
|
||||
default:
|
||||
strcpy(symbol->errtxt, "Something strange happened (D66)");
|
||||
error_number = ZINT_ERROR_ENCODING_PROBLEM;
|
||||
|
@ -936,6 +942,11 @@ int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], const size_
|
|||
mclength++;
|
||||
}
|
||||
|
||||
if (symbol->eci > 811799) {
|
||||
strcpy(symbol->errtxt, "Invalid ECI");
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if (symbol->eci != 3) {
|
||||
/* Encoding ECI assignment number, according to Table 8 */
|
||||
if (symbol->eci <= 899) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue