CODE128: allow for extended latching (double FNC4) spanning

intermediate CodeC sequence by setting `f_state` only if in
  CodeA/B & checking before adding extended mode switch (cf
  OkapiBarcode commit [9ce6dcc], props Daniel Gredler)
DATAMATRIX: in FAST_MODE re-process any buffered X12 characters
  when mode changes from X12 (cf OkapiBarcode commit [fb7981e],
  props Daniel Gredler)
CODABLOCKF: allow for FNC4 when estimating no. of rows required
CODE16K: make sure row calculation accurate by dispensing with
  glyph estimate & using actual codeword count
CODE16K: ensure initial mode selection allows for extended
  characters
vector.c: add `z_alloca()` cast for `first_row_rects` (ticket
  #272)
MSVC project files: remove incorrect "CompileACpp" setting from
  libzint project files (ticket #272)
bwipp_dump.ps: fix 2/4-track processing; update to latest BWIPP
manual/man page/GUI: Code 16k -> Code 16K
This commit is contained in:
gitlost 2022-10-13 13:33:59 +01:00
parent 92a4a25ed2
commit ada19fc079
32 changed files with 804 additions and 561 deletions

View File

@ -12,15 +12,39 @@ Version 2.11.1.9 (dev) not released yet
Changes Changes
------- -------
- DOTCODE, QRCODE, RMQR: return warning if ECI or Structured Append used in GS1 - bwipp_dump.ps: convert patch file to cat file as BWIPP now honours `dontdraw`
mode, ticket #271 for composite symbologies
- common.c: ensure `stripf()` not inlined to prevent optimizer undoing effect
(ticket #269)
- CLI: improve `getopt_long_only()` processing, printing own message if bad arg - CLI: improve `getopt_long_only()` processing, printing own message if bad arg
and returning error if so rather than continuing to process and returning error if so rather than continuing to process
- manual: MSE typo -> MSI; adjust SVG scaling for PDF manual; pandoc 2.19.2 - manual: MSE typo -> MSI; adjust SVG scaling for PDF manual; pandoc 2.19.2
- manual/man page/GUI: Code 16k -> Code 16K
Bugs Bugs
---- ----
- test suite: fix `test_library` test to allow for running from root;
fix `test_args` test to allow for re-running (remove junk) (tickets #268,
#269)
- common.h: define ZINT_IS_C89 as __STDC_VERSION__ not defined by MSVC, and use
when checking whether to include <alloca.h> (MR #152)
- DOTCODE, QRCODE, RMQR: return warning if ECI or Structured Append used in GS1
mode, ticket #271
- GUI: fix "Border Width" ampersand shortcut - GUI: fix "Border Width" ampersand shortcut
- CODE128: allow for extended latching (double FNC4) spanning intermediate
CodeC sequence by setting `f_state` only if in CodeA/B & checking before
adding extended mode switch (cf OkapiBarcode commit [9ce6dcc], props Daniel
Gredler)
- DATAMATRIX: in FAST_MODE re-process any buffered X12 characters when mode
changes from X12 (cf OkapiBarcode commit [fb7981e], props Daniel Gredler)
- CODABLOCKF: allow for FNC4 when estimating no. of rows required
- CODE16K: make sure row calculation accurate by dispensing with glyph estimate
& using actual codeword count
- CODE16K: ensure initial mode selection allows for extended characters
- vector.c: add `z_alloca()` cast for `first_row_rects` (ticket #272)
- MSVC project files: remove incorrect "CompileACpp" setting from libzint
project files (ticket #272)
- bwipp_dump.ps: fix 2/4-track processing; update to latest BWIPP
Version 2.11.1 (2022-08-22) Version 2.11.1 (2022-08-22)

2
README
View File

@ -13,7 +13,7 @@ Plessey, MSI Plessey, Telepen Alpha, Telepen Numeric, Code 39, Extended Code 39,
Code 93, PZN, LOGMARS, Code 32, VIN, Codabar, Pharmacode, Code 128, GS1-128, Code 93, PZN, LOGMARS, Code 32, VIN, Codabar, Pharmacode, Code 128, GS1-128,
EAN-14, NVE-18 (SSCC-18), DPD Code, GS1 DataBar Omnidirectional, GS1 DataBar EAN-14, NVE-18 (SSCC-18), DPD Code, GS1 DataBar Omnidirectional, GS1 DataBar
Limited, GS1 DataBar Expanded, GS1 DataBar Stacked, GS1 Composite Symbologies, Limited, GS1 DataBar Expanded, GS1 DataBar Stacked, GS1 Composite Symbologies,
Korea Post, Channel Code, BC412, Codablock-F, Code 16k, PDF417, Compact PDF417, Korea Post, Channel Code, BC412, Codablock-F, Code 16K, PDF417, Compact PDF417,
MicroPDF417, Code 49, Two-Track Pharmacode, POSTNET, PLANET, CEPNet, Australia MicroPDF417, Code 49, Two-Track Pharmacode, POSTNET, PLANET, CEPNet, Australia
Post 4-State Symbols, Dutch Post KIX, Royal Mail RM4SCC, Royal Mail 4-State Post 4-State Symbols, Dutch Post KIX, Royal Mail RM4SCC, Royal Mail 4-State
Mailmark, USPS Intelligent Mail, Japanese Postal Code, DAFT, Data Matrix, QR Mailmark, USPS Intelligent Mail, Japanese Postal Code, DAFT, Data Matrix, QR

View File

@ -317,7 +317,7 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const
emptyColumns--; emptyColumns--;
} else { } else {
/* Must change to A or B */ /* Must change to A or B */
if (emptyColumns == 1) { if (emptyColumns == 1 || (isFNC4 && emptyColumns == 2)) {
/* Can't switch: */ /* Can't switch: */
pSet[charCur - 1] |= CEnd + CFill; pSet[charCur - 1] |= CEnd + CFill;
emptyColumns = 0; emptyColumns = 0;
@ -362,7 +362,7 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const
} }
} while (rowsCur > 44); } while (rowsCur > 44);
if (symbol->debug & ZINT_DEBUG_PRINT) { if (symbol->debug & ZINT_DEBUG_PRINT) {
printf(" -> out: rowsCur <%i>, useColumns <%i>, fillings <%i>\n", rowsCur, useColumns, fillings); printf(" -> out: rowsCur <%d>, useColumns <%d>, fillings <%d>\n", rowsCur, useColumns, fillings);
} }
*pUseColumns = useColumns; *pUseColumns = useColumns;
*pRows = rowsCur; *pRows = rowsCur;
@ -388,7 +388,7 @@ static int Rows2Columns(struct zint_symbol *symbol, CharacterSetTable *T, const
columnsRequested = *pUseColumns >= 4 ? *pUseColumns : 0; columnsRequested = *pUseColumns >= 4 ? *pUseColumns : 0;
if (symbol->debug & ZINT_DEBUG_PRINT) { if (symbol->debug & ZINT_DEBUG_PRINT) {
printf("Optimizer : Searching <%i> rows\n", rowsRequested); printf("Optimizer : Searching <%d> rows\n", rowsRequested);
} }
if (columnsRequested) { if (columnsRequested) {
@ -841,7 +841,7 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int
printf("\n"); printf("\n");
} }
} }
printf("rows=%i columns=%i fillings=%i\n", rows, columns, fillings); printf("rows=%d columns=%d (%d data) fillings=%d\n", rows, columns, columns - 5, fillings);
} }
#ifdef ZINT_TEST #ifdef ZINT_TEST
if (symbol->debug & ZINT_DEBUG_TEST) { if (symbol->debug & ZINT_DEBUG_TEST) {

View File

@ -378,9 +378,8 @@ INTERNAL int c128_hrt_cpy_iso8859_1_test(struct zint_symbol *symbol, const unsig
/* Handle Code 128, 128B and HIBC 128 */ /* Handle Code 128, 128B and HIBC 128 */
INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int length) { INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int length) {
int i, j, k, values[C128_MAX] = {0}, bar_characters, read, total_sum; int i, j, k, values[C128_MAX] = {0}, bar_characters = 0, read, total_sum;
int error_number, indexchaine, indexliste, f_state; int error_number = 0, indexchaine, indexliste, f_state = 0;
int sourcelen;
int list[2][C128_MAX] = {{0}}; int list[2][C128_MAX] = {{0}};
char set[C128_MAX] = {0}, fset[C128_MAX], mode, last_set, current_set = ' '; char set[C128_MAX] = {0}, fset[C128_MAX], mode, last_set, current_set = ' ';
float glyph_count; float glyph_count;
@ -390,14 +389,7 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len
/* Suppresses clang-analyzer-core.UndefinedBinaryOperatorResult warning on fset which is fully set */ /* Suppresses clang-analyzer-core.UndefinedBinaryOperatorResult warning on fset which is fully set */
assert(length > 0); assert(length > 0);
error_number = 0; if (length > C128_MAX) {
sourcelen = length;
bar_characters = 0;
f_state = 0;
if (sourcelen > C128_MAX) {
/* This only blocks ridiculously long input - the actual length of the /* This only blocks ridiculously long input - the actual length of the
resulting barcode depends on the type of data, so this is trapped later */ resulting barcode depends on the type of data, so this is trapped later */
sprintf(symbol->errtxt, "340: Input too long (%d character maximum)", C128_MAX); sprintf(symbol->errtxt, "340: Input too long (%d character maximum)", C128_MAX);
@ -405,13 +397,13 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len
} }
/* Detect extended ASCII characters */ /* Detect extended ASCII characters */
for (i = 0; i < sourcelen; i++) { for (i = 0; i < length; i++) {
fset[i] = source[i] >= 128 ? 'f' : ' '; fset[i] = source[i] >= 128 ? 'f' : ' ';
} }
/* Decide when to latch to extended mode - Annex E note 3 */ /* Decide when to latch to extended mode - Annex E note 3 */
j = 0; j = 0;
for (i = 0; i < sourcelen; i++) { for (i = 0; i < length; i++) {
if (fset[i] == 'f') { if (fset[i] == 'f') {
j++; j++;
} else { } else {
@ -424,7 +416,7 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len
} }
} }
if ((j >= 3) && (i == (sourcelen - 1))) { if ((j >= 3) && (i == (length - 1))) {
for (k = i; k > (i - 3); k--) { for (k = i; k > (i - 3); k--) {
fset[k] = 'F'; fset[k] = 'F';
} }
@ -432,14 +424,14 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len
} }
/* Decide if it is worth reverting to 646 encodation for a few characters as described in 4.3.4.2 (d) */ /* Decide if it is worth reverting to 646 encodation for a few characters as described in 4.3.4.2 (d) */
for (i = 1; i < sourcelen; i++) { for (i = 1; i < length; i++) {
if ((fset[i - 1] == 'F') && (fset[i] == ' ')) { if ((fset[i - 1] == 'F') && (fset[i] == ' ')) {
/* Detected a change from 8859-1 to 646 - count how long for */ /* Detected a change from 8859-1 to 646 - count how long for */
for (j = 0; ((i + j) < sourcelen) && (fset[i + j] == ' '); j++); for (j = 0; ((i + j) < length) && (fset[i + j] == ' '); j++);
/* Count how many 8859-1 beyond */ /* Count how many 8859-1 beyond */
k = 0; k = 0;
if (i + j < sourcelen) { if (i + j < length) {
for (k = 1; ((i + j + k) < sourcelen) && (fset[i + j + k] != ' '); k++); for (k = 1; ((i + j + k) < length) && (fset[i + j + k] != ' '); k++);
} }
if (j < 3 || (j < 5 && k > 2)) { if (j < 3 || (j < 5 && k > 2)) {
/* Change to shifting back rather than latching back */ /* Change to shifting back rather than latching back */
@ -462,10 +454,10 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len
do { do {
list[1][indexliste] = mode; list[1][indexliste] = mode;
while ((list[1][indexliste] == mode) && (indexchaine < sourcelen)) { while ((list[1][indexliste] == mode) && (indexchaine < length)) {
list[0][indexliste]++; list[0][indexliste]++;
indexchaine++; indexchaine++;
if (indexchaine == sourcelen) { if (indexchaine == length) {
break; break;
} }
mode = c128_parunmodd(source[indexchaine]); mode = c128_parunmodd(source[indexchaine]);
@ -474,7 +466,7 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len
} }
} }
indexliste++; indexliste++;
} while (indexchaine < sourcelen); } while (indexchaine < length);
c128_dxsmooth(list, &indexliste); c128_dxsmooth(list, &indexliste);
@ -503,21 +495,21 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len
c128_put_in_set(list, indexliste, set, NULL /*source*/); c128_put_in_set(list, indexliste, set, NULL /*source*/);
if (symbol->debug & ZINT_DEBUG_PRINT) { if (symbol->debug & ZINT_DEBUG_PRINT) {
printf("Data: %.*s (%d)\n", sourcelen, source, sourcelen); printf("Data: %.*s (%d)\n", length, source, length);
printf(" Set: %.*s\n", sourcelen, set); printf(" Set: %.*s\n", length, set);
printf("FSet: %.*s\n", sourcelen, fset); printf("FSet: %.*s\n", length, fset);
} }
/* Now we can calculate how long the barcode is going to be - and stop it from /* Now we can calculate how long the barcode is going to be - and stop it from
being too long */ being too long */
last_set = set[0]; last_set = set[0];
glyph_count = 0.0f; glyph_count = 0.0f;
for (i = 0; i < sourcelen; i++) { for (i = 0; i < length; i++) {
if ((set[i] == 'a') || (set[i] == 'b')) { if ((set[i] == 'a') || (set[i] == 'b')) {
glyph_count = glyph_count + 1.0f; glyph_count = glyph_count + 1.0f;
} }
if ((fset[i] == 'f') || (fset[i] == 'n')) { if ((fset[i] == 'f') || (fset[i] == 'n')) {
glyph_count = glyph_count + 1.0f; glyph_count = glyph_count + 1.0f; /* May be overestimate if in latch */
} }
if (((set[i] == 'A') || (set[i] == 'B')) || (set[i] == 'C')) { if (((set[i] == 'A') || (set[i] == 'B')) || (set[i] == 'C')) {
if (set[i] != last_set) { if (set[i] != last_set) {
@ -593,13 +585,14 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len
case 'A': case 'A':
values[bar_characters++] = 101; values[bar_characters++] = 101;
values[bar_characters++] = 101; values[bar_characters++] = 101;
f_state = 1;
break; break;
case 'B': case 'B':
values[bar_characters++] = 100; values[bar_characters++] = 100;
values[bar_characters++] = 100; values[bar_characters++] = 100;
f_state = 1;
break; break;
} }
f_state = 1;
} }
/* Encode the data */ /* Encode the data */
@ -631,13 +624,14 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len
case 'A': case 'A':
values[bar_characters++] = 101; values[bar_characters++] = 101;
values[bar_characters++] = 101; values[bar_characters++] = 101;
f_state = 1;
break; break;
case 'B': case 'B':
values[bar_characters++] = 100; values[bar_characters++] = 100;
values[bar_characters++] = 100; values[bar_characters++] = 100;
f_state = 1;
break; break;
} }
f_state = 1;
} }
if ((fset[read] == ' ') && (f_state == 1)) { if ((fset[read] == ' ') && (f_state == 1)) {
/* Latch end of extended mode */ /* Latch end of extended mode */
@ -645,17 +639,18 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len
case 'A': case 'A':
values[bar_characters++] = 101; values[bar_characters++] = 101;
values[bar_characters++] = 101; values[bar_characters++] = 101;
f_state = 0;
break; break;
case 'B': case 'B':
values[bar_characters++] = 100; values[bar_characters++] = 100;
values[bar_characters++] = 100; values[bar_characters++] = 100;
f_state = 0;
break; break;
} }
f_state = 0;
} }
} }
if ((fset[read] == 'f') || (fset[read] == 'n')) { if ((fset[read] == 'f' && f_state == 0) || (fset[read] == 'n' && f_state == 1)) {
/* Shift to or from extended mode */ /* Shift to or from extended mode */
switch (current_set) { switch (current_set) {
case 'A': case 'A':
@ -686,7 +681,7 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len
break; break;
} }
} while (read < sourcelen); } while (read < length);
/* Destination setting and check digit calculation */ /* Destination setting and check digit calculation */
memcpy(d, C128Table[values[0]], 6); memcpy(d, C128Table[values[0]], 6);
@ -733,22 +728,17 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len
/* Handle EAN-128 (Now known as GS1-128), and composite version if `cc_mode` set */ /* Handle EAN-128 (Now known as GS1-128), and composite version if `cc_mode` set */
INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_mode, INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_mode,
const int cc_rows) { const int cc_rows) {
int i, values[C128_MAX] = {0}, bar_characters, read, total_sum; int i, values[C128_MAX] = {0}, bar_characters = 0, read, total_sum;
int error_number, warn_number = 0, indexchaine, indexliste; int error_number, warn_number = 0, indexchaine, indexliste;
int list[2][C128_MAX] = {{0}}; int list[2][C128_MAX] = {{0}};
char set[C128_MAX] = {0}, mode, last_set; char set[C128_MAX] = {0}, mode, last_set;
float glyph_count; float glyph_count;
char dest[1000]; char dest[1000];
char *d = dest; char *d = dest;
int separator_row, linkage_flag; int separator_row = 0, linkage_flag = 0;
int reduced_length; int reduced_length;
unsigned char *reduced = (unsigned char *) z_alloca(length + 1); unsigned char *reduced = (unsigned char *) z_alloca(length + 1);
linkage_flag = 0;
bar_characters = 0;
separator_row = 0;
if (length > C128_MAX) { if (length > C128_MAX) {
/* This only blocks ridiculously long input - the actual length of the /* This only blocks ridiculously long input - the actual length of the
resulting barcode depends on the type of data, so this is trapped later */ resulting barcode depends on the type of data, so this is trapped later */

View File

@ -57,40 +57,31 @@ static const int C16KStopValues[16] = {
}; };
INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int length) { INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int length) {
char width_pattern[100]; char width_pattern[40]; /* 4 (start) + 1 (guard) + 5*6 (chars) + 4 (stop) + 1 */
int current_row, rows, looper, first_check, second_check; int current_row, rows, looper, first_check, second_check;
int indexchaine; int indexchaine;
int list[2][C128_MAX] = {{0}}; int list[2][C128_MAX] = {{0}};
char set[C128_MAX] = {0}, fset[C128_MAX], mode, last_set, current_set; char set[C128_MAX] = {0}, fset[C128_MAX] = {0}, mode, current_set;
int pads_needed, indexliste, i, m, read, mx_reader; int pads_needed, indexliste, i, m, read, mx_reader;
int extra_pads = 0; int extra_pads = 0;
int values[C128_MAX] = {0}; int values[C128_MAX] = {0};
int bar_characters; int bar_characters;
float glyph_count;
int error_number = 0, first_sum, second_sum; int error_number = 0, first_sum, second_sum;
int input_length; const int gs1 = (symbol->input_mode & 0x07) == GS1_MODE;
int gs1; const int debug_print = symbol->debug & ZINT_DEBUG_PRINT;
/* Suppresses clang-analyzer-core.UndefinedBinaryOperatorResult warning on fset which is fully set */ if (length > C128_MAX) {
assert(length > 0);
input_length = length;
if ((symbol->input_mode & 0x07) == GS1_MODE) {
gs1 = 1;
} else {
gs1 = 0;
}
if (input_length > C128_MAX) {
strcpy(symbol->errtxt, "420: Input too long"); strcpy(symbol->errtxt, "420: Input too long");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
bar_characters = 0; if (symbol->option_1 == 1 || symbol->option_1 > 16) {
strcpy(symbol->errtxt, "424: Minimum number of rows out of range (2 to 16)");
return ZINT_ERROR_INVALID_OPTION;
}
/* Detect extended ASCII characters */ /* Detect extended ASCII characters */
for (i = 0; i < input_length; i++) { for (i = 0; i < length; i++) {
fset[i] = source[i] >= 128 ? 'f' : ' '; fset[i] = source[i] >= 128 ? 'f' : ' ';
} }
/* Note to be safe not using extended ASCII latch as not mentioned in BS EN 12323:2005 */ /* Note to be safe not using extended ASCII latch as not mentioned in BS EN 12323:2005 */
@ -103,10 +94,10 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len
do { do {
list[1][indexliste] = mode; list[1][indexliste] = mode;
while ((list[1][indexliste] == mode) && (indexchaine < input_length)) { while ((list[1][indexliste] == mode) && (indexchaine < length)) {
list[0][indexliste]++; list[0][indexliste]++;
indexchaine++; indexchaine++;
if (indexchaine == input_length) { if (indexchaine == length) {
break; break;
} }
mode = c128_parunmodd(source[indexchaine]); mode = c128_parunmodd(source[indexchaine]);
@ -115,82 +106,17 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len
} /* FNC1 */ } /* FNC1 */
} }
indexliste++; indexliste++;
} while (indexchaine < input_length); } while (indexchaine < length);
c128_dxsmooth(list, &indexliste); c128_dxsmooth(list, &indexliste);
/* Put set data into set[], resolving odd C blocks */ /* Put set data into set[], resolving odd C blocks */
c128_put_in_set(list, indexliste, set, source); c128_put_in_set(list, indexliste, set, source);
if (symbol->debug & ZINT_DEBUG_PRINT) { if (debug_print) {
printf("Data: %.*s\n", input_length, source); printf("Data: %.*s\n", length, source);
printf(" Set: %.*s\n", input_length, set); printf(" Set: %.*s\n", length, set);
printf("FSet: %.*s\n", input_length, fset); printf("FSet: %.*s\n", length, fset);
}
/* Make sure the data will fit in the symbol */
last_set = set[0];
glyph_count = 0.0f;
for (i = 0; i < input_length; i++) {
if ((set[i] == 'a') || (set[i] == 'b')) {
glyph_count = glyph_count + 1.0f;
}
if (fset[i] == 'f') {
glyph_count = glyph_count + 1.0f;
}
if (((set[i] == 'A') || (set[i] == 'B')) || (set[i] == 'C')) {
if (set[i] != last_set) {
last_set = set[i];
glyph_count = glyph_count + 1.0f;
}
}
if (i == 0) {
if ((set[i] == 'B') && (set[1] == 'C')) {
glyph_count = glyph_count - 1.0f;
}
if ((set[i] == 'B') && (set[1] == 'B')) {
if (set[2] == 'C') {
glyph_count = glyph_count - 1.0f;
}
}
}
if ((set[i] == 'C') && (!((gs1) && (source[i] == '[')))) {
glyph_count = glyph_count + 0.5f;
} else {
glyph_count = glyph_count + 1.0f;
}
}
if ((gs1) && (set[0] != 'A')) {
/* FNC1 can be integrated with mode character */
glyph_count--;
}
if (glyph_count > 77.0f) {
strcpy(symbol->errtxt, "421: Input too long");
return ZINT_ERROR_TOO_LONG;
}
/* Calculate how tall the symbol will be */
glyph_count = glyph_count + 2.0f;
i = (int) glyph_count;
rows = (i / 5);
if (i % 5 > 0) {
rows++;
}
if (rows == 1) {
rows = 2;
}
if (symbol->option_1 >= 2 && symbol->option_1 <= 16) { /* Minimum no. of rows */
if (symbol->option_1 > rows) {
extra_pads = (symbol->option_1 - rows) * 5;
rows = symbol->option_1;
}
} else if (symbol->option_1 >= 1) {
strcpy(symbol->errtxt, "424: Minimum number of rows out of range (2 to 16)");
return ZINT_ERROR_INVALID_OPTION;
} }
/* start with the mode character - Table 2 */ /* start with the mode character - Table 2 */
@ -205,20 +131,17 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len
} }
if (symbol->output_options & READER_INIT) { if (symbol->output_options & READER_INIT) {
if (m == 2) {
m = 5;
}
if (gs1) { if (gs1) {
strcpy(symbol->errtxt, "422: Cannot use both GS1 mode and Reader Initialisation"); strcpy(symbol->errtxt, "422: Cannot use both GS1 mode and Reader Initialisation");
return ZINT_ERROR_INVALID_OPTION; return ZINT_ERROR_INVALID_OPTION;
} else { }
if ((set[0] == 'B') && (set[1] == 'C')) { if (m == 2) {
m = 5;
} else if ((set[0] == 'B') && (set[1] == 'C') && fset[0] != 'f') {
m = 6; m = 6;
} }
} values[1] = 96; /* FNC3 */
values[bar_characters] = (7 * (rows - 2)) + m; /* see 4.3.4.2 */ bar_characters = 2;
values[bar_characters + 1] = 96; /* FNC3 */
bar_characters += 2;
} else { } else {
if (gs1) { if (gs1) {
/* Integrate FNC1 */ /* Integrate FNC1 */
@ -230,43 +153,36 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len
} }
} else { } else {
if ((set[0] == 'B') && (set[1] == 'C')) { if ((set[0] == 'B') && (set[1] == 'C')) {
m = 5; m = fset[0] == 'f' ? 6 : 5;
} } else if ((set[0] == 'B') && (set[1] == 'B') && (set[2] == 'C') && fset[0] != 'f' && fset[1] != 'f') {
if (((set[0] == 'B') && (set[1] == 'B')) && (set[2] == 'C')) {
m = 6; m = 6;
} }
} }
values[bar_characters] = (7 * (rows - 2)) + m; /* see 4.3.4.2 */ bar_characters = 1;
bar_characters++;
} }
current_set = set[0]; current_set = set[0];
read = 0; read = 0;
/* Encode the data */ /* Encode the data */
/* TODO: make use of extra (non-CODE128) shifts: 1SB, 2SA/B/C, 3SB/C */
do { do {
if ((read != 0) && (set[read] != set[read - 1])) { if ((read != 0) && (set[read] != current_set)) {
/* Latch different code set */ /* Latch different code set */
switch (set[read]) { switch (set[read]) {
case 'A': case 'A':
values[bar_characters] = 101; values[bar_characters++] = 101;
bar_characters++;
current_set = 'A'; current_set = 'A';
break; break;
case 'B': case 'B':
values[bar_characters] = 100; values[bar_characters++] = 100;
bar_characters++;
current_set = 'B'; current_set = 'B';
break; break;
case 'C': case 'C':
if (!((read == 1) && (set[0] == 'B'))) { /* If not Mode C/Shift B and not Mode C/Double Shift B */
/* Not Mode C/Shift B */ if (!(read == 1 && m >= 5) && !(read == 2 && m == 6)) {
if (!((read == 2) && ((set[0] == 'B') && (set[1] == 'B')))) { values[bar_characters++] = 99;
/* Not Mode C/Double Shift B */
values[bar_characters] = 99;
bar_characters++;
}
} }
current_set = 'C'; current_set = 'C';
break; break;
@ -277,31 +193,27 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len
/* Shift extended mode */ /* Shift extended mode */
switch (current_set) { switch (current_set) {
case 'A': case 'A':
values[bar_characters] = 101; /* FNC 4 */ values[bar_characters++] = 101; /* FNC 4 */
break; break;
case 'B': case 'B':
values[bar_characters] = 100; /* FNC 4 */ values[bar_characters++] = 100; /* FNC 4 */
break; break;
} }
bar_characters++;
} }
if ((set[read] == 'a') || (set[read] == 'b')) { if ((set[read] == 'a') || (set[read] == 'b')) {
/* Insert shift character */ /* Insert shift character */
values[bar_characters] = 98; values[bar_characters++] = 98;
bar_characters++;
} }
if (!((gs1) && (source[read] == '['))) { if (!((gs1) && (source[read] == '['))) {
switch (set[read]) { /* Encode data characters */ switch (set[read]) { /* Encode data characters */
case 'A': case 'A':
case 'a': case 'a': c128_set_a(source[read], values, &bar_characters);
c128_set_a(source[read], values, &bar_characters);
read++; read++;
break; break;
case 'B': case 'B':
case 'b': case 'b': (void) c128_set_b(source[read], values, &bar_characters);
c128_set_b(source[read], values, &bar_characters);
read++; read++;
break; break;
case 'C': c128_set_c(source[read], source[read + 1], values, &bar_characters); case 'C': c128_set_c(source[read], source[read + 1], values, &bar_characters);
@ -309,11 +221,15 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len
break; break;
} }
} else { } else {
values[bar_characters] = 102; values[bar_characters++] = 102;
bar_characters++;
read++; read++;
} }
} while (read < input_length);
if (bar_characters > 80 - 2) { /* Max rows 16 * 5 - 2 check chars */
strcpy(symbol->errtxt, "421: Input too long");
return ZINT_ERROR_TOO_LONG;
}
} while (read < length);
pads_needed = 5 - ((bar_characters + 2) % 5); pads_needed = 5 - ((bar_characters + 2) % 5);
if (pads_needed == 5) { if (pads_needed == 5) {
@ -322,11 +238,18 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len
if ((bar_characters + pads_needed) < 8) { if ((bar_characters + pads_needed) < 8) {
pads_needed += 8 - (bar_characters + pads_needed); pads_needed += 8 - (bar_characters + pads_needed);
} }
for (i = 0; i < pads_needed + extra_pads; i++) {
values[bar_characters] = 103; rows = (bar_characters + pads_needed + 4) / 5;
bar_characters++; if (symbol->option_1 > rows) {
extra_pads = (symbol->option_1 - rows) * 5;
rows = symbol->option_1;
} }
for (i = 0; i < pads_needed + extra_pads; i++) {
values[bar_characters++] = 103;
}
values[0] = (7 * (rows - 2)) + m; /* see 4.3.4.2 */
/* Calculate check digits */ /* Calculate check digits */
first_sum = 0; first_sum = 0;
second_sum = 0; second_sum = 0;
@ -341,10 +264,13 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len
values[bar_characters + 1] = second_check; values[bar_characters + 1] = second_check;
bar_characters += 2; bar_characters += 2;
if (symbol->debug & ZINT_DEBUG_PRINT) { if (debug_print) {
printf("Codewords:"); printf("Codewords (%d):", bar_characters);
for (i = 0; i < bar_characters; i++) { for (i = 0; i < bar_characters; i++) {
printf(" %d", values[i]); if (i % 5 == 0) {
printf("\n");
}
printf(" %3d", values[i]);
} }
printf("\n"); printf("\n");
} }
@ -354,6 +280,8 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len
} }
#endif #endif
assert(rows * 5 == bar_characters);
for (current_row = 0; current_row < rows; current_row++) { for (current_row = 0; current_row < rows; current_row++) {
int writer; int writer;
int flip_flop; int flip_flop;
@ -376,16 +304,10 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len
for (looper = 0; looper < ctoi(width_pattern[mx_reader]); looper++) { for (looper = 0; looper < ctoi(width_pattern[mx_reader]); looper++) {
if (flip_flop == 1) { if (flip_flop == 1) {
set_module(symbol, current_row, writer); set_module(symbol, current_row, writer);
writer++; }
} else {
writer++; writer++;
} }
} flip_flop = !flip_flop;
if (flip_flop == 0) {
flip_flop = 1;
} else {
flip_flop = 0;
}
} }
} }

