2019-09-19 HaO DM: when encoding ECI, data scrambled when base256 encoding was chosen. The ECI codeword 241 was missing in the binary marker array and thus, the binrary length was inserted before the latch to binary resulting in very corrupt data.

This commit is contained in:
Harald Oehlmann 2019-09-18 10:51:01 +02:00
parent 0f6924d6dc
commit 5c9d127ad1

View File

@ -588,14 +588,14 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
if (symbol->eci <= 126) { if (symbol->eci <= 126) {
target[tp] = (unsigned char) symbol->eci + 1; target[tp] = (unsigned char) symbol->eci + 1;
tp++; tp++;
strcat(binary, " "); strcat(binary, " ");
} }
if ((symbol->eci >= 127) && (symbol->eci <= 16382)) { if ((symbol->eci >= 127) && (symbol->eci <= 16382)) {
target[tp] = (unsigned char) ((symbol->eci - 127) / 254) + 128; target[tp] = (unsigned char) ((symbol->eci - 127) / 254) + 128;
tp++; tp++;
target[tp] = (unsigned char) ((symbol->eci - 127) % 254) + 1; target[tp] = (unsigned char) ((symbol->eci - 127) % 254) + 1;
tp++; tp++;
strcat(binary, " "); strcat(binary, " ");
} }
if (symbol->eci >= 16383) { if (symbol->eci >= 16383) {
target[tp] = (unsigned char) ((symbol->eci - 16383) / 64516) + 192; target[tp] = (unsigned char) ((symbol->eci - 16383) / 64516) + 192;
@ -604,7 +604,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
tp++; tp++;
target[tp] = (unsigned char) ((symbol->eci - 16383) % 254) + 1; target[tp] = (unsigned char) ((symbol->eci - 16383) % 254) + 1;
tp++; tp++;
strcat(binary, " "); strcat(binary, " ");
} }
if (debug) printf("ECI %d ", symbol->eci + 1); if (debug) printf("ECI %d ", symbol->eci + 1);
} }