View File

@ -1357,6 +1357,7 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
} }
if (next_mode != DM_X12) { if (next_mode != DM_X12) {
sp -= process_p; /* About to throw away buffer, need to re-process input, cf Okapi commit [fb7981e] */
process_p = 0; /* Throw away buffer if any */ process_p = 0; /* Throw away buffer if any */
target[tp++] = 254; /* Unlatch */ target[tp++] = 254; /* Unlatch */
next_mode = DM_ASCII; next_mode = DM_ASCII;
@ -1390,7 +1391,7 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
} else { } else {
next_mode = DM_EDIFACT; next_mode = DM_EDIFACT;
if (process_p == 3) { if (process_p == 3) {
/* Note different then spec Step (f)(2), which suggests checking when 0, but this seems to /* Note different than spec Step (f)(2), which suggests checking when 0, but this seems to
work better in many cases as the switch to ASCII is "free" */ work better in many cases as the switch to ASCII is "free" */
next_mode = dm_look_ahead_test(source, length, sp, current_mode, process_p, gs1, debug_print); next_mode = dm_look_ahead_test(source, length, sp, current_mode, process_p, gs1, debug_print);
} }

View File

@ -173,6 +173,11 @@ static void test_input(const testCtx *const p_ctx) {
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol;
char cmp_buf[8192];
char cmp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
testStart("test_input"); testStart("test_input");
for (i = 0; i < data_size; i++) { for (i = 0; i < data_size; i++) {
@ -190,6 +195,17 @@ static void test_input(const testCtx *const p_ctx) {
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width);
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump);
}
} }
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);

View File

@ -252,12 +252,14 @@ static void test_input(const testCtx *const p_ctx) {
struct item { struct item {
int symbology; int symbology;
int input_mode; int input_mode;
int option_1;
int option_2; int option_2;
char *data; char *data;
int length; int length;
int ret; int ret;
int expected_rows; int expected_rows;
int expected_width; int expected_width;
int bwipp_cmp;
char *expected; char *expected;
char *comment; char *comment;
}; };
@ -277,51 +279,63 @@ static void test_input(const testCtx *const p_ctx) {
ÿ U+00FF (\377, 255), UTF-8 C3BF, CodeB-only extended ASCII ÿ U+00FF (\377, 255), UTF-8 C3BF, CodeB-only extended ASCII
*/ */
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "A", -1, 0, 2, 101, "67 64 40 21 63 64 63 42 6A 67 64 0B 63 64 2B 40 4F 6A", "Fillings 5" }, /* 0*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "A", -1, 0, 2, 101, 1, "67 64 40 21 63 64 63 42 6A 67 64 0B 63 64 2B 40 4F 6A", "Fillings 5" },
/* 1*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "AAA", -1, 0, 2, 101, "67 64 40 21 21 21 63 55 6A 67 64 0B 63 64 0E 57 48 6A", "Fillings 3" }, /* 1*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "AAA", -1, 0, 2, 101, 1, "67 64 40 21 21 21 63 55 6A 67 64 0B 63 64 0E 57 48 6A", "Fillings 3" },
/* 2*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "AAAA", -1, 0, 2, 101, "67 64 40 21 21 21 21 65 6A 67 64 0B 63 64 1A 0E 03 6A", "Fillings 2" }, /* 2*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "AAAA", -1, 0, 2, 101, 1, "67 64 40 21 21 21 21 65 6A 67 64 0B 63 64 1A 0E 03 6A", "Fillings 2" },
/* 3*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "AAAAA", -1, 0, 2, 101, "67 64 40 21 21 21 21 65 6A 67 64 0B 21 63 1D 30 14 6A", "Fillings 1" }, /* 3*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "AAAAA", -1, 0, 2, 101, 1, "67 64 40 21 21 21 21 65 6A 67 64 0B 21 63 1D 30 14 6A", "Fillings 1" },
/* 4*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "AAAAAA", -1, 0, 2, 101, "67 64 40 21 21 21 21 65 6A 67 64 0B 21 21 35 5D 2B 6A", "Fillings 0" }, /* 4*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "AAAAAA", -1, 0, 2, 101, 1, "67 64 40 21 21 21 21 65 6A 67 64 0B 21 21 35 5D 2B 6A", "Fillings 0" },
/* 5*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "1234", -1, 0, 2, 101, "67 63 00 0C 22 64 63 1A 6A 67 64 0B 63 64 3A 1C 29 6A", "Fillings 4" }, /* 5*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "1234", -1, 0, 2, 101, 1, "67 63 00 0C 22 64 63 1A 6A 67 64 0B 63 64 3A 1C 29 6A", "Fillings 4" },
/* 6*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "12345", -1, 0, 2, 101, "67 63 00 0C 22 64 15 49 6A 67 64 0B 63 64 41 44 07 6A", "Fillings 2 (not counting CodeB at end of 1st line)" }, /* 6*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "12345", -1, 0, 2, 101, 1, "67 63 00 0C 22 64 15 49 6A 67 64 0B 63 64 41 44 07 6A", "Fillings 2 (not counting CodeB at end of 1st line)" },
/* 7*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "123456", -1, 0, 2, 101, "67 63 00 0C 22 38 64 12 6A 67 64 0B 63 64 2D 50 52 6A", "Fillings 3" }, /* 7*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "123456", -1, 0, 2, 101, 1, "67 63 00 0C 22 38 64 12 6A 67 64 0B 63 64 2D 50 52 6A", "Fillings 3" },
/* 8*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "1234567", -1, 0, 2, 101, "67 63 00 0C 22 38 64 12 6A 67 64 0B 17 63 16 02 5B 6A", "Fillings 1 (not counting CodeB at end of 1st line)" }, /* 8*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "1234567", -1, 0, 2, 101, 1, "67 63 00 0C 22 38 64 12 6A 67 64 0B 17 63 16 02 5B 6A", "Fillings 1 (not counting CodeB at end of 1st line)" },
/* 9*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "12345678", -1, 0, 2, 101, "67 63 00 0C 22 38 4E 5C 6A 67 64 0B 63 64 08 1C 64 6A", "Fillings 2" }, /* 9*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "12345678", -1, 0, 2, 101, 1, "67 63 00 0C 22 38 4E 5C 6A 67 64 0B 63 64 08 1C 64 6A", "Fillings 2" },
/* 10*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "123456789", -1, 0, 2, 101, "67 63 00 0C 22 38 4E 5C 6A 67 64 0B 19 63 25 4C 65 6A", "Fillings 1" }, /* 10*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "123456789", -1, 0, 2, 101, 1, "67 63 00 0C 22 38 4E 5C 6A 67 64 0B 19 63 25 4C 65 6A", "Fillings 1" },
/* 11*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "1234567890", -1, 0, 2, 101, "67 63 00 0C 22 38 4E 5C 6A 67 64 0B 19 10 41 38 62 6A", "Fillings 0" }, /* 11*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "1234567890", -1, 0, 2, 101, 0, "67 63 00 0C 22 38 4E 5C 6A 67 64 0B 19 10 41 38 62 6A", "Fillings 0; BWIPP different encodation (CodeB 9 0 instead of CodeC 90" },
/* 12*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "A123ñ", -1, 0, 2, 101, "67 64 40 21 11 12 13 54 6A 67 64 0B 64 51 42 28 50 6A", "K1/K2 example in Annex F" }, /* 12*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "A123ñ", -1, 0, 2, 101, 1, "67 64 40 21 11 12 13 54 6A 67 64 0B 64 51 42 28 50 6A", "K1/K2 example in Annex F" },
/* 13*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "", -1, 0, 2, 101, "67 64 40 41 64 3F 63 54 6A 67 64 0B 63 64 5B 1D 06 6A", "CodeB a FNC4 ß fits 1st line" }, /* 13*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "", -1, 0, 2, 101, 1, "67 64 40 41 64 3F 63 54 6A 67 64 0B 63 64 5B 1D 06 6A", "CodeB a FNC4 ß fits 1st line" },
/* 14*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "\037ß", -1, 0, 2, 101, "67 62 40 5F 65 3F 63 49 6A 67 64 0B 63 64 0F 1D 26 6A", "CodeA US FNC4 ß fits 1st line" }, /* 14*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037ß", -1, 0, 2, 101, 1, "67 62 40 5F 65 3F 63 49 6A 67 64 0B 63 64 0F 1D 26 6A", "CodeA US FNC4 ß fits 1st line" },
/* 15*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "aaß", -1, 0, 2, 101, "67 64 40 41 41 64 3F 10 6A 67 64 0B 63 64 4E 5B 04 6A", "CodeB a a FNC4 ß fits 1st line" }, /* 15*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aaß", -1, 0, 2, 101, 1, "67 64 40 41 41 64 3F 10 6A 67 64 0B 63 64 4E 5B 04 6A", "CodeB a a FNC4 ß fits 1st line" },
/* 16*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "\037\037ß", -1, 0, 2, 101, "67 62 40 5F 5F 65 3F 17 6A 67 64 0B 63 64 34 0F 24 6A", "CodeA US US FNC4 ß fits 1st line" }, /* 16*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037\037ß", -1, 0, 2, 101, 1, "67 62 40 5F 5F 65 3F 17 6A 67 64 0B 63 64 34 0F 24 6A", "CodeA US US FNC4 ß fits 1st line" },
/* 17*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "aaaß", -1, 0, 2, 101, "67 64 40 41 41 41 63 39 6A 67 64 0B 64 3F 4C 4E 50 6A", "CodeB a (3) / CodeB FNC4 ß fully on next line" }, /* 17*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aaaß", -1, 0, 2, 101, 1, "67 64 40 41 41 41 63 39 6A 67 64 0B 64 3F 4C 4E 50 6A", "CodeB a (3) / CodeB FNC4 ß fully on next line" },
/* 18*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "\037\037\037ß", -1, 0, 2, 101, "67 62 40 5F 5F 5F 63 03 6A 67 64 0B 64 3F 0E 34 1A 6A", "CodeA US (3) / CodeB FNC4 ß fully on next line" }, /* 18*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037\037\037ß", -1, 0, 2, 101, 1, "67 62 40 5F 5F 5F 63 03 6A 67 64 0B 64 3F 0E 34 1A 6A", "CodeA US (3) / CodeB FNC4 ß fully on next line" },
/* 19*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "", -1, 0, 2, 101, "67 64 40 41 64 40 63 59 6A 67 64 0B 63 64 5D 1E 16 6A", "CodeB a FNC4 à fits 1st line" }, /* 19*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "", -1, 0, 2, 101, 1, "67 64 40 41 64 40 63 59 6A 67 64 0B 63 64 5D 1E 16 6A", "CodeB a FNC4 à fits 1st line" },
/* 20*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "\037à", -1, 0, 2, 101, "67 62 40 5F 65 62 40 26 6A 67 64 0B 63 64 1B 1E 01 6A", "CodeA US FNC4 Shift à fits 1st line" }, /* 20*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037à", -1, 0, 2, 101, 0, "67 62 40 5F 65 62 40 26 6A 67 64 0B 63 64 1B 1E 01 6A", "CodeA US FNC4 Shift à fits 1st line; BWIPP different encodation (CodeB instead of Shift)" },
/* 21*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "\037àa", -1, 0, 2, 101, "67 62 40 5F 64 64 40 2C 6A 67 64 0B 41 63 52 4A 16 6A", "CodeA US LatchB FNC4 à fits 1st line / Code B a" }, /* 21*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037àa", -1, 0, 2, 101, 0, "67 62 40 5F 64 64 40 2C 6A 67 64 0B 41 63 52 4A 16 6A", "CodeA US LatchB FNC4 à fits 1st line / Code B a; BWIPP diffent encodation (as above)" },
/* 22*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "aaà", -1, 0, 2, 101, "67 64 40 41 41 64 40 16 6A 67 64 0B 63 64 51 5D 1F 6A", "CodeB a a FNC4 à fits 1st line" }, /* 22*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aaà", -1, 0, 2, 101, 1, "67 64 40 41 41 64 40 16 6A 67 64 0B 63 64 51 5D 1F 6A", "CodeB a a FNC4 à fits 1st line" },
/* 23*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "\037\037à", -1, 0, 2, 101, "67 62 40 5F 5F 63 64 1D 6A 67 64 0B 64 40 37 1B 55 6A", "CodeA US US / Code B FNC4 à fully on next line" }, /* 23*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037\037à", -1, 0, 2, 101, 1, "67 62 40 5F 5F 63 64 1D 6A 67 64 0B 64 40 37 1B 55 6A", "CodeA US US / Code B FNC4 à fully on next line" },
/* 24*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "aaaà", -1, 0, 2, 101, "67 64 40 41 41 41 63 39 6A 67 64 0B 64 40 50 51 13 6A", "CodeB a (3) / Code B FNC4 à fully on next line" }, /* 24*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "aaaà", -1, 0, 2, 101, 1, "67 64 40 41 41 41 63 39 6A 67 64 0B 64 40 50 51 13 6A", "CodeB a (3) / Code B FNC4 à fully on next line" },
/* 25*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "\037\037\037à", -1, 0, 2, 101, "67 62 40 5F 5F 5F 63 03 6A 67 64 0B 64 40 1C 37 0F 6A", "CodeA US (3) / CodeB FNC4 à fully on next line" }, /* 25*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\037\037\037à", -1, 0, 2, 101, 1, "67 62 40 5F 5F 5F 63 03 6A 67 64 0B 64 40 1C 37 0F 6A", "CodeA US (3) / CodeB FNC4 à fully on next line" },
/* 26*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, "\037\200", -1, 0, 2, 101, "67 62 40 5F 65 40 63 4E 6A 67 64 0B 63 64 5D 0A 05 6A", "CodeA US FNC4 PAD fits 1st line" }, /* 26*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\037\200", -1, 0, 2, 101, 1, "67 62 40 5F 65 40 63 4E 6A 67 64 0B 63 64 5D 0A 05 6A", "CodeA US FNC4 PAD fits 1st line" },
/* 27*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, "\141\200", -1, 0, 2, 101, "67 64 40 41 64 62 40 31 6A 67 64 0B 63 64 49 0A 08 6A", "CodeB a FNC4 Shift PAD fits 1st line" }, /* 27*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\141\200", -1, 0, 2, 101, 0, "67 64 40 41 64 62 40 31 6A 67 64 0B 63 64 49 0A 08 6A", "CodeB a FNC4 Shift PAD fits 1st line; BWIPP different encodation (CodeA instead of Shift)" },
/* 28*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, "\141\200\037", -1, 0, 2, 101, "67 64 40 41 65 65 40 44 6A 67 62 0B 5F 63 10 12 3E 6A", "CodeB a LatchA FNC4 PAD fits 1st line / CodeA US" }, /* 28*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\141\200\037", -1, 0, 2, 101, 0, "67 64 40 41 65 65 40 44 6A 67 62 0B 5F 63 10 12 3E 6A", "CodeB a LatchA FNC4 PAD fits 1st line / CodeA US; BWIPP diffent encodation (as above)" },
/* 29*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, "\037\037\200", -1, 0, 2, 101, "67 62 40 5F 5F 65 40 1D 6A 67 64 0B 63 64 0F 5D 0A 6A", "CodeA US US FNC4 PAD fits 1st line" }, /* 29*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\037\037\200", -1, 0, 2, 101, 1, "67 62 40 5F 5F 65 40 1D 6A 67 64 0B 63 64 0F 5D 0A 6A", "CodeA US US FNC4 PAD fits 1st line" },
/* 30*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, "\141\141\200", -1, 0, 2, 101, "67 64 40 41 41 63 64 1B 6A 67 62 0B 65 40 33 49 21 6A", "CodeB a a / CodeA FNC4 PAD fully on next line" }, /* 30*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\141\141\200", -1, 0, 2, 101, 1, "67 64 40 41 41 63 64 1B 6A 67 62 0B 65 40 33 49 21 6A", "CodeB a a / CodeA FNC4 PAD fully on next line" },
/* 31*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, "\037\037\037\200", -1, 0, 2, 101, "67 62 40 5F 5F 5F 63 03 6A 67 62 0B 65 40 4A 0F 06 6A", "CodeA US (3) / CodeA FNC4 PAD fully on next line" }, /* 31*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\037\037\037\200", -1, 0, 2, 101, 1, "67 62 40 5F 5F 5F 63 03 6A 67 62 0B 65 40 4A 0F 06 6A", "CodeA US (3) / CodeA FNC4 PAD fully on next line" },
/* 32*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, "\141\141\141\200", -1, 0, 2, 101, "67 64 40 41 41 41 63 39 6A 67 62 0B 65 40 28 33 34 6A", "CodeB a (3) / CodeA FNC4 PAD fully on next line" }, /* 32*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, -1, "\141\141\141\200", -1, 0, 2, 101, 1, "67 64 40 41 41 41 63 39 6A 67 62 0B 65 40 28 33 34 6A", "CodeB a (3) / CodeA FNC4 PAD fully on next line" },
/* 33*/ { BARCODE_CODABLOCKF, DATA_MODE, 10, "\200\240\237\340\337\341\377", -1, 0, 4, 112, "(40) 67 62 42 65 40 65 00 63 1E 6A 67 62 0B 65 5F 64 64 40 55 6A 67 64 0C 64 3F 64 41 63", "" }, /* 33*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, 10, "\200\240\237\340\337\341\377", -1, 0, 4, 112, 0, "(40) 67 62 42 65 40 65 00 63 1E 6A 67 62 0B 65 5F 64 64 40 55 6A 67 64 0C 64 3F 64 41 63", "BWIPP different encodation (CodeB before FNC4 instead of after)" },
/* 34*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "\000a\037\177}12", 7, 0, 3, 101, "67 62 41 40 62 41 5F 3B 6A 67 64 0B 5F 5D 11 12 2D 6A 67 64 0C 63 64 40 05 26 6A", "" }, /* 34*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "\000a\037\177}12", 7, 0, 3, 101, 1, "67 62 41 40 62 41 5F 3B 6A 67 64 0B 5F 5D 11 12 2D 6A 67 64 0C 63 64 40 05 26 6A", "" },
/* 35*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "abcdéf", -1, 0, 3, 101, "67 64 41 41 42 43 44 5D 6A 67 64 0B 64 49 46 63 0A 6A 67 64 0C 63 64 4F 26 02 6A", "" }, /* 35*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "abcdéf", -1, 0, 3, 101, 1, "67 64 41 41 42 43 44 5D 6A 67 64 0B 64 49 46 63 0A 6A 67 64 0C 63 64 4F 26 02 6A", "" },
/* 36*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, "a12é\000", 6, 0, 3, 101, "67 64 41 41 11 12 63 2C 6A 67 64 0B 64 49 62 40 2B 6A 67 64 0C 63 64 33 34 31 6A", "" }, /* 36*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "a12é\000", 6, 0, 3, 101, 0, "67 64 41 41 11 12 63 2C 6A 67 64 0B 64 49 62 40 2B 6A 67 64 0C 63 64 33 34 31 6A", "BWIPP different encodation (CodeA instead of Shift)" },
/* 37*/ { BARCODE_CODABLOCKF, UNICODE_MODE, 11, "1234\001", -1, 0, 2, 123, "67 63 00 0C 22 65 41 63 64 54 6A 67 64 0B 63 64 63 64 3F 20 24 6A", "" }, /* 37*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, 11, "1234\001", -1, 0, 2, 123, 1, "67 63 00 0C 22 65 41 63 64 54 6A 67 64 0B 63 64 63 64 3F 20 24 6A", "" },
/* 38*/ { BARCODE_HIBC_BLOCKF, UNICODE_MODE, -1, "A99912345/$$52001510X3", -1, 0, 6, 101, "(54) 67 64 44 0B 21 19 19 3A 6A 67 63 2B 5B 17 2D 64 24 6A 67 64 0C 0F 04 04 15 16 6A 67", "" }, /* 38*/ { BARCODE_CODABLOCKF, UNICODE_MODE, 3, -1, "ÁÁÁÁÁÁ99999999999999ÁÁÁÁÁÁÁ99999999999999Á", -1, 0, 3, 244, 1, "(66) 67 64 41 64 21 64 21 64 21 64 21 64 21 64 21 63 63 63 63 63 56 6A 67 63 2B 63 63 63", "Latching to extended ASCII not used by `codablockf()` (see test_code128 Okapi)" },
/* 39*/ { BARCODE_CODABLOCKF, DATA_MODE, 2, -1, "@g(\302\302\302\302\3025555\302\302\302\302\302\302\302\302", -1, 0, 2, 255, 1, "(46) 67 64 40 20 47 08 64 22 64 22 64 22 64 22 64 22 63 37 37 64 63 4B 6A 67 64 0B 64 22", "Must allow for FNC4 when testing if enough room when switching from CodeC" },
/* 40*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "ÿ\012àa\0121\012àAà", -1, 0, 5, 101, 0, "(45) 67 64 43 64 5F 65 4A 09 6A 67 64 0B 64 40 41 63 34 6A 67 62 0C 4A 11 4A 63 25 6A 67", "BWIPP different encoding (Shift instead of CodeA)" },
/* 41*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "ÿy1234\012àa\0121\0127890àAàDà\012à", -1, 0, 7, 112, 0, "(70) 67 64 45 64 5F 59 11 12 2E 6A 67 62 0B 13 14 4A 63 64 43 6A 67 64 0C 64 40 41 65 4A", "BWIPP different encoding (Shift instead of CodeA)" },
/* 42*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "ÿ12345678\012à12345678abcdef\0121\01223456\012\0127890àAàBCDEFà\012\012à", -1, 0, 8, 134, 0, "(96) 67 64 46 64 5F 63 0C 22 38 4E 5E 6A 67 62 0B 4A 64 64 40 63 0C 22 2B 6A 67 63 2C 38", "BWIPP different encoding (CodeB before FNC4 instead of after)" },
/* 43*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé12345123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2" "B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé6789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890àààààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\012123456à\012à\012à\0123Ä4Ä5Ä6AÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécéÄÄÄÄÄÄ2ÄÄÄÄÄÄÄÄ4ÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécéÄÄÄAÄÄÄÄÄÄaÄÄÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé", -1, 0, 44, 739, 0, "(2948) 67 63 2A 0C 22 38 4E 5A 0C 22 65 15 21 22 23 24 25 26 27 28 29 4A 63 0C 22 38 64", "BWIPP gs command too long" },
/* 44*/ { BARCODE_CODABLOCKF, UNICODE_MODE, -1, -1, "ÿ12345678\012à12345678abcdef\012\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890ààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄÄÄÄÄ2ÄÄÄÄÄÄ4ÄÄÄÄÄÄaÄÄÄÄé1é2é34é56Ä78é9éAéBéCéééééaébécé123456789012345ABCDEFGHI\012123456ÿ12345678\012à12345678abcdef\012123456\012\0127890àABCDEFà\012\012ààGHIJKàLMNOPQabc\012defà1234567ghijk\012\012à901234\0122567890àààààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2B3C4a5b6c7d8e9\0120\0121\0122\0123Ä4Ä5Ä6A7a8A9a0\012Ä12345678ÄÄ2Ä4ÄaÄé1é2é34é56Ä78é9éAéBéCééaébécé123456789012345ABCDEF\012123456ÿ123456\012à12345678abcdef\012\0121234\012\0127890àABCDà\012\012ààGHIJKàLMabc\012defà1234567ghijk\012\012à901234\012\012\012\012567890ààABCDEFGààà\012\012\012HIJK\012\012\012\012à\012à\012à\01212345à\012à\012à67890ààÄ9012ÄÄ56789Ä12Ä3\0124\0125\0126A\012a\012A\012A\012a\012a\012BCD1A2", -1, 0, 33, 387, 0, "(1155) 67 64 5F 64 5F 63 0C 22 38 4E 65 4A 64 64 40 63 0C 22 38 4E 64 41 42 43 44 45 46", "BWIPP different encodation" },
/* 45*/ { BARCODE_HIBC_BLOCKF, UNICODE_MODE, -1, -1, "A99912345/$$52001510X3", -1, 0, 6, 101, 1, "(54) 67 64 44 0B 21 19 19 3A 6A 67 63 2B 5B 17 2D 64 24 6A 67 64 0C 0F 04 04 15 16 6A 67", "" },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol;
char escaped[1024]; char escaped[16834];
char cmp_buf[32768];
char cmp_msg[32768];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
testStart("test_input"); testStart("test_input");
@ -334,21 +348,47 @@ static void test_input(const testCtx *const p_ctx) {
symbol->debug = ZINT_DEBUG_TEST; /* Needed to get codeword dump in errtxt */ symbol->debug = ZINT_DEBUG_TEST; /* Needed to get codeword dump in errtxt */
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, %s, %d, \"%s\", %d, %s, %d, %d, \"%s\", \"%s\" },\n", printf(" /*%3d*/ { %s, %s, %d, %d, \"%s\", %d, %s, %d, %d, %d, \"%s\", \"%s\" },\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].option_2, i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2,
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length,
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, symbol->errtxt, data[i].comment); testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, symbol->errtxt, data[i].comment);
} else { } else {
assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, debug)) {
if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else {
char modules_dump[32768];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump);
}
}
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
int cmp_len, ret_len;
char modules_dump[32768];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
}
} }
} }
@ -375,7 +415,7 @@ static void test_encode(const testCtx *const p_ctx) {
char *expected; char *expected;
}; };
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_CODABLOCKF, 1, -1, "AIM", 0, 1, 68, 1, "Same as CODE128 (not supported by BWIPP)", /* 0*/ { BARCODE_CODABLOCKF, 1, -1, "AIM", 0, 1, 68, 1, "Same as CODE128 (not supported by BWIPP or ZXing-C++)",
"11010010000101000110001100010001010111011000101110110001100011101011" "11010010000101000110001100010001010111011000101110110001100011101011"
}, },
/* 1*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAA", 0, 3, 101, 1, "Defaults to rows 3, columns 9 (4 data); verified manually against tec-it", /* 1*/ { BARCODE_CODABLOCKF, -1, -1, "AAAAAAA", 0, 3, 101, 1, "Defaults to rows 3, columns 9 (4 data); verified manually against tec-it",
@ -467,10 +507,11 @@ static void test_encode(const testCtx *const p_ctx) {
struct zint_symbol *symbol; struct zint_symbol *symbol;
char escaped[1024]; char escaped[1024];
char bwipp_buf[8192]; char cmp_buf[8192];
char bwipp_msg[1024]; char cmp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
testStart("test_encode"); testStart("test_encode");
@ -506,14 +547,25 @@ static void test_encode(const testCtx *const p_ctx) {
if (!data[i].bwipp_cmp) { if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment); if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else { } else {
ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf), NULL); ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected);
} }
} }
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
int cmp_len, ret_len;
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
}
} }
} }

View File

@ -307,6 +307,7 @@ static void test_input(const testCtx *const p_ctx) {
int length; int length;
int ret; int ret;
int expected_width; int expected_width;
int bwipp_cmp;
char *expected; char *expected;
char *comment; char *comment;
}; };
@ -321,47 +322,66 @@ static void test_input(const testCtx *const p_ctx) {
é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII
*/ */
struct item data[] = { struct item data[] = {
/* 0*/ { UNICODE_MODE, "\302\200", -1, ZINT_ERROR_INVALID_DATA, 0, "Error 204: Invalid character in input data (ISO/IEC 8859-1 only)", "PAD not in ISO 8859-1" }, /* 0*/ { UNICODE_MODE, "\302\200", -1, ZINT_ERROR_INVALID_DATA, 0, 1, "Error 204: Invalid character in input data (ISO/IEC 8859-1 only)", "PAD not in ISO 8859-1" },
/* 1*/ { DATA_MODE, "\200", -1, 0, 57, "(5) 103 101 64 23 106", "PAD ok using binary" }, /* 1*/ { DATA_MODE, "\200", -1, 0, 57, 1, "(5) 103 101 64 23 106", "PAD ok using binary" },
/* 2*/ { UNICODE_MODE, "AIM1234", -1, 0, 101, "(9) 104 33 41 45 99 12 34 87 106", "Example from Annex A.1, check char value 87" }, /* 2*/ { UNICODE_MODE, "AIM1234", -1, 0, 101, 1, "(9) 104 33 41 45 99 12 34 87 106", "Example from Annex A.1, check char value 87" },
/* 3*/ { GS1_MODE, "[90]12", -1, ZINT_ERROR_INVALID_OPTION, 0, "Error 220: Selected symbology does not support GS1 mode", "" }, /* 3*/ { GS1_MODE, "[90]12", -1, ZINT_ERROR_INVALID_OPTION, 0, 1, "Error 220: Selected symbology does not support GS1 mode", "" },
/* 4*/ { UNICODE_MODE, "1", -1, 0, 46, "(4) 104 17 18 106", "StartB 1" }, /* 4*/ { UNICODE_MODE, "1", -1, 0, 46, 1, "(4) 104 17 18 106", "StartB 1" },
/* 5*/ { UNICODE_MODE, "12", -1, 0, 46, "(4) 105 12 14 106", "StartC 12" }, /* 5*/ { UNICODE_MODE, "12", -1, 0, 46, 1, "(4) 105 12 14 106", "StartC 12" },
/* 6*/ { UNICODE_MODE, "123", -1, 0, 68, "(6) 104 17 18 19 8 106", "StartB 1 2 3" }, /* 6*/ { UNICODE_MODE, "123", -1, 0, 68, 1, "(6) 104 17 18 19 8 106", "StartB 1 2 3" },
/* 7*/ { UNICODE_MODE, "1234", -1, 0, 57, "(5) 105 12 34 82 106", "StartC 12 34" }, /* 7*/ { UNICODE_MODE, "1234", -1, 0, 57, 1, "(5) 105 12 34 82 106", "StartC 12 34" },
/* 8*/ { UNICODE_MODE, "12345", -1, 0, 79, "(7) 105 12 34 100 21 54 106", "StartC 12 34 CodeB 5" }, /* 8*/ { UNICODE_MODE, "12345", -1, 0, 79, 1, "(7) 105 12 34 100 21 54 106", "StartC 12 34 CodeB 5" },
/* 9*/ { UNICODE_MODE, "\037", -1, 0, 46, "(4) 103 95 95 106", "StartA US" }, /* 9*/ { UNICODE_MODE, "\037", -1, 0, 46, 1, "(4) 103 95 95 106", "StartA US" },
/* 10*/ { UNICODE_MODE, "1\037", -1, 0, 57, "(5) 103 17 95 1 106", "StartA 1 US" }, /* 10*/ { UNICODE_MODE, "1\037", -1, 0, 57, 1, "(5) 103 17 95 1 106", "StartA 1 US" },
/* 11*/ { UNICODE_MODE, "12\037", -1, 0, 68, "(6) 103 17 18 95 29 106", "StartA 1 2 US" }, /* 11*/ { UNICODE_MODE, "12\037", -1, 0, 68, 1, "(6) 103 17 18 95 29 106", "StartA 1 2 US" },
/* 12*/ { UNICODE_MODE, "a\037a", -1, 0, 79, "(7) 104 65 98 95 65 86 106", "StartB a Shift US a" }, /* 12*/ { UNICODE_MODE, "a\037a", -1, 0, 79, 1, "(7) 104 65 98 95 65 86 106", "StartB a Shift US a" },
/* 13*/ { UNICODE_MODE, "1234\037a", -1, 0, 101, "(9) 105 12 34 101 95 98 65 100 106", "StartC 12 34 CodeA US Shift a" }, /* 13*/ { UNICODE_MODE, "1234\037a", -1, 0, 101, 0, "(9) 105 12 34 101 95 98 65 100 106", "StartC 12 34 CodeA US Shift a; BWIPP different encodation" },
/* 14*/ { UNICODE_MODE, "\037AAa\037", -1, 0, 101, "(9) 103 95 33 33 98 65 95 2 106", "StartA US A A Shift a US" }, /* 14*/ { UNICODE_MODE, "\037AAa\037", -1, 0, 101, 1, "(9) 103 95 33 33 98 65 95 2 106", "StartA US A A Shift a US" },
/* 15*/ { UNICODE_MODE, "\037AAaa\037", -1, 0, 123, "(11) 103 95 33 33 100 65 65 98 95 40 106", "StartA US A A CodeB a a Shift US" }, /* 15*/ { UNICODE_MODE, "\037AAaa\037", -1, 0, 123, 0, "(11) 103 95 33 33 100 65 65 98 95 40 106", "StartA US A A CodeB a a Shift US; BWIPP different encodation" },
/* 16*/ { UNICODE_MODE, "AAAa12345aAA", -1, 0, 167, "(15) 104 33 33 33 65 17 99 23 45 100 65 33 33 54 106", "StartB A (3) a 1 CodeC 23 45 CodeB a A A" }, /* 16*/ { UNICODE_MODE, "AAAa12345aAA", -1, 0, 167, 1, "(15) 104 33 33 33 65 17 99 23 45 100 65 33 33 54 106", "StartB A (3) a 1 CodeC 23 45 CodeB a A A" },
/* 17*/ { UNICODE_MODE, "a\037Aa\037\037a\037aa\037a", -1, 0, 222, "(20) 104 65 98 95 33 65 101 95 95 98 65 95 100 65 65 98 95 65 96 106", "StartB a Shift US A a CodeA US US Shift a US CodeB a a Shift US a" }, /* 17*/ { UNICODE_MODE, "a\037Aa\037\037a\037aa\037a", -1, 0, 222, 1, "(20) 104 65 98 95 33 65 101 95 95 98 65 95 100 65 65 98 95 65 96 106", "StartB a Shift US A a CodeA US US Shift a US CodeB a a Shift US a" },
/* 18*/ { UNICODE_MODE, "\000\037ß", 4, 0, 79, "(7) 103 64 95 101 63 88 106", "StartA NUL US FNC4 ß" }, /* 18*/ { UNICODE_MODE, "\000\037ß", 4, 0, 79, 1, "(7) 103 64 95 101 63 88 106", "StartA NUL US FNC4 ß" },
/* 19*/ { UNICODE_MODE, "\000\037é", 4, 0, 90, "(8) 103 64 95 101 98 73 78 106", "StartA NUL US FNC4 Shift é" }, /* 19*/ { UNICODE_MODE, "\000\037é", 4, 0, 90, 0, "(8) 103 64 95 101 98 73 78 106", "StartA NUL US FNC4 Shift é; BWIPP different encodation" },
/* 20*/ { UNICODE_MODE, "\000\037éa", 5, 0, 101, "(9) 103 64 95 100 100 73 65 61 106", "StartA NUL US LatchB FNC4 é a" }, /* 20*/ { UNICODE_MODE, "\000\037éa", 5, 0, 101, 0, "(9) 103 64 95 100 100 73 65 61 106", "StartA NUL US LatchB FNC4 é a; BWIPP different encodation" },
/* 21*/ { UNICODE_MODE, "abß", -1, 0, 79, "(7) 104 65 66 100 63 29 106", "StartB a b FNC4 ß" }, /* 21*/ { UNICODE_MODE, "abß", -1, 0, 79, 1, "(7) 104 65 66 100 63 29 106", "StartB a b FNC4 ß" },
/* 22*/ { DATA_MODE, "\141\142\237", -1, 0, 90, "(8) 104 65 66 100 98 95 26 106", "StartB a b FNC4 Shift APC" }, /* 22*/ { DATA_MODE, "\141\142\237", -1, 0, 90, 0, "(8) 104 65 66 100 98 95 26 106", "StartB a b FNC4 Shift APC; BWIPP different encodation" },
/* 23*/ { DATA_MODE, "\141\142\237\037", -1, 0, 101, "(9) 104 65 66 101 101 95 95 96 106", "StartB a b LatchA FNC4 APC US" }, /* 23*/ { DATA_MODE, "\141\142\237\037", -1, 0, 101, 0, "(9) 104 65 66 101 101 95 95 96 106", "StartB a b LatchA FNC4 APC US; BWIPP different encodation" },
/* 24*/ { UNICODE_MODE, "ééé", -1, 0, 90, "(8) 104 100 100 73 73 73 44 106", "StartB LatchFNC4 é é é" }, /* 24*/ { UNICODE_MODE, "ééé", -1, 0, 90, 1, "(8) 104 100 100 73 73 73 44 106", "StartB LatchFNC4 é é é" },
/* 25*/ { UNICODE_MODE, "aééééb", -1, 0, 145, "(13) 104 65 100 73 100 73 100 73 100 73 66 49 106", "StartB a FNC4 é (4) b" }, /* 25*/ { UNICODE_MODE, "aééééb", -1, 0, 145, 1, "(13) 104 65 100 73 100 73 100 73 100 73 66 49 106", "StartB a FNC4 é (4) b" },
/* 26*/ { UNICODE_MODE, "aéééééb", -1, 0, 145, "(13) 104 65 100 100 73 73 73 73 73 100 66 93 106", "StartB a Latch é (5) Shift b" }, /* 26*/ { UNICODE_MODE, "aéééééb", -1, 0, 145, 1, "(13) 104 65 100 100 73 73 73 73 73 100 66 93 106", "StartB a Latch é (5) Shift b" },
/* 27*/ { UNICODE_MODE, "aééééébc", -1, 0, 167, "(15) 104 65 100 100 73 73 73 73 73 100 66 100 67 40 106", "StartB a Latch é (5) Shift b Shift c" }, /* 27*/ { UNICODE_MODE, "aééééébc", -1, 0, 167, 1, "(15) 104 65 100 100 73 73 73 73 73 100 66 100 67 40 106", "StartB a Latch é (5) Shift b Shift c" },
/* 28*/ { UNICODE_MODE, "aééééébcd", -1, 0, 178, "(16) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 66 106", "StartB a Latch é (5) Unlatch b c d" }, /* 28*/ { UNICODE_MODE, "aééééébcd", -1, 0, 178, 1, "(16) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 66 106", "StartB a Latch é (5) Unlatch b c d" },
/* 29*/ { UNICODE_MODE, "aééééébcde", -1, 0, 189, "(17) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 2 106", "StartB a Latch é (5) Unlatch b c d e" }, /* 29*/ { UNICODE_MODE, "aééééébcde", -1, 0, 189, 1, "(17) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 2 106", "StartB a Latch é (5) Unlatch b c d e" },
/* 30*/ { UNICODE_MODE, "aééééébcdeé", -1, 0, 211, "(19) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 100 73 95 106", "StartB a Latch é (5) Unlatch b c d e FNC4 é" }, /* 30*/ { UNICODE_MODE, "aééééébcdeé", -1, 0, 211, 0, "(19) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 100 73 95 106", "StartB a Latch é (5) Unlatch b c d e FNC4 é; BWIPP different encodation" },
/* 31*/ { UNICODE_MODE, "aééééébcdeéé", -1, 0, 233, "(21) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 100 73 100 73 19 106", "StartB a Latch é (5) Unlatch b c d e FNC4 é (2)" }, /* 31*/ { UNICODE_MODE, "aééééébcdeéé", -1, 0, 233, 0, "(21) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 100 73 100 73 19 106", "StartB a Latch é (5) Unlatch b c d e FNC4 é (2); BWIPP different encodation" },
/* 32*/ { UNICODE_MODE, "aééééébcdeééé", -1, 0, 244, "(22) 104 65 100 100 73 73 73 73 73 100 66 100 67 100 68 100 69 73 73 73 83 106", "StartB a Latch é (5) Shift b Shift c Shift d Shift e é (3)" }, /* 32*/ { UNICODE_MODE, "aééééébcdeééé", -1, 0, 244, 1, "(22) 104 65 100 100 73 73 73 73 73 100 66 100 67 100 68 100 69 73 73 73 83 106", "StartB a Latch é (5) Shift b Shift c Shift d Shift e é (3)" },
/* 33*/ { UNICODE_MODE, "aééééébcdefééé", -1, 0, 255, "(23) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 70 100 100 73 73 73 67 106", "StartB a Latch é (5) Unlatch b c d e f Latch é (3)" }, /* 33*/ { UNICODE_MODE, "aééééébcdefééé", -1, 0, 255, 1, "(23) 104 65 100 100 73 73 73 73 73 100 100 66 67 68 69 70 100 100 73 73 73 67 106", "StartB a Latch é (5) Unlatch b c d e f Latch é (3)" },
/* 34*/ { DATA_MODE, "\200\200\200\200\200\101\060\060\060\060\101\200", -1, 0, 222, "(20) 103 101 101 64 64 64 64 64 101 101 33 99 0 0 101 33 101 64 73 106", "StartA Latch PAD (4) Unlatch A CodeC 00 00 CodeA A FNC4 PAD" }, /* 34*/ { DATA_MODE, "\200\200\200\200\200\101\060\060\060\060\101\200", -1, 0, 222, 1, "(20) 103 101 101 64 64 64 64 64 101 101 33 99 0 0 101 33 101 64 73 106", "StartA Latch PAD (4) Unlatch A CodeC 00 00 CodeA A FNC4 PAD" },
/* 35*/ { UNICODE_MODE, "ÁÁÁÁÁÁ99999999999999", -1, 0, 211, 0, "(19) 104 100 100 33 33 33 33 33 33 99 99 99 99 99 99 99 99 63 106", "Okapi code128/extended-mode-exit-before-code-set-c.png (chose different solution); BWIPP different encodation" },
/* 36*/ { UNICODE_MODE, "ÁÁÁÁÁÁ99999999999999Á", -1, 0, 233, 0, "(21) 104 100 100 33 33 33 33 33 33 99 99 99 99 99 99 99 99 100 33 91 106", "Above with trailing non-shifted (as still latched) extended; BWIPP different encodation" },
/* 37*/ { DATA_MODE | ESCAPE_MODE, "@g(\302\302\302\302\3025555\302\302\302\302\302\302\302\302", -1, 0, 277, 0, "(25) 104 32 71 8 100 100 34 34 34 34 34 99 55 55 100 34 34 34 34 34 34 34 34 25 106", "Okapi code128/extended-mode-with-short-embedded-code-set-c.png (chose different solution); BWIPP different encodation" },
/* 38*/ { DATA_MODE | ESCAPE_MODE, "@g(\302\302\302\302\302555555\302\302\302\302\302\302\302", -1, 0, 277, 0, "(25) 104 32 71 8 100 100 34 34 34 34 34 99 55 55 55 100 34 34 34 34 34 34 34 76 106", "Above with extra 55 instead of \xC2; BWIPP different encodation" },
/* 39*/ { UNICODE_MODE, "ÁÁèÁÁFç7Z", -1, 0, 189, 0, "(17) 104 100 100 33 33 72 33 33 100 38 71 100 100 23 58 95 106", "Okapi code128/extended-mode-shift.png; BWIPP different encodation" },
/* 40*/ { UNICODE_MODE, "m\nm\nm", -1, 0, 112, 1, "(10) 104 77 98 74 77 98 74 77 11 106", "Okapi code128/code-set-b-a-b-a-b.png" },
/* 41*/ { UNICODE_MODE, "c\naDEF", -1, 0, 112, 1, "(10) 104 67 98 74 65 36 37 38 75 106", "Okapi bug-36-1.png" },
/* 42*/ { UNICODE_MODE, "\na\nDEF", -1, 0, 112, 1, "(10) 103 74 98 65 74 36 37 38 90 106", "Okapi bug-36-2.png" },
/* 43*/ { UNICODE_MODE, "ÿ\012àa\0121\012àAà", -1, 0, 222, 0, "(20) 104 100 95 98 74 100 64 65 98 74 17 98 74 100 64 33 100 64 61 106", "BWIPP different encodation, ShA instead of CodeA" },
/* 44*/ { UNICODE_MODE, "ÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 387, 0, "(35) 104 100 95 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100 64", "BWIPP different encodation, CodeA instead of ShA, shorter" },
/* 45*/ { UNICODE_MODE, "yÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 398, 0, "(36) 104 89 100 95 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100", "BWIPP different encodation, CodeA instead of ShA, shorter" },
/* 46*/ { UNICODE_MODE, "ÿy1234\012àa\0121\0127890àAàDà\012à", -1, 0, 398, 0, "(36) 104 100 95 89 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100", "BWIPP different encodation, CodeA instead of ShA, shorter" },
/* 47*/ { UNICODE_MODE, "ÿÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 409, 0, "(37) 104 100 95 100 95 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33", "BWIPP different encodation, CodeA instead of ShA, shorter" },
/* 48*/ { UNICODE_MODE, "ÿ12345678\012à12345678abcdef\0121\01223456\012\0127890àAàBCDEFà\012\012à", -1, 0, 684, 0, "(62) 104 100 95 99 12 34 56 78 101 74 101 98 64 99 12 34 56 78 100 65 66 67 68 69 70 98 74", "BWIPP different encodation, CodeA instead of ShA, shorter" },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol;
char escaped[1024]; char escaped[1024];
char cmp_buf[8192];
char cmp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
testStart("test_input"); testStart("test_input");
@ -380,14 +400,40 @@ static void test_input(const testCtx *const p_ctx) {
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, \"%s\", %d, %s, %d, \"%s\", \"%s\" },\n", printf(" /*%3d*/ { %s, \"%s\", %d, %s, %d, %d, \"%s\", \"%s\" },\n",
i, testUtilInputModeName(data[i].input_mode), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, i, testUtilInputModeName(data[i].input_mode), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length,
testUtilErrorName(data[i].ret), symbol->width, symbol->errtxt, data[i].comment); testUtilErrorName(data[i].ret), symbol->width, data[i].bwipp_cmp, symbol->errtxt, data[i].comment);
} else { } else {
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else {
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump);
}
}
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
int cmp_len, ret_len;
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
}
} }
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
} }
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);

View File

@ -48,6 +48,10 @@ static void test_large(const testCtx *const p_ctx) {
/* 2*/ { "0", 154, 0, 16, 70 }, /* BS EN 12323:2005 4.1 (l) */ /* 2*/ { "0", 154, 0, 16, 70 }, /* BS EN 12323:2005 4.1 (l) */
/* 3*/ { "0", 155, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 3*/ { "0", 155, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 4*/ { "0", 161, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 4*/ { "0", 161, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 5*/ { "\001", 77, 0, 16, 70 },
/* 6*/ { "\001", 78, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 7*/ { "\377", 38, 0, 16, 70 }, /* FNC4 + char for each so half 77 as not using double latch */
/* 8*/ { "\377", 39, ZINT_ERROR_TOO_LONG, -1, -1 },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
@ -154,6 +158,7 @@ static void test_input(const testCtx *const p_ctx) {
int ret; int ret;
int expected_rows; int expected_rows;
int expected_width; int expected_width;
int bwipp_cmp;
char *expected; char *expected;
char *comment; char *comment;
}; };
@ -167,43 +172,61 @@ static void test_input(const testCtx *const p_ctx) {
é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII
*/ */
struct item data[] = { struct item data[] = {
/* 0*/ { UNICODE_MODE, -1, "\037", -1, 0, 2, 70, "(10) 0 95 103 103 103 103 103 103 22 42", "ModeA US Pad (6)" }, /* 0*/ { UNICODE_MODE, -1, "\037", -1, 0, 2, 70, 1, "(10) 0 95 103 103 103 103 103 103 22 42", "ModeA US Pad (6)" },
/* 1*/ { UNICODE_MODE, -1, "A", -1, 0, 2, 70, "(10) 1 33 103 103 103 103 103 103 52 82", "ModeB A Pad (6)" }, /* 1*/ { UNICODE_MODE, -1, "A", -1, 0, 2, 70, 1, "(10) 1 33 103 103 103 103 103 103 52 82", "ModeB A Pad (6)" },
/* 2*/ { UNICODE_MODE, -1, "12", -1, 0, 2, 70, "(10) 2 12 103 103 103 103 103 103 98 27", "ModeC 12 Pad (6)" }, /* 2*/ { UNICODE_MODE, -1, "12", -1, 0, 2, 70, 1, "(10) 2 12 103 103 103 103 103 103 98 27", "ModeC 12 Pad (6)" },
/* 3*/ { GS1_MODE, -1, "[90]A", -1, 0, 2, 70, "(10) 3 25 16 33 103 103 103 103 83 20", "ModeBFNC1 9 0 A Pad (4)" }, /* 3*/ { GS1_MODE, -1, "[90]A", -1, 0, 2, 70, 1, "(10) 3 25 16 33 103 103 103 103 83 20", "ModeBFNC1 9 0 A Pad (4)" },
/* 4*/ { GS1_MODE, -1, "[90]12", -1, 0, 2, 70, "(10) 4 90 12 103 103 103 103 103 79 62", "ModeCFNC1 90 12 Pad (5)" }, /* 4*/ { GS1_MODE, -1, "[90]12", -1, 0, 2, 70, 1, "(10) 4 90 12 103 103 103 103 103 79 62", "ModeCFNC1 90 12 Pad (5)" },
/* 5*/ { GS1_MODE, -1, "[90]12[20]12", -1, 0, 2, 70, "(10) 4 90 12 102 20 12 103 103 9 72", "ModeCFNC1 90 12 FNC1 20 12 Pad (2)" }, /* 5*/ { GS1_MODE, -1, "[90]12[20]12", -1, 0, 2, 70, 1, "(10) 4 90 12 102 20 12 103 103 9 72", "ModeCFNC1 90 12 FNC1 20 12 Pad (2)" },
/* 6*/ { GS1_MODE, -1, "[90]123[20]12", -1, 0, 2, 70, "(15) 4 90 12 100 19 99 102 20 12 103 103 103 103 88 22", "ModeCFNC1 90 CodeB 3 CodeC FNC1 20 12 Pad (4)" }, /* 6*/ { GS1_MODE, -1, "[90]123[20]12", -1, 0, 3, 70, 1, "(15) 11 90 12 100 19 99 102 20 12 103 103 103 103 102 11", "ModeCFNC1 90 CodeB 3 CodeC FNC1 20 12 Pad (4)" },
/* 7*/ { GS1_MODE, -1, "[90]123[91]1A3[20]12", -1, 0, 4, 70, "(20) 18 90 12 100 19 102 25 99 11 100 33 19 99 102 20 12 103 103 0 3", "ModeCFNC1 90 12 CodeB 3 FNC1 9 CodeC 11 CodeB A 3 CodeC FNC1 20 12 Pad (2)" }, /* 7*/ { GS1_MODE, -1, "[90]123[91]1A3[20]12", -1, 0, 4, 70, 1, "(20) 18 90 12 100 19 102 25 99 11 100 33 19 99 102 20 12 103 103 0 3", "ModeCFNC1 90 12 CodeB 3 FNC1 9 CodeC 11 CodeB A 3 CodeC FNC1 20 12 Pad (2)" },
/* 8*/ { GS1_MODE, -1, "[90]123A[91]123", -1, 0, 3, 70, "(15) 11 90 12 100 19 33 102 25 99 11 23 103 103 81 56", "ModeCFNC1 90 12 CodeB 3 A FNC1 9 CodeC 11 23 Pad (2)" }, /* 8*/ { GS1_MODE, -1, "[90]123A[91]123", -1, 0, 3, 70, 1, "(15) 11 90 12 100 19 33 102 25 99 11 23 103 103 81 56", "ModeCFNC1 90 12 CodeB 3 A FNC1 9 CodeC 11 23 Pad (2)" },
/* 9*/ { GS1_MODE | GS1PARENS_MODE, -1, "(90)12", -1, 0, 2, 70, "(10) 4 90 12 103 103 103 103 103 79 62", "ModeCFNC1 90 12 Pad (5)" }, /* 9*/ { GS1_MODE | GS1PARENS_MODE, -1, "(90)12", -1, 0, 2, 70, 1, "(10) 4 90 12 103 103 103 103 103 79 62", "ModeCFNC1 90 12 Pad (5)" },
/* 10*/ { UNICODE_MODE, -1, "a0123456789", -1, 0, 2, 70, "(10) 5 65 1 23 45 67 89 103 27 86", "ModeC1SB a 01 23 45 67 89 Pad" }, /* 10*/ { UNICODE_MODE, -1, "a0123456789", -1, 0, 2, 70, 1, "(10) 5 65 1 23 45 67 89 103 27 86", "ModeC1SB a 01 23 45 67 89 Pad" },
/* 11*/ { UNICODE_MODE, -1, "ab0123456789", -1, 0, 2, 70, "(10) 6 65 66 1 23 45 67 89 19 42", "ModeC2SB a b 01 23 45 67 89" }, /* 11*/ { UNICODE_MODE, -1, "ab0123456789", -1, 0, 2, 70, 1, "(10) 6 65 66 1 23 45 67 89 19 42", "ModeC2SB a b 01 23 45 67 89" },
/* 12*/ { UNICODE_MODE, -1, "1234\037a", -1, 0, 2, 70, "(10) 2 12 34 101 95 98 65 103 67 53", "ModeC 12 34 CodeA US 1SB a Pad" }, /* 12*/ { UNICODE_MODE, -1, "1234\037a", -1, 0, 2, 70, 0, "(10) 2 12 34 101 95 98 65 103 67 53", "ModeC 12 34 CodeA US 1SB a Pad; BWIPP different encodation, CodeB instead of 1SB" },
/* 13*/ { UNICODE_MODE, -1, "\000\037ß", 4, 0, 2, 70, "(10) 0 64 95 101 63 103 103 103 75 11", "ModeA NUL US FNC4 ß Pad (3)" }, /* 13*/ { UNICODE_MODE, -1, "\000\037ß", 4, 0, 2, 70, 1, "(10) 0 64 95 101 63 103 103 103 75 11", "ModeA NUL US FNC4 ß Pad (3)" },
/* 14*/ { UNICODE_MODE, -1, "\000\037é", 4, 0, 2, 70, "(10) 0 64 95 101 98 73 103 103 75 6", "ModeA NUL US FNC4 1SB é Pad (2)" }, /* 14*/ { UNICODE_MODE, -1, "\000\037é", 4, 0, 2, 70, 0, "(10) 0 64 95 101 98 73 103 103 75 6", "ModeA NUL US FNC4 1SB é Pad (2); BWIPP different encodation, CodeB instead of 1SB" },
/* 15*/ { UNICODE_MODE, -1, "\000\037éa", 5, 0, 2, 70, "(10) 0 64 95 100 100 73 65 103 99 69", "ModeA NUL US CodeB FNC4 é a Pad" }, /* 15*/ { UNICODE_MODE, -1, "\000\037éa", 5, 0, 2, 70, 0, "(10) 0 64 95 100 100 73 65 103 99 69", "ModeA NUL US CodeB FNC4 é a Pad; BWIPP different encodation, FNC4 before CodeB" },
/* 16*/ { UNICODE_MODE, -1, "abß", -1, 0, 2, 70, "(10) 1 65 66 100 63 103 103 103 66 56", "ModeB a b FNC4 ß Pad (3)" }, /* 16*/ { UNICODE_MODE, -1, "abß", -1, 0, 2, 70, 1, "(10) 1 65 66 100 63 103 103 103 66 56", "ModeB a b FNC4 ß Pad (3)" },
/* 17*/ { DATA_MODE, -1, "\141\142\237", -1, 0, 2, 70, "(10) 1 65 66 100 98 95 103 103 6 71", "ModeB a b FNC4 1SA APC Pad (2)" }, /* 17*/ { DATA_MODE, -1, "\141\142\237", -1, 0, 2, 70, 0, "(10) 1 65 66 100 98 95 103 103 6 71", "ModeB a b FNC4 1SA APC Pad (2); BWIPP different encodation, CodeA instead of 1SA" },
/* 18*/ { DATA_MODE, -1, "\141\142\237\037", -1, 0, 2, 70, "(10) 1 65 66 101 101 95 95 103 72 93", "ModeB a b CodeA FNC4 APC US Pad" }, /* 18*/ { DATA_MODE, -1, "\141\142\237\037", -1, 0, 2, 70, 0, "(10) 1 65 66 101 101 95 95 103 72 93", "ModeB a b CodeA FNC4 APC US Pad; BWIPP different encodation, FNC4 before CodeA" },
/* 19*/ { UNICODE_MODE, -1, "ééé", -1, 0, 2, 70, "(10) 1 100 73 100 73 100 73 103 105 106", "ModeB FNC4 é FNC4 é FNC4 é Pad" }, /* 19*/ { UNICODE_MODE, -1, "ééé", -1, 0, 2, 70, 0, "(10) 1 100 73 100 73 100 73 103 105 106", "ModeB FNC4 é FNC4 é FNC4 é Pad; BWIPP different encodation, uses double FNC4 latch" },
/* 20*/ { UNICODE_MODE, -1, "aééééb", -1, 0, 3, 70, "(15) 8 65 100 73 100 73 100 73 100 73 66 103 103 39 83", "ModeB a FNC4 é (4) b Pad (2)" }, /* 20*/ { UNICODE_MODE, -1, "aééééb", -1, 0, 3, 70, 1, "(15) 8 65 100 73 100 73 100 73 100 73 66 103 103 39 83", "ModeB a FNC4 é (4) b Pad (2)" },
/* 21*/ { UNICODE_MODE, -1, "aéééééb", -1, 0, 3, 70, "(15) 8 65 100 73 100 73 100 73 100 73 100 73 66 74 106", "ModeB a FNC4 é (5) b" }, /* 21*/ { UNICODE_MODE, -1, "aéééééb", -1, 0, 3, 70, 0, "(15) 8 65 100 73 100 73 100 73 100 73 100 73 66 74 106", "ModeB a FNC4 é (5) b; BWIPP different encodation, uses double FNC4 latch" },
/* 22*/ { UNICODE_MODE, -1, "aééééébcdeé", -1, 0, 4, 70, "(20) 15 65 100 73 100 73 100 73 100 73 100 73 66 67 68 69 100 73 14 69", "ModeB a FNC4 é (5) b c d e FNC4 é" }, /* 22*/ { UNICODE_MODE, -1, "aééééébcdeé", -1, 0, 4, 70, 0, "(20) 15 65 100 73 100 73 100 73 100 73 100 73 66 67 68 69 100 73 14 69", "ModeB a FNC4 é (5) b c d e FNC4 é; BWIPP different encodation, uses double FNC4 latch then FNC4 escapes" },
/* 23*/ { UNICODE_MODE, -1, "123456789012345678901234", -1, 0, 3, 70, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", "3 rows" }, /* 23*/ { UNICODE_MODE, -1, "123456789012345678901234", -1, 0, 3, 70, 1, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", "3 rows" },
/* 24*/ { UNICODE_MODE, 2, "123456789012345678901234", -1, 0, 3, 70, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", "Min 2 rows (no change)" }, /* 24*/ { UNICODE_MODE, 2, "123456789012345678901234", -1, 0, 3, 70, 0, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", "Min 2 rows (no change); BWIPP doesn't support min rows < required" },
/* 25*/ { UNICODE_MODE, 3, "123456789012345678901234", -1, 0, 3, 70, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", "Min 3 rows (no change)" }, /* 25*/ { UNICODE_MODE, 3, "123456789012345678901234", -1, 0, 3, 70, 1, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", "Min 3 rows (no change)" },
/* 26*/ { UNICODE_MODE, 4, "123456789012345678901234", -1, 0, 4, 70, "(20) 16 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 66 96", "Min 4 rows" }, /* 26*/ { UNICODE_MODE, 4, "123456789012345678901234", -1, 0, 4, 70, 1, "(20) 16 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 66 96", "Min 4 rows" },
/* 27*/ { UNICODE_MODE, 5, "123456789012345678901234", -1, 0, 5, 70, "(25) 23 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 103 103 103 103 103 68 61", "Min 5 rows" }, /* 27*/ { UNICODE_MODE, 5, "123456789012345678901234", -1, 0, 5, 70, 1, "(25) 23 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 103 103 103 103 103 68 61", "Min 5 rows" },
/* 28*/ { UNICODE_MODE, 16, "123456789012345678901234", -1, 0, 16, 70, "(80) 100 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 103 103 103 103 103 103", "Min 16 rows" }, /* 28*/ { UNICODE_MODE, 16, "123456789012345678901234", -1, 0, 16, 70, 1, "(80) 100 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 103 103 103 103 103 103", "Min 16 rows" },
/* 29*/ { UNICODE_MODE, 1, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 424: Minimum number of rows out of range (2 to 16)", "" }, /* 29*/ { UNICODE_MODE, 1, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, 1, "Error 424: Minimum number of rows out of range (2 to 16)", "" },
/* 30*/ { UNICODE_MODE, 17, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 424: Minimum number of rows out of range (2 to 16)", "" }, /* 30*/ { UNICODE_MODE, 17, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, 1, "Error 424: Minimum number of rows out of range (2 to 16)", "" },
/* 31*/ { UNICODE_MODE, -1, "ÁÁÁÁÁÁ99999999999999Á", -1, 0, 6, 70, 0, "(30) 29 100 33 100 33 100 33 100 33 100 33 100 33 99 99 99 99 99 99 99 99 100 100 33 103", "BWIPP different encodation, uses double FNC4 latch" },
/* 32*/ { UNICODE_MODE, -1, "ÿ\012àa\0121\012àAà", -1, 0, 4, 70, 0, "(20) 15 100 95 98 74 100 64 65 98 74 17 98 74 100 64 33 100 64 47 35", "BWIPP different encodation, uses CodeA instead of 1SA" },
/* 33*/ { UNICODE_MODE, -1, "ÿ\012àa\0121\012àAà\012à", -1, 0, 5, 70, 0, "(25) 22 100 95 98 74 100 64 65 98 74 17 98 74 100 64 33 100 64 98 74 100 64 103 89 18", "BWIPP different encodation, uses CodeA instead of 1SA" },
/* 34*/ { UNICODE_MODE, -1, "y1234\012àa\0121\0127890àAàDà\012à", -1, 0, 7, 70, 0, "(35) 40 89 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100 64 36 100", "BWIPP different encodation, uses Sh2B + other differences" },
/* 35*/ { UNICODE_MODE, -1, "ÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 7, 70, 0, "(35) 41 100 95 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100 64 36", "BWIPP different encodation" },
/* 36*/ { UNICODE_MODE, -1, "yÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, "(40) 43 89 100 95 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100", "BWIPP different encodation (and fits in 7 rows)" },
/* 37*/ { UNICODE_MODE, -1, "ÿy1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, "(40) 43 100 95 89 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100", "BWIPP different encodation (and fits in 7 rows)" },
/* 38*/ { UNICODE_MODE, -1, "ÿÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, "(40) 43 100 95 100 95 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33", "BWIPP different encodation (and fits in 7 rows)" },
/* 39*/ { UNICODE_MODE, -1, "ÿ1234\012àa\0121\01223456\0127890àAàDà\012à", -1, 0, 8, 70, 0, "(40) 48 100 95 12 34 101 74 100 100 64 65 98 74 17 98 74 18 99 34 56 101 74 99 78 90 100", "BWIPP different encodation, uses Sh2B + other differences" },
/* 40*/ { UNICODE_MODE, -1, "ÿ1234\012à1234a\0121\01223456\0127890àAàDà\012à", -1, 0, 9, 70, 0, "(45) 55 100 95 12 34 101 74 101 98 64 99 12 34 100 65 98 74 17 98 74 18 99 34 56 101 74 99", "BWIPP different encodation, uses Sh2C + other differences" },
/* 41*/ { UNICODE_MODE, -1, "ÿ1234\012à1234ab\0121\01223456\012\0127890àAàBCDà\012\012à", -1, 0, 10, 70, 0, "(50) 62 100 95 12 34 101 74 101 98 64 99 12 34 100 65 66 98 74 17 98 74 18 99 34 56 101 74", "BWIPP different encodation, uses Sh2C + other differences" },
/* 42*/ { UNICODE_MODE, -1, "ÿ123456\012à123456abcd\0121\01223456\012\0127890àAàBCDEà\012\012à", -1, 0, 11, 70, 0, "(55) 69 100 95 12 34 56 101 74 101 98 64 99 12 34 56 100 65 66 67 68 98 74 17 98 74 18 99", "BWIPP different encodation, uses Sh3C + other differences" },
/* 43*/ { UNICODE_MODE, -1, "ÿ12345678\012à12345678abcdef\0121\01223456\012\0127890àAàBCDEFà\012\012à", -1, 0, 12, 70, 0, "(60) 76 100 95 12 34 56 78 101 74 101 98 64 99 12 34 56 78 100 65 66 67 68 69 70 98 74 17", "BWIPP different encodation, uses Sh2C + other differences" },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol;
char escaped[1024]; char escaped[1024];
char cmp_buf[8192];
char cmp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
testStart("test_input"); testStart("test_input");
@ -222,15 +245,41 @@ static void test_input(const testCtx *const p_ctx) {
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) { if (p_ctx->generate) {
printf(" /*%3d*/ { %s, %d, \"%s\", %d, %s, %d, %d, \"%s\", \"%s\" },\n", printf(" /*%3d*/ { %s, %d, \"%s\", %d, %s, %d, %d, %d, \"%s\", \"%s\" },\n",
i, testUtilInputModeName(data[i].input_mode), data[i].option_1, i, testUtilInputModeName(data[i].input_mode), data[i].option_1,
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length,
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, symbol->errtxt, data[i].comment); testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, symbol->errtxt, data[i].comment);
} else { } else {
assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) {
if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else {
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump);
}
}
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
int cmp_len, ret_len;
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
}
} }
} }
@ -302,10 +351,11 @@ static void test_encode(const testCtx *const p_ctx) {
struct zint_symbol *symbol; struct zint_symbol *symbol;
char escaped[1024]; char escaped[1024];
char bwipp_buf[8192]; char cmp_buf[8192];
char bwipp_msg[1024]; char cmp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
testStart("test_encode"); testStart("test_encode");
@ -339,12 +389,23 @@ static void test_encode(const testCtx *const p_ctx) {
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) { if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) {
ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf), NULL); ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected);
}
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
int cmp_len, ret_len;
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, cmp_buf, sizeof(cmp_buf), &cmp_len);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length, NULL /*primary*/, escaped, &ret_len);
assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %.*s\nexpected: %.*s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_len, cmp_buf, ret_len, escaped);
} }
} }
} }

View File

@ -101,7 +101,7 @@ static void test_input(const testCtx *const p_ctx) {
US U+001F (\037, 31), S1 5 US U+001F (\037, 31), S1 5
*/ */
struct item data[] = { struct item data[] = {
/* 0*/ { UNICODE_MODE, -1, "é", -1, ZINT_ERROR_INVALID_DATA, 0, 0, "Error 431: Invalid character in input data", "ASCII only" }, /* 0*/ { UNICODE_MODE, -1, "é", -1, ZINT_ERROR_INVALID_DATA, 0, 0, "Error 431: Invalid character in input data, extended ASCII not allowed", "ASCII only" },
/* 1*/ { UNICODE_MODE, -1, "EXAMPLE 2", -1, 0, 2, 70, "(16) 14 33 10 22 25 21 14 41 38 2 35 14 18 13 0 22", "2.3.7 Symbol Example" }, /* 1*/ { UNICODE_MODE, -1, "EXAMPLE 2", -1, 0, 2, 70, "(16) 14 33 10 22 25 21 14 41 38 2 35 14 18 13 0 22", "2.3.7 Symbol Example" },
/* 2*/ { UNICODE_MODE, -1, "12345", -1, 0, 2, 70, "(16) 5 17 9 48 48 48 48 27 48 48 13 23 0 13 2 0", "2.3 Example 1: Numeric Encodation (Start 2, Numeric)" }, /* 2*/ { UNICODE_MODE, -1, "12345", -1, 0, 2, 70, "(16) 5 17 9 48 48 48 48 27 48 48 13 23 0 13 2 0", "2.3 Example 1: Numeric Encodation (Start 2, Numeric)" },
/* 3*/ { UNICODE_MODE, -1, "123456", -1, 0, 2, 70, "(16) 5 17 9 6 48 48 48 34 48 48 36 9 23 41 2 11", "2.3 Example 1: Numeric Encodation" }, /* 3*/ { UNICODE_MODE, -1, "123456", -1, 0, 2, 70, "(16) 5 17 9 6 48 48 48 34 48 48 36 9 23 41 2 11", "2.3 Example 1: Numeric Encodation" },
@ -132,6 +132,10 @@ static void test_input(const testCtx *const p_ctx) {
struct zint_symbol *symbol; struct zint_symbol *symbol;
char escaped[1024]; char escaped[1024];
char cmp_buf[8192];
char cmp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
testStart("test_input"); testStart("test_input");
@ -155,10 +159,21 @@ static void test_input(const testCtx *const p_ctx) {
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length,
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, symbol->errtxt, data[i].comment); testUtilErrorName(data[i].ret), symbol->rows, symbol->width, symbol->errtxt, data[i].comment);
} else { } else {
assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
assert_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) {
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilBwipp(i, symbol, data[i].option_1, -1, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump);
}
} }
} }

View File

@ -926,6 +926,11 @@ static void test_input(const testCtx *const p_ctx) {
/*237*/ { UNICODE_MODE, 0, -1, -1, -1, "AAAAAAAAAAAAAA12a", 0, 0, 12, 26, 0, "E6 59 BF 59 BF 59 BF 59 BF FE 42 42 8E 62 81 ED 19 C5 3F C8 AC F1 E9 F5 68 75 AA 6C 14 72", "CCCCCCCCCCCCAAAAA; BWIPP same as FAST_MODE", 0 }, /*237*/ { UNICODE_MODE, 0, -1, -1, -1, "AAAAAAAAAAAAAA12a", 0, 0, 12, 26, 0, "E6 59 BF 59 BF 59 BF 59 BF FE 42 42 8E 62 81 ED 19 C5 3F C8 AC F1 E9 F5 68 75 AA 6C 14 72", "CCCCCCCCCCCCAAAAA; BWIPP same as FAST_MODE", 0 },
/*238*/ { UNICODE_MODE | FAST_MODE, 0, -1, -1, -1, "1234ééé12", 0, 0, 8, 32, 0, "8E A4 E7 59 D5 6B EB 6A 8E 81 22 4D 35 A9 CA 58 B3 1B 33 B7 DD", "N12 N34 BAS BE9 BE9 ASC FN4 A69 N12; BWIPP same as non-FAST_MODE", 0 }, /*238*/ { UNICODE_MODE | FAST_MODE, 0, -1, -1, -1, "1234ééé12", 0, 0, 8, 32, 0, "8E A4 E7 59 D5 6B EB 6A 8E 81 22 4D 35 A9 CA 58 B3 1B 33 B7 DD", "N12 N34 BAS BE9 BE9 ASC FN4 A69 N12; BWIPP same as non-FAST_MODE", 0 },
/*239*/ { UNICODE_MODE, 0, -1, -1, -1, "1234ééé12", 0, 0, 14, 14, 1, "8E A4 E7 5A D5 6B 01 8E 1C 5C 58 A7 11 8D DD A8 D6 B9", "", 1 }, /*239*/ { UNICODE_MODE, 0, -1, -1, -1, "1234ééé12", 0, 0, 14, 14, 1, "8E A4 E7 5A D5 6B 01 8E 1C 5C 58 A7 11 8D DD A8 D6 B9", "", 1 },
/*240*/ { UNICODE_MODE, 0, -1, -1, -1, "A*B>C 1A*B>C 1\013*B>C 1A*B>C 1A*", 0, 0, 22, 22, 1, "(50) EE 57 B8 0F 04 21 72 5E 21 FE 21 32 0C EE 08 9B 64 7E 57 B8 0F 04 21 72 FE 81 68 FE", "Okapi datamatrix/ascii-within-x12.png", 1 },
/*241*/ { UNICODE_MODE | FAST_MODE, 0, -1, -1, -1, "A*B>C 1A*B>C 1\013*B>C 1A*B>C 1A*", 0, 0, 22, 22, 1, "(50) EE 57 B8 0F 04 21 72 5E 21 FE 21 32 0C EE 08 9B 64 7E 57 B8 0F 04 21 72 FE 81 68 FE", "Okapi datamatrix/ascii-within-x12.png, process_p 2", 1 },
/*242*/ { UNICODE_MODE | FAST_MODE, 0, -1, -1, -1, "A*B>C 1A*B>C \0131*B>C 1A*B>C 1A*", 0, 0, 22, 22, 1, "(50) EE 57 B8 0F 04 21 72 5E 21 FE 21 0C EE 1F 78 0F 04 21 72 5E 21 13 97 FE 2B 81 68 FE", "process_p 1", 1 },
/*243*/ { UNICODE_MODE | FAST_MODE, 0, -1, -1, -1, "A*B>C 1A*B>C\013 1*B>C 1A*B>C 1A*", 0, 0, 22, 22, 1, "(50) EE 57 B8 0F 04 21 72 5E 21 FE 0C EE 13 8A 5E 21 13 97 08 9B 64 7E FE 42 2B 81 68 FE", "process_p 0", 1 },
/*244*/ { UNICODE_MODE | FAST_MODE, 0, -1, -1, -1, "A*B>C 1A*B>C 1*\013B>C 1A*B>C 1A*", 0, 0, 22, 22, 1, "(50) EE 57 B8 0F 04 21 72 5E 21 13 8A FE 0C EE 5E 21 13 97 08 9B 64 7E FE 42 2B 81 68 FE", "process_p 0", 1 },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;

View File

@ -226,6 +226,11 @@ static void test_input(const testCtx *const p_ctx) {
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol;
char cmp_buf[8192];
char cmp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
testStart("test_input"); testStart("test_input");
for (i = 0; i < data_size; i++) { for (i = 0; i < data_size; i++) {
@ -243,6 +248,17 @@ static void test_input(const testCtx *const p_ctx) {
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width);
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump);
}
} }
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);

View File

@ -149,40 +149,47 @@ static void test_input(const testCtx *const p_ctx) {
int expected_rows; int expected_rows;
int expected_width; int expected_width;
const char *expected_errtxt; const char *expected_errtxt;
int bwipp_cmp;
const char *comment;
}; };
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_CODABAR, "A1234B", 0, 1, 62, "" }, /* 0*/ { BARCODE_CODABAR, "A1234B", 0, 1, 62, "", 1, "" },
/* 1*/ { BARCODE_CODABAR, "1234B", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 358: Does not begin with \"A\", \"B\", \"C\" or \"D\"" }, /* 1*/ { BARCODE_CODABAR, "1234B", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 358: Does not begin with \"A\", \"B\", \"C\" or \"D\"", 1, "" },
/* 2*/ { BARCODE_CODABAR, "A1234", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 359: Does not end with \"A\", \"B\", \"C\" or \"D\"" }, /* 2*/ { BARCODE_CODABAR, "A1234", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 359: Does not end with \"A\", \"B\", \"C\" or \"D\"", 1, "" },
/* 3*/ { BARCODE_CODABAR, "A1234E", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 359: Does not end with \"A\", \"B\", \"C\" or \"D\"" }, /* 3*/ { BARCODE_CODABAR, "A1234E", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 359: Does not end with \"A\", \"B\", \"C\" or \"D\"", 1, "" },
/* 4*/ { BARCODE_CODABAR, "C123.D", 0, 1, 63, "" }, /* 4*/ { BARCODE_CODABAR, "C123.D", 0, 1, 63, "", 1, "" },
/* 5*/ { BARCODE_CODABAR, "C123,D", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 357: Invalid character in data (\"0123456789-$:/.+ABCD\" only)" }, /* 5*/ { BARCODE_CODABAR, "C123,D", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 357: Invalid character in data (\"0123456789-$:/.+ABCD\" only)", 1, "" },
/* 6*/ { BARCODE_CODABAR, "D:C", 0, 1, 33, "" }, /* 6*/ { BARCODE_CODABAR, "D:C", 0, 1, 33, "", 1, "" },
/* 7*/ { BARCODE_CODABAR, "DCC", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 363: Cannot contain \"A\", \"B\", \"C\" or \"D\"" }, /* 7*/ { BARCODE_CODABAR, "DCC", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 363: Cannot contain \"A\", \"B\", \"C\" or \"D\"", 1, "" },
/* 8*/ { BARCODE_CODABAR, "AB", ZINT_ERROR_TOO_LONG, -1, -1, "Error 362: Input too short (3 character minimum)" }, /* 8*/ { BARCODE_CODABAR, "AB", ZINT_ERROR_TOO_LONG, -1, -1, "Error 362: Input too short (3 character minimum)", 1, "" },
/* 9*/ { BARCODE_PHARMA, "131070", 0, 1, 78, "" }, /* 9*/ { BARCODE_PHARMA, "131070", 0, 1, 78, "", 1, "" },
/* 10*/ { BARCODE_PHARMA, "131071", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 352: Data out of range (3 to 131070)" }, /* 10*/ { BARCODE_PHARMA, "131071", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 352: Data out of range (3 to 131070)", 1, "" },
/* 11*/ { BARCODE_PHARMA, "3", 0, 1, 4, "" }, /* 11*/ { BARCODE_PHARMA, "3", 0, 1, 4, "", 1, "" },
/* 12*/ { BARCODE_PHARMA, "2", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 352: Data out of range (3 to 131070)" }, /* 12*/ { BARCODE_PHARMA, "2", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 352: Data out of range (3 to 131070)", 1, "" },
/* 13*/ { BARCODE_PHARMA, "1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 352: Data out of range (3 to 131070)" }, /* 13*/ { BARCODE_PHARMA, "1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 352: Data out of range (3 to 131070)", 1, "" },
/* 14*/ { BARCODE_PHARMA, "12A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 351: Invalid character in data (digits only)" }, /* 14*/ { BARCODE_PHARMA, "12A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 351: Invalid character in data (digits only)", 1, "" },
/* 15*/ { BARCODE_PHARMA_TWO, "64570080", 0, 2, 31, "" }, /* 15*/ { BARCODE_PHARMA_TWO, "64570080", 0, 2, 31, "", 1, "" },
/* 16*/ { BARCODE_PHARMA_TWO, "64570081", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Data out of range (4 to 64570080)" }, /* 16*/ { BARCODE_PHARMA_TWO, "64570081", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Data out of range (4 to 64570080)", 1, "" },
/* 17*/ { BARCODE_PHARMA_TWO, "4", 0, 2, 3, "" }, /* 17*/ { BARCODE_PHARMA_TWO, "4", 0, 2, 3, "", 1, "" },
/* 18*/ { BARCODE_PHARMA_TWO, "3", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Data out of range (4 to 64570080)" }, /* 18*/ { BARCODE_PHARMA_TWO, "3", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Data out of range (4 to 64570080)", 1, "" },
/* 19*/ { BARCODE_PHARMA_TWO, "2", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Data out of range (4 to 64570080)" }, /* 19*/ { BARCODE_PHARMA_TWO, "2", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Data out of range (4 to 64570080)", 1, "" },
/* 20*/ { BARCODE_PHARMA_TWO, "1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Data out of range (4 to 64570080)" }, /* 20*/ { BARCODE_PHARMA_TWO, "1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Data out of range (4 to 64570080)", 1, "" },
/* 21*/ { BARCODE_PHARMA_TWO, "123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 355: Invalid character in data (digits only)" }, /* 21*/ { BARCODE_PHARMA_TWO, "123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 355: Invalid character in data (digits only)", 1, "" },
/* 22*/ { BARCODE_CODE32, "12345678", 0, 1, 103, "" }, /* 22*/ { BARCODE_CODE32, "12345678", 0, 1, 103, "", 1, "" },
/* 23*/ { BARCODE_CODE32, "9", 0, 1, 103, "" }, /* 23*/ { BARCODE_CODE32, "9", 0, 1, 103, "", 0, "BWIPP requires length 8 or 9" },
/* 24*/ { BARCODE_CODE32, "0", 0, 1, 103, "" }, /* 24*/ { BARCODE_CODE32, "0", 0, 1, 103, "", 0, "BWIPP requires length 8 or 9" },
/* 25*/ { BARCODE_CODE32, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 361: Invalid character in data (digits only)" }, /* 25*/ { BARCODE_CODE32, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 361: Invalid character in data (digits only)", 1, "" },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol;
char cmp_buf[8192];
char cmp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
testStart("test_input"); testStart("test_input");
for (i = 0; i < data_size; i++) { for (i = 0; i < data_size; i++) {
@ -196,12 +203,27 @@ static void test_input(const testCtx *const p_ctx) {
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d symbol->errtxt %s != %s\n", i, symbol->errtxt, data[i].expected_errtxt);
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width);
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else {
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump);
}
}
} }
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d symbol->errtxt %s != %s\n", i, symbol->errtxt, data[i].expected_errtxt);
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);
} }

View File

@ -224,61 +224,68 @@ static void test_input(const testCtx *const p_ctx) {
int expected_rows; int expected_rows;
int expected_width; int expected_width;
float expected_height; float expected_height;
int bwipp_cmp;
char *comment;
}; };
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_FLAT, -1, 0, "1234567890", 0, 1, 90, 50 }, /* 0*/ { BARCODE_FLAT, -1, 0, "1234567890", 0, 1, 90, 50, 1, "" },
/* 1*/ { BARCODE_FLAT, -1, 0, "A", ZINT_ERROR_INVALID_DATA, -1, -1, -1 }, /* 1*/ { BARCODE_FLAT, -1, 0, "A", ZINT_ERROR_INVALID_DATA, -1, -1, -1, 1, "" },
/* 2*/ { BARCODE_POSTNET, -1, 0, "12345", 0, 2, 63, 12 }, /* 2*/ { BARCODE_POSTNET, -1, 0, "12345", 0, 2, 63, 12, 1, "" },
/* 3*/ { BARCODE_POSTNET, -1, 0, "123457689", 0, 2, 103, 12 }, /* 3*/ { BARCODE_POSTNET, -1, 0, "123457689", 0, 2, 103, 12, 1, "" },
/* 4*/ { BARCODE_POSTNET, -1, 0, "12345768901", 0, 2, 123, 12 }, /* 4*/ { BARCODE_POSTNET, -1, 0, "12345768901", 0, 2, 123, 12, 1, "" },
/* 5*/ { BARCODE_POSTNET, -1, 0, "0", ZINT_WARN_NONCOMPLIANT, 2, 23, 12 }, /* 5*/ { BARCODE_POSTNET, -1, 0, "0", ZINT_WARN_NONCOMPLIANT, 2, 23, 12, 0, "BWIPP requires standard lengths" },
/* 6*/ { BARCODE_POSTNET, -1, 0, "1234", ZINT_WARN_NONCOMPLIANT, 2, 53, 12 }, /* 6*/ { BARCODE_POSTNET, -1, 0, "1234", ZINT_WARN_NONCOMPLIANT, 2, 53, 12, 0, "BWIPP requires standard lengths" },
/* 7*/ { BARCODE_POSTNET, -1, 0, "123456", ZINT_WARN_NONCOMPLIANT, 2, 73, 12 }, /* 7*/ { BARCODE_POSTNET, -1, 0, "123456", ZINT_WARN_NONCOMPLIANT, 2, 73, 12, 0, "BWIPP requires standard lengths" },
/* 8*/ { BARCODE_POSTNET, -1, 0, "123456789012", ZINT_WARN_NONCOMPLIANT, 2, 133, 12 }, /* 8*/ { BARCODE_POSTNET, -1, 0, "123456789012", ZINT_WARN_NONCOMPLIANT, 2, 133, 12, 0, "BWIPP requires standard lengths" },
/* 9*/ { BARCODE_POSTNET, -1, 0, "1234A", ZINT_ERROR_INVALID_DATA, -1, -1, -1 }, /* 9*/ { BARCODE_POSTNET, -1, 0, "1234A", ZINT_ERROR_INVALID_DATA, -1, -1, -1, 1, "" },
/* 10*/ { BARCODE_POSTNET, -1, 0.9, "12345", 0, 2, 63, 1 }, /* 10*/ { BARCODE_POSTNET, -1, 0.9, "12345", 0, 2, 63, 1, 1, "" },
/* 11*/ { BARCODE_FIM, -1, 0, "a", 0, 1, 17, 50 }, /* 11*/ { BARCODE_FIM, -1, 0, "a", 0, 1, 17, 50, 1, "" },
/* 12*/ { BARCODE_FIM, -1, 0, "b", 0, 1, 17, 50 }, /* 12*/ { BARCODE_FIM, -1, 0, "b", 0, 1, 17, 50, 1, "" },
/* 13*/ { BARCODE_FIM, -1, 0, "c", 0, 1, 17, 50 }, /* 13*/ { BARCODE_FIM, -1, 0, "c", 0, 1, 17, 50, 1, "" },
/* 14*/ { BARCODE_FIM, -1, 0, "d", 0, 1, 17, 50 }, /* 14*/ { BARCODE_FIM, -1, 0, "d", 0, 1, 17, 50, 1, "" },
/* 15*/ { BARCODE_FIM, -1, 0, "ad", ZINT_ERROR_TOO_LONG, -1, -1, -1 }, /* 15*/ { BARCODE_FIM, -1, 0, "ad", ZINT_ERROR_TOO_LONG, -1, -1, -1, 1, "" },
/* 16*/ { BARCODE_FIM, -1, 0, "e", 0, 1, 17, 50 }, /* 16*/ { BARCODE_FIM, -1, 0, "e", 0, 1, 17, 50, 1, "" },
/* 17*/ { BARCODE_FIM, -1, 0, "f", ZINT_ERROR_INVALID_DATA, -1, -1, -1 }, /* 17*/ { BARCODE_FIM, -1, 0, "f", ZINT_ERROR_INVALID_DATA, -1, -1, -1, 1, "" },
/* 18*/ { BARCODE_CEPNET, -1, 0, "1234567A", ZINT_ERROR_INVALID_DATA, -1, -1, -1 }, /* 18*/ { BARCODE_CEPNET, -1, 0, "1234567A", ZINT_ERROR_INVALID_DATA, -1, -1, -1, 1, "" },
/* 19*/ { BARCODE_RM4SCC, -1, 0, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 3, 299, 8 }, /* 19*/ { BARCODE_RM4SCC, -1, 0, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 3, 299, 8, 1, "" },
/* 20*/ { BARCODE_RM4SCC, -1, 0, "a", 0, 3, 19, 8 }, /* Converts to upper */ /* 20*/ { BARCODE_RM4SCC, -1, 0, "a", 0, 3, 19, 8, 1, "" }, /* Converts to upper */
/* 21*/ { BARCODE_RM4SCC, -1, 0, ",", ZINT_ERROR_INVALID_DATA, -1, -1, -1 }, /* 21*/ { BARCODE_RM4SCC, -1, 0, ",", ZINT_ERROR_INVALID_DATA, -1, -1, -1, 1, "" },
/* 22*/ { BARCODE_JAPANPOST, -1, 0, "1234567890-ABCD", 0, 3, 133, 8 }, /* 19 symbol chars */ /* 22*/ { BARCODE_JAPANPOST, -1, 0, "1234567890-ABCD", 0, 3, 133, 8, 1, "" }, /* 19 symbol chars */
/* 23*/ { BARCODE_JAPANPOST, -1, 0, "1234567890-ABCD1", 0, 3, 133, 8 }, /* 20 symbol chars */ /* 23*/ { BARCODE_JAPANPOST, -1, 0, "1234567890-ABCD1", 0, 3, 133, 8, 1, "" }, /* 20 symbol chars */
/* 24*/ { BARCODE_JAPANPOST, -1, 0, "1234567890-ABCDE", ZINT_ERROR_TOO_LONG, -1, -1, -1 }, /* 21 symbol chars */ /* 24*/ { BARCODE_JAPANPOST, -1, 0, "1234567890-ABCDE", ZINT_ERROR_TOO_LONG, -1, -1, -1, 1, "" }, /* 21 symbol chars */
/* 25*/ { BARCODE_JAPANPOST, -1, 0, "1234567890-ABCD12", ZINT_ERROR_TOO_LONG, -1, -1, -1 }, /* 21 symbol chars */ /* 25*/ { BARCODE_JAPANPOST, -1, 0, "1234567890-ABCD12", ZINT_ERROR_TOO_LONG, -1, -1, -1, 1, "" }, /* 21 symbol chars */
/* 26*/ { BARCODE_JAPANPOST, -1, 0, "1234567890ABCDE", 0, 3, 133, 8 }, /* 20 symbol chars */ /* 26*/ { BARCODE_JAPANPOST, -1, 0, "1234567890ABCDE", 0, 3, 133, 8, 1, "" }, /* 20 symbol chars */
/* 27*/ { BARCODE_JAPANPOST, -1, 0, "a", 0, 3, 133, 8 }, /* Converts to upper */ /* 27*/ { BARCODE_JAPANPOST, -1, 0, "a", 0, 3, 133, 8, 1, "" }, /* Converts to upper */
/* 28*/ { BARCODE_JAPANPOST, -1, 0, ",", ZINT_ERROR_INVALID_DATA, -1, -1, -1 }, /* 28*/ { BARCODE_JAPANPOST, -1, 0, ",", ZINT_ERROR_INVALID_DATA, -1, -1, -1, 1, "" },
/* 29*/ { BARCODE_KOREAPOST, -1, 0, "123456", 0, 1, 167, 50 }, /* 29*/ { BARCODE_KOREAPOST, -1, 0, "123456", 0, 1, 167, 50, 1, "" },
/* 30*/ { BARCODE_KOREAPOST, -1, 0, "A", ZINT_ERROR_INVALID_DATA, -1, -1, -1 }, /* 30*/ { BARCODE_KOREAPOST, -1, 0, "A", ZINT_ERROR_INVALID_DATA, -1, -1, -1, 1, "" },
/* 31*/ { BARCODE_PLANET, -1, 0, "12345678901", 0, 2, 123, 12 }, /* 31*/ { BARCODE_PLANET, -1, 0, "12345678901", 0, 2, 123, 12, 1, "" },
/* 32*/ { BARCODE_PLANET, -1, 0, "1234567890123", 0, 2, 143, 12 }, /* 32*/ { BARCODE_PLANET, -1, 0, "1234567890123", 0, 2, 143, 12, 1, "" },
/* 33*/ { BARCODE_PLANET, -1, 0, "0", ZINT_WARN_NONCOMPLIANT, 2, 23, 12 }, /* 33*/ { BARCODE_PLANET, -1, 0, "0", ZINT_WARN_NONCOMPLIANT, 2, 23, 12, 0, "BWIPP requires standard lengths" },
/* 34*/ { BARCODE_PLANET, -1, 0, "1234567890", ZINT_WARN_NONCOMPLIANT, 2, 113, 12 }, /* 34*/ { BARCODE_PLANET, -1, 0, "1234567890", ZINT_WARN_NONCOMPLIANT, 2, 113, 12, 0, "BWIPP requires standard lengths" },
/* 35*/ { BARCODE_PLANET, -1, 0, "123456789012", ZINT_WARN_NONCOMPLIANT, 2, 133, 12 }, /* 35*/ { BARCODE_PLANET, -1, 0, "123456789012", ZINT_WARN_NONCOMPLIANT, 2, 133, 12, 0, "BWIPP requires standard lengths" },
/* 36*/ { BARCODE_PLANET, -1, 0, "12345678901234", ZINT_WARN_NONCOMPLIANT, 2, 153, 12 }, /* 36*/ { BARCODE_PLANET, -1, 0, "12345678901234", ZINT_WARN_NONCOMPLIANT, 2, 153, 12, 0, "BWIPP requires standard lengths" },
/* 37*/ { BARCODE_PLANET, -1, 0, "1234567890A", ZINT_ERROR_INVALID_DATA, -1, -1, -1 }, /* 37*/ { BARCODE_PLANET, -1, 0, "1234567890A", ZINT_ERROR_INVALID_DATA, -1, -1, -1, 1, "" },
/* 38*/ { BARCODE_KIX, -1, 0, "0123456789ABCDEFGH", 0, 3, 143, 8 }, /* 38*/ { BARCODE_KIX, -1, 0, "0123456789ABCDEFGH", 0, 3, 143, 8, 1, "" },
/* 39*/ { BARCODE_KIX, -1, 0, "a", 0, 3, 7, 8 }, /* Converts to upper */ /* 39*/ { BARCODE_KIX, -1, 0, "a", 0, 3, 7, 8, 1, "" }, /* Converts to upper */
/* 40*/ { BARCODE_KIX, -1, 0, ",", ZINT_ERROR_INVALID_DATA, -1, -1, -1 }, /* 40*/ { BARCODE_KIX, -1, 0, ",", ZINT_ERROR_INVALID_DATA, -1, -1, -1, 1, "" },
/* 41*/ { BARCODE_DAFT, -1, 0, "DAFT", 0, 3, 7, 8 }, /* 41*/ { BARCODE_DAFT, -1, 0, "DAFT", 0, 3, 7, 8, 1, "" },
/* 42*/ { BARCODE_DAFT, -1, 0, "a", 0, 3, 1, 8 }, /* Converts to upper */ /* 42*/ { BARCODE_DAFT, -1, 0, "a", 0, 3, 1, 8, 1, "" }, /* Converts to upper */
/* 43*/ { BARCODE_DAFT, -1, 0, "B", ZINT_ERROR_INVALID_DATA, -1, -1, -1 }, /* 43*/ { BARCODE_DAFT, -1, 0, "B", ZINT_ERROR_INVALID_DATA, -1, -1, -1, 1, "" },
/* 44*/ { BARCODE_DAFT, -1, 1.9, "DAFT", 0, 3, 7, 2 }, /* 44*/ { BARCODE_DAFT, -1, 1.9, "DAFT", 0, 3, 7, 2, 1, "" },
/* 45*/ { BARCODE_DAFT, 500, 0.9, "DAFT", 0, 3, 7, 2 }, /* 50% ratio */ /* 45*/ { BARCODE_DAFT, 500, 0.9, "DAFT", 0, 3, 7, 2, 1, "" }, /* 50% ratio */
/* 46*/ { BARCODE_DAFT, 500, 0.4, "DAFT", 0, 3, 7, 8 }, /* 50% ratio */ /* 46*/ { BARCODE_DAFT, 500, 0.4, "DAFT", 0, 3, 7, 8, 1, "" }, /* 50% ratio */
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol;
char cmp_buf[8192];
char cmp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
testStart("test_input"); testStart("test_input");
for (i = 0; i < data_size; i++) { for (i = 0; i < data_size; i++) {
@ -300,6 +307,21 @@ static void test_input(const testCtx *const p_ctx) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width);
assert_equal(symbol->height, data[i].expected_height, "i:%d symbol->height %g != %g\n", i, symbol->height, data[i].expected_height); assert_equal(symbol->height, data[i].expected_height, "i:%d symbol->height %g != %g\n", i, symbol->height, data[i].expected_height);
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else {
char modules_dump[4096];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i);
ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, modules_dump);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, modules_dump);
}
}
} }
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);

View File

@ -2158,7 +2158,8 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
*gs1_cvt = 1; *gs1_cvt = 1;
} }
return "gs1datamatrix"; return "gs1datamatrix";
} else if (symbology == BARCODE_AZTEC || symbology == BARCODE_ULTRA) { } else if (symbology == BARCODE_AZTEC || symbology == BARCODE_CODE16K || symbology == BARCODE_ULTRA
|| symbology == BARCODE_CODE49) {
if (debug & ZINT_DEBUG_TEST_PRINT) { if (debug & ZINT_DEBUG_TEST_PRINT) {
printf("i:%d %s not BWIPP compatible, GS1_MODE not supported\n", printf("i:%d %s not BWIPP compatible, GS1_MODE not supported\n",
index, testUtilBarcodeName(symbology)); index, testUtilBarcodeName(symbology));
@ -2342,8 +2343,13 @@ static char *testUtilBwippUtf8Convert(const int index, const int symbology, cons
index, eci, testUtilBarcodeName(symbology)); index, eci, testUtilBarcodeName(symbology));
return NULL; return NULL;
} }
if (utf8_to_eci(eci, data, converted, p_data_len) != 0) {
fprintf(stderr, "i:%d testUtilBwippUtf8Convert: failed to convert UTF-8 data for %s, default ECI %d\n",
index, testUtilBarcodeName(symbology), eci);
return NULL;
}
return (char *) data; return (char *) converted;
} }
#define GS_INITIAL_LEN 35 /* Length of cmd up to -q */ #define GS_INITIAL_LEN 35 /* Length of cmd up to -q */
@ -2612,7 +2618,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
|| symbology == BARCODE_USPS_IMAIL || symbology == BARCODE_AUSPOST || symbology == BARCODE_USPS_IMAIL || symbology == BARCODE_AUSPOST
|| symbology == BARCODE_PHARMA_TWO) { || symbology == BARCODE_PHARMA_TWO) {
for (r = 0; r < symbol->rows; r++) bwipp_row_height[r] = 1; /* Zap */ for (r = 0; r < symbol->rows; r++) bwipp_row_height[r] = 1; /* Zap */
if (symbology == BARCODE_KIX) { if (symbology == BARCODE_RM4SCC || symbology == BARCODE_KIX || symbology == BARCODE_JAPANPOST || symbology == BARCODE_DAFT) {
to_upper((unsigned char *) bwipp_data, (int) strlen(bwipp_data)); to_upper((unsigned char *) bwipp_data, (int) strlen(bwipp_data));
} else if (symbology == BARCODE_USPS_IMAIL) { } else if (symbology == BARCODE_USPS_IMAIL) {
char *dash = strchr(bwipp_data, '-'); char *dash = strchr(bwipp_data, '-');
@ -2643,13 +2649,13 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
} }
} else if (symbology == BARCODE_FIM) { } else if (symbology == BARCODE_FIM) {
strcpy(bwipp_data, "fima"); strcpy(bwipp_data, "fima");
bwipp_data[3] = data[0] - 'A' + 'a'; bwipp_data[3] = z_isupper(data[0]) ? data[0] - 'A' + 'a' : data[0];
} else if (symbology == BARCODE_CODE16K || symbology == BARCODE_CODE49) { } else if (symbology == BARCODE_CODE16K || symbology == BARCODE_CODE49) {
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%ssepheight=0", strlen(bwipp_opts_buf) ? " " : ""); sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%ssepheight=0", strlen(bwipp_opts_buf) ? " " : "");
bwipp_opts = bwipp_opts_buf; bwipp_opts = bwipp_opts_buf;
if (option_1 >= 2) { if (option_1 >= 2) {
if ((symbology == BARCODE_CODE16K && option_1 <= 16) if ((symbology == BARCODE_CODE16K && option_1 <= 16)
|| (symbology == BARCODE_CODE49 && option_1 <= 8)) { || (symbology == BARCODE_CODE49 && option_1 <= 8 && option_1 >= symbol->rows)) {
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%srows=%d", sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%srows=%d",
strlen(bwipp_opts_buf) ? " " : "", option_1); strlen(bwipp_opts_buf) ? " " : "", option_1);
} }
@ -3043,8 +3049,8 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
} }
cnt = (int) fread(b, 1, symbol->width, fp); cnt = (int) fread(b, 1, symbol->width, fp);
if (cnt != symbol->width) { if (cnt != symbol->width) {
fprintf(stderr, "i:%d testUtilBwipp: failed to read symbol->width %d bytes, cnt %d (%s)\n", fprintf(stderr, "i:%d testUtilBwipp: failed to read row %d of %d, symbol->width %d bytes, cnt %d (%s)\n",
index, symbol->width, cnt, cmd); index, r + 1, symbol->rows, symbol->width, cnt, cmd);
testutil_pclose(fp); testutil_pclose(fp);
return -1; return -1;
} }
@ -3275,7 +3281,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
{ "Code128", BARCODE_CODE128, 20, }, { "Code128", BARCODE_CODE128, 20, },
{ "ITF", BARCODE_DPLEIT, 21, }, { "ITF", BARCODE_DPLEIT, 21, },
{ "ITF", BARCODE_DPIDENT, 22, }, { "ITF", BARCODE_DPIDENT, 22, },
{ "", BARCODE_CODE16K, 23, }, { "Code16K", BARCODE_CODE16K, 23, },
{ "", BARCODE_CODE49, 24, }, { "", BARCODE_CODE49, 24, },
{ "Code93", BARCODE_CODE93, 25, }, { "Code93", BARCODE_CODE93, 25, },
{ "", -1, 26, }, { "", -1, 26, },
@ -3326,7 +3332,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
{ "DataMatrix", BARCODE_DATAMATRIX, 71, }, { "DataMatrix", BARCODE_DATAMATRIX, 71, },
{ "Code128", BARCODE_EAN14, 72, }, { "Code128", BARCODE_EAN14, 72, },
{ "Code39", BARCODE_VIN, 73, }, { "Code39", BARCODE_VIN, 73, },
{ "", BARCODE_CODABLOCKF, 74, }, { "CodablockF", BARCODE_CODABLOCKF, 74, },
{ "Code128", BARCODE_NVE18, 75, }, { "Code128", BARCODE_NVE18, 75, },
{ "", BARCODE_JAPANPOST, 76, }, { "", BARCODE_JAPANPOST, 76, },
{ "", BARCODE_KOREAPOST, 77, }, { "", BARCODE_KOREAPOST, 77, },
@ -3362,7 +3368,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
{ "", -1, 107, }, { "", -1, 107, },
{ "", BARCODE_HIBC_MICPDF, 108, }, { "", BARCODE_HIBC_MICPDF, 108, },
{ "", -1, 109, }, { "", -1, 109, },
{ "", BARCODE_HIBC_BLOCKF, 110, }, { "CodablockF", BARCODE_HIBC_BLOCKF, 110, },
{ "", -1, 111, }, { "", -1, 111, },
{ "Aztec", BARCODE_HIBC_AZTEC, 112, }, { "Aztec", BARCODE_HIBC_AZTEC, 112, },
{ "", -1, 113, }, { "", -1, 113, },
@ -3427,6 +3433,14 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
index, testUtilBarcodeName(symbology)); index, testUtilBarcodeName(symbology));
return NULL; return NULL;
} }
} else if (symbology == BARCODE_CODABLOCKF || symbology == BARCODE_HIBC_BLOCKF) {
if (symbol->rows == 1) { /* Single row i.e. CODE128 not supported */
if (debug & ZINT_DEBUG_TEST_PRINT) {
printf("i:%d %s not ZXing-C++ compatible, single row not supported\n",
index, testUtilBarcodeName(symbology));
}
return NULL;
}
} else if (is_extendable(symbology)) { } else if (is_extendable(symbology)) {
if (symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK) { if (symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK) {
if (length < 9) { if (length < 9) {

View File

@ -116,36 +116,84 @@ ret /pixs known {
sbs length 1 sub sbs length 1 sub
} ifelse def } ifelse def
% If should use bhs/bbs to emulate rows (DAFT/pharmacode2) (hacky)
/nosbs false def /nosbs false def
/minh 999999 def
/midh 0 def % Check for pharmacode2
/maxh 0 def b (pharmacode2) eq {
/maxb 0 def /nosbs true def
systemdict /hs known ret /bhs known and ret /bbs known and {
/bhs ret /bhs get def /bhs ret /bhs get def
/bbs ret /bbs get def /bbs ret /bbs get def
0 1 bbs length 1 sub {
/i exch def
i 0 ne { (0) print } if
bbs i get 0.1 lt {
bhs i get 0.3 gt { (1) print } { (0) print } ifelse
} {
bhs i get 0.1 gt { (1) print } { (0) print } ifelse
} ifelse
} for
n { (\n) print } if
0 1 bbs length 1 sub {
/i exch def
i 0 ne { (0) print } if
bbs i get 0.1 lt {
bhs i get 0.1 gt { (1) print } { (0) print } ifelse
} {
bhs i get 0.3 gt { (1) print } { (0) print } ifelse
} ifelse
} for
n { (\n) print } if
} if
% Check for 2-track postal
b (postnet) eq b (planet) eq or {
/nosbs true def
/bhs ret /bhs get def
0 1 bhs length 1 sub { 0 1 bhs length 1 sub {
/i exch def /i exch def
/h bhs i get def i 0 ne { (0) print } if
/b bbs i get def bhs i get 0.1 gt { (1) print } { (0) print } ifelse
h minh lt { /minh h def } if
h maxh gt { /maxh h def } if
h minh ne h maxh ne and { /midh h def } if
b maxb gt { /maxb b def } if
} for } for
0 1 limit { n { (\n) print } if
0 1 bhs length 1 sub {
/i exch def /i exch def
i 2 mod 0 eq { % i is even i 0 ne { (0) print } if
/h bhs i 2 idiv get def bhs i get 0.01 lt { (0) print } { (1) print } ifelse
/b bbs i 2 idiv get def } for
h maxh eq h midh eq b maxb eq and or maxb 0 ne b maxb eq and midh 0 eq and h minh eq and or { (1) } { (0) } ifelse print % Yeah, me too n { (\n) print } if
} if
% Check for 4-track postal
b (auspost) eq b (kix) eq or b (royalmail) eq or b (onecode) eq or b (japanpost) eq or b (daft) eq or {
/nosbs true def
/bhs ret /bhs get def
/bbs ret /bbs get def
0 1 bbs length 1 sub {
/i exch def
i 0 ne { (0) print } if
bbs i get 0.05 lt {
bhs i get 0.14 gt { (1) print } { (0) print } ifelse
} {
bhs i get 0.09 gt { (1) print } { (0) print } ifelse
} ifelse
} for
n { (\n) print } if
0 1 bbs length 1 sub {
/i exch def
i 0 ne { (0) print } if
(1) print
} for
n { (\n) print } if
0 1 bbs length 1 sub {
/i exch def
i 0 ne { (0) print } if
bbs i get 0.05 lt {
bhs i get 0.09 gt { (1) print } { (0) print } ifelse
} { } {
(0) print (0) print
} ifelse } ifelse
} for } for
n { (\n) print } if n { (\n) print } if
maxb 0 ne midh 0 eq and maxb 0 eq minh maxh eq and or { /nosbs true def } if % No tracker (pharmacode2)
} if } if
% Process sbs % Process sbs
@ -162,20 +210,6 @@ ret /pixs known {
} for } for
n { (\n) print } if n { (\n) print } if
} if } if
% Third row if DAFT, second row if no tracker (pharmacode2)
maxb 0 ne midh 0 ne or minh maxh eq or {
0 1 limit {
/i exch def
i 2 mod 0 eq { % i is even
/b bbs i 2 idiv get def
b 0 eq { (1) } { (0) } ifelse print
} {
(0) print
} ifelse
} for
n { (\n) print } if
} if
} if } if
} ifelse } ifelse

View File

@ -14,17 +14,22 @@ function run_bwipp_test() {
} }
run_bwipp_test "test_2of5" "encode" run_bwipp_test "test_2of5" "encode"
run_bwipp_test "test_auspost" "input"
run_bwipp_test "test_auspost" "encode" run_bwipp_test "test_auspost" "encode"
run_bwipp_test "test_aztec" "encode" run_bwipp_test "test_aztec" "encode"
run_bwipp_test "test_aztec" "encode_segs" run_bwipp_test "test_aztec" "encode_segs"
run_bwipp_test "test_bc412" run_bwipp_test "test_bc412"
run_bwipp_test "test_channel" "encode" run_bwipp_test "test_channel" "encode"
run_bwipp_test "test_codablock" "input"
run_bwipp_test "test_codablock" "encode" run_bwipp_test "test_codablock" "encode"
run_bwipp_test "test_code" "encode" run_bwipp_test "test_code" "encode"
run_bwipp_test "test_code1" "encode" run_bwipp_test "test_code1" "encode"
run_bwipp_test "test_code1" "encode_segs" run_bwipp_test "test_code1" "encode_segs"
run_bwipp_test "test_code128" "input"
run_bwipp_test "test_code128" "encode" run_bwipp_test "test_code128" "encode"
run_bwipp_test "test_code16k" "input"
run_bwipp_test "test_code16k" "encode" run_bwipp_test "test_code16k" "encode"
run_bwipp_test "test_code49" "input"
run_bwipp_test "test_code49" "encode" run_bwipp_test "test_code49" "encode"
run_bwipp_test "test_composite" run_bwipp_test "test_composite"
run_bwipp_test "test_dmatrix" "input" run_bwipp_test "test_dmatrix" "input"
@ -34,15 +39,18 @@ run_bwipp_test "test_dotcode" "input"
run_bwipp_test "test_dotcode" "encode" run_bwipp_test "test_dotcode" "encode"
run_bwipp_test "test_dotcode" "encode_segs" run_bwipp_test "test_dotcode" "encode_segs"
run_bwipp_test "test_gs1" "gs1_reduce" run_bwipp_test "test_gs1" "gs1_reduce"
run_bwipp_test "test_imail" "input"
run_bwipp_test "test_imail" "encode" run_bwipp_test "test_imail" "encode"
run_bwipp_test "test_maxicode" "input" run_bwipp_test "test_maxicode" "input"
run_bwipp_test "test_maxicode" "encode" run_bwipp_test "test_maxicode" "encode"
run_bwipp_test "test_maxicode" "encode_segs" run_bwipp_test "test_maxicode" "encode_segs"
run_bwipp_test "test_medical" "input"
run_bwipp_test "test_medical" "encode" run_bwipp_test "test_medical" "encode"
run_bwipp_test "test_pdf417" "input" run_bwipp_test "test_pdf417" "input"
run_bwipp_test "test_pdf417" "encode" run_bwipp_test "test_pdf417" "encode"
run_bwipp_test "test_pdf417" "encode_segs" run_bwipp_test "test_pdf417" "encode_segs"
run_bwipp_test "test_plessey" "encode" run_bwipp_test "test_plessey" "encode"
run_bwipp_test "test_postal" "input"
run_bwipp_test "test_postal" "encode" run_bwipp_test "test_postal" "encode"
run_bwipp_test "test_qr" run_bwipp_test "test_qr"
run_bwipp_test "test_rss" run_bwipp_test "test_rss"

View File

@ -16,8 +16,13 @@ function run_zxingcpp_test() {
run_zxingcpp_test "test_2of5" "encode" run_zxingcpp_test "test_2of5" "encode"
run_zxingcpp_test "test_aztec" "encode" run_zxingcpp_test "test_aztec" "encode"
run_zxingcpp_test "test_aztec" "encode_segs" run_zxingcpp_test "test_aztec" "encode_segs"
run_zxingcpp_test "test_codablock" "input"
run_zxingcpp_test "test_codablock" "encode"
run_zxingcpp_test "test_code" "encode" run_zxingcpp_test "test_code" "encode"
run_zxingcpp_test "test_code128" "input"
run_zxingcpp_test "test_code128" "encode" run_zxingcpp_test "test_code128" "encode"
run_zxingcpp_test "test_code16k" "input"
run_zxingcpp_test "test_code16k" "encode"
run_zxingcpp_test "test_dmatrix" "input" run_zxingcpp_test "test_dmatrix" "input"
run_zxingcpp_test "test_dmatrix" "encode" run_zxingcpp_test "test_dmatrix" "encode"
run_zxingcpp_test "test_dmatrix" "encode_segs" run_zxingcpp_test "test_dmatrix" "encode_segs"

View File

@ -421,7 +421,8 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
struct zint_vector_hexagon *hexagon, *last_hexagon = NULL; struct zint_vector_hexagon *hexagon, *last_hexagon = NULL;
struct zint_vector_string *last_string = NULL; struct zint_vector_string *last_string = NULL;
struct zint_vector_circle *circle, *last_circle = NULL; struct zint_vector_circle *circle, *last_circle = NULL;
struct zint_vector_rect **first_row_rects = z_alloca(sizeof(struct zint_vector_rect *) * (symbol->rows + 1)); struct zint_vector_rect **first_row_rects
= (struct zint_vector_rect **) z_alloca(sizeof(struct zint_vector_rect *) * (symbol->rows + 1));
memset(first_row_rects, 0, sizeof(struct zint_vector_rect *) * (symbol->rows + 1)); memset(first_row_rects, 0, sizeof(struct zint_vector_rect *) * (symbol->rows + 1));

View File

@ -1,6 +1,6 @@
% Zint Barcode Generator and Zint Barcode Studio User Manual % Zint Barcode Generator and Zint Barcode Studio User Manual
% Version 2.11.1.9 % Version 2.11.1.9
% September 2022 % October 2022
# 1. Introduction # 1. Introduction
@ -1022,7 +1022,7 @@ Symbology Default character sets Alternate if input not Latin-1
Aztec Code Latin-1 None Aztec Code Latin-1 None
Codablock-F Latin-1 None Codablock-F Latin-1 None
Code 128 Latin-1 None Code 128 Latin-1 None
Code 16k Latin-1 None Code 16K Latin-1 None
Code One Latin-1 None Code One Latin-1 None
Data Matrix Latin-1 None Data Matrix Latin-1 None
DotCode Latin-1 None DotCode Latin-1 None

View File

@ -1,6 +1,6 @@
Zint Barcode Generator and Zint Barcode Studio User Manual Zint Barcode Generator and Zint Barcode Studio User Manual
Version 2.11.1.9 Version 2.11.1.9
September 2022 October 2022
******************************************************************************* *******************************************************************************
* For reference the following is a text-only version of the Zint manual, * * For reference the following is a text-only version of the Zint manual, *
@ -1122,7 +1122,7 @@ Latin-2 (ISO/IEC 8859-2 plus ASCII).
Aztec Code Latin-1 None Aztec Code Latin-1 None
Codablock-F Latin-1 None Codablock-F Latin-1 None
Code 128 Latin-1 None Code 128 Latin-1 None
Code 16k Latin-1 None Code 16K Latin-1 None
Code One Latin-1 None Code One Latin-1 None
Data Matrix Latin-1 None Data Matrix Latin-1 None
DotCode Latin-1 None DotCode Latin-1 None
@ -4121,7 +4121,7 @@ defined.
Annex B. Man Page ZINT(1) Annex B. Man Page ZINT(1)
% ZINT(1) Version 2.11.1.9 % % August 2022 % ZINT(1) Version 2.11.1.9 % % October 2022
NAME NAME
@ -4333,7 +4333,7 @@ OPTIONS
--heightperrow --heightperrow
Treat height as per-row. Affects Codablock-F, Code16K, Code 49, GS1 DataBar Treat height as per-row. Affects Codablock-F, Code 16K, Code 49, GS1 DataBar
Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417. Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417.
-i, --input=FILE -i, --input=FILE
@ -4419,7 +4419,7 @@ OPTIONS
--rows=INTEGER --rows=INTEGER
Set the number of rows for Codablock-F or PDF417 to INTEGER. It will also Set the number of rows for Codablock-F or PDF417 to INTEGER. It will also
set the minimum number of rows for Code 16k or Code 49, and the maximum set the minimum number of rows for Code 16K or Code 49, and the maximum
number of rows for GS1 DataBar Expanded Stacked (DBAR_EXPSTK). number of rows for GS1 DataBar Expanded Stacked (DBAR_EXPSTK).
--scale=NUMBER --scale=NUMBER

View File

@ -1,4 +1,4 @@
.\" Automatically generated by Pandoc 2.18 .\" Automatically generated by Pandoc 2.19.2
.\" .\"
.\" Define V font for inline verbatim, using C font in formats .\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font. .\" that render this, and otherwise B font.
@ -14,7 +14,7 @@
. ftr VB CB . ftr VB CB
. ftr VBI CBI . ftr VBI CBI
.\} .\}
.TH "ZINT" "1" "August 2022" "Version 2.11.1.9" "" .TH "ZINT" "1" "October 2022" "Version 2.11.1.9" ""
.hy .hy
.SH NAME .SH NAME
.PP .PP
@ -238,7 +238,7 @@ Set the height of the symbol in multiples of the X-dimension.
.TP .TP
\f[V]--heightperrow\f[R] \f[V]--heightperrow\f[R]
Treat height as per-row. Treat height as per-row.
Affects Codablock-F, Code16K, Code 49, GS1 DataBar Expanded Stacked Affects Codablock-F, Code 16K, Code 49, GS1 DataBar Expanded Stacked
(DBAR_EXPSTK), MicroPDF417 and PDF417. (DBAR_EXPSTK), MicroPDF417 and PDF417.
.TP .TP
\f[V]-i\f[R], \f[V]--input=FILE\f[R] \f[V]-i\f[R], \f[V]--input=FILE\f[R]
@ -332,7 +332,7 @@ can be 0, 90, 270 or 360.
.TP .TP
\f[V]--rows=INTEGER\f[R] \f[V]--rows=INTEGER\f[R]
Set the number of rows for Codablock-F or PDF417 to \f[I]INTEGER\f[R]. Set the number of rows for Codablock-F or PDF417 to \f[I]INTEGER\f[R].
It will also set the minimum number of rows for Code 16k or Code 49, and It will also set the minimum number of rows for Code 16K or Code 49, and
the maximum number of rows for GS1 DataBar Expanded Stacked the maximum number of rows for GS1 DataBar Expanded Stacked
(DBAR_EXPSTK). (DBAR_EXPSTK).
.TP .TP

View File

@ -1,6 +1,6 @@
% ZINT(1) Version 2.11.1.9 % ZINT(1) Version 2.11.1.9
% %
% August 2022 % October 2022
# NAME # NAME
@ -187,7 +187,7 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--heightperrow` `--heightperrow`
: Treat height as per-row. Affects Codablock-F, Code16K, Code 49, GS1 DataBar Expanded Stacked (DBAR_EXPSTK), : Treat height as per-row. Affects Codablock-F, Code 16K, Code 49, GS1 DataBar Expanded Stacked (DBAR_EXPSTK),
MicroPDF417 and PDF417. MicroPDF417 and PDF417.
`-i`, `--input=FILE` `-i`, `--input=FILE`
@ -269,7 +269,7 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--rows=INTEGER` `--rows=INTEGER`
: Set the number of rows for Codablock-F or PDF417 to *INTEGER*. It will also set the minimum number of rows for : Set the number of rows for Codablock-F or PDF417 to *INTEGER*. It will also set the minimum number of rows for
Code 16k or Code 49, and the maximum number of rows for GS1 DataBar Expanded Stacked (DBAR_EXPSTK). Code 16K or Code 49, and the maximum number of rows for GS1 DataBar Expanded Stacked (DBAR_EXPSTK).
`--scale=NUMBER` `--scale=NUMBER`

View File

@ -76,7 +76,7 @@ static void types(void) {
"20 CODE128 Code 128 89 ITF14 ITF-14\n" "20 CODE128 Code 128 89 ITF14 ITF-14\n"
"21 DPLEIT Deutsche Post Leitcode 90 KIX Dutch Post KIX Code\n" "21 DPLEIT Deutsche Post Leitcode 90 KIX Dutch Post KIX Code\n"
"22 DPIDENT Deutsche Post Identcode 92 AZTEC Aztec Code\n" "22 DPIDENT Deutsche Post Identcode 92 AZTEC Aztec Code\n"
"23 CODE16K Code 16k 93 DAFT DAFT Code\n" "23 CODE16K Code 16K 93 DAFT DAFT Code\n"
"24 CODE49 Code 49 96 DPD DPD Parcel Code 128\n" "24 CODE49 Code 49 96 DPD DPD Parcel Code 128\n"
"25 CODE93 Code 93 97 MICROQR Micro QR Code\n" "25 CODE93 Code 93 97 MICROQR Micro QR Code\n"
"28 FLAT Flattermarken 98 HIBC_128 HIBC Code 128\n" "28 FLAT Flattermarken 98 HIBC_128 HIBC Code 128\n"

View File

@ -79,7 +79,7 @@ static const struct bstyle_item bstyle_items[] = {
{ QSL("Codablock-F (and HIBC)"), BARCODE_CODABLOCKF }, { QSL("Codablock-F (and HIBC)"), BARCODE_CODABLOCKF },
{ QSL("Code 11"), BARCODE_CODE11 }, { QSL("Code 11"), BARCODE_CODE11 },
{ QSL("Code 128 (ISO 15417) (and GS1-128 and HIBC)"), BARCODE_CODE128 }, { QSL("Code 128 (ISO 15417) (and GS1-128 and HIBC)"), BARCODE_CODE128 },
{ QSL("Code 16k (EN 12323)"), BARCODE_CODE16K }, { QSL("Code 16K (EN 12323)"), BARCODE_CODE16K },
{ QSL("Code 2 of 5 Data Logic"), BARCODE_C25LOGIC }, { QSL("Code 2 of 5 Data Logic"), BARCODE_C25LOGIC },
{ QSL("Code 2 of 5 IATA"), BARCODE_C25IATA }, { QSL("Code 2 of 5 IATA"), BARCODE_C25IATA },
{ QSL("Code 2 of 5 Industrial"), BARCODE_C25IND }, { QSL("Code 2 of 5 Industrial"), BARCODE_C25IND },

View File

@ -67,7 +67,6 @@
<PrecompiledHeader /> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
@ -101,7 +100,6 @@
<PrecompiledHeader /> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat /> <DebugInformationFormat />
<CompileAs>CompileAsCpp</CompileAs>
<DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>

View File

@ -41,7 +41,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\support\lpng169;&quot;..\..\zlib128-dll\include&quot;" AdditionalIncludeDirectories="..\..\..\lpng;..\..\..\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION=&quot;\&quot;2.11.1.9\&quot;&quot;;BUILD_ZINT_DLL;ZLIB_DLL;PNG_DLL;DEBUG" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION=&quot;\&quot;2.11.1.9\&quot;&quot;;BUILD_ZINT_DLL;ZLIB_DLL;PNG_DLL;DEBUG"
MinimalRebuild="true" MinimalRebuild="true"
ExceptionHandling="0" ExceptionHandling="0"
@ -52,7 +52,7 @@
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
DebugInformationFormat="4" DebugInformationFormat="4"
CompileAs="2" CompileAs="0"
DisableSpecificWarnings="4018;4244;4305" DisableSpecificWarnings="4018;4244;4305"
/> />
<Tool <Tool
@ -68,10 +68,10 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
LinkLibraryDependencies="false" LinkLibraryDependencies="false"
AdditionalDependencies="libpngd.lib zlibd.lib" AdditionalDependencies="libpng16_static.lib zlib.lib"
OutputFile="$(OutDir)\zintd.dll" OutputFile="$(OutDir)\zintd.dll"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\support\lpng169\projects\visualc71\Win32_LIB_Debug;..\..\..\support\lpng169\projects\visualc71\Win32_LIB_Debug\ZLib" AdditionalLibraryDirectories="..\..\..\lpng\build\Release;..\..\..\zlib"
IgnoreDefaultLibraryNames="libcmtd.lib" IgnoreDefaultLibraryNames="libcmtd.lib"
GenerateDebugInformation="true" GenerateDebugInformation="true"
SubSystem="2" SubSystem="2"
@ -126,7 +126,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="2" Optimization="2"
EnableIntrinsicFunctions="false" EnableIntrinsicFunctions="false"
AdditionalIncludeDirectories="..\..\..\support\lpng169;&quot;..\..\zlib128-dll\include&quot;" AdditionalIncludeDirectories="..\..\..\lpng;..\..\..\zlib"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION=&quot;\&quot;2.11.1.9\&quot;&quot;;BUILD_ZINT_DLL;ZLIB_DLL;PNG_DLL" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_WARNINGS;ZINT_VERSION=&quot;\&quot;2.11.1.9\&quot;&quot;;BUILD_ZINT_DLL;ZLIB_DLL;PNG_DLL"
StringPooling="true" StringPooling="true"
ExceptionHandling="0" ExceptionHandling="0"
@ -136,7 +136,7 @@
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
DebugInformationFormat="0" DebugInformationFormat="0"
CompileAs="2" CompileAs="0"
DisableSpecificWarnings="4018;4244;4305" DisableSpecificWarnings="4018;4244;4305"
/> />
<Tool <Tool
@ -152,10 +152,10 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
LinkLibraryDependencies="false" LinkLibraryDependencies="false"
AdditionalDependencies="libpng.lib zlib.lib" AdditionalDependencies="libpng16_static.lib zlib.lib"
OutputFile="$(OutDir)\zint.dll" OutputFile="$(OutDir)\zint.dll"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\support\lpng169\projects\visualc71\Win32_LIB_Release;..\..\..\support\lpng169\projects\visualc71\Win32_LIB_Release\ZLib" AdditionalLibraryDirectories="..\..\..\lpng\build\Release;..\..\..\zlib"
GenerateDebugInformation="false" GenerateDebugInformation="false"
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
@ -221,7 +221,7 @@
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
DebugInformationFormat="0" DebugInformationFormat="0"
CompileAs="2" CompileAs="0"
DisableSpecificWarnings="4018;4244;4305" DisableSpecificWarnings="4018;4244;4305"
/> />
<Tool <Tool
@ -264,59 +264,59 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> >
<File <File
RelativePath="..\backend\2of5.c" RelativePath="..\..\backend\2of5.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\auspost.c" RelativePath="..\..\backend\auspost.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\aztec.c" RelativePath="..\..\backend\aztec.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\bc412.c" RelativePath="..\..\backend\bc412.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\bmp.c" RelativePath="..\..\backend\bmp.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\codablock.c" RelativePath="..\..\backend\codablock.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\code.c" RelativePath="..\..\backend\code.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\code1.c" RelativePath="..\..\backend\code1.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\code128.c" RelativePath="..\..\backend\code128.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\code16k.c" RelativePath="..\..\backend\code16k.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\code49.c" RelativePath="..\..\backend\code49.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\common.c" RelativePath="..\..\backend\common.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\composite.c" RelativePath="..\..\backend\composite.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\dllversion.c" RelativePath="..\..\backend\dllversion.c"
> >
<FileConfiguration <FileConfiguration
Name="Release_LIB|Win32" Name="Release_LIB|Win32"
@ -328,131 +328,131 @@
</FileConfiguration> </FileConfiguration>
</File> </File>
<File <File
RelativePath="..\backend\dmatrix.c" RelativePath="..\..\backend\dmatrix.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\dotcode.c" RelativePath="..\..\backend\dotcode.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\eci.c" RelativePath="..\..\backend\eci.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\emf.c" RelativePath="..\..\backend\emf.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\general_field.c" RelativePath="..\..\backend\general_field.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\gif.c" RelativePath="..\..\backend\gif.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\gridmtx.c" RelativePath="..\..\backend\gridmtx.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\gs1.c" RelativePath="..\..\backend\gs1.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\hanxin.c" RelativePath="..\..\backend\hanxin.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\imail.c" RelativePath="..\..\backend\imail.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\large.c" RelativePath="..\..\backend\large.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\library.c" RelativePath="..\..\backend\library.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\mailmark.c" RelativePath="..\..\backend\mailmark.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\maxicode.c" RelativePath="..\..\backend\maxicode.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\medical.c" RelativePath="..\..\backend\medical.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\output.c" RelativePath="..\..\backend\output.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\pcx.c" RelativePath="..\..\backend\pcx.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\pdf417.c" RelativePath="..\..\backend\pdf417.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\plessey.c" RelativePath="..\..\backend\plessey.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\png.c" RelativePath="..\..\backend\png.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\postal.c" RelativePath="..\..\backend\postal.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\ps.c" RelativePath="..\..\backend\ps.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\qr.c" RelativePath="..\..\backend\qr.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\raster.c" RelativePath="..\..\backend\raster.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\reedsol.c" RelativePath="..\..\backend\reedsol.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\rss.c" RelativePath="..\..\backend\rss.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\svg.c" RelativePath="..\..\backend\svg.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\telepen.c" RelativePath="..\..\backend\telepen.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\tif.c" RelativePath="..\..\backend\tif.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\ultra.c" RelativePath="..\..\backend\ultra.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\upcean.c" RelativePath="..\..\backend\upcean.c"
> >
</File> </File>
<File <File
RelativePath="..\backend\vector.c" RelativePath="..\..\backend\vector.c"
> >
</File> </File>
</Filter> </Filter>
@ -462,171 +462,171 @@
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
> >
<File <File
RelativePath="..\backend\aztec.h" RelativePath="..\..\backend\aztec.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\big5.h" RelativePath="..\..\backend\big5.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\bmp.h" RelativePath="..\..\backend\bmp.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\channel_precalcs.h" RelativePath="..\..\backend\channel_precalcs.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\code1.h" RelativePath="..\..\backend\code1.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\code128.h" RelativePath="..\..\backend\code128.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\code49.h" RelativePath="..\..\backend\code49.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\common.h" RelativePath="..\..\backend\common.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\composite.h" RelativePath="..\..\backend\composite.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\dmatrix.h" RelativePath="..\..\backend\dmatrix.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\dmatrix_trace.h" RelativePath="..\..\backend\dmatrix_trace.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\eci.h" RelativePath="..\..\backend\eci.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\eci_sb.h" RelativePath="..\..\backend\eci_sb.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\emf.h" RelativePath="..\..\backend\emf.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\font.h" RelativePath="..\..\backend\font.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\gb18030.h" RelativePath="..\..\backend\gb18030.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\gb2312.h" RelativePath="..\..\backend\gb2312.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\gbk.h" RelativePath="..\..\backend\gbk.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\general_field.h" RelativePath="..\..\backend\general_field.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\gridmtx.h" RelativePath="..\..\backend\gridmtx.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\gs1.h" RelativePath="..\..\backend\gs1.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\gs1_lint.h" RelativePath="..\..\backend\gs1_lint.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\hanxin.h" RelativePath="..\..\backend\hanxin.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\iso3166.h" RelativePath="..\..\backend\iso3166.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\iso4217.h" RelativePath="..\..\backend\iso4217.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\ksx1001.h" RelativePath="..\..\backend\ksx1001.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\large.h" RelativePath="..\..\backend\large.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\maxicode.h" RelativePath="..\..\backend\maxicode.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\output.h" RelativePath="..\..\backend\output.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\pcx.h" RelativePath="..\..\backend\pcx.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\pdf417.h" RelativePath="..\..\backend\pdf417.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\pdf417_tabs.h" RelativePath="..\..\backend\pdf417_tabs.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\qr.h" RelativePath="..\..\backend\qr.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\reedsol.h" RelativePath="..\..\backend\reedsol.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\reedsol_logs.h" RelativePath="..\..\backend\reedsol_logs.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\rss.h" RelativePath="..\..\backend\rss.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\sjis.h" RelativePath="..\..\backend\sjis.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\tif.h" RelativePath="..\..\backend\tif.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\tif_lzw.h" RelativePath="..\..\backend\tif_lzw.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\zfiletypes.h" RelativePath="..\..\backend\zfiletypes.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\zint.h" RelativePath="..\..\backend\zint.h"
> >
</File> </File>
<File <File
RelativePath="..\backend\zintconfig.h" RelativePath="..\..\backend\zintconfig.h"
> >
</File> </File>
</Filter> </Filter>
@ -636,7 +636,7 @@
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
> >
<File <File
RelativePath="..\backend\libzint.rc" RelativePath="..\..\backend\libzint.rc"
> >
<FileConfiguration <FileConfiguration
Name="Release_LIB|Win32" Name="Release_LIB|Win32"

View File

@ -127,7 +127,6 @@
<PrecompiledHeader /> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
@ -161,7 +160,6 @@
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
@ -193,7 +191,6 @@
<PrecompiledHeader /> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat /> <DebugInformationFormat />
<CompileAs>CompileAsCpp</CompileAs>
<DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
@ -230,7 +227,6 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat> <DebugInformationFormat>
</DebugInformationFormat> </DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
@ -263,7 +259,6 @@
<PrecompiledHeader /> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat /> <DebugInformationFormat />
<CompileAs>CompileAsCpp</CompileAs>
<DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
@ -290,7 +285,6 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat> <DebugInformationFormat>
</DebugInformationFormat> </DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>

View File

@ -51,7 +51,6 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat> <DebugInformationFormat>
</DebugInformationFormat> </DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<BufferSecurityCheck>false</BufferSecurityCheck> <BufferSecurityCheck>false</BufferSecurityCheck>
<PrecompiledHeaderFile> <PrecompiledHeaderFile>

View File

@ -67,7 +67,6 @@
<PrecompiledHeader /> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
<DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>
@ -101,7 +100,6 @@
<PrecompiledHeader /> <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat /> <DebugInformationFormat />
<CompileAs>CompileAsCpp</CompileAs>
<DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings> <DisableSpecificWarnings>4018;4244;4305;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile> </ClCompile>
<ResourceCompile> <ResourceCompile>