diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a3221f2..c3ba22c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,9 +53,12 @@ if(NOT MSVC) # Use default warnings if MSVC otherwise inundated add_compile_options("-Wextra") endif() - check_c_compiler_flag("-Wpedantic" C_COMPILER_FLAG_WPEDANTIC) - if(C_COMPILER_FLAG_WPEDANTIC) - add_compile_options("-Wpedantic") + # gcc complains about "%n$" `errtxtf()` arguments if "-Wpedantic" used, so only use for clang + if(CMAKE_C_COMPILER_ID MATCHES "Clang") + check_c_compiler_flag("-Wpedantic" C_COMPILER_FLAG_WPEDANTIC) + if(C_COMPILER_FLAG_WPEDANTIC) + add_compile_options("-Wpedantic") + endif() endif() check_c_compiler_flag("-Wundef" C_COMPILER_FLAG_WUNDEF) diff --git a/ChangeLog b/ChangeLog index 74b1a673..e8cbfce0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,8 @@ Version 2.13.0.9 (dev) not released yet - New `memfile` & `memfile_size` fields in `symbol` for use with new output option `BARCODE_MEMORY_FILE` - Invalid `input_mode` now returns warning +- Aztec Code symbols that due to input length & user-requested version have less + than recommended 5% error correction codewords now return warning - New CODE128-only special extra escape `\^1` for manually inserting FNC1s Changes @@ -15,15 +17,30 @@ Changes - Add `BARCODE_MEMORY_FILE` to `symbol->output_options` to allow outputting to in-memory buffer `symbol->memfile` instead of to file `symbol->outfile`, ticket #301 -- CODE128: improve encodation on A/B shifting, props Daniel Gredler (Okapi) +- CODE16K (was for CODE128): improve encodation on A/B shifting, props Daniel + Gredler (Okapi) +- CODE128: add new extra escape `\^1` for manual insertion of FNC1s, ticket + #324, props Jim Shank; + add minimal encodation algorithm (non-extended ASCII only), props Alex Geller + (ZXing); + reduce extended latch cut-off from 5 to 4 for better encodation in certain + cases, props lyngklip (BWIPP) - library: return warning on invalid `input_mode` reset -- GS1: new AIs 7250-7259 (GSCN 22-246), new linters `yyyymmdd()`, `iso5218()`, - `posinseqslash()`; remove old linter `iso3166list`; - iso4217: new ISO 4217 currency code 924 +- library/CLI: expanded error messages +- GS1: new AIs 7250-7259 (GSCN 22-246); + iso4217: new ISO 4217 currency code 924; + new AIs 7041 (GSCN 23-272) (packagetype) and 716 (GSCN-24-157) - AZTEC: workaround MSVC 2022 optimizer bug in `az_populate_map()` loops, - ticket #317, props Andre Maute -- CODE128: Add new extra escape `\^1` for manual insertion of FNC1s, ticket - #324, props Jim Shank + ticket #317, props Andre Maute; + return warning if ECC < 5% (due to bit-stuffing when version given) +- MAXICODE: zero-pad US postcodes that lack "+4" (Annex B.1.4a), from + OkapiBarcode, props Daniel Gredler +- GUI: use X11 (xcb) as platform instead of Wayland on Linux to avoid various + weird behaviours; + in "grpDATF.ui" use "PlainText" rather than "RichText" for tracker ratio + examples as height of text messing up sometimes +- manual: make explicit that AI "(00)" and "(01)" prefixes added by Zint are + HRT-only; clarify Codablock-F length maximum & add examples Bugs ---- @@ -37,8 +54,10 @@ Bugs - ITF14/DPLEIT/DPIDENT: ignore `option_2` (check digit options) - GUI: scalewindow: fix cropping of initial resolution and bound X-dim <= 10 - GUI: factory reset: reset preview background colour also +- GUI: cliwindow: `#if _WIN32` -> `#ifdef _WIN32` - QZint: fix legacy width and security level getters/setters, MR #158, props Philip Ye +- CODE128: fix extended char latching when exactly 3 extended chars at end Version 2.13.0 (2023-12-18) diff --git a/backend/2of5.c b/backend/2of5.c index fea1408d..2f062559 100644 --- a/backend/2of5.c +++ b/backend/2of5.c @@ -66,13 +66,14 @@ static int c25_common(struct zint_symbol *symbol, const unsigned char source[], if (length > max) { /* errtxt 301: 303: 305: 307: */ - sprintf(symbol->errtxt, "%d: Input too long (%d character maximum)", error_base, max); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, error_base, "Input length %1$d too long (maximum %2$d)", length, + max); } - if (!is_sane(NEON_F, source, length)) { + if ((i = not_sane(NEON_F, source, length))) { + /* Note: for all "at position" error messages, escape sequences not accounted for */ /* errtxt 302: 304: 306: 308: */ - sprintf(symbol->errtxt, "%d: Invalid character in data (digits only)", error_base + 1); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, error_base + 1, + "Invalid character at position %d in input (digits only)", i); } ustrcpy(temp, source); @@ -147,12 +148,11 @@ static int c25_inter_common(struct zint_symbol *symbol, unsigned char source[], const int have_checkdigit = checkdigit_option == 1 || checkdigit_option == 2; if (length > 125) { /* 4 + (125 + 1) * 9 + 5 = 1143 */ - strcpy(symbol->errtxt, "309: Input too long (125 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 309, "Input length %d too long (maximum 125)", length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "310: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 310, + "Invalid character at position %d in input (digits only)", i); } /* Input must be an even number of characters for Interlaced 2 of 5 to work: @@ -233,13 +233,12 @@ INTERNAL int itf14(struct zint_symbol *symbol, unsigned char source[], int lengt unsigned char localstr[16] = {0}; if (length > 13) { - strcpy(symbol->errtxt, "311: Input too long (13 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 311, "Input length %d too long (maximum 13)", length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "312: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 312, + "Invalid character at position %d in input (digits only)", i); } /* Add leading zeros as required */ @@ -298,12 +297,11 @@ INTERNAL int dpleit(struct zint_symbol *symbol, unsigned char source[], int leng count = 0; if (length > 13) { - strcpy(symbol->errtxt, "313: Input wrong length (13 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 313, "Input length %d too long (maximum 13)", length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "314: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 314, + "Invalid character at position %d in input (digits only)", i); } zeroes = 13 - length; @@ -346,12 +344,11 @@ INTERNAL int dpident(struct zint_symbol *symbol, unsigned char source[], int len count = 0; if (length > 11) { - strcpy(symbol->errtxt, "315: Input wrong length (11 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 315, "Input length %d too long (maximum 11)", length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "316: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 316, + "Invalid character at position %d in input (digits only)", i); } zeroes = 11 - length; diff --git a/backend/auspost.c b/backend/auspost.c index ef233cf8..b27a2fd0 100644 --- a/backend/auspost.c +++ b/backend/auspost.c @@ -110,6 +110,7 @@ INTERNAL int auspost(struct zint_symbol *symbol, unsigned char source[], int len 1 = Tracker and Ascender 2 = Tracker and Descender 3 = Tracker only */ + int i; int error_number; int writer; int loopey, reader; @@ -123,18 +124,17 @@ INTERNAL int auspost(struct zint_symbol *symbol, unsigned char source[], int len /* Do all of the length checking first to avoid stack smashing */ if (symbol->symbology == BARCODE_AUSPOST) { if (length != 8 && length != 13 && length != 16 && length != 18 && length != 23) { - strcpy(symbol->errtxt, "401: Input wrong length (8, 13, 16, 18 or 23 characters only)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 401, "Input length %d wrong (8, 13, 16, 18 or 23 only)", + length); } } else if (length > 8) { - strcpy(symbol->errtxt, "403: Input too long (8 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 403, "Input length %d too long (maximum 8)", length); } /* Check input immediately to catch nuls */ - if (!is_sane(GDSET_F, source, length)) { - strcpy(symbol->errtxt, "404: Invalid character in data (alphanumerics, space and \"#\" only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(GDSET_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 404, + "Invalid character at position %d in input (alphanumerics, space and \"#\" only)", i); } localstr[0] = '\0'; @@ -150,9 +150,10 @@ INTERNAL int auspost(struct zint_symbol *symbol, unsigned char source[], int len break; case 16: strcpy(fcc, "59"); - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "402: Invalid character in data (digits only for length 16)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 402, + "Invalid character at position %d in input (digits only for FCC 59 length 16)", + i); } break; case 18: @@ -160,9 +161,10 @@ INTERNAL int auspost(struct zint_symbol *symbol, unsigned char source[], int len break; case 23: strcpy(fcc, "62"); - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "406: Invalid character in data (digits only for length 23)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 406, + "Invalid character at position %d in input (digits only for FCC 62 length 23)", + i); } break; } @@ -192,9 +194,9 @@ INTERNAL int auspost(struct zint_symbol *symbol, unsigned char source[], int len /* Verify that the first 8 characters are numbers */ memcpy(dpid, localstr, 8); dpid[8] = '\0'; - if (!is_sane(NEON_F, (unsigned char *) dpid, 8)) { - strcpy(symbol->errtxt, "405: Invalid character in DPID (first 8 characters) (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, (unsigned char *) dpid, 8))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 405, + "Invalid character at position %d in DPID (first 8 characters) (digits only)", i); } /* Start character */ diff --git a/backend/aztec.c b/backend/aztec.c index 8e13df22..d6e57822 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -37,10 +37,14 @@ #include "reedsol.h" #define AZTEC_MAX_CAPACITY 19968 /* ISO/IEC 24778:2008 5.3 Table 1 Maximum Symbol Bit Capacity */ -#define AZTEC_BIN_CAPACITY 17940 /* Above less 169 * 12 = 2028 bits (169 = 10% of 1664 + 3) */ +/* Allow up to absolute minimum 3 ECC codewords, but now warn if results in less than the 5% minimum (ISO/IEC + 24778:2008 4.1.e) - previously could go down to 3 ECC codewords anyway if version given, due to bit-stuffing */ +#define AZTEC_BIN_CAPACITY 19932 /* AZTEC_MAX_CAPACITY less 3 * 12 = 36 */ #define AZTEC_MAP_SIZE 22801 /* AztecMap Version 32 151 x 151 */ #define AZTEC_MAP_POSN_MAX 20039 /* Maximum position index in AztecMap */ +#define AZ_BIN_CAP_CWDS_S "1661" /* String version of (AZTEC_BIN_CAPACITY / 12) */ + /* Count number of consecutive (. SP) or (, SP) Punct mode doubles for comparison against Digit mode encoding */ static int az_count_doubles(const unsigned char source[], int i, const int length) { int c = 0; @@ -784,7 +788,7 @@ static void az_populate_map(short AztecMap[], const int layers) { /* Helper to insert dummy '0' or '1's into runs of same bits. See ISO/IEC 24778:2008 7.3.1.2 */ static int az_bitrun_stuff(const char *binary_string, const int data_length, const int codeword_size, - char adjusted_string[AZTEC_MAX_CAPACITY]) { + const int data_maxsize, char adjusted_string[AZTEC_MAX_CAPACITY]) { int i, j = 0, count = 0; for (i = 0; i < data_length; i++) { @@ -796,7 +800,7 @@ static int az_bitrun_stuff(const char *binary_string, const int data_length, con if (count == 0 || count == (codeword_size - 1)) { /* Codeword of B-1 '0's or B-1 '1's */ - if (j >= AZTEC_MAX_CAPACITY) { + if (j > data_maxsize) { return 0; /* Fail */ } adjusted_string[j++] = count == 0 ? '1' : '0'; @@ -808,7 +812,7 @@ static int az_bitrun_stuff(const char *binary_string, const int data_length, con } else if (binary_string[i] == '1') { /* Skip B so only counting B-1 */ count++; } - if (j >= AZTEC_MAX_CAPACITY) { + if (j > data_maxsize) { return 0; /* Fail */ } adjusted_string[j++] = binary_string[i]; @@ -864,23 +868,19 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int int error_number = 0; int compact, data_length, data_maxsize, codeword_size, adjusted_length; int remainder, padbits, adjustment_size; - int reader = 0; - int comp_loop = 4; int bp = 0; const int gs1 = (symbol->input_mode & 0x07) == GS1_MODE; - const int debug_print = (symbol->debug & ZINT_DEBUG_PRINT); + const int reader_init = symbol->output_options & READER_INIT; + const int compact_loop_start = reader_init ? 1 : 4; /* Compact 2-4 excluded from Reader Initialisation */ + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; rs_t rs; rs_uint_t rs_uint; unsigned int *data_part; unsigned int *ecc_part; - if (symbol->output_options & READER_INIT) { - reader = 1; - comp_loop = 1; - } - if (gs1 && reader) { - strcpy(symbol->errtxt, "501: Cannot encode in GS1 and Reader Initialisation mode at the same time"); - return ZINT_ERROR_INVALID_OPTION; + if (gs1 && reader_init) { + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 501, + "Cannot encode in GS1 and Reader Initialisation mode at the same time"); } if (symbol->structapp.count) { @@ -890,19 +890,20 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int int id_len; if (symbol->structapp.count < 2 || symbol->structapp.count > 26) { - strcpy(symbol->errtxt, "701: Structured Append count out of range (2-26)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 701, + "Structured Append count '%d' out of range (2 to 26)", symbol->structapp.count); } if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { - sprintf(symbol->errtxt, "702: Structured Append index out of range (1-%d)", symbol->structapp.count); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 702, + "Structured Append index '%1$d' out of range (1 to count %2$d)", + symbol->structapp.index, symbol->structapp.count); } for (id_len = 0; id_len < 32 && symbol->structapp.id[id_len]; id_len++); if (id_len && chr_cnt((const unsigned char *) symbol->structapp.id, id_len, ' ')) { - strcpy(symbol->errtxt, "703: Structured Append ID cannot contain spaces"); - return ZINT_ERROR_INVALID_OPTION; + /* Note ID can contain any old chars apart from space so don't print in error message */ + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 703, "Structured Append ID cannot contain spaces"); } bp = bin_append_posn(29, 5, binary_string, bp); /* M/L */ @@ -919,7 +920,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int sa_src[sa_len++] = 'A' + symbol->structapp.count - 1; if (debug_print) { printf("Structured Append Count: %d, Index: %d, ID: %.32s, String: %s\n", - symbol->structapp.count, symbol->structapp.count, symbol->structapp.id, sa_src); + symbol->structapp.count, symbol->structapp.index, symbol->structapp.id, sa_src); } (void) aztec_text_process(sa_src, sa_len, bp, binary_string, 0 /*gs1*/, 0 /*eci*/, NULL /*p_current_mode*/, @@ -928,32 +929,26 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int } if (!aztec_text_process_segs(segs, seg_count, bp, binary_string, gs1, &data_length, debug_print)) { - strcpy(symbol->errtxt, "502: Input too long or too many extended ASCII characters"); - return ZINT_ERROR_TOO_LONG; + return errtxt(ZINT_ERROR_TOO_LONG, symbol, 502, + "Input too long, requires too many codewords (maximum " AZ_BIN_CAP_CWDS_S ")"); } assert(data_length > 0); /* Suppress clang-tidy warning: clang-analyzer-core.UndefinedBinaryOperatorResult */ - if (!((symbol->option_1 >= -1) && (symbol->option_1 <= 4))) { - strcpy(symbol->errtxt, "503: Invalid error correction level - using default instead"); + if (symbol->option_1 < -1 || symbol->option_1 > 4) { + errtxtf(0, symbol, 503, "Error correction level '%d' out of range (1 to 4)", symbol->option_1); if (symbol->warn_level == WARN_FAIL_ALL) { return ZINT_ERROR_INVALID_OPTION; } - error_number = ZINT_WARN_INVALID_OPTION; + error_number = errtxt_adj(ZINT_WARN_INVALID_OPTION, symbol, "%1$s%2$s", ", ignoring"); symbol->option_1 = -1; } data_maxsize = 0; /* Keep compiler happy! */ adjustment_size = 0; if (symbol->option_2 == 0) { /* The size of the symbol can be determined by Zint */ - static const short *const full_sizes[5] = { - NULL, Aztec10DataSizes, Aztec23DataSizes, Aztec36DataSizes, Aztec50DataSizes - }; - static const short *const comp_sizes[5] = { - NULL, AztecCompact10DataSizes, AztecCompact23DataSizes, AztecCompact36DataSizes, AztecCompact50DataSizes - }; int ecc_level = symbol->option_1; - if ((ecc_level == -1) || (ecc_level == 0)) { + if (ecc_level <= 0) { ecc_level = 2; } @@ -963,34 +958,43 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int layers = 0; /* For each level of error correction work out the smallest symbol which the data will fit in */ - for (i = comp_loop; i > 0; i--) { - if ((data_length + adjustment_size) < comp_sizes[ecc_level][i - 1]) { + for (i = compact_loop_start; i > 0; i--) { + if ((data_length + adjustment_size) <= AztecCompactDataSizes[ecc_level - 1][i - 1]) { layers = i; compact = 1; - data_maxsize = comp_sizes[ecc_level][i - 1]; + data_maxsize = AztecCompactDataSizes[ecc_level - 1][i - 1]; } } if (!compact) { for (i = 32; i > 0; i--) { - if ((data_length + adjustment_size) < full_sizes[ecc_level][i - 1]) { + if ((data_length + adjustment_size) <= AztecDataSizes[ecc_level - 1][i - 1]) { layers = i; compact = 0; - data_maxsize = full_sizes[ecc_level][i - 1]; + data_maxsize = AztecDataSizes[ecc_level - 1][i - 1]; } } } if (layers == 0) { /* Couldn't find a symbol which fits the data */ - strcpy(symbol->errtxt, "504: Input too long (too many bits for selected ECC)"); - return ZINT_ERROR_TOO_LONG; + if (adjustment_size == 0) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 707, + "Input too long for ECC level %1$d, requires too many codewords (maximum %2$d)", + ecc_level, AztecDataSizes[ecc_level - 1][31] / 12); + } + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 504, + "Input too long for ECC level %1$d, requires %2$d codewords (maximum %3$d)", + ecc_level, (data_length + adjustment_size + 11) / 12, + AztecDataSizes[ecc_level - 1][31] / 12); } codeword_size = az_codeword_size(layers); - adjusted_length = az_bitrun_stuff(binary_string, data_length, codeword_size, adjusted_string); + adjusted_length = az_bitrun_stuff(binary_string, data_length, codeword_size, + adjustment_size ? data_maxsize : AZTEC_BIN_CAPACITY, adjusted_string); if (adjusted_length == 0) { - strcpy(symbol->errtxt, "705: Data too long for specified Aztec Code symbol size"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 705, + "Input too long for ECC level %1$d, requires too many codewords (maximum %2$d)", + ecc_level, (adjustment_size ? data_maxsize : AZTEC_BIN_CAPACITY) / codeword_size); } adjustment_size = adjusted_length - data_length; @@ -1003,10 +1007,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int } if (debug_print) printf("Remainder: %d Pad bits: %d\n", remainder, padbits); - if (adjusted_length + padbits >= AZTEC_MAX_CAPACITY) { /* Probably can't happen */ - strcpy(symbol->errtxt, "706: Data too long for specified Aztec Code symbol size"); - return ZINT_ERROR_TOO_LONG; - } + assert(adjusted_length <= AZTEC_BIN_CAPACITY); adjusted_length = az_add_padding(padbits, codeword_size, adjusted_string, adjusted_length); @@ -1019,11 +1020,19 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int } else { /* The size of the symbol has been specified by the user */ if ((symbol->option_2 < 0) || (symbol->option_2 > 36)) { - strcpy(symbol->errtxt, "510: Invalid Aztec Code size"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 510, "Version '%d' out of range (1 to 36)", + symbol->option_2); } - if ((reader == 1) && ((symbol->option_2 >= 2) && (symbol->option_2 <= 4))) { - symbol->option_2 = 5; + if (reader_init) { + /* For back-compatibility, silently ignore compact 2-4 requests but error on layers > 22 */ + if (symbol->option_2 >= 2 && symbol->option_2 <= 4) { + symbol->option_2 = 5; + } else if (symbol->option_2 > 26) { + /* Caught below anyway but catch here also for better feedback */ + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 709, + "Version '%d' out of range for Reader Initialisation symbols (maximum 26)", + symbol->option_2); + } } if (symbol->option_2 <= 4) { compact = 1; @@ -1034,11 +1043,17 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int } codeword_size = az_codeword_size(layers); + if (compact) { + data_maxsize = codeword_size * (AztecCompactSizes[layers - 1] - 3); + } else { + data_maxsize = codeword_size * (AztecSizes[layers - 1] - 3); + } - adjusted_length = az_bitrun_stuff(binary_string, data_length, codeword_size, adjusted_string); + adjusted_length = az_bitrun_stuff(binary_string, data_length, codeword_size, data_maxsize, adjusted_string); if (adjusted_length == 0) { - strcpy(symbol->errtxt, "704: Data too long for specified Aztec Code symbol size"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 704, + "Input too long for Version %1$d, requires too many codewords (maximum %2$d)", + symbol->option_2, data_maxsize / codeword_size); } /* Add padding */ @@ -1051,15 +1066,12 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int if (debug_print) printf("Remainder: %d Pad bits: %d\n", remainder, padbits); /* Check if the data actually fits into the selected symbol size */ - if (compact) { - data_maxsize = codeword_size * (AztecCompactSizes[layers - 1] - 3); - } else { - data_maxsize = codeword_size * (AztecSizes[layers - 1] - 3); - } if (adjusted_length + padbits > data_maxsize) { - strcpy(symbol->errtxt, "505: Data too long for specified Aztec Code symbol size"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 505, + "Input too long for Version %1$d, requires %2$d codewords (maximum %3$d)", + symbol->option_2, (adjusted_length + padbits) / codeword_size, + data_maxsize / codeword_size); } adjusted_length = az_add_padding(padbits, codeword_size, adjusted_string, adjusted_length); @@ -1075,9 +1087,9 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int fputc('\n', stdout); } - if (reader && (layers > 22)) { - strcpy(symbol->errtxt, "506: Data too long for reader initialisation symbol"); - return ZINT_ERROR_TOO_LONG; + if (reader_init && (layers > 22)) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 506, + "Input too long for Reader Initialisation, requires %d layers (maximum 22)", layers); } data_blocks = adjusted_length / codeword_size; @@ -1090,6 +1102,11 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int } else { ecc_blocks = AztecSizes[layers - 1] - data_blocks; } + if (ecc_blocks < data_blocks / 20) { + error_number = errtxtf(ZINT_WARN_NONCOMPLIANT, symbol, 708, + "Number of ECC codewords %1$d less than %2$d (5%% of data codewords %3$d)", + ecc_blocks, data_blocks / 20, data_blocks); + } if (debug_print) { printf("Generating a %s symbol with %d layers\n", compact ? "compact" : "full-size", layers); @@ -1126,8 +1143,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int break; case 10: if (!rs_uint_init_gf(&rs_uint, 0x409, 1023)) { /* Can fail on malloc() */ - strcpy(symbol->errtxt, "500: Insufficient memory for Reed-Solomon log tables"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 500, "Insufficient memory for Reed-Solomon log tables"); } rs_uint_init_code(&rs_uint, ecc_blocks, 1); rs_uint_encode(&rs_uint, data_blocks, data_part, ecc_part); @@ -1136,8 +1152,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int case 12: if (!rs_uint_init_gf(&rs_uint, 0x1069, 4095)) { /* Can fail on malloc() */ /* Note using AUSPOST error nos range as out of 50x ones & 51x taken by CODEONE */ - strcpy(symbol->errtxt, "700: Insufficient memory for Reed-Solomon log tables"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 700, "Insufficient memory for Reed-Solomon log tables"); } rs_uint_init_code(&rs_uint, ecc_blocks, 1); rs_uint_encode(&rs_uint, data_blocks, data_part, ecc_part); @@ -1168,7 +1183,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int descriptor[1] = ((layers - 1) & 0x01) ? '1' : '0'; /* The next 6 bits represent the number of data blocks minus 1 */ - descriptor[2] = reader || ((data_blocks - 1) & 0x20) ? '1' : '0'; + descriptor[2] = reader_init || ((data_blocks - 1) & 0x20) ? '1' : '0'; for (i = 3; i < 8; i++) { descriptor[i] = ((data_blocks - 1) & (0x10 >> (i - 3))) ? '1' : '0'; } @@ -1180,7 +1195,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int } /* The next 11 bits represent the number of data blocks minus 1 */ - descriptor[5] = reader || ((data_blocks - 1) & 0x400) ? '1' : '0'; + descriptor[5] = reader_init || ((data_blocks - 1) & 0x400) ? '1' : '0'; for (i = 6; i < 16; i++) { descriptor[i] = ((data_blocks - 1) & (0x200 >> (i - 6))) ? '1' : '0'; } @@ -1274,12 +1289,11 @@ INTERNAL int azrune(struct zint_symbol *symbol, unsigned char source[], int leng input_value = 0; if (length > 3) { - strcpy(symbol->errtxt, "507: Input too large (3 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 507, "Input length %d too long (maximum 3)", length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "508: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 508, + "Invalid character at position %d in input (digits only)", i); } switch (length) { case 3: @@ -1294,8 +1308,7 @@ INTERNAL int azrune(struct zint_symbol *symbol, unsigned char source[], int leng } if (input_value > 255) { - strcpy(symbol->errtxt, "509: Input out of range (0 to 255)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 509, "Input value out of range (0 to 255)"); } bp = bin_append_posn(input_value, 8, binary_string, bp); diff --git a/backend/aztec.h b/backend/aztec.h index adc17098..88e1782c 100644 --- a/backend/aztec.h +++ b/backend/aztec.h @@ -117,44 +117,38 @@ static const short AztecCompactSizes[4] = { 17, 40, 51, 64 /* 64 data blocks (Mode Message max) but 76 altogether */ }; -/* Data bits per symbol maximum with 10% error correction */ -static const short Aztec10DataSizes[32] = { - 96, 246, 408, 616, 840, 1104, 1392, 1704, 2040, 2420, 2820, 3250, 3720, 4200, 4730, 5270, - 5840, 6450, 7080, 7750, 8430, 9150, 9900, 10680, 11484, 12324, 13188, 14076, 15000, 15948, 16920, 17940 +static const short AztecDataSizes[4][32] = { { + /* Data bits per symbol maximum with 10% error correction */ + 96, 246, 408, 616, 840, 1104, 1392, 1704, 2040, 2420, 2820, 3250, 3720, 4200, 4730, 5270, + 5840, 6450, 7080, 7750, 8430, 9150, 9900, 10680, 11484, 12324, 13188, 14076, 15000, 15948, 16920, 17940 + }, { + /* Data bits per symbol maximum with 23% error correction */ + 84, 204, 352, 520, 720, 944, 1184, 1456, 1750, 2070, 2410, 2780, 3180, 3590, 4040, 4500, + 5000, 5520, 6060, 6630, 7210, 7830, 8472, 9132, 9816, 10536, 11280, 12036, 12828, 13644, 14472, 15348 + }, { + /* Data bits per symbol maximum with 36% error correction */ + 66, 168, 288, 432, 592, 776, 984, 1208, 1450, 1720, 2000, 2300, 2640, 2980, 3350, 3740, + 4150, 4580, 5030, 5500, 5990, 6500, 7032, 7584, 8160, 8760, 9372, 9996, 10656, 11340, 12024, 12744 + }, { + /* Data bits per symbol maximum with 50% error correction */ + 48, 126, 216, 328, 456, 600, 760, 936, 1120, 1330, 1550, 1790, 2050, 2320, 2610, 2910, + 3230, 3570, 3920, 4290, 4670, 5070, 5484, 5916, 6360, 6828, 7308, 7800, 8316, 8844, 9384, 9948 + } }; -/* Data bits per symbol maximum with 23% error correction */ -static const short Aztec23DataSizes[32] = { - 84, 204, 352, 520, 720, 944, 1184, 1456, 1750, 2070, 2410, 2780, 3180, 3590, 4040, 4500, - 5000, 5520, 6060, 6630, 7210, 7830, 8472, 9132, 9816, 10536, 11280, 12036, 12828, 13644, 14472, 15348 -}; - -/* Data bits per symbol maximum with 36% error correction */ -static const short Aztec36DataSizes[32] = { - 66, 168, 288, 432, 592, 776, 984, 1208, 1450, 1720, 2000, 2300, 2640, 2980, 3350, 3740, - 4150, 4580, 5030, 5500, 5990, 6500, 7032, 7584, 8160, 8760, 9372, 9996, 10656, 11340, 12024, 12744 -}; - -/* Data bits per symbol maximum with 50% error correction */ -static const short Aztec50DataSizes[32] = { - 48, 126, 216, 328, 456, 600, 760, 936, 1120, 1330, 1550, 1790, 2050, 2320, 2610, 2910, - 3230, 3570, 3920, 4290, 4670, 5070, 5484, 5916, 6360, 6828, 7308, 7800, 8316, 8844, 9384, 9948 -}; - -static const short AztecCompact10DataSizes[4] = { - 78, 198, 336, 512 /* Max 64 * 8 */ -}; - -static const short AztecCompact23DataSizes[4] = { - 66, 168, 288, 440 -}; - -static const short AztecCompact36DataSizes[4] = { - 48, 138, 232, 360 -}; - -static const short AztecCompact50DataSizes[4] = { - 36, 102, 176, 280 +static const short AztecCompactDataSizes[4][4] = { { + /* Data bits per symbol maximum with 10% error correction */ + 78, 198, 336, 512 /* Max 64 * 8 */ + }, { + /* Data bits per symbol maximum with 23% error correction */ + 66, 168, 288, 440 + }, { + /* Data bits per symbol maximum with 36% error correction */ + 48, 138, 232, 360 + }, { + /* Data bits per symbol maximum with 50% error correction */ + 36, 102, 176, 280 + } }; /* Reference grid offsets */ diff --git a/backend/bc412.c b/backend/bc412.c index 0f41e090..17e219f1 100644 --- a/backend/bc412.c +++ b/backend/bc412.c @@ -73,9 +73,11 @@ INTERNAL int bc412(struct zint_symbol *symbol, unsigned char source[], int lengt char *d = dest; int error_number = 0; - if ((length < 7) || (length > 18)) { - strcpy(symbol->errtxt, "790: Input wrong length (should be between 7 and 18 characters)"); - return ZINT_ERROR_TOO_LONG; + if (length > 18) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 790, "Input length %d too long (maximum 18)", length); + } + if (length < 7) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 792, "Input length %d too short (minimum 7)", length); } to_upper(source, length); @@ -87,9 +89,9 @@ INTERNAL int bc412(struct zint_symbol *symbol, unsigned char source[], int lengt } padded_source[length + 1] = 0; - if (!is_sane_lookup(BROMINE, 35, padded_source, length + 1, posns)) { - strcpy(symbol->errtxt, "791: Invalid character in data (alphanumerics only, excluding the letter \"O\")"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane_lookup(BROMINE, 35, padded_source, length + 1, posns))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 791, + "Invalid character at position %d in input (alphanumerics only, excluding \"O\")", i - 1); } for (i = 0; i <= length; i++) { diff --git a/backend/bmp.c b/backend/bmp.c index 25ffc6c4..360fa6c8 100644 --- a/backend/bmp.c +++ b/backend/bmp.c @@ -88,13 +88,11 @@ INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix /* Must fit in `uint32_t` field in header */ if (file_size != (uint32_t) file_size) { - strcpy(symbol->errtxt, "606: Output file size too large for BMP header"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 606, "Output size too large for file size field of BMP header"); } if (!(rowbuf = (unsigned char *) malloc(row_size))) { - strcpy(symbol->errtxt, "602: Insufficient memory for BMP row buffer"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 602, "Insufficient memory for BMP row buffer"); } out_le_u16(file_header.header_field, 0x4d42); /* "BM" */ @@ -117,7 +115,7 @@ INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix /* Open output file in binary mode */ if (!fm_open(fmp, symbol, "wb")) { - sprintf(symbol->errtxt, "601: Could not open output file (%d: %.30s)", fmp->err, strerror(fmp->err)); + errtxtf(0, symbol, 601, "Could not open BMP output file (%1$d: %2$s)", fmp->err, strerror(fmp->err)); free(rowbuf); return ZINT_ERROR_FILE_ACCESS; } @@ -160,14 +158,14 @@ INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix free(rowbuf); if (fm_error(fmp)) { - sprintf(symbol->errtxt, "603: Incomplete write to output (%d: %.30s)", fmp->err, strerror(fmp->err)); + errtxtf(0, symbol, 603, "Incomplete write of BMP output (%1$d: %2$s)", fmp->err, strerror(fmp->err)); (void) fm_close(fmp, symbol); return ZINT_ERROR_FILE_WRITE; } if (!fm_close(fmp, symbol)) { - sprintf(symbol->errtxt, "605: Failure on closing output file (%d: %.30s)", fmp->err, strerror(fmp->err)); - return ZINT_ERROR_FILE_WRITE; + return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 605, "Failure on closing BMP output file (%1$d: %2$s)", + fmp->err, strerror(fmp->err)); } return 0; diff --git a/backend/codablock.c b/backend/codablock.c index b1004983..7a275525 100644 --- a/backend/codablock.c +++ b/backend/codablock.c @@ -1,7 +1,7 @@ /* codablock.c - Handles Codablock-F */ /* libzint - the open source barcode library - Copyright (C) 2016-2023 Harald Oehlmann + Copyright (C) 2016-2024 Harald Oehlmann Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -577,14 +577,13 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int return error_number; } if (rows > 44) { - strcpy(symbol->errtxt, "410: Rows parameter not in 0..44"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 410, "Number of rows '%d' out of range (0 to 44)", rows); } /* option_2: (usable data) columns: <= 0: automatic, 9..67 (min 9 == 4 data, max 67 == 62 data) */ columns = symbol->option_2; if (!(columns <= 0 || (columns >= 9 && columns <= 67))) { - strcpy(symbol->errtxt, "411: Columns parameter not in 0, 9..67"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 411, "Number of columns '%d' out of range (9 to 67)", + columns); } if (columns < 0) { /* Protect against negative overflow (ticket #300 (#9) Andre Maute) */ columns = 0; @@ -637,8 +636,8 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int error_number = Columns2Rows(symbol, T, dataLength, &rows, &useColumns, pSet, &fillings); } if (error_number != 0) { - strcpy(symbol->errtxt, "413: Data string too long"); - return error_number; + return errtxt(error_number, symbol, 413, + "Input too long, requires too many symbol characters (maximum 2726)"); } /* Suppresses clang-analyzer-core.VLASize warning */ assert(rows >= 2 && useColumns >= 4); diff --git a/backend/code.c b/backend/code.c index 55032b24..8b999890 100644 --- a/backend/code.c +++ b/backend/code.c @@ -144,17 +144,16 @@ INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int leng assert(length > 0); if (length > 140) { /* 8 (Start) + 140 * 8 + 2 * 8 (Check) + 7 (Stop) = 1151 */ - strcpy(symbol->errtxt, "320: Input too long (140 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 320, "Input length %d too long (maximum 140)", length); } - if (!is_sane(SODIUM_MNS_F, source, length)) { - strcpy(symbol->errtxt, "321: Invalid character in data (digits and \"-\" only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(SODIUM_MNS_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 321, + "Invalid character at position %d in input (digits and \"-\" only)", i); } if (symbol->option_2 < 0 || symbol->option_2 > 2) { - strcpy(symbol->errtxt, "339: Invalid check digit version (1, 2 only)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 339, "Invalid check digit version '%d' (1 or 2 only)", + symbol->option_2); } if (symbol->option_2 == 2) { num_check_digits = 0; @@ -255,22 +254,19 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng /* LOGMARS MIL-STD-1189 Rev. B https://apps.dtic.mil/dtic/tr/fulltext/u2/a473534.pdf */ if ((symbol->symbology == BARCODE_LOGMARS) && (length > 30)) { /* MIL-STD-1189 Rev. B Section 5.2.6.2 */ - strcpy(symbol->errtxt, "322: Input too long (30 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 322, "Input length %d too long (maximum 30)", length); /* Prevent encoded_data out-of-bounds >= 143 for BARCODE_HIBC_39 due to wider 'wide' bars */ } else if ((symbol->symbology == BARCODE_HIBC_39) && (length > 70)) { /* 16 (Start) + 70*16 + 15 (Stop) = 1151 */ - /* Note use 319 (2of5 range) as 340 taken by CODE128 */ - strcpy(symbol->errtxt, "319: Input too long (68 character maximum)"); /* 70 less '+' and check */ - return ZINT_ERROR_TOO_LONG; + /* 70 less '+' and check */ + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 319, "Input length %d too long (maximum 68)", length - 2); } else if (length > 86) { /* 13 (Start) + 86*13 + 12 (Stop) = 1143 */ - strcpy(symbol->errtxt, "323: Input too long (86 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 323, "Input length %d too long (maximum 86)", length); } to_upper(source, length); - if (!is_sane_lookup(SILVER, 43 /* Up to "%" */, source, length, posns)) { - strcpy(symbol->errtxt, "324: Invalid character in data (alphanumerics, space and \"-.$/+%\" only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane_lookup(SILVER, 43 /* Up to "%" */, source, length, posns))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 324, + "Invalid character at position %d in input (alphanumerics, space and \"-.$/+%%\" only)", i); } /* Start character */ @@ -370,16 +366,16 @@ INTERNAL int pzn(struct zint_symbol *symbol, unsigned char source[], int length) const int pzn7 = symbol->option_2 == 1; if (length > 8 - pzn7) { - sprintf(symbol->errtxt, "325: Input wrong length (%d character maximum)", 8 - pzn7); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 325, "Input length %1$d too long (maximum %2$d)", length, + 8 - pzn7); } if (length == 8 - pzn7) { have_check_digit = source[7 - pzn7]; length--; } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "326: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 326, + "Invalid character at position %d in input (digits only)", i); } localstr[0] = '-'; @@ -400,12 +396,11 @@ INTERNAL int pzn(struct zint_symbol *symbol, unsigned char source[], int length) } if (check_digit == 10) { - strcpy(symbol->errtxt, "327: Invalid PZN, check digit is '10'"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 327, "Invalid PZN, check digit is '10'"); } if (have_check_digit && ctoi(have_check_digit) != check_digit) { - sprintf(symbol->errtxt, "890: Invalid check digit '%c', expecting '%c'", have_check_digit, itoc(check_digit)); - return ZINT_ERROR_INVALID_CHECK; + return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 890, "Invalid check digit '%1$c', expecting '%2$c'", + have_check_digit, itoc(check_digit)); } localstr[8 - pzn7] = itoc(check_digit); @@ -453,23 +448,22 @@ INTERNAL int excode39(struct zint_symbol *symbol, unsigned char source[], int le int error_number; if (length > 86) { - strcpy(symbol->errtxt, "328: Input too long (86 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 328, "Input length %d too long (maximum 86)", length); } /* Creates a buffer string and places control characters into it */ for (i = 0; i < length; i++) { if (source[i] > 127) { /* Cannot encode extended ASCII */ - strcpy(symbol->errtxt, "329: Invalid character in data, extended ASCII not allowed"); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 329, + "Invalid character at position %d in input, extended ASCII not allowed", i + 1); } memcpy(b, EC39Ctrl[source[i]], 2); b += EC39Ctrl[source[i]][1] ? 2 : 1; } if (b - buffer > 86) { - strcpy(symbol->errtxt, "317: Expanded input too long (86 symbol character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 317, "Input too long, requires %d symbol characters (maximum 86)", + (int) (b - buffer)); } *b = '\0'; @@ -515,16 +509,15 @@ INTERNAL int code93(struct zint_symbol *symbol, unsigned char source[], int leng assert(length > 0); if (length > 123) { /* 9 (Start) + 123*9 + 2*9 (Checks) + 10 (Stop) = 1144 */ - strcpy(symbol->errtxt, "330: Input too long (123 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 330, "Input length %d too long (maximum 123)", length); } /* Message Content */ for (i = 0; i < length; i++) { if (source[i] > 127) { /* Cannot encode extended ASCII */ - strcpy(symbol->errtxt, "331: Invalid character in data, extended ASCII not allowed"); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 331, + "Invalid character at position %d in input, extended ASCII not allowed", i + 1); } memcpy(b, C93Ctrl[source[i]], 2); b += C93Ctrl[source[i]][1] ? 2 : 1; @@ -534,8 +527,8 @@ INTERNAL int code93(struct zint_symbol *symbol, unsigned char source[], int leng /* Now we can check the true length of the barcode */ h = b - buffer; if (h > 123) { - strcpy(symbol->errtxt, "332: Expanded input too long (123 symbol character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 332, + "Input too long, requires %d symbol characters (maximum 123)", h); } for (i = 0; i < h; i++) { @@ -607,7 +600,7 @@ INTERNAL int code93(struct zint_symbol *symbol, unsigned char source[], int leng } typedef const struct s_channel_precalc { - long value; unsigned char B[8]; unsigned char S[8]; unsigned char bmax[7]; unsigned char smax[7]; + int value; unsigned char B[8]; unsigned char S[8]; unsigned char bmax[7]; unsigned char smax[7]; } channel_precalc; #if 0 @@ -617,7 +610,7 @@ typedef const struct s_channel_precalc { #ifdef CHANNEL_GENERATE_PRECALCS /* To generate precalc tables uncomment CHANNEL_GENERATE_PRECALCS define and run "backend/tests/test_channel -f generate -g" and place result in "channel_precalcs.h" */ -static void channel_generate_precalc(int channels, long value, int mod, int last, int B[8], int S[8], int bmax[7], +static void channel_generate_precalc(int channels, int value, int mod, int last, int B[8], int S[8], int bmax[7], int smax[7]) { int i; if (value == mod) printf("static channel_precalc channel_precalcs%d[] = {\n", channels); @@ -631,7 +624,7 @@ static void channel_generate_precalc(int channels, long value, int mod, int last #include "channel_precalcs.h" #endif -static long channel_copy_precalc(channel_precalc *const precalc, int B[8], int S[8], int bmax[7], int smax[7]) { +static int channel_copy_precalc(channel_precalc *const precalc, int B[8], int S[8], int bmax[7], int smax[7]) { int i; for (i = 0; i < 7; i++) { @@ -656,7 +649,7 @@ static long channel_copy_precalc(channel_precalc *const precalc, int B[8], int S specification is entirely in the public domain and free of all use restrictions, licenses and fees. AIM USA, its member companies, or individual officers assume no liability for the use of this document." */ -static void CHNCHR(int channels, long target_value, int B[8], int S[8]) { +static void CHNCHR(int channels, int target_value, int B[8], int S[8]) { /* Use of initial pre-calculations taken from Barcode Writer in Pure PostScript (BWIPP) * Copyright (c) 2004-2020 Terry Burton (MIT/X-Consortium license) */ static channel_precalc initial_precalcs[6] = { @@ -674,7 +667,7 @@ static void CHNCHR(int channels, long target_value, int B[8], int S[8]) { { 8, 8, 8, 8, 8, 8, 8, }, }, }; int bmax[7], smax[7]; - long value = 0; + int value = 0; channel_copy_precalc(&initial_precalcs[channels - 3], B, S, bmax, smax); @@ -746,20 +739,20 @@ nb0: if (++B[0] <= bmax[0]) goto lb0; INTERNAL int channel(struct zint_symbol *symbol, unsigned char source[], int length) { static const int max_ranges[] = { -1, -1, -1, 26, 292, 3493, 44072, 576688, 7742862 }; int S[8] = {0}, B[8] = {0}; - long target_value = 0; + int target_value; char dest[30]; char *d = dest; int channels, i; int error_number = 0, zeroes; if (length > 7) { - strcpy(symbol->errtxt, "333: Input too long (7 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 333, "Input length %d too long (maximum 7)", length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "334: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 334, + "Invalid character at position %d in input (digits only)", i); } + target_value = to_int(source, length); if ((symbol->option_2 < 3) || (symbol->option_2 > 8)) { channels = 0; @@ -767,11 +760,6 @@ INTERNAL int channel(struct zint_symbol *symbol, unsigned char source[], int len channels = symbol->option_2; } - for (i = 0; i < length; i++) { - target_value *= 10; - target_value += ctoi((char) source[i]); - } - if (channels == 0) { channels = length + 1; if (target_value > 576688 && channels < 8) { @@ -792,12 +780,12 @@ INTERNAL int channel(struct zint_symbol *symbol, unsigned char source[], int len if (target_value > max_ranges[channels]) { if (channels == 8) { - sprintf(symbol->errtxt, "318: Value out of range (0 to %d)", max_ranges[channels]); - } else { - sprintf(symbol->errtxt, "335: Value out of range (0 to %d) for %d channels", - max_ranges[channels], channels); + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 318, "Input value \"%1$d\" out of range (0 to %2$d)", + target_value, max_ranges[channels]); } - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 335, + "Input value \"%1$d\" out of range (0 to %2$d for %3$d channels)", + target_value, max_ranges[channels], channels); } CHNCHR(channels, target_value, B, S); @@ -812,8 +800,7 @@ INTERNAL int channel(struct zint_symbol *symbol, unsigned char source[], int len zeroes = channels - 1 - length; if (zeroes < 0) { zeroes = 0; - } - if (zeroes) { + } else if (zeroes) { memset(symbol->text, '0', zeroes); } ustrcpy(symbol->text + zeroes, source); @@ -848,15 +835,13 @@ INTERNAL int vin(struct zint_symbol *symbol, unsigned char source[], int length) /* Check length */ if (length != 17) { - strcpy(symbol->errtxt, "336: Input wrong length (17 characters required)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 336, "Input length %d wrong (17 only)", length); } /* Check input characters, I, O and Q are not allowed */ - if (!is_sane(ARSENIC_F, source, length)) { - strcpy(symbol->errtxt, - "337: Invalid character in data (alphanumerics only, excluding \"I\", \"O\" and \"Q\")"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(ARSENIC_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 337, + "Invalid character at position %d in input (alphanumerics only, excluding \"IOQ\")", i); } to_upper(source, length); @@ -893,9 +878,8 @@ INTERNAL int vin(struct zint_symbol *symbol, unsigned char source[], int length) } if (input_check != output_check) { - sprintf(symbol->errtxt, "338: Invalid check digit '%c' (position 9), expecting '%c'", - input_check, output_check); - return ZINT_ERROR_INVALID_CHECK; + return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 338, + "Invalid check digit '%1$c' (position 9), expecting '%2$c'", input_check, output_check); } } diff --git a/backend/code1.c b/backend/code1.c index 33634536..2878cc94 100644 --- a/backend/code1.c +++ b/backend/code1.c @@ -30,6 +30,7 @@ */ /* SPDX-License-Identifier: BSD-3-Clause */ +#include #include #include #include "common.h" @@ -37,8 +38,9 @@ #include "reedsol.h" #include "large.h" -#define C1_MAX_CWS 1480 /* Max data codewords for Version H */ -#define C1_MAX_ECCS 560 /* Max ECC codewords for Version H */ +#define C1_MAX_CWS 1480 /* Max data codewords for Version H */ +#define C1_MAX_CWS_S "1480" /* String version of above */ +#define C1_MAX_ECCS 560 /* Max ECC codewords for Version H */ #define C1_ASCII 1 #define C1_C40 2 @@ -1023,35 +1025,33 @@ INTERNAL int codeone(struct zint_symbol *symbol, struct zint_seg segs[], const i int row, col; int sub_version = 0; rs_t rs; - int error_number = 0; const int gs1 = (symbol->input_mode & 0x07) == GS1_MODE; const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; if ((symbol->option_2 < 0) || (symbol->option_2 > 10)) { - strcpy(symbol->errtxt, "513: Invalid symbol size"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 513, "Version '%d' out of range (1 to 10)", + symbol->option_2); } if (symbol->structapp.count) { if (symbol->option_2 == 9) { /* Version S */ - strcpy(symbol->errtxt, "714: Structured Append not available for Version S"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 714, "Structured Append not available for Version S"); } if (gs1) { - strcpy(symbol->errtxt, "710: Cannot have Structured Append and GS1 mode at the same time"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 710, + "Cannot have Structured Append and GS1 mode at the same time"); } if (symbol->structapp.count < 2 || symbol->structapp.count > 128) { - strcpy(symbol->errtxt, "711: Structured Append count out of range (2-128)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 711, + "Structured Append count '%d' out of range (2 to 128)", symbol->structapp.count); } if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { - sprintf(symbol->errtxt, "712: Structured Append index out of range (1-%d)", symbol->structapp.count); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 712, + "Structured Append index '%1$d' out of range (1 to count %2$d)", + symbol->structapp.index, symbol->structapp.count); } if (symbol->structapp.id[0]) { - strcpy(symbol->errtxt, "713: Structured Append ID not available for Code One"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 713, "Structured Append ID not available for Code One"); } } @@ -1063,16 +1063,15 @@ INTERNAL int codeone(struct zint_symbol *symbol, struct zint_seg segs[], const i int block_width; if (seg_count > 1) { - strcpy(symbol->errtxt, "715: Multiple segments not supported for Version S"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 715, "Multiple segments not supported for Version S"); } if (segs[0].length > 18) { - strcpy(symbol->errtxt, "514: Input data too long for Version S"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 514, "Input length %d too long for Version S (maximum 18)", + segs[0].length); } - if (!is_sane(NEON_F, segs[0].source, segs[0].length)) { - strcpy(symbol->errtxt, "515: Invalid input data (Version S encodes numeric input only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, segs[0].source, segs[0].length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 515, + "Invalid character at position %d in input (Version S encodes digits only)", i); } size = 9; @@ -1142,18 +1141,19 @@ INTERNAL int codeone(struct zint_symbol *symbol, struct zint_seg segs[], const i unsigned int ecc[22]; int data_length; int data_cw, ecc_cw, block_width; - int last_mode; + int last_mode = 0; /* Suppress gcc 14 "-Wmaybe-uninitialized" false positive */ - if (c1_total_length_segs(segs, seg_count) > 90) { - strcpy(symbol->errtxt, "519: Input data too long for Version T"); - return ZINT_ERROR_TOO_LONG; + if ((i = c1_total_length_segs(segs, seg_count)) > 90) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 519, "Input length %d too long for Version T (maximum 90)", + i); } data_length = c1_encode_segs(symbol, segs, seg_count, gs1, target, &last_mode); - if (data_length == 0 || data_length > 38) { - strcpy(symbol->errtxt, "516: Input data too long for Version T"); - return ZINT_ERROR_TOO_LONG; + assert(data_length); /* Can't exceed C1_MAX_CWS as input <= 90 */ + if (data_length > 38) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 516, + "Input too long for Version T, requires %d codewords (maximum 38)", data_length); } size = 10; @@ -1234,8 +1234,8 @@ INTERNAL int codeone(struct zint_symbol *symbol, struct zint_seg segs[], const i data_length = c1_encode_segs(symbol, segs, seg_count, gs1, target, &last_mode); if (data_length == 0) { - strcpy(symbol->errtxt, "517: Input data is too long"); - return ZINT_ERROR_TOO_LONG; + return errtxt(ZINT_ERROR_TOO_LONG, symbol, 517, + "Input too long, requires too many codewords (maximum " C1_MAX_CWS_S ")"); } for (i = 7; i >= 0; i--) { @@ -1249,8 +1249,9 @@ INTERNAL int codeone(struct zint_symbol *symbol, struct zint_seg segs[], const i } if ((symbol->option_2 != 0) && (symbol->option_2 < size)) { - strcpy(symbol->errtxt, "518: Input too long for selected symbol size"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 518, + "Input too long for Version %1$c, requires %2$d codewords (maximum %3$d)", + 'A' + symbol->option_2 - 1, data_length, c1_data_length[symbol->option_2 - 1]); } data_cw = c1_data_length[size - 1]; @@ -1577,16 +1578,14 @@ INTERNAL int codeone(struct zint_symbol *symbol, struct zint_seg segs[], const i if (symbol->option_2 == 9) { /* Version S */ if (symbol->eci || gs1) { - sprintf(symbol->errtxt, "511: %s ignored for Version S", - symbol->eci && gs1 ? "ECI and GS1 mode" : symbol->eci ? "ECI" : "GS1 mode"); - error_number = ZINT_WARN_INVALID_OPTION; + return errtxtf(ZINT_WARN_INVALID_OPTION, symbol, 511, "%s ignored for Version S", + symbol->eci && gs1 ? "ECI and GS1 mode" : symbol->eci ? "ECI" : "GS1 mode"); } } else if (symbol->eci && gs1) { - strcpy(symbol->errtxt, "512: ECI ignored for GS1 mode"); - error_number = ZINT_WARN_INVALID_OPTION; + return errtxt(ZINT_WARN_INVALID_OPTION, symbol, 512, "ECI ignored for GS1 mode"); } - return error_number; + return 0; } /* vim: set ts=4 sw=4 et : */ diff --git a/backend/code128.c b/backend/code128.c index af78c0f7..fd86afbc 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -37,7 +37,8 @@ #include "code128.h" #include "gs1.h" -#define C128_SYMBOL_MAX 99 +#define C128_SYMBOL_MAX 99 +#define C128_SYMBOL_MAX_S "99" /* String version of above */ static const char KRSET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; #define KRSET_F (IS_NUM_F | IS_UPR_F) @@ -209,21 +210,20 @@ static void c128_define_mode(char set[C128_MAX], const unsigned char source[], c for (i = 0; i < length; i++) { const int latch = modes[i][charset]; - if (latch >= 1 && latch <= 3) { - charset = latch; - set[i] = '@' + latch; /* A, B or C */ - } else if (latch >= 4 && latch <= 5) { + if (latch >= 4 && latch <= 5) { /* Shift A/B */ charset = latch - 3; set[i] = charset == 1 ? 'b' : 'a'; } else { - /* Continue in same `charset` */ + if (latch >= 1 && latch <= 3) { + charset = latch; + } /* Else continue in same `charset` */ assert(charset); set[i] = '@' + charset; /* A, B or C */ - } - if (charset == 3 && source[i] != '\x1D') { - assert(i + 1 < length); /* Guaranteed by algorithm */ - set[++i] = 'C'; + if (charset == 3 && source[i] != '\x1D') { + assert(i + 1 < length); /* Guaranteed by algorithm */ + set[++i] = 'C'; + } } } } @@ -413,8 +413,7 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len if (length > C128_MAX) { /* This only blocks ridiculously long input - the actual length of the 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); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 340, "Input length %d too long (maximum " C128_MAX_S ")", length); } /* Detect special Code Set escapes for Code 128 in extra escape mode only */ @@ -447,8 +446,7 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len if (j != length) { length = j; if (length == 0) { - strcpy(symbol->errtxt, "842: No input data"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 842, "No input data"); } src = src_buf; src[length] = '\0'; @@ -470,37 +468,36 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len /* Decide when to latch to extended mode - ISO/IEC 15417:2007 Annex E note 3 */ j = 0; + k = 0; for (i = 0; i < length; i++) { if (fset[i] == 'f') { j++; - if (j >= 5) { - for (k = i; k > (i - 5); k--) { - fset[k] = 'F'; + if (j >= 4) { + fset[i] = 'F'; + if (!k) { + fset[i - 1] = fset[i - 2] = fset[i - 3] = 'F'; + k = i; } } } else { j = 0; + k = 0; } } - if (j >= 3) { - for (k = length - 1; k > length - 1 - j; k--) { - fset[k] = 'F'; - } + if (j >= 3 && !k) { + fset[length - 1] = fset[length - 2] = fset[length - 3] = 'F'; } - /* 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 ASCII encodation for a few characters as described in 4.3.4.2 (d) */ for (i = 1; i < length; i++) { if ((fset[i - 1] == 'F') && (fset[i] == ' ')) { - int c = 0; - /* Detected a change from 8859-1 to 646 - count how long for */ - for (j = 0; ((i + j) < length) && (fset[i + j] == ' '); j++) { - c += set[i + j] == 'C'; /* Count code set C so can subtract when deciding below */ - } - /* Count how many 8859-1 beyond */ - k = 0; - if (i + j < length) { - for (k = 1; ((i + j + k) < length) && (fset[i + j + k] != ' '); k++); + int c = set[i] == 'C'; /* Count code set C so can subtract when deciding below */ + /* Detected a change from extended to ASCII - count how long for */ + for (j = 1; i + j < length && fset[i + j] == ' '; j++) { + c += set[i + j] == 'C'; } + /* Count how many extended beyond */ + for (k = i + j < length; i + j + k < length && fset[i + j + k] != ' '; k++); if (j - c < 3 || (j - c < 5 && k > 2)) { /* Change to shifting back rather than latching back */ /* Inverts the same figures recommended by ISO/IEC 15417:2007 Annex E note 3 */ @@ -519,9 +516,9 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len /* Now we can calculate how long the barcode is going to be - and stop it from being too long */ - if (c128_glyph_count(source, length, set, fset) > C128_SYMBOL_MAX) { - sprintf(symbol->errtxt, "341: Input too long (%d symbol character maximum)", C128_SYMBOL_MAX); - return ZINT_ERROR_TOO_LONG; + if ((i = c128_glyph_count(source, length, set, fset)) > C128_SYMBOL_MAX) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 341, + "Input too long, requires %d symbol characters (maximum " C128_SYMBOL_MAX_S ")", i); } /* So now we know what start character to use - we can get on with it! */ @@ -679,9 +676,8 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int if (length > C128_MAX) { /* This only blocks ridiculously long input - the actual length of the - resulting barcode depends on the type of data, so this is trapped later */ - sprintf(symbol->errtxt, "342: Input too long (%d character maximum)", C128_MAX); - return ZINT_ERROR_TOO_LONG; + resulting barcode depends on the type of data, so this is trapped later */ + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 342, "Input length %d too long (maximum " C128_MAX_S ")", length); } /* if part of a composite symbol make room for the separator pattern */ @@ -707,9 +703,9 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int /* Now we can calculate how long the barcode is going to be - and stop it from being too long */ - if (c128_glyph_count(reduced, reduced_length, set, NULL /*fset*/) > C128_SYMBOL_MAX) { - sprintf(symbol->errtxt, "344: Input too long (%d symbol character maximum)", C128_SYMBOL_MAX); - return ZINT_ERROR_TOO_LONG; + if ((i = c128_glyph_count(reduced, reduced_length, set, NULL /*fset*/)) > C128_SYMBOL_MAX) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 344, + "Input too long, requires %d symbol characters (maximum " C128_SYMBOL_MAX_S ")", i); } /* So now we know what start character to use - we can get on with it! */ @@ -800,8 +796,8 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int if (reduced_length > 48) { /* GS1 General Specifications 5.4.4.3 */ if (error_number == 0) { /* Don't overwrite any `gs1_verify()` warning */ - strcpy(symbol->errtxt, "843: GS1-128 input too long (48 character maximum)"); - error_number = ZINT_WARN_NONCOMPLIANT; + error_number = errtxtf(ZINT_WARN_NONCOMPLIANT, symbol, 843, + "Input too long, requires %d characters (maximum 48)", reduced_length); } } @@ -849,8 +845,7 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int } if (i == sizeof(symbol->text)) { /* Trumps all other warnings */ - strcpy(symbol->errtxt, "844: Human Readable Text truncated"); - error_number = ZINT_WARN_HRT_TRUNCATED; + error_number = errtxt(ZINT_WARN_HRT_TRUNCATED, symbol, 844, "Human Readable Text truncated"); i--; } symbol->text[i] = '\0'; @@ -865,17 +860,18 @@ INTERNAL int gs1_128(struct zint_symbol *symbol, unsigned char source[], int len /* Add check digit if encoding an NVE18 symbol */ INTERNAL int nve18(struct zint_symbol *symbol, unsigned char source[], int length) { + int i; int error_number, zeroes; unsigned char ean128_equiv[23]; if (length > 17) { - strcpy(symbol->errtxt, "345: Input too long (17 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 345, "Input length %d too long (maximum 17)", length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "346: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + /* Note: for all "at position" error messages, escape sequences not accounted for */ + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 346, + "Invalid character at position %d in input (digits only)", i); } zeroes = 17 - length; @@ -893,17 +889,17 @@ INTERNAL int nve18(struct zint_symbol *symbol, unsigned char source[], int lengt /* EAN-14 - A version of EAN-128 */ INTERNAL int ean14(struct zint_symbol *symbol, unsigned char source[], int length) { + int i; int error_number, zeroes; unsigned char ean128_equiv[19]; if (length > 13) { - strcpy(symbol->errtxt, "347: Input too long (13 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 347, "Input length %d too long (maximum 13)", length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "348: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 348, + "Invalid character at position %d in input (digits only)", i); } zeroes = 13 - length; @@ -934,11 +930,9 @@ INTERNAL int dpd(struct zint_symbol *symbol, unsigned char source[], int length) if ((length != 27 && length != 28) || (length == 28 && relabel)) { if (relabel) { - strcpy(symbol->errtxt, "830: DPD relabel input wrong length (27 characters required)"); - } else { - strcpy(symbol->errtxt, "349: DPD input wrong length (27 or 28 characters required)"); + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 830, "DPD relabel input length %d wrong (27 only)", length); } - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 349, "DPD input length %d wrong (27 or 28 only)", length); } if (length == 27 && !relabel) { @@ -953,18 +947,18 @@ INTERNAL int dpd(struct zint_symbol *symbol, unsigned char source[], int length) ident_tag = local_source[0]; to_upper(local_source + !relabel, length - !relabel); - if (!is_sane(KRSET_F, local_source + !relabel, length - !relabel)) { + if ((i = not_sane(KRSET_F, local_source + !relabel, length - !relabel))) { if (local_source == local_source_buf || relabel) { - strcpy(symbol->errtxt, "300: Invalid character in data (alphanumerics only)"); - } else { - strcpy(symbol->errtxt, "299: Invalid character in data (alphanumerics only after first character)"); + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 300, + "Invalid character at position %d in input (alphanumerics only)", i); } - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 299, + "Invalid character at position %d in input (alphanumerics only after first)", i); } if ((ident_tag < 32) || (ident_tag > 127)) { - strcpy(symbol->errtxt, "343: Invalid DPD identification tag (first character), ASCII values 32 to 127 only"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 343, + "Invalid DPD identification tag (first character), ASCII values 32 to 127 only"); } (void) code128(symbol, local_source, length); /* Only error returned is for large text which can't happen */ @@ -1030,14 +1024,14 @@ INTERNAL int dpd(struct zint_symbol *symbol, unsigned char source[], int length) symbol->text[p] = '\0'; /* Some compliance checks */ - if (!is_sane(NEON_F, local_source + length - 16, 16)) { - if (!is_sane(NEON_F, local_source + length - 3, 3)) { /* 3-digit Country Code (ISO 3166-1) */ - strcpy(symbol->errtxt, "831: Destination Country Code (last 3 characters) should be numeric"); - } else if (!is_sane(NEON_F, local_source + length - 6, 3)) { /* 3-digit Service Code */ - strcpy(symbol->errtxt, "832: Service Code (characters 6-4 from end) should be numeric"); + if (not_sane(NEON_F, local_source + length - 16, 16)) { + if (not_sane(NEON_F, local_source + length - 3, 3)) { /* 3-digit Country Code (ISO 3166-1) */ + errtxt(0, symbol, 831, "Destination Country Code (last 3 characters) should be numeric"); + } else if (not_sane(NEON_F, local_source + length - 6, 3)) { /* 3-digit Service Code */ + errtxt(0, symbol, 832, "Service Code (characters 6-4 from end) should be numeric"); } else { /* Last 10 characters of Tracking No. */ - strcpy(symbol->errtxt, - "833: Last 10 characters of Tracking Number (characters 16-7 from end) should be numeric"); + errtxt(0, symbol, 833, + "Last 10 characters of Tracking Number (characters 16-7 from end) should be numeric"); } error_number = ZINT_WARN_NONCOMPLIANT; } @@ -1056,8 +1050,7 @@ INTERNAL int upu_s10(struct zint_symbol *symbol, unsigned char source[], int len int error_number = 0; if (length != 12 && length != 13) { - strcpy(symbol->errtxt, "834: Input must be 12 or 13 characters long"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 834, "Input length %d wrong (12 or 13 only)", length); } if (length == 13) { /* Includes check digit - remove for now */ have_check_digit = source[10]; @@ -1069,17 +1062,17 @@ INTERNAL int upu_s10(struct zint_symbol *symbol, unsigned char source[], int len to_upper(local_source, length); if (!z_isupper(local_source[0]) || !z_isupper(local_source[1])) { - strcpy(symbol->errtxt, "835: Invalid character in Service Indictor (first 2 characters) (alphabetic only)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 835, + "Invalid character in Service Indictor (first 2 characters) (alphabetic only)"); } - if (!is_sane(NEON_F, local_source + 2, 12 - 4) || (have_check_digit && !z_isdigit(have_check_digit))) { - sprintf(symbol->errtxt, "836: Invalid character in Serial Number (middle %d characters) (digits only)", - have_check_digit ? 9 : 8); - return ZINT_ERROR_INVALID_DATA; + if (not_sane(NEON_F, local_source + 2, 12 - 4) || (have_check_digit && !z_isdigit(have_check_digit))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 836, + "Invalid character in Serial Number (middle %d characters) (digits only)", + have_check_digit ? 9 : 8); } if (!z_isupper(local_source[10]) || !z_isupper(local_source[11])) { - strcpy(symbol->errtxt, "837: Invalid character in Country Code (last 2 characters) (alphabetic only)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 837, + "Invalid character in Country Code (last 2 characters) (alphabetic only)"); } check_digit = 0; @@ -1094,8 +1087,8 @@ INTERNAL int upu_s10(struct zint_symbol *symbol, unsigned char source[], int len check_digit = 5; } if (have_check_digit && ctoi(have_check_digit) != check_digit) { - sprintf(symbol->errtxt, "838: Invalid check digit '%c', expecting '%c'", have_check_digit, itoc(check_digit)); - return ZINT_ERROR_INVALID_CHECK; + return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 838, "Invalid check digit '%1$c', expecting '%2$c'", + have_check_digit, itoc(check_digit)); } /* Add in (back) check digit */ local_source[12] = local_source[11]; @@ -1105,14 +1098,14 @@ INTERNAL int upu_s10(struct zint_symbol *symbol, unsigned char source[], int len /* Do some checks on the Service Indicator (first char only) and Country Code */ if (strchr("JKSTW", local_source[0]) != NULL) { /* These are reserved & cannot be assigned */ - strcpy(symbol->errtxt, "839: Invalid Service Indicator (first character should not be any of \"JKSTW\")"); - error_number = ZINT_WARN_NONCOMPLIANT; + error_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 839, + "Invalid Service Indicator (first character should not be any of \"JKSTW\")"); } else if (strchr("FHIOXY", local_source[0]) != NULL) { /* These aren't allocated as of spec Oct 2017 */ - strcpy(symbol->errtxt, "840: Non-standard Service Indicator (first 2 characters)"); - error_number = ZINT_WARN_NONCOMPLIANT; + error_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 840, + "Non-standard Service Indicator (first 2 characters)"); } else if (!gs1_iso3166_alpha2(local_source + 11)) { - strcpy(symbol->errtxt, "841: Country code (last two characters) is not ISO 3166-1"); - error_number = ZINT_WARN_NONCOMPLIANT; + error_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 841, + "Country code (last two characters) is not ISO 3166-1"); } (void) code128(symbol, local_source, 13); /* Only error returned is for large text which can't happen */ diff --git a/backend/code128.h b/backend/code128.h index 78e09677..54118ef7 100644 --- a/backend/code128.h +++ b/backend/code128.h @@ -38,6 +38,7 @@ extern "C" { /* Allow for a reasonable number of special Code Set escapes and for GS1 AI delimiters */ #define C128_MAX 256 +#define C128_MAX_S "256" /* String version of above */ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int length); diff --git a/backend/code16k.c b/backend/code16k.c index 5e4bc672..9c5ac331 100644 --- a/backend/code16k.c +++ b/backend/code16k.c @@ -288,13 +288,12 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; if (length > C128_MAX) { - strcpy(symbol->errtxt, "420: Input too long"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 420, "Input length %d too long (maximum " C128_MAX_S ")", length); } 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; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 424, "Minimum number of rows '%d' out of range (2 to 16)", + symbol->option_1); } /* Detect extended ASCII characters */ @@ -346,8 +345,8 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len if (symbol->output_options & READER_INIT) { if (gs1) { - strcpy(symbol->errtxt, "422: Cannot use both GS1 mode and Reader Initialisation"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 422, + "Cannot use both GS1 mode and Reader Initialisation"); } if (m == 2) { m = 5; @@ -440,8 +439,8 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len } if (bar_characters > 80 - 2) { /* Max rows 16 * 5 - 2 check chars */ - strcpy(symbol->errtxt, "421: Input too long"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 421, + "Input too long, requires %d symbol characters (maximum 78)", bar_characters); } } while (read < length); diff --git a/backend/code49.c b/backend/code49.c index 6c94b2b5..5e7c3464 100644 --- a/backend/code49.c +++ b/backend/code49.c @@ -53,8 +53,7 @@ INTERNAL int code49(struct zint_symbol *symbol, unsigned char source[], int leng int error_number = 0; if (length > 81) { - strcpy(symbol->errtxt, "430: Input too long (81 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 430, "Input length %d too long (maximum 81)", length); } if ((symbol->input_mode & 0x07) == GS1_MODE) { gs1 = 1; @@ -65,8 +64,8 @@ INTERNAL int code49(struct zint_symbol *symbol, unsigned char source[], int leng for (i = 0; i < length; i++) { if (source[i] > 127) { - strcpy(symbol->errtxt, "431: Invalid character in input data, extended ASCII not allowed"); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 431, + "Invalid character at position %d in input, extended ASCII not allowed", i + 1); } if (gs1 && source[i] == '\x1D') { *d++ = '*'; /* FNC1 */ @@ -219,8 +218,8 @@ INTERNAL int code49(struct zint_symbol *symbol, unsigned char source[], int leng } if (codeword_count > 49) { - strcpy(symbol->errtxt, "432: Input too long (49 symbol character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 432, "Input too long, requires %d codewords (maximum 49)", + codeword_count); } /* Place codewords in code character array (c grid) */ diff --git a/backend/common.c b/backend/common.c index 890c3c58..4d42a493 100644 --- a/backend/common.c +++ b/backend/common.c @@ -31,6 +31,7 @@ /* SPDX-License-Identifier: BSD-3-Clause */ #include +#include #include #include "common.h" @@ -87,7 +88,7 @@ INTERNAL int chr_cnt(const unsigned char source[], const int length, const unsig return count; } -/* Flag table for `is_chr()` and `is_sane()` */ +/* Flag table for `is_chr()` and `not_sane()` */ #define IS_CLS_F (IS_CLI_F | IS_SIL_F) static const unsigned short flgs[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*00-1F*/ @@ -126,21 +127,22 @@ INTERNAL int is_chr(const unsigned int flg, const unsigned int c) { return c < 0x80 && (flgs[c] & flg) != 0; } -/* Verifies that a string only uses valid characters */ -INTERNAL int is_sane(const unsigned int flg, const unsigned char source[], const int length) { +/* Verifies if a string only uses valid characters, returning 1-based position in `source` if not, 0 for success */ +INTERNAL int not_sane(const unsigned int flg, const unsigned char source[], const int length) { int i; for (i = 0; i < length; i++) { if (!(flgs[source[i]] & flg)) { - return 0; + return i + 1; } } - return 1; + return 0; } /* Replaces huge switch statements for looking up in tables */ -/* Verifies that a string only uses valid characters, and returns `test_string` position of each in `posns` array */ -INTERNAL int is_sane_lookup(const char test_string[], const int test_length, const unsigned char source[], +/* Verifies if a string only uses valid characters as above, but also returns `test_string` position of each in + `posns` array */ +INTERNAL int not_sane_lookup(const char test_string[], const int test_length, const unsigned char source[], const int length, int *posns) { int i, j; @@ -153,11 +155,11 @@ INTERNAL int is_sane_lookup(const char test_string[], const int test_length, con } } if (posns[i] == -1) { - return 0; + return i + 1; } } - return 1; + return 0; } /* Returns the position of `data` in `set_string` */ @@ -244,6 +246,294 @@ INTERNAL void expand(struct zint_symbol *symbol, const char data[], const int le } } +/* Helper for `errtxt()` & `errtxtf()` to set "err_id: " part of error message, returning length */ +static int errtxt_id_str(char *errtxt, int num) { + int len = 0; + if (num == -1) { + errtxt[0] = '\0'; + return 0; + } + if (num < 0 || num > 9999) { /* Restrict to 4 digits */ + num = 9999; + } + if (num >= 1000) { + errtxt[len++] = '0' + (num / 1000); + num %= 1000; + } + errtxt[len++] = '0' + (num / 100); + num %= 100; + errtxt[len++] = '0' + (num / 10); + num %= 10; + errtxt[len++] = '0' + num; + errtxt[len++] = ':'; + errtxt[len++] = ' '; + return len; +} + +/* Set `symbol->errtxt` to "err_id: msg", returning `error_number`. If `err_id` is -1, the "err_id: " prefix is + omitted */ +INTERNAL int errtxt(const int error_number, struct zint_symbol *symbol, const int err_id, const char *msg) { + const int max_len = (int) sizeof(symbol->errtxt) - 1; + const int id_len = errtxt_id_str(symbol->errtxt, err_id); + int msg_len = (int) strlen(msg); + + if (id_len + msg_len > max_len) { + if (!(symbol->debug & ZINT_DEBUG_TEST)) assert(0); /* Catch truncations */ + msg_len = max_len - id_len; + } + memcpy(symbol->errtxt + id_len, msg, msg_len); + + symbol->errtxt[id_len + msg_len] = '\0'; + + return error_number; +} + +static int errtxtf_dpad(const char *fmt); /* Forward reference */ + +/* Helper for `errtxtf()` to parse numbered specifier "n$" (where "n" 1-9), returning `fmt` advance increment */ +static int errtxtf_num_arg(const char *fmt, int *p_arg) { + int ret = 0; + int arg = -2; + if (!errtxtf_dpad(fmt) && z_isdigit(fmt[0])) { + arg = fmt[1] == '$' ? fmt[0] - '0' - 1 : -1; + ret = 2; + } + if (p_arg) { + *p_arg = arg; + } + return ret; +} + +/* Helper for `errtxtf()` to parse length precision, returning `fmt` advance increment */ +static int errtxtf_slen(const char *fmt, const int arg, int *p_arg_cnt, int *p_len) { + int ret = 0; + int len = -1; + if (fmt[0] == '.') { + if (z_isdigit(fmt[1]) && fmt[1] != '0') { + len = fmt[1] - '0'; + for (ret = 2; z_isdigit(fmt[ret]); ret++) { + len = len * 10 + fmt[ret] - '0'; + } + if (fmt[ret] != 's') { + len = -1; + } + } else if (fmt[1] == '*' && fmt[2] == 's' && arg < 0) { + len = 0; + ret = 2; + } else if (fmt[1] == '*' && z_isdigit(fmt[2]) && fmt[3] == '$' && fmt[4] == 's') { + if (arg == -1 || arg == fmt[2] - '0') { + len = 0; + if (p_arg_cnt) { + (*p_arg_cnt)++; + } + } + ret = 4; + } else { + ret = 1; + } + } + if (p_len) { + *p_len = len; + } + return ret; +} + +/* Helper for `errtxtf()` to parse zero-padded minimum field length for "%d", returning `fmt` advance increment */ +static int errtxtf_dpad(const char *fmt) { + /* Allow one leading zero plus one or two digits only */ + if (fmt[0] == '0' && z_isdigit(fmt[1])) { + if (fmt[1] != '0' && fmt[2] == 'd') { + return 2; + } + if (z_isdigit(fmt[1]) && fmt[1] != '0' && z_isdigit(fmt[2]) && fmt[3] == 'd') { + return 3; + } + } + return 0; +} + +/* Set `symbol->errtxt` to "err_id: msg" with restricted subset of `printf()` formatting, returning `error_number`. + If `err_id` is -1, the "err_id: " prefix is omitted. Only the following specifiers are supported: "c", "d", "f", + "g" and "s", with no modifiers apart from "$" numbering for l10n ("" 1-9), in which case all specifiers must + be numbered, "%s" with length precisions: "%.*s", "%$.*$s", "%.

s" and "%$.

s", and "%d" with + zero-padded minimum field lengths: "%0d" or %$0d" ("" 1-99) */ +INTERNAL int errtxtf(const int error_number, struct zint_symbol *symbol, const int err_id, const char *fmt, ...) { + const int max_len = (int) sizeof(symbol->errtxt) - 1; + int p = errtxt_id_str(symbol->errtxt, err_id); + const char *f; + int i; + int arg_cnt = 0; + int have_num_arg = 0, have_unnum_arg = 0; + va_list ap; + int idxs[9] = {0}; /* Argument order */ + char specs[9] = {0}; /* Format specifiers */ + const char *ss[9] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; /* "%s" */ + int slens[9] = {0}; /* "%s" length precisions */ + int have_slens[9] = {0}; /* Bools for if "%s" has length precision */ + char dpads[9][3] = {{0}}; /* 2-digit minimum field length */ + char dfgs[9][100] = {{0}}; /* "%d", "%f" and "%g", allowing for padding up to 99 */ + int cs[9] = {0}; /* "%c" */ + + /* Get argument order and specifiers */ + for (f = fmt, i = 0; *f; f++) { + if (*f == '%') { + int inc, arg, len; + if (*++f == '%') { + continue; + } + if ((inc = errtxtf_num_arg(f, &arg))) { + if (arg == -1) { + if (!(symbol->debug & ZINT_DEBUG_TEST)) assert(0); + return errtxt(ZINT_ERROR_ENCODING_PROBLEM, symbol, 0, + "Internal error: invalid numbered format specifer"); + } + if (i >= 9) { + if (!(symbol->debug & ZINT_DEBUG_TEST)) assert(0); + return errtxt(ZINT_ERROR_ENCODING_PROBLEM, symbol, 0, + "Internal error: too many format specifiers (9 maximum)"); + } + f += inc; + have_num_arg = 1; + idxs[i] = arg; + } else { + if (i >= 9) { + if (!(symbol->debug & ZINT_DEBUG_TEST)) assert(0); + return errtxt(ZINT_ERROR_ENCODING_PROBLEM, symbol, 0, + "Internal error: too many format specifiers (9 maximum)"); + } + have_unnum_arg = 1; + idxs[i] = i; + } + if ((inc = errtxtf_slen(f, arg, &arg_cnt, &len))) { + if (len == -1) { + if (!(symbol->debug & ZINT_DEBUG_TEST)) assert(0); + return errtxt(ZINT_ERROR_ENCODING_PROBLEM, symbol, 0, "Internal error: invalid length precision"); + } + slens[idxs[i]] = len == 0 ? -1 : len; /* TODO: keep `slens` separate else last mentioned trumps */ + have_slens[idxs[i]] = 1; + f += inc; + } + if ((inc = errtxtf_dpad(f))) { + memcpy(dpads[idxs[i]], f + 1, inc - 1); /* TODO: keep `dpads` separate else last mentioned trumps */ + dpads[idxs[i]][inc - 1] = '\0'; + f += inc; + } + if (*f != 'c' && *f != 'd' && *f != 'f' && *f != 'g' && *f != 's') { + if (!(symbol->debug & ZINT_DEBUG_TEST)) assert(0); + return errtxt(ZINT_ERROR_ENCODING_PROBLEM, symbol, 0, + "Internal error: unknown format specifier ('%c','%d','%f','%g','%s' only)"); + } + specs[idxs[i++]] = *f; + arg_cnt++; + } + } + if (have_num_arg && have_unnum_arg) { + if (!(symbol->debug & ZINT_DEBUG_TEST)) assert(0); + return errtxt(ZINT_ERROR_ENCODING_PROBLEM, symbol, 0, + "Internal error: mixed numbered and unnumbered format specifiers"); + } + + /* Get arguments */ + va_start(ap, fmt); + for (i = 0; i < arg_cnt; i++) { + if (specs[i] == 'c') { + cs[i] = va_arg(ap, int); + } else if (specs[i] == 'd') { + if (dpads[i][0]) { + char dpad_fmt[30]; /* Make 30 to suppress GNU c "-Wformat-overflow=" false positive */ + sprintf(dpad_fmt, "%%0%sd", dpads[i]); /* TODO: keep `dpads` separate else last mentioned trumps */ + sprintf(dfgs[i], dpad_fmt, va_arg(ap, int)); + } else { + sprintf(dfgs[i], "%d", va_arg(ap, int)); + } + } else if (specs[i] == 'f' || specs[i] == 'g') { + sprintf(dfgs[i], specs[i] == 'f' ? "%f" : "%g", va_arg(ap, double)); + } else if (specs[i] == 's') { + if (have_slens[i] && slens[i] == -1) { + slens[i] = va_arg(ap, int); /* TODO: keep `slens` separate else last mentioned trumps */ + } + ss[i] = va_arg(ap, char *); + } + } + va_end(ap); + + /* Populate `errtxt` */ + for (f = fmt, i = 0; *f && p < max_len; f++) { + if (*f == '%') { + int idx; + if (*++f == '%') { + symbol->errtxt[p++] = '%'; + continue; + } + f += errtxtf_num_arg(f, NULL /*p_arg*/); + f += errtxtf_slen(f, -1 /*arg*/, NULL /*arg_cnt*/, NULL /*p_len*/); + f += errtxtf_dpad(f); + idx = idxs[i]; + if (specs[idx] == 'c') { + symbol->errtxt[p++] = cs[idx]; + } else { + int len; + if (specs[idx] == 's') { + if (have_slens[idx]) { + const char *si = ss[idx]; + for (len = 0; len < slens[idx] && si[len]; len++); + } else { + len = (int) strlen(ss[idx]); + } + } else { + len = (int) strlen(dfgs[idx]); + } + if (len) { + if (p + len > max_len) { + if (!(symbol->debug & ZINT_DEBUG_TEST)) assert(0); /* Catch truncations */ + len = max_len - p; + } + memcpy(symbol->errtxt + p, specs[idx] == 's' ? ss[idx] : dfgs[idx], len); + p += len; + } + } + i++; + } else { + symbol->errtxt[p++] = *f; + } + } + if (*f) { + if (!(symbol->debug & ZINT_DEBUG_TEST)) assert(0); /* Catch truncations */ + } + + symbol->errtxt[p] = '\0'; + + return error_number; +} + +/* Helper to prepend/append to existing `symbol->errtxt` by calling `errtxtf(fmt)` with 2 arguments (copy of `errtxt` + & `msg`) if `msg` not NULL, or 1 argument (just copy of `errtxt`) if `msg` NULL, returning `error_number` */ +INTERNAL int errtxt_adj(const int error_number, struct zint_symbol *symbol, const char *fmt, const char *msg) { + char err_buf[sizeof(symbol->errtxt)]; + + err_buf[0] = '\0'; + +/* Suppress gcc 14 warning output may be truncated */ +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 14 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" +#endif + + strncat(err_buf, symbol->errtxt, sizeof(symbol->errtxt) - 1); + +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 14 +#pragma GCC diagnostic pop +#endif + + if (msg) { + errtxtf(0, symbol, -1, fmt, err_buf, msg); + } else { + errtxtf(0, symbol, -1, fmt, err_buf); + } + + return error_number; +} + /* Whether `symbology` can have row binding */ INTERNAL int is_stackable(const int symbology) { if (symbology < BARCODE_PHARMA_TWO && symbology != BARCODE_POSTNET) { @@ -489,7 +779,7 @@ INTERNAL int hrt_cpy_iso8859_1(struct zint_symbol *symbol, const unsigned char s symbol->text[j] = '\0'; if (warn_number) { - strcpy(symbol->errtxt, "249: Human Readable Text truncated"); + errtxt(0, symbol, 249, "Human Readable Text truncated"); } return warn_number; } @@ -532,7 +822,7 @@ INTERNAL int set_height(struct zint_symbol *symbol, const float min_row_height, if (stripf(row_height) < stripf(min_row_height)) { error_number = ZINT_WARN_NONCOMPLIANT; if (!no_errtxt) { - strcpy(symbol->errtxt, "247: Height not compliant with standards"); + errtxt(0, symbol, 247, "Height not compliant with standards"); } } } @@ -544,7 +834,7 @@ INTERNAL int set_height(struct zint_symbol *symbol, const float min_row_height, if (stripf(symbol->height) > stripf(max_height)) { error_number = ZINT_WARN_NONCOMPLIANT; if (!no_errtxt) { - strcpy(symbol->errtxt, "248: Height not compliant with standards"); + errtxt(0, symbol, 248, "Height not compliant with standards"); } } } @@ -554,12 +844,15 @@ INTERNAL int set_height(struct zint_symbol *symbol, const float min_row_height, /* Prevent inlining of `stripf()` which can optimize away its effect */ #if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) -__attribute__((__noinline__)) +#define ZINT_NOINLINE __attribute__((__noinline__)) #elif defined(_MSC_VER) && _MSC_VER >= 1310 /* MSVC 2003 (VC++ 7.1) */ -__declspec(noinline) +#define ZINT_NOINLINE __declspec(noinline) +#else +#define ZINT_NOINLINE #endif + /* Removes excess precision from floats - see https://stackoverflow.com/q/503436 */ -INTERNAL float stripf(const float arg) { +INTERNAL ZINT_NOINLINE float stripf(const float arg) { return *((volatile const float *) &arg); } @@ -615,6 +908,7 @@ INTERNAL char *debug_print_escape(const unsigned char *source, const int first_l /* Dumps hex-formatted codewords in symbol->errtxt (for use in testing) */ INTERNAL void debug_test_codeword_dump(struct zint_symbol *symbol, const unsigned char *codewords, const int length) { int i, max = length, cnt_len = 0; + assert(sizeof(symbol->errtxt) >= 100); if (length > 30) { /* 30*3 < errtxt 92 (100 - "Warning ") chars */ sprintf(symbol->errtxt, "(%d) ", length); /* Place the number of codewords at the front */ cnt_len = (int) strlen(symbol->errtxt); @@ -630,6 +924,7 @@ INTERNAL void debug_test_codeword_dump(struct zint_symbol *symbol, const unsigne INTERNAL void debug_test_codeword_dump_short(struct zint_symbol *symbol, const short *codewords, const int length) { int i, max = 0, cnt_len, errtxt_len; char temp[20]; + assert(sizeof(symbol->errtxt) >= 100); errtxt_len = sprintf(symbol->errtxt, "(%d) ", length); /* Place the number of codewords at the front */ for (i = 0, cnt_len = errtxt_len; i < length; i++) { cnt_len += sprintf(temp, "%d ", codewords[i]); @@ -648,6 +943,7 @@ INTERNAL void debug_test_codeword_dump_short(struct zint_symbol *symbol, const s INTERNAL void debug_test_codeword_dump_int(struct zint_symbol *symbol, const int *codewords, const int length) { int i, max = 0, cnt_len, errtxt_len; char temp[20]; + assert(sizeof(symbol->errtxt) >= 100); errtxt_len = sprintf(symbol->errtxt, "(%d) ", length); /* Place the number of codewords at the front */ for (i = 0, cnt_len = errtxt_len; i < length; i++) { cnt_len += sprintf(temp, "%d ", codewords[i]); diff --git a/backend/common.h b/backend/common.h index 5fe06341..5da5ccf3 100644 --- a/backend/common.h +++ b/backend/common.h @@ -42,6 +42,13 @@ extern "C" { #include #include +/* Determine if C89 (excluding MSVC, which doesn't define __STDC_VERSION__) */ +#ifndef _MSC_VER +# if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199000L +# define ZINT_IS_C89 +# endif +#endif + #ifdef _MSC_VER typedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t; @@ -49,7 +56,7 @@ typedef __int32 int32_t; typedef unsigned __int32 uint32_t; typedef unsigned __int64 uint64_t; #else -#include +#include /* Introduced C99 */ #endif /* Note if change following must also change "frontend/main.c" copy */ @@ -79,6 +86,12 @@ typedef unsigned __int64 uint64_t; # endif #endif +#if defined(__GNUC__) && __GNUC__ >= 3 +# define ZINT_FORMAT_PRINTF(fmt_idx, first_idx) __attribute__((__format__(printf, fmt_idx, first_idx))) +#else +# define ZINT_FORMAT_PRINTF(fmt_idx, first_idx) +#endif + #if defined(__GNUC__) && __GNUC__ >= 4 && !defined(ZINT_TEST) && !defined(__MINGW32__) # define INTERNAL __attribute__((__visibility__("hidden"))) #elif defined(ZINT_TEST) @@ -95,13 +108,6 @@ typedef unsigned __int64 uint64_t; # define INTERNAL_DATA #endif -/* Determine if C89 (excluding MSVC, which doesn't define __STDC_VERSION__) */ -#ifndef _MSC_VER -# if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199000L -# define ZINT_IS_C89 -# endif -#endif - #ifdef _MSC_VER # if _MSC_VER >= 1400 /* MSVC 2005 (C++ 8.0) */ # define restrict __restrict @@ -154,7 +160,7 @@ INTERNAL void to_upper(unsigned char source[], const int length); /* Returns the number of times a character occurs in `source` */ INTERNAL int chr_cnt(const unsigned char source[], const int length, const unsigned char c); -/* `is_chr()` & `is_sane()` flags */ +/* `is_chr()` & `not_sane()` flags */ #define IS_SPC_F 0x0001 /* Space */ #define IS_HSH_F 0x0002 /* Hash sign # */ #define IS_AST_F 0x0004 /* Asterisk sign * */ @@ -181,11 +187,12 @@ INTERNAL int chr_cnt(const unsigned char source[], const int length, const unsig /* Whether a character matches `flg` */ INTERNAL int is_chr(const unsigned int flg, const unsigned int c); -/* Verifies that a string only uses valid characters */ -INTERNAL int is_sane(const unsigned int flg, const unsigned char source[], const int length); +/* Verifies if a string only uses valid characters, returning 1-based position in `source` if not, 0 for success */ +INTERNAL int not_sane(const unsigned int flg, const unsigned char source[], const int length); -/* Verifies that a string only uses valid characters, and returns `test_string` position of each in `posns` array */ -INTERNAL int is_sane_lookup(const char test_string[], const int test_length, const unsigned char source[], +/* Verifies if a string only uses valid characters as above, but also returns `test_string` position of each in + `posns` array */ +INTERNAL int not_sane_lookup(const char test_string[], const int test_length, const unsigned char source[], const int length, int *posns); /* Returns the position of `data` in `set_string` */ @@ -232,6 +239,23 @@ INTERNAL void unset_module(struct zint_symbol *symbol, const int y_coord, const INTERNAL void expand(struct zint_symbol *symbol, const char data[], const int length); +/* Set `symbol->errtxt` to "err_id: msg", returning `error_number`. If `err_id` is -1, the "err_id: " prefix is + omitted */ +INTERNAL int errtxt(const int error_number, struct zint_symbol *symbol, const int err_id, const char *msg); + +/* Set `symbol->errtxt` to "err_id: msg" with restricted subset of `printf()` formatting, returning `error_number`. + If `err_id` is -1, the "err_id: " prefix is omitted. Only the following specifiers are supported: "c", "d", "f", + "g" and "s", with no modifiers apart from "$" numbering for l10n ("" 1-9), in which case all specifiers must + be numbered, "%s" with length precisions: "%.*s", "%$.*$s", "%.

s" and "%$.

s", and "%d" with + zero-padded minimum field lengths: "%0d" or %$0d" ("" 1-99) */ +INTERNAL int errtxtf(const int error_number, struct zint_symbol *symbol, const int err_id, const char *fmt, ...) + ZINT_FORMAT_PRINTF(4, 5); + +/* Helper to prepend/append to existing `symbol->errtxt` by calling `errtxtf(fmt)` with 2 arguments (copy of `errtxt` + & `msg`) if `msg` not NULL, or 1 argument (just copy of `errtxt`) if `msg` NULL, returning `error_number` */ +INTERNAL int errtxt_adj(const int error_number, struct zint_symbol *symbol, const char *fmt, const char *msg); + + /* Whether `symbology` can have row binding */ INTERNAL int is_stackable(const int symbology); diff --git a/backend/composite.c b/backend/composite.c index eb746ef6..3f9a5517 100644 --- a/backend/composite.c +++ b/backend/composite.c @@ -1128,8 +1128,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour if (!general_field_encode(general_field, j, &mode, &last_digit, binary_string, &bp)) { /* Invalid character in input data */ - strcpy(symbol->errtxt, "441: Invalid character in 2D component input data"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 441, "Invalid character in input (2D component)"); } } @@ -1146,8 +1145,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour } if (target_bitsize == 0) { - strcpy(symbol->errtxt, "442: Input too long for selected 2D component"); - return ZINT_ERROR_TOO_LONG; + return errtxt(ZINT_ERROR_TOO_LONG, symbol, 442, "Input too long (2D component)"); } remainder = target_bitsize - bp; @@ -1183,8 +1181,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour } if (target_bitsize == 0) { - strcpy(symbol->errtxt, "444: Input too long for selected 2D component"); - return ZINT_ERROR_TOO_LONG; + return errtxt(ZINT_ERROR_TOO_LONG, symbol, 444, "Input too long (2D component)"); } if (bp < target_bitsize) { @@ -1236,7 +1233,6 @@ static int cc_linear_dummy_run(int input_mode, unsigned char *source, const int } INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int length) { - static const char in_linear_comp[] = " in linear component"; int error_number, cc_mode, cc_width = 0, ecc_level = 0; int j, i, k; /* Allow for 8 bits + 5-bit latch per char + 1000 bits overhead/padding */ @@ -1254,31 +1250,28 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l error_number = 0; pri_len = (int) strlen(symbol->primary); if (pri_len == 0) { - strcpy(symbol->errtxt, "445: No primary (linear) message"); - return ZINT_ERROR_INVALID_OPTION; /* TODO: change to more appropiate ZINT_ERROR_INVALID_DATA */ + /* TODO: change to more appropiate ZINT_ERROR_INVALID_DATA */ + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 445, "No primary (linear) message"); } if (length > 2990) { - strcpy(symbol->errtxt, "446: 2D component input data too long"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 446, + "2D component input too long, requires %d characters (maximum 2990)", length); } cc_mode = symbol->option_1; if ((cc_mode == 3) && (symbol->symbology != BARCODE_GS1_128_CC)) { /* CC-C can only be used with a GS1-128 linear part */ - strcpy(symbol->errtxt, "447: Invalid mode (CC-C only valid with GS1-128 linear component)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 447, + "Invalid mode (CC-C only valid with GS1-128 linear component)"); } if (symbol->symbology == BARCODE_GS1_128_CC) { /* Do a test run of encoding the linear component to establish its width */ linear_width = cc_linear_dummy_run(symbol->input_mode, (unsigned char *) symbol->primary, pri_len, - symbol->debug, symbol->errtxt); + symbol->debug, symbol->errtxt); if (linear_width == 0) { - if (strlen(symbol->errtxt) + sizeof(in_linear_comp) <= sizeof(symbol->errtxt)) { - strcat(symbol->errtxt, in_linear_comp); - } - return ZINT_ERROR_INVALID_DATA; + return errtxt_adj(ZINT_ERROR_INVALID_DATA, symbol, "%1$s%2$s", " (linear component)"); } if (debug_print) { printf("GS1-128 linear width: %d\n", linear_width); @@ -1293,10 +1286,8 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l int with_addon; unsigned char padded_pri[21]; if (!ean_leading_zeroes(symbol, (unsigned char *) symbol->primary, padded_pri, &with_addon, NULL, - NULL)) { - sprintf(symbol->errtxt, "448: Input too long (%s) in linear component", - with_addon ? "5 character maximum for add-on" : "13 character maximum"); - return ZINT_ERROR_TOO_LONG; + NULL)) { + return errtxt_adj(ZINT_ERROR_TOO_LONG, symbol, "%1$s%2$s", " (linear component)"); } padded_pri_len = (int) ustrlen(padded_pri); if (padded_pri_len <= 7) { /* EAN-8 */ @@ -1320,8 +1311,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l } } if (cc_width == 0) { - strcpy(symbol->errtxt, "449: Input wrong length in linear component"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 449, "Input length %d wrong (linear component)", pri_len); } break; case BARCODE_GS1_128_CC: cc_width = 4; @@ -1443,10 +1433,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l } if (error_number) { - strcpy(symbol->errtxt, linear->errtxt); - if (strlen(symbol->errtxt) + sizeof(in_linear_comp) <= sizeof(symbol->errtxt)) { - strcat(symbol->errtxt, in_linear_comp); - } + errtxtf(0, symbol, -1, "%1$s%2$s", linear->errtxt, " (linear component)"); if (error_number >= ZINT_ERROR) { ZBarcode_Delete(linear); return error_number; diff --git a/backend/dmatrix.c b/backend/dmatrix.c index de6a90f6..c397ddd4 100644 --- a/backend/dmatrix.c +++ b/backend/dmatrix.c @@ -1059,8 +1059,7 @@ static int dm_minimalenc(struct zint_symbol *symbol, const unsigned char source[ assert(length <= 10921); /* Can only handle (10921 + 1) * 6 = 65532 < 65536 (2*16) due to sizeof(previous) */ if (!dm_define_mode(symbol, modes, source, length, gs1, debug_print)) { - strcpy(symbol->errtxt, "728: Insufficient memory for mode buffers"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 728, "Insufficient memory for mode buffers"); } while (sp < length) { @@ -1217,8 +1216,8 @@ static int dm_minimalenc(struct zint_symbol *symbol, const unsigned char source[ } if (tp > 1558) { - strcpy(symbol->errtxt, "729: Data too long to fit in symbol"); - return ZINT_ERROR_TOO_LONG; + return errtxt(ZINT_ERROR_TOO_LONG, symbol, 729, + "Input too long, requires too many codewords (maximum 1558)"); } } /* while */ @@ -1471,8 +1470,8 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c } if (tp > 1558) { - strcpy(symbol->errtxt, "520: Data too long to fit in symbol"); - return ZINT_ERROR_TOO_LONG; + return errtxt(ZINT_ERROR_TOO_LONG, symbol, 520, + "Input too long, requires too many codewords (maximum 1558)"); } } /* while */ @@ -1682,21 +1681,21 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co const struct zint_seg *last_seg = &segs[seg_count - 1]; const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; - if (segs_length(segs, seg_count) > 3116) { /* Max is 3166 digits */ - strcpy(symbol->errtxt, "719: Data too long to fit in symbol"); - return ZINT_ERROR_TOO_LONG; + if ((i = segs_length(segs, seg_count)) > 3116) { /* Max is 3166 digits */ + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 719, "Input length %d too long (maximum 3116)", i); } if (symbol->structapp.count) { int id1, id2; if (symbol->structapp.count < 2 || symbol->structapp.count > 16) { - strcpy(symbol->errtxt, "720: Structured Append count out of range (2-16)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 720, + "Structured Append count '%d' out of range (2 to 16)", symbol->structapp.count); } if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { - sprintf(symbol->errtxt, "721: Structured Append index out of range (1-%d)", symbol->structapp.count); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 721, + "Structured Append index '%1$d' out of range (1 to count %2$d)", + symbol->structapp.index, symbol->structapp.count); } if (symbol->structapp.id[0]) { int id, id_len, id1_err, id2_err; @@ -1704,14 +1703,13 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co for (id_len = 1; id_len < 7 && symbol->structapp.id[id_len]; id_len++); if (id_len > 6) { /* ID1 * 1000 + ID2 */ - strcpy(symbol->errtxt, "722: Structured Append ID too long (6 digit maximum)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 722, + "Structured Append ID length %d too long (6 digit maximum)", id_len); } id = to_int((const unsigned char *) symbol->structapp.id, id_len); if (id == -1) { - strcpy(symbol->errtxt, "723: Invalid Structured Append ID (digits only)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 723, "Invalid Structured Append ID (digits only)"); } id1 = id / 1000; id2 = id % 1000; @@ -1719,19 +1717,19 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co id2_err = id2 < 1 || id2 > 254; if (id1_err || id2_err) { if (id1_err && id2_err) { - sprintf(symbol->errtxt, - "724: Structured Append ID1 '%03d' and ID2 '%03d' out of range (001-254) (ID '%03d%03d')", - id1, id2, id1, id2); - } else if (id1_err) { - sprintf(symbol->errtxt, - "725: Structured Append ID1 '%03d' out of range (001-254) (ID '%03d%03d')", - id1, id1, id2); - } else { - sprintf(symbol->errtxt, - "726: Structured Append ID2 '%03d' out of range (001-254) (ID '%03d%03d')", - id2, id1, id2); + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 724, + "Structured Append ID1 '%1$03d' and ID2 '%2$03d' out of range (001 to 254)" + " (ID \"%3$03d%4$03d\")", + id1, id2, id1, id2); } - return ZINT_ERROR_INVALID_OPTION; + if (id1_err) { + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 725, + "Structured Append ID1 '%1$03d' out of range (001 to 254) (ID \"%2$03d%3$03d\")", + id1, id1, id2); + } + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 726, + "Structured Append ID2 '%1$03d' out of range (001 to 254) (ID \"%2$03d%3$03d\")", + id2, id1, id2); } } else { id1 = id2 = 1; @@ -1761,12 +1759,12 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co if (symbol->output_options & READER_INIT) { if (gs1) { - strcpy(symbol->errtxt, "521: Cannot encode in GS1 mode and Reader Initialisation at the same time"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 521, + "Cannot encode in GS1 mode and Reader Initialisation at the same time"); } if (symbol->structapp.count) { - strcpy(symbol->errtxt, "727: Cannot have Structured Append and Reader Initialisation at the same time"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 727, + "Cannot have Structured Append and Reader Initialisation at the same time"); } target[tp++] = 234; /* Reader Programming */ if (debug_print) fputs("RP ", stdout); @@ -1837,7 +1835,7 @@ static void dm_add_tail(unsigned char target[], int tp, const int tail_length) { static int dm_ecc200(struct zint_symbol *symbol, struct zint_seg segs[], const int seg_count) { int i, skew = 0; unsigned char binary[2200]; - int binlen; + int binlen = 0; /* Suppress clang-tidy-20 uninitialized value false positive */ int symbolsize; int taillength, error_number; int H, W, FH, FW, datablock, bytes, rsblock; @@ -1854,11 +1852,12 @@ static int dm_ecc200(struct zint_symbol *symbol, struct zint_seg segs[], const i if (binlen > dm_matrixbytes[symbolsize]) { if ((symbol->option_2 >= 1) && (symbol->option_2 <= DMSIZESCOUNT)) { /* The symbol size was given by --ver (option_2) */ - strcpy(symbol->errtxt, "522: Input too long for selected symbol size"); - } else { - strcpy(symbol->errtxt, "523: Data too long to fit in symbol"); + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 522, + "Input too long for Version %1$d, requires %2$d codewords (maximum %3$d)", + symbol->option_2, binlen, dm_matrixbytes[symbolsize]); } - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 523, "Input too long, requires %d codewords (maximum 1558)", + binlen); } H = dm_matrixH[symbolsize]; @@ -1901,8 +1900,7 @@ static int dm_ecc200(struct zint_symbol *symbol, struct zint_seg segs[], const i const int NR = H - 2 * (H / FH); int x, y, *places; if (!(places = (int *) calloc(NC * NR, sizeof(int)))) { - strcpy(symbol->errtxt, "718: Insufficient memory for placement array"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 718, "Insufficient memory for placement array"); } dm_placement(places, NR, NC); for (y = 0; y < H; y += FH) { @@ -1950,18 +1948,13 @@ static int dm_ecc200(struct zint_symbol *symbol, struct zint_seg segs[], const i } INTERNAL int datamatrix(struct zint_symbol *symbol, struct zint_seg segs[], const int seg_count) { - int error_number; if (symbol->option_1 <= 1) { /* ECC 200 */ - error_number = dm_ecc200(symbol, segs, seg_count); - } else { - /* ECC 000 - 140 */ - strcpy(symbol->errtxt, "524: Older Data Matrix standards are no longer supported"); - error_number = ZINT_ERROR_INVALID_OPTION; + return dm_ecc200(symbol, segs, seg_count); } - - return error_number; + /* ECC 000 - 140 */ + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 524, "Older Data Matrix standards are no longer supported"); } /* vim: set ts=4 sw=4 et : */ diff --git a/backend/dotcode.c b/backend/dotcode.c index f665783a..e033e1a1 100644 --- a/backend/dotcode.c +++ b/backend/dotcode.c @@ -1229,8 +1229,8 @@ INTERNAL int dotcode(struct zint_symbol *symbol, struct zint_seg segs[], const i unsigned char *masked_codeword_array; if (symbol->eci > 811799) { - strcpy(symbol->errtxt, "525: Invalid ECI"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 525, "ECI code '%d' out of range (0 to 811799)", + symbol->eci); } user_mask = (symbol->option_3 >> 8) & 0x0F; /* User mask is mask + 1, so >= 1 and <= 8 */ @@ -1240,16 +1240,16 @@ INTERNAL int dotcode(struct zint_symbol *symbol, struct zint_seg segs[], const i if (symbol->structapp.count) { if (symbol->structapp.count < 2 || symbol->structapp.count > 35) { - strcpy(symbol->errtxt, "730: Structured Append count out of range (2-35)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 730, + "Structured Append count '%d' out of range (2 to 35)", symbol->structapp.count); } if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { - sprintf(symbol->errtxt, "731: Structured Append index out of range (1-%d)", symbol->structapp.count); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 731, + "Structured Append index '%1$d' out of range (1 to count %2$d)", + symbol->structapp.index, symbol->structapp.count); } if (symbol->structapp.id[0]) { - strcpy(symbol->errtxt, "732: Structured Append ID not available for DotCode"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 732, "Structured Append ID not available for DotCode"); } } @@ -1258,14 +1258,14 @@ INTERNAL int dotcode(struct zint_symbol *symbol, struct zint_seg segs[], const i if (gs1 && warn_number == 0) { for (i = 0; i < seg_count; i++) { if (segs[i].eci) { - strcpy(symbol->errtxt, "733: Using ECI in GS1 mode not supported by GS1 standards"); - warn_number = ZINT_WARN_NONCOMPLIANT; + warn_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 733, + "Using ECI in GS1 mode not supported by GS1 standards"); break; } } if (warn_number == 0 && symbol->structapp.count) { - strcpy(symbol->errtxt, "734: Using Structured Append in GS1 mode not supported by GS1 standards"); - warn_number = ZINT_WARN_NONCOMPLIANT; + warn_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 734, + "Using Structured Append in GS1 mode not supported by GS1 standards"); } } @@ -1337,9 +1337,9 @@ INTERNAL int dotcode(struct zint_symbol *symbol, struct zint_seg segs[], const i if ((height > 200) || (width > 200)) { if (height > 200 && width > 200) { - sprintf(symbol->errtxt, "526: Symbol size %dx%d (WxH) is too large", width, height); + errtxtf(0, symbol, 526, "Symbol size '%1$dx%2$d' (WxH) is too large", width, height); } else { - sprintf(symbol->errtxt, "528: Symbol %s %d is too large", + errtxtf(0, symbol, 528, "Symbol %1$s '%2$d' is too large", width > 200 ? "width" : "height", width > 200 ? width : height); } return ZINT_ERROR_INVALID_OPTION; @@ -1347,10 +1347,10 @@ INTERNAL int dotcode(struct zint_symbol *symbol, struct zint_seg segs[], const i if ((height < 5) || (width < 5)) { if (height < 5 && width < 5) { /* Won't happen as if width < 5, min height is 19 */ - sprintf(symbol->errtxt, "527: Symbol size %dx%d (WxH) is too small", width, height); /* Not reached */ + errtxtf(0, symbol, 527, "Symbol size '%1$dx%2$d' (WxH) is too small", width, height); /* Not reached */ } else { - sprintf(symbol->errtxt, "529: Symbol %s %d is too small", - width < 5 ? "width" : "height", width < 5 ? width : height); + errtxtf(0, symbol, 529, "Symbol %1$s '%2$d' is too small", + width < 5 ? "width" : "height", width < 5 ? width : height); } return ZINT_ERROR_INVALID_OPTION; } diff --git a/backend/eci.c b/backend/eci.c index 7d4dd633..16c77fde 100644 --- a/backend/eci.c +++ b/backend/eci.c @@ -834,8 +834,7 @@ INTERNAL int sjis_utf8(struct zint_symbol *symbol, const unsigned char source[], for (i = 0, length = *p_length; i < length; i++) { if (!u_sjis_int(utfdata[i], ddata + i)) { - strcpy(symbol->errtxt, "800: Invalid character in input data"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 800, "Invalid character in input"); } } @@ -929,8 +928,7 @@ INTERNAL int gb2312_utf8(struct zint_symbol *symbol, const unsigned char source[ ddata[i] = utfdata[i]; } else { if (!u_gb2312_int(utfdata[i], ddata + i)) { - strcpy(symbol->errtxt, "810: Invalid character in input data"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 810, "Invalid character in input"); } } } @@ -1033,8 +1031,7 @@ INTERNAL int gb18030_utf8(struct zint_symbol *symbol, const unsigned char source } else { ret = u_gb18030_int(utfdata[i], ddata + j, ddata + j + 1); if (ret == 0) { /* Should never happen, as GB 18030 is a UTF i.e. maps all Unicode codepoints */ - strcpy(symbol->errtxt, "820: Invalid character in input data"); /* Not reached */ - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 820, "Invalid character in input"); /* Not reached */ } if (ret == 4) { j++; diff --git a/backend/emf.c b/backend/emf.c index 03f13a88..e6b72974 100644 --- a/backend/emf.c +++ b/backend/emf.c @@ -239,8 +239,7 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) { const int ih_ultra_offset = symbol->symbology == BARCODE_ULTRA ? 8 : 0; if (symbol->vector == NULL) { - strcpy(symbol->errtxt, "643: Vector header NULL"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 643, "Vector header NULL"); } (void) out_colour_get_rgb(symbol->fgcolour, &fgred, &fggrn, &fgblu, NULL /*alpha*/); @@ -640,8 +639,7 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) { for (i = 0; i < this_text; i++) { free(this_string[i]); } - strcpy(symbol->errtxt, "641: Insufficient memory for EMF string buffer"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 641, "Insufficient memory for EMF string buffer"); } memset(this_string[this_text], 0, text_bumped_lens[this_text]); out_le_u32(text[this_text].type, 0x00000054); /* EMR_EXTTEXTOUTW */ @@ -703,8 +701,8 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) { /* Send EMF data to file */ if (!fm_open(fmp, symbol, "wb")) { - sprintf(symbol->errtxt, "640: Could not open output file (%d: %.30s)", fmp->err, strerror(fmp->err)); - return ZINT_ERROR_FILE_ACCESS; + return errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 640, "Could not open EMF output file (%1$d: %2$s)", fmp->err, + strerror(fmp->err)); } fm_write(&emr_header, sizeof(emr_header_t), 1, fmp); @@ -822,14 +820,14 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) { fm_write(&emr_eof, sizeof(emr_eof_t), 1, fmp); if (fm_error(fmp)) { - sprintf(symbol->errtxt, "644: Incomplete write to output (%d: %.30s)", fmp->err, strerror(fmp->err)); + errtxtf(0, symbol, 644, "Incomplete write of EMF output (%1$d: %2$s)", fmp->err, strerror(fmp->err)); (void) fm_close(fmp, symbol); return ZINT_ERROR_FILE_WRITE; } if (!fm_close(fmp, symbol)) { - sprintf(symbol->errtxt, "941: Failure on closing output file (%d: %.30s)", fmp->err, strerror(fmp->err)); - return ZINT_ERROR_FILE_WRITE; + return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 941, "Failure on closing EMF output file (%1$d: %2$s)", + fmp->err, strerror(fmp->err)); } return error_number; } diff --git a/backend/filemem.h b/backend/filemem.h index 3af34d40..caccd5ae 100644 --- a/backend/filemem.h +++ b/backend/filemem.h @@ -72,7 +72,7 @@ INTERNAL int fm_putc(const int ch, struct filemem *restrict const fmp); INTERNAL int fm_puts(const char *str, struct filemem *restrict const fmp); /* `fprintf()` to file or memory, returning 1 on success, 0 on failure */ -INTERNAL int fm_printf(struct filemem *restrict const fmp, const char *format, ...); +INTERNAL int fm_printf(struct filemem *restrict const fmp, const char *format, ...) ZINT_FORMAT_PRINTF(2, 3); /* Output float without trailing zeroes to `fmp` with decimal pts `dp` (precision), returning 1 on success, 0 on failure */ diff --git a/backend/general_field.c b/backend/general_field.c index e3170c38..9c862b72 100644 --- a/backend/general_field.c +++ b/backend/general_field.c @@ -45,7 +45,7 @@ static int general_field_type(const char *general_field, const int i) { if (z_isupper(general_field[i]) || posn(alphanum_puncs, general_field[i]) != -1) { return ALPHANUMERIC; } - if (is_sane(IS_ISOIEC_F, (const unsigned char *) general_field + i, 1)) { + if (!not_sane(IS_ISOIEC_F, (const unsigned char *) general_field + i, 1)) { return ISOIEC; } return 0; diff --git a/backend/gif.c b/backend/gif.c index 48275ce5..e47b6245 100644 --- a/backend/gif.c +++ b/backend/gif.c @@ -269,16 +269,15 @@ INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf) State.OutLength = GIF_LZW_PAGE_SIZE; } if (!(State.pOut = (unsigned char *) malloc(State.OutLength))) { - strcpy(symbol->errtxt, "614: Insufficient memory for LZW buffer"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 614, "Insufficient memory for GIF LZW buffer"); } State.fmp = &fm; /* Open output file in binary mode */ if (!fm_open(State.fmp, symbol, "wb")) { - sprintf(symbol->errtxt, "611: Could not open output file (%d: %.30s)", State.fmp->err, - strerror(State.fmp->err)); + errtxtf(0, symbol, 611, "Could not open GIF output file (%1$d: %2$s)", State.fmp->err, + strerror(State.fmp->err)); free(State.pOut); return ZINT_ERROR_FILE_ACCESS; } @@ -445,8 +444,7 @@ INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf) if (!gif_lzw(&State, paletteBitSize)) { free(State.pOut); (void) fm_close(State.fmp, symbol); - strcpy(symbol->errtxt, "613: Insufficient memory for LZW buffer"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 613, "Insufficient memory for GIF LZW buffer"); } fm_write(State.pOut, 1, State.OutPosCur, State.fmp); free(State.pOut); @@ -455,16 +453,15 @@ INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf) fm_putc(';', State.fmp); if (fm_error(State.fmp)) { - sprintf(symbol->errtxt, "615: Incomplete write to output (%d: %.30s)", State.fmp->err, - strerror(State.fmp->err)); + errtxtf(0, symbol, 615, "Incomplete write of GIF output (%1$d: %2$s)", State.fmp->err, + strerror(State.fmp->err)); (void) fm_close(State.fmp, symbol); return ZINT_ERROR_FILE_WRITE; } if (!fm_close(State.fmp, symbol)) { - sprintf(symbol->errtxt, "617: Failure on closing output file (%d: %.30s)", State.fmp->err, - strerror(State.fmp->err)); - return ZINT_ERROR_FILE_WRITE; + return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 617, "Failure on closing GIF output file (%1$d: %2$s)", + State.fmp->err, strerror(State.fmp->err)); } return 0; diff --git a/backend/gridmtx.c b/backend/gridmtx.c index 05d32342..7ab4b9b6 100644 --- a/backend/gridmtx.c +++ b/backend/gridmtx.c @@ -1050,8 +1050,8 @@ INTERNAL int gridmatrix(struct zint_symbol *symbol, struct zint_seg segs[], cons if (error_number == 0) { done = 1; } else { - sprintf(symbol->errtxt, "535: Invalid character in input data for ECI %d", local_segs[i].eci); - return error_number; + return errtxtf(error_number, symbol, 535, "Invalid character in input for ECI '%d'", + local_segs[i].eci); } } if (!done) { @@ -1069,12 +1069,13 @@ INTERNAL int gridmatrix(struct zint_symbol *symbol, struct zint_seg segs[], cons if (symbol->structapp.count) { if (symbol->structapp.count < 2 || symbol->structapp.count > 16) { - strcpy(symbol->errtxt, "536: Structured Append count out of range (2-16)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 536, + "Structured Append count '%d' out of range (2 to 16)", symbol->structapp.count); } if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { - sprintf(symbol->errtxt, "537: Structured Append index out of range (1-%d)", symbol->structapp.count); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 537, + "Structured Append index '%1$d' out of range (1 to count %2$d)", + symbol->structapp.index, symbol->structapp.count); } if (symbol->structapp.id[0]) { int id, id_len; @@ -1082,32 +1083,30 @@ INTERNAL int gridmatrix(struct zint_symbol *symbol, struct zint_seg segs[], cons for (id_len = 1; id_len < 4 && symbol->structapp.id[id_len]; id_len++); if (id_len > 3) { /* 255 (8 bits) */ - strcpy(symbol->errtxt, "538: Structured Append ID too long (3 digit maximum)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 538, + "Structured Append ID length %d too long (3 digit maximum)", id_len); } id = to_int((const unsigned char *) symbol->structapp.id, id_len); if (id == -1) { - strcpy(symbol->errtxt, "539: Invalid Structured Append ID (digits only)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 539, "Invalid Structured Append ID (digits only)"); } if (id > 255) { - sprintf(symbol->errtxt, "530: Structured Append ID '%d' out of range (0-255)", id); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 530, + "Structured Append ID value '%d' out of range (0 to 255)", id); } } p_structapp = &symbol->structapp; } if (symbol->eci > 811799) { - strcpy(symbol->errtxt, "533: Invalid ECI"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 533, "ECI code '%d' out of range (0 to 811799)", + symbol->eci); } error_number = gm_encode_segs(ddata, local_segs, seg_count, binary, reader, p_structapp, &bin_len, debug_print); if (error_number != 0) { - strcpy(symbol->errtxt, "531: Input data too long"); - return error_number; + return errtxt(error_number, symbol, 531, "Input too long, requires too many codewords (maximum 1313)"); } /* Determine the size of the symbol */ @@ -1132,8 +1131,9 @@ INTERNAL int gridmatrix(struct zint_symbol *symbol, struct zint_seg segs[], cons if (symbol->option_2 >= min_layers) { layers = symbol->option_2; } else { - strcpy(symbol->errtxt, "534: Input data too long for selected symbol size"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 534, + "Input too long for Version %1$d, requires %2$d codewords (maximum %3$d)", + symbol->option_2, data_cw, gm_max_cw[symbol->option_2 - 1]); } } @@ -1189,8 +1189,12 @@ INTERNAL int gridmatrix(struct zint_symbol *symbol, struct zint_seg segs[], cons } if (data_cw > data_max) { - strcpy(symbol->errtxt, "532: Input data too long"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 532, + "Input too long for ECC level %1$d, requires %2$d codewords (maximum %3$d)", + ecc_level, data_cw, data_max); + } + if (debug_print) { + printf("Layers: %d, ECC level: %d, Data Codewords: %d\n", layers, ecc_level, data_cw); } gm_add_ecc(binary, data_cw, layers, ecc_level, word); diff --git a/backend/gs1.c b/backend/gs1.c index cc1a42d1..1e05dfb2 100644 --- a/backend/gs1.c +++ b/backend/gs1.c @@ -181,7 +181,7 @@ static int csum(const unsigned char *data, int data_len, int offset, int min, in for (; d < de; d++) { checksum += (*d - '0') * factor; - factor ^= 2; /* Toggles 1 and 3 */ + factor ^= 0x02; /* Toggles 1 and 3 */ } checksum = 10 - checksum % 10; if (checksum == 10) { @@ -1624,50 +1624,44 @@ static int packagetype(const unsigned char *data, int data_len, int offset, int /* Verify a GS1 input string */ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const int length, unsigned char reduced[]) { - int i, j, last_ai, ai_latch; - int bracket_level, max_bracket_level, ai_length, max_ai_length, min_ai_length; - int ai_zero_len_no_data = 0, ai_single_digit = 0, ai_nonnumeric = 0; - int ai_count; + int i, j; int error_value = 0; - char obracket = symbol->input_mode & GS1PARENS_MODE ? '(' : '['; - char cbracket = symbol->input_mode & GS1PARENS_MODE ? ')' : ']'; - int ai_max = chr_cnt(source, length, obracket) + 1; /* Plus 1 so non-zero */ + int bracket_level = 0, max_bracket_level = 0; + int ai_length, ai_latch; + int max_ai_length = 0, min_ai_length = 5; + int max_ai_pos = 0, min_ai_pos = 0; /* Suppress gcc 14 "-Wmaybe-uninitialized" false positives */ + int ai_zero_len_no_data = 0, ai_single_digit = 0, ai_nonnumeric = 0; + int ai_nonnumeric_pos = 0; /* Suppress gcc 14 "-Wmaybe-uninitialized" false positive */ + const char obracket = symbol->input_mode & GS1PARENS_MODE ? '(' : '['; + const char cbracket = symbol->input_mode & GS1PARENS_MODE ? ')' : ']'; + const int ai_max = chr_cnt(source, length, obracket) + 1; /* Plus 1 so non-zero */ int *ai_value = (int *) z_alloca(sizeof(int) * ai_max); int *ai_location = (int *) z_alloca(sizeof(int) * ai_max); int *data_location = (int *) z_alloca(sizeof(int) * ai_max); int *data_length = (int *) z_alloca(sizeof(int) * ai_max); - /* Detect extended ASCII characters */ + /* Detect control and extended ASCII characters */ for (i = 0; i < length; i++) { if (source[i] >= 128) { - strcpy(symbol->errtxt, "250: Extended ASCII characters are not supported by GS1"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 250, "Extended ASCII characters are not supported by GS1"); } if (source[i] == '\0') { - strcpy(symbol->errtxt, "262: NUL characters not permitted in GS1 mode"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 262, "NUL characters not permitted in GS1 mode"); } if (source[i] < 32) { - strcpy(symbol->errtxt, "251: Control characters are not supported by GS1"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 251, "Control characters are not supported by GS1"); } if (source[i] == 127) { - strcpy(symbol->errtxt, "263: DEL characters are not supported by GS1"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 263, "DEL characters are not supported by GS1"); } } if (source[0] != obracket) { - strcpy(symbol->errtxt, "252: Data does not start with an AI"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 252, "Data does not start with an AI"); } - /* Check the position of the brackets */ - bracket_level = 0; - max_bracket_level = 0; + /* Check the balance of the brackets & AI lengths */ ai_length = 0; - max_ai_length = 0; - min_ai_length = 5; ai_latch = 0; for (i = 0; i < length; i++) { if (source[i] == obracket) { @@ -1680,9 +1674,11 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[] bracket_level--; if (ai_length > max_ai_length) { max_ai_length = ai_length; + max_ai_pos = i - ai_length; } if (ai_length < min_ai_length) { min_ai_length = ai_length; + min_ai_pos = i - ai_length; } /* Check zero-length AI has data */ if (ai_length == 0 && (i + 1 == length || source[i + 1] == obracket)) { @@ -1696,26 +1692,25 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[] ai_length++; if (!z_isdigit(source[i])) { ai_nonnumeric = 1; + ai_nonnumeric_pos = i - ai_length + 1; } } } if (bracket_level != 0) { /* Not all brackets are closed */ - strcpy(symbol->errtxt, "253: Malformed AI in input data (brackets don\'t match)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 253, "Malformed AI in input (brackets don\'t match)"); } if (max_bracket_level > 1) { /* Nested brackets */ - strcpy(symbol->errtxt, "254: Found nested brackets in input data"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 254, "Found nested brackets in input"); } if (max_ai_length > 4) { /* AI is too long */ - strcpy(symbol->errtxt, "255: Invalid AI in input data (AI too long)"); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 255, "Invalid AI at position %d in input (AI too long)", + max_ai_pos); } if (min_ai_length <= 1) { @@ -1723,19 +1718,19 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[] - permits dummy "[]" workaround for ticket #204 data with no valid AI */ if (!(symbol->input_mode & GS1NOCHECK_MODE) || ai_single_digit || ai_zero_len_no_data) { /* AI is too short */ - strcpy(symbol->errtxt, "256: Invalid AI in input data (AI too short)"); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 256, "Invalid AI at position %d in input (AI too short)", + min_ai_pos); } } if (ai_nonnumeric) { /* Non-numeric data in AI */ - strcpy(symbol->errtxt, "257: Invalid AI in input data (non-numeric characters in AI)"); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 257, + "Invalid AI at position %d in input (non-numeric characters in AI)", ai_nonnumeric_pos); } if (!(symbol->input_mode & GS1NOCHECK_MODE)) { - ai_count = 0; + int ai_count = 0; for (i = 1; i < length; i++) { if (source[i - 1] == obracket) { ai_location[ai_count] = i; @@ -1761,8 +1756,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[] } if (data_length[i] == 0) { /* No data for given AI */ - strcpy(symbol->errtxt, "258: Empty data field in input data"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 258, "Empty data field in input"); } } @@ -1773,11 +1767,11 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[] char err_msg[50]; if (!gs1_lint(ai_value[i], source + data_location[i], data_length[i], &err_no, &err_posn, err_msg)) { if (err_no == 1) { - sprintf(symbol->errtxt, "260: Invalid AI (%02d)", ai_value[i]); + errtxtf(0, symbol, 260, "Invalid AI (%02d)", ai_value[i]); } else if (err_no == 2 || err_no == 4) { /* 4 is backward-incompatible bad length */ - sprintf(symbol->errtxt, "259: Invalid data length for AI (%02d)", ai_value[i]); + errtxtf(0, symbol, 259, "Invalid data length for AI (%02d)", ai_value[i]); } else { - sprintf(symbol->errtxt, "261: AI (%02d) position %d: %s", ai_value[i], err_posn, err_msg); + errtxtf(0, symbol, 261, "AI (%1$02d) position %2$d: %3$s", ai_value[i], err_posn, err_msg); } /* For backward compatibility only error on unknown AI or bad length */ if (err_no == 1 || err_no == 2) { @@ -1799,7 +1793,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[] reduced[j++] = '\x1D'; } if (i + 1 != length) { - last_ai = to_int(source + i + 1, 2); + int last_ai = to_int(source + i + 1, 2); ai_latch = 0; /* The following values from "GS1 General Specifications Release 21.0.1" Figure 7.8.4-2 "Element strings with predefined length using GS1 Application Identifiers" */ @@ -1836,7 +1830,7 @@ INTERNAL char gs1_check_digit(const unsigned char source[], const int length) { for (i = 0; i < length; i++) { count += factor * ctoi(source[i]); - factor ^= 2; /* Toggles 1 and 3 */ + factor ^= 0x02; /* Toggles 1 and 3 */ } return itoc((10 - (count % 10)) % 10); diff --git a/backend/hanxin.c b/backend/hanxin.c index d83553d2..790504be 100644 --- a/backend/hanxin.c +++ b/backend/hanxin.c @@ -1521,8 +1521,8 @@ INTERNAL int hanxin(struct zint_symbol *symbol, struct zint_seg segs[], const in if (error_number == 0) { done = 1; } else if (local_segs[i].eci || seg_count > 1) { - sprintf(symbol->errtxt, "545: Invalid character in input data for ECI %d", local_segs[i].eci); - return error_number; + return errtxtf(error_number, symbol, 545, "Invalid character in input for ECI '%d'", + local_segs[i].eci); } } if (!done) { @@ -1532,8 +1532,8 @@ INTERNAL int hanxin(struct zint_symbol *symbol, struct zint_seg segs[], const in return error_number; } if (local_segs[i].eci != 32) { - strcpy(symbol->errtxt, "543: Converted to GB 18030 but no ECI specified"); - warn_number = ZINT_WARN_NONCOMPLIANT; + warn_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 543, + "Converted to GB 18030 but no ECI specified"); } } dd += local_segs[i].length; @@ -1543,8 +1543,11 @@ INTERNAL int hanxin(struct zint_symbol *symbol, struct zint_seg segs[], const in hx_define_mode_segs(mode, ddata, local_segs, seg_count, debug_print); est_binlen = hx_calc_binlen_segs(mode, ddata, local_segs, seg_count); + if (debug_print) { + printf("Estimated binary length: %d\n", est_binlen); + } - binary = (char *) z_alloca((est_binlen + 1)); + binary = (char *) malloc(est_binlen + 1); if ((ecc_level <= 0) || (ecc_level >= 5)) { ecc_level = 1; @@ -1561,40 +1564,16 @@ INTERNAL int hanxin(struct zint_symbol *symbol, struct zint_seg segs[], const in version = 85; for (i = 84; i > 0; i--) { - switch (ecc_level) { - case 1: - if (hx_data_codewords_L1[i - 1] >= codewords) { - version = i; - data_codewords = hx_data_codewords_L1[i - 1]; - } - break; - case 2: - if (hx_data_codewords_L2[i - 1] >= codewords) { - version = i; - data_codewords = hx_data_codewords_L2[i - 1]; - } - break; - case 3: - if (hx_data_codewords_L3[i - 1] >= codewords) { - version = i; - data_codewords = hx_data_codewords_L3[i - 1]; - } - break; - case 4: - if (hx_data_codewords_L4[i - 1] >= codewords) { - version = i; - data_codewords = hx_data_codewords_L4[i - 1]; - } - break; - default: /* Not reached */ - assert(0); - break; + if (hx_data_codewords[ecc_level - 1][i - 1] >= codewords) { + version = i; + data_codewords = hx_data_codewords[ecc_level - 1][i - 1]; } } if (version == 85) { - strcpy(symbol->errtxt, "541: Input too long for selected error correction level"); - return ZINT_ERROR_TOO_LONG; + free(binary); + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 541, "Input too long, requires %d codewords (maximum 3264)", + codewords); } if ((symbol->option_2 < 0) || (symbol->option_2 > 84)) { @@ -1606,27 +1585,35 @@ INTERNAL int hanxin(struct zint_symbol *symbol, struct zint_seg segs[], const in } if ((symbol->option_2 != 0) && (symbol->option_2 < version)) { - strcpy(symbol->errtxt, "542: Input too long for selected symbol size"); - return ZINT_ERROR_TOO_LONG; + free(binary); + if (ecc_level == 1) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 542, + "Input too long for Version %1$d, requires %2$d codewords (maximum %3$d)", + symbol->option_2, codewords, hx_data_codewords[ecc_level - 1][symbol->option_2 - 1]); + } + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 542, + "Input too long for Version %1$d, ECC %2$d, requires %3$d codewords (maximum %4$d)", + symbol->option_2, ecc_level, codewords, + hx_data_codewords[ecc_level - 1][symbol->option_2 - 1]); } /* If there is spare capacity, increase the level of ECC */ /* Unless explicitly specified (within min/max bounds) by user */ if (symbol->option_1 == -1 || symbol->option_1 != ecc_level) { - if ((ecc_level == 1) && (codewords <= hx_data_codewords_L2[version - 1])) { + if (ecc_level == 1 && codewords <= hx_data_codewords[1][version - 1]) { ecc_level = 2; - data_codewords = hx_data_codewords_L2[version - 1]; + data_codewords = hx_data_codewords[1][version - 1]; } - if ((ecc_level == 2) && (codewords <= hx_data_codewords_L3[version - 1])) { + if (ecc_level == 2 && codewords <= hx_data_codewords[2][version - 1]) { ecc_level = 3; - data_codewords = hx_data_codewords_L3[version - 1]; + data_codewords = hx_data_codewords[2][version - 1]; } - if ((ecc_level == 3) && (codewords <= hx_data_codewords_L4[version - 1])) { + if (ecc_level == 3 && codewords <= hx_data_codewords[3][version - 1]) { ecc_level = 4; - data_codewords = hx_data_codewords_L4[version - 1]; + data_codewords = hx_data_codewords[3][version - 1]; } } @@ -1645,6 +1632,7 @@ INTERNAL int hanxin(struct zint_symbol *symbol, struct zint_seg segs[], const in datastream[i >> 3] |= 0x80 >> (i & 0x07); } } + free(binary); if (debug_print) { printf("Datastream (%d):", data_codewords); diff --git a/backend/hanxin.h b/backend/hanxin.h index e24bda20..94928bf0 100644 --- a/backend/hanxin.h +++ b/backend/hanxin.h @@ -1,7 +1,7 @@ /* hanxin.h - definitions for Han Xin code */ /* libzint - the open source barcode library - Copyright (C) 2009-2022 Robin Stuart + Copyright (C) 2009-2024 Robin Stuart Copyright (C) 2016 Zoe Stuart Redistribution and use in source and binary forms, with or without @@ -35,57 +35,64 @@ #define Z_HANXIN_H /* Data from table B1: Data capacity of Han Xin Code */ -static const unsigned short hx_total_codewords[] = { - 25, 37, 50, 54, 69, 84, 100, 117, 136, 155, 161, 181, 203, 225, 249, - 273, 299, 325, 353, 381, 411, 422, 453, 485, 518, 552, 587, 623, 660, - 698, 737, 754, 794, 836, 878, 922, 966, 1011, 1058, 1105, 1126, 1175, - 1224, 1275, 1327, 1380, 1434, 1489, 1513, 1569, 1628, 1686, 1745, 1805, - 1867, 1929, 1992, 2021, 2086, 2151, 2218, 2286, 2355, 2425, 2496, 2528, - 2600, 2673, 2749, 2824, 2900, 2977, 3056, 3135, 3171, 3252, 3334, 3416, - 3500, 3585, 3671, 3758, 3798, 3886 +static const unsigned short hx_total_codewords[84] = { + 25, 37, 50, 54, 69, 84, 100, 117, 136, 155, + 161, 181, 203, 225, 249, 273, 299, 325, 353, 381, + 411, 422, 453, 485, 518, 552, 587, 623, 660, 698, + 737, 754, 794, 836, 878, 922, 966, 1011, 1058, 1105, + 1126, 1175, 1224, 1275, 1327, 1380, 1434, 1489, 1513, 1569, + 1628, 1686, 1745, 1805, 1867, 1929, 1992, 2021, 2086, 2151, + 2218, 2286, 2355, 2425, 2496, 2528, 2600, 2673, 2749, 2824, + 2900, 2977, 3056, 3135, 3171, 3252, 3334, 3416, 3500, 3585, + 3671, 3758, 3798, 3886 }; -static const unsigned short hx_data_codewords_L1[] = { - 21, 31, 42, 46, 57, 70, 84, 99, 114, 131, 135, 153, 171, 189, 209, 229, - 251, 273, 297, 321, 345, 354, 381, 407, 436, 464, 493, 523, 554, 586, 619, - 634, 666, 702, 738, 774, 812, 849, 888, 929, 946, 987, 1028, 1071, 1115, - 1160, 1204, 1251, 1271, 1317, 1368, 1416, 1465, 1517, 1569, 1621, 1674, - 1697, 1752, 1807, 1864, 1920, 1979, 2037, 2096, 2124, 2184, 2245, 2309, - 2372, 2436, 2501, 2568, 2633, 2663, 2732, 2800, 2870, 2940, 3011, - 3083, 3156, 3190, 3264 -}; - -static const unsigned short hx_data_codewords_L2[] = { - 17, 25, 34, 38, 49, 58, 70, 81, 96, 109, 113, 127, 143, 157, 175, 191, 209, - 227, 247, 267, 287, 296, 317, 339, 362, 386, 411, 437, 462, 488, 515, 528, - 556, 586, 614, 646, 676, 707, 740, 773, 788, 823, 856, 893, 929, 966, 1004, - 1043, 1059, 1099, 1140, 1180, 1221, 1263, 1307, 1351, 1394, 1415, 1460, - 1505, 1552, 1600, 1649, 1697, 1748, 1770, 1820, 1871, 1925, 1976, 2030, - 2083, 2140, 2195, 2219, 2276, 2334, 2392, 2450, 2509, 2569, 2630, 2658, - 2720 -}; - -static const unsigned short hx_data_codewords_L3[] = { - 13, 19, 26, 30, 37, 46, 54, 63, 74, 83, 87, 97, 109, 121, 135, 147, 161, - 175, 191, 205, 221, 228, 245, 261, 280, 298, 317, 337, 358, 376, 397, 408, - 428, 452, 474, 498, 522, 545, 572, 597, 608, 635, 660, 689, 717, 746, 774, - 805, 817, 847, 880, 910, 943, 975, 1009, 1041, 1076, 1091, 1126, 1161, 1198, - 1234, 1271, 1309, 1348, 1366, 1404, 1443, 1485, 1524, 1566, 1607, 1650, 1693, - 1713, 1756, 1800, 1844, 1890, 1935, 1983, 2030, 2050, 2098 -}; - -static const unsigned short hx_data_codewords_L4[] = { - 9, 15, 20, 22, 27, 34, 40, 47, 54, 61, 65, 73, 81, 89, 99, 109, 119, 129, - 141, 153, 165, 168, 181, 195, 208, 220, 235, 251, 264, 280, 295, 302, 318, - 334, 352, 368, 386, 405, 424, 441, 450, 469, 490, 509, 531, 552, 574, 595, 605, - 627, 652, 674, 697, 721, 747, 771, 796, 809, 834, 861, 892, 914, 941, 969, 998, - 1012, 1040, 1069, 1099, 1130, 1160, 1191, 1222, 1253, 1269, 1300, 1334, - 1366, 1400, 1433, 1469, 1504, 1520, 1554 +static const unsigned short hx_data_codewords[4][84] = { { + 21, 31, 42, 46, 57, 70, 84, 99, 114, 131, + 135, 153, 171, 189, 209, 229, 251, 273, 297, 321, + 345, 354, 381, 407, 436, 464, 493, 523, 554, 586, + 619, 634, 666, 702, 738, 774, 812, 849, 888, 929, + 946, 987, 1028, 1071, 1115, 1160, 1204, 1251, 1271, 1317, + 1368, 1416, 1465, 1517, 1569, 1621, 1674, 1697, 1752, 1807, + 1864, 1920, 1979, 2037, 2096, 2124, 2184, 2245, 2309, 2372, + 2436, 2501, 2568, 2633, 2663, 2732, 2800, 2870, 2940, 3011, + 3083, 3156, 3190, 3264 + }, { + 17, 25, 34, 38, 49, 58, 70, 81, 96, 109, + 113, 127, 143, 157, 175, 191, 209, 227, 247, 267, + 287, 296, 317, 339, 362, 386, 411, 437, 462, 488, + 515, 528, 556, 586, 614, 646, 676, 707, 740, 773, + 788, 823, 856, 893, 929, 966, 1004, 1043, 1059, 1099, + 1140, 1180, 1221, 1263, 1307, 1351, 1394, 1415, 1460, 1505, + 1552, 1600, 1649, 1697, 1748, 1770, 1820, 1871, 1925, 1976, + 2030, 2083, 2140, 2195, 2219, 2276, 2334, 2392, 2450, 2509, + 2569, 2630, 2658, 2720 + }, { + 13, 19, 26, 30, 37, 46, 54, 63, 74, 83, + 87, 97, 109, 121, 135, 147, 161, 175, 191, 205, + 221, 228, 245, 261, 280, 298, 317, 337, 358, 376, + 397, 408, 428, 452, 474, 498, 522, 545, 572, 597, + 608, 635, 660, 689, 717, 746, 774, 805, 817, 847, + 880, 910, 943, 975, 1009, 1041, 1076, 1091, 1126, 1161, + 1198, 1234, 1271, 1309, 1348, 1366, 1404, 1443, 1485, 1524, + 1566, 1607, 1650, 1693, 1713, 1756, 1800, 1844, 1890, 1935, + 1983, 2030, 2050, 2098 + }, { + 9, 15, 20, 22, 27, 34, 40, 47, 54, 61, + 65, 73, 81, 89, 99, 109, 119, 129, 141, 153, + 165, 168, 181, 195, 208, 220, 235, 251, 264, 280, + 295, 302, 318, 334, 352, 368, 386, 405, 424, 441, + 450, 469, 490, 509, 531, 552, 574, 595, 605, 627, + 652, 674, 697, 721, 747, 771, 796, 809, 834, 861, + 892, 914, 941, 969, 998, 1012, 1040, 1069, 1099, 1130, + 1160, 1191, 1222, 1253, 1269, 1300, 1334, 1366, 1400, 1433, + 1469, 1504, 1520, 1554 + } }; /* Value 'k' from Annex A */ -static const char hx_module_k[] = { - 0, 0, 0, 14, 16, 16, 17, 18, 19, 20, +static const char hx_module_k[84] = { + 0, 0, 0, 14, 16, 16, 17, 18, 19, 20, 14, 15, 16, 16, 17, 17, 18, 19, 20, 20, 21, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 17, 17, 18, 18, 19, 19, 19, 20, 20, @@ -97,8 +104,8 @@ static const char hx_module_k[] = { }; /* Value 'r' from Annex A */ -static const char hx_module_r[] = { - 0, 0, 0, 15, 15, 17, 18, 19, 20, 21, +static const char hx_module_r[84] = { + 0, 0, 0, 15, 15, 17, 18, 19, 20, 21, 15, 15, 15, 17, 17, 19, 19, 19, 19, 21, 21, 17, 16, 18, 17, 19, 18, 20, 19, 21, 20, 17, 19, 17, 19, 17, 19, 21, 19, 21, @@ -110,357 +117,357 @@ static const char hx_module_r[] = { }; /* Value of 'm' from Annex A */ -static const char hx_module_m[] = { - 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, - 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, - 9, 9, 10, 10 +static const char hx_module_m[84] = { + 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, + 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, + 9, 9, 10, 10 }; /* Error correction block sizes from Table D1 */ static const unsigned char hx_table_d1[] = { - /* #blocks, k, 2t, #blocks, k, 2t, #blocks, k, 2t */ - 1, 21, 4, 0, 0, 0, 0, 0, 0, /* version 1 */ - 1, 17, 8, 0, 0, 0, 0, 0, 0, - 1, 13, 12, 0, 0, 0, 0, 0, 0, - 1, 9, 16, 0, 0, 0, 0, 0, 0, - 1, 31, 6, 0, 0, 0, 0, 0, 0, /* version 2 */ - 1, 25, 12, 0, 0, 0, 0, 0, 0, - 1, 19, 18, 0, 0, 0, 0, 0, 0, - 1, 15, 22, 0, 0, 0, 0, 0, 0, - 1, 42, 8, 0, 0, 0, 0, 0, 0, /* version 3 */ - 1, 34, 16, 0, 0, 0, 0, 0, 0, - 1, 26, 24, 0, 0, 0, 0, 0, 0, - 1, 20, 30, 0, 0, 0, 0, 0, 0, - 1, 46, 8, 0, 0, 0, 0, 0, 0, /* version 4 */ - 1, 38, 16, 0, 0, 0, 0, 0, 0, - 1, 30, 24, 0, 0, 0, 0, 0, 0, - 1, 22, 32, 0, 0, 0, 0, 0, 0, - 1, 57, 12, 0, 0, 0, 0, 0, 0, /* version 5 */ - 1, 49, 20, 0, 0, 0, 0, 0, 0, - 1, 37, 32, 0, 0, 0, 0, 0, 0, - 1, 14, 20, 1, 13, 22, 0, 0, 0, - 1, 70, 14, 0, 0, 0, 0, 0, 0, /* version 6 */ - 1, 58, 26, 0, 0, 0, 0, 0, 0, - 1, 24, 20, 1, 22, 18, 0, 0, 0, - 1, 16, 24, 1, 18, 26, 0, 0, 0, - 1, 84, 16, 0, 0, 0, 0, 0, 0, /* version 7 */ - 1, 70, 30, 0, 0, 0, 0, 0, 0, - 1, 26, 22, 1, 28, 24, 0, 0, 0, - 2, 14, 20, 1, 12, 20, 0, 0, 0, - 1, 99, 18, 0, 0, 0, 0, 0, 0, /* version 8 */ - 1, 40, 18, 1, 41, 18, 0, 0, 0, - 1, 31, 26, 1, 32, 28, 0, 0, 0, - 2, 16, 24, 1, 15, 22, 0, 0, 0, - 1, 114, 22, 0, 0, 0, 0, 0, 0, /* version 9 */ - 2, 48, 20, 0, 0, 0, 0, 0, 0, - 2, 24, 20, 1, 26, 22, 0, 0, 0, - 2, 18, 28, 1, 18, 26, 0, 0, 0, - 1, 131, 24, 0, 0, 0, 0, 0, 0, /* version 10 */ - 1, 52, 22, 1, 57, 24, 0, 0, 0, - 2, 27, 24, 1, 29, 24, 0, 0, 0, - 2, 21, 32, 1, 19, 30, 0, 0, 0, - 1, 135, 26, 0, 0, 0, 0, 0, 0, /* version 11 */ - 1, 56, 24, 1, 57, 24, 0, 0, 0, - 2, 28, 24, 1, 31, 26, 0, 0, 0, - 2, 22, 32, 1, 21, 32, 0, 0, 0, - 1, 153, 28, 0, 0, 0, 0, 0, 0, /* version 12 */ - 1, 62, 26, 1, 65, 28, 0, 0, 0, - 2, 32, 28, 1, 33, 28, 0, 0, 0, - 3, 17, 26, 1, 22, 30, 0, 0, 0, - 1, 86, 16, 1, 85, 16, 0, 0, 0, /* version 13 */ - 1, 71, 30, 1, 72, 30, 0, 0, 0, - 2, 37, 32, 1, 35, 30, 0, 0, 0, - 3, 20, 30, 1, 21, 32, 0, 0, 0, - 1, 94, 18, 1, 95, 18, 0, 0, 0, /* version 14 */ - 2, 51, 22, 1, 55, 24, 0, 0, 0, - 3, 30, 26, 1, 31, 26, 0, 0, 0, - 4, 18, 28, 1, 17, 24, 0, 0, 0, - 1, 104, 20, 1, 105, 20, 0, 0, 0, /* version 15 */ - 2, 57, 24, 1, 61, 26, 0, 0, 0, - 3, 33, 28, 1, 36, 30, 0, 0, 0, - 4, 20, 30, 1, 19, 30, 0, 0, 0, - 1, 115, 22, 1, 114, 22, 0, 0, 0, /* version 16 */ - 2, 65, 28, 1, 61, 26, 0, 0, 0, - 3, 38, 32, 1, 33, 30, 0, 0, 0, - 5, 19, 28, 1, 14, 24, 0, 0, 0, - 1, 126, 24, 1, 125, 24, 0, 0, 0, /* version 17 */ - 2, 70, 30, 1, 69, 30, 0, 0, 0, - 4, 33, 28, 1, 29, 26, 0, 0, 0, - 5, 20, 30, 1, 19, 30, 0, 0, 0, - 1, 136, 26, 1, 137, 26, 0, 0, 0, /* version 18 */ - 3, 56, 24, 1, 59, 26, 0, 0, 0, - 5, 35, 30, 0, 0, 0, 0, 0, 0, - 6, 18, 28, 1, 21, 28, 0, 0, 0, - 1, 148, 28, 1, 149, 28, 0, 0, 0, /* version 19 */ - 3, 61, 26, 1, 64, 28, 0, 0, 0, - 7, 24, 20, 1, 23, 22, 0, 0, 0, - 6, 20, 30, 1, 21, 32, 0, 0, 0, - 3, 107, 20, 0, 0, 0, 0, 0, 0, /* version 20 */ - 3, 65, 28, 1, 72, 30, 0, 0, 0, - 7, 26, 22, 1, 23, 22, 0, 0, 0, - 7, 19, 28, 1, 20, 32, 0, 0, 0, - 3, 115, 22, 0, 0, 0, 0, 0, 0, /* version 21 */ - 4, 56, 24, 1, 63, 28, 0, 0, 0, - 7, 28, 24, 1, 25, 22, 0, 0, 0, - 8, 18, 28, 1, 21, 22, 0, 0, 0, - 2, 116, 22, 1, 122, 24, 0, 0, 0, /* version 22 */ - 4, 56, 24, 1, 72, 30, 0, 0, 0, - 7, 28, 24, 1, 32, 26, 0, 0, 0, - 8, 18, 28, 1, 24, 30, 0, 0, 0, - 3, 127, 24, 0, 0, 0, 0, 0, 0, /* version 23 */ - 5, 51, 22, 1, 62, 26, 0, 0, 0, - 7, 30, 26, 1, 35, 26, 0, 0, 0, - 8, 20, 30, 1, 21, 32, 0, 0, 0, - 2, 135, 26, 1, 137, 26, 0, 0, 0, /* version 24 */ - 5, 56, 24, 1, 59, 26, 0, 0, 0, - 7, 33, 28, 1, 30, 28, 0, 0, 0, - 11, 16, 24, 1, 19, 26, 0, 0, 0, - 3, 105, 20, 1, 121, 22, 0, 0, 0, /* version 25 */ - 5, 61, 26, 1, 57, 26, 0, 0, 0, - 9, 28, 24, 1, 28, 22, 0, 0, 0, - 10, 19, 28, 1, 18, 30, 0, 0, 0, - 2, 157, 30, 1, 150, 28, 0, 0, 0, /* version 26 */ - 5, 65, 28, 1, 61, 26, 0, 0, 0, - 8, 33, 28, 1, 34, 30, 0, 0, 0, - 10, 19, 28, 2, 15, 26, 0, 0, 0, - 3, 126, 24, 1, 115, 22, 0, 0, 0, /* version 27 */ - 7, 51, 22, 1, 54, 22, 0, 0, 0, - 8, 35, 30, 1, 37, 30, 0, 0, 0, - 15, 15, 22, 1, 10, 22, 0, 0, 0, - 4, 105, 20, 1, 103, 20, 0, 0, 0, /* version 28 */ - 7, 56, 24, 1, 45, 18, 0, 0, 0, - 10, 31, 26, 1, 27, 26, 0, 0, 0, - 10, 17, 26, 3, 20, 28, 1, 21, 28, - 3, 139, 26, 1, 137, 28, 0, 0, 0, /* version 29 */ - 6, 66, 28, 1, 66, 30, 0, 0, 0, - 9, 36, 30, 1, 34, 32, 0, 0, 0, - 13, 19, 28, 1, 17, 32, 0, 0, 0, - 6, 84, 16, 1, 82, 16, 0, 0, 0, /* version 30 */ - 6, 70, 30, 1, 68, 30, 0, 0, 0, - 7, 35, 30, 3, 33, 28, 1, 32, 28, - 13, 20, 30, 1, 20, 28, 0, 0, 0, - 5, 105, 20, 1, 94, 18, 0, 0, 0, /* version 31 */ - 6, 74, 32, 1, 71, 30, 0, 0, 0, - 11, 33, 28, 1, 34, 32, 0, 0, 0, - 13, 19, 28, 3, 16, 26, 0, 0, 0, - 4, 127, 24, 1, 126, 24, 0, 0, 0, /* version 32 */ - 7, 66, 28, 1, 66, 30, 0, 0, 0, - 12, 30, 24, 1, 24, 28, 1, 24, 30, - 15, 19, 28, 1, 17, 32, 0, 0, 0, - 7, 84, 16, 1, 78, 16, 0, 0, 0, /* version 33 */ - 7, 70, 30, 1, 66, 28, 0, 0, 0, - 12, 33, 28, 1, 32, 30, 0, 0, 0, - 14, 21, 32, 1, 24, 28, 0, 0, 0, - 5, 117, 22, 1, 117, 24, 0, 0, 0, /* version 34 */ - 8, 66, 28, 1, 58, 26, 0, 0, 0, - 11, 38, 32, 1, 34, 32, 0, 0, 0, - 15, 20, 30, 2, 17, 26, 0, 0, 0, - 4, 148, 28, 1, 146, 28, 0, 0, 0, /* version 35 */ - 8, 68, 30, 1, 70, 24, 0, 0, 0, - 10, 36, 32, 3, 38, 28, 0, 0, 0, - 16, 19, 28, 3, 16, 26, 0, 0, 0, - 4, 126, 24, 2, 135, 26, 0, 0, 0, /* version 36 */ - 8, 70, 28, 2, 43, 26, 0, 0, 0, - 13, 32, 28, 2, 41, 30, 0, 0, 0, - 17, 19, 28, 3, 15, 26, 0, 0, 0, - 5, 136, 26, 1, 132, 24, 0, 0, 0, /* version 37 */ - 5, 67, 30, 4, 68, 28, 1, 69, 28, - 14, 35, 30, 1, 32, 24, 0, 0, 0, - 18, 18, 26, 3, 16, 28, 1, 14, 28, - 3, 142, 26, 3, 141, 28, 0, 0, 0, /* version 38 */ - 8, 70, 30, 1, 73, 32, 1, 74, 32, - 12, 34, 30, 3, 34, 26, 1, 35, 28, - 18, 21, 32, 1, 27, 30, 0, 0, 0, - 5, 116, 22, 2, 103, 20, 1, 102, 20, /* version 39 */ - 9, 74, 32, 1, 74, 30, 0, 0, 0, - 14, 34, 28, 2, 32, 32, 1, 32, 30, - 19, 21, 32, 1, 25, 26, 0, 0, 0, - 7, 116, 22, 1, 117, 22, 0, 0, 0, /* version 40 */ - 11, 65, 28, 1, 58, 24, 0, 0, 0, - 15, 38, 32, 1, 27, 28, 0, 0, 0, - 20, 20, 30, 1, 20, 32, 1, 21, 32, - 6, 136, 26, 1, 130, 24, 0, 0, 0, /* version 41 */ - 11, 66, 28, 1, 62, 30, 0, 0, 0, - 14, 34, 28, 3, 34, 32, 1, 30, 30, - 18, 20, 30, 3, 20, 28, 2, 15, 26, - 5, 105, 20, 2, 115, 22, 2, 116, 22, /* version 42 */ - 10, 75, 32, 1, 73, 32, 0, 0, 0, - 16, 38, 32, 1, 27, 28, 0, 0, 0, - 22, 19, 28, 2, 16, 30, 1, 19, 30, - 6, 147, 28, 1, 146, 28, 0, 0, 0, /* version 43 */ - 11, 66, 28, 2, 65, 30, 0, 0, 0, - 18, 33, 28, 2, 33, 30, 0, 0, 0, - 22, 21, 32, 1, 28, 30, 0, 0, 0, - 6, 116, 22, 3, 125, 24, 0, 0, 0, /* version 44 */ - 11, 75, 32, 1, 68, 30, 0, 0, 0, - 13, 35, 28, 6, 34, 32, 1, 30, 30, - 23, 21, 32, 1, 26, 30, 0, 0, 0, - 7, 105, 20, 4, 95, 18, 0, 0, 0, /* version 45 */ - 12, 67, 28, 1, 63, 30, 1, 62, 32, - 21, 31, 26, 2, 33, 32, 0, 0, 0, - 23, 21, 32, 2, 24, 30, 0, 0, 0, - 10, 116, 22, 0, 0, 0, 0, 0, 0, /* version 46 */ - 12, 74, 32, 1, 78, 30, 0, 0, 0, - 18, 37, 32, 1, 39, 30, 1, 41, 28, - 25, 21, 32, 1, 27, 28, 0, 0, 0, - 5, 126, 24, 4, 115, 22, 1, 114, 22, /* version 47 */ - 12, 67, 28, 2, 66, 32, 1, 68, 30, - 21, 35, 30, 1, 39, 30, 0, 0, 0, - 26, 21, 32, 1, 28, 28, 0, 0, 0, - 9, 126, 24, 1, 117, 22, 0, 0, 0, /* version 48 */ - 13, 75, 32, 1, 68, 30, 0, 0, 0, - 20, 35, 30, 3, 35, 28, 0, 0, 0, - 27, 21, 32, 1, 28, 30, 0, 0, 0, - 9, 126, 24, 1, 137, 26, 0, 0, 0, /* version 49 */ - 13, 71, 30, 2, 68, 32, 0, 0, 0, - 20, 37, 32, 1, 39, 28, 1, 38, 28, - 24, 20, 32, 5, 25, 28, 0, 0, 0, - 8, 147, 28, 1, 141, 28, 0, 0, 0, /* version 50 */ - 10, 73, 32, 4, 74, 30, 1, 73, 30, - 16, 36, 32, 6, 39, 30, 1, 37, 30, - 27, 21, 32, 3, 20, 26, 0, 0, 0, - 9, 137, 26, 1, 135, 26, 0, 0, 0, /* version 51 */ - 12, 70, 30, 4, 75, 32, 0, 0, 0, - 24, 35, 30, 1, 40, 28, 0, 0, 0, - 23, 20, 32, 8, 24, 30, 0, 0, 0, - 14, 95, 18, 1, 86, 18, 0, 0, 0, /* version 52 */ - 13, 73, 32, 3, 77, 30, 0, 0, 0, - 24, 35, 30, 2, 35, 28, 0, 0, 0, - 26, 21, 32, 5, 21, 30, 1, 23, 30, - 9, 147, 28, 1, 142, 28, 0, 0, 0, /* version 53 */ - 10, 73, 30, 6, 70, 32, 1, 71, 32, - 25, 35, 30, 2, 34, 26, 0, 0, 0, - 29, 21, 32, 4, 22, 30, 0, 0, 0, - 11, 126, 24, 1, 131, 24, 0, 0, 0, /* version 54 */ - 16, 74, 32, 1, 79, 30, 0, 0, 0, - 25, 38, 32, 1, 25, 30, 0, 0, 0, - 33, 21, 32, 1, 28, 28, 0, 0, 0, - 14, 105, 20, 1, 99, 18, 0, 0, 0, /* version 55 */ - 19, 65, 28, 1, 72, 28, 0, 0, 0, - 24, 37, 32, 2, 40, 30, 1, 41, 30, - 31, 21, 32, 4, 24, 32, 0, 0, 0, - 10, 147, 28, 1, 151, 28, 0, 0, 0, /* version 56 */ - 15, 71, 30, 3, 71, 32, 1, 73, 32, - 24, 37, 32, 3, 38, 30, 1, 39, 30, - 36, 19, 30, 3, 29, 26, 0, 0, 0, - 15, 105, 20, 1, 99, 18, 0, 0, 0, /* version 57 */ - 19, 70, 30, 1, 64, 28, 0, 0, 0, - 27, 38, 32, 2, 25, 26, 0, 0, 0, - 38, 20, 30, 2, 18, 28, 0, 0, 0, - 14, 105, 20, 1, 113, 22, 1, 114, 22, /* version 58 */ - 17, 67, 30, 3, 92, 32, 0, 0, 0, - 30, 35, 30, 1, 41, 30, 0, 0, 0, - 36, 21, 32, 1, 26, 30, 1, 27, 30, - 11, 146, 28, 1, 146, 26, 0, 0, 0, /* version 59 */ - 20, 70, 30, 1, 60, 26, 0, 0, 0, - 29, 38, 32, 1, 24, 32, 0, 0, 0, - 40, 20, 30, 2, 17, 26, 0, 0, 0, - 3, 137, 26, 1, 136, 26, 10, 126, 24, /* version 60 */ - 22, 65, 28, 1, 75, 30, 0, 0, 0, - 30, 37, 32, 1, 51, 30, 0, 0, 0, - 42, 20, 30, 1, 21, 30, 0, 0, 0, - 12, 126, 24, 2, 118, 22, 1, 116, 22, /* version 61 */ - 19, 74, 32, 1, 74, 30, 1, 72, 28, - 30, 38, 32, 2, 29, 30, 0, 0, 0, - 39, 20, 32, 2, 37, 26, 1, 38, 26, - 12, 126, 24, 3, 136, 26, 0, 0, 0, /* version 62 */ - 21, 70, 30, 2, 65, 28, 0, 0, 0, - 34, 35, 30, 1, 44, 32, 0, 0, 0, - 42, 20, 30, 2, 19, 28, 2, 18, 28, - 12, 126, 24, 3, 117, 22, 1, 116, 22, /* version 63 */ - 25, 61, 26, 2, 62, 28, 0, 0, 0, - 34, 35, 30, 1, 40, 32, 1, 41, 32, - 45, 20, 30, 1, 20, 32, 1, 21, 32, - 15, 105, 20, 2, 115, 22, 2, 116, 22, /* version 64 */ - 25, 65, 28, 1, 72, 28, 0, 0, 0, - 18, 35, 30, 17, 37, 32, 1, 50, 32, - 42, 20, 30, 6, 19, 28, 1, 15, 28, - 19, 105, 20, 1, 101, 20, 0, 0, 0, /* version 65 */ - 33, 51, 22, 1, 65, 22, 0, 0, 0, - 40, 33, 28, 1, 28, 28, 0, 0, 0, - 49, 20, 30, 1, 18, 28, 0, 0, 0, - 18, 105, 20, 2, 117, 22, 0, 0, 0, /* version 66 */ - 26, 65, 28, 1, 80, 30, 0, 0, 0, - 35, 35, 30, 3, 35, 28, 1, 36, 28, - 52, 18, 28, 2, 38, 30, 0, 0, 0, - 26, 84, 16, 0, 0, 0, 0, 0, 0, /* version 67 */ - 26, 70, 30, 0, 0, 0, 0, 0, 0, - 45, 31, 26, 1, 9, 26, 0, 0, 0, - 52, 20, 30, 0, 0, 0, 0, 0, 0, - 16, 126, 24, 1, 114, 22, 1, 115, 22, /* version 68 */ - 23, 70, 30, 3, 65, 28, 1, 66, 28, - 40, 35, 30, 1, 43, 30, 0, 0, 0, - 46, 20, 30, 7, 19, 28, 1, 16, 28, - 19, 116, 22, 1, 105, 22, 0, 0, 0, /* version 69 */ - 20, 70, 30, 7, 66, 28, 1, 63, 28, - 40, 35, 30, 1, 42, 32, 1, 43, 32, - 54, 20, 30, 1, 19, 30, 0, 0, 0, - 17, 126, 24, 2, 115, 22, 0, 0, 0, /* version 70 */ - 24, 70, 30, 4, 74, 32, 0, 0, 0, - 48, 31, 26, 2, 18, 26, 0, 0, 0, - 54, 19, 28, 6, 15, 26, 1, 14, 26, - 29, 84, 16, 0, 0, 0, 0, 0, 0, /* version 71 */ - 29, 70, 30, 0, 0, 0, 0, 0, 0, - 6, 34, 30, 3, 36, 30, 38, 33, 28, - 58, 20, 30, 0, 0, 0, 0, 0, 0, - 16, 147, 28, 1, 149, 28, 0, 0, 0, /* version 72 */ - 31, 66, 28, 1, 37, 26, 0, 0, 0, - 48, 33, 28, 1, 23, 26, 0, 0, 0, - 53, 20, 30, 6, 19, 28, 1, 17, 28, - 20, 115, 22, 2, 134, 24, 0, 0, 0, /* verdion 73 */ - 29, 66, 28, 2, 56, 26, 2, 57, 26, - 45, 36, 30, 2, 15, 28, 0, 0, 0, - 59, 20, 30, 2, 21, 32, 0, 0, 0, - 17, 147, 28, 1, 134, 26, 0, 0, 0, /* version 74 */ - 26, 70, 30, 5, 75, 32, 0, 0, 0, - 47, 35, 30, 1, 48, 32, 0, 0, 0, - 64, 18, 28, 2, 33, 30, 1, 35, 30, - 22, 115, 22, 1, 133, 24, 0, 0, 0, /* version 75 */ - 33, 65, 28, 1, 74, 28, 0, 0, 0, - 43, 36, 30, 5, 27, 28, 1, 30, 28, - 57, 20, 30, 5, 21, 32, 1, 24, 32, - 18, 136, 26, 2, 142, 26, 0, 0, 0, /* version 76 */ - 33, 66, 28, 2, 49, 26, 0, 0, 0, - 48, 35, 30, 2, 38, 28, 0, 0, 0, - 64, 20, 30, 1, 20, 32, 0, 0, 0, - 19, 126, 24, 2, 135, 26, 1, 136, 26, /* version 77 */ - 32, 66, 28, 2, 55, 26, 2, 56, 26, - 49, 36, 30, 2, 18, 32, 0, 0, 0, - 65, 18, 28, 5, 27, 30, 1, 29, 30, - 20, 137, 26, 1, 130, 26, 0, 0, 0, /* version 78 */ - 30, 75, 32, 2, 71, 32, 0, 0, 0, - 46, 35, 30, 6, 39, 32, 0, 0, 0, - 3, 12, 30, 70, 19, 28, 0, 0, 0, - 20, 147, 28, 0, 0, 0, 0, 0, 0, /* version 79 */ - 35, 70, 30, 0, 0, 0, 0, 0, 0, - 49, 35, 30, 5, 35, 28, 0, 0, 0, - 70, 20, 30, 0, 0, 0, 0, 0, 0, - 21, 136, 26, 1, 155, 28, 0, 0, 0, /* version 80 */ - 34, 70, 30, 1, 64, 28, 1, 65, 28, - 54, 35, 30, 1, 45, 30, 0, 0, 0, - 68, 20, 30, 3, 18, 28, 1, 19, 28, - 19, 126, 24, 5, 115, 22, 1, 114, 22, /* version 81 */ - 33, 70, 30, 3, 65, 28, 1, 64, 28, - 52, 35, 30, 3, 41, 32, 1, 40, 32, - 67, 20, 30, 5, 21, 32, 1, 24, 32, - 2, 150, 28, 21, 136, 26, 0, 0, 0, /* version 82 */ - 32, 70, 30, 6, 65, 28, 0, 0, 0, - 52, 38, 32, 2, 27, 32, 0, 0, 0, - 73, 20, 30, 2, 22, 32, 0, 0, 0, - 21, 126, 24, 4, 136, 26, 0, 0, 0, /* version 83 */ - 30, 74, 32, 6, 73, 30, 0, 0, 0, - 54, 35, 30, 4, 40, 32, 0, 0, 0, - 75, 20, 30, 1, 20, 28, 0, 0, 0, - 30, 105, 20, 1, 114, 22, 0, 0, 0, /* version 84 */ - 3, 45, 22, 55, 47, 20, 0, 0, 0, - 2, 26, 26, 62, 33, 28, 0, 0, 0, - 79, 18, 28, 4, 33, 30, 0, 0, 0 +/* #blocks, k, 2t, #blocks, k, 2t, #blocks, k, 2t */ + 1, 21, 4, 0, 0, 0, 0, 0, 0, /* version 1 */ + 1, 17, 8, 0, 0, 0, 0, 0, 0, + 1, 13, 12, 0, 0, 0, 0, 0, 0, + 1, 9, 16, 0, 0, 0, 0, 0, 0, + 1, 31, 6, 0, 0, 0, 0, 0, 0, /* version 2 */ + 1, 25, 12, 0, 0, 0, 0, 0, 0, + 1, 19, 18, 0, 0, 0, 0, 0, 0, + 1, 15, 22, 0, 0, 0, 0, 0, 0, + 1, 42, 8, 0, 0, 0, 0, 0, 0, /* version 3 */ + 1, 34, 16, 0, 0, 0, 0, 0, 0, + 1, 26, 24, 0, 0, 0, 0, 0, 0, + 1, 20, 30, 0, 0, 0, 0, 0, 0, + 1, 46, 8, 0, 0, 0, 0, 0, 0, /* version 4 */ + 1, 38, 16, 0, 0, 0, 0, 0, 0, + 1, 30, 24, 0, 0, 0, 0, 0, 0, + 1, 22, 32, 0, 0, 0, 0, 0, 0, + 1, 57, 12, 0, 0, 0, 0, 0, 0, /* version 5 */ + 1, 49, 20, 0, 0, 0, 0, 0, 0, + 1, 37, 32, 0, 0, 0, 0, 0, 0, + 1, 14, 20, 1, 13, 22, 0, 0, 0, + 1, 70, 14, 0, 0, 0, 0, 0, 0, /* version 6 */ + 1, 58, 26, 0, 0, 0, 0, 0, 0, + 1, 24, 20, 1, 22, 18, 0, 0, 0, + 1, 16, 24, 1, 18, 26, 0, 0, 0, + 1, 84, 16, 0, 0, 0, 0, 0, 0, /* version 7 */ + 1, 70, 30, 0, 0, 0, 0, 0, 0, + 1, 26, 22, 1, 28, 24, 0, 0, 0, + 2, 14, 20, 1, 12, 20, 0, 0, 0, + 1, 99, 18, 0, 0, 0, 0, 0, 0, /* version 8 */ + 1, 40, 18, 1, 41, 18, 0, 0, 0, + 1, 31, 26, 1, 32, 28, 0, 0, 0, + 2, 16, 24, 1, 15, 22, 0, 0, 0, + 1, 114, 22, 0, 0, 0, 0, 0, 0, /* version 9 */ + 2, 48, 20, 0, 0, 0, 0, 0, 0, + 2, 24, 20, 1, 26, 22, 0, 0, 0, + 2, 18, 28, 1, 18, 26, 0, 0, 0, + 1, 131, 24, 0, 0, 0, 0, 0, 0, /* version 10 */ + 1, 52, 22, 1, 57, 24, 0, 0, 0, + 2, 27, 24, 1, 29, 24, 0, 0, 0, + 2, 21, 32, 1, 19, 30, 0, 0, 0, + 1, 135, 26, 0, 0, 0, 0, 0, 0, /* version 11 */ + 1, 56, 24, 1, 57, 24, 0, 0, 0, + 2, 28, 24, 1, 31, 26, 0, 0, 0, + 2, 22, 32, 1, 21, 32, 0, 0, 0, + 1, 153, 28, 0, 0, 0, 0, 0, 0, /* version 12 */ + 1, 62, 26, 1, 65, 28, 0, 0, 0, + 2, 32, 28, 1, 33, 28, 0, 0, 0, + 3, 17, 26, 1, 22, 30, 0, 0, 0, + 1, 86, 16, 1, 85, 16, 0, 0, 0, /* version 13 */ + 1, 71, 30, 1, 72, 30, 0, 0, 0, + 2, 37, 32, 1, 35, 30, 0, 0, 0, + 3, 20, 30, 1, 21, 32, 0, 0, 0, + 1, 94, 18, 1, 95, 18, 0, 0, 0, /* version 14 */ + 2, 51, 22, 1, 55, 24, 0, 0, 0, + 3, 30, 26, 1, 31, 26, 0, 0, 0, + 4, 18, 28, 1, 17, 24, 0, 0, 0, + 1, 104, 20, 1, 105, 20, 0, 0, 0, /* version 15 */ + 2, 57, 24, 1, 61, 26, 0, 0, 0, + 3, 33, 28, 1, 36, 30, 0, 0, 0, + 4, 20, 30, 1, 19, 30, 0, 0, 0, + 1, 115, 22, 1, 114, 22, 0, 0, 0, /* version 16 */ + 2, 65, 28, 1, 61, 26, 0, 0, 0, + 3, 38, 32, 1, 33, 30, 0, 0, 0, + 5, 19, 28, 1, 14, 24, 0, 0, 0, + 1, 126, 24, 1, 125, 24, 0, 0, 0, /* version 17 */ + 2, 70, 30, 1, 69, 30, 0, 0, 0, + 4, 33, 28, 1, 29, 26, 0, 0, 0, + 5, 20, 30, 1, 19, 30, 0, 0, 0, + 1, 136, 26, 1, 137, 26, 0, 0, 0, /* version 18 */ + 3, 56, 24, 1, 59, 26, 0, 0, 0, + 5, 35, 30, 0, 0, 0, 0, 0, 0, + 6, 18, 28, 1, 21, 28, 0, 0, 0, + 1, 148, 28, 1, 149, 28, 0, 0, 0, /* version 19 */ + 3, 61, 26, 1, 64, 28, 0, 0, 0, + 7, 24, 20, 1, 23, 22, 0, 0, 0, + 6, 20, 30, 1, 21, 32, 0, 0, 0, + 3, 107, 20, 0, 0, 0, 0, 0, 0, /* version 20 */ + 3, 65, 28, 1, 72, 30, 0, 0, 0, + 7, 26, 22, 1, 23, 22, 0, 0, 0, + 7, 19, 28, 1, 20, 32, 0, 0, 0, + 3, 115, 22, 0, 0, 0, 0, 0, 0, /* version 21 */ + 4, 56, 24, 1, 63, 28, 0, 0, 0, + 7, 28, 24, 1, 25, 22, 0, 0, 0, + 8, 18, 28, 1, 21, 22, 0, 0, 0, + 2, 116, 22, 1, 122, 24, 0, 0, 0, /* version 22 */ + 4, 56, 24, 1, 72, 30, 0, 0, 0, + 7, 28, 24, 1, 32, 26, 0, 0, 0, + 8, 18, 28, 1, 24, 30, 0, 0, 0, + 3, 127, 24, 0, 0, 0, 0, 0, 0, /* version 23 */ + 5, 51, 22, 1, 62, 26, 0, 0, 0, + 7, 30, 26, 1, 35, 26, 0, 0, 0, + 8, 20, 30, 1, 21, 32, 0, 0, 0, + 2, 135, 26, 1, 137, 26, 0, 0, 0, /* version 24 */ + 5, 56, 24, 1, 59, 26, 0, 0, 0, + 7, 33, 28, 1, 30, 28, 0, 0, 0, + 11, 16, 24, 1, 19, 26, 0, 0, 0, + 3, 105, 20, 1, 121, 22, 0, 0, 0, /* version 25 */ + 5, 61, 26, 1, 57, 26, 0, 0, 0, + 9, 28, 24, 1, 28, 22, 0, 0, 0, + 10, 19, 28, 1, 18, 30, 0, 0, 0, + 2, 157, 30, 1, 150, 28, 0, 0, 0, /* version 26 */ + 5, 65, 28, 1, 61, 26, 0, 0, 0, + 8, 33, 28, 1, 34, 30, 0, 0, 0, + 10, 19, 28, 2, 15, 26, 0, 0, 0, + 3, 126, 24, 1, 115, 22, 0, 0, 0, /* version 27 */ + 7, 51, 22, 1, 54, 22, 0, 0, 0, + 8, 35, 30, 1, 37, 30, 0, 0, 0, + 15, 15, 22, 1, 10, 22, 0, 0, 0, + 4, 105, 20, 1, 103, 20, 0, 0, 0, /* version 28 */ + 7, 56, 24, 1, 45, 18, 0, 0, 0, + 10, 31, 26, 1, 27, 26, 0, 0, 0, + 10, 17, 26, 3, 20, 28, 1, 21, 28, + 3, 139, 26, 1, 137, 28, 0, 0, 0, /* version 29 */ + 6, 66, 28, 1, 66, 30, 0, 0, 0, + 9, 36, 30, 1, 34, 32, 0, 0, 0, + 13, 19, 28, 1, 17, 32, 0, 0, 0, + 6, 84, 16, 1, 82, 16, 0, 0, 0, /* version 30 */ + 6, 70, 30, 1, 68, 30, 0, 0, 0, + 7, 35, 30, 3, 33, 28, 1, 32, 28, + 13, 20, 30, 1, 20, 28, 0, 0, 0, + 5, 105, 20, 1, 94, 18, 0, 0, 0, /* version 31 */ + 6, 74, 32, 1, 71, 30, 0, 0, 0, + 11, 33, 28, 1, 34, 32, 0, 0, 0, + 13, 19, 28, 3, 16, 26, 0, 0, 0, + 4, 127, 24, 1, 126, 24, 0, 0, 0, /* version 32 */ + 7, 66, 28, 1, 66, 30, 0, 0, 0, + 12, 30, 24, 1, 24, 28, 1, 24, 30, + 15, 19, 28, 1, 17, 32, 0, 0, 0, + 7, 84, 16, 1, 78, 16, 0, 0, 0, /* version 33 */ + 7, 70, 30, 1, 66, 28, 0, 0, 0, + 12, 33, 28, 1, 32, 30, 0, 0, 0, + 14, 21, 32, 1, 24, 28, 0, 0, 0, + 5, 117, 22, 1, 117, 24, 0, 0, 0, /* version 34 */ + 8, 66, 28, 1, 58, 26, 0, 0, 0, + 11, 38, 32, 1, 34, 32, 0, 0, 0, + 15, 20, 30, 2, 17, 26, 0, 0, 0, + 4, 148, 28, 1, 146, 28, 0, 0, 0, /* version 35 */ + 8, 68, 30, 1, 70, 24, 0, 0, 0, + 10, 36, 32, 3, 38, 28, 0, 0, 0, + 16, 19, 28, 3, 16, 26, 0, 0, 0, + 4, 126, 24, 2, 135, 26, 0, 0, 0, /* version 36 */ + 8, 70, 28, 2, 43, 26, 0, 0, 0, + 13, 32, 28, 2, 41, 30, 0, 0, 0, + 17, 19, 28, 3, 15, 26, 0, 0, 0, + 5, 136, 26, 1, 132, 24, 0, 0, 0, /* version 37 */ + 5, 67, 30, 4, 68, 28, 1, 69, 28, + 14, 35, 30, 1, 32, 24, 0, 0, 0, + 18, 18, 26, 3, 16, 28, 1, 14, 28, + 3, 142, 26, 3, 141, 28, 0, 0, 0, /* version 38 */ + 8, 70, 30, 1, 73, 32, 1, 74, 32, + 12, 34, 30, 3, 34, 26, 1, 35, 28, + 18, 21, 32, 1, 27, 30, 0, 0, 0, + 5, 116, 22, 2, 103, 20, 1, 102, 20, /* version 39 */ + 9, 74, 32, 1, 74, 30, 0, 0, 0, + 14, 34, 28, 2, 32, 32, 1, 32, 30, + 19, 21, 32, 1, 25, 26, 0, 0, 0, + 7, 116, 22, 1, 117, 22, 0, 0, 0, /* version 40 */ + 11, 65, 28, 1, 58, 24, 0, 0, 0, + 15, 38, 32, 1, 27, 28, 0, 0, 0, + 20, 20, 30, 1, 20, 32, 1, 21, 32, + 6, 136, 26, 1, 130, 24, 0, 0, 0, /* version 41 */ + 11, 66, 28, 1, 62, 30, 0, 0, 0, + 14, 34, 28, 3, 34, 32, 1, 30, 30, + 18, 20, 30, 3, 20, 28, 2, 15, 26, + 5, 105, 20, 2, 115, 22, 2, 116, 22, /* version 42 */ + 10, 75, 32, 1, 73, 32, 0, 0, 0, + 16, 38, 32, 1, 27, 28, 0, 0, 0, + 22, 19, 28, 2, 16, 30, 1, 19, 30, + 6, 147, 28, 1, 146, 28, 0, 0, 0, /* version 43 */ + 11, 66, 28, 2, 65, 30, 0, 0, 0, + 18, 33, 28, 2, 33, 30, 0, 0, 0, + 22, 21, 32, 1, 28, 30, 0, 0, 0, + 6, 116, 22, 3, 125, 24, 0, 0, 0, /* version 44 */ + 11, 75, 32, 1, 68, 30, 0, 0, 0, + 13, 35, 28, 6, 34, 32, 1, 30, 30, + 23, 21, 32, 1, 26, 30, 0, 0, 0, + 7, 105, 20, 4, 95, 18, 0, 0, 0, /* version 45 */ + 12, 67, 28, 1, 63, 30, 1, 62, 32, + 21, 31, 26, 2, 33, 32, 0, 0, 0, + 23, 21, 32, 2, 24, 30, 0, 0, 0, + 10, 116, 22, 0, 0, 0, 0, 0, 0, /* version 46 */ + 12, 74, 32, 1, 78, 30, 0, 0, 0, + 18, 37, 32, 1, 39, 30, 1, 41, 28, + 25, 21, 32, 1, 27, 28, 0, 0, 0, + 5, 126, 24, 4, 115, 22, 1, 114, 22, /* version 47 */ + 12, 67, 28, 2, 66, 32, 1, 68, 30, + 21, 35, 30, 1, 39, 30, 0, 0, 0, + 26, 21, 32, 1, 28, 28, 0, 0, 0, + 9, 126, 24, 1, 117, 22, 0, 0, 0, /* version 48 */ + 13, 75, 32, 1, 68, 30, 0, 0, 0, + 20, 35, 30, 3, 35, 28, 0, 0, 0, + 27, 21, 32, 1, 28, 30, 0, 0, 0, + 9, 126, 24, 1, 137, 26, 0, 0, 0, /* version 49 */ + 13, 71, 30, 2, 68, 32, 0, 0, 0, + 20, 37, 32, 1, 39, 28, 1, 38, 28, + 24, 20, 32, 5, 25, 28, 0, 0, 0, + 8, 147, 28, 1, 141, 28, 0, 0, 0, /* version 50 */ + 10, 73, 32, 4, 74, 30, 1, 73, 30, + 16, 36, 32, 6, 39, 30, 1, 37, 30, + 27, 21, 32, 3, 20, 26, 0, 0, 0, + 9, 137, 26, 1, 135, 26, 0, 0, 0, /* version 51 */ + 12, 70, 30, 4, 75, 32, 0, 0, 0, + 24, 35, 30, 1, 40, 28, 0, 0, 0, + 23, 20, 32, 8, 24, 30, 0, 0, 0, + 14, 95, 18, 1, 86, 18, 0, 0, 0, /* version 52 */ + 13, 73, 32, 3, 77, 30, 0, 0, 0, + 24, 35, 30, 2, 35, 28, 0, 0, 0, + 26, 21, 32, 5, 21, 30, 1, 23, 30, + 9, 147, 28, 1, 142, 28, 0, 0, 0, /* version 53 */ + 10, 73, 30, 6, 70, 32, 1, 71, 32, + 25, 35, 30, 2, 34, 26, 0, 0, 0, + 29, 21, 32, 4, 22, 30, 0, 0, 0, + 11, 126, 24, 1, 131, 24, 0, 0, 0, /* version 54 */ + 16, 74, 32, 1, 79, 30, 0, 0, 0, + 25, 38, 32, 1, 25, 30, 0, 0, 0, + 33, 21, 32, 1, 28, 28, 0, 0, 0, + 14, 105, 20, 1, 99, 18, 0, 0, 0, /* version 55 */ + 19, 65, 28, 1, 72, 28, 0, 0, 0, + 24, 37, 32, 2, 40, 30, 1, 41, 30, + 31, 21, 32, 4, 24, 32, 0, 0, 0, + 10, 147, 28, 1, 151, 28, 0, 0, 0, /* version 56 */ + 15, 71, 30, 3, 71, 32, 1, 73, 32, + 24, 37, 32, 3, 38, 30, 1, 39, 30, + 36, 19, 30, 3, 29, 26, 0, 0, 0, + 15, 105, 20, 1, 99, 18, 0, 0, 0, /* version 57 */ + 19, 70, 30, 1, 64, 28, 0, 0, 0, + 27, 38, 32, 2, 25, 26, 0, 0, 0, + 38, 20, 30, 2, 18, 28, 0, 0, 0, + 14, 105, 20, 1, 113, 22, 1, 114, 22, /* version 58 */ + 17, 67, 30, 3, 92, 32, 0, 0, 0, + 30, 35, 30, 1, 41, 30, 0, 0, 0, + 36, 21, 32, 1, 26, 30, 1, 27, 30, + 11, 146, 28, 1, 146, 26, 0, 0, 0, /* version 59 */ + 20, 70, 30, 1, 60, 26, 0, 0, 0, + 29, 38, 32, 1, 24, 32, 0, 0, 0, + 40, 20, 30, 2, 17, 26, 0, 0, 0, + 3, 137, 26, 1, 136, 26, 10, 126, 24, /* version 60 */ + 22, 65, 28, 1, 75, 30, 0, 0, 0, + 30, 37, 32, 1, 51, 30, 0, 0, 0, + 42, 20, 30, 1, 21, 30, 0, 0, 0, + 12, 126, 24, 2, 118, 22, 1, 116, 22, /* version 61 */ + 19, 74, 32, 1, 74, 30, 1, 72, 28, + 30, 38, 32, 2, 29, 30, 0, 0, 0, + 39, 20, 32, 2, 37, 26, 1, 38, 26, + 12, 126, 24, 3, 136, 26, 0, 0, 0, /* version 62 */ + 21, 70, 30, 2, 65, 28, 0, 0, 0, + 34, 35, 30, 1, 44, 32, 0, 0, 0, + 42, 20, 30, 2, 19, 28, 2, 18, 28, + 12, 126, 24, 3, 117, 22, 1, 116, 22, /* version 63 */ + 25, 61, 26, 2, 62, 28, 0, 0, 0, + 34, 35, 30, 1, 40, 32, 1, 41, 32, + 45, 20, 30, 1, 20, 32, 1, 21, 32, + 15, 105, 20, 2, 115, 22, 2, 116, 22, /* version 64 */ + 25, 65, 28, 1, 72, 28, 0, 0, 0, + 18, 35, 30, 17, 37, 32, 1, 50, 32, + 42, 20, 30, 6, 19, 28, 1, 15, 28, + 19, 105, 20, 1, 101, 20, 0, 0, 0, /* version 65 */ + 33, 51, 22, 1, 65, 22, 0, 0, 0, + 40, 33, 28, 1, 28, 28, 0, 0, 0, + 49, 20, 30, 1, 18, 28, 0, 0, 0, + 18, 105, 20, 2, 117, 22, 0, 0, 0, /* version 66 */ + 26, 65, 28, 1, 80, 30, 0, 0, 0, + 35, 35, 30, 3, 35, 28, 1, 36, 28, + 52, 18, 28, 2, 38, 30, 0, 0, 0, + 26, 84, 16, 0, 0, 0, 0, 0, 0, /* version 67 */ + 26, 70, 30, 0, 0, 0, 0, 0, 0, + 45, 31, 26, 1, 9, 26, 0, 0, 0, + 52, 20, 30, 0, 0, 0, 0, 0, 0, + 16, 126, 24, 1, 114, 22, 1, 115, 22, /* version 68 */ + 23, 70, 30, 3, 65, 28, 1, 66, 28, + 40, 35, 30, 1, 43, 30, 0, 0, 0, + 46, 20, 30, 7, 19, 28, 1, 16, 28, + 19, 116, 22, 1, 105, 22, 0, 0, 0, /* version 69 */ + 20, 70, 30, 7, 66, 28, 1, 63, 28, + 40, 35, 30, 1, 42, 32, 1, 43, 32, + 54, 20, 30, 1, 19, 30, 0, 0, 0, + 17, 126, 24, 2, 115, 22, 0, 0, 0, /* version 70 */ + 24, 70, 30, 4, 74, 32, 0, 0, 0, + 48, 31, 26, 2, 18, 26, 0, 0, 0, + 54, 19, 28, 6, 15, 26, 1, 14, 26, + 29, 84, 16, 0, 0, 0, 0, 0, 0, /* version 71 */ + 29, 70, 30, 0, 0, 0, 0, 0, 0, + 6, 34, 30, 3, 36, 30, 38, 33, 28, + 58, 20, 30, 0, 0, 0, 0, 0, 0, + 16, 147, 28, 1, 149, 28, 0, 0, 0, /* version 72 */ + 31, 66, 28, 1, 37, 26, 0, 0, 0, + 48, 33, 28, 1, 23, 26, 0, 0, 0, + 53, 20, 30, 6, 19, 28, 1, 17, 28, + 20, 115, 22, 2, 134, 24, 0, 0, 0, /* version 73 */ + 29, 66, 28, 2, 56, 26, 2, 57, 26, + 45, 36, 30, 2, 15, 28, 0, 0, 0, + 59, 20, 30, 2, 21, 32, 0, 0, 0, + 17, 147, 28, 1, 134, 26, 0, 0, 0, /* version 74 */ + 26, 70, 30, 5, 75, 32, 0, 0, 0, + 47, 35, 30, 1, 48, 32, 0, 0, 0, + 64, 18, 28, 2, 33, 30, 1, 35, 30, + 22, 115, 22, 1, 133, 24, 0, 0, 0, /* version 75 */ + 33, 65, 28, 1, 74, 28, 0, 0, 0, + 43, 36, 30, 5, 27, 28, 1, 30, 28, + 57, 20, 30, 5, 21, 32, 1, 24, 32, + 18, 136, 26, 2, 142, 26, 0, 0, 0, /* version 76 */ + 33, 66, 28, 2, 49, 26, 0, 0, 0, + 48, 35, 30, 2, 38, 28, 0, 0, 0, + 64, 20, 30, 1, 20, 32, 0, 0, 0, + 19, 126, 24, 2, 135, 26, 1, 136, 26, /* version 77 */ + 32, 66, 28, 2, 55, 26, 2, 56, 26, + 49, 36, 30, 2, 18, 32, 0, 0, 0, + 65, 18, 28, 5, 27, 30, 1, 29, 30, + 20, 137, 26, 1, 130, 26, 0, 0, 0, /* version 78 */ + 30, 75, 32, 2, 71, 32, 0, 0, 0, + 46, 35, 30, 6, 39, 32, 0, 0, 0, + 3, 12, 30, 70, 19, 28, 0, 0, 0, + 20, 147, 28, 0, 0, 0, 0, 0, 0, /* version 79 */ + 35, 70, 30, 0, 0, 0, 0, 0, 0, + 49, 35, 30, 5, 35, 28, 0, 0, 0, + 70, 20, 30, 0, 0, 0, 0, 0, 0, + 21, 136, 26, 1, 155, 28, 0, 0, 0, /* version 80 */ + 34, 70, 30, 1, 64, 28, 1, 65, 28, + 54, 35, 30, 1, 45, 30, 0, 0, 0, + 68, 20, 30, 3, 18, 28, 1, 19, 28, + 19, 126, 24, 5, 115, 22, 1, 114, 22, /* version 81 */ + 33, 70, 30, 3, 65, 28, 1, 64, 28, + 52, 35, 30, 3, 41, 32, 1, 40, 32, + 67, 20, 30, 5, 21, 32, 1, 24, 32, + 2, 150, 28, 21, 136, 26, 0, 0, 0, /* version 82 */ + 32, 70, 30, 6, 65, 28, 0, 0, 0, + 52, 38, 32, 2, 27, 32, 0, 0, 0, + 73, 20, 30, 2, 22, 32, 0, 0, 0, + 21, 126, 24, 4, 136, 26, 0, 0, 0, /* version 83 */ + 30, 74, 32, 6, 73, 30, 0, 0, 0, + 54, 35, 30, 4, 40, 32, 0, 0, 0, + 75, 20, 30, 1, 20, 28, 0, 0, 0, + 30, 105, 20, 1, 114, 22, 0, 0, 0, /* version 84 */ + 3, 45, 22, 55, 47, 20, 0, 0, 0, + 2, 26, 26, 62, 33, 28, 0, 0, 0, + 79, 18, 28, 4, 33, 30, 0, 0, 0 }; /* vim: set ts=4 sw=4 et : */ diff --git a/backend/imail.c b/backend/imail.c index 020bf039..146d62e0 100644 --- a/backend/imail.c +++ b/backend/imail.c @@ -259,12 +259,11 @@ INTERNAL int usps_imail(struct zint_symbol *symbol, unsigned char source[], int int zip_len, len; if (length > 32) { - strcpy(symbol->errtxt, "450: Input too long (32 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 450, "Input length %d too long (maximum 32)", length); } - if (!is_sane(SODIUM_MNS_F, source, length)) { - strcpy(symbol->errtxt, "451: Invalid character in data (digits and \"-\" only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(SODIUM_MNS_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 451, + "Invalid character at position %d in input (digits and \"-\" only)", i); } /* separate the tracking code from the routing code */ @@ -296,18 +295,18 @@ INTERNAL int usps_imail(struct zint_symbol *symbol, unsigned char source[], int } if (strlen(tracker) != 20) { - strcpy(symbol->errtxt, "452: Invalid length for tracking code (20 characters required)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 452, + "Invalid length for tracking code (20 characters required)"); } if (tracker[1] > '4') { - strcpy(symbol->errtxt, "454: Barcode Identifier (second character) out of range (0 to 4)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 454, + "Barcode Identifier (second character) out of range (0 to 4)"); } zip_len = (int) strlen(zip); if (zip_len != 0 && zip_len != 5 && zip_len != 9 && zip_len != 11) { - strcpy(symbol->errtxt, "453: Invalid length for ZIP code (5, 9 or 11 characters required)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 453, + "Invalid length for ZIP code (5, 9 or 11 characters required)"); } /* *** Step 1 - Conversion of Data Fields into Binary Data *** */ diff --git a/backend/library.c b/backend/library.c index 65cab829..97ea9ac0 100644 --- a/backend/library.c +++ b/backend/library.c @@ -243,12 +243,12 @@ INTERNAL int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Prefix error message with Error/Warning */ -static int error_tag(struct zint_symbol *symbol, int error_number, const char *error_string) { +static int error_tag(int error_number, struct zint_symbol *symbol, const int err_id, const char *error_string) { if (error_number != 0) { - const char *const error_arg = error_string ? error_string : symbol->errtxt; - char error_buffer[100]; - + if (error_string) { + errtxt(0, symbol, err_id, error_string); + } if (error_number < ZINT_ERROR && symbol->warn_level == WARN_FAIL_ALL) { /* Convert to error equivalent */ if (error_number == ZINT_WARN_NONCOMPLIANT) { @@ -265,19 +265,19 @@ static int error_tag(struct zint_symbol *symbol, int error_number, const char *e } } if (error_number >= ZINT_ERROR) { - sprintf(error_buffer, "Error %.93s", error_arg); /* Truncate if too long */ + errtxt_adj(0, symbol, "Error %s", NULL); } else { - sprintf(error_buffer, "Warning %.91s", error_arg); /* Truncate if too long */ + errtxt_adj(0, symbol, "Warning %s", NULL); } - strcpy(symbol->errtxt, error_buffer); } return error_number; } #ifdef ZINT_TEST /* Wrapper for direct testing */ -INTERNAL int error_tag_test(struct zint_symbol *symbol, int error_number, const char *error_string) { - return error_tag(symbol, error_number, error_string); +INTERNAL int error_tag_test(int error_number, struct zint_symbol *symbol, const int err_id, + const char *error_string) { + return error_tag(error_number, symbol, err_id, error_string); } #endif @@ -298,8 +298,7 @@ static int dump_plot(struct zint_symbol *symbol) { f = fopen(symbol->outfile, "w"); #endif if (!f) { - strcpy(symbol->errtxt, "201: Could not open output file"); - return ZINT_ERROR_FILE_ACCESS; + return errtxt(ZINT_ERROR_FILE_ACCESS, symbol, 201, "Could not open output file"); } } @@ -336,7 +335,7 @@ static int dump_plot(struct zint_symbol *symbol) { } if (ferror(f)) { - sprintf(symbol->errtxt, "795: Incomplete write to output (%d: %.30s)", errno, strerror(errno)); + errtxtf(0, symbol, 795, "Incomplete write to output (%1$d: %2$s)", errno, strerror(errno)); if (!output_to_stdout) { (void) fclose(f); } @@ -345,13 +344,13 @@ static int dump_plot(struct zint_symbol *symbol) { if (output_to_stdout) { if (fflush(f) != 0) { - sprintf(symbol->errtxt, "796: Incomplete flush to output (%d: %.30s)", errno, strerror(errno)); - return ZINT_ERROR_FILE_WRITE; + return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 796, "Incomplete flush to output (%1$d: %2$s)", + errno, strerror(errno)); } } else { if (fclose(f) != 0) { - sprintf(symbol->errtxt, "792: Failure on closing output file (%d: %.30s)", errno, strerror(errno)); - return ZINT_ERROR_FILE_WRITE; + return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 792, "Failure on closing output file (%1$d: %2$s)", + errno, strerror(errno)); } } @@ -373,13 +372,13 @@ static int hibc(struct zint_symbol *symbol, struct zint_seg segs[], const int se /* without "+" and check: max 110 characters in HIBC 2.6 */ if (length > 110) { - strcpy(symbol->errtxt, "202: Data too long for HIBC LIC (110 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 202, "Input length %d too long for HIBC LIC (maximum 110)", + length); } to_upper(source, length); - if (!is_sane_lookup(TECHNETIUM, sizeof(TECHNETIUM) - 1, source, length, posns)) { - strcpy(symbol->errtxt, "203: Invalid character in data (alphanumerics, space and \"-.$/+%\" only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane_lookup(TECHNETIUM, sizeof(TECHNETIUM) - 1, source, length, posns))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 203, + "Invalid character at position %d in input (alphanumerics, space and \"-.$/+%%\" only)", i); } counter = 41; @@ -657,11 +656,10 @@ static int reduced_charset(struct zint_symbol *symbol, struct zint_seg segs[], c &local_segs[i].length); if (error_number != 0) { if (local_segs[i].eci) { - sprintf(symbol->errtxt, "244: Invalid character in input data for ECI %d", local_segs[i].eci); - } else { - strcpy(symbol->errtxt, "204: Invalid character in input data (ISO/IEC 8859-1 only)"); + return errtxtf(error_number, symbol, 244, "Invalid character in input for ECI '%d'", + local_segs[i].eci); } - return error_number; + return errtxt(error_number, symbol, 204, "Invalid character in input (ISO/IEC 8859-1 only)"); } local_segs[i].source = preprocessed; preprocessed += local_segs[i].length + 1; @@ -714,8 +712,7 @@ static int esc_base(struct zint_symbol *symbol, const unsigned char *input_strin int val = -1; if (in_posn + min_len > length) { - sprintf(symbol->errtxt, "232: Incomplete '\\%c' escape sequence in input data", base); - return -1; + return errtxtf(-1, symbol, 232, "Incomplete '\\%c' escape sequence in input", base); } c1 = ctoi(input_string[in_posn]); c2 = ctoi(input_string[in_posn + 1]); @@ -736,16 +733,14 @@ static int esc_base(struct zint_symbol *symbol, const unsigned char *input_strin } if (val == -1) { - sprintf(symbol->errtxt, "233: Invalid character in escape sequence '\\%c%.*s' in input data (%s only)", - base, base == 'x' ? 2 : 3, input_string + in_posn, - base == 'd' ? "decimal" : base == 'o' ? "octal" : "hexadecimal"); - return -1; + return errtxtf(-1, symbol, 238, "Invalid character in escape sequence '%2$.*1$s' in input (%3$s only)", + base == 'x' ? 4 : 5, input_string + in_posn - 2, + base == 'd' ? "decimal" : base == 'o' ? "octal" : "hexadecimal"); } if (val > 255) { assert(base != 'x'); - sprintf(symbol->errtxt, "237: Value of escape sequence '\\%c%.3s' in input data out of range (000-%s)", - base, input_string + in_posn, base == 'd' ? "255" : "377"); - return -1; + return errtxtf(-1, symbol, 237, "Value of escape sequence '%1$.5s' in input out of range (000 to %2$s)", + input_string + in_posn - 2, base == 'd' ? "255" : "377"); } return val; @@ -762,14 +757,13 @@ static int escape_char_process(struct zint_symbol *symbol, const unsigned char * unsigned char ch; int val; int i; - unsigned long unicode; + unsigned int unicode; const int extra_escape_mode = (symbol->input_mode & EXTRA_ESCAPE_MODE) && symbol->symbology == BARCODE_CODE128; do { if (input_string[in_posn] == '\\') { if (in_posn + 1 >= length) { - strcpy(symbol->errtxt, "236: Incomplete escape character in input data"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 236, "Incomplete escape character in input"); } ch = input_string[in_posn + 1]; /* NOTE: if add escape character, must also update regex in "frontend_qt/datawindow.php" */ @@ -792,8 +786,8 @@ static int escape_char_process(struct zint_symbol *symbol, const unsigned char * break; case '^': /* CODE128 specific */ if (!extra_escape_mode) { - strcpy(symbol->errtxt, "798: Escape '\\^' only valid for Code 128 in extra escape mode"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 798, + "Escape '\\^' only valid for Code 128 in extra escape mode"); } /* Pass thru unaltered */ if (escaped_string) { @@ -824,16 +818,15 @@ static int escape_char_process(struct zint_symbol *symbol, const unsigned char * case 'u': case 'U': if (in_posn + 6 > length || (ch == 'U' && in_posn + 8 > length)) { - sprintf(symbol->errtxt, "209: Incomplete '\\%c' escape sequence in input data", ch); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 209, + "Incomplete '\\%c' escape sequence in input", ch); } unicode = 0; for (i = 0; i < 6; i++) { if ((val = ctoi(input_string[in_posn + i + 2])) == -1) { - sprintf(symbol->errtxt, - "211: Invalid character for '\\%c' escape sequence in input data (hexadecimal only)", - ch); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 211, + "Invalid character for '\\%c' escape sequence in input (hexadecimal only)", + ch); } unicode = (unicode << 4) | val; if (i == 3 && ch == 'u') { @@ -842,9 +835,9 @@ static int escape_char_process(struct zint_symbol *symbol, const unsigned char * } /* Exclude reversed BOM and surrogates and out-of-range */ if (unicode == 0xfffe || (unicode >= 0xd800 && unicode < 0xe000) || unicode > 0x10ffff) { - sprintf(symbol->errtxt, "246: Value of escape sequence '%.*s' in input data out of range", - ch == 'u' ? 6 : 8, input_string + in_posn); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 246, + "Value of escape sequence '%.*s' in input out of range", + ch == 'u' ? 6 : 8, input_string + in_posn); } if (unicode < 0x80) { if (escaped_string) escaped_string[out_posn] = (unsigned char) unicode; @@ -876,8 +869,8 @@ static int escape_char_process(struct zint_symbol *symbol, const unsigned char * in_posn += 6 + (ch == 'U') * 2; break; default: - sprintf(symbol->errtxt, "234: Unrecognised escape character '\\%c' in input data", ch); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 234, + "Unrecognised escape character '\\%c' in input", ch); break; } } else { @@ -941,17 +934,17 @@ static int map_invalid_symbology(struct zint_symbol *symbol) { if (symbol->symbology == 19) { /* Has specific error message */ - warn_number = error_tag(symbol, ZINT_WARN_INVALID_OPTION, "207: Codabar 18 not supported"); + warn_number = error_tag(ZINT_WARN_INVALID_OPTION, symbol, 207, "Codabar 18 not supported"); if (warn_number >= ZINT_ERROR) { return warn_number; } symbol->symbology = BARCODE_CODABAR; } else if (symbol->symbology == 27) { /* Not mapped */ - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "208: UPCD1 not supported"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 208, "UPCD1 not supported"); } else if (symbol->symbology <= 0 || symbol->symbology > LIB_ID_MAP_LAST || id_map[symbol->symbology] == 0) { - warn_number = error_tag(symbol, ZINT_WARN_INVALID_OPTION, "206: Symbology out of range"); + warn_number = error_tag(ZINT_WARN_INVALID_OPTION, symbol, 206, "Symbology out of range"); if (warn_number >= ZINT_ERROR) { return warn_number; } @@ -962,7 +955,7 @@ static int map_invalid_symbology(struct zint_symbol *symbol) { if (symbol->symbology == orig_symbology) { /* Should never happen */ assert(0); /* Not reached */ - return error_tag(symbol, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error"); + return error_tag(ZINT_ERROR_ENCODING_PROBLEM, symbol, 0, "Internal error"); } return warn_number; @@ -994,16 +987,16 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ if (!symbol) return ZINT_ERROR_INVALID_DATA; if (segs == NULL) { - return error_tag(symbol, ZINT_ERROR_INVALID_DATA, "200: Input segments NULL"); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, 200, "Input segments NULL"); } /* `seg_count` zero dealt with via `total_len` zero below */ if (seg_count > ZINT_MAX_SEG_COUNT) { - return error_tag(symbol, ZINT_ERROR_INVALID_DATA, "771: Too many input segments (max 256)"); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, 771, "Too many input segments (maximum 256)"); } if ((symbol->input_mode & 0x07) > 2) { symbol->input_mode = DATA_MODE; /* Reset completely */ - warn_number = error_tag(symbol, ZINT_WARN_INVALID_OPTION, "212: Invalid input mode - reset to DATA_MODE"); + warn_number = error_tag(ZINT_WARN_INVALID_OPTION, symbol, 212, "Invalid input mode - reset to DATA_MODE"); if (warn_number >= ZINT_ERROR) { return warn_number; } @@ -1023,8 +1016,8 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ for (i = 0; i < seg_count; i++) { local_segs[i] = segs[i]; if (local_segs[i].source == NULL) { - sprintf(symbol->errtxt, "772: Input segment %d source NULL", i); - return error_tag(symbol, ZINT_ERROR_INVALID_DATA, NULL); + errtxtf(0, symbol, 772, "Input segment %d source NULL", i); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, -1, NULL); } if (local_segs[i].length <= 0) { local_segs[i].length = (int) ustrlen(local_segs[i].source); @@ -1033,36 +1026,37 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ if (i == 0) { if (is_composite(symbol->symbology) && ((symbol->input_mode & 0x07) == GS1_MODE || check_force_gs1(symbol->symbology))) { - strcpy(symbol->errtxt, "779: No composite data in 2D component"); + errtxt(0, symbol, 779, "No composite data (2D component)"); + } else if (supports_eci(symbol->symbology)) { + errtxt(0, symbol, 228, "No input data (segment 0 empty)"); } else { - sprintf(symbol->errtxt, "778: No input data%s", - supports_eci(symbol->symbology) ? " (segment 0 empty)" : ""); + errtxt(0, symbol, 778, "No input data"); } } else { - sprintf(symbol->errtxt, "773: Input segment %d empty", i); + errtxtf(0, symbol, 773, "Input segment %d empty", i); } - return error_tag(symbol, ZINT_ERROR_INVALID_DATA, NULL); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, -1, NULL); } if (symbol->input_mode & ESCAPE_MODE) { /* Calculate de-escaped length for check against ZINT_MAX_DATA_LEN */ int escaped_len = local_segs[i].length; error_number = escape_char_process(symbol, local_segs[i].source, &escaped_len, NULL /*escaped_string*/); if (error_number != 0) { /* Only returns errors, not warnings */ - return error_tag(symbol, error_number, NULL); + return error_tag(error_number, symbol, -1, NULL); } if (escaped_len > ZINT_MAX_DATA_LEN) { - return error_tag(symbol, ZINT_ERROR_TOO_LONG, "797: Input data too long"); + return error_tag(ZINT_ERROR_TOO_LONG, symbol, 797, "Input too long"); } total_len += escaped_len; } else { if (local_segs[i].length > ZINT_MAX_DATA_LEN) { - return error_tag(symbol, ZINT_ERROR_TOO_LONG, "777: Input data too long"); + return error_tag(ZINT_ERROR_TOO_LONG, symbol, 777, "Input too long"); } total_len += local_segs[i].length; } } if (total_len == 0) { - return error_tag(symbol, ZINT_ERROR_INVALID_DATA, "205: No input data"); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, 205, "No input data"); } if (symbol->debug & ZINT_DEBUG_PRINT) { @@ -1085,15 +1079,15 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ } if (total_len > ZINT_MAX_DATA_LEN) { - return error_tag(symbol, ZINT_ERROR_TOO_LONG, "243: Input data too long"); + return error_tag(ZINT_ERROR_TOO_LONG, symbol, 243, "Input too long"); } /* Reconcile symbol ECI and first segment ECI if both set */ if (symbol->eci != local_segs[0].eci) { if (symbol->eci && local_segs[0].eci) { - sprintf(symbol->errtxt, "774: Symbol ECI %d must match segment zero ECI %d", symbol->eci, - local_segs[0].eci); - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, NULL); + errtxtf(0, symbol, 774, "Symbol ECI '%1$d' must match segment zero ECI '%2$d'", + symbol->eci, local_segs[0].eci); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, -1, NULL); } if (symbol->eci) { local_segs[0].eci = symbol->eci; @@ -1103,19 +1097,20 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ } if (seg_count > 1 && !supports_eci(symbol->symbology)) { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "775: Symbology does not support multiple segments"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 775, "Symbology does not support multiple segments"); } /* Check ECI(s) */ for (i = 0; i < seg_count; i++) { if (local_segs[i].eci) { if (!supports_eci(symbol->symbology)) { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "217: Symbology does not support ECI switching"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 217, "Symbology does not support ECI switching"); } if (local_segs[i].eci < 0 || local_segs[i].eci == 1 || local_segs[i].eci == 2 || local_segs[i].eci == 14 || local_segs[i].eci == 19 || local_segs[i].eci > 999999) { - sprintf(symbol->errtxt, "218: Invalid ECI code %d", local_segs[i].eci); - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, NULL); + errtxtf(0, symbol, 218, "ECI code '%d' out of range (0 to 999999, excluding 1, 2, 14 and 19)", + local_segs[i].eci); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, -1, NULL); } } else { have_zero_eci = 1; @@ -1124,52 +1119,52 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ /* Check other symbol fields */ if ((symbol->scale < 0.01f) || (symbol->scale > 200.0f)) { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "227: Scale out of range (0.01 to 200)"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 227, "Scale out of range (0.01 to 200)"); } if ((symbol->dot_size < 0.01f) || (symbol->dot_size > 20.0f)) { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "221: Dot size out of range (0.01 to 20)"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 221, "Dot size out of range (0.01 to 20)"); } if ((symbol->height < 0.0f) || (symbol->height > 2000.0f)) { /* Allow for 44 row CODABLOCKF at 45X each */ - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "765: Height out of range (0 to 2000)"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 765, "Height out of range (0 to 2000)"); } if ((symbol->guard_descent < 0.0f) || (symbol->guard_descent > 50.0f)) { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "769: Guard bar descent out of range (0 to 50)"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 769, "Guard bar descent out of range (0 to 50)"); } if ((symbol->text_gap < -5.0f) || (symbol->text_gap > 10.0f)) { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "219: Text gap out of range (-5 to 10)"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 219, "Text gap out of range (-5 to 10)"); } if ((symbol->whitespace_width < 0) || (symbol->whitespace_width > 100)) { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "766: Whitespace width out of range (0 to 100)"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 766, "Whitespace width out of range (0 to 100)"); } if ((symbol->whitespace_height < 0) || (symbol->whitespace_height > 100)) { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "767: Whitespace height out of range (0 to 100)"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 767, "Whitespace height out of range (0 to 100)"); } if ((symbol->border_width < 0) || (symbol->border_width > 100)) { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "768: Border width out of range (0 to 100)"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 768, "Border width out of range (0 to 100)"); } if (symbol->rows >= 200) { /* Check for stacking too many symbols */ - return error_tag(symbol, ZINT_ERROR_TOO_LONG, "770: Too many stacked symbols"); + return error_tag(ZINT_ERROR_TOO_LONG, symbol, 770, "Too many stacked symbols"); } if (symbol->rows < 0) { /* Silently defend against out-of-bounds access */ symbol->rows = 0; } if ((symbol->input_mode & 0x07) == GS1_MODE && !gs1_compliant(symbol->symbology)) { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "220: Selected symbology does not support GS1 mode"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 220, "Selected symbology does not support GS1 mode"); } if (seg_count > 1) { /* Note: GS1_MODE not currently supported when using multiple segments */ if ((symbol->input_mode & 0x07) == GS1_MODE) { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "776: GS1 mode not supported for multiple segments"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 776, "GS1 mode not supported for multiple segments"); } } if ((symbol->input_mode & 0x07) == UNICODE_MODE) { for (i = 0; i < seg_count; i++) { if (!is_valid_utf8(local_segs[i].source, local_segs[i].length)) { - return error_tag(symbol, ZINT_ERROR_INVALID_DATA, "245: Invalid UTF-8 in input data"); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, 245, "Invalid UTF-8 in input"); } } } @@ -1193,13 +1188,13 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ char primary[sizeof(symbol->primary)]; int primary_len = (int) strlen(symbol->primary); if (primary_len >= (int) sizeof(symbol->primary)) { - return error_tag(symbol, ZINT_ERROR_INVALID_DATA, "799: Invalid primary string"); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, 799, "Invalid primary string"); } ustrcpy(primary, symbol->primary); error_number = escape_char_process(symbol, (unsigned char *) primary, &primary_len, (unsigned char *) symbol->primary); if (error_number != 0) { /* Only returns errors, not warnings */ - return error_tag(symbol, error_number, NULL); + return error_tag(error_number, symbol, -1, NULL); } } @@ -1216,12 +1211,10 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ unsigned char *reduced = (unsigned char *) z_alloca(local_segs[0].length + 1); error_number = gs1_verify(symbol, local_segs[0].source, local_segs[0].length, reduced); if (error_number) { - static const char in_2d_comp[] = " in 2D component"; - if (is_composite(symbol->symbology) - && strlen(symbol->errtxt) + sizeof(in_2d_comp) <= sizeof(symbol->errtxt)) { - strcat(symbol->errtxt, in_2d_comp); + if (is_composite(symbol->symbology)) { + errtxt_adj(0, symbol, "%1$s%2$s", " (2D component)"); } - error_number = error_tag(symbol, error_number, NULL); + error_number = error_tag(error_number, symbol, -1, NULL); if (error_number >= ZINT_ERROR) { return error_number; } @@ -1231,7 +1224,7 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ local_segs[0].length = (int) ustrlen(reduced); } } else { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "210: Selected symbology does not support GS1 mode"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 210, "Selected symbology does not support GS1 mode"); } } @@ -1246,7 +1239,7 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ if (error_number < ZINT_ERROR) { error_number = ZINT_WARN_USES_ECI; if (!(symbol->debug & ZINT_DEBUG_TEST)) { - sprintf(symbol->errtxt, "222: Encoded data includes ECI %d", first_eci_set); + errtxtf(0, symbol, 222, "Encoded data includes ECI %d", first_eci_set); } if (symbol->debug & ZINT_DEBUG_PRINT) printf("Added ECI %d\n", first_eci_set); } @@ -1255,7 +1248,7 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ if (error_number == 0) { error_number = warn_number; /* Already tagged */ } else { - error_number = error_tag(symbol, error_number, NULL); + error_number = error_tag(error_number, symbol, -1, NULL); } if (error_number < ZINT_ERROR) { @@ -1279,12 +1272,12 @@ static int check_output_args(struct zint_symbol *symbol, int rotate_angle) { case 270: break; default: - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "223: Invalid rotation angle"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 223, "Invalid rotation angle"); break; } if ((symbol->output_options & BARCODE_DOTTY_MODE) && !(is_dotty(symbol->symbology))) { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "224: Selected symbology cannot be rendered as dots"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 224, "Selected symbology cannot be rendered as dots"); } return 0; @@ -1339,13 +1332,13 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) { error_number = dump_plot(symbol); } } else { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "225: Unknown output format"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 225, "Unknown output format"); } } else { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "226: Unknown output format"); + return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 226, "Unknown output format"); } - return error_tag(symbol, error_number, NULL); + return error_tag(error_number, symbol, -1, NULL); } /* Output a previously encoded symbol to memory as raster (`symbol->bitmap`) */ @@ -1357,7 +1350,7 @@ int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle) { } error_number = plot_raster(symbol, rotate_angle, OUT_BUFFER); - return error_tag(symbol, error_number, NULL); + return error_tag(error_number, symbol, -1, NULL); } /* Output a previously encoded symbol to memory as vector (`symbol->vector`) */ @@ -1369,7 +1362,7 @@ int ZBarcode_Buffer_Vector(struct zint_symbol *symbol, int rotate_angle) { } error_number = plot_vector(symbol, rotate_angle, OUT_BUFFER); - return error_tag(symbol, error_number, NULL); + return error_tag(error_number, symbol, -1, NULL); } /* Encode and output a symbol to file `symbol->outfile` */ @@ -1474,7 +1467,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, const char *filename) { if (!symbol) return ZINT_ERROR_INVALID_DATA; if (!filename) { - return error_tag(symbol, ZINT_ERROR_INVALID_DATA, "239: Filename NULL"); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, 239, "Filename NULL"); } if (strcmp(filename, "-") == 0) { @@ -1487,16 +1480,16 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, const char *filename) { file = fopen(filename, "rb"); #endif if (!file) { - sprintf(symbol->errtxt, "229: Unable to read input file (%d: %.30s)", errno, strerror(errno)); - return error_tag(symbol, ZINT_ERROR_INVALID_DATA, NULL); + errtxtf(0, symbol, 229, "Unable to read input file (%1$d: %2$s)", errno, strerror(errno)); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, -1, NULL); } file_opened = 1; /* Get file length */ if (fseek(file, 0, SEEK_END) != 0) { - sprintf(symbol->errtxt, "797: Unable to seek input file (%d: %.30s)", errno, strerror(errno)); + errtxtf(0, symbol, 797, "Unable to seek input file (%1$d: %2$s)", errno, strerror(errno)); (void) fclose(file); - return error_tag(symbol, ZINT_ERROR_INVALID_DATA, NULL); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, -1, NULL); } fileLen = ftell(file); @@ -1504,17 +1497,17 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, const char *filename) { /* On many Linux distros `ftell()` returns LONG_MAX not -1 on error */ if (fileLen <= 0 || fileLen == LONG_MAX) { (void) fclose(file); - return error_tag(symbol, ZINT_ERROR_INVALID_DATA, "235: Input file empty or unseekable"); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, 235, "Input file empty or unseekable"); } if (fileLen > ZINT_MAX_DATA_LEN) { (void) fclose(file); - return error_tag(symbol, ZINT_ERROR_TOO_LONG, "230: Input file too long"); + return error_tag(ZINT_ERROR_TOO_LONG, symbol, 230, "Input file too long"); } if (fseek(file, 0, SEEK_SET) != 0) { - sprintf(symbol->errtxt, "793: Unable to seek input file (%d: %.30s)", errno, strerror(errno)); + errtxtf(0, symbol, 793, "Unable to seek input file (%1$d: %2$s)", errno, strerror(errno)); (void) fclose(file); - return error_tag(symbol, ZINT_ERROR_INVALID_DATA, NULL); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, -1, NULL); } } @@ -1524,7 +1517,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, const char *filename) { if (file_opened) { (void) fclose(file); } - return error_tag(symbol, ZINT_ERROR_MEMORY, "231: Insufficient memory for file read buffer"); + return error_tag(ZINT_ERROR_MEMORY, symbol, 231, "Insufficient memory for file read buffer"); } /* Read file contents into buffer */ @@ -1532,21 +1525,21 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, const char *filename) { do { n = fread(buffer + nRead, 1, fileLen - nRead, file); if (ferror(file)) { - sprintf(symbol->errtxt, "241: Input file read error (%d: %.30s)", errno, strerror(errno)); + errtxtf(0, symbol, 241, "Input file read error (%1$d: %2$s)", errno, strerror(errno)); free(buffer); if (file_opened) { (void) fclose(file); } - return error_tag(symbol, ZINT_ERROR_INVALID_DATA, NULL); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, -1, NULL); } nRead += n; } while (!feof(file) && (0 < n) && ((long) nRead < fileLen)); if (file_opened) { if (fclose(file) != 0) { - sprintf(symbol->errtxt, "794: Failure on closing input file (%d: %.30s)", errno, strerror(errno)); + errtxtf(0, symbol, 794, "Failure on closing input file (%1$d: %2$s)", errno, strerror(errno)); free(buffer); - return error_tag(symbol, ZINT_ERROR_INVALID_DATA, NULL); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, -1, NULL); } } ret = ZBarcode_Encode(symbol, buffer, (int) nRead); diff --git a/backend/mailmark.c b/backend/mailmark.c index 688f2cc7..bb7b9ab6 100644 --- a/backend/mailmark.c +++ b/backend/mailmark.c @@ -194,16 +194,14 @@ INTERNAL int mailmark_4s(struct zint_symbol *symbol, unsigned char source[], int int error_number = 0; if (length > 26) { - strcpy(symbol->errtxt, "580: Input too long (26 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 580, "Input length %d too long (maximum 26)", length); } ustrcpy(local_source, source); if (length < 22) { if (length < 14) { - strcpy(symbol->errtxt, "588: Input too short (14 character minimum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 588, "Input length %d too short (minimum 14)", length); } for (i = length; i <= 22; i++) { strcat(local_source, " "); @@ -222,30 +220,27 @@ INTERNAL int mailmark_4s(struct zint_symbol *symbol, unsigned char source[], int printf("Producing 4-state Mailmark (%d): %s\n", length, local_source); } - if (!is_sane(RUBIDIUM_F, (unsigned char *) local_source, length)) { - strcpy(symbol->errtxt, "581: Invalid character in data (alphanumerics and space only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(RUBIDIUM_F, (unsigned char *) local_source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 581, + "Invalid character at position %d in input (alphanumerics and space only)", i); } /* Format is in the range 0-4 */ format = ctoi(local_source[0]); if ((format < 0) || (format > 4)) { - strcpy(symbol->errtxt, "582: Format (1st character) out of range (0 to 4)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 582, "Format (1st character) out of range (0 to 4)"); } /* Version ID is in the range 1-4 */ version_id = ctoi(local_source[1]) - 1; if ((version_id < 0) || (version_id > 3)) { - strcpy(symbol->errtxt, "583: Version ID (2nd character) out of range (1 to 4)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 583, "Version ID (2nd character) out of range (1 to 4)"); } /* Class is in the range 0-9,A-E */ mail_class = ctoi(local_source[2]); if ((mail_class < 0) || (mail_class > 14)) { - strcpy(symbol->errtxt, "584: Class (3rd character) out of range (0 to 9 and A to E)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 584, "Class (3rd character) out of range (0 to 9 and A to E)"); } /* Supply Chain ID is 2 digits for barcode C and 6 digits for barcode L */ @@ -255,8 +250,8 @@ INTERNAL int mailmark_4s(struct zint_symbol *symbol, unsigned char source[], int supply_chain_id *= 10; supply_chain_id += ctoi(local_source[i]); } else { - sprintf(symbol->errtxt, "585: Invalid Supply Chain ID at character %d (digits only)", i); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 585, + "Invalid Supply Chain ID at character %d (digits only)", i); } } @@ -267,8 +262,7 @@ INTERNAL int mailmark_4s(struct zint_symbol *symbol, unsigned char source[], int item_id *= 10; item_id += ctoi(local_source[i]); } else { - sprintf(symbol->errtxt, "586: Invalid Item ID at character %d (digits only)", i); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 586, "Invalid Item ID at character %d (digits only)", i); } } @@ -278,8 +272,7 @@ INTERNAL int mailmark_4s(struct zint_symbol *symbol, unsigned char source[], int } postcode[9] = '\0'; if (mailmark_verify_postcode(postcode, &postcode_type) != 0) { - sprintf(symbol->errtxt, "587: Invalid postcode \"%s\"", postcode); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 587, "Invalid postcode \"%s\"", postcode); } /* Convert postcode to internal user field */ @@ -526,13 +519,11 @@ INTERNAL int mailmark_2d(struct zint_symbol *symbol, unsigned char source[], int struct zint_seg segs[1]; if (length > 90) { - strcpy(symbol->errtxt, "589: Input too long (90 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 589, "Input length %d too long (maximum 90)", length); } if (length < 28) { /* After adding prefix (4), blank Return to Sender Post Code (7), Reserved (6): 28 + 17 = 45 */ - strcpy(symbol->errtxt, "860: Input too short (28 character minimum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 860, "Input length %d too short (minimum 28)", length); } /* Add prefix if missing */ @@ -540,8 +531,7 @@ INTERNAL int mailmark_2d(struct zint_symbol *symbol, unsigned char source[], int to_upper(local_source, 3); if (memcmp(local_source, "JGB ", 4) != 0) { if (length > 86) { - strcpy(symbol->errtxt, "861: Input too long (86 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 861, "Input length %d too long (maximum 86)", length); } ustrcpy(local_source, "JGB "); ustrcpy(local_source + 4, source); @@ -551,8 +541,7 @@ INTERNAL int mailmark_2d(struct zint_symbol *symbol, unsigned char source[], int } if (length < 32) { - strcpy(symbol->errtxt, "862: Input too short (32 character minimum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 862, "Input length %d too short (minimum 32)", length); } if (length < 39) { /* Space-pad Return to Sender Post Code */ memset(local_source + length, ' ', 39 - length); @@ -570,18 +559,18 @@ INTERNAL int mailmark_2d(struct zint_symbol *symbol, unsigned char source[], int /* 8: 24 x 24, 10: 32 x 32, 30: 16 x 48 */ if (symbol->option_2) { if (symbol->option_2 != 8 && symbol->option_2 != 10 && symbol->option_2 != 30) { - strcpy(symbol->errtxt, "863: Invalid symbol size selected (8, 10, 30 only)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 863, "Invalid Version '%d' (8, 10 or 30 only)", + symbol->option_2); } if (symbol->option_2 == 8) { if (length > 51) { - strcpy(symbol->errtxt, "864: Input too long for selected size (51 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 864, + "Input length %d too long for Version 8 (maximum 51)", length); } } else if (symbol->option_2 == 30) { if (length > 70) { - strcpy(symbol->errtxt, "865: Input too long for selected size (70 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 865, + "Input length %d too long for Version 30 (maximum 70)", length); } } } else { @@ -598,38 +587,32 @@ INTERNAL int mailmark_2d(struct zint_symbol *symbol, unsigned char source[], int printf("Producing 2D Mailmark %d (%d): %s\n", symbol->option_2, length, local_source); } - if (!is_sane(RUBIDIUM_F, local_source, 45)) { - strcpy(symbol->errtxt, - "866: Invalid character in data (alphanumerics and space only in first 45 characters)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(RUBIDIUM_F, local_source, 45))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 866, + "Invalid character at position %d in input (alphanumerics and space only in first 45)", i); } /* Information Type ID */ /* Not checking that matches values listed in Mailmark Definition Document as contradicted by Mailmark Mailing Requirements Section 5.7 which says 'P' for poll card is valid, which isn't listed */ if (local_source[4] == ' ') { - strcpy(symbol->errtxt, "867: Invalid Information Type ID (cannot be space)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 867, "Invalid Information Type ID (cannot be space)"); } /* Version ID */ if (local_source[5] != '1') { - strcpy(symbol->errtxt, "868: Invalid Version ID (\"1\" only)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 868, "Invalid Version ID (\"1\" only)"); } /* Class */ if (local_source[6] == ' ') { - strcpy(symbol->errtxt, "869: Invalid Class (cannot be space)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 869, "Invalid Class (cannot be space)"); } /* Supply Chain ID */ if (cnt_digits(local_source, length, 7, 7) != 7) { - strcpy(symbol->errtxt, "870: Invalid Supply Chain ID (7 digits only)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 870, "Invalid Supply Chain ID (7 digits only)"); } /* Item ID */ if (cnt_digits(local_source, length, 14, 8) != 8) { - strcpy(symbol->errtxt, "871: Invalid Item ID (8 digits only)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 871, "Invalid Item ID (8 digits only)"); } /* Destination Post Code plus DPS field */ @@ -638,14 +621,12 @@ INTERNAL int mailmark_2d(struct zint_symbol *symbol, unsigned char source[], int } postcode[9] = '\0'; if (mailmark_verify_postcode(postcode, NULL) != 0) { - strcpy(symbol->errtxt, "872: Invalid Destination Post Code plus DPS"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 872, "Invalid Destination Post Code plus DPS"); } /* Service Type */ if (local_source[31] < '0' || local_source[31] > '6') { - strcpy(symbol->errtxt, "873: Invalid Service Type (\"0\" to \"6\" only)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 873, "Invalid Service Type (\"0\" to \"6\" only)"); } /* Return to Sender Post Code */ @@ -663,15 +644,13 @@ INTERNAL int mailmark_2d(struct zint_symbol *symbol, unsigned char source[], int } postcode[9] = '\0'; if (mailmark_verify_postcode(postcode, NULL) != 0) { - strcpy(symbol->errtxt, "874: Invalid Return to Sender Post Code"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 874, "Invalid Return to Sender Post Code"); } } /* Reserved */ if (memcmp(local_source + 39, " ", 6) != 0) { - strcpy(symbol->errtxt, "875: Invalid Reserved field (must be spaces only)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 875, "Invalid Reserved field (must be spaces only)"); } segs[0].eci = 0; diff --git a/backend/maxicode.c b/backend/maxicode.c index 194b56c8..809d651f 100644 --- a/backend/maxicode.c +++ b/backend/maxicode.c @@ -557,8 +557,7 @@ INTERNAL int maxicode(struct zint_symbol *symbol, struct zint_seg segs[], const lp = (int) strlen(symbol->primary); if (lp == 0) { if (mode == 0) { /* Require primary message to auto-determine between 2 and 3 */ - strcpy(symbol->errtxt, "554: Primary Message empty"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 554, "Primary Message empty"); } mode = 4; } else { @@ -573,8 +572,7 @@ INTERNAL int maxicode(struct zint_symbol *symbol, struct zint_seg segs[], const } if ((mode < 2) || (mode > 6)) { /* Only codes 2 to 6 supported */ - strcpy(symbol->errtxt, "550: Invalid MaxiCode Mode"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 550, "Mode '%d' out of range (2 to 6)", mode); } if ((mode == 2) || (mode == 3)) { /* Modes 2 and 3 need data in symbol->primary */ @@ -586,8 +584,11 @@ INTERNAL int maxicode(struct zint_symbol *symbol, struct zint_seg segs[], const lp = (int) strlen(symbol->primary); } if (lp < 7 || lp > 15) { /* 1 to 9 character postcode + 3 digit country code + 3 digit service class */ - strcpy(symbol->errtxt, "551: Invalid length for Primary Message"); - return ZINT_ERROR_INVALID_DATA; + if (lp == 0) { + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 548, "Primary Message empty"); + } + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 551, "Primary Message length %d wrong (7 to 15 only)", + lp); } postcode_len = lp - 6; @@ -595,8 +596,8 @@ INTERNAL int maxicode(struct zint_symbol *symbol, struct zint_seg segs[], const service = to_int((const unsigned char *) (symbol->primary + postcode_len + 3), 3); if (countrycode == -1 || service == -1) { /* check that country code and service are numeric */ - strcpy(symbol->errtxt, "552: Non-numeric country code or service class in Primary Message"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 552, + "Non-numeric country code or service class in Primary Message"); } memcpy(postcode, symbol->primary, postcode_len); @@ -609,8 +610,7 @@ INTERNAL int maxicode(struct zint_symbol *symbol, struct zint_seg segs[], const postcode_len = i; break; } else if (!z_isdigit(postcode[i])) { - strcpy(symbol->errtxt, "555: Non-numeric postcode in Primary Message"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 555, "Non-numeric postcode in Primary Message"); } } if (countrycode == 840 && postcode_len == 5) { @@ -631,8 +631,8 @@ INTERNAL int maxicode(struct zint_symbol *symbol, struct zint_seg segs[], const for (i = 0; i < 6; i++) { /* Don't allow Code Set A control characters CR, RS, GS and RS */ if (postcode[i] < ' ' || maxiCodeSet[postcode[i]] > 1) { - strcpy(symbol->errtxt, "556: Invalid character in postcode in Primary Message"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 556, + "Invalid character in postcode in Primary Message"); } } maxi_do_primary_3(maxi_codeword, postcode, countrycode, service); @@ -640,8 +640,8 @@ INTERNAL int maxicode(struct zint_symbol *symbol, struct zint_seg segs[], const if (symbol->option_2) { /* Check for option_2 = vv + 1, where vv is version of SCM prefix "[)>\R01\Gvv" */ if (symbol->option_2 < 0 || symbol->option_2 > 100) { - strcpy(symbol->errtxt, "557: Invalid SCM prefix version"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 557, + "SCM prefix version '%d' out of range (1 to 100)", symbol->option_2); } scm_vv = symbol->option_2 - 1; } @@ -659,24 +659,23 @@ INTERNAL int maxicode(struct zint_symbol *symbol, struct zint_seg segs[], const if (symbol->structapp.count) { if (symbol->structapp.count < 2 || symbol->structapp.count > 8) { - strcpy(symbol->errtxt, "558: Structured Append count out of range (2-8)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 558, + "Structured Append count '%d' out of range (2 to 8)", symbol->structapp.count); } if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { - sprintf(symbol->errtxt, "559: Structured Append index out of range (1-%d)", symbol->structapp.count); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 559, + "Structured Append index '%1$d' out of range (1 to count %2$d)", + symbol->structapp.index, symbol->structapp.count); } if (symbol->structapp.id[0]) { - strcpy(symbol->errtxt, "549: Structured Append ID not available for MaxiCode"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 549, "Structured Append ID not available for MaxiCode"); } structapp_cw = (symbol->structapp.count - 1) | ((symbol->structapp.index - 1) << 3); } error_number = maxi_text_process_segs(maxi_codeword, mode, segs, seg_count, structapp_cw, scm_vv, debug_print); if (error_number == ZINT_ERROR_TOO_LONG) { - strcpy(symbol->errtxt, "553: Input data too long"); - return error_number; + return errtxt(error_number, symbol, 553, "Input too long, requires too many codewords (maximum 144)"); } /* All the data is sorted - now do error correction */ diff --git a/backend/medical.c b/backend/medical.c index b00a2294..8f375c00 100644 --- a/backend/medical.c +++ b/backend/medical.c @@ -63,6 +63,7 @@ INTERNAL int pharma(struct zint_symbol *symbol, unsigned char source[], int leng the specification at http://www.laetus.com/laetus.php?request=file&id=69 (http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf) */ + int i; int tester; int counter, error_number = 0, h; char inter[18] = {0}; /* 131070 -> 17 bits */ @@ -71,18 +72,16 @@ INTERNAL int pharma(struct zint_symbol *symbol, unsigned char source[], int leng char *d = dest; if (length > 6) { - strcpy(symbol->errtxt, "350: Input too long (6 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 350, "Input length %d too long (maximum 6)", length); } - tester = to_int(source, length); - if (tester == -1) { - strcpy(symbol->errtxt, "351: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 351, + "Invalid character at position %d in input (digits only)", i); } + tester = to_int(source, length); if ((tester < 3) || (tester > 131070)) { - strcpy(symbol->errtxt, "352: Data out of range (3 to 131070)"); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 352, "Input value '%d' out of range (3 to 131070)", tester); } do { @@ -152,6 +151,7 @@ static int pharma_two_calc(int tester, char *d) { INTERNAL int pharma_two(struct zint_symbol *symbol, unsigned char source[], int length) { /* Draws the patterns for two track pharmacode */ + int i; int tester; char height_pattern[200]; unsigned int loopey, h; @@ -159,17 +159,16 @@ INTERNAL int pharma_two(struct zint_symbol *symbol, unsigned char source[], int int error_number = 0; if (length > 8) { - strcpy(symbol->errtxt, "354: Input too long (8 character maximum"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 354, "Input length %d too long (maximum 8)", length); } + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 355, + "Invalid character at position %d in input (digits only)", i); + } + tester = to_int(source, length); - if (tester == -1) { - strcpy(symbol->errtxt, "355: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; - } if ((tester < 4) || (tester > 64570080)) { - strcpy(symbol->errtxt, "353: Data out of range (4 to 64570080)"); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 353, "Input value '%d' out of range (4 to 64570080)", tester); } h = pharma_two_calc(tester, height_pattern); @@ -209,36 +208,32 @@ INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int len int d_chars = 0; if (length > 103) { /* No stack smashing please (103 + 1) * 11 = 1144 */ - strcpy(symbol->errtxt, "356: Input too long (103 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 356, "Input length %d too long (maximum 103)", length); } /* BS EN 798:1995 4.2 "'Codabar' symbols shall consist of ... b) start character; c) one or more symbol characters representing data ... d) stop character ..." */ if (length < 3) { - strcpy(symbol->errtxt, "362: Input too short (3 character minimum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 362, "Input length %d too short (minimum 3)", length); } to_upper(source, length); /* Codabar must begin and end with the characters A, B, C or D */ if ((source[0] != 'A') && (source[0] != 'B') && (source[0] != 'C') && (source[0] != 'D')) { - strcpy(symbol->errtxt, "358: Does not begin with \"A\", \"B\", \"C\" or \"D\""); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 358, "Does not begin with \"A\", \"B\", \"C\" or \"D\""); } if ((source[length - 1] != 'A') && (source[length - 1] != 'B') && (source[length - 1] != 'C') && (source[length - 1] != 'D')) { - strcpy(symbol->errtxt, "359: Does not end with \"A\", \"B\", \"C\" or \"D\""); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 359, "Does not end with \"A\", \"B\", \"C\" or \"D\""); } - if (!is_sane_lookup(CALCIUM, sizeof(CALCIUM) - 1, source, length, posns)) { - sprintf(symbol->errtxt, "357: Invalid character in data (\"%s\" only)", CALCIUM); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane_lookup(CALCIUM, sizeof(CALCIUM) - 1, source, length, posns))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 357, + "Invalid character at position %1$d in input (\"%2$s\" only)", i, CALCIUM); } /* And must not use A, B, C or D otherwise (BS EN 798:1995 4.3.2) */ - if (!is_sane(CALCIUM_INNER_F, source + 1, length - 2)) { - strcpy(symbol->errtxt, "363: Cannot contain \"A\", \"B\", \"C\" or \"D\""); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(CALCIUM_INNER_F, source + 1, length - 2))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 363, + "Invalid character at position %d in input (cannot contain \"A\", \"B\", \"C\" or \"D\")", i); } /* Add check character: 1 don't show to HRT, 2 do show to HRT @@ -301,17 +296,16 @@ INTERNAL int code32(struct zint_symbol *symbol, unsigned char source[], int leng static const char TABELLA[] = "0123456789BCDFGHJKLMNPQRSTUVWXYZ"; int i, zeroes, error_number = 0, checksum, checkpart, checkdigit; char localstr[10], risultante[7]; - long int pharmacode, devisor; + unsigned int pharmacode, devisor; int codeword[6]; /* Validate the input */ if (length > 8) { - strcpy(symbol->errtxt, "360: Input too long (8 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 360, "Input length %d too long (maximum 8)", length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "361: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 361, + "Invalid character at position %d in input (digits only)", i); } /* Add leading zeros as required */ @@ -343,7 +337,7 @@ INTERNAL int code32(struct zint_symbol *symbol, unsigned char source[], int leng /* Convert from decimal to base-32 */ devisor = 33554432; for (i = 5; i >= 0; i--) { - long int remainder; + unsigned int remainder; codeword[i] = pharmacode / devisor; remainder = pharmacode % devisor; pharmacode = remainder; diff --git a/backend/output.c b/backend/output.c index 3f109990..e6f5ed9a 100644 --- a/backend/output.c +++ b/backend/output.c @@ -52,12 +52,12 @@ static int out_check_colour(struct zint_symbol *symbol, const char *colour, cons if ((comma1 = strchr(colour, ',')) == NULL) { const int len = (int) strlen(colour); if ((len != 6) && (len != 8)) { - sprintf(symbol->errtxt, "880: Malformed %s RGB colour (6 or 8 characters only)", name); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 880, "Malformed %s RGB colour (6 or 8 characters only)", + name); } - if (!is_sane(OUT_SSET_F, (unsigned char *) colour, len)) { - sprintf(symbol->errtxt, "881: Malformed %s RGB colour '%s' (hexadecimal only)", name, colour); - return ZINT_ERROR_INVALID_OPTION; + if (not_sane(OUT_SSET_F, (unsigned char *) colour, len)) { + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 881, + "Malformed %1$s RGB colour '%2$s' (hexadecimal only)", name, colour); } return 0; @@ -66,29 +66,29 @@ static int out_check_colour(struct zint_symbol *symbol, const char *colour, cons /* CMYK comma-separated percentages */ if ((comma2 = strchr(comma1 + 1, ',')) == NULL || (comma3 = strchr(comma2 + 1, ',')) == NULL || strchr(comma3 + 1, ',') != NULL) { - sprintf(symbol->errtxt, "882: Malformed %s CMYK colour (4 decimal numbers, comma-separated)", name); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 882, + "Malformed %s CMYK colour (4 decimal numbers, comma-separated)", name); } if (comma1 - colour > 3 || comma2 - (comma1 + 1) > 3 || comma3 - (comma2 + 1) > 3 || strlen(comma3 + 1) > 3) { - sprintf(symbol->errtxt, "883: Malformed %s CMYK colour (3 digit maximum per number)", name); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 883, + "Malformed %s CMYK colour (3 digit maximum per number)", name); } if ((val = to_int((const unsigned char *) colour, (int) (comma1 - colour))) == -1 || val > 100) { - sprintf(symbol->errtxt, "884: Malformed %s CMYK colour C (decimal 0-100 only)", name); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 884, "Malformed %s CMYK colour C (decimal 0 to 100 only)", + name); } if ((val = to_int((const unsigned char *) (comma1 + 1), (int) (comma2 - (comma1 + 1)))) == -1 || val > 100) { - sprintf(symbol->errtxt, "885: Malformed %s CMYK colour M (decimal 0-100 only)", name); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 885, "Malformed %s CMYK colour M (decimal 0 to 100 only)", + name); } if ((val = to_int((const unsigned char *) (comma2 + 1), (int) (comma3 - (comma2 + 1)))) == -1 || val > 100) { - sprintf(symbol->errtxt, "886: Malformed %s CMYK colour Y (decimal 0-100 only)", name); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 886, "Malformed %s CMYK colour Y (decimal 0 to 100 only)", + name); } if ((val = to_int((const unsigned char *) (comma3 + 1), (int) strlen(comma3 + 1))) == -1 || val > 100) { - sprintf(symbol->errtxt, "887: Malformed %s CMYK colour K (decimal 0-100 only)", name); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 887, "Malformed %s CMYK colour K (decimal 0 to 100 only)", + name); } return 0; diff --git a/backend/pcx.c b/backend/pcx.c index 24ed2462..3e3689e6 100644 --- a/backend/pcx.c +++ b/backend/pcx.c @@ -86,8 +86,8 @@ INTERNAL int pcx_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix /* Open output file in binary mode */ if (!fm_open(fmp, symbol, "wb")) { - sprintf(symbol->errtxt, "621: Could not open output file (%d: %.30s)", fmp->err, strerror(fmp->err)); - return ZINT_ERROR_FILE_ACCESS; + return errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 621, "Could not open PCX output file (%1$d: %2$s)", fmp->err, + strerror(fmp->err)); } fm_write(&header, sizeof(pcx_header_t), 1, fmp); @@ -151,14 +151,14 @@ INTERNAL int pcx_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix } if (fm_error(fmp)) { - sprintf(symbol->errtxt, "622: Incomplete write to output (%d: %.30s)", fmp->err, strerror(fmp->err)); + errtxtf(0, symbol, 622, "Incomplete write of PCX output (%1$d: %2$s)", fmp->err, strerror(fmp->err)); (void) fm_close(fmp, symbol); return ZINT_ERROR_FILE_WRITE; } if (!fm_close(fmp, symbol)) { - sprintf(symbol->errtxt, "624: Failure on closing output file (%d: %.30s)", fmp->err, strerror(fmp->err)); - return ZINT_ERROR_FILE_WRITE; + return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 624, "Failure on closing PCX output file (%1$d: %2$s)", + fmp->err, strerror(fmp->err)); } return 0; diff --git a/backend/pdf417.c b/backend/pdf417.c index 6742f6c0..7e03adc5 100644 --- a/backend/pdf417.c +++ b/backend/pdf417.c @@ -146,10 +146,12 @@ static const char pdf_MicroAutosize[56] = { /* ISO/IEC 15438:2015 5.1.1 c) 3) Max possible number of characters at error correction level 0 (Numeric Compaction mode) */ #define PDF_MAX_LEN 2710 +#define PDF_MAX_LEN_S "2710" /* String version of above */ #define PDF_MAX_STREAM_LEN (PDF_MAX_LEN * 3) /* Allow for tripling up due to shifts/latches (ticket #300 (#7)) */ /* ISO/IEC 24728:2006 5.1.1 c) 3) Max possible number of characters (Numeric Compaction mode) */ #define MICRO_PDF_MAX_LEN 366 +#define MICRO_PDF_MAX_LEN_S "366" /* String version of above */ /* 866 */ /* Initial non-compressed categorization of input */ @@ -1024,8 +1026,7 @@ static int pdf_initial(struct zint_symbol *symbol, const unsigned char chaine[], pdf_appendix_d_encode(chaine, liste, &indexliste); } else { if (!pdf_define_mode(liste, &indexliste, chaine, length, *p_lastmode, debug_print)) { - strcpy(symbol->errtxt, "749: Insufficient memory for mode buffers"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 749, "Insufficient memory for mode buffers"); } } @@ -1051,8 +1052,8 @@ static int pdf_initial(struct zint_symbol *symbol, const unsigned char chaine[], if (eci != 0) { if (eci > 811799) { - strcpy(symbol->errtxt, "472: Invalid ECI"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 472, "ECI code '%d' out of range (0 to 811799)", + symbol->eci); } /* Encoding ECI assignment number, according to Table 8 */ if (eci <= 899) { @@ -1125,12 +1126,13 @@ static int pdf_initial_segs(struct zint_symbol *symbol, struct zint_seg segs[], int id_cnt = 0, ids[10]; if (symbol->structapp.count < 2 || symbol->structapp.count > 99999) { - strcpy(symbol->errtxt, "740: Structured Append count out of range (2-99999)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 740, + "Structured Append count '%d' out of range (2 to 99999)", symbol->structapp.count); } if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { - sprintf(symbol->errtxt, "741: Structured Append index out of range (1-%d)", symbol->structapp.count); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 741, + "Structured Append index '%1$d' out of range (1 to count %2$d)", + symbol->structapp.index, symbol->structapp.count); } if (symbol->structapp.id[0]) { int id_len; @@ -1138,21 +1140,21 @@ static int pdf_initial_segs(struct zint_symbol *symbol, struct zint_seg segs[], for (id_len = 1; id_len < 31 && symbol->structapp.id[id_len]; id_len++); if (id_len > 30) { /* 10 triplets */ - strcpy(symbol->errtxt, "742: Structured Append ID too long (30 digit maximum)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 742, + "Structured Append ID length %d too long (30 digit maximum)", id_len); } for (i = 0; i < id_len; i += 3, id_cnt++) { const int triplet_len = i + 3 < id_len ? 3 : id_len - i; ids[id_cnt] = to_int((const unsigned char *) (symbol->structapp.id + i), triplet_len); if (ids[id_cnt] == -1) { - strcpy(symbol->errtxt, "743: Invalid Structured Append ID (digits only)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 743, + "Invalid Structured Append ID (digits only)"); } if (ids[id_cnt] > 899) { - sprintf(symbol->errtxt, "744: Structured Append ID triplet %d '%03d' out of range (000-899)", - id_cnt + 1, ids[id_cnt]); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 744, + "Structured Append ID triplet %1$d value '%2$03d' out of range (000 to 899)", + id_cnt + 1, ids[id_cnt]); } } } @@ -1204,9 +1206,8 @@ static int pdf_enc(struct zint_symbol *symbol, struct zint_seg segs[], const int const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; static const short ecc_num_cws[] = { 2, 4, 8, 16, 32, 64, 128, 256, 512 }; - if (segs_length(segs, seg_count) > PDF_MAX_LEN) { - strcpy(symbol->errtxt, "463: Input string too long"); - return ZINT_ERROR_TOO_LONG; + if ((i = segs_length(segs, seg_count)) > PDF_MAX_LEN) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 463, "Input length %d too long (maximum " PDF_MAX_LEN_S ")", i); } error_number = pdf_initial_segs(symbol, segs, seg_count, 0 /*is_micro*/, chainemc, &mclength, structapp_cws, @@ -1250,8 +1251,7 @@ static int pdf_enc(struct zint_symbol *symbol, struct zint_seg segs[], const int if (longueur > 928) { /* Enforce maximum codeword limit */ - strcpy(symbol->errtxt, "464: Input string too long"); - return ZINT_ERROR_TOO_LONG; + return errtxt(ZINT_ERROR_TOO_LONG, symbol, 464, "Input too long, requires too many codewords (maximum 928)"); } cols = symbol->option_2; @@ -1268,21 +1268,20 @@ static int pdf_enc(struct zint_symbol *symbol, struct zint_seg segs[], const int /* Increase rows if multiple too big */ for (; cols >= 1 && rows < 90 && rows * cols > 928; rows++, cols = (longueur + rows - 1) / rows); if (rows * cols > 928) { - strcpy(symbol->errtxt, "465: Data too long for specified number of rows"); - return ZINT_ERROR_TOO_LONG; + return errtxt(ZINT_ERROR_TOO_LONG, symbol, 465, + "Input too long, requires too many codewords (maximum 928)"); } } } else { /* Cols given */ /* Increase rows if multiple too big */ for (; rows <= 90 && rows * cols < longueur; rows++); if (rows > 90 || rows * cols > 928) { - strcpy(symbol->errtxt, "745: Data too long for specified number of columns"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 745, "Input too long for number of columns '%d'", cols); } } if (rows != symbol->option_3) { - sprintf(symbol->errtxt, "746: Rows increased from %d to %d", symbol->option_3, rows); - error_number = ZINT_WARN_INVALID_OPTION; + error_number = errtxtf(ZINT_WARN_INVALID_OPTION, symbol, 746, + "Number of rows increased from %1$d to %2$d", symbol->option_3, rows); } } else { /* Rows automatic, cols automatic or given */ if (cols < 1) { /* Cols automatic */ @@ -1299,12 +1298,12 @@ static int pdf_enc(struct zint_symbol *symbol, struct zint_seg segs[], const int /* Increase cols if multiple too big */ for (; rows >= 3 && cols < 30 && rows * cols > 928; cols++, rows = (longueur + cols - 1) / cols); if (rows * cols > 928) { - strcpy(symbol->errtxt, "747: Data too long for specified number of columns"); - return ZINT_ERROR_TOO_LONG; + return errtxt(ZINT_ERROR_TOO_LONG, symbol, 747, + "Input too long, requires too many codewords (maximum 928)"); } if (symbol->option_2 && cols != symbol->option_2) { /* Note previously did not warn if cols auto-upped */ - sprintf(symbol->errtxt, "748: Columns increased from %d to %d", symbol->option_2, cols); - error_number = ZINT_WARN_INVALID_OPTION; + error_number = errtxtf(ZINT_WARN_INVALID_OPTION, symbol, 748, + "Number of columns increased from %1$d to %2$d", symbol->option_2, cols); } } } @@ -1450,30 +1449,28 @@ INTERNAL int pdf417(struct zint_symbol *symbol, struct zint_seg segs[], const in error_number = 0; if ((symbol->option_1 < -1) || (symbol->option_1 > 8)) { + errtxtf(0, symbol, 460, "Error correction level '%d' out of range (0 to 8)", symbol->option_1); if (symbol->warn_level == WARN_FAIL_ALL) { - strcpy(symbol->errtxt, "462: Security value out of range (0 to 8)"); return ZINT_ERROR_INVALID_OPTION; } - strcpy(symbol->errtxt, "460: Security value out of range (0 to 8), ignored"); + error_number = errtxt_adj(ZINT_WARN_INVALID_OPTION, symbol, "%1$s%2$s", ", ignoring"); symbol->option_1 = -1; - error_number = ZINT_WARN_INVALID_OPTION; } if ((symbol->option_2 < 0) || (symbol->option_2 > 30)) { + errtxtf(0, symbol, 461, "Number of columns '%d' out of range (1 to 30)", symbol->option_2); if (symbol->warn_level == WARN_FAIL_ALL) { - strcpy(symbol->errtxt, "473: Number of columns out of range (1 to 30)"); return ZINT_ERROR_INVALID_OPTION; } - strcpy(symbol->errtxt, "461: Number of columns out of range (1 to 30), ignored"); + error_number = errtxt_adj(ZINT_WARN_INVALID_OPTION, symbol, "%1$s%2$s", ", ignoring"); symbol->option_2 = 0; - error_number = ZINT_WARN_INVALID_OPTION; } if (symbol->option_3 && (symbol->option_3 < 3 || symbol->option_3 > 90)) { - strcpy(symbol->errtxt, "466: Number of rows out of range (3 to 90)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 466, "Number of rows '%d' out of range (3 to 90)", + symbol->option_3); } if (symbol->option_2 && symbol->option_3 && symbol->option_2 * symbol->option_3 > 928) { - strcpy(symbol->errtxt, "475: Columns x rows out of range (1 to 928)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 475, "Columns x rows value '%d' out of range (1 to 928)", + symbol->option_2 * symbol->option_3); } /* 349 */ @@ -1500,14 +1497,15 @@ INTERNAL int micropdf417(struct zint_symbol *symbol, struct zint_seg segs[], con int variant; int LeftRAP, CentreRAP, RightRAP, Cluster, loop; const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; + /* From ISO/IEC 24728:2006 Table 1 — MicroPDF417 version characteristics */ + static char col_max_codewords[5] = { 0, 20, 37, 82, 126 }; - if (segs_length(segs, seg_count) > MICRO_PDF_MAX_LEN) { - strcpy(symbol->errtxt, "474: Input data too long"); - return ZINT_ERROR_TOO_LONG; + if ((i = segs_length(segs, seg_count)) > MICRO_PDF_MAX_LEN) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 474, "Input length %d too long (maximum " MICRO_PDF_MAX_LEN_S ")", + i); } if (symbol->option_3) { - strcpy(symbol->errtxt, "476: Cannot specify rows for MicroPDF417"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 476, "Cannot specify rows for MicroPDF417"); } /* Encoding starts out the same as PDF417, so use the same code */ @@ -1521,16 +1519,17 @@ INTERNAL int micropdf417(struct zint_symbol *symbol, struct zint_seg segs[], con /* This is where it all changes! */ if (mclength + structapp_cp > 126) { - strcpy(symbol->errtxt, "467: Input data too long"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 467, "Input too long, requires %d codewords (maximum 126)", + mclength + structapp_cp); } if (symbol->option_2 > 4) { - strcpy(symbol->errtxt, "468: Specified width out of range"); if (symbol->warn_level == WARN_FAIL_ALL) { - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 471, "Number of columns '%d' out of range (1 to 4)", + symbol->option_2); } + error_number = errtxtf(ZINT_WARN_INVALID_OPTION, symbol, 468, + "Number of columns '%d' out of range (1 to 4), ignoring", symbol->option_2); symbol->option_2 = 0; - error_number = ZINT_WARN_INVALID_OPTION; } if (debug_print) { @@ -1545,34 +1544,16 @@ INTERNAL int micropdf417(struct zint_symbol *symbol, struct zint_seg segs[], con variant = 0; - if ((symbol->option_2 == 1) && (mclength + structapp_cp > 20)) { - /* the user specified 1 column but the data doesn't fit - go to automatic */ - strcpy(symbol->errtxt, "469: Specified symbol size too small for data"); + if (symbol->option_2 >= 1 && mclength + structapp_cp > col_max_codewords[symbol->option_2]) { + /* The user specified the column but the data doesn't fit - go to automatic */ if (symbol->warn_level == WARN_FAIL_ALL) { - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 469, + "Input too long for number of columns '%1$d', requires %2$d codewords (maximum %3$d)", + symbol->option_2, mclength + structapp_cp, col_max_codewords[symbol->option_2]); } + error_number = errtxtf(ZINT_WARN_INVALID_OPTION, symbol, 470, + "Input too long for number of columns '%d', ignoring", symbol->option_2); symbol->option_2 = 0; - error_number = ZINT_WARN_INVALID_OPTION; - } - - if ((symbol->option_2 == 2) && (mclength + structapp_cp > 37)) { - /* the user specified 2 columns but the data doesn't fit - go to automatic */ - strcpy(symbol->errtxt, "470: Specified symbol size too small for data"); - if (symbol->warn_level == WARN_FAIL_ALL) { - return ZINT_ERROR_INVALID_OPTION; - } - symbol->option_2 = 0; - error_number = ZINT_WARN_INVALID_OPTION; - } - - if ((symbol->option_2 == 3) && (mclength + structapp_cp > 82)) { - /* the user specified 3 columns but the data doesn't fit - go to automatic */ - strcpy(symbol->errtxt, "471: Specified symbol size too small for data"); - if (symbol->warn_level == WARN_FAIL_ALL) { - return ZINT_ERROR_INVALID_OPTION; - } - symbol->option_2 = 0; - error_number = ZINT_WARN_INVALID_OPTION; } if (symbol->option_2 == 1) { diff --git a/backend/plessey.c b/backend/plessey.c index 6187691c..0d30d928 100644 --- a/backend/plessey.c +++ b/backend/plessey.c @@ -62,12 +62,11 @@ INTERNAL int plessey(struct zint_symbol *symbol, unsigned char source[], int len int error_number = 0; if (length > 67) { /* 16 + 67 * 16 + 4 * 8 + 19 = 1139 */ - strcpy(symbol->errtxt, "370: Input too long (67 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 370, "Input length %d too long (maximum 67)", length); } - if (!is_sane(SSET_F, source, length)) { - strcpy(symbol->errtxt, "371: Invalid character in data (digits and \"ABCDEF\" only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(SSET_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 371, + "Invalid character at position %d in input (digits and \"ABCDEF\" only)", i); } /* Start character */ @@ -308,18 +307,18 @@ static char *msi_plessey_mod1110(struct zint_symbol *symbol, const unsigned char INTERNAL int msi_plessey(struct zint_symbol *symbol, unsigned char source[], int length) { int error_number = 0; + int i; char dest[766]; /* 2 + 92 * 8 + 3 * 8 + 3 + 1 = 766 */ char *d = dest; int check_option = symbol->option_2; int no_checktext = 0; if (length > 92) { /* 3 (Start) + 92 * 12 + 3 * 12 + 4 (Stop) = 1147 */ - strcpy(symbol->errtxt, "372: Input too long (92 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 372, "Input length %d too long (maximum 92)", length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "377: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 377, + "Invalid character at position %d in input (digits only)", i); } if (check_option >= 11 && check_option <= 16) { /* +10 means don't print check digits in HRT */ diff --git a/backend/png.c b/backend/png.c index 68e2c248..84796174 100644 --- a/backend/png.c +++ b/backend/png.c @@ -1,7 +1,7 @@ /* png.c - Handles output to PNG file */ /* libzint - the open source barcode library - Copyright (C) 2009-2023 Robin Stuart + Copyright (C) 2009-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -61,7 +61,7 @@ static void wpng_error_handler(png_structp png_ptr, png_const_charp msg) { fflush(stderr); return; /* libpng will call abort() */ } - sprintf(wpng_error_ptr->symbol->errtxt, "635: libpng error: %.60s", msg ? msg : ""); + errtxtf(0, wpng_error_ptr->symbol, 635, "libpng error: %s", msg ? msg : ""); longjmp(wpng_error_ptr->jmpbuf, 1); } @@ -212,24 +212,22 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix /* Open output file in binary mode */ if (!fm_open(fmp, symbol, "wb")) { - sprintf(symbol->errtxt, "632: Could not open output file (%d: %.30s)", fmp->err, strerror(fmp->err)); - return ZINT_ERROR_FILE_ACCESS; + return errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 632, "Could not open PNG output file (%1$d: %2$s)", fmp->err, + strerror(fmp->err)); } /* Set up error handling routine as proc() above */ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, &wpng_error, wpng_error_handler, NULL); if (!png_ptr) { - strcpy(symbol->errtxt, "633: Insufficient memory for PNG write structure buffer"); (void) fm_close(fmp, symbol); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 633, "Insufficient memory for PNG write structure buffer"); } info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { png_destroy_write_struct(&png_ptr, NULL); - strcpy(symbol->errtxt, "634: Insufficient memory for PNG info structure buffer"); (void) fm_close(fmp, symbol); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 634, "Insufficient memory for PNG info structure buffer"); } /* catch jumping here */ @@ -314,14 +312,14 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix png_destroy_write_struct(&png_ptr, &info_ptr); if (fm_error(fmp)) { - sprintf(symbol->errtxt, "638: Incomplete write to output (%d: %.30s)", fmp->err, strerror(fmp->err)); + errtxtf(0, symbol, 638, "Incomplete write of PNG output (%1$d: %2$s)", fmp->err, strerror(fmp->err)); (void) fm_close(fmp, symbol); return ZINT_ERROR_FILE_WRITE; } if (!fm_close(fmp, symbol)) { - sprintf(symbol->errtxt, "960: Failure on closing output file (%d: %.30s)", fmp->err, strerror(fmp->err)); - return ZINT_ERROR_FILE_WRITE; + return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 960, "Failure on closing PNG output file (%1$d: %2$s)", + fmp->err, strerror(fmp->err)); } return 0; diff --git a/backend/postal.c b/backend/postal.c index 0c551b8b..6476704f 100644 --- a/backend/postal.c +++ b/backend/postal.c @@ -125,7 +125,7 @@ static int usps_set_height(struct zint_symbol *symbol, const int no_errtxt) { if (symbol->height < 4.6f || symbol->height > 9.0f) { error_number = ZINT_WARN_NONCOMPLIANT; if (!no_errtxt) { - strcpy(symbol->errtxt, "498: Height not compliant with standards"); + errtxt(0, symbol, 498, "Height not compliant with standards"); } } } @@ -143,24 +143,23 @@ static int postnet_enc(struct zint_symbol *symbol, const unsigned char source[], int error_number = 0; if (length > 38) { - strcpy(symbol->errtxt, "480: Input too long (38 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 480, "Input length %d too long (maximum 38)", length); } if (symbol->symbology == BARCODE_CEPNET) { if (length != 8) { - strcpy(symbol->errtxt, "780: Input is wrong length (should be 8 digits)"); - error_number = ZINT_WARN_NONCOMPLIANT; + error_number = errtxtf(ZINT_WARN_NONCOMPLIANT, symbol, 780, "Input length %d wrong (should be 8 digits)", + length); } } else { if (length != 5 && length != 9 && length != 11) { - strcpy(symbol->errtxt, "479: Input length is not standard (5, 9 or 11 characters)"); - error_number = ZINT_WARN_NONCOMPLIANT; + error_number = errtxtf(ZINT_WARN_NONCOMPLIANT, symbol, 479, + "Input length %d is not standard (5, 9 or 11)", length); } } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "481: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 481, + "Invalid character at position %d in input (digits only)", i); } sum = 0; @@ -187,7 +186,8 @@ static int postnet_enc(struct zint_symbol *symbol, const unsigned char source[], /* Puts POSTNET barcodes into the pattern matrix */ INTERNAL int postnet(struct zint_symbol *symbol, unsigned char source[], int length) { - char height_pattern[256]; /* 5 + 38 * 5 + 5 + 5 + 1 = 206 */ + /* Suppress clang-tidy-20 garbage value false positive by initializing (see "vector.c" `vection_add_rect()`) */ + char height_pattern[256] = {0}; /* 5 + 38 * 5 + 5 + 5 + 1 = 206 */ unsigned int loopey, h; int writer; int error_number, warn_number; @@ -219,16 +219,15 @@ static int planet_enc(struct zint_symbol *symbol, const unsigned char source[], int error_number = 0; if (length > 38) { - strcpy(symbol->errtxt, "482: Input too long (38 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 482, "Input length %d too long (maximum 38)", length); } if (length != 11 && length != 13) { - strcpy(symbol->errtxt, "478: Input length is not standard (11 or 13 characters)"); - error_number = ZINT_WARN_NONCOMPLIANT; + error_number = errtxtf(ZINT_WARN_NONCOMPLIANT, symbol, 478, "Input length %d is not standard (11 or 13)", + length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "483: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 483, + "Invalid character at position %d in input (digits only)", i); } sum = 0; @@ -255,7 +254,8 @@ static int planet_enc(struct zint_symbol *symbol, const unsigned char source[], /* Puts PLANET barcodes into the pattern matrix */ INTERNAL int planet(struct zint_symbol *symbol, unsigned char source[], int length) { - char height_pattern[256]; /* 5 + 38 * 5 + 5 + 5 + 1 = 206 */ + /* Suppress clang-tidy-20 garbage value false positive by initializing (see "vector.c" `vection_add_rect()`) */ + char height_pattern[256] = {0}; /* 5 + 38 * 5 + 5 + 5 + 1 = 206 */ unsigned int loopey, h; int writer; int error_number, warn_number; @@ -283,27 +283,26 @@ INTERNAL int planet(struct zint_symbol *symbol, unsigned char source[], int leng /* Korean Postal Authority */ INTERNAL int koreapost(struct zint_symbol *symbol, unsigned char source[], int length) { - int total, loop, check, zeroes, error_number = 0; + int total, i, check, zeroes, error_number = 0; char localstr[8], dest[80]; char *d = dest; int posns[6]; if (length > 6) { - strcpy(symbol->errtxt, "484: Input too long (6 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 484, "Input length %d too long (maximum 6)", length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "485: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 485, + "Invalid character at position %d in input (digits only)", i); } zeroes = 6 - length; memset(localstr, '0', zeroes); ustrcpy(localstr + zeroes, source); total = 0; - for (loop = 0; loop < 6; loop++) { - posns[loop] = ctoi(localstr[loop]); - total += posns[loop]; + for (i = 0; i < 6; i++) { + posns[i] = ctoi(localstr[i]); + total += posns[i]; } check = 10 - (total % 10); if (check == 10) { @@ -312,8 +311,8 @@ INTERNAL int koreapost(struct zint_symbol *symbol, unsigned char source[], int l localstr[6] = itoc(check); localstr[7] = '\0'; - for (loop = 5; loop >= 0; loop--) { - const char *const entry = KoreaTable[posns[loop]]; + for (i = 5; i >= 0; i--) { + const char *const entry = KoreaTable[posns[i]]; memcpy(d, entry, 10); d += entry[8] ? 10 : 8; } @@ -335,8 +334,7 @@ INTERNAL int fim(struct zint_symbol *symbol, unsigned char source[], int length) int error_number = 0; if (length > 1) { - strcpy(symbol->errtxt, "486: Input too long (1 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 486, "Input length %d too long (maximum 1)", length); } switch ((char) source[0]) { @@ -361,8 +359,8 @@ INTERNAL int fim(struct zint_symbol *symbol, unsigned char source[], int length) expand(symbol, "1317131", 7); break; default: - strcpy(symbol->errtxt, "487: Invalid character in data (\"A\", \"B\", \"C\", \"D\" or \"E\" only)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 487, + "Invalid character in input (\"A\", \"B\", \"C\", \"D\" or \"E\" only)"); break; } @@ -406,8 +404,7 @@ INTERNAL int daft_set_height(struct zint_symbol *symbol, const float min_height, if (symbol->output_options & COMPLIANT_HEIGHT) { if ((min_height && symbol->height < min_height) || (max_height && symbol->height > max_height)) { - error_number = ZINT_WARN_NONCOMPLIANT; - strcpy(symbol->errtxt, "499: Height not compliant with standards"); + error_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 499, "Height not compliant with standards"); } } @@ -453,6 +450,7 @@ static void rm4scc_enc(const struct zint_symbol *symbol, const int *posns, char /* Puts RM4SCC into the data matrix */ INTERNAL int rm4scc(struct zint_symbol *symbol, unsigned char source[], int length) { + int i; char height_pattern[210]; int posns[50]; int loopey, h; @@ -460,13 +458,12 @@ INTERNAL int rm4scc(struct zint_symbol *symbol, unsigned char source[], int leng int error_number = 0; if (length > 50) { - strcpy(symbol->errtxt, "488: Input too long (50 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 488, "Input length %d too long (maximum 50)", length); } to_upper(source, length); - if (!is_sane_lookup(KRSET, 36, source, length, posns)) { - strcpy(symbol->errtxt, "489: Invalid character in data (alphanumerics only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane_lookup(KRSET, 36, source, length, posns))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 489, + "Invalid character at position %d in input (alphanumerics only)", i); } rm4scc_enc(symbol, posns, height_pattern, length); @@ -519,13 +516,12 @@ INTERNAL int kix(struct zint_symbol *symbol, unsigned char source[], int length) int error_number = 0; if (length > 18) { - strcpy(symbol->errtxt, "490: Input too long (18 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 490, "Input length %d too long (maximum 18)", length); } to_upper(source, length); - if (!is_sane_lookup(KRSET, 36, source, length, posns)) { - strcpy(symbol->errtxt, "491: Invalid character in data (alphanumerics only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane_lookup(KRSET, 36, source, length, posns))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 491, + "Invalid character at position %d in input (alphanumerics only)", i); } /* Encode data */ @@ -567,19 +563,19 @@ INTERNAL int kix(struct zint_symbol *symbol, unsigned char source[], int length) /* Handles DAFT Code symbols */ INTERNAL int daft(struct zint_symbol *symbol, unsigned char source[], int length) { + int i; int posns[576]; int loopey; int writer; if (length > 576) { /* 576 * 2 = 1152 */ - strcpy(symbol->errtxt, "492: Input too long (576 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 492, "Input length %d too long (maximum 576)", length); } to_upper(source, length); - if (!is_sane_lookup(DAFTSET, 4, source, length, posns)) { - strcpy(symbol->errtxt, "493: Invalid character in data (\"D\", \"A\", \"F\" and \"T\" only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane_lookup(DAFTSET, 4, source, length, posns))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 493, + "Invalid character at position %d in input (\"D\", \"A\", \"F\" and \"T\" only)", i); } writer = 0; @@ -617,21 +613,20 @@ INTERNAL int daft(struct zint_symbol *symbol, unsigned char source[], int length /* Flattermarken - Not really a barcode symbology! */ INTERNAL int flat(struct zint_symbol *symbol, unsigned char source[], int length) { - int loop, error_number = 0; + int i, error_number = 0; char dest[512]; /* 128 * 4 = 512 */ char *d = dest; if (length > 128) { /* 128 * 9 = 1152 */ - strcpy(symbol->errtxt, "494: Input too long (128 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 494, "Input length %d too long (maximum 128)", length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "495: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 495, + "Invalid character at position %d in input (digits only)", i); } - for (loop = 0; loop < length; loop++) { - const char *const entry = FlatTable[source[loop] - '0']; + for (i = 0; i < length; i++) { + const char *const entry = FlatTable[source[i] - '0']; memcpy(d, entry, 4); d += entry[2] ? 4 : 2; } @@ -653,15 +648,14 @@ INTERNAL int japanpost(struct zint_symbol *symbol, unsigned char source[], int l char inter[20 + 1]; if (length > 20) { - strcpy(symbol->errtxt, "496: Input too long (20 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 496, "Input length %d too long (maximum 20)", length); } to_upper(source, length); - if (!is_sane(SHKASUTSET_F, source, length)) { - strcpy(symbol->errtxt, "497: Invalid character in data (alphanumerics and \"-\" only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(SHKASUTSET_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 497, + "Invalid character at position %d in input (alphanumerics and \"-\" only)", i); } memset(inter, 'd', 20); /* Pad character CC4 */ inter[20] = '\0'; @@ -689,8 +683,8 @@ INTERNAL int japanpost(struct zint_symbol *symbol, unsigned char source[], int l } while ((i < length) && (inter_posn < 20)); if (i != length || inter[20] != '\0') { - strcpy(symbol->errtxt, "477: Input too long (20 symbol character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxt(ZINT_ERROR_TOO_LONG, symbol, 477, + "Input too long, requires too many symbol characters (maximum 20)"); } memcpy(d, "13", 2); /* Start */ diff --git a/backend/ps.c b/backend/ps.c index 16ca75c7..5ff2ac4a 100644 --- a/backend/ps.c +++ b/backend/ps.c @@ -178,7 +178,6 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) { float red_paper = 0.0f, green_paper = 0.0f, blue_paper = 0.0f; float cyan_ink = 0.0f, magenta_ink = 0.0f, yellow_ink = 0.0f, black_ink = 0.0f; float cyan_paper = 0.0f, magenta_paper = 0.0f, yellow_paper = 0.0f, black_paper = 0.0f; - int error_number = 0; float previous_diameter; float radius; int colour_rect_flag; @@ -196,12 +195,11 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) { const int is_rgb = (symbol->output_options & CMYK_COLOUR) == 0; if (symbol->vector == NULL) { - strcpy(symbol->errtxt, "646: Vector header NULL"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 646, "Vector header NULL"); } if (!fm_open(fmp, symbol, "w")) { - sprintf(symbol->errtxt, "645: Could not open output file (%d: %.30s)", fmp->err, strerror(fmp->err)); - return ZINT_ERROR_FILE_ACCESS; + return errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 645, "Could not open EPS output file (%1$d: %2$s)", fmp->err, + strerror(fmp->err)); } if (is_rgb) { @@ -509,17 +507,17 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) { } if (fm_error(fmp)) { - sprintf(symbol->errtxt, "647: Incomplete write to output (%d: %.30s)", fmp->err, strerror(fmp->err)); + errtxtf(0, symbol, 647, "Incomplete write of EPS output (%1$d: %2$s)", fmp->err, strerror(fmp->err)); (void) fm_close(fmp, symbol); return ZINT_ERROR_FILE_WRITE; } if (!fm_close(fmp, symbol)) { - sprintf(symbol->errtxt, "649: Failure on closing output file (%d: %.30s)", fmp->err, strerror(fmp->err)); - return ZINT_ERROR_FILE_WRITE; + return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 649, "Failure on closing EPS output file (%1$d: %2$s)", + fmp->err, strerror(fmp->err)); } - return error_number; + return 0; } /* vim: set ts=4 sw=4 et : */ diff --git a/backend/qr.c b/backend/qr.c index 0a62a5d3..39425e2b 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -40,10 +40,10 @@ #define QR_ALPHA (IS_NUM_F | IS_UPR_F | IS_SPC_F | IS_AST_F | IS_PLS_F | IS_MNS_F | IS_SIL_F | IS_CLI_F) -#define QR_LEVEL_L 1 -#define QR_LEVEL_M 2 -#define QR_LEVEL_Q 3 -#define QR_LEVEL_H 4 +#define QR_LEVEL_L 0 +#define QR_LEVEL_M 1 +#define QR_LEVEL_Q 2 +#define QR_LEVEL_H 3 static const char qr_ecc_level_names[] = { 'L', 'M', 'Q', 'H' }; @@ -411,7 +411,7 @@ static int qr_terminator_bits(const int version) { if (version < MICROQR_VERSION) { return 3; /* RMQR */ } - return 3 + (version - MICROQR_VERSION) * 2; /* MICROQR (Note not actually using this at the moment) */ + return 3 + (version - MICROQR_VERSION) * 2; /* MICROQR */ } /* Convert input data to a binary stream and add padding */ @@ -913,8 +913,8 @@ static void qr_place_align(unsigned char grid[], const int size, int x, int y) { static void qr_setup_grid(unsigned char *grid, const int size, const int version) { int i, toggle = 1; -/* Suppress false positive gcc-13 warning (when optimizing only) "writing 1 byte into a region of size 0" */ -#if defined(__GNUC__) && __GNUC__ == 13 +/* Suppress false positive gcc >= 13 warning (when optimizing only) "writing 1 byte into a region of size 0" */ +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 13 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstringop-overflow" #endif @@ -950,7 +950,7 @@ static void qr_setup_grid(unsigned char *grid, const int size, const int version grid[(7 * size) + (size - 8)] = 0x10; grid[((size - 8) * size) + 7] = 0x10; -#if defined(__GNUC__) && __GNUC__ == 13 +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 13 #pragma GCC diagnostic pop #endif @@ -1612,8 +1612,7 @@ static int qr_prep_data(struct zint_symbol *symbol, struct zint_seg segs[], cons if (error_number == 0) { done = 1; } else if (segs[i].eci || seg_count > 1) { - sprintf(symbol->errtxt, "575: Invalid character in input data for ECI %d", segs[i].eci); - return error_number; + return errtxtf(error_number, symbol, 575, "Invalid character in input for ECI '%d'", segs[i].eci); } } if (!done) { @@ -1623,8 +1622,8 @@ static int qr_prep_data(struct zint_symbol *symbol, struct zint_seg segs[], cons return error_number; } if (segs[i].eci != 20) { - strcpy(symbol->errtxt, "760: Converted to Shift JIS but no ECI specified"); - warn_number = ZINT_WARN_NONCOMPLIANT; + warn_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 760, + "Converted to Shift JIS but no ECI specified"); } } dd += segs[i].length; @@ -1669,12 +1668,13 @@ INTERNAL int qrcode(struct zint_symbol *symbol, struct zint_seg segs[], const in if (symbol->structapp.count) { if (symbol->structapp.count < 2 || symbol->structapp.count > 16) { - strcpy(symbol->errtxt, "750: Structured Append count out of range (2-16)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 750, + "Structured Append count '%d' out of range (2 to 16)", symbol->structapp.count); } if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { - sprintf(symbol->errtxt, "751: Structured Append index out of range (1-%d)", symbol->structapp.count); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 751, + "Structured Append index '%1$d' out of range (1 to count %2$d)", + symbol->structapp.index, symbol->structapp.count); } if (symbol->structapp.id[0]) { int id, id_len; @@ -1682,18 +1682,17 @@ INTERNAL int qrcode(struct zint_symbol *symbol, struct zint_seg segs[], const in for (id_len = 1; id_len < 4 && symbol->structapp.id[id_len]; id_len++); if (id_len > 3) { /* Max value 255 */ - strcpy(symbol->errtxt, "752: Structured Append ID too long (3 digit maximum)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 752, + "Structured Append ID length %d too long (3 digit maximum)", id_len); } id = to_int((const unsigned char *) symbol->structapp.id, id_len); if (id == -1) { - strcpy(symbol->errtxt, "753: Invalid Structured Append ID (digits only)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 753, "Invalid Structured Append ID (digits only)"); } if (id > 255) { - sprintf(symbol->errtxt, "754: Structured Append ID '%d' out of range (0-255)", id); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 754, + "Structured Append ID value '%d' out of range (0 to 255)", id); } } p_structapp = &symbol->structapp; @@ -1704,66 +1703,41 @@ INTERNAL int qrcode(struct zint_symbol *symbol, struct zint_seg segs[], const in if (gs1 && warn_number == 0) { for (i = 0; i < seg_count; i++) { if (local_segs[i].eci) { - strcpy(symbol->errtxt, "755: Using ECI in GS1 mode not supported by GS1 standards"); - warn_number = ZINT_WARN_NONCOMPLIANT; + warn_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 755, + "Using ECI in GS1 mode not supported by GS1 standards"); break; } } if (warn_number == 0 && p_structapp) { - strcpy(symbol->errtxt, "756: Using Structured Append in GS1 mode not supported by GS1 standards"); - warn_number = ZINT_WARN_NONCOMPLIANT; + warn_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 756, + "Using Structured Append in GS1 mode not supported by GS1 standards"); } } est_binlen = qr_calc_binlen_segs(40, mode, ddata, local_segs, seg_count, p_structapp, 0 /*mode_preset*/, gs1, debug_print); - ecc_level = QR_LEVEL_L; - max_cw = 2956; if ((symbol->option_1 >= 1) && (symbol->option_1 <= 4)) { - switch (symbol->option_1) { - case 1: - break; - case 2: ecc_level = QR_LEVEL_M; - max_cw = 2334; - break; - case 3: ecc_level = QR_LEVEL_Q; - max_cw = 1666; - break; - case 4: ecc_level = QR_LEVEL_H; - max_cw = 1276; - break; - } + ecc_level = symbol->option_1 - 1; + } else { + ecc_level = QR_LEVEL_L; } + max_cw = qr_data_codewords[ecc_level][39]; if (est_binlen > (8 * max_cw)) { - strcpy(symbol->errtxt, "561: Input too long for selected error correction level"); - return ZINT_ERROR_TOO_LONG; + if (ecc_level == QR_LEVEL_L) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 567, "Input too long, requires %1$d codewords (maximum %2$d)", + (est_binlen + 7) / 8, max_cw); + } + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 561, + "Input too long for ECC level %1$c, requires %2$d codewords (maximum %3$d)", + qr_ecc_level_names[ecc_level], (est_binlen + 7) / 8, max_cw); } autosize = 40; for (i = 39; i >= 0; i--) { - switch (ecc_level) { - case QR_LEVEL_L: - if ((8 * qr_data_codewords_L[i]) >= est_binlen) { - autosize = i + 1; - } - break; - case QR_LEVEL_M: - if ((8 * qr_data_codewords_M[i]) >= est_binlen) { - autosize = i + 1; - } - break; - case QR_LEVEL_Q: - if ((8 * qr_data_codewords_Q[i]) >= est_binlen) { - autosize = i + 1; - } - break; - case QR_LEVEL_H: - if ((8 * qr_data_codewords_H[i]) >= est_binlen) { - autosize = i + 1; - } - break; + if ((8 * qr_data_codewords[ecc_level][i]) >= est_binlen) { + autosize = i + 1; } } if (autosize != 40) { @@ -1793,27 +1767,8 @@ INTERNAL int qrcode(struct zint_symbol *symbol, struct zint_seg segs[], const in est_binlen = qr_calc_binlen_segs(autosize - 1, mode, ddata, local_segs, seg_count, p_structapp, 0 /*mode_preset*/, gs1, debug_print); - switch (ecc_level) { - case QR_LEVEL_L: - if ((8 * qr_data_codewords_L[autosize - 2]) < est_binlen) { - canShrink = 0; - } - break; - case QR_LEVEL_M: - if ((8 * qr_data_codewords_M[autosize - 2]) < est_binlen) { - canShrink = 0; - } - break; - case QR_LEVEL_Q: - if ((8 * qr_data_codewords_Q[autosize - 2]) < est_binlen) { - canShrink = 0; - } - break; - case QR_LEVEL_H: - if ((8 * qr_data_codewords_H[autosize - 2]) < est_binlen) { - canShrink = 0; - } - break; + if ((8 * qr_data_codewords[ecc_level][autosize - 2]) < est_binlen) { + canShrink = 0; } if (canShrink == 1) { @@ -1841,42 +1796,31 @@ INTERNAL int qrcode(struct zint_symbol *symbol, struct zint_seg segs[], const in } if (symbol->option_2 < version) { - strcpy(symbol->errtxt, "569: Input too long for selected symbol size"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 569, + "Input too long for Version %1$d-%2$c, requires %3$d codewords (maximum %4$d)", + symbol->option_2, qr_ecc_level_names[ecc_level], (est_binlen + 7) / 8, + qr_data_codewords[ecc_level][symbol->option_2 - 1]); } } /* Ensure maxium error correction capacity unless user-specified */ - if (symbol->option_1 == -1 || symbol->option_1 != ecc_level) { - if (est_binlen <= qr_data_codewords_M[version - 1] * 8) { - ecc_level = QR_LEVEL_M; - } - if (est_binlen <= qr_data_codewords_Q[version - 1] * 8) { - ecc_level = QR_LEVEL_Q; - } - if (est_binlen <= qr_data_codewords_H[version - 1] * 8) { + if (symbol->option_1 == -1 || symbol->option_1 - 1 != ecc_level) { + if (est_binlen <= qr_data_codewords[QR_LEVEL_H][version - 1] * 8) { ecc_level = QR_LEVEL_H; + } else if (est_binlen <= qr_data_codewords[QR_LEVEL_Q][version - 1] * 8) { + ecc_level = QR_LEVEL_Q; + } else if (est_binlen <= qr_data_codewords[QR_LEVEL_M][version - 1] * 8) { + ecc_level = QR_LEVEL_M; } } - target_codewords = qr_data_codewords_L[version - 1]; - blocks = qr_blocks_L[version - 1]; - switch (ecc_level) { - case QR_LEVEL_M: target_codewords = qr_data_codewords_M[version - 1]; - blocks = qr_blocks_M[version - 1]; - break; - case QR_LEVEL_Q: target_codewords = qr_data_codewords_Q[version - 1]; - blocks = qr_blocks_Q[version - 1]; - break; - case QR_LEVEL_H: target_codewords = qr_data_codewords_H[version - 1]; - blocks = qr_blocks_H[version - 1]; - break; - } + target_codewords = qr_data_codewords[ecc_level][version - 1]; + blocks = qr_blocks[ecc_level][version - 1]; if (debug_print) { printf("Minimum codewords: %d\n", (est_binlen + 7) / 8); printf("Selected version: %d-%c (%dx%d)\n", - version, qr_ecc_level_names[ecc_level - 1], qr_sizes[version - 1], qr_sizes[version - 1]); + version, qr_ecc_level_names[ecc_level], qr_sizes[version - 1], qr_sizes[version - 1]); printf("Number of data codewords in symbol: %d\n", target_codewords); printf("Number of ECC blocks: %d\n", blocks); } @@ -1925,164 +1869,83 @@ INTERNAL int qrcode(struct zint_symbol *symbol, struct zint_seg segs[], const in return warn_number; } -static int micro_qr_m1(struct zint_symbol *symbol, char binary_data[], int bp) { - int i, j, latch; - int bits_total, bits_left; - int data_codewords, ecc_codewords; - unsigned char data_blocks[4], ecc_blocks[3]; +/* Write terminator, padding & ECC */ +static int microqr_end(struct zint_symbol *symbol, char binary_data[], int bp, const int ecc_level, + const int version) { + int i, j; + int bits_left; + unsigned char data_blocks[17]; + unsigned char ecc_blocks[15]; rs_t rs; - bits_total = 20; - latch = 0; + const int terminator_bits = qr_terminator_bits(MICROQR_VERSION + version); + const int bits_total = microqr_data[ecc_level][version][0]; + const int data_codewords = microqr_data[ecc_level][version][1]; + const int ecc_codewords = microqr_data[ecc_level][version][2]; + const int bits_end = version == 0 || version == 2 ? 4 : 8; /* Add terminator */ bits_left = bits_total - bp; - if (bits_left <= 3) { + if (bits_left <= terminator_bits) { if (bits_left) { bp = bin_append_posn(0, bits_left, binary_data, bp); + bits_left = 0; } - latch = 1; } else { - bp = bin_append_posn(0, 3, binary_data, bp); + bp = bin_append_posn(0, terminator_bits, binary_data, bp); + bits_left -= terminator_bits; } if (symbol->debug & ZINT_DEBUG_PRINT) { - printf("M1 Terminated binary (%d): %.*s (bits_left %d)\n", bp, bp, binary_data, bits_left); + printf("M%d Terminated binary (%d): %.*s (bits_left %d)\n", version + 1, bp, bp, binary_data, bits_left); } - if (latch == 0) { - /* Manage last (4-bit) block */ - bits_left = bits_total - bp; - if (bits_left <= 4) { - if (bits_left) { - bp = bin_append_posn(0, bits_left, binary_data, bp); - } - latch = 1; - } + /* Manage last (4-bit) block */ + if (bits_end == 4 && bits_left && bits_left <= 4) { + bp = bin_append_posn(0, bits_left, binary_data, bp); + bits_left = 0; } - if (latch == 0) { + if (bits_left) { /* Complete current byte */ int remainder = 8 - (bp % 8); if (remainder != 8) { bp = bin_append_posn(0, remainder, binary_data, bp); + bits_left -= remainder; } /* Add padding */ - bits_left = bits_total - bp; - if (bits_left > 4) { - remainder = (bits_left - 4) / 8; - for (i = 0; i < remainder; i++) { - bp = bin_append_posn(i & 1 ? 0x11 : 0xEC, 8, binary_data, bp); - } + if (bits_end == 4 && bits_left > 4) { + bits_left -= 4; } - bp = bin_append_posn(0, 4, binary_data, bp); - } - - data_codewords = 3; - ecc_codewords = 2; - - /* Copy data into codewords */ - for (i = 0; i < (data_codewords - 1); i++) { - data_blocks[i] = 0; - for (j = 0; j < 8; j++) { - if (binary_data[(i * 8) + j] == '1') { - data_blocks[i] |= 0x80 >> j; - } - } - } - data_blocks[2] = 0; - for (j = 0; j < 4; j++) { - if (binary_data[16 + j] == '1') { - data_blocks[2] |= 0x80 >> j; - } - } -#ifdef ZINT_TEST - if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, data_blocks, data_codewords); -#endif - - /* Calculate Reed-Solomon error codewords */ - rs_init_gf(&rs, 0x11d); - rs_init_code(&rs, ecc_codewords, 0); - rs_encode(&rs, data_codewords, data_blocks, ecc_blocks); - - /* Add Reed-Solomon codewords to binary data */ - for (i = 0; i < ecc_codewords; i++) { - bp = bin_append_posn(ecc_blocks[ecc_codewords - i - 1], 8, binary_data, bp); - } - - return bp; -} - -static int micro_qr_m2(struct zint_symbol *symbol, char binary_data[], int bp, const int ecc_mode) { - int i, j, latch; - int bits_total = 0, bits_left; - int data_codewords = 0, ecc_codewords = 0; - unsigned char data_blocks[6], ecc_blocks[7]; - rs_t rs; - - latch = 0; - - if (ecc_mode == QR_LEVEL_L) { - bits_total = 40; - } - else if (ecc_mode == QR_LEVEL_M) { - bits_total = 32; - } - else assert(0); - - /* Add terminator */ - bits_left = bits_total - bp; - if (bits_left <= 5) { - if (bits_left) { - bp = bin_append_posn(0, bits_left, binary_data, bp); - } - latch = 1; - } else { - bp = bin_append_posn(0, 5, binary_data, bp); - } - - if (symbol->debug & ZINT_DEBUG_PRINT) { - printf("M2 Terminated binary (%d): %.*s (bits_left %d)\n", bp, bp, binary_data, bits_left); - } - - if (latch == 0) { - /* Complete current byte */ - int remainder = 8 - (bp % 8); - if (remainder != 8) { - bp = bin_append_posn(0, remainder, binary_data, bp); - } - - /* Add padding */ - bits_left = bits_total - bp; remainder = bits_left / 8; for (i = 0; i < remainder; i++) { bp = bin_append_posn(i & 1 ? 0x11 : 0xEC, 8, binary_data, bp); } + if (bits_end == 4) { + bp = bin_append_posn(0, 4, binary_data, bp); + } } - - if (ecc_mode == QR_LEVEL_L) { - data_codewords = 5; - ecc_codewords = 5; - } - else if (ecc_mode == QR_LEVEL_M) { - data_codewords = 4; - ecc_codewords = 6; - } - else assert(0); + assert((bp & 0x07) == 8 - bits_end); /* Copy data into codewords */ for (i = 0; i < data_codewords; i++) { + const int bits = i + 1 == data_codewords ? bits_end : 8; data_blocks[i] = 0; - for (j = 0; j < 8; j++) { + for (j = 0; j < bits; j++) { if (binary_data[(i * 8) + j] == '1') { data_blocks[i] |= 0x80 >> j; } } } #ifdef ZINT_TEST - if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, data_blocks, data_codewords); + if (symbol->debug & ZINT_DEBUG_TEST) { + char bp_buf[10]; + debug_test_codeword_dump(symbol, data_blocks, data_codewords); + sprintf(bp_buf, "%d", bp); /* Append `bp` to detect padding errors */ + errtxt_adj(0, symbol, "%s (%s)", bp_buf); + } #endif /* Calculate Reed-Solomon error codewords */ @@ -2098,214 +1961,7 @@ static int micro_qr_m2(struct zint_symbol *symbol, char binary_data[], int bp, c return bp; } -static int micro_qr_m3(struct zint_symbol *symbol, char binary_data[], int bp, const int ecc_mode) { - int i, j, latch; - int bits_total = 0, bits_left; - int data_codewords = 0, ecc_codewords = 0; - unsigned char data_blocks[12], ecc_blocks[9]; - rs_t rs; - - latch = 0; - - if (ecc_mode == QR_LEVEL_L) { - bits_total = 84; - } - else if (ecc_mode == QR_LEVEL_M) { - bits_total = 68; - } - else assert(0); - - /* Add terminator */ - bits_left = bits_total - bp; - if (bits_left <= 7) { - if (bits_left) { - bp = bin_append_posn(0, bits_left, binary_data, bp); - } - latch = 1; - } else { - bp = bin_append_posn(0, 7, binary_data, bp); - } - - if (symbol->debug & ZINT_DEBUG_PRINT) { - printf("M3 Terminated binary (%d): %.*s (bits_left %d)\n", bp, bp, binary_data, bits_left); - } - - if (latch == 0) { - /* Manage last (4-bit) block */ - bits_left = bits_total - bp; - if (bits_left <= 4) { - if (bits_left) { - bp = bin_append_posn(0, bits_left, binary_data, bp); - } - latch = 1; - } - } - - if (latch == 0) { - /* Complete current byte */ - int remainder = 8 - (bp % 8); - if (remainder != 8) { - bp = bin_append_posn(0, remainder, binary_data, bp); - } - - /* Add padding */ - bits_left = bits_total - bp; - if (bits_left > 4) { - remainder = (bits_left - 4) / 8; - for (i = 0; i < remainder; i++) { - bp = bin_append_posn(i & 1 ? 0x11 : 0xEC, 8, binary_data, bp); - } - } - bp = bin_append_posn(0, 4, binary_data, bp); - } - - if (ecc_mode == QR_LEVEL_L) { - data_codewords = 11; - ecc_codewords = 6; - } - else if (ecc_mode == QR_LEVEL_M) { - data_codewords = 9; - ecc_codewords = 8; - } - else assert(0); - - /* Copy data into codewords */ - for (i = 0; i < (data_codewords - 1); i++) { - data_blocks[i] = 0; - - for (j = 0; j < 8; j++) { - if (binary_data[(i * 8) + j] == '1') { - data_blocks[i] |= 0x80 >> j; - } - } - } - - if (ecc_mode == QR_LEVEL_L) { - data_blocks[10] = 0; - for (j = 0; j < 4; j++) { - if (binary_data[80 + j] == '1') { - data_blocks[10] |= 0x80 >> j; - } - } - } - - if (ecc_mode == QR_LEVEL_M) { - data_blocks[8] = 0; - for (j = 0; j < 4; j++) { - if (binary_data[64 + j] == '1') { - data_blocks[8] |= 0x80 >> j; - } - } - } -#ifdef ZINT_TEST - if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, data_blocks, data_codewords); -#endif - - /* Calculate Reed-Solomon error codewords */ - rs_init_gf(&rs, 0x11d); - rs_init_code(&rs, ecc_codewords, 0); - rs_encode(&rs, data_codewords, data_blocks, ecc_blocks); - - /* Add Reed-Solomon codewords to binary data */ - for (i = 0; i < ecc_codewords; i++) { - bp = bin_append_posn(ecc_blocks[ecc_codewords - i - 1], 8, binary_data, bp); - } - - return bp; -} - -static int micro_qr_m4(struct zint_symbol *symbol, char binary_data[], int bp, const int ecc_mode) { - int i, j, latch; - int bits_total = 0, bits_left; - int data_codewords = 0, ecc_codewords = 0; - unsigned char data_blocks[17], ecc_blocks[15]; - rs_t rs; - - latch = 0; - - if (ecc_mode == QR_LEVEL_L) { - bits_total = 128; - } - else if (ecc_mode == QR_LEVEL_M) { - bits_total = 112; - } - else if (ecc_mode == QR_LEVEL_Q) { - bits_total = 80; - } - else assert(0); - - /* Add terminator */ - bits_left = bits_total - bp; - if (bits_left <= 9) { - if (bits_left) { - bp = bin_append_posn(0, bits_left, binary_data, bp); - } - latch = 1; - } else { - bp = bin_append_posn(0, 9, binary_data, bp); - } - - if (symbol->debug & ZINT_DEBUG_PRINT) { - printf("M4 Terminated binary (%d): %.*s (bits_left %d)\n", bp, bp, binary_data, bits_left); - } - - if (latch == 0) { - /* Complete current byte */ - int remainder = 8 - (bp % 8); - if (remainder != 8) { - bp = bin_append_posn(0, remainder, binary_data, bp); - } - - /* Add padding */ - bits_left = bits_total - bp; - remainder = bits_left / 8; - for (i = 0; i < remainder; i++) { - bp = bin_append_posn(i & 1 ? 0x11 : 0xEC, 8, binary_data, bp); - } - } - - if (ecc_mode == QR_LEVEL_L) { - data_codewords = 16; - ecc_codewords = 8; - } - else if (ecc_mode == QR_LEVEL_M) { - data_codewords = 14; - ecc_codewords = 10; - } - else if (ecc_mode == QR_LEVEL_Q) { - data_codewords = 10; - ecc_codewords = 14; - } - else assert(0); - - /* Copy data into codewords */ - for (i = 0; i < data_codewords; i++) { - data_blocks[i] = 0; - - for (j = 0; j < 8; j++) { - if (binary_data[(i * 8) + j] == '1') { - data_blocks[i] |= 0x80 >> j; - } - } - } -#ifdef ZINT_TEST - if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, data_blocks, data_codewords); -#endif - - /* Calculate Reed-Solomon error codewords */ - rs_init_gf(&rs, 0x11d); - rs_init_code(&rs, ecc_codewords, 0); - rs_encode(&rs, data_codewords, data_blocks, ecc_blocks); - - /* Add Reed-Solomon codewords to binary data */ - for (i = 0; i < ecc_codewords; i++) { - bp = bin_append_posn(ecc_blocks[ecc_codewords - i - 1], 8, binary_data, bp); - } - - return bp; -} - -static void micro_setup_grid(unsigned char *grid, const int size) { +static void microqr_setup_grid(unsigned char *grid, const int size) { int i, toggle = 1; /* Add timing patterns */ @@ -2340,7 +1996,7 @@ static void micro_setup_grid(unsigned char *grid, const int size) { grid[(8 * size) + 8] |= 20; } -static void micro_populate_grid(unsigned char *grid, const int size, const char full_stream[], int bp) { +static void microqr_populate_grid(unsigned char *grid, const int size, const char full_stream[], int bp) { int direction = 1; /* up */ int row = 0; /* right hand side */ int i; @@ -2391,7 +2047,7 @@ static void micro_populate_grid(unsigned char *grid, const int size, const char } while (i < bp); } -static int micro_evaluate(const unsigned char *grid, const int size, const int pattern) { +static int microqr_evaluate(const unsigned char *grid, const int size, const int pattern) { int sum1, sum2, i, filter = 0, retval; switch (pattern) { @@ -2425,7 +2081,7 @@ static int micro_evaluate(const unsigned char *grid, const int size, const int p return retval; } -static int micro_apply_bitmask(unsigned char *grid, const int size, const int user_mask, const int debug_print) { +static int microqr_apply_bitmask(unsigned char *grid, const int size, const int user_mask, const int debug_print) { int x, y; int r, k; int bit; @@ -2476,7 +2132,7 @@ static int micro_apply_bitmask(unsigned char *grid, const int size, const int us /* Evaluate result */ best_pattern = 0; for (pattern = 0; pattern < 4; pattern++) { - value[pattern] = micro_evaluate(eval, size, pattern); + value[pattern] = microqr_evaluate(eval, size, pattern); if (value[pattern] > value[best_pattern]) { best_pattern = pattern; } @@ -2495,11 +2151,7 @@ static int micro_apply_bitmask(unsigned char *grid, const int size, const int us bit = 1 << best_pattern; for (k = 0; k < size_squared; k++) { if (mask[k] & bit) { - if (grid[k] & 0x01) { - grid[k] = 0x00; - } else { - grid[k] = 0x01; - } + grid[k] ^= 0x01; } } @@ -2518,7 +2170,7 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len int alpha_used = 0, byte_or_kanji_used = 0; int version_valid[4]; int binary_count[4]; - int ecc_level, autoversion, version; + int ecc_level, version; int bitmask, format, format_full; int size_squared; struct zint_seg segs[1]; @@ -2527,28 +2179,25 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len unsigned char *grid; if (length > 35) { - strcpy(symbol->errtxt, "562: Input data too long"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 562, "Input length %d too long (maximum 35)", length); } /* Check option 1 in combination with option 2 */ ecc_level = QR_LEVEL_L; if (symbol->option_1 >= 1 && symbol->option_1 <= 4) { if (symbol->option_1 == 4) { - strcpy(symbol->errtxt, "566: Error correction level H not available"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 566, "Error correction level H not available"); } if (symbol->option_2 >= 1 && symbol->option_2 <= 4) { if (symbol->option_2 == 1 && symbol->option_1 != 1) { - strcpy(symbol->errtxt, "574: Version M1 supports error correction level L only"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 574, + "Version M1 supports error correction level L only"); } if (symbol->option_2 != 4 && symbol->option_1 == 3) { - strcpy(symbol->errtxt, "563: Error correction level Q requires Version M4"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 563, "Error correction level Q requires Version M4"); } } - ecc_level = symbol->option_1; + ecc_level = symbol->option_1 - 1; } /* If ZINT_FULL_MULTIBYTE use Kanji mode in DATA_MODE or for non-Shift JIS in UNICODE_MODE */ @@ -2618,87 +2267,55 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len } } - /* Eliminate possible versions depending on length of binary data */ - if (binary_count[0] > 20) { - version_valid[0] = 0; - } - if (binary_count[1] > 40) { - version_valid[1] = 0; - } - if (binary_count[2] > 84) { - version_valid[2] = 0; - } - if (binary_count[3] > 128) { - strcpy(symbol->errtxt, "565: Input data too long"); - return ZINT_ERROR_TOO_LONG; - } - /* Eliminate possible versions depending on binary length and error correction level specified */ - if (ecc_level == QR_LEVEL_Q) { - if (binary_count[3] > 80) { - strcpy(symbol->errtxt, "567: Input data too long"); - return ZINT_ERROR_TOO_LONG; - } - } else if (ecc_level == QR_LEVEL_M) { - if (binary_count[1] > 32) { - version_valid[1] = 0; - } - if (binary_count[2] > 68) { - version_valid[2] = 0; - } - if (binary_count[3] > 112) { - strcpy(symbol->errtxt, "568: Input data too long"); - return ZINT_ERROR_TOO_LONG; + if (binary_count[3] > microqr_data[ecc_level][3][0]) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 565, + "Input too long for Version M4-%1$c, requires %2$d codewords (maximum %3$d)", + qr_ecc_level_names[ecc_level], (binary_count[3] + 7) / 8, microqr_data[ecc_level][3][1]); + } + for (i = 0; i < 3; i++) { + if (binary_count[i] > microqr_data[ecc_level][i][0]) { + version_valid[i] = 0; } } - autoversion = 3; + /* Auto-select lowest valid size */ + version = 3; if (version_valid[2]) { - autoversion = 2; + version = 2; } if (version_valid[1]) { - autoversion = 1; + version = 1; } if (version_valid[0]) { - autoversion = 0; + version = 0; } - version = autoversion; /* Get version from user */ if ((symbol->option_2 >= 1) && (symbol->option_2 <= 4)) { - if (symbol->option_2 == 1 && !is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "758: Invalid character in data for Version M1 (digits only)"); - return ZINT_ERROR_INVALID_DATA; - } else if (symbol->option_2 == 2 && !is_sane(QR_ALPHA, source, length)) { - strcpy(symbol->errtxt, - "759: Invalid character in data for Version M2 (digits, A-Z, space and \"$%*+-./:\" only)"); - return ZINT_ERROR_INVALID_DATA; + if (symbol->option_2 == 1 && (i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 758, + "Invalid character at position %d in input for Version M1 (digits only)", i); + } else if (symbol->option_2 == 2 && not_sane(QR_ALPHA, source, length)) { + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 759, + "Invalid character in input for Version M2 (digits, A-Z, space and \"$%*+-./:\" only)"); } - if (symbol->option_2 - 1 >= autoversion) { + if (symbol->option_2 - 1 >= version) { version = symbol->option_2 - 1; } else { - strcpy(symbol->errtxt, "570: Input too long for selected symbol size"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 570, + "Input too long for Version M%1$d-%2$c, requires %3$d codewords (maximum %4$d)", + symbol->option_2, qr_ecc_level_names[ecc_level], (binary_count[version] + 7) / 8, + microqr_data[ecc_level][symbol->option_2 - 1][1]); } } /* If there is enough unused space then increase the error correction level, unless user-specified */ - if (symbol->option_1 == -1 || symbol->option_1 != ecc_level) { - if (version == 3) { - if (binary_count[3] <= 112) { - ecc_level = QR_LEVEL_M; - } - if (binary_count[3] <= 80) { - ecc_level = QR_LEVEL_Q; - } - } else if (version == 2) { - if (binary_count[2] <= 68) { - ecc_level = QR_LEVEL_M; - } - } else if (version == 1) { - if (binary_count[1] <= 32) { - ecc_level = QR_LEVEL_M; - } + if (version && (symbol->option_1 == -1 || symbol->option_1 - 1 != ecc_level)) { + if (binary_count[version] <= microqr_data[QR_LEVEL_Q][version][0]) { + ecc_level = QR_LEVEL_Q; + } else if (binary_count[version] <= microqr_data[QR_LEVEL_M][version][0]) { + ecc_level = QR_LEVEL_M; } } @@ -2709,106 +2326,33 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len if (debug_print) printf("Binary (%d): %.*s\n", bp, bp, full_stream); - switch (version) { - case 0: bp = micro_qr_m1(symbol, full_stream, bp); - break; - case 1: bp = micro_qr_m2(symbol, full_stream, bp, ecc_level); - break; - case 2: bp = micro_qr_m3(symbol, full_stream, bp, ecc_level); - break; - case 3: bp = micro_qr_m4(symbol, full_stream, bp, ecc_level); - break; - } + bp = microqr_end(symbol, full_stream, bp, ecc_level, version); - size = micro_qr_sizes[version]; + size = microqr_sizes[version]; size_squared = size * size; grid = (unsigned char *) z_alloca(size_squared); memset(grid, 0, size_squared); - micro_setup_grid(grid, size); - micro_populate_grid(grid, size, full_stream, bp); - bitmask = micro_apply_bitmask(grid, size, user_mask, debug_print); + microqr_setup_grid(grid, size); + microqr_populate_grid(grid, size, full_stream, bp); + bitmask = microqr_apply_bitmask(grid, size, user_mask, debug_print); /* Add format data */ - format = 0; - switch (version) { - case 1: switch (ecc_level) { - case 1: format = 1; - break; - case 2: format = 2; - break; - } - break; - case 2: switch (ecc_level) { - case 1: format = 3; - break; - case 2: format = 4; - break; - } - break; - case 3: switch (ecc_level) { - case 1: format = 5; - break; - case 2: format = 6; - break; - case 3: format = 7; - break; - } - break; - } + format = version ? (version - 1) * 2 + ecc_level + 1 : 0; if (debug_print) { printf("Version: M%d-%c, Size: %dx%d, Format: %d\n", - version + 1, qr_ecc_level_names[ecc_level - 1], size, size, format); + version + 1, qr_ecc_level_names[ecc_level], size, size, format); } format_full = qr_annex_c1[(format << 2) + bitmask]; - if (format_full & 0x4000) { - grid[(8 * size) + 1] |= 0x01; + for (i = 1; i <= 8; i++) { + grid[(8 * size) + i] |= (format_full >> (15 - i)) & 0x01; } - if (format_full & 0x2000) { - grid[(8 * size) + 2] |= 0x01; - } - if (format_full & 0x1000) { - grid[(8 * size) + 3] |= 0x01; - } - if (format_full & 0x800) { - grid[(8 * size) + 4] |= 0x01; - } - if (format_full & 0x400) { - grid[(8 * size) + 5] |= 0x01; - } - if (format_full & 0x200) { - grid[(8 * size) + 6] |= 0x01; - } - if (format_full & 0x100) { - grid[(8 * size) + 7] |= 0x01; - } - if (format_full & 0x80) { - grid[(8 * size) + 8] |= 0x01; - } - if (format_full & 0x40) { - grid[(7 * size) + 8] |= 0x01; - } - if (format_full & 0x20) { - grid[(6 * size) + 8] |= 0x01; - } - if (format_full & 0x10) { - grid[(5 * size) + 8] |= 0x01; - } - if (format_full & 0x08) { - grid[(4 * size) + 8] |= 0x01; - } - if (format_full & 0x04) { - grid[(3 * size) + 8] |= 0x01; - } - if (format_full & 0x02) { - grid[(2 * size) + 8] |= 0x01; - } - if (format_full & 0x01) { - grid[(1 * size) + 8] |= 0x01; + for (i = 7; i >= 1; i--) { + grid[(i * size) + 8] |= (format_full >> (i - 1)) & 0x01; } symbol->width = size; @@ -2861,14 +2405,13 @@ INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int lengt } break; case GS1_MODE: /* Should never happen as checked before being called */ - strcpy(symbol->errtxt, "571: UPNQR does not support GS1 data"); /* Not reached */ - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 571, + "UPNQR does not support GS1 data"); /* Not reached */ break; case UNICODE_MODE: error_number = utf8_to_eci(4, source, preprocessed, &length); if (error_number != 0) { - strcpy(symbol->errtxt, "572: Invalid character in input data for ECI 4"); - return error_number; + return errtxt(error_number, symbol, 572, "Invalid character in input for ECI '4'"); } for (i = 0; i < length; i++) { ddata[i] = preprocessed[i]; @@ -2887,14 +2430,14 @@ INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int lengt ecc_level = QR_LEVEL_M; if (est_binlen > 3320) { - strcpy(symbol->errtxt, "573: Input too long for selected symbol"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 573, "Input too long, requires %d codewords (maximum 415)", + (est_binlen + 7) / 8); } version = 15; /* 77 x 77 */ - target_codewords = qr_data_codewords_M[version - 1]; - blocks = qr_blocks_M[version - 1]; + target_codewords = qr_data_codewords[ecc_level][version - 1]; + blocks = qr_blocks[ecc_level][version - 1]; datastream = (unsigned char *) z_alloca(target_codewords + 1); fullstream = (unsigned char *) z_alloca(qr_total_codewords[version - 1] + 1); @@ -2938,6 +2481,14 @@ INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int lengt return 0; } +static const char rmqr_version_names[38][8] = { + "R7x43", "R7x59", "R7x77", "R7x99", "R7x139", "R9x43", "R9x59", "R9x77", + "R9x99", "R9x139", "R11x27", "R11x43", "R11x59", "R11x77", "R11x99", "R11x139", + "R13x27", "R13x43", "R13x59", "R13x77", "R13x99", "R13x139", "R15x43", "R15x59", + "R15x77", "R15x99", "R15x139", "R17x43", "R17x59", "R17x77", "R17x99", "R17x139", + "R7xW", "R9xW", "R11xW", "R13xW", "R15xW", "R17xW", +}; + static void rmqr_setup_grid(unsigned char *grid, const int h_size, const int v_size) { int i, j; char alignment[] = {0x1F, 0x11, 0x15, 0x11, 0x1F}; @@ -3069,6 +2620,18 @@ INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int unsigned char *fullstream; unsigned char *grid; + if (symbol->option_1 == 1) { + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 576, "Error correction level L not available in rMQR"); + } + if (symbol->option_1 == 3) { + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 577, "Error correction level Q not available in rMQR"); + } + + if ((symbol->option_2 < 0) || (symbol->option_2 > 38)) { + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 579, "Version '%d' out of range (1 to 38)", + symbol->option_2); + } + segs_cpy(symbol, segs, seg_count, local_segs); warn_number = qr_prep_data(symbol, local_segs, seg_count, ddata); @@ -3081,8 +2644,8 @@ INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int if (gs1 && warn_number == 0) { for (i = 0; i < seg_count; i++) { if (local_segs[i].eci) { - strcpy(symbol->errtxt, "757: Using ECI in GS1 mode not supported by GS1 standards"); - warn_number = ZINT_WARN_NONCOMPLIANT; + warn_number = errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 757, + "Using ECI in GS1 mode not supported by GS1 standards"); break; } } @@ -3091,31 +2654,13 @@ INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int est_binlen = qr_calc_binlen_segs(RMQR_VERSION + 31, mode, ddata, local_segs, seg_count, NULL /*p_structapp*/, 0 /*mode_preset*/, gs1, debug_print); - ecc_level = QR_LEVEL_M; - max_cw = 152; - if (symbol->option_1 == 1) { - strcpy(symbol->errtxt, "576: Error correction level L not available in rMQR"); - return ZINT_ERROR_INVALID_OPTION; - } - - if (symbol->option_1 == 3) { - strcpy(symbol->errtxt, "577: Error correction level Q not available in rMQR"); - return ZINT_ERROR_INVALID_OPTION; - } - - if (symbol->option_1 == 4) { - ecc_level = QR_LEVEL_H; - max_cw = 76; - } + ecc_level = symbol->option_1 == 4 ? QR_LEVEL_H : QR_LEVEL_M; + max_cw = rmqr_data_codewords[ecc_level >> 1][31]; if (est_binlen > (8 * max_cw)) { - strcpy(symbol->errtxt, "578: Input too long for selected error correction level"); - return ZINT_ERROR_TOO_LONG; - } - - if ((symbol->option_2 < 0) || (symbol->option_2 > 38)) { - strcpy(symbol->errtxt, "579: Invalid rMQR symbol size"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 578, + "Input too long for ECC level %1$c, requires %2$d codewords (maximum %3$d)", + qr_ecc_level_names[ecc_level], (est_binlen + 7) / 8, max_cw); } version = 31; /* Set default to keep compiler happy */ @@ -3128,19 +2673,10 @@ INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int est_binlen = qr_calc_binlen_segs(RMQR_VERSION + version, mode, ddata, local_segs, seg_count, NULL /*p_structapp*/, 0 /*mode_preset*/, gs1, debug_print); footprint = rmqr_height[version] * rmqr_width[version]; - if (ecc_level == QR_LEVEL_M) { - if (8 * rmqr_data_codewords_M[version] >= est_binlen) { - if (footprint < best_footprint) { - autosize = version; - best_footprint = footprint; - } - } - } else { - if (8 * rmqr_data_codewords_H[version] >= est_binlen) { - if (footprint < best_footprint) { - autosize = version; - best_footprint = footprint; - } + if (8 * rmqr_data_codewords[ecc_level >> 1][version] >= est_binlen) { + if (footprint < best_footprint) { + autosize = version; + best_footprint = footprint; } } } @@ -3162,14 +2698,8 @@ INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int for (i = version - 1; i > rmqr_fixed_height_upper_bound[symbol->option_2 - 33]; i--) { est_binlen = qr_calc_binlen_segs(RMQR_VERSION + i, mode, ddata, local_segs, seg_count, NULL /*p_structapp*/, 0 /*mode_preset*/, gs1, debug_print); - if (ecc_level == QR_LEVEL_M) { - if (8 * rmqr_data_codewords_M[i] >= est_binlen) { - version = i; - } - } else { - if (8 * rmqr_data_codewords_H[i] >= est_binlen) { - version = i; - } + if (8 * rmqr_data_codewords[ecc_level >> 1][i] >= est_binlen) { + version = i; } } est_binlen = qr_calc_binlen_segs(RMQR_VERSION + version, mode, ddata, local_segs, seg_count, @@ -3178,29 +2708,27 @@ INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int if (symbol->option_1 == -1) { /* Detect if there is enough free space to increase ECC level */ - if (est_binlen < (rmqr_data_codewords_H[version] * 8)) { + if (est_binlen < rmqr_data_codewords[QR_LEVEL_H >> 1][version] * 8) { ecc_level = QR_LEVEL_H; } } - if (ecc_level == QR_LEVEL_M) { - target_codewords = rmqr_data_codewords_M[version]; - blocks = rmqr_blocks_M[version]; - } else { - target_codewords = rmqr_data_codewords_H[version]; - blocks = rmqr_blocks_H[version]; - } + target_codewords = rmqr_data_codewords[ecc_level >> 1][version]; + blocks = rmqr_blocks[ecc_level >> 1][version]; if (est_binlen > (target_codewords * 8)) { /* User has selected a symbol too small for the data */ - strcpy(symbol->errtxt, "560: Input too long for selected symbol size"); - return ZINT_ERROR_TOO_LONG; + assert(symbol->option_2 > 0); + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 560, + "Input too long for Version %1$d %2$s-%3$c, requires %4$d codewords (maximum %5$d)", + symbol->option_2, rmqr_version_names[symbol->option_2 - 1], qr_ecc_level_names[ecc_level], + (est_binlen + 7) / 8, target_codewords); } if (debug_print) { printf("Minimum codewords: %d\n", (est_binlen + 7) / 8); printf("Selected version: %d = R%dx%d-%c\n", - (version + 1), rmqr_height[version], rmqr_width[version], qr_ecc_level_names[ecc_level - 1]); + (version + 1), rmqr_height[version], rmqr_width[version], qr_ecc_level_names[ecc_level]); printf("Number of data codewords in symbol: %d\n", target_codewords); printf("Number of ECC blocks: %d\n", blocks); } @@ -3232,11 +2760,7 @@ INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int /* This is a data module */ if (((i / 2) + (j / 3)) % 2 == 0) { /* < This is the data mask from section 7.8.2 */ /* This module needs to be changed */ - if (grid[r + j] == 0x01) { - grid[r + j] = 0x00; - } else { - grid[r + j] = 0x01; - } + grid[r + j] ^= 0x01; } } } diff --git a/backend/qr.h b/backend/qr.h index f8c0a252..5e870b23 100644 --- a/backend/qr.h +++ b/backend/qr.h @@ -43,32 +43,27 @@ static const signed char qr_alphanumeric[59] = { }; /* From ISO/IEC 18004:2015 Table 7 - Number of symbol characters and input data capacity for QR Code */ -static const unsigned short qr_data_codewords_L[40] = { - 19, 34, 55, 80, 108, 136, 156, 194, 232, 274, - 324, 370, 428, 461, 523, 589, 647, 721, 795, 861, - 932, 1006, 1094, 1174, 1276, 1370, 1468, 1531, 1631, 1735, - 1843, 1955, 2071, 2191, 2306, 2434, 2566, 2702, 2812, 2956 -}; - -static const unsigned short qr_data_codewords_M[40] = { - 16, 28, 44, 64, 86, 108, 124, 154, 182, 216, - 254, 290, 334, 365, 415, 453, 507, 563, 627, 669, - 714, 782, 860, 914, 1000, 1062, 1128, 1193, 1267, 1373, - 1455, 1541, 1631, 1725, 1812, 1914, 1992, 2102, 2216, 2334 -}; - -static const unsigned short qr_data_codewords_Q[40] = { - 13, 22, 34, 48, 62, 76, 88, 110, 132, 154, - 180, 206, 244, 261, 295, 325, 367, 397, 445, 485, - 512, 568, 614, 664, 718, 754, 808, 871, 911, 985, - 1033, 1115, 1171, 1231, 1286, 1354, 1426, 1502, 1582, 1666 -}; - -static const unsigned short qr_data_codewords_H[40] = { - 9, 16, 26, 36, 46, 60, 66, 86, 100, 122, - 140, 158, 180, 197, 223, 253, 283, 313, 341, 385, - 406, 442, 464, 514, 538, 596, 628, 661, 701, 745, - 793, 845, 901, 961, 986, 1054, 1096, 1142, 1222, 1276 +static const unsigned short qr_data_codewords[4][40] = { { + 19, 34, 55, 80, 108, 136, 156, 194, 232, 274, /* L */ + 324, 370, 428, 461, 523, 589, 647, 721, 795, 861, + 932, 1006, 1094, 1174, 1276, 1370, 1468, 1531, 1631, 1735, + 1843, 1955, 2071, 2191, 2306, 2434, 2566, 2702, 2812, 2956 + }, { + 16, 28, 44, 64, 86, 108, 124, 154, 182, 216, /* M */ + 254, 290, 334, 365, 415, 453, 507, 563, 627, 669, + 714, 782, 860, 914, 1000, 1062, 1128, 1193, 1267, 1373, + 1455, 1541, 1631, 1725, 1812, 1914, 1992, 2102, 2216, 2334 + }, { + 13, 22, 34, 48, 62, 76, 88, 110, 132, 154, /* Q */ + 180, 206, 244, 261, 295, 325, 367, 397, 445, 485, + 512, 568, 614, 664, 718, 754, 808, 871, 911, 985, + 1033, 1115, 1171, 1231, 1286, 1354, 1426, 1502, 1582, 1666 + }, { + 9, 16, 26, 36, 46, 60, 66, 86, 100, 122, /* H */ + 140, 158, 180, 197, 223, 253, 283, 313, 341, 385, + 406, 442, 464, 514, 538, 596, 628, 661, 701, 745, + 793, 845, 901, 961, 986, 1054, 1096, 1142, 1222, 1276 + } }; /* From ISO/IEC 18004:2015 Table 1 - Codeword capacity of all versions of QRCode */ @@ -99,22 +94,21 @@ static const unsigned char rmqr_width[32] = { }; /* From ISO/IEC 23941:2022 Table 6 - Number of data codewords and input data capacity for rMQR */ -static const unsigned char rmqr_data_codewords_M[32] = { - 6, 12, 20, 28, 44, /* R7x */ - 12, 21, 31, 42, 63, /* R9x */ - 7, 19, 31, 43, 57, 84, /* R11x */ - 12, 27, 38, 53, 73, 106, /* R13x */ - 33, 48, 67, 88, 127, /* R15x */ - 39, 56, 78, 100, 152 /* R17x */ -}; - -static const unsigned char rmqr_data_codewords_H[32] = { - 3, 7, 10, 14, 24, /* R7x */ - 7, 11, 17, 22, 33, /* R9x */ - 5, 11, 15, 23, 29, 42, /* R11x */ - 7, 13, 20, 29, 35, 54, /* R13x */ - 15, 26, 31, 48, 69, /* R15x */ - 21, 28, 38, 56, 76 /* R17x */ +static const unsigned char rmqr_data_codewords[2][32] = { { + 6, 12, 20, 28, 44, /* R7x */ /* M */ + 12, 21, 31, 42, 63, /* R9x */ + 7, 19, 31, 43, 57, 84, /* R11x */ + 12, 27, 38, 53, 73, 106, /* R13x */ + 33, 48, 67, 88, 127, /* R15x */ + 39, 56, 78, 100, 152 /* R17x */ + }, { + 3, 7, 10, 14, 24, /* R7x */ /* H */ + 7, 11, 17, 22, 33, /* R9x */ + 5, 11, 15, 23, 29, 42, /* R11x */ + 7, 13, 20, 29, 35, 54, /* R13x */ + 15, 26, 31, 48, 69, /* R15x */ + 21, 28, 38, 56, 76 /* R17x */ + } }; /* Highest index in `rmqr_total_codewords` for each given row (R7x, R9x etc) */ @@ -170,54 +164,48 @@ static const unsigned char rmqr_kanji_cci[32] = { }; /* From ISO/IEC 18004:2015 Table 9 - Error correction characteristics for QR Code */ -static const char qr_blocks_L[40] = { - 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, - 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, - 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, - 16, 17, 18, 19, 19, 20, 21, 22, 24, 25 -}; - -static const char qr_blocks_M[40] = { - 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, - 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, - 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, - 31, 33, 35, 37, 38, 40, 43, 45, 47, 49 -}; - -static const char qr_blocks_Q[40] = { - 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, - 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, - 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, - 43, 45, 48, 51, 53, 56, 59, 62, 65, 68 -}; - -static const char qr_blocks_H[40] = { - 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, - 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, - 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, - 51, 54, 57, 60, 63, 66, 70, 74, 77, 81 +static const char qr_blocks[4][40] = { { + 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, /* L */ + 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, + 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, + 16, 17, 18, 19, 19, 20, 21, 22, 24, 25 + }, { + 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, /* M */ + 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, + 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, + 31, 33, 35, 37, 38, 40, 43, 45, 47, 49 + }, { + 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, /* Q */ + 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, + 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, + 43, 45, 48, 51, 53, 56, 59, 62, 65, 68 + }, { + 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, /* H */ + 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, + 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, + 51, 54, 57, 60, 63, 66, 70, 74, 77, 81 + } }; /* From ISO/IEC 23941:2022 Table 8 - Error correction characteristics for rMQR */ -static const char rmqr_blocks_M[32] = { - 1, 1, 1, 1, 1, /* R7x */ - 1, 1, 1, 1, 2, /* R9x */ - 1, 1, 1, 1, 2, 2, /* R11x */ - 1, 1, 1, 2, 2, 3, /* R13x */ - 1, 1, 2, 2, 3, /* R15x */ - 1, 2, 2, 3, 4 /* R17x */ +static const char rmqr_blocks[2][32] = { { + 1, 1, 1, 1, 1, /* R7x */ /* M */ + 1, 1, 1, 1, 2, /* R9x */ + 1, 1, 1, 1, 2, 2, /* R11x */ + 1, 1, 1, 2, 2, 3, /* R13x */ + 1, 1, 2, 2, 3, /* R15x */ + 1, 2, 2, 3, 4 /* R17x */ + }, { + 1, 1, 1, 1, 2, /* R7x */ /* H */ + 1, 1, 2, 2, 3, /* R9x */ + 1, 1, 2, 2, 2, 3, /* R11x */ + 1, 1, 2, 2, 3, 4, /* R13x */ + 2, 2, 3, 4, 5, /* R15x */ + 2, 2, 3, 4, 6 /* R17x */ + } }; -static const char rmqr_blocks_H[32] = { - 1, 1, 1, 1, 2, /* R7x */ - 1, 1, 2, 2, 3, /* R9x */ - 1, 1, 2, 2, 2, 3, /* R11x */ - 1, 1, 2, 2, 3, 4, /* R13x */ - 2, 2, 3, 4, 5, /* R15x */ - 2, 2, 3, 4, 6 /* R17x */ -}; - -/* From ISO/IEC 18004:2015 Table 1 - Codeword capacity of all versions of QRCode */ +/* From ISO/IEC 18004:2015 Table 1 - Codeword capacity of all versions of QR Code */ static const unsigned char qr_sizes[40] = { 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, @@ -225,10 +213,22 @@ static const unsigned char qr_sizes[40] = { 141, 145, 149, 153, 157, 161, 165, 169, 173, 177 }; -static const char micro_qr_sizes[4] = { +static const char microqr_sizes[4] = { 11, 13, 15, 17 }; +/* From ISO/IEC 18004:2015 Table 7 - Number of symbol characters and input data capacity for QR Code and + Table 9 — Error correction characteristics for QR Code, M1-4 only, indexed by ecc_level & version as + { data bits, data codewords, ecc codewords } */ +static const unsigned char microqr_data[3][4][3] = { { + { 20, 3, 2 }, { 40, 5, 5 }, { 84, 11, 6 }, { 128, 16, 8 } /* L */ + }, { + { 0, 0, 0 }, { 32, 4, 6 }, { 68, 9, 8 }, { 112, 14, 10 } /* M */ + }, { + { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 80, 10, 14 } /* Q */ + } +}; + /* No. of entries in `qr_table_e1` (Table E.1) per version */ static const char qr_align_loopsize[40] = { 0, 2, 2, 2, 2, 2, 3, 3, 3, 3, diff --git a/backend/raster.c b/backend/raster.c index 7e9bf93c..0742a74d 100644 --- a/backend/raster.c +++ b/backend/raster.c @@ -113,15 +113,13 @@ static int buffer_plot(struct zint_symbol *symbol, const unsigned char *pixelbuf } if (!(symbol->bitmap = (unsigned char *) raster_malloc(bm_bitmap_size, 0 /*prev_size*/))) { - strcpy(symbol->errtxt, "661: Insufficient memory for bitmap buffer"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 661, "Insufficient memory for bitmap buffer"); } if (plot_alpha) { const size_t alpha_size = (size_t) symbol->bitmap_width * symbol->bitmap_height; if (!(symbol->alphamap = (unsigned char *) raster_malloc(alpha_size, bm_bitmap_size))) { - strcpy(symbol->errtxt, "662: Insufficient memory for alphamap buffer"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 662, "Insufficient memory for alphamap buffer"); } for (row = 0; row < symbol->bitmap_height; row++) { size_t p = (size_t) symbol->bitmap_width * row; @@ -182,8 +180,7 @@ static int save_raster_image_to_file(struct zint_symbol *symbol, const int image if (rotate_angle) { if (!(rotated_pixbuf = (unsigned char *) raster_malloc((size_t) image_width * image_height, 0 /*prev_size*/))) { - strcpy(symbol->errtxt, "650: Insufficient memory for pixel buffer"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 650, "Insufficient memory for pixel buffer"); } } @@ -783,16 +780,14 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, const int rotate_ang image_size = (size_t) image_width * image_height; if (!(pixelbuf = (unsigned char *) raster_malloc(image_size, 0 /*prev_size*/))) { - strcpy(symbol->errtxt, "655: Insufficient memory for pixel buffer"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 655, "Insufficient memory for pixel buffer"); } memset(pixelbuf, DEFAULT_PAPER, image_size); hex_size = (size_t) hex_width * hex_height; if (!(scaled_hexagon = (unsigned char *) raster_malloc(hex_size, image_size))) { - strcpy(symbol->errtxt, "656: Insufficient memory for pixel buffer"); free(pixelbuf); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 656, "Insufficient memory for pixel buffer"); } memset(scaled_hexagon, DEFAULT_PAPER, hex_size); @@ -828,8 +823,7 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, const int rotate_ang const float max_ratio = 1.177984f; /* 27.93 / 23.71 */ const float size_ratio = (float) hex_image_width / hex_image_height; if (size_ratio < min_ratio || size_ratio > max_ratio) { - strcpy(symbol->errtxt, "663: Size not within the minimum/maximum ranges"); - error_number = ZINT_WARN_NONCOMPLIANT; + return errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 663, "Size not within the minimum/maximum ranges"); } } return error_number; @@ -879,8 +873,7 @@ static int plot_raster_dotty(struct zint_symbol *symbol, const int rotate_angle, /* Apply scale options by creating pixel buffer */ if (!(scaled_pixelbuf = (unsigned char *) raster_malloc(scale_size, 0 /*prev_size*/))) { - strcpy(symbol->errtxt, "657: Insufficient memory for pixel buffer"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 657, "Insufficient memory for pixel buffer"); } memset(scaled_pixelbuf, DEFAULT_PAPER, scale_size); @@ -1045,8 +1038,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl image_size = (size_t) image_width * image_height; if (!(pixelbuf = (unsigned char *) raster_malloc(image_size, 0 /*prev_size*/))) { - strcpy(symbol->errtxt, "658: Insufficient memory for pixel buffer"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 658, "Insufficient memory for pixel buffer"); } memset(pixelbuf, DEFAULT_PAPER, image_size); @@ -1373,8 +1365,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl /* Apply scale options by creating another pixel buffer */ if (!(scaled_pixelbuf = (unsigned char *) raster_malloc((size_t) scale_width * scale_height, image_size))) { free(pixelbuf); - strcpy(symbol->errtxt, "659: Insufficient memory for scaled pixel buffer"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 659, "Insufficient memory for scaled pixel buffer"); } memset(scaled_pixelbuf, DEFAULT_PAPER, (size_t) scale_width * scale_height); @@ -1414,8 +1405,7 @@ INTERNAL int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_ #ifdef ZINT_NO_PNG if (file_type == OUT_PNG_FILE) { - strcpy(symbol->errtxt, "660: PNG format disabled at compile time"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 660, "PNG format disabled at compile time"); } #endif /* ZINT_NO_PNG */ @@ -1424,8 +1414,7 @@ INTERNAL int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_ return error; } if (symbol->rows <= 0) { - strcpy(symbol->errtxt, "664: No rows"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 664, "No rows"); } if (symbol->symbology == BARCODE_MAXICODE) { diff --git a/backend/rss.c b/backend/rss.c index beef7ba4..3e313917 100644 --- a/backend/rss.c +++ b/backend/rss.c @@ -247,7 +247,6 @@ static void dbar_omn_separator(struct zint_symbol *symbol, int width, const int /* Set Databar Stacked height, maintaining 5:7 ratio of the 2 main row heights */ INTERNAL int dbar_omnstk_set_height(struct zint_symbol *symbol, const int first_row) { - int error_number = 0; float fixed_height = 0.0f; int second_row = first_row + 2; /* 2 row separator */ int i; @@ -274,12 +273,11 @@ INTERNAL int dbar_omnstk_set_height(struct zint_symbol *symbol, const int first_ if (symbol->output_options & COMPLIANT_HEIGHT) { if (symbol->row_height[first_row] < 5.0f || symbol->row_height[second_row] < 7.0f) { - error_number = ZINT_WARN_NONCOMPLIANT; - strcpy(symbol->errtxt, "379: Height not compliant with standards"); + return errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 379, "Height not compliant with standards"); } } - return error_number; + return 0; } /* GS1 DataBar Omnidirectional/Truncated/Stacked, allowing for composite if `cc_rows` set */ @@ -296,19 +294,17 @@ INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int separator_row = 0; if (length > 14) { /* Allow check digit to be specified (will be verified and ignored) */ - strcpy(symbol->errtxt, "380: Input too long (14 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 380, "Input length %d too long (maximum 14)", length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "381: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 381, + "Invalid character at position %d in input (digits only)", i); } if (length == 14) { /* Verify check digit */ if (gs1_check_digit(source, 13) != source[13]) { - sprintf(symbol->errtxt, "388: Invalid check digit '%c', expecting '%c'", - source[13], gs1_check_digit(source, 13)); - return ZINT_ERROR_INVALID_CHECK; + return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 388, "Invalid check digit '%1$c', expecting '%2$c'", + source[13], gs1_check_digit(source, 13)); } length--; /* Ignore */ } @@ -633,27 +629,24 @@ INTERNAL int dbar_ltd_cc(struct zint_symbol *symbol, unsigned char source[], int separator_row = 0; if (length > 14) { /* Allow check digit to be specified (will be verified and ignored) */ - strcpy(symbol->errtxt, "382: Input too long (14 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 382, "Input length %d too long (maximum 14)", length); } - if (!is_sane(NEON_F, source, length)) { - strcpy(symbol->errtxt, "383: Invalid character in data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(NEON_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 383, + "Invalid character at position %d in input (digits only)", i); } if (length == 14) { /* Verify check digit */ if (gs1_check_digit(source, 13) != source[13]) { - sprintf(symbol->errtxt, "389: Invalid check digit '%c', expecting '%c'", - source[13], gs1_check_digit(source, 13)); - return ZINT_ERROR_INVALID_CHECK; + return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 389, "Invalid check digit '%1$c', expecting '%2$c'", + source[13], gs1_check_digit(source, 13)); } length--; /* Ignore */ } if (length == 13) { if ((source[0] != '0') && (source[0] != '1')) { - strcpy(symbol->errtxt, "384: Input out of range (0 to 1999999999999)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 384, "Input value out of range (0 to 1999999999999)"); } } @@ -842,6 +835,11 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha int remainder, d1, d2; int cdf_bp_start; /* Compressed data field start - debug only */ + if (length > 77) { /* ISO/IEC 24724:2011 4.2.d.2 */ + /* Caught below anyway but catch here also for better feedback */ + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 378, "Processed input length %d too long (maximum 77)", length); + } + /* Decide whether a compressed data field is required and if so what method to use - method 2 = no compressed data field */ @@ -968,8 +966,8 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha if (!z_isdigit(source[i])) { if (source[i] != '\x1D') { /* Something is wrong */ - strcpy(symbol->errtxt, "385: Invalid character in Compressed Field data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 385, + "Invalid character in Compressed Field data (digits only)"); } } } @@ -1064,8 +1062,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha if (j != 0) { /* If general field not empty */ if (!general_field_encode(general_field, j, &mode, &last_digit, binary_string, &bp)) { /* Will happen if character not in CSET 82 + space */ - strcpy(symbol->errtxt, "386: Invalid character in General Field data"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 386, "Invalid character in General Field data"); } } @@ -1134,8 +1131,8 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha } if (bp > 252) { /* 252 = (21 * 12) */ - strcpy(symbol->errtxt, "387: Input too long"); /* TODO: Better error message */ - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 387, /* TODO: Better error message */ + "Input too long, requires %d symbol characters (maximum 21)", (bp + 11) / 12); } if (min_cols_per_row && min_cols_per_row > *p_cols_per_row) { diff --git a/backend/svg.c b/backend/svg.c index 57329e74..f0b18a2b 100644 --- a/backend/svg.c +++ b/backend/svg.c @@ -1,7 +1,7 @@ /* svg.c - Scalable Vector Graphics */ /* libzint - the open source barcode library - Copyright (C) 2009-2023 Robin Stuart + Copyright (C) 2009-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -117,7 +117,6 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) { static const char upcean_font_family[] = "OCRB"; struct filemem fm; struct filemem *const fmp = &fm; - int error_number = 0; float previous_diameter; float radius, half_radius, half_sqrt3_radius; int i; @@ -173,12 +172,11 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) { /* Check for no created vector set */ /* E-Mail Christian Schmitz 2019-09-10: reason unknown Ticket #164 */ if (symbol->vector == NULL) { - strcpy(symbol->errtxt, "681: Vector header NULL"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 681, "Vector header NULL"); } if (!fm_open(fmp, symbol, "w")) { - sprintf(symbol->errtxt, "680: Could not open output file (%d: %.30s)", fmp->err, strerror(fmp->err)); - return ZINT_ERROR_FILE_ACCESS; + return errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 680, "Could not open SVG output file (%1$d: %2$s)", fmp->err, + strerror(fmp->err)); } /* Start writing the header */ @@ -346,17 +344,17 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) { "\n", fmp); if (fm_error(fmp)) { - sprintf(symbol->errtxt, "682: Incomplete write to output (%d: %.30s)", fmp->err, strerror(fmp->err)); + errtxtf(0, symbol, 682, "Incomplete write to SVG output (%1$d: %2$s)", fmp->err, strerror(fmp->err)); (void) fm_close(fmp, symbol); return ZINT_ERROR_FILE_WRITE; } if (!fm_close(fmp, symbol)) { - sprintf(symbol->errtxt, "684: Failure on closing output file (%d: %.30s)", fmp->err, strerror(fmp->err)); - return ZINT_ERROR_FILE_WRITE; + return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 684, "Failure on closing SVG output file (%1$d: %2$s)", + fmp->err, strerror(fmp->err)); } - return error_number; + return 0; } /* vim: set ts=4 sw=4 et : */ diff --git a/backend/telepen.c b/backend/telepen.c index 9ef16f0b..74629a3f 100644 --- a/backend/telepen.c +++ b/backend/telepen.c @@ -1,7 +1,7 @@ /* telepen.c - Handles Telepen and Telepen numeric */ /* libzint - the open source barcode library - Copyright (C) 2008-2023 Robin Stuart + Copyright (C) 2008-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -86,7 +86,7 @@ static const char TeleLens[128] = { 12, 10, 8, 14, 10, 12, 12, 12, 10, 14, 12, 12, 14, 12, 12, 16 }; -INTERNAL int telepen(struct zint_symbol *symbol, unsigned char source[], int src_len) { +INTERNAL int telepen(struct zint_symbol *symbol, unsigned char source[], int length) { int i, count, check_digit; int error_number; char dest[1145]; /* 12 (Start) + 69 * 16 (max for DELs) + 16 (Check) + 12 (stop) + 1 = 1145 */ @@ -96,19 +96,18 @@ INTERNAL int telepen(struct zint_symbol *symbol, unsigned char source[], int src count = 0; - if (src_len > 69) { /* 16 (Start) + 69 * 16 + 16 (Check) + 16 (Stop) = 1152 */ - strcpy(symbol->errtxt, "390: Input too long (69 character maximum)"); - return ZINT_ERROR_TOO_LONG; + if (length > 69) { /* 16 (Start) + 69 * 16 + 16 (Check) + 16 (Stop) = 1152 */ + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 390, "Input length %d too long (maximum 69)", length); } /* Start character */ memcpy(d, TeleTable['_'], 12); d += 12; - for (i = 0; i < src_len; i++) { + for (i = 0; i < length; i++) { if (source[i] > 127) { /* Cannot encode extended ASCII */ - strcpy(symbol->errtxt, "391: Invalid character in input data, extended ASCII not allowed"); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 391, + "Invalid character at position %d in input, extended ASCII not allowed", i + 1); } memcpy(d, TeleTable[source[i]], TeleLens[source[i]]); d += TeleLens[source[i]]; @@ -138,18 +137,18 @@ INTERNAL int telepen(struct zint_symbol *symbol, unsigned char source[], int src (void) set_height(symbol, 0.0f, 50.0f, 0, 1 /*no_errtxt*/); } - for (i = 0; i < src_len; i++) { + for (i = 0; i < length; i++) { if (source[i] == '\0') { symbol->text[i] = ' '; } else { symbol->text[i] = source[i]; } } - symbol->text[src_len] = '\0'; + symbol->text[length] = '\0'; return error_number; } -INTERNAL int telepen_num(struct zint_symbol *symbol, unsigned char source[], int src_len) { +INTERNAL int telepen_num(struct zint_symbol *symbol, unsigned char source[], int length) { int count, check_digit, glyph; int error_number = 0; int i; @@ -159,33 +158,32 @@ INTERNAL int telepen_num(struct zint_symbol *symbol, unsigned char source[], int count = 0; - if (src_len > 136) { /* 68*2 */ - strcpy(symbol->errtxt, "392: Input too long (136 character maximum)"); - return ZINT_ERROR_TOO_LONG; + if (length > 136) { /* 68*2 */ + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 392, "Input length %d too long (maximum 136)", length); } - if (!is_sane(SODIUM_X_F, source, src_len)) { - strcpy(symbol->errtxt, "393: Invalid character in data (digits and \"X\" only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(SODIUM_X_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 393, + "Invalid character at position %d in input (digits and \"X\" only)", i); } /* Add a leading zero if required */ - if (src_len & 1) { - memcpy(temp + 1, source, src_len++); + if (length & 1) { + memcpy(temp + 1, source, length++); temp[0] = '0'; } else { - memcpy(temp, source, src_len); + memcpy(temp, source, length); } - temp[src_len] = '\0'; - to_upper(temp, src_len); + temp[length] = '\0'; + to_upper(temp, length); /* Start character */ memcpy(d, TeleTable['_'], 12); d += 12; - for (i = 0; i < src_len; i += 2) { + for (i = 0; i < length; i += 2) { if (temp[i] == 'X') { - strcpy(symbol->errtxt, "394: Invalid position of X in Telepen data"); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 394, "Invalid odd position %d of \"X\" in Telepen data", + i + 1); } if (temp[i + 1] == 'X') { diff --git a/backend/tests/test_2of5.c b/backend/tests/test_2of5.c index 1c9e882f..316bceb6 100644 --- a/backend/tests/test_2of5.c +++ b/backend/tests/test_2of5.c @@ -42,37 +42,38 @@ static void test_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { BARCODE_C25STANDARD, -1, "1", 112, 0, 1, 1137 }, - /* 1*/ { BARCODE_C25STANDARD, -1, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { BARCODE_C25STANDARD, 1, "1", 112, 0, 1, 1147 }, - /* 3*/ { BARCODE_C25STANDARD, 1, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 4*/ { BARCODE_C25INTER, -1, "1", 125, 0, 1, 1143 }, - /* 5*/ { BARCODE_C25INTER, -1, "1", 126, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 6*/ { BARCODE_C25INTER, 1, "1", 125, 0, 1, 1143 }, - /* 7*/ { BARCODE_C25INTER, 1, "1", 126, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 8*/ { BARCODE_C25IATA, -1, "1", 80, 0, 1, 1129 }, - /* 9*/ { BARCODE_C25IATA, -1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 10*/ { BARCODE_C25IATA, 1, "1", 80, 0, 1, 1143 }, - /* 11*/ { BARCODE_C25IATA, 1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 12*/ { BARCODE_C25LOGIC, -1, "1", 113, 0, 1, 1139 }, - /* 13*/ { BARCODE_C25LOGIC, -1, "1", 114, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 14*/ { BARCODE_C25LOGIC, 1, "1", 113, 0, 1, 1149 }, - /* 15*/ { BARCODE_C25LOGIC, 1, "1", 114, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 16*/ { BARCODE_C25IND, -1, "1", 79, 0, 1, 1125 }, - /* 17*/ { BARCODE_C25IND, -1, "1", 80, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 18*/ { BARCODE_C25IND, 1, "1", 79, 0, 1, 1139 }, - /* 19*/ { BARCODE_C25IND, 1, "1", 80, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 20*/ { BARCODE_DPLEIT, -1, "1", 13, 0, 1, 135 }, - /* 21*/ { BARCODE_DPLEIT, -1, "1", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 22*/ { BARCODE_DPIDENT, -1, "1", 11, 0, 1, 117 }, - /* 23*/ { BARCODE_DPIDENT, -1, "1", 12, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 24*/ { BARCODE_ITF14, -1, "1", 13, 0, 1, 135 }, - /* 25*/ { BARCODE_ITF14, -1, "1", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, + static const struct item data[] = { + /* 0*/ { BARCODE_C25STANDARD, -1, "1", 112, 0, 1, 1137, "" }, + /* 1*/ { BARCODE_C25STANDARD, -1, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1, "Error 301: Input length 113 too long (maximum 112)" }, + /* 2*/ { BARCODE_C25STANDARD, 1, "1", 112, 0, 1, 1147, "" }, + /* 3*/ { BARCODE_C25STANDARD, 1, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1, "Error 301: Input length 113 too long (maximum 112)" }, + /* 4*/ { BARCODE_C25INTER, -1, "1", 125, 0, 1, 1143, "" }, + /* 5*/ { BARCODE_C25INTER, -1, "1", 126, ZINT_ERROR_TOO_LONG, -1, -1, "Error 309: Input length 126 too long (maximum 125)" }, + /* 6*/ { BARCODE_C25INTER, 1, "1", 125, 0, 1, 1143, "" }, + /* 7*/ { BARCODE_C25INTER, 1, "1", 126, ZINT_ERROR_TOO_LONG, -1, -1, "Error 309: Input length 126 too long (maximum 125)" }, + /* 8*/ { BARCODE_C25IATA, -1, "1", 80, 0, 1, 1129, "" }, + /* 9*/ { BARCODE_C25IATA, -1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1, "Error 305: Input length 81 too long (maximum 80)" }, + /* 10*/ { BARCODE_C25IATA, 1, "1", 80, 0, 1, 1143, "" }, + /* 11*/ { BARCODE_C25IATA, 1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1, "Error 305: Input length 81 too long (maximum 80)" }, + /* 12*/ { BARCODE_C25LOGIC, -1, "1", 113, 0, 1, 1139, "" }, + /* 13*/ { BARCODE_C25LOGIC, -1, "1", 114, ZINT_ERROR_TOO_LONG, -1, -1, "Error 307: Input length 114 too long (maximum 113)" }, + /* 14*/ { BARCODE_C25LOGIC, 1, "1", 113, 0, 1, 1149, "" }, + /* 15*/ { BARCODE_C25LOGIC, 1, "1", 114, ZINT_ERROR_TOO_LONG, -1, -1, "Error 307: Input length 114 too long (maximum 113)" }, + /* 16*/ { BARCODE_C25IND, -1, "1", 79, 0, 1, 1125, "" }, + /* 17*/ { BARCODE_C25IND, -1, "1", 80, ZINT_ERROR_TOO_LONG, -1, -1, "Error 303: Input length 80 too long (maximum 79)" }, + /* 18*/ { BARCODE_C25IND, 1, "1", 79, 0, 1, 1139, "" }, + /* 19*/ { BARCODE_C25IND, 1, "1", 80, ZINT_ERROR_TOO_LONG, -1, -1, "Error 303: Input length 80 too long (maximum 79)" }, + /* 20*/ { BARCODE_DPLEIT, -1, "1", 13, 0, 1, 135, "" }, + /* 21*/ { BARCODE_DPLEIT, -1, "1", 14, ZINT_ERROR_TOO_LONG, -1, -1, "Error 313: Input length 14 too long (maximum 13)" }, + /* 22*/ { BARCODE_DPIDENT, -1, "1", 11, 0, 1, 117, "" }, + /* 23*/ { BARCODE_DPIDENT, -1, "1", 12, ZINT_ERROR_TOO_LONG, -1, -1, "Error 315: Input length 12 too long (maximum 11)" }, + /* 24*/ { BARCODE_ITF14, -1, "1", 13, 0, 1, 135, "" }, + /* 25*/ { BARCODE_ITF14, -1, "1", 14, ZINT_ERROR_TOO_LONG, -1, -1, "Error 311: Input length 14 too long (maximum 13)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -94,6 +95,8 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -116,7 +119,7 @@ static void test_hrt(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_C25STANDARD, -1, "123456789", "123456789" }, /* 1*/ { BARCODE_C25STANDARD, 1, "123456789", "1234567895" }, /* 2*/ { BARCODE_C25STANDARD, 2, "123456789", "123456789" }, /* Suppresses printing of check digit */ @@ -142,7 +145,7 @@ static void test_hrt(const testCtx *const p_ctx) { /* 22*/ { BARCODE_ITF14, -1, "123456789", "00001234567895" }, /* Leading zeroes added to make 13 + appended checksum */ /* 23*/ { BARCODE_ITF14, -1, "1234567890123", "12345678901231" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -173,23 +176,28 @@ static void test_input(const testCtx *const p_ctx) { struct item { int symbology; + int input_mode; char *data; int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { BARCODE_C25STANDARD, "A", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 1*/ { BARCODE_C25INTER, "A", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 2*/ { BARCODE_C25IATA, "A", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 3*/ { BARCODE_C25LOGIC, "A", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 4*/ { BARCODE_C25IND, "A", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 5*/ { BARCODE_DPLEIT, "A", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 6*/ { BARCODE_DPIDENT, "A", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 7*/ { BARCODE_ITF14, "A", ZINT_ERROR_INVALID_DATA, -1, -1 }, + static const struct item data[] = { + /* 0*/ { BARCODE_C25STANDARD, -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 302: Invalid character at position 1 in input (digits only)" }, + /* 1*/ { BARCODE_C25STANDARD, -1, "1234A6", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 302: Invalid character at position 5 in input (digits only)" }, + /* 2*/ { BARCODE_C25STANDARD, ESCAPE_MODE, "\\d049234A6", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 302: Invalid character at position 5 in input (digits only)" }, /* TODO (maybe): position doesn't account for escapes */ + /* 3*/ { BARCODE_C25INTER, -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 310: Invalid character at position 1 in input (digits only)" }, + /* 4*/ { BARCODE_C25IATA, -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 306: Invalid character at position 1 in input (digits only)" }, + /* 5*/ { BARCODE_C25LOGIC, -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 308: Invalid character at position 1 in input (digits only)" }, + /* 6*/ { BARCODE_C25IND, -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 304: Invalid character at position 1 in input (digits only)" }, + /* 7*/ { BARCODE_DPLEIT, -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 314: Invalid character at position 1 in input (digits only)" }, + /* 8*/ { BARCODE_DPIDENT, -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 316: Invalid character at position 1 in input (digits only)" }, + /* 9*/ { BARCODE_DPIDENT, -1, "1234567890A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 316: Invalid character at position 11 in input (digits only)" }, + /* 10*/ { BARCODE_ITF14, -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 312: Invalid character at position 1 in input (digits only)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -202,10 +210,12 @@ static void test_input(const testCtx *const p_ctx) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, -1 /*output_options*/, data[i].data, -1, debug); + length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, -1 /*output_options*/, data[i].data, -1, debug); 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -233,7 +243,7 @@ static void test_encode(const testCtx *const p_ctx) { char *expected; }; /* BARCODE_ITF14 examples verified manually against GS1 General Specifications 21.0.1 */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_C25STANDARD, -1, "87654321", 0, 1, 97, "Standard Code 2 of 5; note zint uses 4X start/end wides while BWIPP uses 3X", "1111010101110100010101000111010001110101110111010101110111011100010101000101110111010111011110101" }, @@ -319,13 +329,13 @@ static void test_encode(const testCtx *const p_ctx) { "101010100011101110001011101011100010001011100010101011100010001011101110100011100010001110101010101110001110001011101010001000111011101" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); + int i, length, ret; + struct zint_symbol *symbol = NULL; char escaped[1024]; char cmp_buf[4096]; char cmp_msg[1024]; - int i, length, ret; - struct zint_symbol *symbol = NULL; 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 */ @@ -408,13 +418,13 @@ static void test_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_C25INTER, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 1, 819, "C25INTER 90" }, /* 1*/ { BARCODE_C25INTER, -1, "1234567890", 0, 1, 99, "C25INTER 10" }, /* 2*/ { BARCODE_C25STANDARD, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 1, 817, "C25STANDARD 80" }, /* 3*/ { BARCODE_C25STANDARD, -1, "1234567890", 0, 1, 117, "C25STANDARD 10" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; diff --git a/backend/tests/test_auspost.c b/backend/tests/test_auspost.c index 260c988d..c9f57d4d 100644 --- a/backend/tests/test_auspost.c +++ b/backend/tests/test_auspost.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2022 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -43,7 +43,7 @@ static void test_large(const testCtx *const p_ctx) { int expected_width; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_AUSPOST, "1", 23, 0, 3, 133 }, /* 1*/ { BARCODE_AUSPOST, "1", 24, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 2*/ { BARCODE_AUSPOST, "1", 18, 0, 3, 133 }, @@ -61,13 +61,13 @@ static void test_large(const testCtx *const p_ctx) { /* 14*/ { BARCODE_AUSREDIRECT, "1", 8, 0, 3, 73 }, /* 15*/ { BARCODE_AUSREDIRECT, "1", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char data_buf[64]; - testStart("test_large"); + testStartSymbol("test_large", &symbol); for (i = 0; i < data_size; i++) { @@ -105,14 +105,14 @@ static void test_hrt(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_AUSPOST, "12345678901234567890123", "" }, /* None */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_hrt"); + testStartSymbol("test_hrt", &symbol); for (i = 0; i < data_size; i++) { @@ -146,39 +146,39 @@ static void test_input(const testCtx *const p_ctx) { char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_AUSPOST, "12345678", 0, 3, 73, "" }, - /* 1*/ { BARCODE_AUSPOST, "1234567A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 405: Invalid character in DPID (first 8 characters) (digits only)" }, + /* 1*/ { BARCODE_AUSPOST, "1234567A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 405: Invalid character at position 8 in DPID (first 8 characters) (digits only)" }, /* 2*/ { BARCODE_AUSPOST, "12345678ABcd#", 0, 3, 103, "" }, - /* 3*/ { BARCODE_AUSPOST, "12345678ABcd!", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 404: Invalid character in data (alphanumerics, space and \"#\" only)" }, + /* 3*/ { BARCODE_AUSPOST, "12345678ABcd!", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 404: Invalid character at position 13 in input (alphanumerics, space and \"#\" only)" }, /* 4*/ { BARCODE_AUSPOST, "12345678ABcd#", 0, 3, 103, "" }, /* 5*/ { BARCODE_AUSPOST, "1234567890123456", 0, 3, 103, "" }, - /* 6*/ { BARCODE_AUSPOST, "123456789012345A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 402: Invalid character in data (digits only for length 16)" }, + /* 6*/ { BARCODE_AUSPOST, "123456789012345A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 402: Invalid character at position 16 in input (digits only for FCC 59 length 16)" }, /* 7*/ { BARCODE_AUSPOST, "12345678ABCDefgh #", 0, 3, 133, "" }, /* Length 18 */ /* 8*/ { BARCODE_AUSPOST, "12345678901234567890123", 0, 3, 133, "" }, - /* 9*/ { BARCODE_AUSPOST, "1234567890123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 406: Invalid character in data (digits only for length 23)" }, - /* 10*/ { BARCODE_AUSPOST, "1234567", ZINT_ERROR_TOO_LONG, -1, -1, "Error 401: Input wrong length (8, 13, 16, 18 or 23 characters only)" }, /* No leading zeroes added */ + /* 9*/ { BARCODE_AUSPOST, "1234567890123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 406: Invalid character at position 23 in input (digits only for FCC 62 length 23)" }, + /* 10*/ { BARCODE_AUSPOST, "1234567", ZINT_ERROR_TOO_LONG, -1, -1, "Error 401: Input length 7 wrong (8, 13, 16, 18 or 23 only)" }, /* No leading zeroes added */ /* 11*/ { BARCODE_AUSREPLY, "12345678", 0, 3, 73, "" }, /* 12*/ { BARCODE_AUSREPLY, "1234567", 0, 3, 73, "" }, /* Leading zeroes added */ - /* 13*/ { BARCODE_AUSREPLY, "123456789", ZINT_ERROR_TOO_LONG, -1, -1, "Error 403: Input too long (8 character maximum)" }, + /* 13*/ { BARCODE_AUSREPLY, "123456789", ZINT_ERROR_TOO_LONG, -1, -1, "Error 403: Input length 9 too long (maximum 8)" }, /* 14*/ { BARCODE_AUSROUTE, "123456", 0, 3, 73, "" }, /* 15*/ { BARCODE_AUSROUTE, "12345", 0, 3, 73, "" }, - /* 16*/ { BARCODE_AUSROUTE, "123456789", ZINT_ERROR_TOO_LONG, -1, -1, "Error 403: Input too long (8 character maximum)" }, + /* 16*/ { BARCODE_AUSROUTE, "123456789", ZINT_ERROR_TOO_LONG, -1, -1, "Error 403: Input length 9 too long (maximum 8)" }, /* 17*/ { BARCODE_AUSREDIRECT, "1234", 0, 3, 73, "" }, /* 18*/ { BARCODE_AUSREDIRECT, "123", 0, 3, 73, "" }, /* 19*/ { BARCODE_AUSREDIRECT, "0", 0, 3, 73, "" }, - /* 20*/ { BARCODE_AUSREDIRECT, "123456789", ZINT_ERROR_TOO_LONG, -1, -1, "Error 403: Input too long (8 character maximum)" }, + /* 20*/ { BARCODE_AUSREDIRECT, "123456789", ZINT_ERROR_TOO_LONG, -1, -1, "Error 403: Input length 9 too long (maximum 8)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; 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"); + testStartSymbol("test_input", &symbol); for (i = 0; i < data_size; i++) { @@ -191,6 +191,8 @@ static void test_input(const testCtx *const p_ctx) { 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -207,7 +209,6 @@ static void test_input(const testCtx *const p_ctx) { 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); ZBarcode_Delete(symbol); } @@ -233,7 +234,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_AUSPOST, "96184209", 0, 3, 73, "AusPost Tech Specs Diagram 1; verified manually against TEC-IT", "1000101010100010001010100000101010001010001000001010000010001000001000100" "1010101010101010101010101010101010101010101010101010101010101010101010101" @@ -310,9 +311,9 @@ static void test_encode(const testCtx *const p_ctx) { "0000001010100010101010001010001000000010101000000000001010101000001010000" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[1024]; char bwipp_buf[8192]; @@ -320,7 +321,7 @@ static void test_encode(const testCtx *const p_ctx) { int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ - testStart("test_encode"); + testStartSymbol("test_encode", &symbol); for (i = 0; i < data_size; i++) { @@ -378,7 +379,7 @@ static void test_fuzz(const testCtx *const p_ctx) { int ret; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_AUSROUTE, "A\000\000\000", 4, ZINT_ERROR_INVALID_DATA }, /* 1*/ { BARCODE_AUSROUTE, "1\000\000\000", 4, ZINT_ERROR_INVALID_DATA }, /* 2*/ { BARCODE_AUSREPLY, "A\000\000\000", 4, ZINT_ERROR_INVALID_DATA }, @@ -386,11 +387,11 @@ static void test_fuzz(const testCtx *const p_ctx) { /* 4*/ { BARCODE_AUSREDIRECT, "A\000\000\000", 4, ZINT_ERROR_INVALID_DATA }, /* 5*/ { BARCODE_AUSREDIRECT, "1\000\000\000", 4, ZINT_ERROR_INVALID_DATA }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_fuzz"); + testStartSymbol("test_fuzz", &symbol); for (i = 0; i < data_size; i++) { diff --git a/backend/tests/test_aztec.c b/backend/tests/test_aztec.c index 08ddabb0..80ebfd84 100644 --- a/backend/tests/test_aztec.c +++ b/backend/tests/test_aztec.c @@ -46,124 +46,134 @@ static void test_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; - const char *ret_errtxt; + const char *expected_errtxt; + const char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { BARCODE_AZTEC, -1, 1, -1, -1, { 0, 0, "" }, "\xFF", 2053, 0, 151, 151, "" }, - /* 1*/ { BARCODE_AZTEC, -1, 1, -1, -1, { 0, 0, "" }, "\xFF", 2054, ZINT_ERROR_TOO_LONG, -1, -1, "Error 504: Input too long (too many bits for selected ECC)" }, - /* 2*/ { BARCODE_AZTEC, -1, 1, -1, -1, { 0, 0, "" }, "\xFF", 2237, ZINT_ERROR_TOO_LONG, -1, -1, "Error 504: Input too long (too many bits for selected ECC)" }, - /* 3*/ { BARCODE_AZTEC, -1, 1, -1, -1, { 0, 0, "" }, "\xFF", 2238, ZINT_ERROR_TOO_LONG, -1, -1, "Error 502: Input too long or too many extended ASCII characters" }, - /* 4*/ { BARCODE_AZTEC, -1, 2, -1, -1, { 0, 0, "" }, "1", 3835, 0, 151, 151, "" }, - /* 5*/ { BARCODE_AZTEC, -1, 2, -1, -1, { 0, 0, "" }, "1", 3836, ZINT_ERROR_TOO_LONG, -1, -1, "Error 504: Input too long (too many bits for selected ECC)" }, - /* 6*/ { BARCODE_AZTEC, -1, 2, -1, -1, { 0, 0, "" }, "A", 3069, 0, 151, 151, "" }, - /* 7*/ { BARCODE_AZTEC, -1, 2, -1, -1, { 0, 0, "" }, "A", 3070, ZINT_ERROR_TOO_LONG, -1, -1, "Error 504: Input too long (too many bits for selected ECC)" }, - /* 8*/ { BARCODE_AZTEC, -1, 2, -1, -1, { 0, 0, "" }, "\xFF", 1756, 0, 151, 151, "" }, - /* 9*/ { BARCODE_AZTEC, -1, 2, -1, -1, { 0, 0, "" }, "\xFF", 1757, ZINT_ERROR_TOO_LONG, -1, -1, "Error 504: Input too long (too many bits for selected ECC)" }, - /* 10*/ { BARCODE_AZTEC, -1, 3, -1, -1, { 0, 0, "" }, "1", 3184, 0, 151, 151, "" }, - /* 11*/ { BARCODE_AZTEC, -1, 3, -1, -1, { 0, 0, "" }, "1", 3185, ZINT_ERROR_TOO_LONG, -1, -1, "Error 504: Input too long (too many bits for selected ECC)" }, - /* 12*/ { BARCODE_AZTEC, -1, 3, -1, -1, { 0, 0, "" }, "A", 2548, 0, 151, 151, "" }, - /* 13*/ { BARCODE_AZTEC, -1, 3, -1, -1, { 0, 0, "" }, "A", 2549, ZINT_ERROR_TOO_LONG, -1, -1, "Error 504: Input too long (too many bits for selected ECC)" }, - /* 14*/ { BARCODE_AZTEC, -1, 3, -1, -1, { 0, 0, "" }, "\xFF", 1457, 0, 151, 151, "" }, - /* 15*/ { BARCODE_AZTEC, -1, 3, -1, -1, { 0, 0, "" }, "\xFF", 1458, ZINT_ERROR_TOO_LONG, -1, -1, "Error 504: Input too long (too many bits for selected ECC)" }, - /* 16*/ { BARCODE_AZTEC, -1, 4, -1, -1, { 0, 0, "" }, "1", 2485, 0, 151, 151, "" }, - /* 17*/ { BARCODE_AZTEC, -1, 4, -1, -1, { 0, 0, "" }, "1", 2486, ZINT_ERROR_TOO_LONG, -1, -1, "Error 504: Input too long (too many bits for selected ECC)" }, - /* 18*/ { BARCODE_AZTEC, -1, 4, -1, -1, { 0, 0, "" }, "A", 1989, 0, 151, 151, "" }, - /* 19*/ { BARCODE_AZTEC, -1, 4, -1, -1, { 0, 0, "" }, "A", 1990, ZINT_ERROR_TOO_LONG, -1, -1, "Error 504: Input too long (too many bits for selected ECC)" }, - /* 20*/ { BARCODE_AZTEC, -1, 4, -1, -1, { 0, 0, "" }, "\xFF", 1137, 0, 151, 151, "" }, - /* 21*/ { BARCODE_AZTEC, -1, 4, -1, -1, { 0, 0, "" }, "\xFF", 1138, ZINT_ERROR_TOO_LONG, -1, -1, "Error 504: Input too long (too many bits for selected ECC)" }, - /* 22*/ { BARCODE_AZTEC, -1, -1, 1, -1, { 0, 0, "" }, "\xFF", 7, 0, 15, 15, "" }, - /* 23*/ { BARCODE_AZTEC, -1, -1, 1, -1, { 0, 0, "" }, "\xFF", 8, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 24*/ { BARCODE_AZTEC, -1, -1, 1, -1, { 0, 0, "" }, "\xFF", 2078, ZINT_ERROR_TOO_LONG, -1, -1, "Error 704: Data too long for specified Aztec Code symbol size" }, - /* 25*/ { BARCODE_AZTEC, -1, -1, 2, -1, { 0, 0, "" }, "\xFF", 22, 0, 19, 19, "" }, - /* 26*/ { BARCODE_AZTEC, -1, -1, 2, -1, { 0, 0, "" }, "\xFF", 23, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 27*/ { BARCODE_AZTEC, -1, -1, 2, -1, { 0, 0, "" }, "\xFF", 2077, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 28*/ { BARCODE_AZTEC, -1, -1, 2, -1, { 0, 0, "" }, "\xFF", 2078, ZINT_ERROR_TOO_LONG, -1, -1, "Error 704: Data too long for specified Aztec Code symbol size" }, - /* 29*/ { BARCODE_AZTEC, -1, -1, 3, -1, { 0, 0, "" }, "\xFF", 39, 0, 23, 23, "" }, - /* 30*/ { BARCODE_AZTEC, -1, -1, 3, -1, { 0, 0, "" }, "\xFF", 40, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 31*/ { BARCODE_AZTEC, -1, -1, 4, -1, { 0, 0, "" }, "\xFF", 51, 0, 27, 27, "" }, - /* 32*/ { BARCODE_AZTEC, -1, -1, 4, -1, { 0, 0, "" }, "\xFF", 52, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 33*/ { BARCODE_AZTEC, -1, -1, 5, -1, { 0, 0, "" }, "\xFF", 10, 0, 19, 19, "" }, - /* 34*/ { BARCODE_AZTEC, -1, -1, 5, -1, { 0, 0, "" }, "\xFF", 11, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 35*/ { BARCODE_AZTEC, -1, -1, 5, -1, { 0, 0, "" }, "\xFF", 2077, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 36*/ { BARCODE_AZTEC, -1, -1, 5, -1, { 0, 0, "" }, "\xFF", 2078, ZINT_ERROR_TOO_LONG, -1, -1, "Error 704: Data too long for specified Aztec Code symbol size" }, - /* 37*/ { BARCODE_AZTEC, -1, -1, 6, -1, { 0, 0, "" }, "\xFF", 27, 0, 23, 23, "" }, - /* 38*/ { BARCODE_AZTEC, -1, -1, 6, -1, { 0, 0, "" }, "\xFF", 28, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 39*/ { BARCODE_AZTEC, -1, -1, 7, -1, { 0, 0, "" }, "\xFF", 47, 0, 27, 27, "" }, - /* 40*/ { BARCODE_AZTEC, -1, -1, 7, -1, { 0, 0, "" }, "\xFF", 48, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 41*/ { BARCODE_AZTEC, -1, -1, 8, -1, { 0, 0, "" }, "\xFF", 72, 0, 31, 31, "" }, - /* 42*/ { BARCODE_AZTEC, -1, -1, 8, -1, { 0, 0, "" }, "\xFF", 73, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 43*/ { BARCODE_AZTEC, -1, -1, 9, -1, { 0, 0, "" }, "\xFF", 100, 0, 37, 37, "" }, - /* 44*/ { BARCODE_AZTEC, -1, -1, 9, -1, { 0, 0, "" }, "\xFF", 101, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 45*/ { BARCODE_AZTEC, -1, -1, 10, -1, { 0, 0, "" }, "\xFF", 131, 0, 41, 41, "" }, - /* 46*/ { BARCODE_AZTEC, -1, -1, 10, -1, { 0, 0, "" }, "\xFF", 132, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 47*/ { BARCODE_AZTEC, -1, -1, 11, -1, { 0, 0, "" }, "\xFF", 166, 0, 45, 45, "" }, - /* 48*/ { BARCODE_AZTEC, -1, -1, 11, -1, { 0, 0, "" }, "\xFF", 167, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 49*/ { BARCODE_AZTEC, -1, -1, 12, -1, { 0, 0, "" }, "\xFF", 205, 0, 49, 49, "" }, - /* 50*/ { BARCODE_AZTEC, -1, -1, 12, -1, { 0, 0, "" }, "\xFF", 206, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 51*/ { BARCODE_AZTEC, -1, -1, 13, -1, { 0, 0, "" }, "\xFF", 253, 0, 53, 53, "" }, - /* 52*/ { BARCODE_AZTEC, -1, -1, 13, -1, { 0, 0, "" }, "\xFF", 254, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 53*/ { BARCODE_AZTEC, -1, -1, 14, -1, { 0, 0, "" }, "\xFF", 300, 0, 57, 57, "" }, - /* 54*/ { BARCODE_AZTEC, -1, -1, 14, -1, { 0, 0, "" }, "\xFF", 301, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 55*/ { BARCODE_AZTEC, -1, -1, 15, -1, { 0, 0, "" }, "\xFF", 349, 0, 61, 61, "" }, - /* 56*/ { BARCODE_AZTEC, -1, -1, 15, -1, { 0, 0, "" }, "\xFF", 350, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 57*/ { BARCODE_AZTEC, -1, -1, 16, -1, { 0, 0, "" }, "\xFF", 403, 0, 67, 67, "" }, - /* 58*/ { BARCODE_AZTEC, -1, -1, 16, -1, { 0, 0, "" }, "\xFF", 404, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 59*/ { BARCODE_AZTEC, -1, -1, 17, -1, { 0, 0, "" }, "\xFF", 462, 0, 71, 71, "" }, - /* 60*/ { BARCODE_AZTEC, -1, -1, 17, -1, { 0, 0, "" }, "\xFF", 463, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 61*/ { BARCODE_AZTEC, -1, -1, 18, -1, { 0, 0, "" }, "\xFF", 523, 0, 75, 75, "" }, - /* 62*/ { BARCODE_AZTEC, -1, -1, 18, -1, { 0, 0, "" }, "\xFF", 524, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 63*/ { BARCODE_AZTEC, -1, -1, 19, -1, { 0, 0, "" }, "\xFF", 588, 0, 79, 79, "" }, - /* 64*/ { BARCODE_AZTEC, -1, -1, 19, -1, { 0, 0, "" }, "\xFF", 589, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 65*/ { BARCODE_AZTEC, -1, -1, 20, -1, { 0, 0, "" }, "\xFF", 655, 0, 83, 83, "" }, - /* 66*/ { BARCODE_AZTEC, -1, -1, 20, -1, { 0, 0, "" }, "\xFF", 656, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 67*/ { BARCODE_AZTEC, -1, -1, 21, -1, { 0, 0, "" }, "\xFF", 727, 0, 87, 87, "" }, - /* 68*/ { BARCODE_AZTEC, -1, -1, 21, -1, { 0, 0, "" }, "\xFF", 728, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 69*/ { BARCODE_AZTEC, -1, -1, 22, -1, { 0, 0, "" }, "\xFF", 804, 0, 91, 91, "" }, - /* 70*/ { BARCODE_AZTEC, -1, -1, 22, -1, { 0, 0, "" }, "\xFF", 805, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 71*/ { BARCODE_AZTEC, -1, -1, 23, -1, { 0, 0, "" }, "\xFF", 883, 0, 95, 95, "" }, - /* 72*/ { BARCODE_AZTEC, -1, -1, 23, -1, { 0, 0, "" }, "\xFF", 884, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 73*/ { BARCODE_AZTEC, -1, -1, 24, -1, { 0, 0, "" }, "\xFF", 966, 0, 101, 101, "" }, - /* 74*/ { BARCODE_AZTEC, -1, -1, 24, -1, { 0, 0, "" }, "\xFF", 967, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 75*/ { BARCODE_AZTEC, -1, -1, 25, -1, { 0, 0, "" }, "\xFF", 1051, 0, 105, 105, "" }, - /* 76*/ { BARCODE_AZTEC, -1, -1, 25, -1, { 0, 0, "" }, "\xFF", 1052, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 77*/ { BARCODE_AZTEC, -1, -1, 26, -1, { 0, 0, "" }, "\xFF", 1141, 0, 109, 109, "" }, - /* 78*/ { BARCODE_AZTEC, -1, -1, 26, -1, { 0, 0, "" }, "\xFF", 1142, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 79*/ { BARCODE_AZTEC, -1, -1, 27, -1, { 0, 0, "" }, "\xFF", 1258, 0, 113, 113, "" }, - /* 80*/ { BARCODE_AZTEC, -1, -1, 27, -1, { 0, 0, "" }, "\xFF", 1259, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 81*/ { BARCODE_AZTEC, -1, -1, 28, -1, { 0, 0, "" }, "\xFF", 1357, 0, 117, 117, "" }, - /* 82*/ { BARCODE_AZTEC, -1, -1, 28, -1, { 0, 0, "" }, "\xFF", 1358, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 83*/ { BARCODE_AZTEC, -1, -1, 29, -1, { 0, 0, "" }, "\xFF", 1459, 0, 121, 121, "" }, - /* 84*/ { BARCODE_AZTEC, -1, -1, 29, -1, { 0, 0, "" }, "\xFF", 1460, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 85*/ { BARCODE_AZTEC, -1, -1, 30, -1, { 0, 0, "" }, "\xFF", 1566, 0, 125, 125, "" }, - /* 86*/ { BARCODE_AZTEC, -1, -1, 30, -1, { 0, 0, "" }, "\xFF", 1567, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 87*/ { BARCODE_AZTEC, -1, -1, 31, -1, { 0, 0, "" }, "\xFF", 1676, 0, 131, 131, "" }, - /* 88*/ { BARCODE_AZTEC, -1, -1, 31, -1, { 0, 0, "" }, "\xFF", 1677, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 89*/ { BARCODE_AZTEC, -1, -1, 32, -1, { 0, 0, "" }, "\xFF", 1789, 0, 135, 135, "" }, - /* 90*/ { BARCODE_AZTEC, -1, -1, 32, -1, { 0, 0, "" }, "\xFF", 1790, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 91*/ { BARCODE_AZTEC, -1, -1, 33, -1, { 0, 0, "" }, "\xFF", 1907, 0, 139, 139, "" }, - /* 92*/ { BARCODE_AZTEC, -1, -1, 33, -1, { 0, 0, "" }, "\xFF", 1908, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 93*/ { BARCODE_AZTEC, -1, -1, 34, -1, { 0, 0, "" }, "\xFF", 2028, 0, 143, 143, "" }, - /* 94*/ { BARCODE_AZTEC, -1, -1, 34, -1, { 0, 0, "" }, "\xFF", 2029, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 95*/ { BARCODE_AZTEC, -1, -1, 35, -1, { 0, 0, "" }, "\xFF", 2149, 0, 147, 147, "" }, - /* 96*/ { BARCODE_AZTEC, -1, -1, 35, -1, { 0, 0, "" }, "\xFF", 2150, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /* 97*/ { BARCODE_AZTEC, -1, -1, 36, -1, { 0, 0, "" }, "\xFF", 2237, 0, 151, 151, "" }, - /* 98*/ { BARCODE_AZTEC, -1, -1, 36, -1, { 0, 0, "" }, "\xFF", 2238, ZINT_ERROR_TOO_LONG, -1, -1, "Error 502: Input too long or too many extended ASCII characters" }, - /* 97*/ { BARCODE_AZTEC, -1, -1, 36, -1, { 0, 0, "" }, "\xFF", 2205, 0, 151, 151, "" }, - /* 99*/ { BARCODE_AZTEC, -1, -1, 34, -1, { 0, 0, "" }, "1", 4429, 0, 143, 143, "" }, - /*100*/ { BARCODE_AZTEC, -1, -1, 34, -1, { 0, 0, "" }, "1", 4430, ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, - /*101*/ { BARCODE_AZTEC, -1, -1, 35, -1, { 0, 0, "" }, "1", 4483, 0, 147, 147, "" }, - /*102*/ { BARCODE_AZTEC, -1, -1, 35, -1, { 0, 0, "" }, "1", 4484, ZINT_ERROR_TOO_LONG, -1, -1, "Error 502: Input too long or too many extended ASCII characters" }, - /*103*/ { BARCODE_AZTEC, -1, -1, 36, -1, { 0, 0, "" }, "1", 4483, 0, 151, 151, "" }, - /*104*/ { BARCODE_AZTEC, -1, -1, 36, -1, { 0, 0, "" }, "1", 4484, ZINT_ERROR_TOO_LONG, -1, -1, "Error 502: Input too long or too many extended ASCII characters" }, - /*105*/ { BARCODE_AZTEC, 899, -1, 36, -1, { 0, 0, "" }, "\xFF", 2234, 0, 151, 151, "" }, - /*106*/ { BARCODE_AZTEC, 899, -1, 36, -1, { 0, 0, "" }, "\xFF", 2235, ZINT_ERROR_TOO_LONG, -1, -1, "Error 502: Input too long or too many extended ASCII characters" }, - /*107*/ { BARCODE_AZTEC, -1, -1, 36, -1, { 2, 3, "1234567890123456789012" }, "\xFF", 2221, 0, 151, 151, "" }, - /*108*/ { BARCODE_AZTEC, -1, -1, 36, -1, { 2, 3, "1234567890123456789012" }, "\xFF", 2222, ZINT_ERROR_TOO_LONG, -1, -1, "Error 502: Input too long or too many extended ASCII characters" }, - /*109*/ { BARCODE_AZTEC, 899, -1, 36, -1, { 2, 3, "1234567890123456789012" }, "\xFF", 2218, 0, 151, 151, "" }, - /*110*/ { BARCODE_AZTEC, 899, -1, 36, -1, { 2, 3, "1234567890123456789012" }, "\xFF", 2219, ZINT_ERROR_TOO_LONG, -1, -1, "Error 502: Input too long or too many extended ASCII characters" }, + static const struct item data[] = { + /* 0*/ { BARCODE_AZTEC, -1, 1, -1, -1, { 0, 0, "" }, "\377", 2053, 0, 151, 151, "", "" }, + /* 1*/ { BARCODE_AZTEC, -1, 1, -1, -1, { 0, 0, "" }, "\377", 2054, ZINT_ERROR_TOO_LONG, 0, 0, "Error 504: Input too long for ECC level 1, requires 1496 codewords (maximum 1495)", "" }, + /* 2*/ { BARCODE_AZTEC, -1, 1, -1, -1, { 0, 0, "" }, "\377", 2237, ZINT_ERROR_TOO_LONG, 0, 0, "Error 504: Input too long for ECC level 1, requires 1631 codewords (maximum 1495)", "" }, + /* 3*/ { BARCODE_AZTEC, -1, 1, -1, -1, { 0, 0, "" }, "\377", 2238, ZINT_ERROR_TOO_LONG, 0, 0, "Error 707: Input too long for ECC level 1, requires too many codewords (maximum 1495)", "" }, + /* 4*/ { BARCODE_AZTEC, -1, 2, -1, -1, { 0, 0, "" }, "1", 3835, 0, 151, 151, "", "" }, + /* 5*/ { BARCODE_AZTEC, -1, 2, -1, -1, { 0, 0, "" }, "1", 3836, ZINT_ERROR_TOO_LONG, 0, 0, "Error 707: Input too long for ECC level 2, requires too many codewords (maximum 1279)", "" }, + /* 6*/ { BARCODE_AZTEC, -1, 2, -1, -1, { 0, 0, "" }, "A", 3069, 0, 151, 151, "", "" }, + /* 7*/ { BARCODE_AZTEC, -1, 2, -1, -1, { 0, 0, "" }, "A", 3070, ZINT_ERROR_TOO_LONG, 0, 0, "Error 707: Input too long for ECC level 2, requires too many codewords (maximum 1279)", "" }, + /* 8*/ { BARCODE_AZTEC, -1, 2, -1, -1, { 0, 0, "" }, "\377", 1756, 0, 151, 151, "", "" }, + /* 9*/ { BARCODE_AZTEC, -1, 2, -1, -1, { 0, 0, "" }, "\377", 1757, ZINT_ERROR_TOO_LONG, 0, 0, "Error 504: Input too long for ECC level 2, requires 1280 codewords (maximum 1279)", "" }, + /* 10*/ { BARCODE_AZTEC, -1, 3, -1, -1, { 0, 0, "" }, "1", 3184, 0, 151, 151, "", "" }, + /* 11*/ { BARCODE_AZTEC, -1, 3, -1, -1, { 0, 0, "" }, "1", 3185, ZINT_ERROR_TOO_LONG, 0, 0, "Error 707: Input too long for ECC level 3, requires too many codewords (maximum 1062)", "" }, + /* 12*/ { BARCODE_AZTEC, -1, 3, -1, -1, { 0, 0, "" }, "A", 2548, 0, 151, 151, "", "" }, + /* 13*/ { BARCODE_AZTEC, -1, 3, -1, -1, { 0, 0, "" }, "A", 2549, ZINT_ERROR_TOO_LONG, 0, 0, "Error 707: Input too long for ECC level 3, requires too many codewords (maximum 1062)", "" }, + /* 14*/ { BARCODE_AZTEC, -1, 3, -1, -1, { 0, 0, "" }, "\377", 1457, 0, 151, 151, "", "" }, + /* 15*/ { BARCODE_AZTEC, -1, 3, -1, -1, { 0, 0, "" }, "\377", 1458, ZINT_ERROR_TOO_LONG, 0, 0, "Error 504: Input too long for ECC level 3, requires 1063 codewords (maximum 1062)", "" }, + /* 16*/ { BARCODE_AZTEC, -1, 4, -1, -1, { 0, 0, "" }, "1", 2485, 0, 151, 151, "", "" }, + /* 17*/ { BARCODE_AZTEC, -1, 4, -1, -1, { 0, 0, "" }, "1", 2486, ZINT_ERROR_TOO_LONG, 0, 0, "Error 707: Input too long for ECC level 4, requires too many codewords (maximum 829)", "" }, + /* 18*/ { BARCODE_AZTEC, -1, 4, -1, -1, { 0, 0, "" }, "A", 1989, 0, 151, 151, "", "" }, + /* 19*/ { BARCODE_AZTEC, -1, 4, -1, -1, { 0, 0, "" }, "A", 1990, ZINT_ERROR_TOO_LONG, 0, 0, "Error 707: Input too long for ECC level 4, requires too many codewords (maximum 829)", "" }, + /* 20*/ { BARCODE_AZTEC, -1, 4, -1, -1, { 0, 0, "" }, "\377", 1137, 0, 151, 151, "", "" }, + /* 21*/ { BARCODE_AZTEC, -1, 4, -1, -1, { 0, 0, "" }, "\377", 1138, ZINT_ERROR_TOO_LONG, 0, 0, "Error 504: Input too long for ECC level 4, requires 830 codewords (maximum 829)", "" }, + /* 22*/ { BARCODE_AZTEC, -1, -1, 1, -1, { 0, 0, "" }, "\377", 7, 0, 15, 15, "", "4 ECC codewords" }, + /* 23*/ { BARCODE_AZTEC, -1, -1, 1, -1, { 0, 0, "" }, "\377", 8, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 1, requires too many codewords (maximum 14)", "" }, + /* 24*/ { BARCODE_AZTEC, -1, -1, 1, -1, { 0, 0, "" }, "\377", 2078, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 1, requires too many codewords (maximum 14)", "" }, + /* 25*/ { BARCODE_AZTEC, -1, -1, 2, -1, { 0, 0, "" }, "\377", 22, 0, 19, 19, "", "3 ECC codewords" }, + /* 26*/ { BARCODE_AZTEC, -1, -1, 2, -1, { 0, 0, "" }, "\377", 23, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 2, requires too many codewords (maximum 37)", "" }, + /* 27*/ { BARCODE_AZTEC, -1, -1, 2, -1, { 0, 0, "" }, "\377", 1866, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 2, requires too many codewords (maximum 37)", "" }, + /* 28*/ { BARCODE_AZTEC, -1, -1, 3, -1, { 0, 0, "" }, "\377", 39, 0, 23, 23, "", "3 ECC codewords" }, + /* 29*/ { BARCODE_AZTEC, -1, -1, 3, -1, { 0, 0, "" }, "\377", 40, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 3, requires too many codewords (maximum 48)", "" }, + /* 30*/ { BARCODE_AZTEC, -1, -1, 4, -1, { 0, 0, "" }, "\377", 51, 0, 27, 27, "", "15 ECC codewords (Version 4 (compact) spare 12 ECC blocks bonus)" }, + /* 31*/ { BARCODE_AZTEC, -1, -1, 4, -1, { 0, 0, "" }, "\377", 52, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 4, requires too many codewords (maximum 61)", "" }, + /* 32*/ { BARCODE_AZTEC, -1, -1, 5, -1, { 0, 0, "" }, "\377", 10, 0, 19, 19, "", "3 ECC codewords" }, + /* 33*/ { BARCODE_AZTEC, -1, -1, 5, -1, { 0, 0, "" }, "\377", 11, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 5, requires too many codewords (maximum 18)", "" }, + /* 34*/ { BARCODE_AZTEC, -1, -1, 6, -1, { 0, 0, "" }, "\377", 27, 0, 23, 23, "", "3 ECC codewords" }, + /* 35*/ { BARCODE_AZTEC, -1, -1, 6, -1, { 0, 0, "" }, "\377", 28, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 6, requires too many codewords (maximum 45)", "" }, + /* 36*/ { BARCODE_AZTEC, -1, -1, 7, -1, { 0, 0, "" }, "\377", 47, 0, 27, 27, "", "3 ECC codewords" }, + /* 37*/ { BARCODE_AZTEC, -1, -1, 7, -1, { 0, 0, "" }, "\377", 48, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 7, requires too many codewords (maximum 57)", "" }, + /* 38*/ { BARCODE_AZTEC, -1, -1, 8, -1, { 0, 0, "" }, "\377", 71, 0, 31, 31, "", "4 ECC codewords" }, + /* 39*/ { BARCODE_AZTEC, -1, -1, 8, -1, { 0, 0, "" }, "\377", 72, ZINT_WARN_NONCOMPLIANT, 31, 31, "Warning 708: Number of ECC codewords 3 less than 4 (5% of data codewords 85)", "" }, + /* 40*/ { BARCODE_AZTEC, -1, -1, 8, -1, { 0, 0, "" }, "\377", 73, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 8, requires too many codewords (maximum 85)", "" }, + /* 41*/ { BARCODE_AZTEC, -1, -1, 9, -1, { 0, 0, "" }, "\377", 98, 0, 37, 37, "", "5 ECC codewords" }, + /* 42*/ { BARCODE_AZTEC, -1, -1, 9, -1, { 0, 0, "" }, "\377", 100, ZINT_WARN_NONCOMPLIANT, 37, 37, "Warning 708: Number of ECC codewords 3 less than 5 (5% of data codewords 117)", "" }, + /* 43*/ { BARCODE_AZTEC, -1, -1, 9, -1, { 0, 0, "" }, "\377", 101, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 9, requires too many codewords (maximum 117)", "" }, + /* 44*/ { BARCODE_AZTEC, -1, -1, 10, -1, { 0, 0, "" }, "\377", 128, 0, 41, 41, "", "7 ECC codewords" }, + /* 45*/ { BARCODE_AZTEC, -1, -1, 10, -1, { 0, 0, "" }, "\377", 129, ZINT_WARN_NONCOMPLIANT, 41, 41, "Warning 708: Number of ECC codewords 6 less than 7 (5% of data codewords 150)", "" }, + /* 46*/ { BARCODE_AZTEC, -1, -1, 10, -1, { 0, 0, "" }, "\377", 131, ZINT_WARN_NONCOMPLIANT, 41, 41, "Warning 708: Number of ECC codewords 3 less than 7 (5% of data codewords 153)", "" }, + /* 47*/ { BARCODE_AZTEC, -1, -1, 10, -1, { 0, 0, "" }, "\377", 132, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 10, requires too many codewords (maximum 153)", "" }, + /* 48*/ { BARCODE_AZTEC, -1, -1, 11, -1, { 0, 0, "" }, "\377", 166, ZINT_WARN_NONCOMPLIANT, 45, 45, "Warning 708: Number of ECC codewords 3 less than 9 (5% of data codewords 193)", "" }, + /* 49*/ { BARCODE_AZTEC, -1, -1, 11, -1, { 0, 0, "" }, "\377", 167, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 11, requires too many codewords (maximum 193)", "" }, + /* 50*/ { BARCODE_AZTEC, -1, -1, 12, -1, { 0, 0, "" }, "\377", 205, ZINT_WARN_NONCOMPLIANT, 49, 49, "Warning 708: Number of ECC codewords 3 less than 11 (5% of data codewords 237)", "" }, + /* 51*/ { BARCODE_AZTEC, -1, -1, 12, -1, { 0, 0, "" }, "\377", 206, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 12, requires too many codewords (maximum 237)", "" }, + /* 52*/ { BARCODE_AZTEC, -1, -1, 13, -1, { 0, 0, "" }, "\377", 253, ZINT_WARN_NONCOMPLIANT, 53, 53, "Warning 708: Number of ECC codewords 3 less than 11 (5% of data codewords 227)", "" }, + /* 53*/ { BARCODE_AZTEC, -1, -1, 13, -1, { 0, 0, "" }, "\377", 254, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 13, requires too many codewords (maximum 227)", "" }, + /* 54*/ { BARCODE_AZTEC, -1, -1, 14, -1, { 0, 0, "" }, "\377", 300, ZINT_WARN_NONCOMPLIANT, 57, 57, "Warning 708: Number of ECC codewords 3 less than 13 (5% of data codewords 269)", "" }, + /* 55*/ { BARCODE_AZTEC, -1, -1, 14, -1, { 0, 0, "" }, "\377", 301, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 14, requires too many codewords (maximum 269)", "" }, + /* 56*/ { BARCODE_AZTEC, -1, -1, 15, -1, { 0, 0, "" }, "\377", 349, ZINT_WARN_NONCOMPLIANT, 61, 61, "Warning 708: Number of ECC codewords 3 less than 15 (5% of data codewords 313)", "" }, + /* 57*/ { BARCODE_AZTEC, -1, -1, 15, -1, { 0, 0, "" }, "\377", 350, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 15, requires too many codewords (maximum 313)", "" }, + /* 58*/ { BARCODE_AZTEC, -1, -1, 16, -1, { 0, 0, "" }, "\377", 403, ZINT_WARN_NONCOMPLIANT, 67, 67, "Warning 708: Number of ECC codewords 3 less than 18 (5% of data codewords 361)", "" }, + /* 59*/ { BARCODE_AZTEC, -1, -1, 16, -1, { 0, 0, "" }, "\377", 404, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 16, requires too many codewords (maximum 361)", "" }, + /* 60*/ { BARCODE_AZTEC, -1, -1, 17, -1, { 0, 0, "" }, "\377", 462, ZINT_WARN_NONCOMPLIANT, 71, 71, "Warning 708: Number of ECC codewords 3 less than 20 (5% of data codewords 413)", "" }, + /* 61*/ { BARCODE_AZTEC, -1, -1, 17, -1, { 0, 0, "" }, "\377", 463, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 17, requires too many codewords (maximum 413)", "" }, + /* 62*/ { BARCODE_AZTEC, -1, -1, 18, -1, { 0, 0, "" }, "\377", 501, 0, 75, 75, "", "22 ECC codewords (448 data codewords)" }, + /* 63*/ { BARCODE_AZTEC, -1, -1, 18, -1, { 0, 0, "" }, "\377", 502, ZINT_WARN_NONCOMPLIANT, 75, 75, "Warning 708: Number of ECC codewords 21 less than 22 (5% of data codewords 449)", "" }, + /* 64*/ { BARCODE_AZTEC, -1, -1, 18, -1, { 0, 0, "" }, "\377", 523, ZINT_WARN_NONCOMPLIANT, 75, 75, "Warning 708: Number of ECC codewords 3 less than 23 (5% of data codewords 467)", "" }, + /* 65*/ { BARCODE_AZTEC, -1, -1, 18, -1, { 0, 0, "" }, "\377", 524, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 18, requires too many codewords (maximum 467)", "" }, + /* 66*/ { BARCODE_AZTEC, -1, -1, 19, -1, { 0, 0, "" }, "\377", 588, ZINT_WARN_NONCOMPLIANT, 79, 79, "Warning 708: Number of ECC codewords 3 less than 26 (5% of data codewords 525)", "" }, + /* 67*/ { BARCODE_AZTEC, -1, -1, 19, -1, { 0, 0, "" }, "\377", 589, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 19, requires too many codewords (maximum 525)", "" }, + /* 68*/ { BARCODE_AZTEC, -1, -1, 20, -1, { 0, 0, "" }, "\377", 655, ZINT_WARN_NONCOMPLIANT, 83, 83, "Warning 708: Number of ECC codewords 3 less than 29 (5% of data codewords 585)", "" }, + /* 69*/ { BARCODE_AZTEC, -1, -1, 20, -1, { 0, 0, "" }, "\377", 656, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 20, requires too many codewords (maximum 585)", "" }, + /* 70*/ { BARCODE_AZTEC, -1, -1, 21, -1, { 0, 0, "" }, "\377", 727, ZINT_WARN_NONCOMPLIANT, 87, 87, "Warning 708: Number of ECC codewords 3 less than 32 (5% of data codewords 649)", "" }, + /* 71*/ { BARCODE_AZTEC, -1, -1, 21, -1, { 0, 0, "" }, "\377", 728, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 21, requires too many codewords (maximum 649)", "" }, + /* 72*/ { BARCODE_AZTEC, -1, -1, 22, -1, { 0, 0, "" }, "\377", 804, ZINT_WARN_NONCOMPLIANT, 91, 91, "Warning 708: Number of ECC codewords 3 less than 35 (5% of data codewords 717)", "" }, + /* 73*/ { BARCODE_AZTEC, -1, -1, 22, -1, { 0, 0, "" }, "\377", 805, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 22, requires too many codewords (maximum 717)", "" }, + /* 74*/ { BARCODE_AZTEC, -1, -1, 23, -1, { 0, 0, "" }, "\377", 883, ZINT_WARN_NONCOMPLIANT, 95, 95, "Warning 708: Number of ECC codewords 3 less than 39 (5% of data codewords 787)", "" }, + /* 75*/ { BARCODE_AZTEC, -1, -1, 23, -1, { 0, 0, "" }, "\377", 884, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 23, requires too many codewords (maximum 787)", "" }, + /* 76*/ { BARCODE_AZTEC, -1, -1, 24, -1, { 0, 0, "" }, "\377", 966, ZINT_WARN_NONCOMPLIANT, 101, 101, "Warning 708: Number of ECC codewords 3 less than 43 (5% of data codewords 861)", "" }, + /* 77*/ { BARCODE_AZTEC, -1, -1, 24, -1, { 0, 0, "" }, "\377", 967, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 24, requires too many codewords (maximum 861)", "" }, + /* 78*/ { BARCODE_AZTEC, -1, -1, 25, -1, { 0, 0, "" }, "\377", 1051, ZINT_WARN_NONCOMPLIANT, 105, 105, "Warning 708: Number of ECC codewords 3 less than 46 (5% of data codewords 937)", "" }, + /* 79*/ { BARCODE_AZTEC, -1, -1, 25, -1, { 0, 0, "" }, "\377", 1052, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 25, requires too many codewords (maximum 937)", "" }, + /* 80*/ { BARCODE_AZTEC, -1, -1, 26, -1, { 0, 0, "" }, "\377", 1091, 0, 109, 109, "", "48 ecc codewords (972 data codewords)" }, + /* 81*/ { BARCODE_AZTEC, -1, -1, 26, -1, { 0, 0, "" }, "\377", 1092, ZINT_WARN_NONCOMPLIANT, 109, 109, "Warning 708: Number of ECC codewords 47 less than 48 (5% of data codewords 973)", "" }, + /* 82*/ { BARCODE_AZTEC, -1, -1, 26, -1, { 0, 0, "" }, "\377", 1141, ZINT_WARN_NONCOMPLIANT, 109, 109, "Warning 708: Number of ECC codewords 3 less than 50 (5% of data codewords 1017)", "" }, + /* 83*/ { BARCODE_AZTEC, -1, -1, 26, -1, { 0, 0, "" }, "\377", 1142, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 26, requires too many codewords (maximum 1017)", "" }, + /* 84*/ { BARCODE_AZTEC, -1, -1, 27, -1, { 0, 0, "" }, "\377", 1258, ZINT_WARN_NONCOMPLIANT, 113, 113, "Warning 708: Number of ECC codewords 3 less than 45 (5% of data codewords 917)", "" }, + /* 85*/ { BARCODE_AZTEC, -1, -1, 27, -1, { 0, 0, "" }, "\377", 1259, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 27, requires too many codewords (maximum 917)", "" }, + /* 86*/ { BARCODE_AZTEC, -1, -1, 28, -1, { 0, 0, "" }, "\377", 1357, ZINT_WARN_NONCOMPLIANT, 117, 117, "Warning 708: Number of ECC codewords 3 less than 49 (5% of data codewords 989)", "" }, + /* 87*/ { BARCODE_AZTEC, -1, -1, 28, -1, { 0, 0, "" }, "\377", 1358, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 28, requires too many codewords (maximum 989)", "" }, + /* 88*/ { BARCODE_AZTEC, -1, -1, 29, -1, { 0, 0, "" }, "\377", 1459, ZINT_WARN_NONCOMPLIANT, 121, 121, "Warning 708: Number of ECC codewords 3 less than 53 (5% of data codewords 1063)", "" }, + /* 89*/ { BARCODE_AZTEC, -1, -1, 29, -1, { 0, 0, "" }, "\377", 1460, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 29, requires too many codewords (maximum 1063)", "" }, + /* 90*/ { BARCODE_AZTEC, -1, -1, 30, -1, { 0, 0, "" }, "\377", 1566, ZINT_WARN_NONCOMPLIANT, 125, 125, "Warning 708: Number of ECC codewords 3 less than 57 (5% of data codewords 1141)", "" }, + /* 91*/ { BARCODE_AZTEC, -1, -1, 30, -1, { 0, 0, "" }, "\377", 1567, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 30, requires too many codewords (maximum 1141)", "" }, + /* 92*/ { BARCODE_AZTEC, -1, -1, 31, -1, { 0, 0, "" }, "\377", 1676, ZINT_WARN_NONCOMPLIANT, 131, 131, "Warning 708: Number of ECC codewords 3 less than 61 (5% of data codewords 1221)", "" }, + /* 93*/ { BARCODE_AZTEC, -1, -1, 31, -1, { 0, 0, "" }, "\377", 1677, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 31, requires too many codewords (maximum 1221)", "" }, + /* 94*/ { BARCODE_AZTEC, -1, -1, 32, -1, { 0, 0, "" }, "\377", 1789, ZINT_WARN_NONCOMPLIANT, 135, 135, "Warning 708: Number of ECC codewords 3 less than 65 (5% of data codewords 1303)", "" }, + /* 95*/ { BARCODE_AZTEC, -1, -1, 32, -1, { 0, 0, "" }, "\377", 1790, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 32, requires too many codewords (maximum 1303)", "" }, + /* 96*/ { BARCODE_AZTEC, -1, -1, 33, -1, { 0, 0, "" }, "\377", 1907, ZINT_WARN_NONCOMPLIANT, 139, 139, "Warning 708: Number of ECC codewords 3 less than 69 (5% of data codewords 1389)", "" }, + /* 97*/ { BARCODE_AZTEC, -1, -1, 33, -1, { 0, 0, "" }, "\377", 1908, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 33, requires too many codewords (maximum 1389)", "" }, + /* 98*/ { BARCODE_AZTEC, -1, -1, 34, -1, { 0, 0, "" }, "1", 4429, ZINT_WARN_NONCOMPLIANT, 143, 143, "Warning 708: Number of ECC codewords 3 less than 73 (5% of data codewords 1477)", "" }, + /* 99*/ { BARCODE_AZTEC, -1, -1, 34, -1, { 0, 0, "" }, "1", 4430, ZINT_ERROR_TOO_LONG, 0, 0, "Error 505: Input too long for Version 34, requires 1478 codewords (maximum 1477)", "" }, + /*100*/ { BARCODE_AZTEC, -1, -1, 34, -1, { 0, 0, "" }, "\377", 2028, ZINT_WARN_NONCOMPLIANT, 143, 143, "Warning 708: Number of ECC codewords 3 less than 73 (5% of data codewords 1477)", "" }, + /*101*/ { BARCODE_AZTEC, -1, -1, 34, -1, { 0, 0, "" }, "\377", 2029, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 34, requires too many codewords (maximum 1477)", "" }, + /*102*/ { BARCODE_AZTEC, -1, -1, 35, -1, { 0, 0, "" }, "1", 4699, ZINT_WARN_NONCOMPLIANT, 147, 147, "Warning 708: Number of ECC codewords 3 less than 78 (5% of data codewords 1567)", "" }, + /*103*/ { BARCODE_AZTEC, -1, -1, 35, -1, { 0, 0, "" }, "1", 4700, ZINT_ERROR_TOO_LONG, 0, 0, "Error 505: Input too long for Version 35, requires 1568 codewords (maximum 1567)", "" }, + /*104*/ { BARCODE_AZTEC, -1, -1, 35, -1, { 0, 0, "" }, "A", 3590, 0, 147, 147, "", "74 ECC codewords (1496 data codewords)" }, + /*105*/ { BARCODE_AZTEC, -1, -1, 35, -1, { 0, 0, "" }, "A", 3591, ZINT_WARN_NONCOMPLIANT, 147, 147, "Warning 708: Number of ECC codewords 73 less than 74 (5% of data codewords 1497)", "" }, + /*106*/ { BARCODE_AZTEC, -1, -1, 35, -1, { 0, 0, "" }, "A", 3760, ZINT_WARN_NONCOMPLIANT, 147, 147, "Warning 708: Number of ECC codewords 3 less than 78 (5% of data codewords 1567)", "" }, + /*107*/ { BARCODE_AZTEC, -1, -1, 35, -1, { 0, 0, "" }, "A", 3761, ZINT_ERROR_TOO_LONG, 0, 0, "Error 505: Input too long for Version 35, requires 1568 codewords (maximum 1567)", "" }, + /*108*/ { BARCODE_AZTEC, -1, -1, 35, -1, { 0, 0, "" }, "\377", 2149, ZINT_WARN_NONCOMPLIANT, 147, 147, "Warning 708: Number of ECC codewords 3 less than 78 (5% of data codewords 1567)", "" }, + /*109*/ { BARCODE_AZTEC, -1, -1, 35, -1, { 0, 0, "" }, "\377", 2150, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 35, requires too many codewords (maximum 1567)", "" }, + /*110*/ { BARCODE_AZTEC, -1, -1, 36, -1, { 0, 0, "" }, "1", 4753, 0, 151, 151, "", "79 ECC codewords (1585 data codewords)" }, + /*111*/ { BARCODE_AZTEC, -1, -1, 36, -1, { 0, 0, "" }, "1", 4981, ZINT_WARN_NONCOMPLIANT, 151, 151, "Warning 708: Number of ECC codewords 3 less than 83 (5% of data codewords 1661)", "" }, + /*112*/ { BARCODE_AZTEC, -1, -1, 36, -1, { 0, 0, "" }, "1", 4982, ZINT_ERROR_TOO_LONG, 0, 0, "Error 502: Input too long, requires too many codewords (maximum 1661)", "" }, + /*113*/ { BARCODE_AZTEC, -1, -1, 36, -1, { 0, 0, "" }, "\377", 2279, ZINT_WARN_NONCOMPLIANT, 151, 151, "Warning 708: Number of ECC codewords 3 less than 83 (5% of data codewords 1661)", "" }, + /*114*/ { BARCODE_AZTEC, -1, -1, 36, -1, { 0, 0, "" }, "\377", 2280, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 36, requires too many codewords (maximum 1661)", "" }, + /*115*/ { BARCODE_AZTEC, 899, -1, 36, -1, { 0, 0, "" }, "\377", 2276, ZINT_WARN_NONCOMPLIANT, 151, 151, "Warning 708: Number of ECC codewords 3 less than 83 (5% of data codewords 1661)", "" }, + /*116*/ { BARCODE_AZTEC, 899, -1, 36, -1, { 0, 0, "" }, "\377", 2277, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 36, requires too many codewords (maximum 1661)", "" }, + /*117*/ { BARCODE_AZTEC, -1, -1, 36, -1, { 2, 3, "" }, "\377", 2276, ZINT_WARN_NONCOMPLIANT, 151, 151, "Warning 708: Number of ECC codewords 3 less than 83 (5% of data codewords 1661)", "" }, + /*118*/ { BARCODE_AZTEC, -1, -1, 36, -1, { 2, 3, "" }, "\377", 2277, ZINT_ERROR_TOO_LONG, 0, 0, "Error 704: Input too long for Version 36, requires too many codewords (maximum 1661)", "" }, + /*119*/ { BARCODE_AZTEC, 899, -1, 36, -1, { 2, 3, "" }, "\377", 2273, ZINT_WARN_NONCOMPLIANT, 151, 151, "Warning 708: Number of ECC codewords 3 less than 83 (5% of data codewords 1661)", "" }, + /*120*/ { BARCODE_AZTEC, 899, -1, 36, -1, { 2, 3, "" }, "\377", 2274, ZINT_ERROR_TOO_LONG, 0, 0, "Error 505: Input too long for Version 36, requires 1662 codewords (maximum 1661)", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -194,24 +204,32 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); - 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->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); - - if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data_buf, length, debug)) { - int cmp_len, ret_len; - char modules_dump[22801 + 1]; - assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); - ret = testUtilZXingCPP(i, symbol, data_buf, 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_buf, 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); - } + if (p_ctx->generate) { + printf(" /*%3d*/ { %s, %d, %d, %d, %s, { %d, %d, \"\" }, \"%s\", %d, %s, %d, %d, \"%s\", \"%s\" },\n", + i, testUtilBarcodeName(data[i].symbology), data[i].eci, data[i].option_1, data[i].option_2, + testUtilOutputOptionsName(data[i].output_options), data[i].structapp.index, data[i].structapp.count, + testUtilEscape(data[i].pattern, (int) strlen(data[i].pattern), escaped, sizeof(escaped)), data[i].length, + testUtilErrorName(data[i].ret), symbol->rows, symbol->width, symbol->errtxt, data[i].comment); } else { - assert_zero(strcmp(symbol->errtxt, data[i].ret_errtxt), "i:%d errtxt %s != %s\n", i, symbol->errtxt, data[i].ret_errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d errtxt %s != %s\n", i, symbol->errtxt, data[i].expected_errtxt); + 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->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); + + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data_buf, length, debug)) { + int cmp_len, ret_len; + char modules_dump[22801 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data_buf, 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_buf, 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); + } + } } ZBarcode_Delete(symbol); @@ -238,32 +256,37 @@ static void test_options(const testCtx *const p_ctx) { const char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 0, 0, "" }, "1234567890", 0, 15, 15, "" }, /* 1*/ { BARCODE_AZTEC, -1, -1, 1, -1, { 0, 0, "" }, "1234567890", 0, 15, 15, "" }, /* 2*/ { BARCODE_AZTEC, -1, -1, 4, -1, { 0, 0, "" }, "1234567890", 0, 19, 19, "" }, - /* 3*/ { BARCODE_AZTEC, -1, -1, 5, -1, { 0, 0, "" }, "1234567890", ZINT_WARN_INVALID_OPTION, 15, 15, "Warning 503: Invalid error correction level - using default instead" }, - /* 4*/ { BARCODE_AZTEC, -1, -1, -1, 1, { 0, 0, "" }, "12345678901234567890", ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Data too long for specified Aztec Code symbol size" }, + /* 3*/ { BARCODE_AZTEC, -1, -1, 5, -1, { 0, 0, "" }, "1234567890", ZINT_WARN_INVALID_OPTION, 15, 15, "Warning 503: Error correction level '5' out of range (1 to 4), ignoring" }, + /* 4*/ { BARCODE_AZTEC, -1, -1, -1, 1, { 0, 0, "" }, "12345678901234567890", ZINT_ERROR_TOO_LONG, -1, -1, "Error 505: Input too long for Version 1, requires 15 codewords (maximum 14)" }, /* 5*/ { BARCODE_AZTEC, -1, -1, -1, 36, { 0, 0, "" }, "1234567890", 0, 151, 151, "" }, - /* 6*/ { BARCODE_AZTEC, -1, -1, -1, 37, { 0, 0, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 510: Invalid Aztec Code size" }, - /* 7*/ { BARCODE_AZTEC, GS1_MODE, READER_INIT, -1, -1, { 0, 0, "" }, "[91]A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 501: Cannot encode in GS1 and Reader Initialisation mode at the same time" }, - /* 8*/ { BARCODE_AZTEC, GS1_MODE, -1, -1, -1, { 0, 0, "" }, "[91]A", 0, 15, 15, "" }, - /* 9*/ { BARCODE_AZTEC, GS1_MODE | GS1PARENS_MODE, -1, -1, -1, { 0, 0, "" }, "(91)A", 0, 15, 15, "" }, - /* 10*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 26, { 0, 0, "" }, "A", 0, 109, 109, "" }, /* 22 layers */ - /* 11*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 27, { 0, 0, "" }, "A", ZINT_ERROR_TOO_LONG, -1, -1, "Error 506: Data too long for reader initialisation symbol" }, /* 23 layers */ - /* 12*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 1, { 0, 0, "" }, "A", 0, 15, 15, "" }, /* Compact 1 layer */ - /* 13*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 2, { 0, 0, "" }, "A", 0, 19, 19, "" }, /* Compact 2 layers gets set to full 1 layer if READER_INIT set */ - /* 14*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "0001", ZINT_ERROR_TOO_LONG, -1, -1, "Error 507: Input too large (3 character maximum)" }, - /* 15*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 508: Invalid character in data (digits only)" }, - /* 16*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "256", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 509: Input out of range (0 to 255)" }, - /* 17*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, "" }, "1234567890", 0, 15, 15, "" }, - /* 18*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, {'1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2'} }, "1234567890", 0, 23, 23, "" }, - /* 19*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 1, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 701: Structured Append count out of range (2-26)" }, - /* 20*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 0, 2, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 702: Structured Append index out of range (1-2)" }, - /* 21*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 3, 2, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 702: Structured Append index out of range (1-2)" }, - /* 22*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, "A B" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 703: Structured Append ID cannot contain spaces" }, + /* 6*/ { BARCODE_AZTEC, -1, -1, -1, 37, { 0, 0, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 510: Version '37' out of range (1 to 36)" }, + /* 7*/ { BARCODE_AZTEC, -1, -1, -1, -2, { 0, 0, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 510: Version '-2' out of range (1 to 36)" }, + /* 8*/ { BARCODE_AZTEC, GS1_MODE, READER_INIT, -1, -1, { 0, 0, "" }, "[91]A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 501: Cannot encode in GS1 and Reader Initialisation mode at the same time" }, + /* 9*/ { BARCODE_AZTEC, GS1_MODE, -1, -1, -1, { 0, 0, "" }, "[91]A", 0, 15, 15, "" }, + /* 10*/ { BARCODE_AZTEC, GS1_MODE | GS1PARENS_MODE, -1, -1, -1, { 0, 0, "" }, "(91)A", 0, 15, 15, "" }, + /* 11*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 26, { 0, 0, "" }, "A", 0, 109, 109, "" }, /* 22 layers */ + /* 12*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 27, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 709: Version '27' out of range for Reader Initialisation symbols (maximum 26)" }, /* 23 layers */ + /* 13*/ { BARCODE_AZTEC, -1, READER_INIT, 4, -1, { 0, 0, "" }, "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377", ZINT_ERROR_TOO_LONG, -1, -1, "Error 506: Input too long for Reader Initialisation, requires 23 layers (maximum 22)" }, /* 23 layers */ + /* 14*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 1, { 0, 0, "" }, "A", 0, 15, 15, "" }, /* Compact 1 layer */ + /* 15*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 3, { 0, 0, "" }, "A", 0, 19, 19, "" }, /* Compact 3 layers gets set to full 1 layer if READER_INIT set */ + /* 16*/ { BARCODE_AZTEC, -1, -1, 1, -1, { 0, 0, "" }, "A", 0, 15, 15, "" }, /* Compact 1 layer */ + /* 17*/ { BARCODE_AZTEC, -1, READER_INIT, 1, -1, { 0, 0, "" }, "A", 0, 15, 15, "" }, /* Still compact 1 layer if READER_INIT set */ + /* 18*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "0001", ZINT_ERROR_TOO_LONG, -1, -1, "Error 507: Input length 4 too long (maximum 3)" }, + /* 19*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 508: Invalid character at position 1 in input (digits only)" }, + /* 20*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "256", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 509: Input value out of range (0 to 255)" }, + /* 21*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, "" }, "1234567890", 0, 15, 15, "" }, + /* 22*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, {'1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2'} }, "1234567890", 0, 23, 23, "" }, + /* 23*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 1, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 701: Structured Append count '1' out of range (2 to 26)" }, + /* 24*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 0, 2, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 702: Structured Append index '0' out of range (1 to count 2)" }, + /* 25*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 3, 2, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 702: Structured Append index '3' out of range (1 to count 2)" }, + /* 26*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, "A B" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 703: Structured Append ID cannot contain spaces" }, + /* 27*/ { BARCODE_HIBC_AZTEC, -1, -1, -1, -1, { 0, 0, "" }, "1234567890;", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 203: Invalid character at position 11 in input (alphanumerics, space and \"-.$/+%\" only)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -316,7 +339,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_AZTEC, UNICODE_MODE, -1, -1, -1, 1, "123456789012", -1, 0, 15, 15, 1, "ISO/IEC 24778:2008 Figure 1 (left)", "000111000011100" "110111001110010" @@ -2577,7 +2600,7 @@ static void test_encode(const testCtx *const p_ctx) { "00111111100" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -2668,7 +2691,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, -1, -1, 1, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 15, 15, 1, "ISO/IEC 24778:2008 16.5 example", "001111000011111" "110111100100011" @@ -2843,7 +2866,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { "10001000000000111000011" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, j, seg_count, ret; struct zint_symbol *symbol = NULL; @@ -2948,9 +2971,10 @@ static void test_fuzz(const testCtx *const p_ctx) { char *data; int length; int ret; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_AZTEC, DATA_MODE, -1, -1, "\133\060\060\060\135\060\125\125\125\125\140\060\125\125\125\125\060\060\060\271\060\060\125\103\164\125\125\125\377\377\125\125" "\125\125\125\125\125\133\060\076\060\135\261\177\261\261\261\236\261\261\261\040\261\261\261\261\261\261\261\020\261\261\261\261" @@ -3023,7 +3047,7 @@ static void test_fuzz(const testCtx *const p_ctx) { "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" "\377\377\377\377\377\377\261\261\261\261\261\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\135\135\135\135\135\135" "\135\335\135\060\060\010\010\010\010\010\060", - 2251, ZINT_ERROR_TOO_LONG + 2251, ZINT_ERROR_TOO_LONG, "Error 707: Input too long for ECC level 2, requires too many codewords (maximum 1279)" }, /* Original OSS-Fuzz triggering data for malloc leak */ /* 1*/ { BARCODE_AZTEC, DATA_MODE, -1, -1, "\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060" @@ -3114,7 +3138,7 @@ static void test_fuzz(const testCtx *const p_ctx) { "\060\060\060\363\060\060\060\060\060\060\060\060\060\060\060\060\362\060\060\060\060\060\000\060\060\377\060\060\060\175\175\175" "\175\060\060\060\175\175\175\175\060\060\005\060\005\060\005\060\060\060\060\000\000\060\060\060\060\060\060\377\060\060\060\060" "\377\060\377\377\060\060\057\060\060\057\060\060\060\000\000\060\060", - 2801, ZINT_ERROR_TOO_LONG + 2801, ZINT_ERROR_TOO_LONG, "Error 502: Input too long, requires too many codewords (maximum 1661)" }, /* Original OSS-Fuzz triggering data for binary_string buffer overrun */ /* 2*/ { BARCODE_AZTEC, -1, 1, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" @@ -3150,7 +3174,7 @@ static void test_fuzz(const testCtx *const p_ctx) { "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", - 4483, 0 + 4483, 0, "" }, /* 4483 = (1664 (Max codewords) - 169 (ECC codewords) - 5/12 (D/L) - 3/12 (padding)) * 3 (3 4-bit digits per 12-bit wordcode) = 4483 */ /* 3*/ { BARCODE_AZTEC, -1, 1, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" @@ -3186,7 +3210,7 @@ static void test_fuzz(const testCtx *const p_ctx) { "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", - 4484, ZINT_ERROR_TOO_LONG + 4484, ZINT_ERROR_TOO_LONG, "Error 707: Input too long for ECC level 1, requires too many codewords (maximum 1495)" }, /* 4*/ { BARCODE_AZTEC, -1, 1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -3216,8 +3240,8 @@ static void test_fuzz(const testCtx *const p_ctx) { "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" - "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY", - 3587, 0 + "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", + 3588, 0, "" }, /* 5*/ { BARCODE_AZTEC, -1, 1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -3247,8 +3271,8 @@ static void test_fuzz(const testCtx *const p_ctx) { "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" - "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", - 3588, ZINT_ERROR_TOO_LONG + "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA", + 3589, ZINT_ERROR_TOO_LONG, "Error 707: Input too long for ECC level 1, requires too many codewords (maximum 1495)" }, /* 6*/ { BARCODE_AZTEC, -1, 1, -1, "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" @@ -3307,7 +3331,7 @@ static void test_fuzz(const testCtx *const p_ctx) { "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240", - 2237, 0 + 2237, 0, "" }, /* 7*/ { BARCODE_AZTEC, -1, 1, -1, "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" @@ -3366,7 +3390,7 @@ static void test_fuzz(const testCtx *const p_ctx) { "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240", - 2238, ZINT_ERROR_TOO_LONG + 2238, ZINT_ERROR_TOO_LONG, "Error 707: Input too long for ECC level 1, requires too many codewords (maximum 1495)" }, /* 8*/ { BARCODE_AZTEC, DATA_MODE, -1, 1, "\105\105\000\000\000\000\000\000\000\000\077\012\377\377\377\072\376\376\350\350\350\350\350\250\350\350\350\350\354\350\350\350\350\350\001\000\000\000\000\000" @@ -3424,7 +3448,7 @@ static void test_fuzz(const testCtx *const p_ctx) { "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\377\377\377\377\377\377\377\000\177\377\377\377" "\046\000\000\000\000\000\000\027\027\027\027\027\027\027\027\027\027\027\027\000\027\027\027\027\000\004\000\000\000\000\000\135\000\044\103\000\000\377\377\377" "\377\377\103\377\364\377\364", - 2167, ZINT_ERROR_TOO_LONG + 2167, ZINT_ERROR_TOO_LONG, "Error 704: Input too long for Version 1, requires too many codewords (maximum 14)" }, /* #300 (#2) Andre Maute */ /* 9*/ { BARCODE_AZTEC, DATA_MODE, 1, -1, "111\377\377\377\377\377\377\377\377" @@ -3480,7 +3504,7 @@ static void test_fuzz(const testCtx *const p_ctx) { "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" "111", - 2054, 0 + 2054, 0, "" }, /* 2048 byte block surrounded by digits */ /* 10*/ { BARCODE_AZTEC, DATA_MODE, -1, 1, "\105\105\000\000\000\000\000\000\000\000\077\012\377\377\377\072\376\376\350\350\350\350\350\250\350\350\350\350\354\350\350\350\350\350\001\000\000\000\000\000" @@ -3537,7 +3561,7 @@ static void test_fuzz(const testCtx *const p_ctx) { "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\377\377\377\377\377\377\377\000\177\377\377\377\046\000\000\000\000\000\000\027\027\027" "\027\027\027\027\027\027\027\027\027\000\027\027\027\027\000\004\000\000\000\000\000\135\000\044\103\000\000\377\377\377\377\377\103\377\364\377\364", - 2157, ZINT_ERROR_TOO_LONG + 2157, ZINT_ERROR_TOO_LONG, "Error 704: Input too long for Version 1, requires too many codewords (maximum 14)" }, /* #300 (#3) Andre Maute */ /* 11*/ { BARCODE_AZTEC, DATA_MODE, 2, -1, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" @@ -3565,7 +3589,7 @@ static void test_fuzz(const testCtx *const p_ctx) { "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", - 996, 0 + 996, 0, "" }, /* Padding 11 example causing issue with ZXing-C++ */ /* 12*/ { BARCODE_AZTEC, DATA_MODE, -1, -1, "\133\060\060\060\135\060\125\125\125\125\140\060\125\125\125\125\060\060\060\271\060\060\125\103\164\125\125\125\377\377\125\125\125\125\125\125\125\133\060\076" @@ -3679,10 +3703,10 @@ static void test_fuzz(const testCtx *const p_ctx) { "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" "\377\377\377\377\377\261\261\261\261\261\060\060\060\060\060\060\060\060\060\060\060\060\060\060\060\135\135\135\135\135\135\135\335\135\060\060\010\010\010\010" "\010\060", - 4402, ZINT_ERROR_TOO_LONG + 4402, ZINT_ERROR_TOO_LONG, "Error 502: Input too long, requires too many codewords (maximum 1661)" }, /* fuzz_data (1st) */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -3705,6 +3729,8 @@ static void test_fuzz(const testCtx *const p_ctx) { 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", 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) { @@ -3747,7 +3773,7 @@ static void test_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_AZTEC, -1, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -3787,7 +3813,7 @@ static void test_perf(const testCtx *const p_ctx) { "255", 0, 11, 11, "3 chars, AZRUNE" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; diff --git a/backend/tests/test_bc412.c b/backend/tests/test_bc412.c index 8fe06cbe..6b677818 100644 --- a/backend/tests/test_bc412.c +++ b/backend/tests/test_bc412.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2022 Robin Stuart + Copyright (C) 2022-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -47,12 +47,12 @@ static void test_input(const testCtx *const p_ctx) { char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { UNICODE_MODE, -1, -1, "123456", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 790: Input wrong length (should be between 7 and 18 characters)", "" }, - /* 1*/ { UNICODE_MODE, -1, -1, "1234567890123456789", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 790: Input wrong length (should be between 7 and 18 characters)", "" }, + static const struct item data[] = { + /* 0*/ { UNICODE_MODE, -1, -1, "123456", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 792: Input length 6 too short (minimum 7)", "" }, + /* 1*/ { UNICODE_MODE, -1, -1, "1234567890123456789", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 790: Input length 19 too long (maximum 18)", "" }, /* 2*/ { UNICODE_MODE, -1, -1, "1234567", -1, 0, 1, 102, "1U234567", "" }, - /* 3*/ { UNICODE_MODE, -1, -1, "1234567 ", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 791: Invalid character in data (alphanumerics only, excluding the letter \"O\")", "" }, - /* 4*/ { UNICODE_MODE, -1, -1, "ABCDEFGHIJKLMNOPQR", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 791: Invalid character in data (alphanumerics only, excluding the letter \"O\")", "" }, + /* 3*/ { UNICODE_MODE, -1, -1, "1234567 ", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 791: Invalid character at position 8 in input (alphanumerics only, excluding \"O\")", "" }, + /* 4*/ { UNICODE_MODE, -1, -1, "ABCDEFGHIJKLMNOPQR", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 791: Invalid character at position 15 in input (alphanumerics only, excluding \"O\")", "" }, /* 5*/ { UNICODE_MODE, -1, -1, "ABCDEFGHIJKLMNPQRS", -1, 0, 1, 234, "AQBCDEFGHIJKLMNPQRS", "" }, /* 6*/ { UNICODE_MODE, -1, -1, "STUVWXYZ1234567890", -1, 0, 1, 234, "SCTUVWXYZ1234567890", "" }, /* 7*/ { UNICODE_MODE, -1, -1, "abcdefghijklmnpqrs", -1, 0, 1, 234, "AQBCDEFGHIJKLMNPQRS", "" }, @@ -71,16 +71,16 @@ static void test_input(const testCtx *const p_ctx) { /* 20*/ { UNICODE_MODE, -1, -1, "2J1STN4ZE8AHVLG90R", -1, 0, 1, 234, "2PJ1STN4ZE8AHVLG90R", "" }, /* 21*/ { UNICODE_MODE, -1, -1, "JJJJJJJJJJJJJJJJJJ", -1, 0, 1, 234, "J9JJJJJJJJJJJJJJJJJ", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char bwipp_buf[8192]; char bwipp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ - testStart("test_input"); + testStartSymbol("test_input", &symbol); for (i = 0; i < data_size; i++) { @@ -135,7 +135,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, -1, -1, "AQ45670", 0, 1, 102, 1, "SEMI T1-95 Figure 2, same", "100101000100100100010101000100010101000101010000010101001010000101001001000101001000100101010100000101" }, @@ -143,9 +143,9 @@ static void test_encode(const testCtx *const p_ctx) { "100101000100100100100010100101001001000101000100010101000010100101010010000101010001000101010000100101010000010101" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[1024]; char bwipp_buf[8192]; @@ -153,7 +153,7 @@ static void test_encode(const testCtx *const p_ctx) { int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ - testStart("test_encode"); + testStartSymbol("test_encode", &symbol); for (i = 0; i < data_size; i++) { diff --git a/backend/tests/test_bmp.c b/backend/tests/test_bmp.c index b98f015a..1c33773a 100644 --- a/backend/tests/test_bmp.c +++ b/backend/tests/test_bmp.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2022 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -45,7 +45,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) { int ret; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { 1, 1, "1", 0, 0 }, /* 1*/ { 2, 1, "11", 0, 0 }, /* 2*/ { 2, 2, "10", 1, 0 }, @@ -57,7 +57,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) { /* 8*/ { 5, 1, "10101", 0, 0 }, /* 9*/ { 8, 2, "CBMWKRYGGYRKWMBC", 0, 0 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, ret; struct zint_symbol *symbol; @@ -140,13 +140,13 @@ static void test_print(const testCtx *const p_ctx) { char *data; char *expected_file; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_PDF417, -1, -1, 5, -1, -1, -1, "147AD0", "FC9630", "123", "pdf417_fg_bg.bmp" }, /* 1*/ { BARCODE_ULTRA, -1, -1, 5, -1, -1, -1, "147AD0", "FC9630", "123", "ultracode_fg_bg.bmp" }, /* 2*/ { BARCODE_ULTRA, 1, BARCODE_BOX, 1, 1, -1, -1, "147AD0", "FC9630", "123", "ultracode_fg_bg_hvwsp1_box1.bmp" }, /* 3*/ { BARCODE_PDF417COMP, -1, -1, 2, 2, -1, -1, "", "", "123", "pdf417comp_hvwsp2.bmp" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; @@ -266,12 +266,15 @@ static void test_outfile(const testCtx *const p_ctx) { skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ #endif if (!skip_readonly_test) { + static char expected_errtxt[] = "601: Could not open BMP output file ("; /* Excluding OS-dependent `errno` stuff */ + (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ assert_nonzero(testUtilCreateROFile(symbol.outfile), "bmp_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret = bmp_pixel_plot(&symbol, data); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "bmp_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "bmp_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); + assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); } symbol.output_options |= BARCODE_STDOUT; diff --git a/backend/tests/test_channel.c b/backend/tests/test_channel.c index cab3d317..5daf8d55 100644 --- a/backend/tests/test_channel.c +++ b/backend/tests/test_channel.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2022 Robin Stuart + Copyright (C) 2019-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -42,7 +42,7 @@ static void test_hrt(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { -1, "1", -1, "01" }, /* 1*/ { 3, "1", -1, "01" }, /* 2*/ { 3, "12", -1, "12" }, @@ -65,11 +65,11 @@ static void test_hrt(const testCtx *const p_ctx) { /* 19*/ { 8, "12", -1, "0000012" }, /* 20*/ { 8, "1", -1, "0000001" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_hrt"); + testStartSymbol("test_hrt", &symbol); for (i = 0; i < data_size; i++) { @@ -100,67 +100,70 @@ static void test_input(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { -1, "0", 0, 1, 19 }, /* < 3 ignored */ - /* 1*/ { 0, "0", 0, 1, 19, }, - /* 2*/ { 1, "0", 0, 1, 19, }, - /* 3*/ { 2, "0", 0, 1, 19, }, - /* 4*/ { 9, "0", 0, 1, 19, }, /* > 8 ignored */ - /* 5*/ { -1, "00", 0, 1, 19 }, - /* 6*/ { 3, "00", 0, 1, 19 }, - /* 7*/ { -1, "26", 0, 1, 19, }, - /* 8*/ { 3, "26", 0, 1, 19, }, - /* 9*/ { 3, "27", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 10*/ { 3, "000", 0, 1, 19, }, - /* 11*/ { 3, "001", 0, 1, 19, }, - /* 12*/ { 3, "026", 0, 1, 19, }, - /* 13*/ { -1, "27", 0, 1, 23 }, /* Channel 4 */ - /* 14*/ { -1, "026", 0, 1, 23, }, /* Defaults to channel 4 due to length */ - /* 15*/ { 3, "0026", 0, 1, 19, }, - /* 16*/ { 3, "1234", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 17*/ { 4, "000", 0, 1, 23 }, - /* 18*/ { -1, "000", 0, 1, 23 }, /* Defaults to channel 4 due to length */ - /* 19*/ { 4, "026", 0, 1, 23 }, - /* 20*/ { 4, "0000026", 0, 1, 23 }, - /* 21*/ { 4, "0000", 0, 1, 23 }, - /* 22*/ { 4, "292", 0, 1, 23 }, - /* 23*/ { 4, "293", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 24*/ { -1, "293", 0, 1, 27 }, /* Channel 5 */ - /* 25*/ { 5, "0000", 0, 1, 27 }, - /* 26*/ { -1, "0000", 0, 1, 27 }, /* Defaults to channel 5 due to length */ - /* 27*/ { -1, "3493", 0, 1, 27 }, - /* 28*/ { 5, "3493", 0, 1, 27 }, - /* 29*/ { 5, "3494", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 30*/ { -1, "3494", 0, 1, 31 }, /* Channel 6 */ - /* 31*/ { 6, "00000", 0, 1, 31 }, - /* 32*/ { -1, "00000", 0, 1, 31 }, /* Defaults to channel 5 due to length */ - /* 33*/ { -1, "44072", 0, 1, 31 }, - /* 34*/ { 6, "44072", 0, 1, 31 }, - /* 35*/ { 6, "44073", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 36*/ { -1, "44073", 0, 1, 35 }, /* Channel 7 */ - /* 37*/ { 7, "000000", 0, 1, 35 }, - /* 38*/ { -1, "000000", 0, 1, 35 }, /* Defaults to channel 7 due to length */ - /* 39*/ { 7, "576688", 0, 1, 35 }, - /* 40*/ { 7, "576689", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 41*/ { 7, "0576688", 0, 1, 35 }, - /* 42*/ { -1, "1234567", 0, 1, 39 }, - /* 43*/ { -1, "576689", 0, 1, 39 }, /* Channel 8 */ - /* 44*/ { 8, "0000000", 0, 1, 39, }, - /* 45*/ { -1, "0000000", 0, 1, 39, }, /* Defaults to channel 8 due to length */ - /* 46*/ { 8, "1234567", 0, 1, 39, }, - /* 47*/ { 8, "7742863", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 48*/ { 8, "01234567", ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 49*/ { 8, "00000000", ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 50*/ { 9, "7742863", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 51*/ { -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1 }, + static const struct item data[] = { + /* 0*/ { -1, "0", 0, 1, 19, "" }, /* < 3 ignored */ + /* 1*/ { 0, "0", 0, 1, 19, "" }, + /* 2*/ { 1, "0", 0, 1, 19, "" }, + /* 3*/ { 2, "0", 0, 1, 19, "" }, + /* 4*/ { 9, "0", 0, 1, 19, "" }, /* > 8 ignored */ + /* 5*/ { -1, "00", 0, 1, 19, "" }, + /* 6*/ { 3, "00", 0, 1, 19, "" }, + /* 7*/ { -1, "26", 0, 1, 19, "" }, + /* 8*/ { 3, "26", 0, 1, 19, "" }, + /* 9*/ { 3, "27", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 335: Input value \"27\" out of range (0 to 26 for 3 channels)" }, + /* 10*/ { 3, "027", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 335: Input value \"27\" out of range (0 to 26 for 3 channels)" }, + /* 11*/ { 3, "000", 0, 1, 19, "" }, + /* 12*/ { 3, "001", 0, 1, 19, "" }, + /* 13*/ { 3, "026", 0, 1, 19, "" }, + /* 14*/ { -1, "27", 0, 1, 23, "" }, /* Channel 4 */ + /* 15*/ { -1, "026", 0, 1, 23, "" }, /* Defaults to channel 4 due to length */ + /* 16*/ { 3, "0026", 0, 1, 19, "" }, + /* 17*/ { 3, "1234", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 335: Input value \"1234\" out of range (0 to 26 for 3 channels)" }, + /* 18*/ { 4, "000", 0, 1, 23, "" }, + /* 19*/ { -1, "000", 0, 1, 23, "" }, /* Defaults to channel 4 due to length */ + /* 20*/ { 4, "026", 0, 1, 23, "" }, + /* 21*/ { 4, "0000026", 0, 1, 23, "" }, + /* 22*/ { 4, "0000", 0, 1, 23, "" }, + /* 23*/ { 4, "292", 0, 1, 23, "" }, + /* 24*/ { 4, "293", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 335: Input value \"293\" out of range (0 to 292 for 4 channels)" }, + /* 25*/ { 4, "000293", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 335: Input value \"293\" out of range (0 to 292 for 4 channels)" }, + /* 26*/ { -1, "293", 0, 1, 27, "" }, /* Channel 5 */ + /* 27*/ { 5, "0000", 0, 1, 27, "" }, + /* 28*/ { -1, "0000", 0, 1, 27, "" }, /* Defaults to channel 5 due to length */ + /* 29*/ { -1, "3493", 0, 1, 27, "" }, + /* 30*/ { 5, "3493", 0, 1, 27, "" }, + /* 31*/ { 5, "3494", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 335: Input value \"3494\" out of range (0 to 3493 for 5 channels)" }, + /* 32*/ { -1, "3494", 0, 1, 31, "" }, /* Channel 6 */ + /* 33*/ { 6, "00000", 0, 1, 31, "" }, + /* 34*/ { -1, "00000", 0, 1, 31, "" }, /* Defaults to channel 5 due to length */ + /* 35*/ { -1, "44072", 0, 1, 31, "" }, + /* 36*/ { 6, "44072", 0, 1, 31, "" }, + /* 37*/ { 6, "44073", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 335: Input value \"44073\" out of range (0 to 44072 for 6 channels)" }, + /* 38*/ { -1, "44073", 0, 1, 35, "" }, /* Channel 7 */ + /* 39*/ { 7, "000000", 0, 1, 35, "" }, + /* 40*/ { -1, "000000", 0, 1, 35, "" }, /* Defaults to channel 7 due to length */ + /* 41*/ { 7, "576688", 0, 1, 35, "" }, + /* 42*/ { 7, "576689", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 335: Input value \"576689\" out of range (0 to 576688 for 7 channels)" }, + /* 43*/ { 7, "0576688", 0, 1, 35, "" }, + /* 44*/ { -1, "1234567", 0, 1, 39, "" }, + /* 45*/ { -1, "576689", 0, 1, 39, "" }, /* Channel 8 */ + /* 46*/ { 8, "0000000", 0, 1, 39, "" }, + /* 47*/ { -1, "0000000", 0, 1, 39, "" }, /* Defaults to channel 8 due to length */ + /* 48*/ { 8, "1234567", 0, 1, 39, "" }, + /* 49*/ { 8, "7742863", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 318: Input value \"7742863\" out of range (0 to 7742862)" }, + /* 50*/ { 8, "01234567", ZINT_ERROR_TOO_LONG, -1, -1, "Error 333: Input length 8 too long (maximum 7)" }, + /* 51*/ { 8, "00000000", ZINT_ERROR_TOO_LONG, -1, -1, "Error 333: Input length 8 too long (maximum 7)" }, + /* 52*/ { 9, "7742863", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 318: Input value \"7742863\" out of range (0 to 7742862)" }, + /* 53*/ { -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 334: Invalid character at position 1 in input (digits only)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_input"); + testStartSymbol("test_input", &symbol); for (i = 0; i < data_size; i++) { @@ -173,6 +176,8 @@ static void test_input(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); + assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -200,7 +205,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { -1, "1234", 0, 1, 27, "ANSI/AIM BC12-1998 Figure 1", "101010101001010010011110011" }, @@ -412,15 +417,15 @@ static void test_encode(const testCtx *const p_ctx) { "101010101000001110010101101100101110011" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[1024]; char bwipp_buf[8192]; char bwipp_msg[1024]; - testStart("test_encode"); + testStartSymbol("test_encode", &symbol); for (i = 0; i < data_size; i++) { @@ -473,8 +478,8 @@ static void test_generate(const testCtx *const p_ctx) { struct item { char *data; }; - struct item data[] = { { "576688" }, { "7742862" } }; - int data_size = ARRAY_SIZE(data); + static const struct item data[] = { { "576688" }, { "7742862" } }; + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; diff --git a/backend/tests/test_codablock.c b/backend/tests/test_codablock.c index eafd921a..1317b40f 100644 --- a/backend/tests/test_codablock.c +++ b/backend/tests/test_codablock.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2023 Robin Stuart + Copyright (C) 2019-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -42,48 +42,51 @@ static void test_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { -1, -1, "A", 2666, 0, 44, 728 }, - /* 1*/ { -1, -1, "A", 2725, 0, 44, 739 }, - /* 2*/ { -1, -1, "A", 2726, 0, 44, 739 }, /* 4.2.1 c.3 says max 2725 but actually 44 * 62 - 2 == 2726 as mentioned later in 4.8.1 */ - /* 3*/ { -1, -1, "A", 2727, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 4*/ { -1, -1, "A", ZINT_MAX_DATA_LEN, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 5*/ { -1, -1, "12", 2726 * 2, 0, 44, 739 }, - /* 6*/ { -1, -1, "12", 2726 * 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 7*/ { -1, -1, "\351", 2726 / 2, 0, 44, 739 }, - /* 8*/ { -1, -1, "\351", 2726 / 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 9*/ { 1, -1, "A", 99, 0, 1, 1124 }, /* CODE128 99 max */ - /* 10*/ { 1, -1, "A", 100, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 11*/ { 2, -1, "A", 122, 0, 2, 739 }, - /* 12*/ { 2, 10, "A", 122, 0, 2, 739 }, /* Cols 10 -> 67 */ - /* 13*/ { 2, 67, "A", 122, 0, 2, 739 }, - /* 14*/ { 2, -1, "A", 123, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 15*/ { 2, -1, "A", 63 * 2, ZINT_ERROR_TOO_LONG, -1, -1 }, /* Triggers initial testColumns > 62 */ - /* 16*/ { 2, -1, "A", 2726 * 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 17*/ { 2, 9, "A", 2726 * 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 18*/ { 3, -1, "A", 184, 0, 3, 739 }, - /* 19*/ { 3, -1, "A", 185, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 20*/ { 10, -1, "A", 618, 0, 10, 739 }, - /* 21*/ { 10, -1, "A", 619, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 22*/ { 20, -1, "A", 1238, 0, 20, 739 }, - /* 23*/ { 20, -1, "A", 1239, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 24*/ { 30, -1, "A", 1858, 0, 30, 739 }, - /* 25*/ { 30, -1, "A", 1859, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 26*/ { 40, -1, "A", 2478, 0, 40, 739 }, - /* 27*/ { 40, -1, "A", 2479, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 28*/ { 43, -1, "A", 2664, 0, 43, 739 }, - /* 29*/ { 43, -1, "A", 2665, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 30*/ { 44, -1, "A", 2726, 0, 44, 739 }, - /* 31*/ { 44, -1, "A", 2727, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 32*/ { 44, 60, "A", 2726, 0, 44, 739 }, /* Cols 60 -> 67 */ - /* 33*/ { 44, 67, "A", 2726, 0, 44, 739 }, + static const struct item data[] = { + /* 0*/ { -1, -1, "A", 2666, 0, 44, 728, "" }, + /* 1*/ { -1, -1, "A", 2725, 0, 44, 739, "" }, + /* 2*/ { -1, -1, "A", 2726, 0, 44, 739, "" }, /* 4.2.1 c.3 says max 2725 but actually 44 * 62 - 2 == 2726 as mentioned later in 4.8.1 */ + /* 3*/ { -1, -1, "A", 2727, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 4*/ { -1, -1, "A", ZINT_MAX_DATA_LEN, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 5*/ { -1, -1, "12", 2726 * 2, 0, 44, 739, "" }, + /* 6*/ { -1, -1, "12", 2726 * 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 7*/ { -1, -1, "\351", 2726 / 2, 0, 44, 739, "" }, + /* 8*/ { -1, -1, "\351", 2726 / 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 9*/ { -1, -1, "\001", 2726, 0, 44, 739, "" }, + /* 10*/ { -1, -1, "\001", 2727, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 11*/ { 1, -1, "A", 99, 0, 1, 1124, "" }, /* CODE128 99 max */ + /* 12*/ { 1, -1, "A", 100, ZINT_ERROR_TOO_LONG, -1, -1, "Error 341: Input too long, requires 100 symbol characters (maximum 99)" }, + /* 13*/ { 2, -1, "A", 122, 0, 2, 739, "" }, + /* 14*/ { 2, 10, "A", 122, 0, 2, 739, "" }, /* Cols 10 -> 67 */ + /* 15*/ { 2, 67, "A", 122, 0, 2, 739, "" }, + /* 16*/ { 2, -1, "A", 123, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 17*/ { 2, -1, "A", 63 * 2, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, /* Triggers initial testColumns > 62 */ + /* 18*/ { 2, -1, "A", 2726 * 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 19*/ { 2, 9, "A", 2726 * 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 20*/ { 3, -1, "A", 184, 0, 3, 739, "" }, + /* 21*/ { 3, -1, "A", 185, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 22*/ { 10, -1, "A", 618, 0, 10, 739, "" }, + /* 23*/ { 10, -1, "A", 619, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 24*/ { 20, -1, "A", 1238, 0, 20, 739, "" }, + /* 25*/ { 20, -1, "A", 1239, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 26*/ { 30, -1, "A", 1858, 0, 30, 739, "" }, + /* 27*/ { 30, -1, "A", 1859, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 28*/ { 40, -1, "A", 2478, 0, 40, 739, "" }, + /* 29*/ { 40, -1, "A", 2479, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 30*/ { 43, -1, "A", 2664, 0, 43, 739, "" }, + /* 31*/ { 43, -1, "A", 2665, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 32*/ { 44, -1, "A", 2726, 0, 44, 739, "" }, + /* 33*/ { 44, -1, "A", 2727, ZINT_ERROR_TOO_LONG, -1, -1, "Error 413: Input too long, requires too many symbol characters (maximum 2726)" }, + /* 34*/ { 44, 60, "A", 2726, 0, 44, 739, "" }, /* Cols 60 -> 67 */ + /* 35*/ { 44, 67, "A", 2726, 0, 44, 739, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -105,6 +108,8 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -128,36 +133,37 @@ static void test_options(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { UNICODE_MODE, 1, -1, "é", 0, 1, 57, "CODE128" }, - /* 1*/ { UNICODE_MODE, -1, -1, "A", 0, 2, 101, "Defaults" }, - /* 2*/ { UNICODE_MODE, 0, -1, "A", 0, 2, 101, "0 rows same as -1" }, - /* 3*/ { UNICODE_MODE, 2, -1, "A", 0, 2, 101, "Rows 2, columns default" }, - /* 4*/ { UNICODE_MODE, 3, -1, "A", 0, 3, 101, "Rows 3" }, - /* 5*/ { UNICODE_MODE, 43, -1, "A", 0, 43, 101, "Rows 43" }, - /* 6*/ { UNICODE_MODE, 44, -1, "A", 0, 44, 101, "Max rows" }, - /* 7*/ { UNICODE_MODE, 45, -1, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, "" }, - /* 8*/ { UNICODE_MODE, -1, -1, "abcdefg", 0, 3, 101, "" }, - /* 9*/ { UNICODE_MODE, 2, -1, "abcdefg", 0, 2, 112, "Rows given so columns expanded" }, - /* 10*/ { UNICODE_MODE, 3, -1, "abcdefg", 0, 3, 101, "" }, - /* 11*/ { UNICODE_MODE, -1, 8, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Min columns 9 (4 data)" }, - /* 12*/ { UNICODE_MODE, -1, 9, "A", 0, 2, 101, "Min columns 9 (4 data)" }, - /* 13*/ { UNICODE_MODE, -1, 10, "A", 0, 2, 112, "Columns 10" }, - /* 14*/ { UNICODE_MODE, -1, 66, "A", 0, 2, 728, "Columns 66" }, - /* 15*/ { UNICODE_MODE, -1, 67, "A", 0, 2, 739, "Max columns 67 (62 data)" }, - /* 16*/ { UNICODE_MODE, -1, 68, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, "" }, - /* 17*/ { UNICODE_MODE, 2, 9, "A", 0, 2, 101, "Rows and columns defaults given" }, - /* 18*/ { UNICODE_MODE, 2, 10, "A", 0, 2, 112, "Rows and columns given" }, - /* 19*/ { UNICODE_MODE, 3, 11, "A", 0, 3, 123, "" }, - /* 20*/ { UNICODE_MODE, 43, 66, "A", 0, 43, 728, "" }, - /* 21*/ { UNICODE_MODE, 44, 67, "A", 0, 44, 739, "Max rows, max columns" }, - /* 22*/ { GS1_MODE, -1, -1, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, "GS1 not supported" }, - /* 23*/ { GS1_MODE, 1, -1, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Check for CODE128" }, + static const struct item data[] = { + /* 0*/ { UNICODE_MODE, 1, -1, "é", 0, 1, 57, "", "CODE128" }, + /* 1*/ { UNICODE_MODE, -1, -1, "A", 0, 2, 101, "", "Defaults" }, + /* 2*/ { UNICODE_MODE, 0, -1, "A", 0, 2, 101, "", "0 rows same as -1" }, + /* 3*/ { UNICODE_MODE, 2, -1, "A", 0, 2, 101, "", "Rows 2, columns default" }, + /* 4*/ { UNICODE_MODE, 3, -1, "A", 0, 3, 101, "", "Rows 3" }, + /* 5*/ { UNICODE_MODE, 43, -1, "A", 0, 43, 101, "", "Rows 43" }, + /* 6*/ { UNICODE_MODE, 44, -1, "A", 0, 44, 101, "", "Max rows" }, + /* 7*/ { UNICODE_MODE, 45, -1, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 410: Number of rows '45' out of range (0 to 44)", "" }, + /* 8*/ { UNICODE_MODE, -1, -1, "abcdefg", 0, 3, 101, "", "" }, + /* 9*/ { UNICODE_MODE, 2, -1, "abcdefg", 0, 2, 112, "", "Rows given so columns expanded" }, + /* 10*/ { UNICODE_MODE, 3, -1, "abcdefg", 0, 3, 101, "", "" }, + /* 11*/ { UNICODE_MODE, -1, 8, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 411: Number of columns '8' out of range (9 to 67)", "Min columns 9 (4 data)" }, + /* 12*/ { UNICODE_MODE, -1, 9, "A", 0, 2, 101, "", "Min columns 9 (4 data)" }, + /* 13*/ { UNICODE_MODE, -1, 10, "A", 0, 2, 112, "", "Columns 10" }, + /* 14*/ { UNICODE_MODE, -1, 66, "A", 0, 2, 728, "", "Columns 66" }, + /* 15*/ { UNICODE_MODE, -1, 67, "A", 0, 2, 739, "", "Max columns 67 (62 data)" }, + /* 16*/ { UNICODE_MODE, -1, 68, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 411: Number of columns '68' out of range (9 to 67)", "" }, + /* 17*/ { UNICODE_MODE, 2, 9, "A", 0, 2, 101, "", "Rows and columns defaults given" }, + /* 18*/ { UNICODE_MODE, 2, 10, "A", 0, 2, 112, "", "Rows and columns given" }, + /* 19*/ { UNICODE_MODE, 3, 11, "A", 0, 3, 123, "", "" }, + /* 20*/ { UNICODE_MODE, 43, 66, "A", 0, 43, 728, "", "" }, + /* 21*/ { UNICODE_MODE, 44, 67, "A", 0, 44, 739, "", "Max rows, max columns" }, + /* 22*/ { GS1_MODE, -1, -1, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 220: Selected symbology does not support GS1 mode", "" }, + /* 23*/ { GS1_MODE, 1, -1, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 220: Selected symbology does not support GS1 mode", "Check for CODE128" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -174,6 +180,8 @@ static void test_options(const testCtx *const p_ctx) { 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_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); + assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); 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); @@ -200,12 +208,12 @@ static void test_reader_init(const testCtx *const p_ctx) { char *expected; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODABLOCKF, UNICODE_MODE, READER_INIT, "1234", 0, 2, 101, "67 64 40 60 63 0C 22 2B 6A 67 64 0B 63 64 3A 1C 29 6A", "CodeB FNC3 CodeC 12 34 / CodeB Pads" }, /* 1*/ { BARCODE_CODABLOCKF, UNICODE_MODE, READER_INIT, "\001\002", 0, 2, 101, "67 62 40 60 41 42 63 32 6A 67 64 0B 63 64 45 42 0F 6A", "FNC3 SOH STX / CodeB Pads" }, /* 2*/ { BARCODE_HIBC_BLOCKF, UNICODE_MODE, READER_INIT, "123456", 0, 3, 101, "67 64 41 60 0B 11 12 22 6A 67 63 2B 22 38 64 2A 1B 6A 67 64 0C 63 64 2B 2F 52 6A", "CodeB FNC3 + 1 2 / CodeC 34 56 CodeB J" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -278,7 +286,7 @@ static void test_input(const testCtx *const p_ctx) { ñ U+00F1 (\361, 241), UTF-8 C3B1, CodeB-only extended ASCII ÿ U+00FF (\377, 255), UTF-8 C3BF, CodeB-only extended ASCII */ - struct item data[] = { + static const struct item data[] = { /* 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, -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, -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" }, @@ -325,8 +333,9 @@ static void test_input(const testCtx *const p_ctx) { /* 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\0122à\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", "" }, + /* 46*/ { BARCODE_HIBC_BLOCKF, UNICODE_MODE, -1, -1, "A99912345/$$520:1510X3", -1, ZINT_ERROR_INVALID_DATA, -1, -1, 1, "Error 203: Invalid character at position 16 in input (alphanumerics, space and \"-.$/+%\" only)", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -414,7 +423,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODABLOCKF, 1, -1, "AIM", 0, 1, 68, 1, "Same as CODE128 (not supported by BWIPP or ZXing-C++)", "11010010000101000110001100010001010111011000101110110001100011101011" }, @@ -502,7 +511,7 @@ static void test_encode(const testCtx *const p_ctx) { "11010000100101111011101001101110010110001000101110111101101000111011000110110100011010001100011101011" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -588,7 +597,7 @@ static void test_fuzz(const testCtx *const p_ctx) { int bwipp_cmp; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { -1, -1, "\034\034I", 3, 0, 1, "" }, /* 1*/ { 6, -2147483647 - 1 /*Suppress MSVC warning C4146*/, "\134\000\377\153\143\163\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061\061" @@ -600,7 +609,7 @@ static void test_fuzz(const testCtx *const p_ctx) { 238, 0, 0, "BWIPP different (better) encodation" }, /* #300 (#9) Andre Maute */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; diff --git a/backend/tests/test_code.c b/backend/tests/test_code.c index 6df228e6..3f3f4655 100644 --- a/backend/tests/test_code.c +++ b/backend/tests/test_code.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2023 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -42,39 +42,40 @@ static void test_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { BARCODE_CODE11, -1, "13", 140, 0, 1, 1151 }, /* 8 (Start) + 140*8 + 2*8 (Checks) + 7 (Stop) == 1151 */ - /* 1*/ { BARCODE_CODE11, -1, "13", 141, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { BARCODE_CODE39, -1, "1", 86, 0, 1, 1143 }, /* 13 (Start) + 86*13 + 12 (Stop) == 1143 */ - /* 3*/ { BARCODE_CODE39, -1, "1", 87, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 4*/ { BARCODE_EXCODE39, -1, "1", 86, 0, 1, 1143 }, - /* 5*/ { BARCODE_EXCODE39, -1, "1", 87, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 6*/ { BARCODE_EXCODE39, -1, "a", 43, 0, 1, 1143 }, /* Takes 2 encoding chars per char */ - /* 7*/ { BARCODE_EXCODE39, -1, "a", 44, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 8*/ { BARCODE_EXCODE39, -1, "a", 86, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 9*/ { BARCODE_LOGMARS, -1, "1", 30, 0, 1, 511 }, /* 16 (Start) + 30*16 + 15 (Stop) == 511 */ - /* 10*/ { BARCODE_LOGMARS, -1, "1", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 11*/ { BARCODE_CODE93, -1, "1", 123, 0, 1, 1144 }, /* 9 (Start) + 123*9 + 2*9 (Checks) + 10 (Stop) == 1144 */ - /* 12*/ { BARCODE_CODE93, -1, "1", 124, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 13*/ { BARCODE_CODE93, -1, "a", 61, 0, 1, 1135 }, /* Takes 2 encoding chars per char */ - /* 14*/ { BARCODE_CODE93, -1, "a", 62, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 15*/ { BARCODE_CODE93, -1, "a", 124, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 16*/ { BARCODE_CODE93, -1, "a1", 82, 0, 1, 1144 }, /* Takes 1.5 encoding chars (1.5*82 == 123) */ - /* 17*/ { BARCODE_CODE93, -1, "a1", 83, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 18*/ { BARCODE_PZN, -1, "1", 7, 0, 1, 142 }, /* Takes 8 with correct check digit */ - /* 19*/ { BARCODE_PZN, -1, "1", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 20*/ { BARCODE_PZN, 1, "1", 6, 0, 1, 129 }, /* PZN7 takes 7 with correct check digit */ - /* 21*/ { BARCODE_PZN, 1, "1", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 22*/ { BARCODE_VIN, -1, "1", 17, 0, 1, 246 }, - /* 23*/ { BARCODE_VIN, -1, "1", 18, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 24*/ { BARCODE_VIN, -1, "1", 16, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 25*/ { BARCODE_VIN, 1, "1", 17, 0, 1, 259 }, - /* 26*/ { BARCODE_HIBC_39, -1, "1", 68, 0, 1, 1151 }, /* 70 - 2 ('+' and check digit) */ - /* 27*/ { BARCODE_HIBC_39, -1, "1", 69, ZINT_ERROR_TOO_LONG, -1, -1 }, + static const struct item data[] = { + /* 0*/ { BARCODE_CODE11, -1, "13", 140, 0, 1, 1151, "" }, /* 8 (Start) + 140*8 + 2*8 (Checks) + 7 (Stop) == 1151 */ + /* 1*/ { BARCODE_CODE11, -1, "13", 141, ZINT_ERROR_TOO_LONG, -1, -1, "Error 320: Input length 141 too long (maximum 140)" }, + /* 2*/ { BARCODE_CODE39, -1, "1", 86, 0, 1, 1143, "" }, /* 13 (Start) + 86*13 + 12 (Stop) == 1143 */ + /* 3*/ { BARCODE_CODE39, -1, "1", 87, ZINT_ERROR_TOO_LONG, -1, -1, "Error 323: Input length 87 too long (maximum 86)" }, + /* 4*/ { BARCODE_EXCODE39, -1, "1", 86, 0, 1, 1143, "" }, + /* 5*/ { BARCODE_EXCODE39, -1, "1", 87, ZINT_ERROR_TOO_LONG, -1, -1, "Error 328: Input length 87 too long (maximum 86)" }, + /* 6*/ { BARCODE_EXCODE39, -1, "a", 43, 0, 1, 1143, "" }, /* Takes 2 encoding chars per char */ + /* 7*/ { BARCODE_EXCODE39, -1, "a", 44, ZINT_ERROR_TOO_LONG, -1, -1, "Error 317: Input too long, requires 88 symbol characters (maximum 86)" }, + /* 8*/ { BARCODE_EXCODE39, -1, "a", 86, ZINT_ERROR_TOO_LONG, -1, -1, "Error 317: Input too long, requires 172 symbol characters (maximum 86)" }, + /* 9*/ { BARCODE_LOGMARS, -1, "1", 30, 0, 1, 511, "" }, /* 16 (Start) + 30*16 + 15 (Stop) == 511 */ + /* 10*/ { BARCODE_LOGMARS, -1, "1", 31, ZINT_ERROR_TOO_LONG, -1, -1, "Error 322: Input length 31 too long (maximum 30)" }, + /* 11*/ { BARCODE_CODE93, -1, "1", 123, 0, 1, 1144, "" }, /* 9 (Start) + 123*9 + 2*9 (Checks) + 10 (Stop) == 1144 */ + /* 12*/ { BARCODE_CODE93, -1, "1", 124, ZINT_ERROR_TOO_LONG, -1, -1, "Error 330: Input length 124 too long (maximum 123)" }, + /* 13*/ { BARCODE_CODE93, -1, "a", 61, 0, 1, 1135, "" }, /* Takes 2 encoding chars per char */ + /* 14*/ { BARCODE_CODE93, -1, "a", 62, ZINT_ERROR_TOO_LONG, -1, -1, "Error 332: Input too long, requires 124 symbol characters (maximum 123)" }, + /* 15*/ { BARCODE_CODE93, -1, "a", 124, ZINT_ERROR_TOO_LONG, -1, -1, "Error 330: Input length 124 too long (maximum 123)" }, + /* 16*/ { BARCODE_CODE93, -1, "a1", 82, 0, 1, 1144, "" }, /* Takes 1.5 encoding chars (1.5*82 == 123) */ + /* 17*/ { BARCODE_CODE93, -1, "a1", 83, ZINT_ERROR_TOO_LONG, -1, -1, "Error 332: Input too long, requires 125 symbol characters (maximum 123)" }, + /* 18*/ { BARCODE_PZN, -1, "1", 7, 0, 1, 142, "" }, /* Takes 8 with correct check digit */ + /* 19*/ { BARCODE_PZN, -1, "1", 9, ZINT_ERROR_TOO_LONG, -1, -1, "Error 325: Input length 9 too long (maximum 8)" }, + /* 20*/ { BARCODE_PZN, 1, "1", 6, 0, 1, 129, "" }, /* PZN7 takes 7 with correct check digit */ + /* 21*/ { BARCODE_PZN, 1, "1", 8, ZINT_ERROR_TOO_LONG, -1, -1, "Error 325: Input length 8 too long (maximum 7)" }, + /* 22*/ { BARCODE_VIN, -1, "1", 17, 0, 1, 246, "" }, + /* 23*/ { BARCODE_VIN, -1, "1", 18, ZINT_ERROR_TOO_LONG, -1, -1, "Error 336: Input length 18 wrong (17 only)" }, + /* 24*/ { BARCODE_VIN, -1, "1", 16, ZINT_ERROR_TOO_LONG, -1, -1, "Error 336: Input length 16 wrong (17 only)" }, + /* 25*/ { BARCODE_VIN, 1, "1", 17, 0, 1, 259, "" }, + /* 26*/ { BARCODE_HIBC_39, -1, "1", 68, 0, 1, 1151, "" }, /* 70 - 2 ('+' and check digit) */ + /* 27*/ { BARCODE_HIBC_39, -1, "1", 69, ZINT_ERROR_TOO_LONG, -1, -1, "Error 319: Input length 69 too long (maximum 68)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -96,6 +97,8 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -120,7 +123,7 @@ static void test_hrt(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE11, -1, "123-45", -1, "123-4552" }, /* 2 checksums */ /* 1*/ { BARCODE_CODE11, 1, "123-45", -1, "123-455" }, /* 1 check digit */ /* 2*/ { BARCODE_CODE11, 2, "123-45", -1, "123-45" }, /* No checksums */ @@ -164,7 +167,7 @@ static void test_hrt(const testCtx *const p_ctx) { /* 40*/ { BARCODE_HIBC_39, -1, "abc1234", -1, "*+ABC1234+*" }, /* Converts to upper */ /* 41*/ { BARCODE_HIBC_39, -1, "123456789", -1, "*+1234567890*" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -195,84 +198,87 @@ static void test_input(const testCtx *const p_ctx) { struct item { int symbology; + int input_mode; int option_2; char *data; int length; int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { BARCODE_CODE11, -1, "-", -1, 0, 1, 37 }, - /* 1*/ { BARCODE_CODE11, -1, "0123456789-", -1, 0, 1, 115 }, - /* 2*/ { BARCODE_CODE11, -1, "A", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 3*/ { BARCODE_CODE11, -1, "12+", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 4*/ { BARCODE_CODE11, -1, "1.2", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 5*/ { BARCODE_CODE11, -1, "12!", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 6*/ { BARCODE_CODE11, -1, " ", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 7*/ { BARCODE_CODE11, 3, "1", -1, ZINT_ERROR_INVALID_OPTION, -1, -1 }, - /* 8*/ { BARCODE_CODE39, -1, "a", -1, 0, 1, 38 }, /* Converts to upper */ - /* 9*/ { BARCODE_CODE39, -1, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%", -1, 0, 1, 584 }, - /* 10*/ { BARCODE_CODE39, -1, "AB!", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 11*/ { BARCODE_CODE39, -1, "A\"B", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 12*/ { BARCODE_CODE39, -1, "#AB", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 13*/ { BARCODE_CODE39, -1, "&", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 14*/ { BARCODE_CODE39, -1, "'", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 15*/ { BARCODE_CODE39, -1, "(", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 16*/ { BARCODE_CODE39, -1, ")", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 17*/ { BARCODE_CODE39, -1, "*", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 18*/ { BARCODE_CODE39, -1, ",", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 19*/ { BARCODE_CODE39, -1, ":", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 20*/ { BARCODE_CODE39, -1, "@", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 21*/ { BARCODE_CODE39, -1, "[", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 22*/ { BARCODE_CODE39, -1, "`", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 23*/ { BARCODE_CODE39, -1, "{", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 24*/ { BARCODE_CODE39, -1, "\000", 1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 25*/ { BARCODE_CODE39, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 26*/ { BARCODE_CODE39, 0, "1", -1, 0, 1, 38 }, - /* 27*/ { BARCODE_CODE39, 1, "1", -1, 0, 1, 51 }, /* Check digit */ - /* 28*/ { BARCODE_CODE39, 2, "1", -1, 0, 1, 51 }, /* Hidden check digit */ - /* 29*/ { BARCODE_CODE39, 3, "1", -1, 0, 1, 38 }, /* option_2 > 2 ignored */ - /* 30*/ { BARCODE_EXCODE39, -1, "A", -1, 0, 1, 38 }, - /* 31*/ { BARCODE_EXCODE39, 3, "A", -1, 0, 1, 38 }, /* option_2 > 2 ignored */ - /* 32*/ { BARCODE_EXCODE39, -1, "a", -1, 0, 1, 51 }, - /* 33*/ { BARCODE_EXCODE39, -1, ",", -1, 0, 1, 51 }, - /* 34*/ { BARCODE_EXCODE39, -1, "\000", 1, 0, 1, 51 }, - /* 35*/ { BARCODE_EXCODE39, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 36*/ { BARCODE_EXCODE39, -1, "é", -1, ZINT_ERROR_INVALID_DATA, -1, -1, }, - /* 37*/ { BARCODE_LOGMARS, -1, "A", -1, 0, 1, 47 }, - /* 38*/ { BARCODE_LOGMARS, -1, "a", -1, 0, 1, 47 }, - /* 39*/ { BARCODE_LOGMARS, -1, ",", -1, ZINT_ERROR_INVALID_DATA, -1, -1, }, - /* 40*/ { BARCODE_LOGMARS, -1, "\000", 1, ZINT_ERROR_INVALID_DATA, -1, -1, }, - /* 41*/ { BARCODE_LOGMARS, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1, }, - /* 42*/ { BARCODE_LOGMARS, 3, "A", -1, 0, 1, 47 }, /* option_2 > 2 ignored */ - /* 43*/ { BARCODE_CODE93, -1, "A", -1, 0, 1, 46 }, - /* 44*/ { BARCODE_CODE93, -1, "a", -1, 0, 1, 55 }, - /* 45*/ { BARCODE_CODE93, -1, ",", -1, 0, 1, 55 }, - /* 46*/ { BARCODE_CODE93, -1, "\000", 1, 0, 1, 55 }, - /* 47*/ { BARCODE_CODE93, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 48*/ { BARCODE_CODE93, -1, "é", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 49*/ { BARCODE_PZN, -1, "1", -1, 0, 1, 142 }, - /* 50*/ { BARCODE_PZN, -1, "A", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 51*/ { BARCODE_PZN, -1, "1000006", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* Check digit == 10 so can't be used */ - /* 52*/ { BARCODE_PZN, -1, "00000011", -1, ZINT_ERROR_INVALID_CHECK, -1, -1 }, - /* 53*/ { BARCODE_PZN, 1, "100009", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* Check digit == 10 so can't be used */ - /* 54*/ { BARCODE_PZN, 1, "0000011", -1, ZINT_ERROR_INVALID_CHECK, -1, -1 }, - /* 55*/ { BARCODE_VIN, -1, "5GZCZ43D13S812715", -1, 0, 1, 246 }, - /* 56*/ { BARCODE_VIN, -1, "5GZCZ43D23S812715", -1, ZINT_ERROR_INVALID_CHECK, -1, -1 }, /* North American with invalid check character */ - /* 57*/ { BARCODE_VIN, -1, "WP0ZZZ99ZTS392124", -1, 0, 1, 246 }, /* Not North American so no check */ - /* 58*/ { BARCODE_VIN, -1, "WP0ZZZ99ZTS392I24", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* I not allowed */ - /* 59*/ { BARCODE_VIN, -1, "WPOZZZ99ZTS392124", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* O not allowed */ - /* 60*/ { BARCODE_VIN, -1, "WPQZZZ99ZTS392124", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* Q not allowed */ - /* 61*/ { BARCODE_HIBC_39, -1, "a", -1, 0, 1, 79 }, /* Converts to upper */ - /* 62*/ { BARCODE_HIBC_39, -1, ",", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 63*/ { BARCODE_HIBC_39, -1, "\000", 1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 64*/ { BARCODE_HIBC_39, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 65*/ { BARCODE_HIBC_39, 1, "a", -1, 0, 1, 79 }, /* option_2 ignored */ - /* 66*/ { BARCODE_HIBC_39, 2, "a", -1, 0, 1, 79 }, /* option_2 ignored */ + static const struct item data[] = { + /* 0*/ { BARCODE_CODE11, -1, -1, "-", -1, 0, 1, 37, "" }, + /* 1*/ { BARCODE_CODE11, -1, -1, "0123456789-", -1, 0, 1, 115, "" }, + /* 2*/ { BARCODE_CODE11, -1, -1, "A", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 321: Invalid character at position 1 in input (digits and \"-\" only)" }, + /* 3*/ { BARCODE_CODE11, -1, -1, "12+", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 321: Invalid character at position 3 in input (digits and \"-\" only)" }, + /* 4*/ { BARCODE_CODE11, -1, -1, "1.2", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 321: Invalid character at position 2 in input (digits and \"-\" only)" }, + /* 5*/ { BARCODE_CODE11, -1, -1, "12!", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 321: Invalid character at position 3 in input (digits and \"-\" only)" }, + /* 6*/ { BARCODE_CODE11, -1, -1, " ", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 321: Invalid character at position 1 in input (digits and \"-\" only)" }, + /* 7*/ { BARCODE_CODE11, ESCAPE_MODE, -1, "\\d048 ", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 321: Invalid character at position 2 in input (digits and \"-\" only)" }, /* Note position doesn't account for escape sequences */ + /* 8*/ { BARCODE_CODE11, -1, 3, "1", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 339: Invalid check digit version '3' (1 or 2 only)" }, + /* 9*/ { BARCODE_CODE39, -1, -1, "a", -1, 0, 1, 38, "" }, /* Converts to upper */ + /* 10*/ { BARCODE_CODE39, -1, -1, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%", -1, 0, 1, 584, "" }, + /* 11*/ { BARCODE_CODE39, -1, -1, "AB!", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 3 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 12*/ { BARCODE_CODE39, -1, -1, "A\"B", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 2 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 13*/ { BARCODE_CODE39, -1, -1, "#AB", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 14*/ { BARCODE_CODE39, -1, -1, "&", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 15*/ { BARCODE_CODE39, -1, -1, "'", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 16*/ { BARCODE_CODE39, -1, -1, "(", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 17*/ { BARCODE_CODE39, -1, -1, ")", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 18*/ { BARCODE_CODE39, -1, -1, "*", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 19*/ { BARCODE_CODE39, -1, -1, ",", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 20*/ { BARCODE_CODE39, -1, -1, ":", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 21*/ { BARCODE_CODE39, -1, -1, "@", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 22*/ { BARCODE_CODE39, -1, -1, "[", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 23*/ { BARCODE_CODE39, -1, -1, "`", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 24*/ { BARCODE_CODE39, -1, -1, "{", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 25*/ { BARCODE_CODE39, -1, -1, "\000", 1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 26*/ { BARCODE_CODE39, -1, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 27*/ { BARCODE_CODE39, -1, 0, "1", -1, 0, 1, 38, "" }, + /* 28*/ { BARCODE_CODE39, -1, 1, "1", -1, 0, 1, 51, "" }, /* Check digit */ + /* 29*/ { BARCODE_CODE39, -1, 2, "1", -1, 0, 1, 51, "" }, /* Hidden check digit */ + /* 30*/ { BARCODE_CODE39, -1, 3, "1", -1, 0, 1, 38, "" }, /* option_2 > 2 ignored */ + /* 31*/ { BARCODE_EXCODE39, -1, -1, "A", -1, 0, 1, 38, "" }, + /* 32*/ { BARCODE_EXCODE39, -1, 3, "A", -1, 0, 1, 38, "" }, /* option_2 > 2 ignored */ + /* 33*/ { BARCODE_EXCODE39, -1, -1, "a", -1, 0, 1, 51, "" }, + /* 34*/ { BARCODE_EXCODE39, -1, -1, ",", -1, 0, 1, 51, "" }, + /* 35*/ { BARCODE_EXCODE39, -1, -1, "\000", 1, 0, 1, 51, "" }, + /* 36*/ { BARCODE_EXCODE39, -1, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 329: Invalid character at position 1 in input, extended ASCII not allowed" }, + /* 37*/ { BARCODE_EXCODE39, -1, -1, "ABCDé", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 329: Invalid character at position 5 in input, extended ASCII not allowed" }, + /* 38*/ { BARCODE_LOGMARS, -1, -1, "A", -1, 0, 1, 47, "" }, + /* 39*/ { BARCODE_LOGMARS, -1, -1, "a", -1, 0, 1, 47, "" }, + /* 40*/ { BARCODE_LOGMARS, -1, -1, ",", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 41*/ { BARCODE_LOGMARS, -1, -1, "\000", 1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 42*/ { BARCODE_LOGMARS, -1, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 324: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 43*/ { BARCODE_LOGMARS, -1, 3, "A", -1, 0, 1, 47, "" }, /* option_2 > 2 ignored */ + /* 44*/ { BARCODE_CODE93, -1, -1, "A", -1, 0, 1, 46, "" }, + /* 45*/ { BARCODE_CODE93, -1, -1, "a", -1, 0, 1, 55, "" }, + /* 46*/ { BARCODE_CODE93, -1, -1, ",", -1, 0, 1, 55, "" }, + /* 47*/ { BARCODE_CODE93, -1, -1, "\000", 1, 0, 1, 55, "" }, + /* 48*/ { BARCODE_CODE93, -1, -1, "12\3004", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 331: Invalid character at position 3 in input, extended ASCII not allowed" }, + /* 49*/ { BARCODE_CODE93, -1, -1, "é", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 331: Invalid character at position 1 in input, extended ASCII not allowed" }, + /* 50*/ { BARCODE_PZN, -1, -1, "1", -1, 0, 1, 142, "" }, + /* 51*/ { BARCODE_PZN, -1, -1, "A", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 326: Invalid character at position 1 in input (digits only)" }, + /* 52*/ { BARCODE_PZN, -1, -1, "1000006", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 327: Invalid PZN, check digit is '10'" }, /* Check digit == 10 so can't be used */ + /* 53*/ { BARCODE_PZN, -1, -1, "00000011", -1, ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 890: Invalid check digit '1', expecting '7'" }, + /* 54*/ { BARCODE_PZN, -1, 1, "100009", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 327: Invalid PZN, check digit is '10'" }, /* Check digit == 10 so can't be used */ + /* 55*/ { BARCODE_PZN, -1, 1, "0000011", -1, ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 890: Invalid check digit '1', expecting '7'" }, + /* 56*/ { BARCODE_VIN, -1, -1, "5GZCZ43D13S812715", -1, 0, 1, 246, "" }, + /* 57*/ { BARCODE_VIN, -1, -1, "5GZCZ43D23S812715", -1, ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 338: Invalid check digit '2' (position 9), expecting '1'" }, /* North American with invalid check character */ + /* 58*/ { BARCODE_VIN, -1, -1, "WP0ZZZ99ZTS392124", -1, 0, 1, 246, "" }, /* Not North American so no check */ + /* 59*/ { BARCODE_VIN, -1, -1, "WP0ZZZ99ZTS392I24", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 337: Invalid character at position 15 in input (alphanumerics only, excluding \"IOQ\")" }, /* I not allowed */ + /* 60*/ { BARCODE_VIN, -1, -1, "WPOZZZ99ZTS392124", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 337: Invalid character at position 3 in input (alphanumerics only, excluding \"IOQ\")" }, /* O not allowed */ + /* 61*/ { BARCODE_VIN, -1, -1, "WPQZZZ99ZTS392124", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 337: Invalid character at position 3 in input (alphanumerics only, excluding \"IOQ\")" }, /* Q not allowed */ + /* 62*/ { BARCODE_HIBC_39, -1, -1, "a", -1, 0, 1, 79, "" }, /* Converts to upper */ + /* 63*/ { BARCODE_HIBC_39, -1, -1, ",", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 203: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 64*/ { BARCODE_HIBC_39, -1, -1, "\000", 1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 203: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 65*/ { BARCODE_HIBC_39, -1, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 203: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)" }, + /* 66*/ { BARCODE_HIBC_39, -1, 1, "a", -1, 0, 1, 79, "" }, /* option_2 ignored */ + /* 67*/ { BARCODE_HIBC_39, -1, 2, "a", -1, 0, 1, 79, "" }, /* option_2 ignored */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -285,10 +291,12 @@ static void test_input(const testCtx *const p_ctx) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*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*/, -1 /*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); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -316,7 +324,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE11, -1, "123-45", -1, 0, 1, 78, "2 check digits (52); verified manually against TEC-IT", "101100101101011010010110110010101011010101101101101101011011010100101101011001" }, @@ -447,7 +455,7 @@ static void test_encode(const testCtx *const p_ctx) { "1000101110111010100010100010001010001000100010101000100010001010111010001110101010111000101011101010001110111010101000111011101011101000101011101110100011101010111010001010111010100011101110101000101110101110111011100010101010101000111011101010111000101110100010111011101" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -536,7 +544,7 @@ static void test_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE39, -1, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+", 0, 1, 1130, "CODE39 85" }, /* 1*/ { BARCODE_CODE39, -1, "123456ABCD", 0, 1, 155, "CODE39 10" }, /* 2*/ { BARCODE_CODE93, -1, @@ -546,7 +554,7 @@ static void test_perf(const testCtx *const p_ctx) { /* 4*/ { BARCODE_CODE11, -1, "1234567890-1234567890-1234567890-1234567890-1234567890-1234567890-1234567890-1234567890-1234567890-1234567890-1234567890-", 0, 1, 966, "CODE11 121" }, /* 5*/ { BARCODE_CODE11, -1, "1234567890-", 0, 1, 116, "CODE11 5" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; diff --git a/backend/tests/test_code1.c b/backend/tests/test_code1.c index fddbf70a..9ecd97ad 100644 --- a/backend/tests/test_code1.c +++ b/backend/tests/test_code1.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2022 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -43,154 +43,158 @@ static void test_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* Reference AIM USS Code One Table 2 */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { -1, -1, { 0, 0, "" }, "1", 3550, 0, 148, 134 }, /* Auto Version H */ - /* 1*/ { -1, -1, { 0, 0, "" }, "1", 3551, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { 3, -1, { 0, 0, "" }, "1", 3535, 0, 148, 134 }, /* With ECI */ - /* 3*/ { 3, -1, { 0, 0, "" }, "1", 3536, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 4*/ { -1, -1, { 1, 2, "" }, "1", 3546, 0, 148, 134 }, /* With Structured Append (Group mode, count < 2) */ - /* 5*/ { -1, -1, { 1, 2, "" }, "1", 3547, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 6*/ { -1, -1, { 1, 16, "" }, "1", 3541, 0, 148, 134 }, /* With Structured Append (Extended Group mode, count >= 16) */ - /* 7*/ { -1, -1, { 1, 16, "" }, "1", 3542, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 8*/ { 3, -1, { 1, 2, "" }, "1", 3532, 0, 148, 134 }, /* With ECI and Structured Append (Group mode) 1st symbol */ - /* 9*/ { 3, -1, { 1, 2, "" }, "1", 3533, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 10*/ { 3, -1, { 2, 2, "" }, "1", 3537, 0, 148, 134 }, /* With ECI and Structured Append (Group mode) subsequent symbol */ - /* 11*/ { 3, -1, { 2, 2, "" }, "1", 3538, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 12*/ { 3, -1, { 1, 16, "" }, "1", 3530, 0, 148, 134 }, /* With ECI and Structured Append (Extended Group mode) 1st symbol */ - /* 13*/ { 3, -1, { 1, 16, "" }, "1", 3531, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 14*/ { 3, -1, { 2, 16, "" }, "1", 3535, 0, 148, 134 }, /* With ECI and Structured Append (Extended Group mode) subsequent symbol */ - /* 15*/ { 3, -1, { 2, 16, "" }, "1", 3536, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 16*/ { -1, -1, { 0, 0, "" }, "A", 2218, 0, 148, 134 }, - /* 17*/ { -1, -1, { 0, 0, "" }, "A", 2219, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 18*/ { -1, -1, { 0, 0, "" }, "\001", 1480, 0, 148, 134 }, /* Full ASCII */ - /* 19*/ { -1, -1, { 0, 0, "" }, "\001", 1481, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 20*/ { -1, -1, { 0, 0, "" }, "\200", 1478, 0, 148, 134 }, /* BYTE */ - /* 21*/ { -1, -1, { 0, 0, "" }, "\200", 1479, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 22*/ { -1, 1, { 0, 0, "" }, "1", 22, 0, 16, 18 }, /* Version A */ - /* 23*/ { -1, 1, { 0, 0, "" }, "1", 23, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 24*/ { -1, 1, { 0, 0, "" }, "A", 13, 0, 16, 18 }, - /* 25*/ { -1, 1, { 0, 0, "" }, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 26*/ { 3, 1, { 0, 0, "" }, "A", 4, 0, 16, 18 }, /* With ECI */ - /* 27*/ { 3, 1, { 0, 0, "" }, "A", 5, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 28*/ { -1, 1, { 1, 2, "" }, "A", 10, 0, 16, 18 }, /* With Structured Append */ - /* 29*/ { -1, 1, { 1, 2, "" }, "A", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 30*/ { 3, 1, { 1, 2, "" }, "A", 2, 0, 16, 18 }, /* With ECI and Structured Append 1st symbol */ - /* 31*/ { 3, 1, { 1, 2, "" }, "A", 3, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 32*/ { 3, 1, { 2, 2, "" }, "A", 4, 0, 16, 18 }, /* With ECI and Structured Append subsequent symbol */ - /* 33*/ { 3, 1, { 2, 2, "" }, "A", 5, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 34*/ { -1, 1, { 0, 0, "" }, "\001", 10, 0, 16, 18 }, - /* 35*/ { -1, 1, { 0, 0, "" }, "\001", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 36*/ { -1, 1, { 0, 0, "" }, "\200", 8, 0, 16, 18 }, - /* 37*/ { -1, 1, { 0, 0, "" }, "\200", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 38*/ { -1, 2, { 0, 0, "" }, "1", 44, 0, 22, 22 }, /* Version B */ - /* 39*/ { -1, 2, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 40*/ { -1, 2, { 0, 0, "" }, "A", 27, 0, 22, 22 }, - /* 41*/ { -1, 2, { 0, 0, "" }, "A", 28, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 42*/ { -1, 2, { 0, 0, "" }, "A", 26, 0, 22, 22 }, - /* 43*/ { -1, 2, { 0, 0, "" }, "\001", 19, 0, 22, 22 }, - /* 44*/ { -1, 2, { 0, 0, "" }, "\001", 20, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 45*/ { -1, 2, { 0, 0, "" }, "\200", 17, 0, 22, 22 }, - /* 46*/ { -1, 2, { 0, 0, "" }, "\200", 18, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 47*/ { -1, 3, { 0, 0, "" }, "1", 104, 0, 28, 32 }, /* Version C */ - /* 48*/ { -1, 3, { 0, 0, "" }, "1", 105, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 49*/ { -1, 3, { 0, 0, "" }, "A", 64, 0, 28, 32 }, - /* 50*/ { -1, 3, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 51*/ { -1, 3, { 0, 0, "" }, "\001", 44, 0, 28, 32 }, - /* 52*/ { -1, 3, { 0, 0, "" }, "\001", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 53*/ { -1, 3, { 0, 0, "" }, "\200", 42, 0, 28, 32 }, - /* 54*/ { -1, 3, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 55*/ { -1, 4, { 0, 0, "" }, "1", 217, 0, 40, 42 }, /* Version D */ - /* 56*/ { -1, 4, { 0, 0, "" }, "1", 218, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 57*/ { -1, 4, { 0, 0, "" }, "A", 135, 0, 40, 42 }, - /* 58*/ { -1, 4, { 0, 0, "" }, "A", 136, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 59*/ { -1, 4, { 0, 0, "" }, "\001", 91, 0, 40, 42 }, - /* 60*/ { -1, 4, { 0, 0, "" }, "\001", 92, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 61*/ { -1, 4, { 0, 0, "" }, "\200", 89, 0, 40, 42 }, - /* 62*/ { -1, 4, { 0, 0, "" }, "\200", 90, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 63*/ { -1, 5, { 0, 0, "" }, "1", 435, 0, 52, 54 }, /* Version E (note 435 multiple of 3) */ - /* 64*/ { -1, 5, { 0, 0, "" }, "1", 436, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 65*/ { -1, 5, { 0, 0, "" }, "1", 434, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */ - /* 66*/ { -1, 5, { 0, 0, "" }, "1", 433, 0, 52, 54 }, - /* 67*/ { -1, 5, { 0, 0, "" }, "A", 271, 0, 52, 54 }, - /* 68*/ { -1, 5, { 0, 0, "" }, "A", 272, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 69*/ { -1, 5, { 0, 0, "" }, "\001", 182, 0, 52, 54 }, - /* 70*/ { -1, 5, { 0, 0, "" }, "\001", 183, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 71*/ { -1, 5, { 0, 0, "" }, "\200", 180, 0, 52, 54 }, - /* 72*/ { -1, 5, { 0, 0, "" }, "\200", 181, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 73*/ { -1, 6, { 0, 0, "" }, "1", 886, 0, 70, 76 }, /* Version F */ - /* 74*/ { -1, 6, { 0, 0, "" }, "1", 887, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 75*/ { -1, 6, { 0, 0, "" }, "A", 553, 0, 70, 76 }, - /* 76*/ { -1, 6, { 0, 0, "" }, "A", 554, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 77*/ { -1, 6, { 0, 0, "" }, "\001", 370, 0, 70, 76 }, - /* 78*/ { -1, 6, { 0, 0, "" }, "\001", 371, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 79*/ { -1, 6, { 0, 0, "" }, "\200", 368, 0, 70, 76 }, - /* 80*/ { -1, 6, { 0, 0, "" }, "\200", 369, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 81*/ { -1, 7, { 0, 0, "" }, "1", 1755, 0, 104, 98 }, /* Version G (note 1755 multiple of 3) */ - /* 82*/ { -1, 7, { 0, 0, "" }, "1", 1756, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 83*/ { -1, 7, { 0, 0, "" }, "1", 1754, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */ - /* 84*/ { -1, 7, { 0, 0, "" }, "1", 1753, 0, 104, 98 }, - /* 85*/ { -1, 7, { 0, 0, "" }, "A", 1096, 0, 104, 98 }, - /* 86*/ { -1, 7, { 0, 0, "" }, "A", 1097, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 87*/ { -1, 7, { 0, 0, "" }, "\001", 732, 0, 104, 98 }, - /* 88*/ { -1, 7, { 0, 0, "" }, "\001", 733, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 89*/ { -1, 7, { 0, 0, "" }, "\200", 730, 0, 104, 98 }, - /* 90*/ { -1, 7, { 0, 0, "" }, "\200", 731, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 91*/ { -1, 8, { 0, 0, "" }, "1", 3550, 0, 148, 134 }, /* Version H */ - /* 92*/ { -1, 8, { 0, 0, "" }, "1", 3551, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 93*/ { -1, 8, { 0, 0, "" }, "A", 2218, 0, 148, 134 }, - /* 94*/ { -1, 8, { 0, 0, "" }, "A", 2219, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 95*/ { -1, 8, { 0, 0, "" }, "\001", 1480, 0, 148, 134 }, - /* 96*/ { -1, 8, { 0, 0, "" }, "\001", 1481, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 97*/ { -1, 8, { 0, 0, "" }, "\200", 1478, 0, 148, 134 }, - /* 98*/ { -1, 8, { 0, 0, "" }, "\200", 1479, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 99*/ { -1, 9, { 0, 0, "" }, "1", 6, 0, 8, 11 }, /* Version S-10 */ - /*100*/ { -1, 9, { 0, 0, "" }, "1", 7, 0, 8, 21 }, /* -> S-20 */ - /*101*/ { -1, 9, { 0, 0, "" }, "1", 12, 0, 8, 21 }, /* Version S-20 */ - /*102*/ { -1, 9, { 0, 0, "" }, "1", 13, 0, 8, 31 }, /* -> S-30 */ - /*103*/ { -1, 9, { 0, 0, "" }, "1", 18, 0, 8, 31 }, /* Version S-30 */ - /*104*/ { -1, 9, { 0, 0, "" }, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*105*/ { -1, 9, { 0, 0, "" }, "1", 17, 0, 8, 31 }, - /*106*/ { -1, 10, { 0, 0, "" }, "1", 22, 0, 16, 17 }, /* Version T-16 */ - /*107*/ { -1, 10, { 0, 0, "" }, "1", 23, 0, 16, 33 }, /* -> T-32 */ - /*108*/ { -1, 10, { 0, 0, "" }, "A", 13, 0, 16, 17 }, - /*109*/ { -1, 10, { 0, 0, "" }, "A", 14, 0, 16, 33 }, /* -> T-32 */ - /*110*/ { -1, 10, { 0, 0, "" }, "\001", 10, 0, 16, 17 }, - /*111*/ { -1, 10, { 0, 0, "" }, "\001", 11, 0, 16, 33 }, /* -> T-32 */ - /*112*/ { -1, 10, { 0, 0, "" }, "\200", 8, 0, 16, 17 }, - /*113*/ { -1, 10, { 0, 0, "" }, "\200", 9, 0, 16, 33 }, /* -> T-32 */ - /*114*/ { -1, 10, { 0, 0, "" }, "1", 56, 0, 16, 33 }, /* Version T-32 */ - /*115*/ { -1, 10, { 0, 0, "" }, "1", 57, 0, 16, 49 }, /* -> T-48 */ - /*116*/ { -1, 10, { 0, 0, "" }, "A", 34, 0, 16, 33 }, - /*117*/ { -1, 10, { 0, 0, "" }, "A", 35, 0, 16, 49 }, /* -> T-48 */ - /*118*/ { -1, 10, { 0, 0, "" }, "\001", 24, 0, 16, 33 }, - /*119*/ { -1, 10, { 0, 0, "" }, "\001", 25, 0, 16, 49 }, /* -> T-48 */ - /*120*/ { -1, 10, { 0, 0, "" }, "\200", 22, 0, 16, 33 }, - /*121*/ { -1, 10, { 0, 0, "" }, "\200", 23, 0, 16, 49 }, /* -> T-48 */ - /*122*/ { -1, 10, { 0, 0, "" }, "1", 90, 0, 16, 49 }, /* Version T-48 (note 90 multiple of 3) */ - /*123*/ { -1, 10, { 0, 0, "" }, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*124*/ { -1, 10, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */ - /*125*/ { -1, 10, { 0, 0, "" }, "1", 88, 0, 16, 49 }, - /*126*/ { -1, 10, { 0, 0, "" }, "A", 55, 0, 16, 49 }, - /*127*/ { -1, 10, { 0, 0, "" }, "A", 56, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*128*/ { -1, 10, { 0, 0, "" }, "A", 90, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*129*/ { -1, 10, { 0, 0, "" }, "\001", 38, 0, 16, 49 }, - /*130*/ { -1, 10, { 0, 0, "" }, "\001", 39, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*131*/ { -1, 10, { 0, 0, "" }, "\001", 90, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*132*/ { -1, 10, { 0, 0, "" }, "\\", 38, 0, 16, 49 }, - /*133*/ { -1, 10, { 0, 0, "" }, "\\", 39, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*134*/ { -1, 10, { 0, 0, "" }, "\200", 36, 0, 16, 49 }, - /*135*/ { -1, 10, { 0, 0, "" }, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*136*/ { -1, 10, { 0, 0, "" }, "AAA\200", 31, 0, 16, 49 }, /* ASCII + BYTE (ASCII UpSh - worse than BYTE) */ - /*137*/ { -1, 10, { 0, 0, "" }, "AAA\200", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*138*/ { 3, 10, { 0, 0, "" }, "A", 46, 0, 16, 49 }, /* Version T-48 with ECI (9 less as PAD escape char + "\123456") */ - /*139*/ { 3, 10, { 0, 0, "" }, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*140*/ { 3, 10, { 0, 0, "" }, "\001", 32, 0, 16, 49 }, - /*141*/ { 3, 10, { 0, 0, "" }, "\001", 33, ZINT_ERROR_TOO_LONG, -1, -1 }, + static const struct item data[] = { + /* 0*/ { -1, -1, { 0, 0, "" }, "1", 3550, 0, 148, 134, "" }, /* Auto Version H */ + /* 1*/ { -1, -1, { 0, 0, "" }, "1", 3551, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /* 2*/ { 3, -1, { 0, 0, "" }, "1", 3535, 0, 148, 134, "" }, /* With ECI */ + /* 3*/ { 3, -1, { 0, 0, "" }, "1", 3536, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /* 4*/ { -1, -1, { 1, 2, "" }, "1", 3546, 0, 148, 134, "" }, /* With Structured Append (Group mode, count < 2) */ + /* 5*/ { -1, -1, { 1, 2, "" }, "1", 3547, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /* 6*/ { -1, -1, { 1, 16, "" }, "1", 3541, 0, 148, 134, "" }, /* With Structured Append (Extended Group mode, count >= 16) */ + /* 7*/ { -1, -1, { 1, 16, "" }, "1", 3542, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /* 8*/ { 3, -1, { 1, 2, "" }, "1", 3532, 0, 148, 134, "" }, /* With ECI and Structured Append (Group mode) 1st symbol */ + /* 9*/ { 3, -1, { 1, 2, "" }, "1", 3533, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /* 10*/ { 3, -1, { 2, 2, "" }, "1", 3537, 0, 148, 134, "" }, /* With ECI and Structured Append (Group mode) subsequent symbol */ + /* 11*/ { 3, -1, { 2, 2, "" }, "1", 3538, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /* 12*/ { 3, -1, { 1, 16, "" }, "1", 3530, 0, 148, 134, "" }, /* With ECI and Structured Append (Extended Group mode) 1st symbol */ + /* 13*/ { 3, -1, { 1, 16, "" }, "1", 3531, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /* 14*/ { 3, -1, { 2, 16, "" }, "1", 3535, 0, 148, 134, "" }, /* With ECI and Structured Append (Extended Group mode) subsequent symbol */ + /* 15*/ { 3, -1, { 2, 16, "" }, "1", 3536, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /* 16*/ { -1, -1, { 0, 0, "" }, "A", 2218, 0, 148, 134, "" }, + /* 17*/ { -1, -1, { 0, 0, "" }, "A", 2219, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /* 18*/ { -1, -1, { 0, 0, "" }, "\001", 1480, 0, 148, 134, "" }, /* Full ASCII */ + /* 19*/ { -1, -1, { 0, 0, "" }, "\001", 1481, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /* 20*/ { -1, -1, { 0, 0, "" }, "\200", 1478, 0, 148, 134, "" }, /* BYTE */ + /* 21*/ { -1, -1, { 0, 0, "" }, "\200", 1479, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /* 22*/ { -1, 1, { 0, 0, "" }, "1", 22, 0, 16, 18, "" }, /* Version A */ + /* 23*/ { -1, 1, { 0, 0, "" }, "1", 23, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version A, requires 11 codewords (maximum 10)" }, + /* 24*/ { -1, 1, { 0, 0, "" }, "A", 13, 0, 16, 18, "" }, + /* 25*/ { -1, 1, { 0, 0, "" }, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version A, requires 12 codewords (maximum 10)" }, + /* 26*/ { -1, 1, { 0, 0, "" }, "A", 2218, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version A, requires 1480 codewords (maximum 10)" }, + /* 27*/ { 3, 1, { 0, 0, "" }, "A", 4, 0, 16, 18, "" }, /* With ECI */ + /* 28*/ { 3, 1, { 0, 0, "" }, "A", 5, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version A, requires 11 codewords (maximum 10)" }, + /* 29*/ { -1, 1, { 1, 2, "" }, "A", 10, 0, 16, 18, "" }, /* With Structured Append */ + /* 30*/ { -1, 1, { 1, 2, "" }, "A", 11, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version A, requires 12 codewords (maximum 10)" }, + /* 31*/ { 3, 1, { 1, 2, "" }, "A", 2, 0, 16, 18, "" }, /* With ECI and Structured Append 1st symbol */ + /* 32*/ { 3, 1, { 1, 2, "" }, "A", 3, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version A, requires 11 codewords (maximum 10)" }, + /* 33*/ { 3, 1, { 2, 2, "" }, "A", 4, 0, 16, 18, "" }, /* With ECI and Structured Append subsequent symbol */ + /* 34*/ { 3, 1, { 2, 2, "" }, "A", 5, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version A, requires 11 codewords (maximum 10)" }, + /* 35*/ { -1, 1, { 0, 0, "" }, "\001", 10, 0, 16, 18, "" }, + /* 36*/ { -1, 1, { 0, 0, "" }, "\001", 11, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version A, requires 11 codewords (maximum 10)" }, + /* 37*/ { -1, 1, { 0, 0, "" }, "\200", 8, 0, 16, 18, "" }, + /* 38*/ { -1, 1, { 0, 0, "" }, "\200", 9, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version A, requires 11 codewords (maximum 10)" }, + /* 39*/ { -1, 2, { 0, 0, "" }, "1", 44, 0, 22, 22, "" }, /* Version B */ + /* 40*/ { -1, 2, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version B, requires 20 codewords (maximum 19)" }, + /* 41*/ { -1, 2, { 0, 0, "" }, "A", 27, 0, 22, 22, "" }, + /* 42*/ { -1, 2, { 0, 0, "" }, "A", 28, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version B, requires 21 codewords (maximum 19)" }, + /* 43*/ { -1, 2, { 0, 0, "" }, "A", 26, 0, 22, 22, "" }, + /* 44*/ { -1, 2, { 0, 0, "" }, "\001", 19, 0, 22, 22, "" }, + /* 45*/ { -1, 2, { 0, 0, "" }, "\001", 20, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version B, requires 20 codewords (maximum 19)" }, + /* 46*/ { -1, 2, { 0, 0, "" }, "\200", 17, 0, 22, 22, "" }, + /* 47*/ { -1, 2, { 0, 0, "" }, "\200", 18, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version B, requires 20 codewords (maximum 19)" }, + /* 48*/ { -1, 3, { 0, 0, "" }, "1", 104, 0, 28, 32, "" }, /* Version C */ + /* 49*/ { -1, 3, { 0, 0, "" }, "1", 105, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version C, requires 45 codewords (maximum 44)" }, + /* 50*/ { -1, 3, { 0, 0, "" }, "A", 64, 0, 28, 32, "" }, + /* 51*/ { -1, 3, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version C, requires 46 codewords (maximum 44)" }, + /* 52*/ { -1, 3, { 0, 0, "" }, "\001", 44, 0, 28, 32, "" }, + /* 53*/ { -1, 3, { 0, 0, "" }, "\001", 45, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version C, requires 45 codewords (maximum 44)" }, + /* 54*/ { -1, 3, { 0, 0, "" }, "\200", 42, 0, 28, 32, "" }, + /* 55*/ { -1, 3, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version C, requires 45 codewords (maximum 44)" }, + /* 56*/ { -1, 4, { 0, 0, "" }, "1", 217, 0, 40, 42, "" }, /* Version D */ + /* 57*/ { -1, 4, { 0, 0, "" }, "1", 218, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version D, requires 93 codewords (maximum 91)" }, + /* 58*/ { -1, 4, { 0, 0, "" }, "A", 135, 0, 40, 42, "" }, + /* 59*/ { -1, 4, { 0, 0, "" }, "A", 136, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version D, requires 93 codewords (maximum 91)" }, + /* 60*/ { -1, 4, { 0, 0, "" }, "\001", 91, 0, 40, 42, "" }, + /* 61*/ { -1, 4, { 0, 0, "" }, "\001", 92, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version D, requires 92 codewords (maximum 91)" }, + /* 62*/ { -1, 4, { 0, 0, "" }, "\200", 89, 0, 40, 42, "" }, + /* 63*/ { -1, 4, { 0, 0, "" }, "\200", 90, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version D, requires 92 codewords (maximum 91)" }, + /* 64*/ { -1, 5, { 0, 0, "" }, "1", 435, 0, 52, 54, "" }, /* Version E (note 435 multiple of 3) */ + /* 65*/ { -1, 5, { 0, 0, "" }, "1", 436, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version E, requires 183 codewords (maximum 182)" }, + /* 66*/ { -1, 5, { 0, 0, "" }, "1", 434, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version E, requires 183 codewords (maximum 182)" }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */ + /* 67*/ { -1, 5, { 0, 0, "" }, "1", 433, 0, 52, 54, "" }, + /* 68*/ { -1, 5, { 0, 0, "" }, "A", 271, 0, 52, 54, "" }, + /* 69*/ { -1, 5, { 0, 0, "" }, "A", 272, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version E, requires 184 codewords (maximum 182)" }, + /* 70*/ { -1, 5, { 0, 0, "" }, "\001", 182, 0, 52, 54, "" }, + /* 71*/ { -1, 5, { 0, 0, "" }, "\001", 183, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version E, requires 183 codewords (maximum 182)" }, + /* 72*/ { -1, 5, { 0, 0, "" }, "\200", 180, 0, 52, 54, "" }, + /* 73*/ { -1, 5, { 0, 0, "" }, "\200", 181, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version E, requires 183 codewords (maximum 182)" }, + /* 74*/ { -1, 6, { 0, 0, "" }, "1", 886, 0, 70, 76, "" }, /* Version F */ + /* 75*/ { -1, 6, { 0, 0, "" }, "1", 887, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version F, requires 371 codewords (maximum 370)" }, + /* 76*/ { -1, 6, { 0, 0, "" }, "A", 553, 0, 70, 76, "" }, + /* 77*/ { -1, 6, { 0, 0, "" }, "A", 554, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version F, requires 372 codewords (maximum 370)" }, + /* 78*/ { -1, 6, { 0, 0, "" }, "\001", 370, 0, 70, 76, "" }, + /* 79*/ { -1, 6, { 0, 0, "" }, "\001", 371, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version F, requires 371 codewords (maximum 370)" }, + /* 80*/ { -1, 6, { 0, 0, "" }, "\200", 368, 0, 70, 76, "" }, + /* 81*/ { -1, 6, { 0, 0, "" }, "\200", 369, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version F, requires 372 codewords (maximum 370)" }, + /* 82*/ { -1, 7, { 0, 0, "" }, "1", 1755, 0, 104, 98, "" }, /* Version G (note 1755 multiple of 3) */ + /* 83*/ { -1, 7, { 0, 0, "" }, "1", 1756, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version G, requires 733 codewords (maximum 732)" }, + /* 84*/ { -1, 7, { 0, 0, "" }, "1", 1754, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version G, requires 733 codewords (maximum 732)" }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */ + /* 85*/ { -1, 7, { 0, 0, "" }, "1", 1753, 0, 104, 98, "" }, + /* 86*/ { -1, 7, { 0, 0, "" }, "A", 1096, 0, 104, 98, "" }, + /* 87*/ { -1, 7, { 0, 0, "" }, "A", 1097, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version G, requires 734 codewords (maximum 732)" }, + /* 88*/ { -1, 7, { 0, 0, "" }, "\001", 732, 0, 104, 98, "" }, + /* 89*/ { -1, 7, { 0, 0, "" }, "\001", 733, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version G, requires 733 codewords (maximum 732)" }, + /* 90*/ { -1, 7, { 0, 0, "" }, "\200", 730, 0, 104, 98, "" }, + /* 91*/ { -1, 7, { 0, 0, "" }, "\200", 731, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version G, requires 734 codewords (maximum 732)" }, + /* 92*/ { -1, 7, { 0, 0, "" }, "\200", 732, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version G, requires 735 codewords (maximum 732)" }, + /* 93*/ { -1, 7, { 0, 0, "" }, "\200", 1478, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version G, requires 1480 codewords (maximum 732)" }, + /* 94*/ { -1, 8, { 0, 0, "" }, "1", 3550, 0, 148, 134, "" }, /* Version H */ + /* 95*/ { -1, 8, { 0, 0, "" }, "1", 3551, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /* 96*/ { -1, 8, { 0, 0, "" }, "A", 2218, 0, 148, 134, "" }, + /* 97*/ { -1, 8, { 0, 0, "" }, "A", 2219, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /* 98*/ { -1, 8, { 0, 0, "" }, "\001", 1480, 0, 148, 134, "" }, + /* 99*/ { -1, 8, { 0, 0, "" }, "\001", 1481, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /*100*/ { -1, 8, { 0, 0, "" }, "\200", 1478, 0, 148, 134, "" }, + /*101*/ { -1, 8, { 0, 0, "" }, "\200", 1479, ZINT_ERROR_TOO_LONG, -1, -1, "Error 517: Input too long, requires too many codewords (maximum 1480)" }, + /*102*/ { -1, 9, { 0, 0, "" }, "1", 6, 0, 8, 11, "" }, /* Version S-10 */ + /*103*/ { -1, 9, { 0, 0, "" }, "1", 7, 0, 8, 21, "" }, /* -> S-20 */ + /*104*/ { -1, 9, { 0, 0, "" }, "1", 12, 0, 8, 21, "" }, /* Version S-20 */ + /*105*/ { -1, 9, { 0, 0, "" }, "1", 13, 0, 8, 31, "" }, /* -> S-30 */ + /*106*/ { -1, 9, { 0, 0, "" }, "1", 18, 0, 8, 31, "" }, /* Version S-30 */ + /*107*/ { -1, 9, { 0, 0, "" }, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1, "Error 514: Input length 19 too long for Version S (maximum 18)" }, + /*108*/ { -1, 9, { 0, 0, "" }, "1", 17, 0, 8, 31, "" }, + /*109*/ { -1, 10, { 0, 0, "" }, "1", 22, 0, 16, 17, "" }, /* Version T-16 */ + /*110*/ { -1, 10, { 0, 0, "" }, "1", 23, 0, 16, 33, "" }, /* -> T-32 */ + /*111*/ { -1, 10, { 0, 0, "" }, "A", 13, 0, 16, 17, "" }, + /*112*/ { -1, 10, { 0, 0, "" }, "A", 14, 0, 16, 33, "" }, /* -> T-32 */ + /*113*/ { -1, 10, { 0, 0, "" }, "\001", 10, 0, 16, 17, "" }, + /*114*/ { -1, 10, { 0, 0, "" }, "\001", 11, 0, 16, 33, "" }, /* -> T-32 */ + /*115*/ { -1, 10, { 0, 0, "" }, "\200", 8, 0, 16, 17, "" }, + /*116*/ { -1, 10, { 0, 0, "" }, "\200", 9, 0, 16, 33, "" }, /* -> T-32 */ + /*117*/ { -1, 10, { 0, 0, "" }, "1", 56, 0, 16, 33, "" }, /* Version T-32 */ + /*118*/ { -1, 10, { 0, 0, "" }, "1", 57, 0, 16, 49, "" }, /* -> T-48 */ + /*119*/ { -1, 10, { 0, 0, "" }, "A", 34, 0, 16, 33, "" }, + /*120*/ { -1, 10, { 0, 0, "" }, "A", 35, 0, 16, 49, "" }, /* -> T-48 */ + /*121*/ { -1, 10, { 0, 0, "" }, "\001", 24, 0, 16, 33, "" }, + /*122*/ { -1, 10, { 0, 0, "" }, "\001", 25, 0, 16, 49, "" }, /* -> T-48 */ + /*123*/ { -1, 10, { 0, 0, "" }, "\200", 22, 0, 16, 33, "" }, + /*124*/ { -1, 10, { 0, 0, "" }, "\200", 23, 0, 16, 49, "" }, /* -> T-48 */ + /*125*/ { -1, 10, { 0, 0, "" }, "1", 90, 0, 16, 49, "" }, /* Version T-48 (note 90 multiple of 3) */ + /*126*/ { -1, 10, { 0, 0, "" }, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1, "Error 519: Input length 91 too long for Version T (maximum 90)" }, + /*127*/ { -1, 10, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 39 codewords (maximum 38)" }, /* NOTE: a quirk of decimal end-of-data processing is existence of "lower maxs" if digits are not a multiple of 3 */ + /*128*/ { -1, 10, { 0, 0, "" }, "1", 88, 0, 16, 49, "" }, + /*129*/ { -1, 10, { 0, 0, "" }, "A", 55, 0, 16, 49, "" }, + /*130*/ { -1, 10, { 0, 0, "" }, "A", 56, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 40 codewords (maximum 38)" }, + /*131*/ { -1, 10, { 0, 0, "" }, "A", 90, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 61 codewords (maximum 38)" }, + /*132*/ { -1, 10, { 0, 0, "" }, "\001", 38, 0, 16, 49, "" }, + /*133*/ { -1, 10, { 0, 0, "" }, "\001", 39, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 39 codewords (maximum 38)" }, + /*134*/ { -1, 10, { 0, 0, "" }, "\001", 90, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 90 codewords (maximum 38)" }, + /*135*/ { -1, 10, { 0, 0, "" }, "\\", 38, 0, 16, 49, "" }, + /*136*/ { -1, 10, { 0, 0, "" }, "\\", 39, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 39 codewords (maximum 38)" }, + /*137*/ { -1, 10, { 0, 0, "" }, "\200", 36, 0, 16, 49, "" }, + /*138*/ { -1, 10, { 0, 0, "" }, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 39 codewords (maximum 38)" }, + /*139*/ { -1, 10, { 0, 0, "" }, "AAA\200", 31, 0, 16, 49, "" }, /* ASCII + BYTE (ASCII UpSh - worse than BYTE) */ + /*140*/ { -1, 10, { 0, 0, "" }, "AAA\200", 32, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 40 codewords (maximum 38)" }, + /*141*/ { 3, 10, { 0, 0, "" }, "A", 46, 0, 16, 49, "" }, /* Version T-48 with ECI (9 less as PAD escape char + "\123456") */ + /*142*/ { 3, 10, { 0, 0, "" }, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 40 codewords (maximum 38)" }, + /*143*/ { 3, 10, { 0, 0, "" }, "\001", 32, 0, 16, 49, "" }, + /*144*/ { 3, 10, { 0, 0, "" }, "\001", 33, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 39 codewords (maximum 38)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -215,6 +219,8 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -243,46 +249,47 @@ static void test_input(const testCtx *const p_ctx) { const char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { -1, -1, -1, { 0, 0, "" }, "123456789012ABCDEFGHI", -1, 0, 22, 22, "", }, /* 1*/ { -1, -1, -1, { 0, 0, "" }, "123456789012ABCDEFGHIJ", -1, 0, 22, 22, "", }, /* 2*/ { -1, -1, -1, { 0, 0, "" }, "1", -1, 0, 16, 18, "", }, /* 3*/ { -1, -1, 0, { 0, 0, "" }, "1", -1, 0, 16, 18, "", }, /* 4*/ { -1, -1, 1, { 0, 0, "" }, "1", -1, 0, 16, 18, "", }, - /* 5*/ { -1, -1, 1, { 0, 0, "" }, "ABCDEFGHIJKLMN", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for selected symbol size", }, + /* 5*/ { -1, -1, 1, { 0, 0, "" }, "ABCDEFGHIJKLMN", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version A, requires 12 codewords (maximum 10)", }, /* 6*/ { GS1_MODE, -1, 1, { 0, 0, "" }, "[01]12345678901231", -1, 0, 16, 18, "", }, /* 7*/ { GS1_MODE | GS1PARENS_MODE, -1, 1, { 0, 0, "" }, "(01)12345678901231", -1, 0, 16, 18, "", }, /* 8*/ { -1, 3, 1, { 0, 0, "" }, "1", -1, 0, 16, 18, "", }, /* 9*/ { UNICODE_MODE, 3, 1, { 0, 0, "" }, "é", -1, 0, 16, 18, "", }, /* 10*/ { GS1_MODE, 3, 1, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 16, 18, "Warning 512: ECI ignored for GS1 mode", }, /* 11*/ { -1, -1, 9, { 0, 0, "" }, "123456789012345678", -1, 0, 8, 31, "", }, - /* 12*/ { -1, -1, 9, { 0, 0, "" }, "12345678901234567A", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 515: Invalid input data (Version S encodes numeric input only)", }, - /* 13*/ { -1, -1, 9, { 0, 0, "" }, "1234567890123456789", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 514: Input data too long for Version S", }, + /* 12*/ { -1, -1, 9, { 0, 0, "" }, "12345678901234567A", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 515: Invalid character at position 18 in input (Version S encodes digits only)", }, + /* 13*/ { -1, -1, 9, { 0, 0, "" }, "1234567890123456789", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 514: Input length 19 too long for Version S (maximum 18)", }, /* 14*/ { GS1_MODE, -1, 9, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 8, 31, "Warning 511: GS1 mode ignored for Version S", }, /* 15*/ { -1, 3, 9, { 0, 0, "" }, "1", -1, ZINT_WARN_INVALID_OPTION, 8, 11, "Warning 511: ECI ignored for Version S", }, /* 16*/ { GS1_MODE, 3, 9, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 8, 31, "Warning 511: ECI and GS1 mode ignored for Version S", }, /* 17*/ { -1, -1, 10, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", -1, 0, 16, 49, "", }, - /* 18*/ { -1, -1, 10, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 519: Input data too long for Version T", }, + /* 18*/ { -1, -1, 10, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 519: Input length 91 too long for Version T (maximum 90)", }, /* 19*/ { -1, -1, 10, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, 0, 16, 49, "", }, - /* 20*/ { -1, -1, 10, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input data too long for Version T", }, + /* 20*/ { -1, -1, 10, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 55 codewords (maximum 38)", }, /* 21*/ { -1, -1, 10, { 0, 0, "" }, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 38, 0, 16, 49, "", }, /* 22*/ { -1, 3, 10, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456", -1, 0, 16, 49, "", }, - /* 23*/ { -1, 3, 10, { 0, 0, "" }, "12345678901234567890123456789012345678901234567890123456789012345678901234567", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input data too long for Version T", }, - /* 24*/ { -1, 3, 10, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 519: Input data too long for Version T", }, + /* 23*/ { -1, 3, 10, { 0, 0, "" }, "12345678901234567890123456789012345678901234567890123456789012345678901234567", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 39 codewords (maximum 38)", }, + /* 24*/ { -1, 3, 10, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 519: Input length 91 too long for Version T (maximum 90)", }, /* 25*/ { GS1_MODE, -1, 10, { 0, 0, "" }, "[01]12345678901231", -1, 0, 16, 17, "", }, /* 26*/ { GS1_MODE, 3, 10, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 16, 17, "Warning 512: ECI ignored for GS1 mode", }, - /* 27*/ { -1, -1, 11, { 0, 0, "" }, "1", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 513: Invalid symbol size", }, - /* 28*/ { GS1_MODE, -1, -1, { 1, 2, "" }, "[01]12345678901231", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 710: Cannot have Structured Append and GS1 mode at the same time", }, - /* 29*/ { -1, -1, -1, { 1, 1, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count out of range (2-128)", }, - /* 30*/ { -1, -1, -1, { 1, 1, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count out of range (2-128)", }, - /* 31*/ { -1, -1, -1, { 1, 129, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count out of range (2-128)", }, - /* 32*/ { -1, -1, -1, { 0, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 712: Structured Append index out of range (1-2)", }, - /* 33*/ { -1, -1, -1, { 3, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 712: Structured Append index out of range (1-2)", }, - /* 34*/ { -1, -1, -1, { 1, 2, "1" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 713: Structured Append ID not available for Code One", }, - /* 35*/ { -1, -1, 9, { 1, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 714: Structured Append not available for Version S", }, - /* 36*/ { -1, -1, 9, { 3, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 714: Structured Append not available for Version S", }, /* Trumps other checking */ + /* 27*/ { -1, -1, 11, { 0, 0, "" }, "1", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 513: Version '11' out of range (1 to 10)", }, + /* 28*/ { -1, -1, -2, { 0, 0, "" }, "1", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 513: Version '-2' out of range (1 to 10)", }, + /* 29*/ { GS1_MODE, -1, -1, { 1, 2, "" }, "[01]12345678901231", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 710: Cannot have Structured Append and GS1 mode at the same time", }, + /* 30*/ { -1, -1, -1, { 1, 1, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count '1' out of range (2 to 128)", }, + /* 31*/ { -1, -1, -1, { 1, -1, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count '-1' out of range (2 to 128)", }, + /* 32*/ { -1, -1, -1, { 1, 129, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count '129' out of range (2 to 128)", }, + /* 33*/ { -1, -1, -1, { 0, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 712: Structured Append index '0' out of range (1 to count 2)", }, + /* 34*/ { -1, -1, -1, { 3, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 712: Structured Append index '3' out of range (1 to count 2)", }, + /* 35*/ { -1, -1, -1, { 1, 2, "1" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 713: Structured Append ID not available for Code One", }, + /* 36*/ { -1, -1, 9, { 1, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 714: Structured Append not available for Version S", }, + /* 37*/ { -1, -1, 9, { 3, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 714: Structured Append not available for Version S", }, /* Trumps other checking */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -334,7 +341,7 @@ static void test_encode(const testCtx *const p_ctx) { char *expected; }; /* Figure examples AIM USS Code One (USSCO) Revision March 3, 2000 */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { -1, -1, -1, { 0, 0, "" }, "1234567890123456789012", -1, 0, 16, 18, 1, "USSCO Figure 1 (Version A, no padding), same", "111111111111001100" "000110000110010101" @@ -2879,7 +2886,7 @@ static void test_encode(const testCtx *const p_ctx) { "110100001010111101" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -2969,7 +2976,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { char *expected; }; /* Figure examples AIM USS Code One (USSCO) Revision March 3, 2000 */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, -1, { 0, 0, "" }, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 16, 18, 1, "Standard example", "100011010111100011" "000110110110110111" @@ -3268,7 +3275,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, j, seg_count, ret; struct zint_symbol *symbol = NULL; @@ -3363,7 +3370,7 @@ static void test_fuzz(const testCtx *const p_ctx) { char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { -1, "3333P33B\035333V3333333333333\0363", -1, 0, 1, "" }, /* #181 Nico Gunkel, OSS-Fuzz */ /* 1*/ { -1, "{{-06\024755712162106130000000829203983\377", -1, 0, 1, "" }, /* #232 Jan Schrewe, CI-Fuzz, out-of-bounds in is_last_single_ascii() sp + 1 */ /* 2*/ { -1, "\000\000\000\367\000\000\000\000\000\103\040\000\000\244\137\140\140\000\000\000\000\000\000\000\000\000\005\000\000\000\000\000\165\060\060\060\060\061\060\060\114\114\060\010\102\102\102\102\102\102\102\102\057\102\100\102\057\233\100\102", 60, 0, 1, "" }, /* #300 (#4) Andre Maute (`c1_c40text_cnt()` not accounting for extended ASCII shifts) */ @@ -3371,7 +3378,7 @@ static void test_fuzz(const testCtx *const p_ctx) { /* 4*/ { 10, "\015\015\353\362\015\015\015\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\110\015\015\015\015\015\015\015\015\015\015\015\015\015\015\015\362\362\000", 39, 0, 1, "" }, /* #300 (#8 shortened) Andre Maute */ /* 5*/ { 10, "\153\153\153\153\153\060\001\000\000\134\153\153\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\153\153\153\153\153\153\043\000\000\307\000\147\000\000\000\043\113\153\162\162\215\220", 90, ZINT_ERROR_TOO_LONG, 1, "" }, /* #300 (#12) Andre Maute (too small buffer for Version T) */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; diff --git a/backend/tests/test_code128.c b/backend/tests/test_code128.c index 08ec977e..614a85a3 100644 --- a/backend/tests/test_code128.c +++ b/backend/tests/test_code128.c @@ -43,41 +43,42 @@ static void test_large(const testCtx *const p_ctx) { int length; int ret; int expected_width; + char *expected_errtxt; }; /* é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { BARCODE_CODE128, -1, "A", 99, 0, 1124 }, - /* 1*/ { BARCODE_CODE128, -1, "A", 100, ZINT_ERROR_TOO_LONG, -1 }, - /* 2*/ { BARCODE_CODE128, -1, "A", 257, ZINT_ERROR_TOO_LONG, -1 }, - /* 3*/ { BARCODE_CODE128, READER_INIT, "A", 99, 0, 1135 }, - /* 4*/ { BARCODE_CODE128, READER_INIT, "A", 100, ZINT_ERROR_TOO_LONG, -1 }, - /* 5*/ { BARCODE_CODE128, READER_INIT, "A", 257, ZINT_ERROR_TOO_LONG, -1 }, - /* 6*/ { BARCODE_CODE128, -1, "\351A", 66, 0, 1124 }, - /* 7*/ { BARCODE_CODE128, -1, "\351A", 67, ZINT_ERROR_TOO_LONG, -1 }, /* 67 chars (+ 34 shifts) */ - /* 8*/ { BARCODE_CODE128, -1, "\351", 97, 0, 1124 }, /* Less 2 FNC4s for latch */ - /* 9*/ { BARCODE_CODE128, -1, "\351", 98, ZINT_ERROR_TOO_LONG, -1 }, - /* 10*/ { BARCODE_CODE128, -1, "0", 198, 0, 1124 }, - /* 11*/ { BARCODE_CODE128, -1, "0", 199, ZINT_ERROR_TOO_LONG, -1 }, - /* 12*/ { BARCODE_CODE128, -1, "0", 257, ZINT_ERROR_TOO_LONG, -1 }, - /* 13*/ { BARCODE_CODE128AB, -1, "A", 99, 0, 1124 }, - /* 14*/ { BARCODE_CODE128AB, -1, "A", 100, ZINT_ERROR_TOO_LONG, -1 }, - /* 15*/ { BARCODE_CODE128AB, -1, "0", 99, 0, 1124 }, - /* 16*/ { BARCODE_CODE128AB, -1, "0", 100, ZINT_ERROR_TOO_LONG, -1 }, - /* 17*/ { BARCODE_GS1_128, -1, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", -1, ZINT_WARN_HRT_TRUNCATED, 1135 }, /* 196 nos + 3 FNC1s */ - /* 18*/ { BARCODE_GS1_128, -1, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", -1, ZINT_ERROR_TOO_LONG, -1 }, /* 196 nos + CodeA + single no. + 3 FNC1s */ - /* 19*/ { BARCODE_GS1_128, -1, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", -1, ZINT_ERROR_TOO_LONG, -1 }, /* 198 nos + 3 FNC1s */ - /* 20*/ { BARCODE_GS1_128, -1, "A", 257, ZINT_ERROR_TOO_LONG, -1 }, - /* 21*/ { BARCODE_EAN14, -1, "1234567890123", -1, 0, 134 }, - /* 22*/ { BARCODE_EAN14, -1, "12345678901234", -1, ZINT_ERROR_TOO_LONG, -1 }, - /* 23*/ { BARCODE_NVE18, -1, "12345678901234567", -1, 0, 156 }, - /* 24*/ { BARCODE_NVE18, -1, "123456789012345678", -1, ZINT_ERROR_TOO_LONG, -1 }, - /* 25*/ { BARCODE_HIBC_128, -1, "1", 110, 0, 684 }, - /* 26*/ { BARCODE_HIBC_128, -1, "1", 111, ZINT_ERROR_TOO_LONG, -1 }, + static const struct item data[] = { + /* 0*/ { BARCODE_CODE128, -1, "A", 99, 0, 1124, "" }, + /* 1*/ { BARCODE_CODE128, -1, "A", 100, ZINT_ERROR_TOO_LONG, -1, "Error 341: Input too long, requires 100 symbol characters (maximum 99)" }, + /* 2*/ { BARCODE_CODE128, -1, "A", 257, ZINT_ERROR_TOO_LONG, -1, "Error 340: Input length 257 too long (maximum 256)" }, + /* 3*/ { BARCODE_CODE128, READER_INIT, "A", 99, 0, 1135, "" }, + /* 4*/ { BARCODE_CODE128, READER_INIT, "A", 100, ZINT_ERROR_TOO_LONG, -1, "Error 341: Input too long, requires 100 symbol characters (maximum 99)" }, + /* 5*/ { BARCODE_CODE128, READER_INIT, "A", 257, ZINT_ERROR_TOO_LONG, -1, "Error 340: Input length 257 too long (maximum 256)" }, + /* 6*/ { BARCODE_CODE128, -1, "\351A", 66, 0, 1124, "" }, + /* 7*/ { BARCODE_CODE128, -1, "\351A", 67, ZINT_ERROR_TOO_LONG, -1, "Error 341: Input too long, requires 101 symbol characters (maximum 99)" }, /* 67 chars (+ 34 shifts) */ + /* 8*/ { BARCODE_CODE128, -1, "\351", 97, 0, 1124, "" }, /* Less 2 FNC4s for latch */ + /* 9*/ { BARCODE_CODE128, -1, "\351", 98, ZINT_ERROR_TOO_LONG, -1, "Error 341: Input too long, requires 100 symbol characters (maximum 99)" }, + /* 10*/ { BARCODE_CODE128, -1, "0", 198, 0, 1124, "" }, + /* 11*/ { BARCODE_CODE128, -1, "0", 199, ZINT_ERROR_TOO_LONG, -1, "Error 341: Input too long, requires 101 symbol characters (maximum 99)" }, + /* 12*/ { BARCODE_CODE128, -1, "0", 257, ZINT_ERROR_TOO_LONG, -1, "Error 340: Input length 257 too long (maximum 256)" }, + /* 13*/ { BARCODE_CODE128AB, -1, "A", 99, 0, 1124, "" }, + /* 14*/ { BARCODE_CODE128AB, -1, "A", 100, ZINT_ERROR_TOO_LONG, -1, "Error 341: Input too long, requires 100 symbol characters (maximum 99)" }, + /* 15*/ { BARCODE_CODE128AB, -1, "0", 99, 0, 1124, "" }, + /* 16*/ { BARCODE_CODE128AB, -1, "0", 100, ZINT_ERROR_TOO_LONG, -1, "Error 341: Input too long, requires 100 symbol characters (maximum 99)" }, + /* 17*/ { BARCODE_GS1_128, -1, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", -1, ZINT_WARN_HRT_TRUNCATED, 1135, "Warning 844: Human Readable Text truncated" }, /* 196 nos + 3 FNC1s */ + /* 18*/ { BARCODE_GS1_128, -1, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", -1, ZINT_ERROR_TOO_LONG, -1, "Error 344: Input too long, requires 101 symbol characters (maximum 99)" }, /* 196 nos + CodeA + single no. + 3 FNC1s */ + /* 19*/ { BARCODE_GS1_128, -1, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", -1, ZINT_ERROR_TOO_LONG, -1, "Error 344: Input too long, requires 100 symbol characters (maximum 99)" }, /* 198 nos + 3 FNC1s */ + /* 20*/ { BARCODE_GS1_128, -1, "A", 257, ZINT_ERROR_TOO_LONG, -1, "Error 342: Input length 257 too long (maximum 256)" }, + /* 21*/ { BARCODE_EAN14, -1, "1234567890123", -1, 0, 134, "" }, + /* 22*/ { BARCODE_EAN14, -1, "12345678901234", -1, ZINT_ERROR_TOO_LONG, -1, "Error 347: Input length 14 too long (maximum 13)" }, + /* 23*/ { BARCODE_NVE18, -1, "12345678901234567", -1, 0, 156, "" }, + /* 24*/ { BARCODE_NVE18, -1, "123456789012345678", -1, ZINT_ERROR_TOO_LONG, -1, "Error 345: Input length 18 too long (maximum 17)" }, + /* 25*/ { BARCODE_HIBC_128, -1, "1", 110, 0, 684, "" }, + /* 26*/ { BARCODE_HIBC_128, -1, "1", 111, ZINT_ERROR_TOO_LONG, -1, "Error 202: Input length 111 too long for HIBC LIC (maximum 110)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -103,6 +104,8 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); if (ret < ZINT_ERROR) { assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); @@ -130,7 +133,7 @@ static void test_hrt(const testCtx *const p_ctx) { é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, "1234567890", -1, "1234567890" }, /* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, "\000ABC\000DEF\000", 9, " ABC DEF " }, /* 2*/ { BARCODE_CODE128AB, UNICODE_MODE, -1, "12345\00067890", 11, "12345 67890" }, @@ -175,7 +178,7 @@ static void test_hrt(const testCtx *const p_ctx) { /* 41*/ { BARCODE_UPU_S10, UNICODE_MODE, -1, "EE876543216CA", -1, "EE 876 543 216 CA" }, /* UPU S10 Annex A */ /* BARCODE_GS1_128, BARCODE_EAN14, BARCODE_NVE18 hrt tested in test_gs1.c */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -217,7 +220,7 @@ static void test_reader_init(const testCtx *const p_ctx) { char *expected; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, UNICODE_MODE, READER_INIT, "A", 0, 1, 57, "(5) 104 96 33 60 106", "StartA FNC3 A" }, /* 1*/ { BARCODE_CODE128, UNICODE_MODE, READER_INIT, "12", 0, 1, 68, "(6) 104 96 99 12 22 106", "StartB FNC3 CodeC 12" }, /* 2*/ { BARCODE_CODE128AB, UNICODE_MODE, READER_INIT, "\0371234", 0, 1, 101, "(9) 103 96 95 17 18 19 20 6 106", "StartA FNC3 US 1 2 3 4" }, @@ -226,7 +229,7 @@ static void test_reader_init(const testCtx *const p_ctx) { /* 5*/ { BARCODE_NVE18, GS1_MODE, READER_INIT, "12", 0, 1, 156, "(14) 105 102 0 0 0 0 0 0 0 0 1 23 58 106", "StartC FNC1 00 (8) 01 23 (Reader Initialise not supported by GS1 barcodes (use CODE128))" }, /* 6*/ { BARCODE_HIBC_128, UNICODE_MODE, READER_INIT, "A", 0, 1, 79, "(7) 104 96 11 33 24 5 106", "StartA FNC3 + A 8 (check) (Not sensible, use CODE128)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -290,8 +293,8 @@ static void test_input(const testCtx *const p_ctx) { ß U+00DF (\337, 223), UTF-8 C39F, CodeA and CodeB extended ASCII é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII */ - struct item data[] = { - /* 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" }, + static const struct item data[] = { + /* 0*/ { UNICODE_MODE, "\302\200", -1, ZINT_ERROR_INVALID_DATA, 0, 1, "Error 204: Invalid character in input (ISO/IEC 8859-1 only)", "PAD not in ISO 8859-1" }, /* 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, 1, "(9) 104 33 41 45 99 12 34 87 106", "Example from Annex A.1, check char value 87" }, /* 3*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^B12345\\^C6789", -1, 0, 123, 0, "(11) 104 17 18 19 20 21 99 67 89 11 106", "Ticket #204 ZPL example; BWIPP no manual mode" }, @@ -343,59 +346,72 @@ static void test_input(const testCtx *const p_ctx) { /* 49*/ { DATA_MODE, "\141\142\237", -1, 0, 90, 0, "(8) 104 65 66 101 101 95 41 106", "StartB a b CodeA FNC4 APC; BWIPP different encodation" }, /* 50*/ { DATA_MODE, "\141\142\237\037", -1, 0, 101, 0, "(9) 104 65 66 101 101 95 95 96 106", "StartB a b CodeA FNC4 APC US; BWIPP different encodation" }, /* 51*/ { UNICODE_MODE, "ééé", -1, 0, 90, 1, "(8) 104 100 100 73 73 73 44 106", "StartB LatchFNC4 é é é" }, - /* 52*/ { 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" }, - /* 53*/ { 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" }, - /* 54*/ { 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" }, - /* 55*/ { 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" }, - /* 56*/ { 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" }, - /* 57*/ { 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" }, - /* 58*/ { 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" }, - /* 59*/ { 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)" }, - /* 60*/ { 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)" }, - /* 61*/ { DATA_MODE, "\200\200\200\200\200\101\060\060\060\060\101\200", -1, 0, 211, 0, "(19) 103 101 101 64 64 64 64 64 101 33 99 0 0 101 101 33 64 4 106", "StartA FNC4 FNC4 PAD (5) FNC4 A CodeC 00 00 CodeA FNC4 A PAD; BWIPP different encodation (BWIPP 1 longer)" }, - /* 62*/ { 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" }, - /* 63*/ { 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" }, - /* 64*/ { DATA_MODE, "@g(\202\202\202\202\2025555\202\202\202\202\202\202\202\202", -1, 0, 288, 0, "(26) 104 32 71 8 101 101 101 66 66 66 66 66 99 55 55 101 66 66 66 66 66 66 66 66 10 106", "Okapi code128/extended-mode-with-short-embedded-code-set-c.png (chose different solution); BWIPP different encodation" }, - /* 65*/ { DATA_MODE, "@g(\202\202\202\202\20255555\202\202\202\202\202\202\202", -1, 0, 299, 0, "(27) 104 32 71 8 101 101 101 66 66 66 66 66 99 55 55 101 101 21 66 66 66 66 66 66 66 50 106", "Above with extra 5; BWIPP different encodation" }, - /* 66*/ { DATA_MODE, "@g(\202\202\202\202\202555555\202\202\202\202\202\202\202", -1, 0, 288, 0, "(26) 104 32 71 8 101 101 101 66 66 66 66 66 99 55 55 55 101 66 66 66 66 66 66 66 86 106", "Above with extra 55, one less \x82; BWIPP different encodation" }, - /* 67*/ { DATA_MODE, "@g(\202\202\202\202\202555\202\202\202\202\202\202\202\202", -1, 0, 310, 0, "(28) 104 32 71 8 101 101 101 66 66 66 66 66 101 21 101 21 101 21 66 66 66 66 66 66 66 66 5", "Above less one 5; BWIPP different encodation" }, - /* 68*/ { 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" }, - /* 69*/ { 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" }, - /* 70*/ { UNICODE_MODE, "c\naDEF", -1, 0, 112, 1, "(10) 104 67 98 74 65 36 37 38 75 106", "Okapi bug-36-1.png" }, - /* 71*/ { UNICODE_MODE, "\na\nDEF", -1, 0, 112, 1, "(10) 103 74 98 65 74 36 37 38 90 106", "Okapi bug-36-2.png" }, - /* 72*/ { UNICODE_MODE, "ÿ\012àa\0121\012àAà", -1, 0, 222, 0, "(20) 104 100 95 98 74 100 64 65 101 74 17 74 100 100 64 33 100 64 30 106", "BWIPP different encodation, ShA instead of CodeA" }, - /* 73*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "ÿ\012àa\\^A\0121\012\\^BàAà", -1, 0, 222, 0, "(20) 104 100 95 98 74 100 64 65 101 74 17 74 100 100 64 33 100 64 30 106", "BWIPP different encodation, FNC4 before CodeB" }, - /* 74*/ { UNICODE_MODE, "ÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 376, 0, "(34) 104 100 95 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33 100 64 36", "BWIPP different encodation, CodeA instead of ShA, same width" }, - /* 75*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "ÿ1234\012à\\^Aa\0121\012\\^C7890\\^BàAàDà\012à", -1, 0, 376, 0, "(34) 104 100 95 99 12 34 101 74 101 98 64 98 65 74 17 74 99 78 90 100 100 64 33 100 64 36", "BWIPP different encodation, FNC4 before CodeB, same width" }, - /* 76*/ { UNICODE_MODE, "yÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 387, 0, "(35) 104 89 100 95 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33 100 64", "BWIPP different encodation, CodeA instead of ShA, same width" }, - /* 77*/ { UNICODE_MODE, "ÿy1234\012àa\0121\0127890àAàDà\012à", -1, 0, 387, 0, "(35) 104 100 95 89 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33 100 64", "BWIPP different encodation, CodeA instead of ShA, same width" }, - /* 78*/ { UNICODE_MODE, "ÿÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 398, 0, "(36) 104 100 95 100 95 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33", "BWIPP different encodation, CodeA instead of ShA, same width" }, - /* 79*/ { UNICODE_MODE, "ÿ12345678\012à12345678abcdef\0121\01223456\012\0127890àAàBCDEFà\012\012à", -1, 0, 662, 0, "(60) 104 100 95 99 12 34 56 78 101 74 100 100 64 99 12 34 56 78 100 65 66 67 68 69 70 101", "BWIPP different encodation, CodeA instead of ShA, same width" }, - /* 80*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^B\\^A12\\^C34\\^A\\^B5\\^C67\\^A\\^B\\^CA\\^B\\^A", -1, 0, 145, 0, "(13) 103 17 18 99 34 100 21 99 67 100 33 69 106", "BWIPP no manual mode" }, - /* 81*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^C1234ABC12\012", -1, 0, 145, 0, "(13) 105 12 34 100 33 34 35 99 12 101 74 36 106", "StartC 12 34 CodeB A B C CodeC 12 CodeA ; BWIPP no manual mode" }, - /* 82*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "A\\^", -1, 0, 68, 1, "(6) 104 33 60 62 31 106", "StartC 12 34 CodeB A B C CodeC 12 CodeA LF" }, - /* 83*/ { UNICODE_MODE, "A\0121234A12\012", -1, 0, 145, 1, "(13) 103 33 74 99 12 34 101 33 17 18 74 99 106", "StartA A CodeC 12 34 CodeA A 1 2 ; Okapi c128/improved-lookahead-mode-a.png" }, - /* 84*/ { UNICODE_MODE, "21*\015\012M0", -1, 0, 112, 0, "(10) 105 21 101 10 77 74 45 16 79 106", "StartC 21 CodeA * M 0; Okapi c128/improved-lookahead-rule-1c.png; BWIPP different encodation, same width" }, - /* 85*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^112345\\^11234\\^112345", -1, 0, 178, 0, "(16) 104 102 17 99 23 45 102 12 34 102 12 34 100 21 72 106", "Okapi code128/fnc1-mode-c-fnc1-in-middle.png; BWIPP different encodation (BWIPP 2 longer)" }, - /* 86*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^1SN123456789012", -1, 0, 145, 1, "(13) 104 102 51 46 99 12 34 56 78 90 12 65 106", "StartB FNC1 S N CodeC 12 34 56 78 90 12" }, - /* 87*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^B\\^1SN123456789012", -1, 0, 200, 0, "(18) 104 102 51 46 17 18 19 20 21 22 23 24 25 16 17 18 56 106", "StartB FNC1 S N 1 2 3 4 5 6 7 8 9 0 1 2; BWIPP no manual mode" }, - /* 88*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "A\\^1BC\\^1DEF\\^1", -1, 0, 134, 1, "(12) 104 33 102 34 35 102 36 37 38 102 9 106", "StartB A FNC1 B C FNC1 D E F FNC1" }, - /* 89*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^C12\\^1", -1, 0, 57, 0, "(5) 105 12 102 12 106", "StartC 12 FNC1; BWIPP no manual mode" }, - /* 90*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^13", -1, 0, 79, 1, "(7) 105 12 102 100 19 79 106", "StartC 12 FNC1 CodeB 3" }, - /* 91*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^13\\^1", -1, 0, 90, 1, "(8) 105 12 102 100 19 102 74 106", "StartC 12 FNC1 CodeB 3 FNC1" }, - /* 92*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "1\\^123", -1, 0, 79, 0, "(7) 104 17 99 102 23 99 106", "StartB 1 CodeC FNC1 23; BWIPP different encodation (same codeword count)" }, - /* 93*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^134", -1, 0, 68, 1, "(6) 105 12 102 34 11 106", "StartC 12 FNC1 34" }, - /* 94*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^134\\^1", -1, 0, 79, 1, "(7) 105 12 102 34 102 7 106", "StartC 12 FNC1 34 FNC1" }, - /* 95*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "123\\^145\\^1", -1, 0, 101, 1, "(9) 104 17 99 23 102 45 102 88 106", "StartB 1 CodeC 23 FNC1 45 FNC1" }, - /* 96*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^1345\\^1", -1, 0, 101, 1, "(9) 105 12 102 34 100 21 102 98 106", "StartC 12 FNC1 34 CodeB 5 FNC1" }, - /* 97*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "1234\\^156\\^1", -1, 0, 90, 1, "(8) 105 12 34 102 56 102 92 106", "StartC 12 34 FNC1 56 FNC1" }, - /* 98*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "1234\\^156789\\^101\\^11\\^1", -1, 0, 178, 1, "(16) 105 12 34 102 56 78 100 25 102 16 17 102 17 102 100 106", "StartC 12 34 FNC1 56 78 CodeB 9 FNC1 0 1 FNC1 1 FNC1" }, - /* 99*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^Aaa\\^B\012\012", -1, 0, 134, 0, "(12) 103 98 65 98 65 100 98 74 98 74 27 106", "StartA ShB a ShB a CodeB ShA ShA ; BWIPP no manual mode" }, - /*100*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^A\342\342\\^B\202\202", -1, 0, 156, 0, "(14) 103 101 101 98 66 98 66 100 98 66 98 66 72 106", "StartA FNC4 FNC4 ShB 226(E2) ShB 226(E2) CodeB ShA 130(82) ShA 130(82); BWIPP no manual mode" }, - /*101*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^A\342\342\342\342\342\\^Baaaaa", -1, 0, 255, 0, "(23) 103 101 101 98 66 98 66 98 66 98 66 98 66 100 100 100 65 65 65 65 65 46 106", "BWIPP no manual mode" }, - /*102*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^A\342\012\342\342\342\\^B\202\342\012\012", -1, 0, 277, 0, "(25) 103 101 98 66 74 101 101 98 66 98 66 98 66 100 98 66 66 100 98 74 100 98 74 69 106", "BWIPP no manual mode" }, + /* 52*/ { UNICODE_MODE, "aéééb", -1, 0, 123, 1, "(11) 104 65 100 73 100 73 100 73 66 5 106", "StartB a FNC4 é (4) b" }, + /* 53*/ { UNICODE_MODE, "aééééb", -1, 0, 134, 0, "(12) 104 65 100 100 73 73 73 73 100 66 64 106", "StartB a Latch é (4) Shift b; BWIPP different encodation" }, + /* 54*/ { 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" }, + /* 55*/ { 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" }, + /* 56*/ { 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" }, + /* 57*/ { 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" }, + /* 58*/ { 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" }, + /* 59*/ { 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" }, + /* 60*/ { 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)" }, + /* 61*/ { 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)" }, + /* 62*/ { DATA_MODE, "\200\200\200\200\200\101\060\060\060\060\101\200", -1, 0, 211, 0, "(19) 103 101 101 64 64 64 64 64 101 33 99 0 0 101 101 33 64 4 106", "StartA FNC4 FNC4 PAD (5) FNC4 A CodeC 00 00 CodeA FNC4 A PAD; BWIPP different encodation (BWIPP 1 longer)" }, + /* 63*/ { 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" }, + /* 64*/ { 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" }, + /* 65*/ { DATA_MODE, "@g(\202\202\202\202\2025555\202\202\202\202\202\202\202\202", -1, 0, 288, 0, "(26) 104 32 71 8 101 101 101 66 66 66 66 66 99 55 55 101 66 66 66 66 66 66 66 66 10 106", "Okapi code128/extended-mode-with-short-embedded-code-set-c.png (chose different solution); BWIPP different encodation" }, + /* 66*/ { DATA_MODE, "@g(\202\202\202\202\20255555\202\202\202\202\202\202\202", -1, 0, 299, 0, "(27) 104 32 71 8 101 101 101 66 66 66 66 66 99 55 55 101 101 21 66 66 66 66 66 66 66 50 106", "Above with extra 5; BWIPP different encodation" }, + /* 67*/ { DATA_MODE, "@g(\202\202\202\202\202555555\202\202\202\202\202\202\202", -1, 0, 288, 0, "(26) 104 32 71 8 101 101 101 66 66 66 66 66 99 55 55 55 101 66 66 66 66 66 66 66 86 106", "Above with extra 55, one less \\202; BWIPP different encodation" }, + /* 68*/ { DATA_MODE, "@g(\202\202\202\202\202555\202\202\202\202\202\202\202\202", -1, 0, 310, 0, "(28) 104 32 71 8 101 101 101 66 66 66 66 66 101 21 101 21 101 21 66 66 66 66 66 66 66 66 5", "Above less one 5; BWIPP different encodation" }, + /* 69*/ { UNICODE_MODE, "±±±±1234AA", -1, 0, 189, 0, "(17) 104 100 100 17 17 17 17 99 12 34 100 100 33 100 33 89 106", "BWIPP PR #275 (extended ASCII treated as digits)" }, + /* 70*/ { 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" }, + /* 71*/ { 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" }, + /* 72*/ { UNICODE_MODE, "c\naDEF", -1, 0, 112, 1, "(10) 104 67 98 74 65 36 37 38 75 106", "Okapi bug-36-1.png" }, + /* 73*/ { UNICODE_MODE, "\na\nDEF", -1, 0, 112, 1, "(10) 103 74 98 65 74 36 37 38 90 106", "Okapi bug-36-2.png" }, + /* 74*/ { UNICODE_MODE, "ÿ\012àa\0121\012àAà", -1, 0, 222, 0, "(20) 104 100 95 98 74 100 64 65 101 74 17 74 100 100 64 33 100 64 30 106", "BWIPP different encodation, ShA instead of CodeA" }, + /* 75*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "ÿ\012àa\\^A\0121\012\\^BàAà", -1, 0, 222, 0, "(20) 104 100 95 98 74 100 64 65 101 74 17 74 100 100 64 33 100 64 30 106", "BWIPP different encodation, FNC4 before CodeB" }, + /* 76*/ { UNICODE_MODE, "ÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 376, 0, "(34) 104 100 95 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33 100 64 36", "BWIPP different encodation, CodeA instead of ShA, same width" }, + /* 77*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "ÿ1234\012à\\^Aa\0121\012\\^C7890\\^BàAàDà\012à", -1, 0, 376, 0, "(34) 104 100 95 99 12 34 101 74 101 98 64 98 65 74 17 74 99 78 90 100 100 64 33 100 64 36", "BWIPP no manual mode" }, + /* 78*/ { UNICODE_MODE, "yÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 387, 0, "(35) 104 89 100 95 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33 100 64", "BWIPP different encodation, CodeA instead of ShA, same width" }, + /* 79*/ { UNICODE_MODE, "ÿy1234\012àa\0121\0127890àAàDà\012à", -1, 0, 387, 0, "(35) 104 100 95 89 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33 100 64", "BWIPP different encodation, CodeA instead of ShA, same width" }, + /* 80*/ { UNICODE_MODE, "ÿÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 398, 0, "(36) 104 100 95 100 95 99 12 34 101 74 100 100 64 65 101 74 17 74 99 78 90 100 100 64 33", "BWIPP different encodation, CodeA instead of ShA, same width" }, + /* 81*/ { UNICODE_MODE, "ÿ12345678\012à12345678abcdef\0121\01223456\012\0127890àAàBCDEFà\012\012à", -1, 0, 662, 0, "(60) 104 100 95 99 12 34 56 78 101 74 100 100 64 99 12 34 56 78 100 65 66 67 68 69 70 101", "BWIPP different encodation, CodeA instead of ShA, same width" }, + /* 82*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 200, 0, "(18) 104 0 100 100 1 1 1 1 100 0 1 1 1 1 100 0 91 106", "StartB Latch (4) FNC4 (4) FNC4 , adapted from BWIPP PR #272; BWIPP pending PR #275" }, + /* 83*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 222, 0, "(20) 104 0 100 100 1 1 1 1 100 0 100 0 1 1 1 1 100 0 63 106", "2 middle spaces; BWIPP pending PR #275" }, + /* 84*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 244, 0, "(22) 104 0 100 100 1 1 1 1 100 0 100 0 100 0 1 1 1 1 100 0 29 106", "3 middle spaces; BWIPP pending PR #275" }, + /* 85*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 266, 0, "(24) 104 0 100 100 1 1 1 1 100 0 100 0 100 0 100 0 1 1 1 1 100 0 92 106", "4 middle spaces (no unlatch); BWIPP pending PR #275" }, + /* 86*/ { UNICODE_MODE, " ¡¡¡¡ ¡¡¡¡ ", -1, 0, 277, 0, "(25) 104 0 100 100 1 1 1 1 100 100 0 0 0 0 0 100 100 1 1 1 1 100 0 81 106", "5 middle spaces (unlatch); BWIPP pending PR #275" }, + /* 87*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, " 12\\^1 ", -1, 0, 90, 0, "(8) 104 0 17 18 102 0 85 106", "BWIPP PR #272" }, + /* 88*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, " 1234\\^1567", -1, 0, 123, 0, "(11) 104 0 99 12 34 102 56 100 23 41 106", "BWIPP PR #272" }, + /* 89*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "123\\^14567", -1, 0, 101, 0, "(9) 104 17 99 23 102 45 67 84 106", "BWIPP PR #272" }, + /* 90*/ { DATA_MODE | ESCAPE_MODE | EXTRA_ESCAPE_MODE, "\\d031\\d031_\\d127\\d159\\d031\\d159\\d159\\d159\\d15912345``\\d255\\d000\\d127\\d255\\d224\\d224\\d159`", -1, 0, 442, 0, "(40) 103 95 95 63 98 95 101 95 95 101 101 95 95 95 95 99 12 34 100 100 100 21 64 64 100 95", "Code set limit chars; BWIPP different encodation" }, + /* 91*/ { DATA_MODE, "\200\200\200\200\200A0000A\200", -1, 0, 211, 0, "(19) 103 101 101 64 64 64 64 64 101 33 99 0 0 101 101 33 64 4 106", "BWIPP different encodation" }, + /* 92*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^1345\\^167\\^18", -1, 0, 145, 1, "(13) 105 12 102 34 100 21 102 22 23 102 24 49 106", "" }, + /* 93*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^B\\^A12\\^C34\\^A\\^B5\\^C67\\^A\\^B\\^CA\\^B\\^A", -1, 0, 145, 0, "(13) 103 17 18 99 34 100 21 99 67 100 33 69 106", "BWIPP no manual mode" }, + /* 94*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^C1234ABC12\012", -1, 0, 145, 0, "(13) 105 12 34 100 33 34 35 99 12 101 74 36 106", "StartC 12 34 CodeB A B C CodeC 12 CodeA ; BWIPP no manual mode" }, + /* 95*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "A\\^", -1, 0, 68, 1, "(6) 104 33 60 62 31 106", "StartC 12 34 CodeB A B C CodeC 12 CodeA LF" }, + /* 96*/ { UNICODE_MODE, "A\0121234A12\012", -1, 0, 145, 1, "(13) 103 33 74 99 12 34 101 33 17 18 74 99 106", "StartA A CodeC 12 34 CodeA A 1 2 ; Okapi c128/improved-lookahead-mode-a.png" }, + /* 97*/ { UNICODE_MODE, "21*\015\012M0", -1, 0, 112, 0, "(10) 105 21 101 10 77 74 45 16 79 106", "StartC 21 CodeA * M 0; Okapi c128/improved-lookahead-rule-1c.png; BWIPP different encodation, same width" }, + /* 98*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^112345\\^11234\\^112345", -1, 0, 178, 0, "(16) 104 102 17 99 23 45 102 12 34 102 12 34 100 21 72 106", "Okapi code128/fnc1-mode-c-fnc1-in-middle.png; BWIPP different encodation (BWIPP 2 longer)" }, + /* 99*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^1SN123456789012", -1, 0, 145, 1, "(13) 104 102 51 46 99 12 34 56 78 90 12 65 106", "StartB FNC1 S N CodeC 12 34 56 78 90 12" }, + /*100*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^B\\^1SN123456789012", -1, 0, 200, 0, "(18) 104 102 51 46 17 18 19 20 21 22 23 24 25 16 17 18 56 106", "StartB FNC1 S N 1 2 3 4 5 6 7 8 9 0 1 2; BWIPP no manual mode" }, + /*101*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "A\\^1BC\\^1DEF\\^1", -1, 0, 134, 1, "(12) 104 33 102 34 35 102 36 37 38 102 9 106", "StartB A FNC1 B C FNC1 D E F FNC1" }, + /*102*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^C12\\^1", -1, 0, 57, 0, "(5) 105 12 102 12 106", "StartC 12 FNC1; BWIPP no manual mode" }, + /*103*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^13", -1, 0, 79, 1, "(7) 105 12 102 100 19 79 106", "StartC 12 FNC1 CodeB 3" }, + /*104*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^13\\^1", -1, 0, 90, 1, "(8) 105 12 102 100 19 102 74 106", "StartC 12 FNC1 CodeB 3 FNC1" }, + /*105*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "1\\^123", -1, 0, 79, 0, "(7) 104 17 99 102 23 99 106", "StartB 1 CodeC FNC1 23; BWIPP different encodation (same codeword count)" }, + /*106*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^134", -1, 0, 68, 1, "(6) 105 12 102 34 11 106", "StartC 12 FNC1 34" }, + /*107*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^134\\^1", -1, 0, 79, 1, "(7) 105 12 102 34 102 7 106", "StartC 12 FNC1 34 FNC1" }, + /*108*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "123\\^145\\^1", -1, 0, 101, 1, "(9) 104 17 99 23 102 45 102 88 106", "StartB 1 CodeC 23 FNC1 45 FNC1" }, + /*109*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "12\\^1345\\^1", -1, 0, 101, 1, "(9) 105 12 102 34 100 21 102 98 106", "StartC 12 FNC1 34 CodeB 5 FNC1" }, + /*110*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "1234\\^156\\^1", -1, 0, 90, 1, "(8) 105 12 34 102 56 102 92 106", "StartC 12 34 FNC1 56 FNC1" }, + /*111*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "1234\\^156789\\^101\\^11\\^1", -1, 0, 178, 1, "(16) 105 12 34 102 56 78 100 25 102 16 17 102 17 102 100 106", "StartC 12 34 FNC1 56 78 CodeB 9 FNC1 0 1 FNC1 1 FNC1" }, + /*112*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^Aaa\\^B\012\012", -1, 0, 134, 0, "(12) 103 98 65 98 65 100 98 74 98 74 27 106", "StartA ShB a ShB a CodeB ShA ShA ; BWIPP no manual mode" }, + /*113*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^A\342\342\\^B\202\202", -1, 0, 156, 0, "(14) 103 101 101 98 66 98 66 100 98 66 98 66 72 106", "StartA FNC4 FNC4 ShB 226(E2) ShB 226(E2) CodeB ShA 130(82) ShA 130(82); BWIPP no manual mode" }, + /*114*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^A\342\342\342\342\342\\^Baaaaa", -1, 0, 255, 0, "(23) 103 101 101 98 66 98 66 98 66 98 66 98 66 100 100 100 65 65 65 65 65 46 106", "BWIPP no manual mode" }, + /*115*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^A\342\012\342\342\342\\^B\202\342\012\012", -1, 0, 277, 0, "(25) 103 101 98 66 74 101 101 98 66 98 66 98 66 100 98 66 66 100 98 74 100 98 74 69 106", "BWIPP no manual mode" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -477,38 +493,38 @@ static void test_gs1_128_input(const testCtx *const p_ctx) { char *expected; char *comment; }; - struct item data[] = { - /* 0*/ { GS1_MODE, "[90]1[90]1", 0, 123, 0, "(11) 105 102 90 100 17 102 25 99 1 56 106", "StartC FNC1 90 CodeB 1 FNC1 9 CodeC 01; BWIPP different encodation (same codeword count)" }, - /* 1*/ { GS1_MODE | GS1PARENS_MODE, "(90)1(90)1", 0, 123, 0, "(11) 105 102 90 100 17 102 25 99 1 56 106", "StartC FNC1 90 CodeB 1 FNC1 9 CodeC 01; BWIPP different encodation (same codeword count)" }, + static const struct item data[] = { + /* 0*/ { GS1_MODE, "[90]1[90]1", 0, 123, 0, "(11) 105 102 90 100 17 102 25 99 1 56 106", "StartC FNC1 90 CodeB 1 FNC1 9 CodeC 01; BWIPP different encodation (same width)" }, + /* 1*/ { GS1_MODE | GS1PARENS_MODE, "(90)1(90)1", 0, 123, 0, "(11) 105 102 90 100 17 102 25 99 1 56 106", "StartC FNC1 90 CodeB 1 FNC1 9 CodeC 01; BWIPP different encodation (same width)" }, /* 2*/ { GS1_MODE, "[90]1[90]12", 0, 112, 0, "(10) 104 102 25 99 1 102 90 12 43 106", "StartB FNC1 9 CodeC 01 FNC1 90 12; BWIPP different encodation (BWIPP 1 longer)" }, /* 3*/ { GS1_MODE, "[90]1[90]123", 0, 134, 1, "(12) 105 102 90 100 17 102 25 99 1 23 57 106", "StartC FNC1 90 CodeB 1 FNC1 9 CodeC 01 23" }, /* 4*/ { GS1_MODE, "[90]12[90]1", 0, 112, 1, "(10) 105 102 90 12 102 90 100 17 43 106", "StartC FNC1 90 12 FNC1 90 CodeB 1" }, /* 5*/ { GS1_MODE, "[90]12[90]12", 0, 101, 1, "(9) 105 102 90 12 102 90 12 14 106", "StartC FNC1 90 12 FNC1 90 12" }, /* 6*/ { GS1_MODE, "[90]12[90]123", 0, 123, 1, "(11) 105 102 90 12 102 90 12 100 19 42 106", "StartC FNC1 90 12 FNC1 CodeB 9 CodeC 01 23" }, - /* 7*/ { GS1_MODE, "[90]123[90]1", 0, 134, 0, "(12) 105 102 90 12 100 19 102 25 99 1 34 106", "StartC FNC1 90 12 CodeB 3 FNC1 9 CodeC 01; BWIPP different encodation (same codeword count)" }, - /* 8*/ { GS1_MODE, "[90]123[90]1234", 0, 134, 0, "(12) 104 102 25 99 1 23 102 90 12 34 50 106", "StartB FNC1 9 CodeC 01 23 FNC1 90 12 34; BWIPP different encodation (BWIPP 1 longer)" }, - /* 9*/ { GS1_MODE, "[90]1[90]1[90]1", 0, 167, 0, "(15) 105 102 90 100 17 102 25 99 1 102 90 100 17 88 106", "StartC FNC1(GS1) 90 CodeB 1 FNC1(29) 9 CodeC 01 FNC1(29) 90 CodeB 1; BWIPP different encodation (same codeword count)" }, + /* 7*/ { GS1_MODE, "[90]123[90]1", 0, 134, 0, "(12) 105 102 90 12 100 19 102 25 99 1 34 106", "StartC FNC1 90 12 CodeB 3 FNC1 9 CodeC 01; BWIPP different encodation (same width)" }, + /* 8*/ { GS1_MODE, "[90]123[90]1234", 0, 134, 0, "(12) 104 102 25 99 1 23 102 90 12 34 50 106", "StartB FNC1 9 CodeC 01 23 FNC1 90 12 34" }, + /* 9*/ { GS1_MODE, "[90]1[90]1[90]1", 0, 167, 0, "(15) 105 102 90 100 17 102 25 99 1 102 90 100 17 88 106", "StartC FNC1(GS1) 90 CodeB 1 FNC1(29) 9 CodeC 01 FNC1(29) 90 CodeB 1; BWIPP different encodation (same width)" }, /* 10*/ { GS1_MODE, "[90]1[90]12[90]1", 0, 156, 0, "(14) 104 102 25 99 1 102 90 12 102 90 100 17 75 106", "StartB FNC1 9 CodeC 01 FNC1 90 12 FNC1 90 CodeB 1; BWIPP different encodation (BWIPP 2 longer)" }, /* 11*/ { GS1_MODE, "[90]1[90]123[90]1", 0, 178, 1, "(16) 105 102 90 100 17 102 25 99 1 23 102 90 100 17 89 106", "StartC FNC1 90 CodeB 1 FNC1 9 CodeC 01 23 FNC1 90 CodeB 1" }, - /* 12*/ { GS1_MODE, "[90]12[90]123[90]1", 0, 167, 0, "(15) 105 102 90 12 102 90 12 100 19 102 25 99 1 45 106", "StartC FNC1 90 12 FNC1 90 12 CodeB 3 FNC1 9 CodeC 01; BWIPP different encodation (same codeword count)" }, - /* 13*/ { GS1_MODE, "[90]12[90]123[90]12", 0, 167, 0, "(15) 105 102 90 12 102 90 12 100 19 99 102 90 12 100 106", "StartC FNC1 90 12 FNC1 90 12 CodeB 3 CodeC FNC1 90 12; BWIPP different encodation (same codeword count)" }, - /* 14*/ { GS1_MODE, "[90]123[90]1[90]1", 0, 178, 0, "(16) 105 102 90 12 100 19 102 25 99 1 102 90 100 17 66 106", "StartC FNC1 90 12 CodeB 3 FNC1 9 CodeC 01 FNC1 90 CodeB 1; BWIPP different encodation (same codeword count)" }, + /* 12*/ { GS1_MODE, "[90]12[90]123[90]1", 0, 167, 0, "(15) 105 102 90 12 102 90 12 100 19 102 25 99 1 45 106", "StartC FNC1 90 12 FNC1 90 12 CodeB 3 FNC1 9 CodeC 01; BWIPP different encodation (same width)" }, + /* 13*/ { GS1_MODE, "[90]12[90]123[90]12", 0, 167, 0, "(15) 105 102 90 12 102 90 12 100 19 99 102 90 12 100 106", "StartC FNC1 90 12 FNC1 90 12 CodeB 3 CodeC FNC1 90 12; BWIPP different encodation (same width)" }, + /* 14*/ { GS1_MODE, "[90]123[90]1[90]1", 0, 178, 0, "(16) 105 102 90 12 100 19 102 25 99 1 102 90 100 17 66 106", "StartC FNC1 90 12 CodeB 3 FNC1 9 CodeC 01 FNC1 90 CodeB 1; BWIPP different encodation (same width)" }, /* 15*/ { GS1_MODE, "[90]123[90]12[90]1", 0, 167, 0, "(15) 104 102 25 99 1 23 102 90 12 102 90 100 17 85 106", "StartB FNC1 9 CodeC 01 23 FNC1 90 12 FNC1 90 CodeB 1; BWIPP different encodation (BWIPP 2 longer)" }, /* 16*/ { GS1_MODE, "[90]123[90]123[90]12", 0, 178, 1, "(16) 105 102 90 12 100 19 102 25 99 1 23 102 90 12 47 106", "StartC FNC1 90 12 CodeB 3 FNC1 9 CodeC 01 23 FNC1 90 12" }, /* 17*/ { GS1_MODE, "[90]123[90]1234[90]1", 0, 178, 0, "(16) 104 102 25 99 1 23 102 90 12 34 102 90 100 17 82 106", "StartB FNC1 9 CodeC 01 23 FNC1 90 12 34 FNC1 90 CodeB 1; BWIPP different encodation (BWIPP 3 longer)" }, /* 18*/ { GS1_MODE, "[90]123[90]1234[90]123", 0, 189, 0, "(17) 104 102 25 99 1 23 102 90 12 34 102 90 12 100 19 62 106", "StartB FNC1 9 CodeC 01 23 FNC1 90 12 34 FNC1 90 12 CodeB 3; BWIPP different encodation (BWIPP 3 longer)" }, /* 19*/ { GS1_MODE, "[90]12345[90]1234[90]1", 0, 189, 0, "(17) 104 102 25 99 1 23 45 102 90 12 34 102 90 100 17 75 106", "StartB FNC1 9 CodeC 01 23 45 FNC1 90 12 34 FNC1 90 CodeB 1; BWIPP different encodation (BWIPP 3 longer)" }, - /* 20*/ { GS1_MODE, "[90]1A[90]1", 0, 134, 0, "(12) 105 102 90 100 17 33 102 25 99 1 36 106", "StartC FNC1 90 CodeB 1 A FNC1 9 CodeC 01; BWIPP different encodation (same codeword count)" }, + /* 20*/ { GS1_MODE, "[90]1A[90]1", 0, 134, 0, "(12) 105 102 90 100 17 33 102 25 99 1 36 106", "StartC FNC1 90 CodeB 1 A FNC1 9 CodeC 01; BWIPP different encodation (same width)" }, /* 21*/ { GS1_MODE, "[90]12A[90]123", 0, 145, 1, "(13) 105 102 90 12 100 33 102 25 99 1 23 25 106", "StartC FNC1 90 12 CodeB A FNC1 9 CodeC 01 23" }, - /* 22*/ { GS1_MODE, "[90]123[90]A234[90]123", 0, 222, 0, "(20) 105 102 90 12 100 19 102 25 16 33 18 99 34 102 90 12 100 19 50 106", "StartC FNC1 90 12 CodeB 3 FNC1 9 0 A 2 CodeC 34 FNC1 90 12 CodeB 3; BWIPP different encodation (same codeword count)" }, - /* 23*/ { GS1_MODE, "[90]12345A12345A", 0, 178, 0, "(16) 105 102 90 12 34 100 21 33 99 12 34 100 21 33 8 106", "StartC FNC1 90 12 34 CodeB 5 A CodeC 12 34 CodeB 5 A; BWIPP different encodation (same codeword count)" }, + /* 22*/ { GS1_MODE, "[90]123[90]A234[90]123", 0, 222, 0, "(20) 105 102 90 12 100 19 102 25 16 33 18 99 34 102 90 12 100 19 50 106", "StartC FNC1 90 12 CodeB 3 FNC1 9 0 A 2 CodeC 34 FNC1 90 12 CodeB 3; BWIPP different encodation (same width)" }, + /* 23*/ { GS1_MODE, "[90]12345A12345A", 0, 178, 0, "(16) 105 102 90 12 34 100 21 33 99 12 34 100 21 33 8 106", "StartC FNC1 90 12 34 CodeB 5 A CodeC 12 34 CodeB 5 A; BWIPP different encodation (same width)" }, /* 24*/ { GS1_MODE, "[01]12345678901231[90]12345678901234567890123456789", 0, 321, 1, "(29) 105 102 1 12 34 56 78 90 12 31 90 12 34 56 78 90 12 34 56 78 90 12 34 56 78 100 25 59", "Max length" }, - /* 25*/ { GS1_MODE, "[01]12345678901231[90]123456789012345678901234567890[91]1", ZINT_WARN_NONCOMPLIANT, 354, 1, "Warning 843: GS1-128 input too long (48 character maximum)", "Over length" }, + /* 25*/ { GS1_MODE, "[01]12345678901231[90]123456789012345678901234567890[91]1", ZINT_WARN_NONCOMPLIANT, 354, 1, "Warning 843: Input too long, requires 52 characters (maximum 48)", "Over length" }, /* 26*/ { GS1_MODE, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]12345678901234567890123456789012345678901234567890123456789012345678901234567890[93]1234", ZINT_WARN_HRT_TRUNCATED, 1135, 1, "Warning 844: Human Readable Text truncated", "Max input" }, /* 27*/ { GS1_MODE, "[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[3100]567890[20]34[20]78", ZINT_WARN_HRT_TRUNCATED, 1135, 1, "Warning 844: Human Readable Text truncated", "HRT truncation warning trumps non-compliant (3100) warning" }, - /* 28*/ { GS1_MODE, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]12345678901234567890123456789012345678901234567890123456789012345678901234567890[93]12345", ZINT_ERROR_TOO_LONG, 0, 1, "Error 344: Input too long (99 symbol character maximum)", "" }, + /* 28*/ { GS1_MODE, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]12345678901234567890123456789012345678901234567890123456789012345678901234567890[93]12345", ZINT_ERROR_TOO_LONG, 0, 1, "Error 344: Input too long, requires 101 symbol characters (maximum 99)", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -598,17 +614,17 @@ static void test_hibc_input(const testCtx *const p_ctx) { char *expected; char *comment; }; - struct item data[] = { - /* 0*/ { ",", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 203: Invalid character in data (alphanumerics, space and \"-.$/+%\" only)", "" }, + static const struct item data[] = { + /* 0*/ { ",", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 203: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)", "" }, /* 1*/ { "A99912345/$$52001510X3", 0, 255, 0, "(23) 104 11 33 99 99 91 23 45 100 15 4 4 99 52 0 15 10 100 56 99 33 102 106", "Check digit 3; BWIPP different encodation, same width" }, /* 2*/ { "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%", 0, 497, 1, "(45) 104 11 99 1 23 45 67 89 100 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51", "Check digit +" }, /* 3*/ { "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%", 0, 695, 1, "(63) 104 11 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5", "Check digit Q" }, /* 4*/ { "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%", 0, 1124, 1, "(102) 104 11 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5", "" }, - /* 5*/ { "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%", ZINT_ERROR_TOO_LONG, -1, 0, "Error 341: Input too long (99 symbol character maximum)", "" }, + /* 5*/ { "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%", ZINT_ERROR_TOO_LONG, -1, 0, "Error 341: Input too long, requires 100 symbol characters (maximum 99)", "" }, /* 6*/ { "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 0, 684, 1, "(62) 104 11 99 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", "Check digit %" }, /* 7*/ { "09AZ-.19AZ-.29AZ-.39AZ-.49AZ-.59AZ-.69AZ-.79AZ-.89AZ-.99AZ", 0, 695, 1, "(63) 104 11 16 25 33 58 13 14 17 25 33 58 13 14 18 25 33 58 13 14 19 25 33 58 13 14 20 25", "Check digit -" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -678,6 +694,62 @@ static void test_hibc_input(const testCtx *const p_ctx) { testFinish(); } +static void test_nve18_input(const testCtx *const p_ctx) { + int debug = p_ctx->debug; + + struct item { + int input_mode; + char *data; + int ret; + int expected_width; + char *expected; + char *comment; + }; + static const struct item data[] = { + /* 0*/ { -1, "123456789012345678", ZINT_ERROR_TOO_LONG, -1, "Error 345: Input length 18 too long (maximum 17)", "" }, + /* 1*/ { -1, "1234A568901234567", ZINT_ERROR_INVALID_DATA, -1, "Error 346: Invalid character at position 5 in input (digits only)", "" }, + /* 2*/ { ESCAPE_MODE, "\\d049\\d050\\d051\\d052A568901234567", ZINT_ERROR_INVALID_DATA, -1, "Error 346: Invalid character at position 5 in input (digits only)", "Position does not account for escape sequences" }, + }; + const int data_size = ARRAY_SIZE(data); + int i, length, ret; + struct zint_symbol *symbol = NULL; + + char escaped[1024]; + + testStartSymbol("test_nve18_input", &symbol); + + for (i = 0; i < data_size; i++) { + + if (testContinue(p_ctx, i)) continue; + + symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + symbol->debug = ZINT_DEBUG_TEST; /* Needed to get codeword dump in errtxt */ + + length = testUtilSetSymbol(symbol, BARCODE_NVE18, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); + + 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + + if (p_ctx->generate) { + printf(" /*%3d*/ { \"%s\", %s, %d, \"%s\", \"%s\" },\n", + i, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), + testUtilErrorName(data[i].ret), symbol->width, symbol->errtxt, data[i].comment); + } 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) { + 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); + } + } + + ZBarcode_Delete(symbol); + } + + testFinish(); +} + static void test_ean14_input(const testCtx *const p_ctx) { int debug = p_ctx->debug; @@ -688,11 +760,11 @@ static void test_ean14_input(const testCtx *const p_ctx) { char *expected; char *comment; }; - struct item data[] = { - /* 0*/ { "12345678901234", ZINT_ERROR_TOO_LONG, -1, "Error 347: Input too long (13 character maximum)", "" }, - /* 1*/ { "A", ZINT_ERROR_INVALID_DATA, -1, "Error 348: Invalid character in data (digits only)", "" }, + static const struct item data[] = { + /* 0*/ { "12345678901234", ZINT_ERROR_TOO_LONG, -1, "Error 347: Input length 14 too long (maximum 13)", "" }, + /* 1*/ { "123456789012A", ZINT_ERROR_INVALID_DATA, -1, "Error 348: Invalid character at position 13 in input (digits only)", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -744,16 +816,16 @@ static void test_dpd_input(const testCtx *const p_ctx) { char *expected; char *comment; }; - struct item data[] = { - /* 0*/ { -1, -1, "12345678901234567890123456", ZINT_ERROR_TOO_LONG, -1, 0, "Error 349: DPD input wrong length (27 or 28 characters required)", "" }, - /* 1*/ { 1, -1, "12345678901234567890123456", ZINT_ERROR_TOO_LONG, -1, 0, "Error 830: DPD relabel input wrong length (27 characters required)", "" }, + static const struct item data[] = { + /* 0*/ { -1, -1, "12345678901234567890123456", ZINT_ERROR_TOO_LONG, -1, 0, "Error 349: DPD input length 26 wrong (27 or 28 only)", "" }, + /* 1*/ { 1, -1, "12345678901234567890123456", ZINT_ERROR_TOO_LONG, -1, 0, "Error 830: DPD relabel input length 26 wrong (27 only)", "" }, /* 2*/ { -1, -1, "123456789012345678901234567", 0, 211, 50, "(19) 104 5 17 99 23 45 67 89 1 23 45 67 89 1 23 45 67 51 106", "27 chars ok now, ident tag prefixed" }, /* 3*/ { -1, -1, "%123456789012345678901234567", 0, 211, 50, "(19) 104 5 17 99 23 45 67 89 1 23 45 67 89 1 23 45 67 51 106", "" }, /* 4*/ { 1, -1, "123456789012345678901234567", 0, 200, 25, "(18) 105 12 34 56 78 90 12 34 56 78 90 12 34 56 100 23 102 106", "27 chars also ok (and necessary) for relabel" }, - /* 5*/ { -1, -1, "12345678901234567890123456789", ZINT_ERROR_TOO_LONG, -1, 0, "Error 349: DPD input wrong length (27 or 28 characters required)", "" }, - /* 6*/ { 1, -1, "1234567890123456789012345678", ZINT_ERROR_TOO_LONG, -1, 0, "Error 830: DPD relabel input wrong length (27 characters required)", "" }, - /* 7*/ { -1, -1, "123456789012345678901234567,", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 299: Invalid character in data (alphanumerics only after first character)", "Alphanumerics only in body" }, - /* 8*/ { -1, -1, "12345678901234567890123456,", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 300: Invalid character in data (alphanumerics only)", "Alphanumerics only in body" }, + /* 5*/ { -1, -1, "12345678901234567890123456789", ZINT_ERROR_TOO_LONG, -1, 0, "Error 349: DPD input length 29 wrong (27 or 28 only)", "" }, + /* 6*/ { 1, -1, "1234567890123456789012345678", ZINT_ERROR_TOO_LONG, -1, 0, "Error 830: DPD relabel input length 28 wrong (27 only)", "" }, + /* 7*/ { -1, -1, "123456789012345678901234567,", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 299: Invalid character at position 27 in input (alphanumerics only after first)", "Alphanumerics only in body" }, + /* 8*/ { -1, -1, "12345678901234567890123456,", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 300: Invalid character at position 27 in input (alphanumerics only)", "Alphanumerics only" }, /* 9*/ { -1, -1, ",234567890123456789012345678", 0, 211, 50, "(19) 104 12 18 99 34 56 78 90 12 34 56 78 90 12 34 56 78 64 106", "Non-alphanumeric DPD ident tag (Barcode ID) allowed" }, /* 10*/ { -1, -1, "\037234567890123456789012345678", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 343: Invalid DPD identification tag (first character), ASCII values 32 to 127 only", "Control char as DPD ident tag" }, /* 11*/ { -1, -1, "é234567890123456789012345678", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 343: Invalid DPD identification tag (first character), ASCII values 32 to 127 only", "Extended ASCII as DPD ident tag" }, @@ -777,7 +849,7 @@ static void test_dpd_input(const testCtx *const p_ctx) { /* 29*/ { 1, -1, "12345678901A345678901234567", ZINT_WARN_NONCOMPLIANT, 222, 25, "Warning 833: Last 10 characters of Tracking Number (characters 16-7 from end) should be numeric", "" }, /* 30*/ { 1, COMPLIANT_HEIGHT, "12345678901A345678901234567", ZINT_WARN_NONCOMPLIANT, 222, 33.333332, "Warning 833: Last 10 characters of Tracking Number (characters 16-7 from end) should be numeric", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -828,9 +900,9 @@ static void test_upu_s10_input(const testCtx *const p_ctx) { char *expected; char *comment; }; - struct item data[] = { - /* 0*/ { "AB123456789ABC", ZINT_ERROR_TOO_LONG, 0, "Error 834: Input must be 12 or 13 characters long", "" }, - /* 1*/ { "AB1234567AB", ZINT_ERROR_TOO_LONG, 0, "Error 834: Input must be 12 or 13 characters long", "" }, + static const struct item data[] = { + /* 0*/ { "AB123456789ABC", ZINT_ERROR_TOO_LONG, 0, "Error 834: Input length 14 wrong (12 or 13 only)", "" }, + /* 1*/ { "AB1234567AB", ZINT_ERROR_TOO_LONG, 0, "Error 834: Input length 11 wrong (12 or 13 only)", "" }, /* 2*/ { "1B123456789AB", ZINT_ERROR_INVALID_DATA, 0, "Error 835: Invalid character in Service Indictor (first 2 characters) (alphabetic only)", "" }, /* 3*/ { "1B12345678AB", ZINT_ERROR_INVALID_DATA, 0, "Error 835: Invalid character in Service Indictor (first 2 characters) (alphabetic only)", "" }, /* 4*/ { "A2123456789AB", ZINT_ERROR_INVALID_DATA, 0, "Error 835: Invalid character in Service Indictor (first 2 characters) (alphabetic only)", "" }, @@ -850,7 +922,7 @@ static void test_upu_s10_input(const testCtx *const p_ctx) { /* 18*/ { "AB123100000IE", 0, 156, "", "Check digit 10 -> 0" }, /* 19*/ { "AB000000005IE", 0, 156, "", "Check digit 11 -> 5" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -908,7 +980,7 @@ static void test_encode(const testCtx *const p_ctx) { /* BARCODE_GS1_128 examples verified manually against GS1 General Specifications 21.0.1 (GGS) */ /* BARCODE_DPD examples Specification DPD and primetime Parcel Despatch (DPDAPPD) Version 4.0.2, also DPD Parcel Label Specification (DPDPLS) Version 2.4.1 (19.01.2021) */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, "AIM", 0, 1, 68, 1, "ISO/IEC 15417:2007 Figure 1", "11010010000101000110001100010001010111011000101110110001100011101011" }, @@ -933,10 +1005,10 @@ static void test_encode(const testCtx *const p_ctx) { /* 7*/ { BARCODE_GS1_128, GS1_MODE, -1, "[415]5412345678908[3911]710125", 0, 1, 189, 1, "GGS Figure 2.6.6-1 top", "110100111001111010111011000100010111010001101100010001011101101110101110110001000010110011011011110100011001001101000100011000100100100110100001100110110011100101100100001001101100011101011" }, - /* 8*/ { BARCODE_GS1_128, GS1_MODE, -1, "[12]010425[8020]ABC123", 0, 1, 189, 0, "GGS Figure 2.6.6-1 bottom **NOT SAME**, different encodation, same codeword count; BWIPP as standard", + /* 8*/ { BARCODE_GS1_128, GS1_MODE, -1, "[12]010425[8020]ABC123", 0, 1, 189, 0, "GGS Figure 2.6.6-1 bottom **NOT SAME**, different encodation, same width; BWIPP as standard", "110100111001111010111010110011100110011011001001000110011100101100101001111001100100111010111101110101000110001000101100010001000110100111001101011101111011101101110111101000101100011101011" }, - /* 9*/ { BARCODE_GS1_128, GS1_MODE, -1, "[253]950110153005812345678901", 0, 1, 211, 0, "GGS Figure 2.6.9-1 **NOT SAME**, different encodation, same codeword count; BWIPP as standard", + /* 9*/ { BARCODE_GS1_128, GS1_MODE, -1, "[253]950110153005812345678901", 0, 1, 211, 0, "GGS Figure 2.6.9-1 **NOT SAME**, different encodation, same width; BWIPP as standard", "1101001110011110101110111001011001101000100011000101110110001001001100110110011011101110110110011001110110001010110011100100010110001110001011011000010100110111101101011110111010011100110101110110001100011101011" }, /* 10*/ { BARCODE_GS1_128, GS1_MODE, -1, "[253]950110153006567890543210987", 0, 1, 211, 1, "GGS Figure 2.6.9-2", @@ -960,7 +1032,7 @@ static void test_encode(const testCtx *const p_ctx) { /* 16*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]006141411234567890", 0, 1, 156, 1, "GGS Figure 6.6.5-1. (and Figures 6.6.5-3 bottom, 6.6.5-4 bottom)", "110100111001111010111011011001100110110011001100100001011000100010110001000101011001110010001011000111000101101100001010011011110110110110110001100011101011" }, - /* 17*/ { BARCODE_GS1_128, GS1_MODE, -1, "[403]402621[401]950110153B01001", 0, 1, 255, 0, "GGS Figure 6.6.5-2 top, same; BWIPP different encodation, same codeword count", + /* 17*/ { BARCODE_GS1_128, GS1_MODE, -1, "[403]402621[401]950110153B01001", 0, 1, 255, 0, "GGS Figure 6.6.5-2 top, same; BWIPP different encodation, same width", "110100100001111010111011001001110101110111101001001100011000101000111001001101101110010011110101110110001010001100101110011000101110110001001001100110110011011101110101111011101000101100010011101100101110111101100100010011001101100110001101101100011101011" }, /* 18*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]395011015300000011", 0, 1, 156, 1, "GGS Figure 6.6.5-2 bottom", @@ -1032,7 +1104,7 @@ static void test_encode(const testCtx *const p_ctx) { /* 40*/ { BARCODE_NVE18, GS1_MODE, -1, "40700000071967072", 0, 1, 156, 1, "", "110100111001111010111011011001100110001010001011000010011011001100110110011001001100010011001011100100001011001001100010011001001110110111011101100011101011" }, - /* 41*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "83278F8G9H0J2G", 0, 1, 211, 0, "ANSI/HIBC 2.6 - 2016 Section 4.1, same; BWIPP different encodation, same codeword count", + /* 41*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "83278F8G9H0J2G", 0, 1, 211, 0, "ANSI/HIBC 2.6 - 2016 Section 4.1, same; BWIPP different encodation, same width", "1101001000011000100100101110111101011110010011101100100101111011101110100110010001100010111010011001101000100011100101100110001010001001110110010110111000110011100101101000100010001001100110100010001100011101011" }, /* 42*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "A123BJC5D6E71", 0, 1, 200, 1, "ANSI/HIBC 2.6 - 2016 Figure 1, same", @@ -1065,11 +1137,11 @@ static void test_encode(const testCtx *const p_ctx) { /* 51*/ { BARCODE_DPD, UNICODE_MODE, 1, "006376209980000020044118276", 0, 1, 200, 1, "DPDPLS Section 8.7.2 relabel, **NOT SAME**, figure begins StartB then immediate CodeC, zint begins StartC (shorter)", "11010011100110110011001010011000011001010000110010011101011101111010100111100110110011001101100110011001001110100100011001100010001011001110010111011001001011110111011001110100110111011101100011101011" }, - /* 52*/ { BARCODE_UPU_S10, UNICODE_MODE, -1, "EE876543216CA", 0, 1, 156, 0, "BWIPP different encodation, same codeword count", + /* 52*/ { BARCODE_UPU_S10, UNICODE_MODE, -1, "EE876543216CA", 0, 1, 156, 0, "BWIPP different encodation, same width", "110100100001000110100010001101000101110111101111001010010010110000101100011101101110010010111101110110011101001000100011010100011000100010011001100011101011" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -1162,12 +1234,12 @@ static void test_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, "123456ABCD123456ABCD123456ABCD123456ABCD123456ABCD123456ABCD", 0, 1, 618, "CODE128 60" }, /* 1*/ { BARCODE_CODE128, "123456ABCD", 0, 1, 123, "CODE128 10" }, /* 2*/ { BARCODE_GS1_128, "[01]09501101530003", 0, 1, 134, "GS1_128 (01)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; @@ -1258,6 +1330,7 @@ int main(int argc, char *argv[]) { { "test_input", test_input }, { "test_gs1_128_input", test_gs1_128_input }, { "test_hibc_input", test_hibc_input }, + { "test_nve18_input", test_nve18_input }, { "test_ean14_input", test_ean14_input }, { "test_dpd_input", test_dpd_input }, { "test_upu_s10_input", test_upu_s10_input }, diff --git a/backend/tests/test_code16k.c b/backend/tests/test_code16k.c index 34221427..c7e087a9 100644 --- a/backend/tests/test_code16k.c +++ b/backend/tests/test_code16k.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2023 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -40,21 +40,23 @@ static void test_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { "A", 77, 0, 16, 70 }, /* BS EN 12323:2005 4.1 (l) */ - /* 1*/ { "A", 78, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { "0", 154, 0, 16, 70 }, /* BS EN 12323:2005 4.1 (l) */ - /* 3*/ { "0", 155, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 4*/ { "0", 153, ZINT_ERROR_TOO_LONG, -1, -1 }, /* Fails due to odd length */ - /* 5*/ { "0", 161, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 6*/ { "\001", 77, 0, 16, 70 }, - /* 7*/ { "\001", 78, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 8*/ { "\377", 38, 0, 16, 70 }, /* FNC4 + char for each so half 77 as not using double latch */ - /* 9*/ { "\377", 39, ZINT_ERROR_TOO_LONG, -1, -1 }, + static const struct item data[] = { + /* 0*/ { "A", 77, 0, 16, 70, "" }, /* BS EN 12323:2005 4.1 (l) */ + /* 1*/ { "A", 78, ZINT_ERROR_TOO_LONG, -1, -1, "Error 421: Input too long, requires 79 symbol characters (maximum 78)" }, + /* 2*/ { "A", 257, ZINT_ERROR_TOO_LONG, -1, -1, "Error 420: Input length 257 too long (maximum 256)" }, + /* 3*/ { "0", 154, 0, 16, 70, "" }, /* BS EN 12323:2005 4.1 (l) */ + /* 4*/ { "0", 155, ZINT_ERROR_TOO_LONG, -1, -1, "Error 421: Input too long, requires 80 symbol characters (maximum 78)" }, + /* 5*/ { "0", 153, ZINT_ERROR_TOO_LONG, -1, -1, "Error 421: Input too long, requires 79 symbol characters (maximum 78)" }, /* Fails due to odd length */ + /* 6*/ { "0", 161, ZINT_ERROR_TOO_LONG, -1, -1, "Error 421: Input too long, requires 79 symbol characters (maximum 78)" }, + /* 7*/ { "\001", 77, 0, 16, 70, "" }, + /* 8*/ { "\001", 78, ZINT_ERROR_TOO_LONG, -1, -1, "Error 421: Input too long, requires 79 symbol characters (maximum 78)" }, + /* 9*/ { "\377", 38, 0, 16, 70, "" }, /* FNC4 + char for each so half 77 as not using double latch */ + /* 10*/ { "\377", 39, ZINT_ERROR_TOO_LONG, -1, -1, "Error 421: Input too long, requires 79 symbol characters (maximum 78)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -76,6 +78,8 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -101,13 +105,13 @@ static void test_reader_init(const testCtx *const p_ctx) { char *expected; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, READER_INIT, "A", 0, 2, 70, "(10) 1 96 33 103 103 103 103 103 68 35", "ModeB FNC3 A Pad (5)" }, /* 1*/ { UNICODE_MODE, READER_INIT, "12", 0, 2, 70, "(10) 5 96 12 103 103 103 103 103 99 41", "ModeC1SB FNC3 12 Pad (5)" }, /* 2*/ { UNICODE_MODE, READER_INIT, "A1234", 0, 2, 70, "(10) 6 96 33 12 34 103 103 103 65 53", "ModeC2SB FNC3 A 12 34 Pad (3)" }, /* 3*/ { GS1_MODE, READER_INIT, "[90]1", ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 422: Cannot use both GS1 mode and Reader Initialisation", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -135,10 +139,10 @@ static void test_reader_init(const testCtx *const p_ctx) { testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->rows, symbol->width, symbol->errtxt, data[i].comment); } 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) { 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_zero(strcmp((char *) symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); } } @@ -172,7 +176,7 @@ static void test_input(const testCtx *const p_ctx) { ß U+00DF (\337, 223), UTF-8 C39F, CodeA and CodeB extended ASCII é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII */ - struct item data[] = { + static const struct item data[] = { /* 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, 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, 1, "(10) 2 12 103 103 103 103 103 103 98 27", "ModeC 12 Pad (6)" }, @@ -202,8 +206,8 @@ static void test_input(const testCtx *const p_ctx) { /* 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, 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, 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, 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)", "" }, + /* 29*/ { UNICODE_MODE, 1, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, 1, "Error 424: Minimum number of rows '1' 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 '17' 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" }, @@ -218,7 +222,7 @@ static void test_input(const testCtx *const p_ctx) { /* 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); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -251,7 +255,7 @@ static void test_input(const testCtx *const p_ctx) { testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, symbol->errtxt, data[i].comment); } 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(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); 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->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); @@ -304,7 +308,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, -1, "ab0123456789", 0, 2, 70, "BS EN 12323:2005 Figure 3", "1110010101100110111011010011110110111100100110010011000100100010001101" "1100110101000100111011110100110010010000100110100011010010001110011001" @@ -347,7 +351,7 @@ static void test_encode(const testCtx *const p_ctx) { "1110100100101111011001011110110010111101100101110001001110010010111101" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; diff --git a/backend/tests/test_code49.c b/backend/tests/test_code49.c index cae2e41a..e00c09c0 100644 --- a/backend/tests/test_code49.c +++ b/backend/tests/test_code49.c @@ -40,21 +40,22 @@ static void test_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { "A", 49, 0, 8, 70 }, /* ANSI/AIM BC6-2000 Table 1 */ - /* 1*/ { "A", 50, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { "0", 81, 0, 8, 70 }, /* ANSI/AIM BC6-2000 Table 1 */ - /* 3*/ { "0", 82, ZINT_ERROR_TOO_LONG, -1, -1 }, + static const struct item data[] = { + /* 0*/ { "A", 49, 0, 8, 70, "" }, /* ANSI/AIM BC6-2000 Table 1 */ + /* 1*/ { "A", 50, ZINT_ERROR_TOO_LONG, -1, -1, "Error 432: Input too long, requires 50 codewords (maximum 49)" }, + /* 2*/ { "0", 81, 0, 8, 70, "" }, /* ANSI/AIM BC6-2000 Table 1 */ + /* 3*/ { "0", 82, ZINT_ERROR_TOO_LONG, -1, -1, "Error 430: Input length 82 too long (maximum 81)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char data_buf[4096]; - testStart("test_large"); + testStartSymbol("test_large", &symbol); for (i = 0; i < data_size; i++) { @@ -70,6 +71,8 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -100,8 +103,8 @@ static void test_input(const testCtx *const p_ctx) { NUL U+0000, S1 SP (39) US U+001F (\037, 31), S1 5 */ - struct item data[] = { - /* 0*/ { UNICODE_MODE, -1, "é", -1, ZINT_ERROR_INVALID_DATA, 0, 0, "Error 431: Invalid character in input data, extended ASCII not allowed", "ASCII only" }, + static const struct item data[] = { + /* 0*/ { UNICODE_MODE, -1, "é", -1, ZINT_ERROR_INVALID_DATA, 0, 0, "Error 431: Invalid character at position 1 in input, 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" }, /* 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" }, @@ -127,11 +130,11 @@ static void test_input(const testCtx *const p_ctx) { /* 23*/ { UNICODE_MODE, 7, "1234567890123456789012345678901234567890", -1, 0, 7, 70, "(56) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, /* 24*/ { UNICODE_MODE, 8, "1234567890123456789012345678901234567890", -1, 0, 8, 70, "(64) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" }, /* 25*/ { UNICODE_MODE, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW", -1, 0, 8, 70, "(64) 10 11 12 13 14 15 16 42 17 18 19 20 21 22 23 42 24 25 26 27 28 29 30 42 31 32 33 34 35", "" }, - /* 26*/ { UNICODE_MODE, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWX", -1, ZINT_ERROR_TOO_LONG, 0, 0, "Error 432: Input too long (49 symbol character maximum)", "" }, + /* 26*/ { UNICODE_MODE, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWX", -1, ZINT_ERROR_TOO_LONG, 0, 0, "Error 432: Input too long, requires 50 codewords (maximum 49)", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[1024]; char cmp_buf[8192]; @@ -139,7 +142,7 @@ static void test_input(const testCtx *const p_ctx) { int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ - testStart("test_input"); + testStartSymbol("test_input", &symbol); for (i = 0; i < data_size; i++) { @@ -199,7 +202,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, -1, "MULTIPLE ROWS IN CODE 49", 0, 5, 70, "ANSI/AIM BC6-2000 Figure 1", "1011111011001011101011100110000110111101011011111010111101000100001111" "1010100001000010001001111000101110100110001111010010001011100011001111" @@ -227,9 +230,9 @@ static void test_encode(const testCtx *const p_ctx) { "1011110110100100001010000100010000111010010011111011001000111011001111" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[1024]; char bwipp_buf[8192]; @@ -237,7 +240,7 @@ static void test_encode(const testCtx *const p_ctx) { int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ - testStart("test_encode"); + testStartSymbol("test_encode", &symbol); for (i = 0; i < data_size; i++) { diff --git a/backend/tests/test_common.c b/backend/tests/test_common.c index 52bad579..558755aa 100644 --- a/backend/tests/test_common.c +++ b/backend/tests/test_common.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2023 Robin Stuart + Copyright (C) 2019-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -59,7 +59,7 @@ static void test_to_int(const testCtx *const p_ctx) { int ret; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "", -1, 0 }, /* 1*/ { "1234", -1, 1234 }, /* 2*/ { "-1234", -1, -1 }, @@ -67,7 +67,7 @@ static void test_to_int(const testCtx *const p_ctx) { /* 4*/ { " ", -1, -1 }, /* 5*/ { "999999999", -1, 999999999 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; testStart("test_to_int"); @@ -93,13 +93,13 @@ static void test_to_upper(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "", -1, "" }, /* 1*/ { "abcefghijklmnopqrstuvwxyz", -1, "ABCEFGHIJKLMNOPQRSTUVWXYZ" }, /* 2*/ { ".a[b`cA~B\177C;\200", -1, ".A[B`CA~B\177C;\200" }, /* 3*/ { "é", -1, "é" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length; unsigned char buf[512]; @@ -117,7 +117,7 @@ static void test_to_upper(const testCtx *const p_ctx) { buf[length] = '\0'; to_upper(buf, length); - assert_zero(strcmp((const char *) buf, data[i].expected), "i:%d strcmp(%s,%s) != 0\n", i, buf, data[i].expected); + assert_zero(strcmp((const char *) buf, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, buf, data[i].expected); } testFinish(); @@ -132,12 +132,12 @@ static void test_chr_cnt(const testCtx *const p_ctx) { int ret; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "", -1, 'a', 0 }, /* 1*/ { "BDAaED", -1, 'a', 1 }, /* 1*/ { "aBDAaaaEaDa", -1, 'a', 6 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; testStart("test_chr_cnt"); @@ -155,7 +155,7 @@ static void test_chr_cnt(const testCtx *const p_ctx) { testFinish(); } -static void test_is_sane(const testCtx *const p_ctx) { +static void test_not_sane(const testCtx *const p_ctx) { struct item { unsigned int flg; @@ -166,97 +166,97 @@ static void test_is_sane(const testCtx *const p_ctx) { char *orig_test; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { IS_SPC_F, " ", -1, 1, " " }, - /* 1*/ { IS_SPC_F, "\000", 1, 0, " " }, - /* 2*/ { IS_HSH_F, "#", -1, 1, "#" }, - /* 3*/ { IS_HSH_F, " ", -1, 0, "#" }, - /* 4*/ { IS_AST_F, "*", -1, 1, "*" }, - /* 5*/ { IS_AST_F, " ", -1, 0, "*" }, - /* 6*/ { IS_PLS_F, "+", -1, 1, "+" }, - /* 7*/ { IS_PLS_F, " ", -1, 0, "+" }, - /* 8*/ { IS_MNS_F, "-", -1, 1, "-" }, - /* 9*/ { IS_MNS_F, " ", -1, 0, "-" }, - /* 10*/ { IS_NUM_F, "0123456789", -1, 1, "0123456789" }, /* NEON */ - /* 11*/ { IS_NUM_F, "0123456789 ", -1, 0, "0123456789" }, - /* 12*/ { IS_NUM_F, "012345678A9", -1, 0, "0123456789" }, - /* 13*/ { IS_UPO_F, "GHIJKLMNOPQRSTUVWYZ", -1, 1, "GHIJKLMNOPQRSTUVWYZ" }, - /* 14*/ { IS_UPO_F, "FGHIJKLMNOPQRSTUVWYZ", -1, 0, "GHIJKLMNOPQRSTUVWYZ" }, - /* 15*/ { IS_LWO_F, "ghijklmnopqrstuvwyz", -1, 1, "ghijklmnopqrstuvwyz" }, - /* 16*/ { IS_LWO_F, "fghijklmnopqrstuvwyz", -1, 0, "ghijklmnopqrstuvwyz" }, - /* 17*/ { IS_UHX_F, "ABCDEF", -1, 1, "ABCDEF" }, - /* 18*/ { IS_UHX_F, "ABCDEf", -1, 0, "ABCDEF" }, - /* 19*/ { IS_LHX_F, "abcdef", -1, 1, "abcdef" }, - /* 20*/ { IS_LHX_F, "abcdeF", -1, 0, "abcdef" }, - /* 21*/ { IS_UPR_F, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, - /* 22*/ { IS_UPR_F, "ABCDEFGHIJKLMNOPQRSTUVWXYZ ", -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, - /* 23*/ { IS_UPR_F, "X", -1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, - /* 24*/ { IS_UPR_F, "x", -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, - /* 25*/ { IS_LWR_F, "abcdefghijklmnopqrstuvwxyz", -1, 1, "abcdefghijklmnopqrstuvwxyz" }, - /* 26*/ { IS_LWR_F, "abcdefghijklmnopqrstuvwxyz ", -1, 0, "abcdefghijklmnopqrstuvwxyz" }, - /* 27*/ { IS_LWR_F, "x", -1, 1, "abcdefghijklmnopqrstuvwxyz" }, - /* 28*/ { IS_LWR_F, "X", -1, 0, "abcdefghijklmnopqrstuvwxyz" }, - /* 29*/ { IS_UX__F, "X", -1, 1, "X" }, - /* 30*/ { IS_UX__F, "x", -1, 0, "X" }, - /* 31*/ { IS_LX__F, "x", -1, 1, "x" }, - /* 32*/ { IS_LX__F, "X", -1, 0, "x" }, - /* 33*/ { IS_C82_F, "!\"%&'(),./:;<=>?_", -1, 1, "!\"%&'(),./:;<=>?_" }, /* CSET82 punctuation less "*+-" */ - /* 34*/ { IS_C82_F, "!\"%&'(),./:;<=>?_ ", -1, 0, "!\"%&'(),./:;<=>?_" }, - /* 35*/ { IS_C82_F, "-", -1, 0, "!\"%&'(),./:;<=>?_" }, - /* 36*/ { IS_C82_F, "$", -1, 0, "!\"%&'(),./:;<=>?_" }, - /* 37*/ { IS_SIL_F, ".$/%", -1, 1, ".$/%" }, /* SILVER punctuation less " +-" */ - /* 38*/ { IS_SIL_F, ".$/% " , -1, 0, ".$/%" }, - /* 39*/ { IS_SIL_F, "-", -1, 0, ".$/%" }, - /* 40*/ { IS_CLI_F, "$:/.", -1, 1, "$:/." }, /* CALCIUM INNER punctuation less "+-" */ - /* 41*/ { IS_CLI_F, "$:/. ", -1, 0, "$:/." }, - /* 42*/ { IS_CLI_F, "+", -1, 0, "$:/." }, - /* 43*/ { IS_ARS_F, "ABCDEFGHJKLMNPRSTUVWXYZ", -1, 1, "ABCDEFGHJKLMNPRSTUVWXYZ" }, /* ARSENIC uppercase */ - /* 44*/ { IS_ARS_F, "ABCDEFGHJKLMNPRSTUVWXYZ ", -1, 0, "ABCDEFGHJKLMNPRSTUVWXYZ" }, - /* 45*/ { IS_ARS_F, "I", -1, 0, "ABCDEFGHJKLMNPRSTUVWXYZ" }, - /* 46*/ { IS_ARS_F, "O", -1, 0, "ABCDEFGHJKLMNPRSTUVWXYZ" }, - /* 47*/ { IS_NUM_F | IS_UHX_F, "0123456789ABCDEF", -1, 1, "0123456789ABCDEF" }, /* SSET */ - /* 48*/ { IS_NUM_F | IS_UHX_F, "0123456789ABCDEf", -1, 0, "0123456789ABCDEF" }, - /* 49*/ { IS_NUM_F | IS_PLS_F, "0123456789+", -1, 1, "0123456789+" }, /* SODIUM_PLS */ - /* 50*/ { IS_NUM_F | IS_PLS_F, "0123456789+-", -1, 0, "0123456789+" }, - /* 51*/ { IS_NUM_F | IS_UX__F, "0123456789X", -1, 1, "0123456789X" }, /* ISBNX_SANE */ - /* 52*/ { IS_NUM_F | IS_UX__F, "0123456789x", -1, 0, "0123456789X" }, - /* 53*/ { IS_NUM_F | IS_UX__F | IS_LX__F | IS_PLS_F, "0123456789Xx+", -1, 1, "0123456789Xx+" }, /* ISBNX_ADDON_SANE */ - /* 54*/ { IS_NUM_F | IS_UX__F | IS_LX__F | IS_PLS_F, "0123456789Xx+Y", -1, 0, "0123456789Xx+" }, - /* 55*/ { IS_NUM_F | IS_MNS_F, "0123456789-", -1, 1, "0123456789-" }, /* SODIUM_MNS */ - /* 56*/ { IS_NUM_F | IS_MNS_F, "0123456789-+", -1, 0, "0123456789-" }, - /* 57*/ { IS_C82_F | IS_AST_F | IS_MNS_F | IS_PLS_F | IS_NUM_F | IS_UPR_F | IS_LWR_F, "!\"%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz", -1, 1, "!\"%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" }, /* CSET82 */ - /* 58*/ { IS_C82_F | IS_AST_F | IS_MNS_F | IS_PLS_F | IS_NUM_F | IS_UPR_F | IS_LWR_F, " ", -1, 0, "!\"%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" }, - /* 59*/ { IS_C82_F | IS_AST_F | IS_MNS_F | IS_PLS_F | IS_NUM_F | IS_UPR_F | IS_LWR_F, "#", -1, 0, "!\"%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" }, - /* 60*/ { IS_C82_F | IS_AST_F | IS_MNS_F | IS_PLS_F | IS_NUM_F | IS_UPR_F | IS_LWR_F, "$", -1, 0, "!\"%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" }, - /* 61*/ { IS_C82_F | IS_AST_F | IS_MNS_F | IS_PLS_F | IS_NUM_F | IS_UPR_F | IS_LWR_F, "@", -1, 0, "!\"%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" }, - /* 62*/ { IS_LWR_F | IS_C82_F | IS_AST_F | IS_PLS_F | IS_MNS_F | IS_SPC_F, "abcdefghijklmnopqrstuvwxyz!\"%&'()*+,-./:;<=>?_ ", -1, 1, "abcdefghijklmnopqrstuvwxyz!\"%&'()*+,-./:;<=>?_ " }, /* IS_ISOIEC_F */ - /* 63*/ { IS_LWR_F | IS_C82_F | IS_AST_F | IS_PLS_F | IS_MNS_F | IS_SPC_F, "abcdefghijklmnopqrstuvwxyz!\"%&'()*+,-./:;<=>?_ #", -1, 0, "abcdefghijklmnopqrstuvwxyz!\"%&'()*+,-./:;<=>?_ " }, - /* 64*/ { IS_LWR_F | IS_C82_F | IS_AST_F | IS_PLS_F | IS_MNS_F | IS_SPC_F, "$", -1, 0, "abcdefghijklmnopqrstuvwxyz!\"%&'()*+,-./:;<=>?_ " }, - /* 65*/ { IS_MNS_F | IS_SIL_F | IS_SPC_F | IS_PLS_F, "-. $/+%", -1, 1, "" }, - /* 66*/ { IS_MNS_F | IS_SIL_F | IS_SPC_F | IS_PLS_F, "-. $/!+%", -1, 0, "" }, - /* 67*/ { IS_NUM_F | IS_UPR_F | IS_MNS_F | IS_SIL_F | IS_SPC_F | IS_PLS_F, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%", -1, 1, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%" }, /* SILVER */ - /* 68*/ { IS_NUM_F | IS_UPR_F | IS_MNS_F | IS_SIL_F | IS_SPC_F | IS_PLS_F, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%a", -1, 0, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%" }, - /* 69*/ { IS_NUM_F | IS_ARS_F, "0123456789ABCDEFGHJKLMNPRSTUVWXYZ", -1, 1, "0123456789ABCDEFGHJKLMNPRSTUVWXYZ" }, /* ARSENIC */ - /* 70*/ { IS_NUM_F | IS_ARS_F, "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ", -1, 0, "0123456789ABCDEFGHJKLMNPRSTUVWXYZ" }, - /* 71*/ { IS_NUM_F | IS_ARS_F, "0123456789ABCDEFGHJKLMNPRSTUVWXYz", -1, 0, "0123456789ABCDEFGHJKLMNPRSTUVWXYZ" }, - /* 72*/ { IS_NUM_F | IS_UPR_F | IS_LWR_F | IS_SPC_F | IS_HSH_F, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #", -1, 1, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #" }, /* GDSET */ - /* 73*/ { IS_NUM_F | IS_UPR_F | IS_LWR_F | IS_SPC_F | IS_HSH_F, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #!", -1, 0, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #" }, - /* 74*/ { IS_NUM_F | IS_MNS_F | IS_CLI_F | IS_PLS_F, "0123456789-$:/.+", -1, 1, "0123456789-$:/.+" }, /* CALCIUM_INNER */ - /* 75*/ { IS_NUM_F | IS_MNS_F | IS_CLI_F | IS_PLS_F, "0123456789-$:/.+ ", -1, 0, "0123456789-$:/.+" }, - /* 76*/ { IS_NUM_F | IS_MNS_F | IS_CLI_F | IS_PLS_F, "0123456789-$:/.+!", -1, 0, "0123456789-$:/.+" }, - /* 77*/ { IS_NUM_F | IS_UPR_F, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, 1, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, /* KRSET */ - /* 78*/ { IS_NUM_F | IS_UPR_F, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYz", -1, 0, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, - /* 79*/ { IS_NUM_F | IS_UPR_F | IS_SPC_F, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ", -1, 1, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ " }, /* RUBIDIUM */ - /* 80*/ { IS_NUM_F | IS_UPR_F | IS_SPC_F, "0123456789aBCDEFGHIJKLMNOPQRSTUVWXYZ ", -1, 0, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ " }, - /* 81*/ { IS_NUM_F | IS_MNS_F | IS_UPR_F, "1234567890-ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, 1, "1234567890-ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, /* SHKASUTSET */ - /* 82*/ { IS_NUM_F | IS_MNS_F | IS_UPR_F, "1234567890-ABCDEFGHIJKLMNOPQRSTUVWXYz", -1, 0, "1234567890-ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, - /* 83*/ { IS_NUM_F | IS_UPR_F | IS_SPC_F | IS_AST_F | IS_PLS_F | IS_MNS_F | IS_SIL_F | IS_CLI_F, "1234567890 $%*+-./:ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, 1, "1234567890 $%*+-./:ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, /* QR_ALPHA */ - /* 84*/ { IS_NUM_F | IS_UPR_F | IS_SPC_F | IS_AST_F | IS_PLS_F | IS_MNS_F | IS_SIL_F | IS_CLI_F, "1234567890 $%*+-./:ABCDEFGHIJKLMNOPQRSTUVWXYz", -1, 0, "1234567890 $%*+-./:ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, + static const struct item data[] = { + /* 0*/ { IS_SPC_F, " ", -1, 0, " " }, + /* 1*/ { IS_SPC_F, "\000", 0, 0, " " }, + /* 2*/ { IS_HSH_F, "#", -1, 0, "#" }, + /* 3*/ { IS_HSH_F, " ", -1, 1, "#" }, + /* 4*/ { IS_AST_F, "*", -1, 0, "*" }, + /* 5*/ { IS_AST_F, " ", -1, 1, "*" }, + /* 6*/ { IS_PLS_F, "+", -1, 0, "+" }, + /* 7*/ { IS_PLS_F, " ", -1, 1, "+" }, + /* 8*/ { IS_MNS_F, "-", -1, 0, "-" }, + /* 9*/ { IS_MNS_F, " ", -1, 1, "-" }, + /* 10*/ { IS_NUM_F, "0123456789", -1, 0, "0123456789" }, /* NEON */ + /* 11*/ { IS_NUM_F, "0123456789 ", -1, 11, "0123456789" }, + /* 12*/ { IS_NUM_F, "012345678A9", -1, 10, "0123456789" }, + /* 13*/ { IS_UPO_F, "GHIJKLMNOPQRSTUVWYZ", -1, 0, "GHIJKLMNOPQRSTUVWYZ" }, + /* 14*/ { IS_UPO_F, "FGHIJKLMNOPQRSTUVWYZ", -1, 1, "GHIJKLMNOPQRSTUVWYZ" }, + /* 15*/ { IS_LWO_F, "ghijklmnopqrstuvwyz", -1, 0, "ghijklmnopqrstuvwyz" }, + /* 16*/ { IS_LWO_F, "fghijklmnopqrstuvwyz", -1, 1, "ghijklmnopqrstuvwyz" }, + /* 17*/ { IS_UHX_F, "ABCDEF", -1, 0, "ABCDEF" }, + /* 18*/ { IS_UHX_F, "ABCDEf", -1, 6, "ABCDEF" }, + /* 19*/ { IS_LHX_F, "abcdef", -1, 0, "abcdef" }, + /* 20*/ { IS_LHX_F, "abcdeF", -1, 6, "abcdef" }, + /* 21*/ { IS_UPR_F, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, + /* 22*/ { IS_UPR_F, "ABCDEFGHIJKLMNOPQRSTUVWXYZ ", -1, 27, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, + /* 23*/ { IS_UPR_F, "X", -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, + /* 24*/ { IS_UPR_F, "x", -1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, + /* 25*/ { IS_LWR_F, "abcdefghijklmnopqrstuvwxyz", -1, 0, "abcdefghijklmnopqrstuvwxyz" }, + /* 26*/ { IS_LWR_F, "abcdefghijklmnopqrstuvwxyz ", -1, 27, "abcdefghijklmnopqrstuvwxyz" }, + /* 27*/ { IS_LWR_F, "x", -1, 0, "abcdefghijklmnopqrstuvwxyz" }, + /* 28*/ { IS_LWR_F, "X", -1, 1, "abcdefghijklmnopqrstuvwxyz" }, + /* 29*/ { IS_UX__F, "X", -1, 0, "X" }, + /* 30*/ { IS_UX__F, "x", -1, 1, "X" }, + /* 31*/ { IS_LX__F, "x", -1, 0, "x" }, + /* 32*/ { IS_LX__F, "X", -1, 1, "x" }, + /* 33*/ { IS_C82_F, "!\"%&'(),./:;<=>?_", -1, 0, "!\"%&'(),./:;<=>?_" }, /* CSET82 punctuation less "*+-" */ + /* 34*/ { IS_C82_F, "!\"%&'(),./:;<=>?_ ", -1, 18, "!\"%&'(),./:;<=>?_" }, + /* 35*/ { IS_C82_F, "-", -1, 1, "!\"%&'(),./:;<=>?_" }, + /* 36*/ { IS_C82_F, "$", -1, 1, "!\"%&'(),./:;<=>?_" }, + /* 37*/ { IS_SIL_F, ".$/%", -1, 0, ".$/%" }, /* SILVER punctuation less " +-" */ + /* 38*/ { IS_SIL_F, ".$/% " , -1, 5, ".$/%" }, + /* 39*/ { IS_SIL_F, "-", -1, 1, ".$/%" }, + /* 40*/ { IS_CLI_F, "$:/.", -1, 0, "$:/." }, /* CALCIUM INNER punctuation less "+-" */ + /* 41*/ { IS_CLI_F, "$:/. ", -1, 5, "$:/." }, + /* 42*/ { IS_CLI_F, "+", -1, 1, "$:/." }, + /* 43*/ { IS_ARS_F, "ABCDEFGHJKLMNPRSTUVWXYZ", -1, 0, "ABCDEFGHJKLMNPRSTUVWXYZ" }, /* ARSENIC uppercase */ + /* 44*/ { IS_ARS_F, "ABCDEFGHJKLMNPRSTUVWXYZ ", -1, 24, "ABCDEFGHJKLMNPRSTUVWXYZ" }, + /* 45*/ { IS_ARS_F, "I", -1, 1, "ABCDEFGHJKLMNPRSTUVWXYZ" }, + /* 46*/ { IS_ARS_F, "O", -1, 1, "ABCDEFGHJKLMNPRSTUVWXYZ" }, + /* 47*/ { IS_NUM_F | IS_UHX_F, "0123456789ABCDEF", -1, 0, "0123456789ABCDEF" }, /* SSET */ + /* 48*/ { IS_NUM_F | IS_UHX_F, "0123456789ABCDEf", -1, 16, "0123456789ABCDEF" }, + /* 49*/ { IS_NUM_F | IS_PLS_F, "0123456789+", -1, 0, "0123456789+" }, /* SODIUM_PLS */ + /* 50*/ { IS_NUM_F | IS_PLS_F, "0123456789+-", -1, 12, "0123456789+" }, + /* 51*/ { IS_NUM_F | IS_UX__F, "0123456789X", -1, 0, "0123456789X" }, /* ISBNX_SANE */ + /* 52*/ { IS_NUM_F | IS_UX__F, "0123456789x", -1, 11, "0123456789X" }, + /* 53*/ { IS_NUM_F | IS_UX__F | IS_LX__F | IS_PLS_F, "0123456789Xx+", -1, 0, "0123456789Xx+" }, /* ISBNX_ADDON_SANE */ + /* 54*/ { IS_NUM_F | IS_UX__F | IS_LX__F | IS_PLS_F, "0123456789Xx+Y", -1, 14, "0123456789Xx+" }, + /* 55*/ { IS_NUM_F | IS_MNS_F, "0123456789-", -1, 0, "0123456789-" }, /* SODIUM_MNS */ + /* 56*/ { IS_NUM_F | IS_MNS_F, "0123456789-+", -1, 12, "0123456789-" }, + /* 57*/ { IS_C82_F | IS_AST_F | IS_MNS_F | IS_PLS_F | IS_NUM_F | IS_UPR_F | IS_LWR_F, "!\"%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz", -1, 0, "!\"%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" }, /* CSET82 */ + /* 58*/ { IS_C82_F | IS_AST_F | IS_MNS_F | IS_PLS_F | IS_NUM_F | IS_UPR_F | IS_LWR_F, " ", -1, 1, "!\"%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" }, + /* 59*/ { IS_C82_F | IS_AST_F | IS_MNS_F | IS_PLS_F | IS_NUM_F | IS_UPR_F | IS_LWR_F, "#", -1, 1, "!\"%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" }, + /* 60*/ { IS_C82_F | IS_AST_F | IS_MNS_F | IS_PLS_F | IS_NUM_F | IS_UPR_F | IS_LWR_F, "$", -1, 1, "!\"%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" }, + /* 61*/ { IS_C82_F | IS_AST_F | IS_MNS_F | IS_PLS_F | IS_NUM_F | IS_UPR_F | IS_LWR_F, "@", -1, 1, "!\"%&'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" }, + /* 62*/ { IS_LWR_F | IS_C82_F | IS_AST_F | IS_PLS_F | IS_MNS_F | IS_SPC_F, "abcdefghijklmnopqrstuvwxyz!\"%&'()*+,-./:;<=>?_ ", -1, 0, "abcdefghijklmnopqrstuvwxyz!\"%&'()*+,-./:;<=>?_ " }, /* IS_ISOIEC_F */ + /* 63*/ { IS_LWR_F | IS_C82_F | IS_AST_F | IS_PLS_F | IS_MNS_F | IS_SPC_F, "abcdefghijklmnopqrstuvwxyz!\"%&'()*+,-./:;<=>?_ #", -1, 48, "abcdefghijklmnopqrstuvwxyz!\"%&'()*+,-./:;<=>?_ " }, + /* 64*/ { IS_LWR_F | IS_C82_F | IS_AST_F | IS_PLS_F | IS_MNS_F | IS_SPC_F, "$", -1, 1, "abcdefghijklmnopqrstuvwxyz!\"%&'()*+,-./:;<=>?_ " }, + /* 65*/ { IS_MNS_F | IS_SIL_F | IS_SPC_F | IS_PLS_F, "-. $/+%", -1, 0, "" }, + /* 66*/ { IS_MNS_F | IS_SIL_F | IS_SPC_F | IS_PLS_F, "-. $/!+%", -1, 6, "" }, + /* 67*/ { IS_NUM_F | IS_UPR_F | IS_MNS_F | IS_SIL_F | IS_SPC_F | IS_PLS_F, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%", -1, 0, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%" }, /* SILVER */ + /* 68*/ { IS_NUM_F | IS_UPR_F | IS_MNS_F | IS_SIL_F | IS_SPC_F | IS_PLS_F, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%a", -1, 44, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%" }, + /* 69*/ { IS_NUM_F | IS_ARS_F, "0123456789ABCDEFGHJKLMNPRSTUVWXYZ", -1, 0, "0123456789ABCDEFGHJKLMNPRSTUVWXYZ" }, /* ARSENIC */ + /* 70*/ { IS_NUM_F | IS_ARS_F, "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ", -1, 25, "0123456789ABCDEFGHJKLMNPRSTUVWXYZ" }, + /* 71*/ { IS_NUM_F | IS_ARS_F, "0123456789ABCDEFGHJKLMNPRSTUVWXYz", -1, 33, "0123456789ABCDEFGHJKLMNPRSTUVWXYZ" }, + /* 72*/ { IS_NUM_F | IS_UPR_F | IS_LWR_F | IS_SPC_F | IS_HSH_F, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #", -1, 0, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #" }, /* GDSET */ + /* 73*/ { IS_NUM_F | IS_UPR_F | IS_LWR_F | IS_SPC_F | IS_HSH_F, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #!", -1, 65, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #" }, + /* 74*/ { IS_NUM_F | IS_MNS_F | IS_CLI_F | IS_PLS_F, "0123456789-$:/.+", -1, 0, "0123456789-$:/.+" }, /* CALCIUM_INNER */ + /* 75*/ { IS_NUM_F | IS_MNS_F | IS_CLI_F | IS_PLS_F, "0123456789-$:/.+ ", -1, 17, "0123456789-$:/.+" }, + /* 76*/ { IS_NUM_F | IS_MNS_F | IS_CLI_F | IS_PLS_F, "0123456789-$:/.+!", -1, 17, "0123456789-$:/.+" }, + /* 77*/ { IS_NUM_F | IS_UPR_F, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, 0, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, /* KRSET */ + /* 78*/ { IS_NUM_F | IS_UPR_F, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYz", -1, 36, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, + /* 79*/ { IS_NUM_F | IS_UPR_F | IS_SPC_F, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ", -1, 0, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ " }, /* RUBIDIUM */ + /* 80*/ { IS_NUM_F | IS_UPR_F | IS_SPC_F, "0123456789aBCDEFGHIJKLMNOPQRSTUVWXYZ ", -1, 11, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ " }, + /* 81*/ { IS_NUM_F | IS_MNS_F | IS_UPR_F, "1234567890-ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, 0, "1234567890-ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, /* SHKASUTSET */ + /* 82*/ { IS_NUM_F | IS_MNS_F | IS_UPR_F, "1234567890-ABCDEFGHIJKLMNOPQRSTUVWXYz", -1, 37, "1234567890-ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, + /* 83*/ { IS_NUM_F | IS_UPR_F | IS_SPC_F | IS_AST_F | IS_PLS_F | IS_MNS_F | IS_SIL_F | IS_CLI_F, "1234567890 $%*+-./:ABCDEFGHIJKLMNOPQRSTUVWXYZ", -1, 0, "1234567890 $%*+-./:ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, /* QR_ALPHA */ + /* 84*/ { IS_NUM_F | IS_UPR_F | IS_SPC_F | IS_AST_F | IS_PLS_F | IS_MNS_F | IS_SIL_F | IS_CLI_F, "1234567890 $%*+-./:ABCDEFGHIJKLMNOPQRSTUVWXYz", -1, 45, "1234567890 $%*+-./:ABCDEFGHIJKLMNOPQRSTUVWXYZ" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, j, length, ret; - testStart("test_is_sane"); + testStart("test_not_sane"); for (i = 0; i < data_size; i++) { @@ -264,22 +264,22 @@ static void test_is_sane(const testCtx *const p_ctx) { length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; - ret = is_sane(data[i].flg, (const unsigned char *) data[i].data, length); + ret = not_sane(data[i].flg, (const unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); if (data[i].orig_test[0]) { int orig_ret = is_sane_orig(data[i].orig_test, (const unsigned char *) data[i].data, length); if (orig_ret == 0) { - assert_nonzero(ret, "i:%d orig_ret %d, ret %d == 0\n", i, orig_ret, ret); - } else { assert_zero(ret, "i:%d orig_ret %d, ret %d != 0\n", i, orig_ret, ret); + } else { + assert_nonzero(ret, "i:%d orig_ret %d, ret %d == 0\n", i, orig_ret, ret); } } - ret = 1; + ret = 0; for (j = 0; j < length; j++) { if (!is_chr(data[i].flg, data[i].data[j])) { - ret = 0; + ret = j + 1; break; } } @@ -289,7 +289,7 @@ static void test_is_sane(const testCtx *const p_ctx) { testFinish(); } -static void test_is_sane_lookup(const testCtx *const p_ctx) { +static void test_not_sane_lookup(const testCtx *const p_ctx) { struct item { char *test_string; @@ -301,16 +301,16 @@ static void test_is_sane_lookup(const testCtx *const p_ctx) { int posns[32]; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { "1234567", -1, "7654321357", -1, 1, { 6, 5, 4, 3, 2, 1, 0, 2, 4, 6 } }, - /* 1*/ { "1234567", -1, "76543213578", -1, 0, {0} }, + static const struct item data[] = { + /* 0*/ { "1234567", -1, "7654321357", -1, 0, { 6, 5, 4, 3, 2, 1, 0, 2, 4, 6 } }, + /* 1*/ { "1234567", -1, "76543213578", -1, 11, {0} }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; int test_length; int posns[32]; - testStart("test_is_sane_lookup"); + testStart("test_not_sane_lookup"); for (i = 0; i < data_size; i++) { @@ -319,10 +319,10 @@ static void test_is_sane_lookup(const testCtx *const p_ctx) { test_length = data[i].test_length == -1 ? (int) strlen(data[i].test_string) : data[i].test_length; length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; - ret = is_sane_lookup(data[i].test_string, test_length, (const unsigned char *) data[i].data, length, posns); + ret = not_sane_lookup(data[i].test_string, test_length, (const unsigned char *) data[i].data, length, posns); assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); - if (ret) { + if (ret == 0) { int j; for (j = 0; j < length; j++) { assert_equal(posns[j], data[i].posns[j], "i:%d posns[%d] %d != expected posns[%d] %d\n", i, j, posns[j], j, data[i].posns[j]); @@ -333,6 +333,206 @@ static void test_is_sane_lookup(const testCtx *const p_ctx) { testFinish(); } +static void test_errtxt(const testCtx *const p_ctx) { + + struct item { + int debug_test; + int error_number; + int err_id; + char *msg; + char *expected; + }; + /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ + static const struct item data[] = { + /* 0*/ { 0, ZINT_ERROR_TOO_LONG, -1, "", "" }, + /* 1*/ { 0, ZINT_ERROR_TOO_LONG, 123, "", "123: " }, + /* 2*/ { 0, ZINT_ERROR_TOO_LONG, 0, "Data too long", "000: Data too long" }, + /* 3*/ { 0, ZINT_ERROR_TOO_LONG, 9, "Data too long", "009: Data too long" }, + /* 4*/ { 0, ZINT_ERROR_TOO_LONG, 99, "Data too long", "099: Data too long" }, + /* 5*/ { 0, ZINT_ERROR_TOO_LONG, 100, "Data too long", "100: Data too long" }, + /* 6*/ { 0, ZINT_ERROR_TOO_LONG, 999, "Data too long", "999: Data too long" }, + /* 7*/ { 0, ZINT_ERROR_TOO_LONG, 1000, "Data too long", "1000: Data too long" }, + /* 8*/ { 0, ZINT_ERROR_TOO_LONG, 9999, "Data too long", "9999: Data too long" }, + /* 9*/ { 0, ZINT_ERROR_TOO_LONG, 10000, "Data too long", "9999: Data too long" }, + /* 10*/ { 0, ZINT_ERROR_TOO_LONG, 99999, "Data too long", "9999: Data too long" }, + /* 11*/ { 1, ZINT_ERROR_TOO_LONG, 10000, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234", "9999: 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" }, + }; + const int data_size = ARRAY_SIZE(data); + int i, ret; + struct zint_symbol s_symbol; + struct zint_symbol *symbol = &s_symbol; + + testStart("test_errtxt"); + + for (i = 0; i < data_size; i++) { + + if (testContinue(p_ctx, i)) continue; + + memset(symbol, 0, sizeof(*symbol)); + if (data[i].debug_test) symbol->debug |= ZINT_DEBUG_TEST; + + ret = errtxt(data[i].error_number, symbol, data[i].err_id, data[i].msg); + assert_equal(ret, data[i].error_number, "i:%d ret %d != %d\n", i, ret, data[i].error_number); + assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); + } + + testFinish(); +} + +static void test_errtxtf(const testCtx *const p_ctx) { + + struct item { + int debug_test; + int error_number; + int err_id; + char *fmt; + int num_args; + int i_arg; + const char *s_arg; + double f_arg; + int ret; + char *expected; + }; + /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ + static const struct item data[] = { + /* 0*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%0$d", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: invalid numbered format specifer" }, + /* 1*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%1d", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: invalid numbered format specifer" }, + /* 2*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%10$d", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: invalid numbered format specifer" }, + /* 3*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%10d", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: invalid numbered format specifer" }, + /* 4*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%00d", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: invalid numbered format specifer" }, + /* 5*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%000d", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: invalid numbered format specifer" }, + /* 6*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%001d", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: invalid numbered format specifer" }, + /* 7*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%0111d", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: invalid numbered format specifer" }, + /* 8*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%x", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: unknown format specifier ('%c','%d','%f','%g','%s' only)" }, + /* 9*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%1$10d", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: unknown format specifier ('%c','%d','%f','%g','%s' only)" }, + /* 10*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%.0s", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: invalid length precision" }, + /* 11*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%.ss", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: invalid length precision" }, + /* 12*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%.10d", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: invalid length precision" }, + /* 13*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%1$d %d", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: mixed numbered and unnumbered format specifiers" }, + /* 14*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%d %d %d %d %s %d %d %d %d %d", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: too many format specifiers (9 maximum)" }, + /* 15*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%1$d %2$d %3$d %4$d %5$s %6$d %7$d %8$d %9$d %9$d", 0, 0, NULL, 0, ZINT_ERROR_ENCODING_PROBLEM, "000: Internal error: too many format specifiers (9 maximum)" }, + /* 16*/ { 0, ZINT_ERROR_TOO_LONG, 123, "%d %d %d %d %s %d %d %d %d", 9, 4, "5max", -1, -1, "123: 2100000001 2100000002 3333 4 5max 2100000006 2100000007 2100000008 2100000009" }, + /* 17*/ { 0, ZINT_ERROR_TOO_LONG, 123, "%1$d %2$d %3$d %4$d %5$s %6$d %7$d %8$d %9$d", 9, 4, "5max", -1, -1, "123: 2100000001 2100000002 3333 4 5max 2100000006 2100000007 2100000008 2100000009" }, + /* 18*/ { 0, ZINT_ERROR_TOO_LONG, 123, "%9$d %8$d %7$d %6$d %5$s %4$d %3$d %2$d %1$d", 9, 4, "5max", -1, -1, "123: 2100000009 2100000008 2100000007 2100000006 5max 4 3333 2100000002 2100000001" }, + /* 19*/ { 0, ZINT_ERROR_TOO_LONG, 123, "%9$d %8$d %7$d %6$d %5$.3s %4$d %3$d %2$d %1$d", 9, 4, "5max", -1, -1, "123: 2100000009 2100000008 2100000007 2100000006 5ma 4 3333 2100000002 2100000001" }, + /* 20*/ { 0, ZINT_ERROR_TOO_LONG, 123, "%1$d %2$d %3$d %5$.*4$s %6$d %7$d %8$d %9$d", 9, 4, "45max", -1, -1, "123: 2100000001 2100000002 3333 45ma 2100000006 2100000007 2100000008 2100000009" }, + /* 21*/ { 0, ZINT_ERROR_TOO_LONG, 123, "%%%d %d %d %d %s %d %d %d %d", 9, 4, "5max", -1, -1, "123: %2100000001 2100000002 3333 4 5max 2100000006 2100000007 2100000008 2100000009" }, + /* 22*/ { 0, ZINT_ERROR_TOO_LONG, 123, "%%%d%%%% %%d %d%%%%%09d %d%% %%%s %d %d %%%% %d%d%%", 9, 4, "5max", -1, -1, "123: %2100000001%% %d 2100000002%%000003333 4% %5max 2100000006 2100000007 %% 21000000082100000009%" }, + /* 23*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%%%d%%%% %%d %d%%%%%09d %d%% %%%s %d %d %%%% %d %d%%", 9, 4, "5max", -1, -1, "123: %2100000001%% %d 2100000002%%000003333 4% %5max 2100000006 2100000007 %% 2100000008 2100000009" }, /* Truncated */ + /* 24*/ { 1, ZINT_ERROR_TOO_LONG, 123, "%%%d%%%% %%d %d%%%%%09d %d%% %%%s %d %d %%%% %d %d ", 9, 4, "5max", -1, -1, "123: %2100000001%% %d 2100000002%%000003333 4% %5max 2100000006 2100000007 %% 2100000008 2100000009" }, /* Truncated */ + /* 25*/ { 0, ZINT_ERROR_TOO_LONG, 123, "%d %011d %05d %05d %s %d %d %d %014d", 9, 4, "5max", -1, -1, "123: 2100000001 02100000002 03333 00004 5max 2100000006 2100000007 2100000008 00002100000009" }, + /* 26*/ { 0, ZINT_ERROR_TOO_LONG, 123, "", 0, 0, NULL, 0, -1, "123: " }, + /* 27*/ { 0, ZINT_ERROR_TOO_LONG, -1, "Gosh '%c' wow", 1, 1, NULL, -1, -1, "Gosh '\001' wow" }, + /* 28*/ { 0, ZINT_ERROR_TOO_LONG, 0, "Gosh '%c' wow", 1, 1, NULL, -1, -1, "000: Gosh '\001' wow" }, + /* 29*/ { 0, ZINT_ERROR_TOO_LONG, 99, "Gosh %d wow", 1, 1, NULL, -1, -1, "099: Gosh 1 wow" }, + /* 30*/ { 0, ZINT_ERROR_TOO_LONG, 99, "Gosh %02d wow", 1, 1, NULL, -1, -1, "099: Gosh 01 wow" }, + /* 31*/ { 0, ZINT_ERROR_TOO_LONG, 99, "Gosh %03d wow", 1, 99, NULL, -1, -1, "099: Gosh 099 wow" }, + /* 32*/ { 0, ZINT_ERROR_TOO_LONG, 99, "Gosh %012d wow", 1, 99, NULL, -1, -1, "099: Gosh 000000000099 wow" }, + /* 33*/ { 0, ZINT_ERROR_TOO_LONG, -1, "%099d", 1, 99, NULL, -1, -1, "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000099" }, + /* 34*/ { 0, ZINT_ERROR_TOO_LONG, 9999, "Gosh %d%% wow", 1, 100, NULL, -1, -1, "9999: Gosh 100% wow" }, + /* 35*/ { 0, ZINT_ERROR_TOO_LONG, 10000, "Gosh %d%% wow", 1, 100, NULL, -1, -1, "9999: Gosh 100% wow" }, + /* 36*/ { 0, ZINT_ERROR_TOO_LONG, 99999, "Gosh %d%% wow", 1, 100, NULL, -1, -1, "9999: Gosh 100% wow" }, + /* 37*/ { 0, ZINT_ERROR_TOO_LONG, 9999, "%%%d%% wow", 1, 100, NULL, -1, -1, "9999: %100% wow" }, + /* 38*/ { 0, ZINT_ERROR_TOO_LONG, 9999, "Gosh %1$d wow", 1, 1, NULL, -1, -1, "9999: Gosh 1 wow" }, + /* 39*/ { 0, ZINT_ERROR_TOO_LONG, 9999, "Gosh %1$d wow %1$d", 1, 1, NULL, -1, -1, "9999: Gosh 1 wow 1" }, + /* 40*/ { 0, ZINT_ERROR_TOO_LONG, 9999, "Gosh %1$09d wow", 1, 10, NULL, -1, -1, "9999: Gosh 000000010 wow" }, + /* 41*/ { 0, ZINT_ERROR_TOO_LONG, 9999, "Gosh %1$03d wow %1$04d", 1, 10, NULL, -1, -1, "9999: Gosh 0010 wow 0010" }, /* TODO: incompat: last min field trumps but each should be respected */ + /* 42*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%f' wow", 1, -1, NULL, 3.1, -1, "123: Gosh '3.100000' wow" }, + /* 43*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %g wow", 1, -1, NULL, 3.1, -1, "123: Gosh 3.1 wow" }, + /* 44*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%s' wow", 1, -1, "gee", -1, -1, "123: Gosh 'gee' wow" }, + /* 45*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%.1s' wow", 1, -1, "12345678901234567890", -1, -1, "123: Gosh '1' wow" }, + /* 46*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%.9s' wow", 1, -1, "12345678901234567890", -1, -1, "123: Gosh '123456789' wow" }, + /* 47*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%.10s' wow", 1, -1, "12345678901234567890", -1, -1, "123: Gosh '1234567890' wow" }, + /* 48*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%.19s' wow", 1, -1, "12345678901234567890", -1, -1, "123: Gosh '1234567890123456789' wow" }, + /* 49*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%1$.1s' wow", 1, -1, "12345678901234567890", -1, -1, "123: Gosh '1' wow" }, + /* 50*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%1$.20s' wow", 1, -1, "12345678901234567890", -1, -1, "123: Gosh '12345678901234567890' wow" }, + /* 51*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%.2s' wow", 1, -1, "gee", -1, -1, "123: Gosh 'ge' wow" }, + /* 52*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%.3s' wow", 1, -1, "gee", -1, -1, "123: Gosh 'gee' wow" }, + /* 53*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%.4s' wow", 1, -1, "gee", -1, -1, "123: Gosh 'gee' wow" }, + /* 54*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%.9s' wow", 1, -1, "gee", -1, -1, "123: Gosh 'gee' wow" }, + /* 55*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%.*s' wow", 2, 0, "gee", -1, -1, "123: Gosh '' wow" }, + /* 56*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%.*s' wow", 2, 1, "gee", -1, -1, "123: Gosh 'g' wow" }, + /* 57*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%.*s' wow", 2, 2, "gee", -1, -1, "123: Gosh 'ge' wow" }, + /* 58*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%.*s' wow", 2, 3, "gee", -1, -1, "123: Gosh 'gee' wow" }, + /* 59*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%.*s' wow", 2, 4, "gee", -1, -1, "123: Gosh 'gee' wow" }, + /* 60*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%.*s' wow", 2, 999, "gee", -1, -1, "123: Gosh 'gee' wow" }, + /* 61*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%2$.*1$s' wow", 2, 2, "gee", -1, -1, "123: Gosh 'ge' wow" }, + /* 62*/ { 1, ZINT_ERROR_TOO_LONG, 123, "Gosh %s wow", 1, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456", -1, -1, "123: Gosh 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456 wo" }, + /* 63*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh '%c' %g wow", 2, 'A', NULL, -12.1f, -1, "123: Gosh 'A' -12.1 wow" }, + /* 64*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %d %s wow", 2, 123456789, "cor", -1, -1, "123: Gosh 123456789 cor wow" }, + /* 65*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %1$d %2$s wow", 2, 123456789, "cor", -1, -1, "123: Gosh 123456789 cor wow" }, + /* 66*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %1$d %2$.1s wow", 2, 123456789, "cor", -1, -1, "123: Gosh 123456789 c wow" }, + /* 67*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %2$s %1$d wow", 2, 123456789, "cor", -1, -1, "123: Gosh cor 123456789 wow" }, + /* 68*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %2$g %1$d wow", 2, 1, NULL, 2, -1, "123: Gosh 2 1 wow" }, + /* 69*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %2$s %1$d wow second %2$s", 2, 123456789, "cor", -1, -1, "123: Gosh cor 123456789 wow second cor" }, + /* 70*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %2$.2s %1$d wow second %2$s", 2, 123456789, "cor", -1, -1, "123: Gosh co 123456789 wow second co" }, /* TODO: incompat: last length trumps but each should be respected */ + /* 71*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %2$.2s %1$d wow second %2$.1s", 2, 123456789, "cor", -1, -1, "123: Gosh c 123456789 wow second c" }, /* TODO: incompat: last length trumps */ + /* 72*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %2$.1s %1$d wow second %2$.2s", 2, 123456789, "cor", -1, -1, "123: Gosh co 123456789 wow second co" }, /* TODO: incompat: last length trumps */ + /* 73*/ { 1, ZINT_ERROR_TOO_LONG, -1, "%1$s %1$s", 1, -1, "12345678901234567890123456789012345678901234567890", -1, -1, "12345678901234567890123456789012345678901234567890 123456789012345678901234567890123456789012345678" }, + /* 74*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %d %s %g wow", 3, 1, "cor", 3, -1, "123: Gosh 1 cor 3 wow" }, + /* 75*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %1$d %2$s %3$g wow", 3, 1, "cor", 3, -1, "123: Gosh 1 cor 3 wow" }, + /* 76*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %3$g %2$s %1$d wow", 3, 1, "cor", 3, -1, "123: Gosh 3 cor 1 wow" }, + /* 77*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %3$g %1$d %2$s wow", 3, 1, "cor", 3, -1, "123: Gosh 3 1 cor wow" }, + /* 78*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %3$g %1$d %2$s wow %2$s %1$d", 3, 1, "cor", 3, -1, "123: Gosh 3 1 cor wow cor 1" }, + /* 79*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %2$.*1$s %3$g wow", 3, 1, "cor", 3, -1, "123: Gosh c 3 wow" }, + /* 80*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %2$.*1$s %3$g wow %2$s blimey", 3, 1, "cor", 3, -1, "123: Gosh c 3 wow c blimey" }, + /* 81*/ { 0, ZINT_ERROR_TOO_LONG, 123, "Gosh %3$g %2$.*1$s wow", 3, 1, "cor", 3, -1, "123: Gosh 3 c wow" }, + }; + const int data_size = ARRAY_SIZE(data); + int i, ret; + struct zint_symbol s_symbol; + struct zint_symbol *symbol = &s_symbol; + + testStart("test_errtxtf"); + + for (i = 0; i < data_size; i++) { + + if (testContinue(p_ctx, i)) continue; + + memset(symbol, 0, sizeof(*symbol)); + if (data[i].debug_test) symbol->debug |= ZINT_DEBUG_TEST; + + if (data[i].num_args == 0) { + ret = errtxtf(data[i].error_number, symbol, data[i].err_id, data[i].fmt, NULL /*suppress -Wformat-security*/); + } else if (data[i].num_args == 1) { + if (data[i].i_arg != -1) { + ret = errtxtf(data[i].error_number, symbol, data[i].err_id, data[i].fmt, data[i].i_arg); + } else if (data[i].s_arg != NULL) { + ret = errtxtf(data[i].error_number, symbol, data[i].err_id, data[i].fmt, data[i].s_arg); + } else { + ret = errtxtf(data[i].error_number, symbol, data[i].err_id, data[i].fmt, data[i].f_arg); + } + } else if (data[i].num_args == 2) { + if (data[i].i_arg != -1) { + if (data[i].s_arg != NULL) { + ret = errtxtf(data[i].error_number, symbol, data[i].err_id, data[i].fmt, data[i].i_arg, data[i].s_arg); + } else { + ret = errtxtf(data[i].error_number, symbol, data[i].err_id, data[i].fmt, data[i].i_arg, data[i].f_arg); + } + } else { + assert_nonnull(data[i].s_arg, "i:%d num_args:%d data[i].s_arg NULL", i, data[i].num_args); + ret = errtxtf(data[i].error_number, symbol, data[i].err_id, data[i].fmt, data[i].s_arg, data[i].f_arg); + } + } else if (data[i].num_args == 3) { + assert_nonnull(data[i].s_arg, "i:%d num_args:%d data[i].s_arg NULL", i, data[i].num_args); + ret = errtxtf(data[i].error_number, symbol, data[i].err_id, data[i].fmt, data[i].i_arg, data[i].s_arg, data[i].f_arg); + } else if (data[i].num_args == 9) { /* Special case max, assuming 4th arg "%d", 5th arg "%s" */ + assert_nonnull(data[i].s_arg, "i:%d num_args:%d data[i].s_arg NULL", i, data[i].num_args); + ret = errtxtf(data[i].error_number, symbol, data[i].err_id, data[i].fmt, 2100000001, 2100000002, 3333, data[i].i_arg, data[i].s_arg, 2100000006, 2100000007, 2100000008, 2100000009); + } else { + assert_nonnull(NULL, "i:%d num_args:%d > 3 && != 9\n", i, data[i].num_args); + } + if (data[i].ret == -1) { + assert_equal(ret, data[i].error_number, "i:%d ret %d != %d (%s)\n", i, ret, data[i].error_number, symbol->errtxt); + } else { + assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + } + assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); + } + + testFinish(); +} + static void test_cnt_digits(const testCtx *const p_ctx) { struct item { @@ -343,7 +543,7 @@ static void test_cnt_digits(const testCtx *const p_ctx) { int ret; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "", -1, 0, -1, 0 }, /* 1*/ { "asdf1", -1, 0, -1, 0 }, /* 2*/ { "asdf1asdf", -1, 4, -1, 1 }, @@ -351,7 +551,7 @@ static void test_cnt_digits(const testCtx *const p_ctx) { /* 4*/ { "a12345asdf", -1, 1, 4, 4}, /* 5*/ { "a1234", -1, 1, 5, 4}, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; testStart("test_cnt_digits"); @@ -378,7 +578,7 @@ static void test_is_valid_utf8(const testCtx *const p_ctx) { char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "", -1, 1, "" }, /* 1*/ { "abcdefghijklmnopqrstuvwxyz", -1, 1, "" }, /* 2*/ { "éa", -1, 1, "" }, @@ -390,7 +590,7 @@ static void test_is_valid_utf8(const testCtx *const p_ctx) { /* 7*/ { "\300\201", -1, 0, "Overlong 0xC081" }, /* 8*/ { "\355\240\200", -1, 0, "Surrogate 0xEDA080" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; testStart("test_is_valid_utf8"); @@ -421,22 +621,23 @@ static void test_utf8_to_unicode(const testCtx *const p_ctx) { char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "", -1, 1, 0, 0, {0}, "" }, /* 1*/ { "\000a\302\200\340\240\200", 7, 1, 0, 4, { 0, 'a', 0x80, 0x800 }, "NUL a C280 E0A080" }, /* 2*/ { "\357\277\277", -1, 1, 0, 1, { 0xFFFF }, "EFBFBF" }, /* 3*/ { "\360\220\200\200", -1, 1, ZINT_ERROR_INVALID_DATA, -1, {0}, "Four-byte F0908080" }, /* 4*/ { "a\200b", -1, 1, ZINT_ERROR_INVALID_DATA, -1, {0}, "Orphan continuation 0x80" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; unsigned int vals[20]; - struct zint_symbol symbol = {0}; + struct zint_symbol s_symbol; + struct zint_symbol *symbol = &s_symbol; testStart("test_utf8_to_unicode"); - symbol.debug = debug; + symbol->debug = debug; for (i = 0; i < data_size; i++) { int ret_length; @@ -446,7 +647,7 @@ static void test_utf8_to_unicode(const testCtx *const p_ctx) { length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; ret_length = length; - ret = utf8_to_unicode(&symbol, (unsigned char *) data[i].data, vals, &ret_length, data[i].disallow_4byte); + ret = utf8_to_unicode(symbol, (unsigned char *) data[i].data, vals, &ret_length, data[i].disallow_4byte); assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); if (ret == 0) { int j; @@ -477,7 +678,7 @@ static void test_hrt_cpy_iso8859_1(const testCtx *const p_ctx) { é U+00E9 (\351, 233), UTF-8 C3A9 */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "", -1, 0, "", "" }, /* 1*/ { "abc", -1, 0, "abc", "" }, /* 2*/ { "\000A\001B\002\036\037C ~\177", 11, 0, " A B C ~ ", "" }, @@ -501,14 +702,15 @@ static void test_hrt_cpy_iso8859_1(const testCtx *const p_ctx) { /* 20*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 1, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "101 \351 (truncated)" }, /* 21*/ { "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, 1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "200 A (truncated)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol symbol = {0}; + struct zint_symbol s_symbol; + struct zint_symbol *symbol = &s_symbol; testStart("test_hrt_cpy_iso8859_1"); - symbol.debug = debug; + symbol->debug = debug; for (i = 0; i < data_size; i++) { int j; @@ -517,15 +719,15 @@ static void test_hrt_cpy_iso8859_1(const testCtx *const p_ctx) { length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length; - ret = hrt_cpy_iso8859_1(&symbol, (unsigned char *) data[i].data, length); + ret = hrt_cpy_iso8859_1(symbol, (unsigned char *) data[i].data, length); if (p_ctx->index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) { for (j = 0; j < ret; j++) { - fprintf(stderr, "symbol.text[%d] %2X\n", j, symbol.text[j]); + fprintf(stderr, "symbol->text[%d] %2X\n", j, symbol->text[j]); } } assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); - assert_nonzero(testUtilIsValidUTF8(symbol.text, (int) ustrlen(symbol.text)), "i:%d testUtilIsValidUTF8(%s) != 1\n", i, symbol.text); - assert_zero(strcmp((char *) symbol.text, data[i].expected), "i:%d symbol.text (%s) != expected (%s)\n", i, symbol.text, data[i].expected); + assert_nonzero(testUtilIsValidUTF8(symbol->text, (int) ustrlen(symbol->text)), "i:%d testUtilIsValidUTF8(%s) != 1\n", i, symbol->text); + assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d symbol->text (%s) != expected (%s)\n", i, symbol->text, data[i].expected); } testFinish(); @@ -550,7 +752,7 @@ static void test_set_height(const testCtx *const p_ctx) { char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { 0, { 0 }, 0, 0, 0, 0, 0, 0, 0.5, "", "" }, /* 1*/ { 2, { 1, 1 }, 2, 0, 0, 0, 0, 0, 2, "", "zero_count == 0, fixed height only" }, /* 2*/ { 2, { 1, 1 }, 2, 0, 0, 1, 1, ZINT_WARN_NONCOMPLIANT, 2, "", "zero_count == 0, height < max height" }, @@ -562,31 +764,32 @@ static void test_set_height(const testCtx *const p_ctx) { /* 8*/ { 2, { 2, 0 }, 20, 0, 20, 0, 0, 0, 20, "", "zero_count != 0, height 20" }, /* 9*/ { 2, { 2, 0 }, 0, 2, 0, 0, 0, 0, 4, "", "zero_count != 0, min_row_height 2" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, ret; - struct zint_symbol symbol; + struct zint_symbol s_symbol; + struct zint_symbol *symbol = &s_symbol; testStart("set_height"); - symbol.debug = debug; + symbol->debug = debug; for (i = 0; i < data_size; i++) { int j; if (testContinue(p_ctx, i)) continue; - memset(&symbol, 0, sizeof(symbol)); - symbol.rows = data[i].rows; + memset(symbol, 0, sizeof(*symbol)); + symbol->rows = data[i].rows; for (j = 0; j < ARRAY_SIZE(data[i].row_height); j++) { - symbol.row_height[j] = data[i].row_height[j]; + symbol->row_height[j] = data[i].row_height[j]; } - symbol.height = data[i].height; + symbol->height = data[i].height; - ret = set_height(&symbol, data[i].min_row_height, data[i].default_height, data[i].max_height, data[i].no_errtxt); + ret = set_height(symbol, data[i].min_row_height, data[i].default_height, data[i].max_height, data[i].no_errtxt); assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); - assert_equal(symbol.height, data[i].expected_height, "i:%d symbol.height %g != %g\n", i, symbol.height, data[i].expected_height); - assert_zero(strcmp(symbol.errtxt, data[i].expected_errtxt), "i:%d errtxt %s != %s\n", i, symbol.errtxt, data[i].expected_errtxt); + assert_equal(symbol->height, data[i].expected_height, "i:%d symbol->height %g != %g\n", i, symbol->height, data[i].expected_height); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d errtxt %s != %s\n", i, symbol->errtxt, data[i].expected_errtxt); } testFinish(); @@ -603,26 +806,27 @@ static void test_debug_test_codeword_dump_int(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { { 2147483647, -2147483646, 2147483647, 0, 2147483647, 2147483647, 2147483647, 2147483647, 123456 }, 10, "(10) 2147483647 -2147483646 2147483647 0 2147483647 2147483647 2147483647 2147483647 123456" }, /* 1*/ { { 2147483647, -2147483646, 2147483647, 0, 2147483647, 2147483647, 2147483647, 2147483647, 1234567 }, 10, "(10) 2147483647 -2147483646 2147483647 0 2147483647 2147483647 2147483647 2147483647" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i; - struct zint_symbol symbol = {0}; + struct zint_symbol s_symbol; + struct zint_symbol *symbol = &s_symbol; testStart("test_debug_test_codeword_dump_int"); - symbol.debug = debug; + symbol->debug = debug; for (i = 0; i < data_size; i++) { if (testContinue(p_ctx, i)) continue; - debug_test_codeword_dump_int(&symbol, data[i].codewords, data[i].length); - assert_nonzero(strlen(symbol.errtxt) < 92, "i:%d strlen(%s) >= 92 (%d)\n", i, symbol.errtxt, (int) strlen(symbol.errtxt)); - assert_zero(strcmp(symbol.errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0 (%d, %d)\n", i, symbol.errtxt, data[i].expected, (int) strlen(symbol.errtxt), (int) strlen(data[i].expected)); + debug_test_codeword_dump_int(symbol, data[i].codewords, data[i].length); + assert_nonzero(strlen(symbol->errtxt) < 92, "i:%d strlen(%s) >= 92 (%d)\n", i, symbol->errtxt, (int) strlen(symbol->errtxt)); + assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0 (%d, %d)\n", i, symbol->errtxt, data[i].expected, (int) strlen(symbol->errtxt), (int) strlen(data[i].expected)); } testFinish(); @@ -634,8 +838,10 @@ int main(int argc, char *argv[]) { { "test_chr_cnt", test_chr_cnt }, { "test_to_int", test_to_int }, { "test_to_upper", test_to_upper }, - { "test_is_sane", test_is_sane }, - { "test_is_sane_lookup", test_is_sane_lookup }, + { "test_not_sane", test_not_sane }, + { "test_not_sane_lookup", test_not_sane_lookup }, + { "test_errtxt", test_errtxt }, + { "test_errtxtf", test_errtxtf }, { "test_cnt_digits", test_cnt_digits }, { "test_is_valid_utf8", test_is_valid_utf8 }, { "test_utf8_to_unicode", test_utf8_to_unicode }, diff --git a/backend/tests/test_composite.c b/backend/tests/test_composite.c index 4d5fb8fe..74554088 100644 --- a/backend/tests/test_composite.c +++ b/backend/tests/test_composite.c @@ -44,7 +44,7 @@ static void test_eanx_leading_zeroes(const testCtx *const p_ctx) { int expected_width; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_EANX_CC, "1", "[21]A12345678", 0, 8, 72 }, /* EAN-8 */ /* 1*/ { BARCODE_EANX_CC, "12", "[21]A12345678", 0, 8, 72 }, /* 2*/ { BARCODE_EANX_CC, "123", "[21]A12345678", 0, 8, 72 }, @@ -73,7 +73,7 @@ static void test_eanx_leading_zeroes(const testCtx *const p_ctx) { /*25*/ { BARCODE_EANX_CC, "1234567890128+12", "[21]A12345678", 0, 7, 125 }, /* EAN-13 + CHK + EAN-2 */ /*26*/ { BARCODE_EANX_CC, "1234567890128+12345", "[21]A12345678", 0, 7, 152 }, /* EAN-13 + CHK + EAN-5 */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; struct zint_symbol *symbol = NULL; @@ -95,10 +95,8 @@ static void test_eanx_leading_zeroes(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); - 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->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); - } + 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); ZBarcode_Delete(symbol); } @@ -153,7 +151,7 @@ static void test_examples(const testCtx *const p_ctx) { char *expected; }; /* Verified manually against GS1 General Specifications 21.0.1 (GGS) and ISO/IEC 24723:2010, with noted exceptions, and verified via bwipp_dump.ps against BWIPP */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DBAR_OMNSTK_CC, -1, 1, "0401234567890", "[17]050101[10]ABC123", 0, 11, 56, 1, "GSS Figure 5.1-5. GS1 DataBar Stacked Omnidirectional barcode with a Composite Component", "01101100110101110001001100001000000110100111011110101001" "01101101110110001100010100001100001000010110011100101001" @@ -1424,7 +1422,14 @@ static void test_examples(const testCtx *const p_ctx) { "00000000010110001100001010001001000010010100110001101110100111000111010010011110101100100001001010011000110111010011100011101001001111010110010000100101001100011011101001110001110100100111101011010000100010010000100100111000101000000000000" "00000001101001110011110101110110111101101011001110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100101111011101101111011011000111010110000000000" }, - /* 70*/ { BARCODE_EANX_CC, -1, 1, "123456789012+12", "[91]123456789012345678901", 0, 8, 125, 1, "Example of EAN-13 with 2-digit addon, CC-A 4 cols, 4 rows", + /* 70*/ { BARCODE_GS1_128_CC, -1, 3, "[01]12345678901231[90]123", "[20]12", 0, 5, 205, 1, "Example with 8 cols, left/right padding of linear (BWIPP)", + "1111111101010100011101010111000000111010110011110001110111110111010010000010000100010111010011011110001001100111101110010000110111001100111000101101111001000101110111000011101010001110000111111101000101001" + "1111111101010100011110101000010000111010111011000001111110111001010011111001000100110111000000100110101100100111000001011111010001101110110101110001000001111010100001000011111010101100000111111101000101001" + "1111111101010100011101010001111110100010100011110001111101011100001011000011001011110100101001111000001011111011010000011101111110010100110111100010001101011001001110000010101000011110000111111101000101001" + "0000000001011000110000101000100110010011010011000110111010011100011101001001111010110010000100101001100011001001110010010000100101001100011010000100010011010001100010100001001000100010011100010100000000000" + "0000000110100111001111010111011001101100101100111001000101100011100010110110000101001101111011010110011100110110001101101111011010110011100101111011101100101110011101011110110111011101100011101011000000000" + }, + /* 71*/ { BARCODE_EANX_CC, -1, 1, "123456789012+12", "[91]123456789012345678901", 0, 8, 125, 1, "Example of EAN-13 with 2-digit addon, CC-A 4 cols, 4 rows", "11010010001111001101001110010111011100010000100100011010111011100100000110000010011011101110110010100000000000000000000000000" "11010110001110101100100000011001111010111110100100001011001011110110000110010011100000101100110010100000000000000000000000000" "11010111001110101111101000011111100110111010101100001011111010111100110100110100111000001101110010100000000000000000000000000" @@ -1434,7 +1439,7 @@ static void test_examples(const testCtx *const p_ctx) { "00010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000" "00010100100110111101001110101100010000101001000101010100100011101001110010110011011011001001000101000000010110011001010010011" }, - /* 71*/ { BARCODE_EANX_CC, -1, 1, "123456789012+54321", "[91]1234567890", 0, 7, 152, 1, "Example of EAN-13 with 5-digit addon, CC-B 4 cols, 3 rows", + /* 72*/ { BARCODE_EANX_CC, -1, 1, "123456789012+54321", "[91]1234567890", 0, 7, 152, 1, "Example of EAN-13 with 5-digit addon, CC-B 4 cols, 3 rows", "11011011101111001101001110010111011100010000100111010010111011100100000110000010011011101101100010100000000000000000000000000000000000000000000000000000" "11011011001111110101001110011111000100100110100110010011010001110001000100101111110011101100100010100000000000000000000000000000000000000000000000000000" "11011010001010000010111100011100111100101110100110011011001111101001000100111110110100001110100010100000000000000000000000000000000000000000000000000000" @@ -1443,7 +1448,7 @@ static void test_examples(const testCtx *const p_ctx) { "00010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000" "00010100100110111101001110101100010000101001000101010100100011101001110010110011011011001001000101000000010110111001010100011010100001010010011010011001" }, - /* 72*/ { BARCODE_UPCA_CC, -1, 1, "12345678901+12", "[91]123456789", 0, 7, 127, 1, "Example of UPC-A with 2-digit addon, CC-A 4 cols, 3 rows", + /* 73*/ { BARCODE_UPCA_CC, -1, 1, "12345678901+12", "[91]123456789", 0, 7, 127, 1, "Example of UPC-A with 2-digit addon, CC-A 4 cols, 3 rows", "1101101110111100110100111001011101110001000010011101001011101110010000011000001001101110110110001010000000000000000000000000000" "1101101100111001110011110101100001000111001010011001001110101100100000010010111111001110110010001010000000000000000000000000000" "1101101000100001111001000101011110100000010010011001101000111000010110011011100010001110111010001010000000000000000000000000000" @@ -1452,7 +1457,7 @@ static void test_examples(const testCtx *const p_ctx) { "0001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000" "0001010011001001001101111010100011011000101011110101010001001001000111010011100101100110110110010100000000010110011001010010011" }, - /* 73*/ { BARCODE_UPCA_CC, -1, 2, "12345678901+12121", "[91]1234567890123", 0, 8, 154, 1, "Example of UPC-A with 5-digit addon, CC-B 4 cols, 4 rows", + /* 74*/ { BARCODE_UPCA_CC, -1, 2, "12345678901+12121", "[91]1234567890123", 0, 8, 154, 1, "Example of UPC-A with 5-digit addon, CC-B 4 cols, 4 rows", "1101001110100011111010011101101111110101110010011101101101000011110110011001011100001000110100100010000000000000000000000000000000000000000000000000000000" "1101001100101100100111000001011111011000001010011101001101111110011010011101001111100100110101100010000000000000000000000000000000000000000000000000000000" "1101000100111001101000011001100100000101100010011001001001111011110100011100011101000100110101110010000000000000000000000000000000000000000000000000000000" @@ -1462,7 +1467,7 @@ static void test_examples(const testCtx *const p_ctx) { "0001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000" "0001010011001001001101111010100011011000101011110101010001001001000111010011100101100110110110010100000000010110011001010010011010110011010011011010011001" }, - /* 74*/ { BARCODE_UPCE_CC, -1, 1, "0654321+89", "[91]1", 0, 9, 81, 1, "Example of UPC-E with 2-digit addon, CC-A 2 cols, 5 rows", + /* 75*/ { BARCODE_UPCE_CC, -1, 1, "0654321+89", "[91]1", 0, 9, 81, 1, "Example of UPC-E with 2-digit addon, CC-A 2 cols, 5 rows", "110110011011110111010111110101000100011110001111010100100000000000000000000000000" "110110111011101100001000110111001010111000001110010100100000000000000000000000000" "110110110011000101111101110111101000010010001110110100100000000000000000000000000" @@ -1473,7 +1478,7 @@ static void test_examples(const testCtx *const p_ctx) { "000100000000000000000000000000000000000000000000000001000000000000000000000000000" "000101000010101100010011101011110100110110011001010101000000010110110111010010111" }, - /* 75*/ { BARCODE_UPCE_CC, -1, 2, "1876543+56789", "[91]12345", 0, 12, 108, 1, "Example of UPC-E with 5-digit addon, CC-B 2 cols, 8 rows", + /* 76*/ { BARCODE_UPCE_CC, -1, 2, "1876543+56789", "[91]12345", 0, 12, 108, 1, "Example of UPC-E with 5-digit addon, CC-B 2 cols, 8 rows", "110010001011101111101110100100000100001000101100100010100000000000000000000000000000000000000000000000000000" "111010001011010000111101100110010111000010001110100010100000000000000000000000000000000000000000000000000000" "111011001011101100100111110100011110010000101110110010100000000000000000000000000000000000000000000000000000" @@ -1487,7 +1492,7 @@ static void test_examples(const testCtx *const p_ctx) { "000100000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000" "000101011011100100010000101011000101000110100001010101000000010110110001010101111010010001010110111010010111" }, - /* 76*/ { BARCODE_EANX_CC, -1, 1, "9876543+65", "[91]1234567", 0, 8, 98, 1, "Example of EAN-8 with 2-digit addon, CC-A 3 cols, 4 rows", + /* 77*/ { BARCODE_EANX_CC, -1, 1, "9876543+65", "[91]1234567", 0, 8, 98, 1, "Example of EAN-8 with 2-digit addon, CC-A 3 cols, 4 rows", "10010001111100110101001100011100010111001100110001011101000001110100110100000000000000000000000000" "11011111100110100101011100011011110010110000111100010011110101110101110100000000000000000000000000" "10000101100000110101011000010101111101111100111010010000111001110101100100000000000000000000000000" @@ -1497,7 +1502,7 @@ static void test_examples(const testCtx *const p_ctx) { "00001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000" "00001010001011011011101110110101111010101001110101110010000101110010101000000010110101111010111001" }, - /* 77*/ { BARCODE_EANX_CC, -1, 2, "9876543+74083", "[91]123456789012345678", 0, 12, 135, 1, "Example of EAN-8 with 5-digit addon, CC-B 3 cols, 8 rows", + /* 78*/ { BARCODE_EANX_CC, -1, 2, "9876543+74083", "[91]123456789012345678", 0, 12, 135, 1, "Example of EAN-8 with 5-digit addon, CC-B 3 cols, 8 rows", "110011101011101111101110100100001011010000010000100010111110110100111101100111010100000000000000000000000000000000000000000000000000000" "111011101011001011100001000100001001011100101100100000111000110111010001110111010100000000000000000000000000000000000000000000000000000" "111001101011011111100110100100001101010100010111100000110010011011111101110011010100000000000000000000000000000000000000000000000000000" @@ -1511,7 +1516,7 @@ static void test_examples(const testCtx *const p_ctx) { "000000000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000" "000000000000001010001011011011101110110101111010101001110101110010000101110010101000000010110111011010011101010001101010110111010100001" }, - /* 78*/ { BARCODE_EANX_CC, -1, 1, "1234567890128+65", "[91]1234567", 0, 7, 125, 1, "Example of EAN-13 + CHK with 2-digit addon, CC-A 3 cols, 4 rows", + /* 79*/ { BARCODE_EANX_CC, -1, 1, "1234567890128+65", "[91]1234567", 0, 7, 125, 1, "Example of EAN-13 + CHK with 2-digit addon, CC-A 3 cols, 4 rows", "11011011101111001101001110010111011100010000100111010010111011100100000110000110010100001101100010100000000000000000000000000" "11011011001001100101111110011111011001000010100110010011111101110010100110101110001000001100100010100000000000000000000000000" "11011010001101011111100100011011101000011100100110011010001001001111000101000011011111001110100010100000000000000000000000000" @@ -1521,7 +1526,7 @@ static void test_examples(const testCtx *const p_ctx) { "00010100100110111101001110101100010000101001000101010100100011101001110010110011011011001001000101000000010110101111010111001" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; struct zint_symbol *symbol = NULL; @@ -1603,7 +1608,7 @@ static void test_odd_numbered_numeric(const testCtx *const p_ctx) { char *expected; }; /* Verified via bwipp_dump.ps against BWIPP, and manually against tec-it.com */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]1234567890123", 0, 9, 55, "Test odd-numbered numeric, 1st fit, 9-bit remainder, 7-bit final, 2-bit alphanumeric latch, no padding", "1101100110111011101011110001001111100110010011110101001" "1101101110110001100001000101100010000100110011100101001" @@ -1697,7 +1702,7 @@ static void test_odd_numbered_numeric(const testCtx *const p_ctx) { "0001010010011011110101000110111001000010100100010101010" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; struct zint_symbol *symbol = NULL; @@ -1768,7 +1773,7 @@ static void test_ean128_cc_shift(const testCtx *const p_ctx) { char *expected; }; /* Verified via bwipp_dump.ps against BWIPP except where noted, when shift verified manually (tec-it.com seems to be off by 2 for top shifts > 1) */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_GS1_128_CC, -1, "[91]1", "[21]A1B2C3D4E5F6G7H8", 0, 6, 100, 1, "CC-A alignment, bottom shift 10", "1101001000110100001000001101101011110111110010010001101010000010010000011101110100010000111011001010" "1101011000110101111001100001111010001101100010010000101111000011001101011100101100001000110011001010" @@ -1826,7 +1831,7 @@ static void test_ean128_cc_shift(const testCtx *const p_ctx) { "1101001110011110101110111101101101011001110010001011000111000101101100001010011011110110101111011101001110011010111011110100110100001100011101011" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; struct zint_symbol *symbol = NULL; @@ -1897,7 +1902,7 @@ static void test_ean128_cc_width(const testCtx *const p_ctx) { char *comment; }; /* Verified manually with BWIPP (except very large tests) */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "[91]1", "[02]13012345678909", 0, 11, 103, "" }, /* 1*/ { "[91]12", "[02]13012345678909", 0, 20, 86, "" }, /* 2*/ { "[91]123", "[02]13012345678909", 0, 11, 108, "" }, @@ -1912,7 +1917,7 @@ static void test_ean128_cc_width(const testCtx *const p_ctx) { /*11*/ { "[00]123456789012345675", "[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345" "675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[91]1234567890", 0, 32, 579, "With composite 2372 digits == max" }, /*12*/ { "[00]123456789012345675", "[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345" "675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[91]12345678901", ZINT_ERROR_TOO_LONG, 0, 0, "With composite 2373 digits > max" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; struct zint_symbol *symbol = NULL; @@ -1965,7 +1970,7 @@ static void test_encodation_0(const testCtx *const p_ctx) { char *expected; }; /* Verified via bwipp_dump.ps against BWIPP and manually against tec-it.com (with noted exception) */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_UPCE_CC, 1, "1234567", "[91]1", 0, 9, 55, "Single numeric", "1101100110111101110101111101010001000111100011110101001" "1101101110111011000010001101110010101110000011100101001" @@ -2374,7 +2379,7 @@ static void test_encodation_0(const testCtx *const p_ctx) { "0001010010011011110101000110111001000010100100010101010" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; struct zint_symbol *symbol = NULL; @@ -2444,7 +2449,7 @@ static void test_encodation_10(const testCtx *const p_ctx) { char *expected; }; /* Verified via bwipp_dump.ps against BWIPP, and manually, with noted exceptions, against tec-it.com */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_UPCE_CC, 1, "1234567", "[11]201001[10]AB1234", 0, 9, 55, "Mode '10' date + even-numbered numeric lot, 1st fit, alphanumeric latch and padding", "1101100110101110000100011001001000100111100011110101001" "1101101110110010100011000001100110010000001011100101001" @@ -2512,7 +2517,7 @@ static void test_encodation_10(const testCtx *const p_ctx) { "0001010010011011110101000110111001000010100100010101010" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; struct zint_symbol *symbol = NULL; @@ -2582,7 +2587,7 @@ static void test_encodation_11(const testCtx *const p_ctx) { char *expected; }; /* Verified via bwipp_dump.ps against BWIPP, and manually against tec-it.com (with noted exception) */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]A", 0, 9, 55, "Mode '11', letter prefix only", "1101100110100111100000101001110110010011111011110101001" "1101101110110001000101100001100011010010000011100101001" @@ -2715,8 +2720,8 @@ static void test_encodation_11(const testCtx *const p_ctx) { "0001000000000000000000000000000000000000000000000000010" "0001010010011011110101000110111001000010100100010101010" }, - /*12*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]1AB#D", ZINT_ERROR_INVALID_DATA, 0, 0, "Mode '11', invalid char [90]", "" }, - /*13*/ { BARCODE_UPCE_CC, 2, "1234567", "[90]1AB#D", ZINT_ERROR_INVALID_DATA, 0, 0, "Mode '11', invalid char [90]", "" }, + /*12*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]1AB#D", ZINT_ERROR_INVALID_DATA, 0, 0, "Mode '11', invalid char [90]", "Error 441: Invalid character in input (2D component)" }, + /*13*/ { BARCODE_UPCE_CC, 2, "1234567", "[90]1AB#D", ZINT_ERROR_INVALID_DATA, 0, 0, "Mode '11', invalid char [90]", "Error 441: Invalid character in input (2D component)" }, /*14*/ { BARCODE_UPCE_CC, 1, "1234567", "[90]A12345[21]AB", 0, 10, 55, "Mode '11', numeric [90], with [21]", "1100100010111000111011011001001100011000010011100101101" "1110100010101000001111001001111100110100010011000101101" @@ -2928,7 +2933,7 @@ static void test_encodation_11(const testCtx *const p_ctx) { "0001010010011011110101000110111001000010100100010101010" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; struct zint_symbol *symbol = NULL; @@ -2999,7 +3004,7 @@ static void test_addongap(const testCtx *const p_ctx) { char *expected; }; /* Verified via bwipp_dump.ps against BWIPP */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_EANX_CC, 1, -1, "1234567+12", 0, 8, 98, "EAN-8 default 7 gap", "10010001111100110101001100011110001011001100110110011110000101110100110100000000000000000000000000" "10000011100101100101011100010111100010001000100000100101111001110101110100000000000000000000000000" @@ -3079,7 +3084,7 @@ static void test_addongap(const testCtx *const p_ctx) { "00010100100110111101010001101110010000101001000101010100000000000010110011001010010011" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; struct zint_symbol *symbol = NULL; @@ -3153,7 +3158,7 @@ static void test_gs1parens(const testCtx *const p_ctx) { int expected_width; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_EANX_CC, -1, "1234567", "[21]A12345678", 0, 8, 72 }, /* EAN-8 */ /* 1*/ { BARCODE_EANX_CC, GS1PARENS_MODE, "1234567", "(21)A12345678", 0, 8, 72 }, /* EAN-8 */ /* 2*/ { BARCODE_EANX_CC, -1, "123456789012", "[21]A12345678", 0, 7, 99 }, /* EAN-13 */ @@ -3177,7 +3182,7 @@ static void test_gs1parens(const testCtx *const p_ctx) { /* 20*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[3103]001234", "[21]A12345678", 0, 9, 102 }, /* 21*/ { BARCODE_DBAR_EXPSTK_CC, GS1PARENS_MODE, "(01)12345678901231(3103)001234", "(21)A12345678", 0, 9, 102 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; struct zint_symbol *symbol = NULL; @@ -3199,10 +3204,8 @@ static void test_gs1parens(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); - 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->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); - } + 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); ZBarcode_Delete(symbol); } @@ -3223,7 +3226,7 @@ static void test_hrt(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_EANX_CC, -1, "1234567", "[20]12", 0, "12345670" }, /* EAN-8 */ /* 1*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]12", 0, "1234567890128" }, /* EAN-13 */ /* 2*/ { BARCODE_EANX_CC, -1, "1234567890128", "[20]12", 0, "1234567890128" }, @@ -3260,7 +3263,7 @@ static void test_hrt(const testCtx *const p_ctx) { /* 33*/ { BARCODE_DBAR_STK_CC, -1, "12345678901231", "[20]12", 0, "" }, /* No HRT for stacked symbologies */ /* 34*/ { BARCODE_DBAR_OMNSTK_CC, -1, "12345678901231", "[20]12", 0, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; struct zint_symbol *symbol = NULL; @@ -3309,109 +3312,109 @@ static void test_input(const testCtx *const p_ctx) { char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567", "[20]12", 0, 8, 72, "" }, /* EAN-8 */ - /* 1*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "123456A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, /* EAN-8 */ - /* 2*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, /* Linear component still checked */ - /* 3*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567", "[20]1A", ZINT_WARN_NONCOMPLIANT, 8, 72, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, + /* 1*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "123456A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character at position 7 in input (digits and \"+\" only) (linear component)" }, /* EAN-8 */ + /* 2*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character at position 7 in input (digits and \"+\" only) (linear component)" }, /* Linear component still checked */ + /* 3*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567", "[20]1A", ZINT_WARN_NONCOMPLIANT, 8, 72, "Warning 261: AI (20) position 2: Non-numeric character 'A' (2D component)" }, /* 4*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567", "[20]1A", 0, 8, 72, "" }, - /* 5*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 8, 72, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 5*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 8, 72, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' (2D component)" }, /* 6*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567", "[02]12345678901234", 0, 8, 72, "" }, /* 7*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "12345671", "[20]12", 0, 7, 99, "" }, /* EAN-13 for EANX_CC as length 8 only EAN-8 for EANX_CHK */ /* 8*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "123456789012", "[20]12", 0, 7, 99, "" }, /* EAN-13 */ /* 9*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890128", "[20]12", 0, 7, 99, "" }, /* EAN-13 */ - /* 10*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 275: Invalid check digit '3', expecting '8' in linear component" }, - /* 11*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 275: Invalid check digit '3', expecting '8' in linear component" }, /* Linear component still checked */ - /* 12*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "12345678901234", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 448: Input too long (13 character maximum) in linear component" }, - /* 13*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901234", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 448: Input too long (13 character maximum) in linear component" }, - /* 14*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "123456789012A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, - /* 15*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, - /* 16*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890128", "[20]1A", ZINT_WARN_NONCOMPLIANT, 7, 99, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, /* AI (20) should be 2 nos. */ + /* 10*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 275: Invalid check digit '3', expecting '8' (linear component)" }, + /* 11*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 275: Invalid check digit '3', expecting '8' (linear component)" }, /* Linear component still checked */ + /* 12*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "12345678901234", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 294: Input length 14 too long (maximum 13) (linear component)" }, + /* 13*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901234", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 294: Input length 14 too long (maximum 13) (linear component)" }, + /* 14*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "123456789012A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character at position 13 in input (digits and \"+\" only) (linear component)" }, + /* 15*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character at position 13 in input (digits and \"+\" only) (linear component)" }, + /* 16*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890128", "[20]1A", ZINT_WARN_NONCOMPLIANT, 7, 99, "Warning 261: AI (20) position 2: Non-numeric character 'A' (2D component)" }, /* AI (20) should be 2 nos. */ /* 17*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890128", "[20]1A", 0, 7, 99, "" }, - /* 18*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890128", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 7, 99, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 18*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890128", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 7, 99, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' (2D component)" }, /* 19*/ { BARCODE_EANX_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890128", "[02]12345678901234", 0, 7, 99, "" }, /* 20*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890128", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567", 0, 48, 99, "" }, /* Max CC-B for EAN-13 */ - /* 21*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890128", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]1234567890123456789012345678901234567890123456789012345678", ZINT_ERROR_TOO_LONG, -1, -1, "Error 444: Input too long for selected 2D component" }, + /* 21*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "1234567890128", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]1234567890123456789012345678901234567890123456789012345678", ZINT_ERROR_TOO_LONG, -1, -1, "Error 444: Input too long (2D component)" }, /* 22*/ { BARCODE_EANX_CC, -1, 3, -1, -1, "1234567890128", "[20]12", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 447: Invalid mode (CC-C only valid with GS1-128 linear component)" }, - /* 23*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "123456789012345678901", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 449: Input wrong length in linear component" }, + /* 23*/ { BARCODE_EANX_CC, -1, -1, -1, -1, "123456789012345678901", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 449: Input length 21 wrong (linear component)" }, /* 24*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "1234567890123", "[20]12", 0, 5, 100, "" }, /* 25*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "12345678901231", "[20]12", 0, 5, 100, "" }, - /* 26*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, - /* 27*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, /* Linear component still checked */ - /* 28*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum) in linear component" }, - /* 29*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum) in linear component" }, - /* 30*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only) in linear component" }, - /* 31*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only) in linear component" }, - /* 32*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, 5, 100, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, /* AI (20) should be 2 nos. */ + /* 26*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' (linear component)" }, + /* 27*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' (linear component)" }, /* Linear component still checked */ + /* 28*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14) (linear component)" }, + /* 29*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14) (linear component)" }, + /* 30*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 14 in input (digits only) (linear component)" }, + /* 31*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 14 in input (digits only) (linear component)" }, + /* 32*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, 5, 100, "Warning 261: AI (20) position 2: Non-numeric character 'A' (2D component)" }, /* AI (20) should be 2 nos. */ /* 33*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[20]1A", 0, 5, 100, "" }, - /* 34*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 5, 100, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 34*/ { BARCODE_DBAR_OMN_CC, -1, -1, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 5, 100, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' (2D component)" }, /* 35*/ { BARCODE_DBAR_OMN_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[02]12345678901234", 0, 5, 100, "" }, /* 36*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "1234567890123", "[20]12", 0, 6, 79, "" }, /* 37*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "12345678901231", "[20]12", 0, 6, 79, "" }, - /* 38*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '2', expecting '1' in linear component" }, - /* 39*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '2', expecting '1' in linear component" }, /* Linear component still checked */ - /* 40*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "123456789012345", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input too long (14 character maximum) in linear component" }, - /* 41*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012345", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input too long (14 character maximum) in linear component" }, - /* 42*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "A1234567890123", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character in data (digits only) in linear component" }, - /* 43*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, -1, -1, "A1234567890123", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character in data (digits only) in linear component" }, - /* 44*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, 6, 79, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, /* AI (20) should be 2 nos. */ + /* 38*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '2', expecting '1' (linear component)" }, + /* 39*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '2', expecting '1' (linear component)" }, /* Linear component still checked */ + /* 40*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "123456789012345", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input length 15 too long (maximum 14) (linear component)" }, + /* 41*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012345", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input length 15 too long (maximum 14) (linear component)" }, + /* 42*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "A1234567890123", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character at position 1 in input (digits only) (linear component)" }, + /* 43*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, -1, -1, "A1234567890123", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character at position 1 in input (digits only) (linear component)" }, + /* 44*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, 6, 79, "Warning 261: AI (20) position 2: Non-numeric character 'A' (2D component)" }, /* AI (20) should be 2 nos. */ /* 45*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[20]1A", 0, 6, 79, "" }, - /* 46*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 6, 79, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 46*/ { BARCODE_DBAR_LTD_CC, -1, -1, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 6, 79, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' (2D component)" }, /* 47*/ { BARCODE_DBAR_LTD_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[02]12345678901234", 0, 6, 79, "" }, /* 48*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "12345678901", "[20]12", 0, 7, 99, "" }, /* 49*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "123456789012", "[20]12", 0, 7, 99, "" }, - /* 50*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 270: Invalid check digit '3', expecting '2' in linear component" }, - /* 51*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 270: Invalid check digit '3', expecting '2' in linear component" }, /* Linear component still checked */ - /* 52*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 289: Input wrong length (12 character maximum) in linear component" }, - /* 53*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 289: Input wrong length (12 character maximum) in linear component" }, - /* 54*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "12345678901A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, - /* 55*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, - /* 56*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "123456789012", "[20]1A", ZINT_WARN_NONCOMPLIANT, 7, 99, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, /* AI (20) should be 2 nos. */ + /* 50*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 270: Invalid check digit '3', expecting '2' (linear component)" }, + /* 51*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789013", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 270: Invalid check digit '3', expecting '2' (linear component)" }, /* Linear component still checked */ + /* 52*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 289: Input length 13 wrong (11 or 12 only) (linear component)" }, + /* 53*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 289: Input length 13 wrong (11 or 12 only) (linear component)" }, + /* 54*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "12345678901A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character at position 12 in input (digits and \"+\" only) (linear component)" }, + /* 55*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character at position 12 in input (digits and \"+\" only) (linear component)" }, + /* 56*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "123456789012", "[20]1A", ZINT_WARN_NONCOMPLIANT, 7, 99, "Warning 261: AI (20) position 2: Non-numeric character 'A' (2D component)" }, /* AI (20) should be 2 nos. */ /* 57*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012", "[20]1A", 0, 7, 99, "" }, - /* 58*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "123456789012", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 7, 99, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 58*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, "123456789012", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 7, 99, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' (2D component)" }, /* 59*/ { BARCODE_UPCA_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012", "[02]12345678901234", 0, 7, 99, "" }, /* 60*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "123456", "[20]12", 0, 9, 55, "" }, /* 61*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "1234567", "[20]12", 0, 9, 55, "" }, /* 62*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "12345670", "[20]12", 0, 9, 55, "" }, /* Check digit can now be given for UPCE_CC, like UPCA_CC */ - /* 63*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "12345671", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 274: Invalid check digit '1', expecting '0' in linear component" }, - /* 64*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345671", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 274: Invalid check digit '1', expecting '0' in linear component" }, /* Linear component still checked */ - /* 65*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "123456712", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 291: Input wrong length (8 character maximum) in linear component" }, - /* 66*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456712", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 291: Input wrong length (8 character maximum) in linear component" }, - /* 67*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "1234567A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, - /* 68*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component" }, - /* 69*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "1234567", "[20]1A", ZINT_WARN_NONCOMPLIANT, 9, 55, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, /* AI (20) should be 2 nos. */ + /* 63*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "12345671", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 274: Invalid check digit '1', expecting '0' (linear component)" }, + /* 64*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345671", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 274: Invalid check digit '1', expecting '0' (linear component)" }, /* Linear component still checked */ + /* 65*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "123456712", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 291: Input length 9 wrong (6, 7 or 8 only) (linear component)" }, + /* 66*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456712", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 291: Input length 9 wrong (6, 7 or 8 only) (linear component)" }, + /* 67*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "1234567A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character at position 8 in input (digits and \"+\" only) (linear component)" }, + /* 68*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 284: Invalid character at position 8 in input (digits and \"+\" only) (linear component)" }, + /* 69*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "1234567", "[20]1A", ZINT_WARN_NONCOMPLIANT, 9, 55, "Warning 261: AI (20) position 2: Non-numeric character 'A' (2D component)" }, /* AI (20) should be 2 nos. */ /* 70*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567", "[20]1A", 0, 9, 55, "" }, - /* 71*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "1234567", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 9, 55, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 71*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, "1234567", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 9, 55, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' (2D component)" }, /* 72*/ { BARCODE_UPCE_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567", "[02]12345678901234", 0, 9, 55, "" }, /* 73*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "1234567890123", "[20]12", 0, 9, 56, "" }, /* 74*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "12345678901231", "[20]12", 0, 9, 56, "" }, - /* 75*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, - /* 76*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, /* Linear component still checked */ - /* 77*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "123456789012323", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum) in linear component" }, - /* 78*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012323", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum) in linear component" }, - /* 79*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only) in linear component" }, - /* 80*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only) in linear component" }, - /* 81*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, 9, 56, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, /* AI (20) should be 2 nos. */ + /* 75*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' (linear component)" }, + /* 76*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' (linear component)" }, /* Linear component still checked */ + /* 77*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "123456789012323", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14) (linear component)" }, + /* 78*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012323", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14) (linear component)" }, + /* 79*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 14 in input (digits only) (linear component)" }, + /* 80*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 14 in input (digits only) (linear component)" }, + /* 81*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, 9, 56, "Warning 261: AI (20) position 2: Non-numeric character 'A' (2D component)" }, /* AI (20) should be 2 nos. */ /* 82*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[20]1A", 0, 9, 56, "" }, - /* 83*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 9, 56, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 83*/ { BARCODE_DBAR_STK_CC, -1, -1, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 9, 56, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' (2D component)" }, /* 84*/ { BARCODE_DBAR_STK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[02]12345678901234", 0, 9, 56, "" }, /* 85*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "1234567890123", "[20]12", 0, 11, 56, "" }, /* 86*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "12345678901231", "[20]12", 0, 11, 56, "" }, - /* 87*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, - /* 88*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' in linear component" }, /* Linear component still checked */ - /* 89*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum) in linear component" }, - /* 90*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum) in linear component" }, - /* 91*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only) in linear component" }, - /* 92*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only) in linear component" }, - /* 93*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, 11, 56, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, /* AI (20) should be 2 nos. */ + /* 87*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' (linear component)" }, + /* 88*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901232", "[20]12", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '2', expecting '1' (linear component)" }, /* Linear component still checked */ + /* 89*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14) (linear component)" }, + /* 90*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "123456789012312", "[20]12", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14) (linear component)" }, + /* 91*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 14 in input (digits only) (linear component)" }, + /* 92*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "1234567890123A", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 14 in input (digits only) (linear component)" }, + /* 93*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, 11, 56, "Warning 261: AI (20) position 2: Non-numeric character 'A' (2D component)" }, /* AI (20) should be 2 nos. */ /* 94*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[20]1A", 0, 11, 56, "" }, - /* 95*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 11, 56, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' in 2D component" }, + /* 95*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 11, 56, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' (2D component)" }, /* 96*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[02]12345678901234", 0, 11, 56, "" }, /* 97*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "", "[20]12", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 445: No primary (linear) message" }, /* 98*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 31, 273, "" }, /* Tries CC-A then CC-B then CC-C - ensure errtxt empty */ - /* 99*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123", ZINT_WARN_NONCOMPLIANT, 29, 702, "Warning 843: GS1-128 input too long (48 character maximum) in linear component" }, /* Overlarge linear and CC-C input */ - /*100*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1,"[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[97]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[98]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[99]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL", ZINT_ERROR_TOO_LONG, -1, -1, "Error 442: Input too long for selected 2D component" }, /* Overlarge linear and oversized CC-C input */ - /*101*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231", "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[97]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[98]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[99]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI" "JKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLM", ZINT_ERROR_TOO_LONG, -1, -1, "Error 446: 2D component input data too long" }, /* Reduced length 2291 */ + /* 99*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123", ZINT_WARN_NONCOMPLIANT, 29, 702, "Warning 843: Input too long, requires 115 characters (maximum 48) (linear component)" }, /* Overlarge linear and CC-C input */ + /*100*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[97]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[98]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[99]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL", ZINT_ERROR_TOO_LONG, -1, -1, "Error 442: Input too long (2D component)" }, /* Overlarge linear and oversized CC-C input */ + /*101*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231", "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[97]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[98]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[99]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI" "JKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLM", ZINT_ERROR_TOO_LONG, -1, -1, "Error 446: 2D component input too long, requires 2991 characters (maximum 2990)" }, /* Reduced length 2291 */ /*102*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231", "[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012" "345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[11]121212[20]12", 0, 32, 579, "" }, /* Reduced length 2372 digits (no FNC1s) with not recommended ECC 4 > 2361 digit limit given in ISO/IEC 24723:2010 4.1 (d)(2)(iii) */ /*103*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, -1, -1, "[91]1234567890123456789012345678901234", "[20]12", 0, 13, 102, "" }, /*104*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, 1, -1, "[91]1234567890123456789012345678901234", "[20]12", 0, 13, 102, "" }, @@ -3422,7 +3425,7 @@ static void test_input(const testCtx *const p_ctx) { /*109*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, -1, 3, "[91]1234567890123456789012345678901234", "[20]12", 0, 13, 102, "" }, /*110*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, -1, 4, "[91]1234567890123456789012345678901234", "[20]12", 0, 13, 102, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; struct zint_symbol *symbol = NULL; @@ -3474,20 +3477,20 @@ static void test_fuzz(const testCtx *const p_ctx) { char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { BARCODE_EANX_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 448: Input too long (5 character maximum for add-on) in linear component", "" }, - /* 1*/ { BARCODE_UPCA_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 294: Input too long (5 character maximum for add-on) in linear component", "" }, - /* 2*/ { BARCODE_UPCE_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 294: Input too long (5 character maximum for add-on) in linear component", "" }, + static const struct item data[] = { + /* 0*/ { BARCODE_EANX_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 297: Input add-on length 18 too long (maximum 5) (linear component)", "" }, + /* 1*/ { BARCODE_UPCA_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 297: Input add-on length 18 too long (maximum 5) (linear component)", "" }, + /* 2*/ { BARCODE_UPCE_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 297: Input add-on length 18 too long (maximum 5) (linear component)", "" }, /* 3*/ { BARCODE_EANX_CC, -1, -1, "+12345", -1, "[21]A12345678", 0 , 0, "", "BWIPP checks for proper EAN data" }, - /* 4*/ { BARCODE_EANX_CC, -1, -1, "+123456", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 448: Input too long (5 character maximum for add-on) in linear component", "" }, - /* 5*/ { BARCODE_EANX_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "kks", -1, "()111%", ZINT_ERROR_INVALID_DATA, 1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component", "" }, /* #300 (#5), Andre Maute (`dbar_date()` not checking length + other non-checks) */ - /* 6*/ { BARCODE_UPCA_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\153\153\153\153\153\153\153\153\163", -1, "()90", ZINT_ERROR_TOO_LONG, 1, "Error 283: Input too long (19 character maximum) in linear component", "" }, /* #300 (#6), Andre Maute (`dbar_date()` not checking length + other non-checks) */ - /* 7*/ { BARCODE_UPCA_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\377\002\000\000\153\153\153\153\163\000\000\000\153\153\153\153\153\153\153\060\047\047\043\047\057\153\153\153\153\153\000\000\000\000\153\153\153\161\153\153\153\153\153\153\153\153\153\153\153\153\153\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\001\100\000\000\000\000\000\000\000\167\167\167\167\167\167\167\167\167\167\167\167\167\167", 127, "()904OOOOO)CK0336680OOOOOOOOOOOOOO29[0kkkk%%%%(", ZINT_ERROR_INVALID_DATA, 1, "Error 253: Malformed AI in input data (brackets don't match) in 2D component", "" }, /* #300 (#11), Andre Maute (`gs1_verify()` not checking length on resolve AI data loop) */ - /* 8*/ { BARCODE_EANX_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\377\002\000\000\153\153\153\153\163\000\000\000\153\153\153\153\153\153\153\060\047\047\043\047\057\153\153\153\153\153\000\000\000\000\153\153\153\161\153\153\153\153\153\153\153\153\153\153\153\153\153\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\001\100\000\000\000\000\000\000\000\167\167\167\167\167\167\167\167\167\167\167\167\167\167", 127, "()904OOOOO)CK0336680OOOOOOOOOOOOOO29[0kkkk%%%%(", ZINT_ERROR_INVALID_DATA, 1, "Error 253: Malformed AI in input data (brackets don't match) in 2D component", "" }, /* #300 (#11 with EANX_CC) */ + /* 4*/ { BARCODE_EANX_CC, -1, -1, "+123456", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 297: Input add-on length 6 too long (maximum 5) (linear component)", "" }, + /* 5*/ { BARCODE_EANX_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "kks", -1, "()111%", ZINT_ERROR_INVALID_DATA, 1, "Error 284: Invalid character at position 1 in input (digits and \"+\" only) (linear component)", "" }, /* #300 (#5), Andre Maute (`dbar_date()` not checking length + other non-checks) */ + /* 6*/ { BARCODE_UPCA_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\153\153\153\153\153\153\153\153\163", -1, "()90", ZINT_ERROR_TOO_LONG, 1, "Error 283: Input length 46 too long (maximum 19) (linear component)", "" }, /* #300 (#6), Andre Maute (`dbar_date()` not checking length + other non-checks) */ + /* 7*/ { BARCODE_UPCA_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\377\002\000\000\153\153\153\153\163\000\000\000\153\153\153\153\153\153\153\060\047\047\043\047\057\153\153\153\153\153\000\000\000\000\153\153\153\161\153\153\153\153\153\153\153\153\153\153\153\153\153\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\001\100\000\000\000\000\000\000\000\167\167\167\167\167\167\167\167\167\167\167\167\167\167", 127, "()904OOOOO)CK0336680OOOOOOOOOOOOOO29[0kkkk%%%%(", ZINT_ERROR_INVALID_DATA, 1, "Error 253: Malformed AI in input (brackets don't match) (2D component)", "" }, /* #300 (#11), Andre Maute (`gs1_verify()` not checking length on resolve AI data loop) */ + /* 8*/ { BARCODE_EANX_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\377\002\000\000\153\153\153\153\163\000\000\000\153\153\153\153\153\153\153\060\047\047\043\047\057\153\153\153\153\153\000\000\000\000\153\153\153\161\153\153\153\153\153\153\153\153\153\153\153\153\153\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\001\100\000\000\000\000\000\000\000\167\167\167\167\167\167\167\167\167\167\167\167\167\167", 127, "()904OOOOO)CK0336680OOOOOOOOOOOOOO29[0kkkk%%%%(", ZINT_ERROR_INVALID_DATA, 1, "Error 253: Malformed AI in input (brackets don't match) (2D component)", "" }, /* #300 (#11 with EANX_CC) */ /* 9*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, 3, "[]28", -1, "[]RRR___________________KKKRRR0000", 0, 1, "", "" }, /* #300 (#13), Andre Maute (`calc_padding_ccc()` dividing by zero when linear width == 68) */ /*10*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, 3, "[]2", -1, "[]RRR___________________KKKRRR0000", 0, 1, "", "" }, /* #300 (#13 shortened to min linear input (but same linear width 68)) */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; struct zint_symbol *symbol = NULL; @@ -3558,7 +3561,7 @@ static void test_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_EANX_CC, 1, "123456789012", "[91]123456789012345678901234567890123456789012345678901234", 0, 11, 99, "58 chars CC-A" }, @@ -3577,7 +3580,7 @@ static void test_perf(const testCtx *const p_ctx) { "[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 32, 205, "564 chars CC-C" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; clock_t start, total_encode = 0, total_buffer = 0, diff_encode, diff_buffer; diff --git a/backend/tests/test_dmatrix.c b/backend/tests/test_dmatrix.c index 59b696f8..f4a77bba 100644 --- a/backend/tests/test_dmatrix.c +++ b/backend/tests/test_dmatrix.c @@ -44,317 +44,321 @@ static void test_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; + char *expected_errtxt2; + char *comment; }; /* ISO/IEC 16022:2006 Table 7 and ISO/IEC 21471:2020 (DMRE) Table 7 */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "1", 3116, 0, 144, 144 }, - /* 1*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "1", 3117, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "1", 10922, ZINT_ERROR_TOO_LONG, -1, -1 }, /* Minimal encoding can handle max (10921 + 1) * 6 = 65532 < 65536 (2*16) due to sizeof(previous) */ - /* 3*/ { BARCODE_DATAMATRIX, -1, { 1, 2, "001001"}, "1", 3108, 0, 144, 144 }, /* Structured Append 4 codewords overhead == 8 digits */ - /* 4*/ { BARCODE_DATAMATRIX, -1, { 1, 2, "001001"}, "1", 3109, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 5*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "A", 2335, 0, 144, 144 }, - /* 6*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "A", 2336, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 7*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "\200", 1556, 0, 144, 144 }, /* Spec says 1555 but 1556 correct as only single byte count of 0 required */ - /* 8*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "\200", 1557, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 9*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "\001", 1558, 0, 144, 144 }, - /* 10*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "\001", 1559, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 11*/ { BARCODE_HIBC_DM, -1, { 0, 0, "" }, "1", 110, 0, 32, 32 }, - /* 12*/ { BARCODE_HIBC_DM, -1, { 0, 0, "" }, "1", 111, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 13*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "1", 6, 0, 10, 10 }, - /* 14*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "1", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 15*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "A", 3, 0, 10, 10 }, - /* 16*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "A", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 17*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "\200", 1, 0, 10, 10 }, - /* 18*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "\200", 2, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 19*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "1", 10, 0, 12, 12 }, - /* 20*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "1", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 21*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "A", 6, 0, 12, 12 }, - /* 22*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "A", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 23*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "\200", 3, 0, 12, 12 }, - /* 24*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "\200", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 25*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "1", 16, 0, 14, 14 }, - /* 26*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "1", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 27*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "A", 10, 0, 14, 14 }, - /* 28*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "A", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 29*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "\200", 6, 0, 14, 14 }, - /* 30*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "\200", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 31*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "1", 24, 0, 16, 16 }, - /* 32*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "1", 25, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 33*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "A", 16, 0, 16, 16 }, - /* 34*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "A", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 35*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "\200", 10, 0, 16, 16 }, - /* 36*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "\200", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 37*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "1", 36, 0, 18, 18 }, - /* 38*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "1", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 39*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "A", 25, 0, 18, 18 }, - /* 40*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "A", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 41*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "\200", 16, 0, 18, 18 }, - /* 42*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "\200", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 43*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "1", 44, 0, 20, 20 }, - /* 44*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 45*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "A", 31, 0, 20, 20 }, - /* 46*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "A", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 47*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "\200", 20, 0, 20, 20 }, - /* 48*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "\200", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 49*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "1", 60, 0, 22, 22 }, - /* 50*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "1", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 51*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "A", 43, 0, 22, 22 }, - /* 52*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "A", 44, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 53*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "\200", 28, 0, 22, 22 }, - /* 54*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "\200", 29, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 55*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "1", 72, 0, 24, 24 }, - /* 56*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "1", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 57*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "A", 52, 0, 24, 24 }, - /* 58*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "A", 53, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 59*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "\200", 34, 0, 24, 24 }, - /* 60*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "\200", 35, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 61*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "1", 88, 0, 26, 26 }, - /* 62*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 63*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "A", 64, 0, 26, 26 }, - /* 64*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 65*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "\200", 42, 0, 26, 26 }, - /* 66*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 67*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "1", 124, 0, 32, 32 }, - /* 68*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "1", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 69*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "A", 91, 0, 32, 32 }, - /* 70*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "A", 92, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 71*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "\200", 60, 0, 32, 32 }, - /* 72*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "\200", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 73*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "1", 172, 0, 36, 36 }, - /* 74*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "1", 173, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 75*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "A", 127, 0, 36, 36 }, - /* 76*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "A", 128, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 77*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "\200", 84, 0, 36, 36 }, - /* 78*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "\200", 85, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 79*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "1", 228, 0, 40, 40 }, - /* 80*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "1", 229, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 81*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "A", 169, 0, 40, 40 }, - /* 82*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "A", 170, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 83*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "\200", 112, 0, 40, 40 }, - /* 84*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "\200", 113, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 85*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "1", 288, 0, 44, 44 }, - /* 86*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "1", 289, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 87*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "A", 214, 0, 44, 44 }, - /* 88*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "A", 215, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 89*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "\200", 142, 0, 44, 44 }, - /* 90*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "\200", 143, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 91*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "1", 348, 0, 48, 48 }, - /* 92*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "1", 349, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 93*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "A", 259, 0, 48, 48 }, - /* 94*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "A", 260, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 95*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "\200", 172, 0, 48, 48 }, - /* 96*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "\200", 173, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 97*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "1", 408, 0, 52, 52 }, - /* 98*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "1", 409, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 99*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "A", 304, 0, 52, 52 }, - /*100*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "A", 305, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*101*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "\200", 202, 0, 52, 52 }, - /*102*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "\200", 203, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*103*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "1", 560, 0, 64, 64 }, - /*104*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "1", 561, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*105*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "A", 418, 0, 64, 64 }, - /*106*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "A", 419, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*107*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "\200", 278, 0, 64, 64 }, /* Spec says 277 but 278 correct as only single byte count of 0 required */ - /*108*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "\200", 279, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*109*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "1", 736, 0, 72, 72 }, - /*110*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "1", 737, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*111*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "A", 550, 0, 72, 72 }, - /*112*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "A", 551, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*113*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "\200", 366, 0, 72, 72 }, /* Spec says 365 but 366 correct as only single byte count of 0 required */ - /*114*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "\200", 367, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*115*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "1", 912, 0, 80, 80 }, - /*116*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "1", 913, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*117*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "A", 682, 0, 80, 80 }, - /*118*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "A", 683, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*119*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "\200", 454, 0, 80, 80 }, /* Spec says 453 but 454 correct as only single byte count of 0 required */ - /*120*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "\200", 455, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*121*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "1", 1152, 0, 88, 88 }, - /*122*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "1", 1153, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*123*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "A", 862, 0, 88, 88 }, - /*124*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "A", 863, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*125*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "\200", 574, 0, 88, 88 }, /* Spec says 573 but 574 correct as only single byte count of 0 required */ - /*126*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "\200", 575, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*127*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "1", 1392, 0, 96, 96 }, - /*128*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "1", 1393, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*129*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "A", 1042, 0, 96, 96 }, - /*130*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "A", 1043, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*131*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "\200", 694, 0, 96, 96 }, /* Spec says 693 but 694 correct as only single byte count of 0 required */ - /*132*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "\200", 695, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*133*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "1", 1632, 0, 104, 104 }, - /*134*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "1", 1633, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*135*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "A", 1222, 0, 104, 104 }, - /*136*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "A", 1223, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*137*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "\200", 814, 0, 104, 104 }, /* Spec says 813 but 814 correct as only single byte count of 0 required */ - /*138*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "\200", 815, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*139*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "1", 2100, 0, 120, 120 }, - /*140*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "1", 2101, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*141*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "A", 1573, 0, 120, 120 }, - /*142*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "A", 1574, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*143*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "\200", 1048, 0, 120, 120 }, /* Spec says 1047 but 1048 correct as only single byte count of 0 required */ - /*144*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "\200", 1049, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*145*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "1", 2608, 0, 132, 132 }, - /*146*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "1", 2609, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*147*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "A", 1954, 0, 132, 132 }, - /*148*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "A", 1955, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*149*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "\200", 1302, 0, 132, 132 }, /* Spec says 1301 but 1302 correct as only single byte count of 0 required */ - /*150*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "\200", 1303, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*151*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "1", 3116, 0, 144, 144 }, - /*152*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "1", 3117, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*153*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "A", 2335, 0, 144, 144 }, - /*154*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "A", 2336, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*155*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "\200", 1556, 0, 144, 144 }, /* Spec says 1555 but 1556 correct as only single byte count of 0 required */ - /*156*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "\200", 1557, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*157*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "1", 10, 0, 8, 18 }, - /*158*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "1", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*159*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "A", 6, 0, 8, 18 }, - /*160*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "A", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*161*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "\200", 3, 0, 8, 18 }, - /*162*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "\200", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*163*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "1", 20, 0, 8, 32 }, - /*164*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "1", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*165*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "A", 13, 0, 8, 32 }, - /*166*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*167*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "\200", 8, 0, 8, 32 }, - /*168*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "\200", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*169*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "1", 32, 0, 12, 26 }, - /*170*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "1", 33, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*171*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "A", 22, 0, 12, 26 }, - /*172*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "A", 23, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*173*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "\200", 14, 0, 12, 26 }, - /*174*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "\200", 15, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*175*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "1", 44, 0, 12, 36 }, - /*176*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*177*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "A", 31, 0, 12, 36 }, - /*178*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "A", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*179*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "\200", 20, 0, 12, 36 }, - /*180*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "\200", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*181*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "1", 64, 0, 16, 36 }, - /*182*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "1", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*183*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "A", 46, 0, 16, 36 }, - /*184*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*185*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "\200", 30, 0, 16, 36 }, - /*186*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "\200", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*187*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "1", 98, 0, 16, 48 }, - /*188*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "1", 99, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*189*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "A", 72, 0, 16, 48 }, - /*190*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "A", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*191*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "\200", 47, 0, 16, 48 }, - /*192*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "\200", 48, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*193*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "1", 36, 0, 8, 48 }, - /*194*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "1", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*195*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "A", 25, 0, 8, 48 }, - /*196*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "A", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*197*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "\200", 16, 0, 8, 48 }, - /*198*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "\200", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*199*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "1", 48, 0, 8, 64 }, - /*200*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "1", 49, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*201*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "A", 34, 0, 8, 64 }, - /*202*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "A", 35, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*203*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "\200", 22, 0, 8, 64 }, - /*204*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "\200", 23, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*205*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "1", 64, 0, 8, 80 }, - /*206*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "1", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*207*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "A", 46, 0, 8, 80 }, - /*208*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*209*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "\200", 30, 0, 8, 80 }, - /*210*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "\200", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*211*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "1", 76, 0, 8, 96 }, - /*212*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "1", 77, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*213*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "A", 55, 0, 8, 96 }, - /*214*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "A", 56, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*215*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "\200", 36, 0, 8, 96 }, - /*216*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*217*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "1", 98, 0, 8, 120 }, - /*218*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "1", 99, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*219*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "A", 72, 0, 8, 120 }, - /*220*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "A", 73, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*221*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "\200", 47, 0, 8, 120 }, - /*222*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "\200", 48, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*223*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "1", 126, 0, 8, 144 }, - /*224*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "1", 127, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*225*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "A", 93, 0, 8, 144 }, - /*226*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "A", 94, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*227*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "\200", 61, 0, 8, 144 }, - /*228*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "\200", 62, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*229*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "1", 86, 0, 12, 64 }, - /*230*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "1", 87, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*231*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "A", 63, 0, 12, 64 }, - /*232*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "A", 64, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*233*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "\200", 41, 0, 12, 64 }, - /*234*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "\200", 42, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*235*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "1", 128, 0, 12, 88 }, - /*236*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "1", 129, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*237*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "A", 94, 0, 12, 88 }, - /*238*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "A", 95, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*239*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "\200", 62, 0, 12, 88 }, - /*240*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "\200", 63, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*241*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "1", 124, 0, 16, 64 }, - /*242*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "1", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*243*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "A", 91, 0, 16, 64 }, - /*244*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "A", 92, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*245*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "\200", 60, 0, 16, 64 }, - /*246*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "\200", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*247*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "1", 88, 0, 20, 36 }, - /*248*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*249*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "A", 64, 0, 20, 36 }, - /*250*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*251*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "\200", 42, 0, 20, 36 }, - /*252*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*253*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "1", 112, 0, 20, 44 }, - /*254*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*255*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "A", 82, 0, 20, 44 }, - /*256*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "A", 83, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*257*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "\200", 54, 0, 20, 44 }, - /*258*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "\200", 55, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*259*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "1", 168, 0, 20, 64 }, /* Spec says 186 but typo */ - /*260*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "1", 169, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*261*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "A", 124, 0, 20, 64 }, - /*262*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "A", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*263*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "\200", 82, 0, 20, 64 }, - /*264*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "\200", 83, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*265*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "1", 144, 0, 22, 48 }, - /*266*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "1", 145, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*267*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "A", 106, 0, 22, 48 }, - /*268*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "A", 107, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*269*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "\200", 70, 0, 22, 48 }, - /*270*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "\200", 71, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*271*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "1", 160, 0, 24, 48 }, - /*272*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "1", 161, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*273*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "A", 118, 0, 24, 48 }, - /*274*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "A", 119, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*275*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "\200", 78, 0, 24, 48 }, - /*276*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "\200", 79, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*277*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "1", 216, 0, 24, 64 }, - /*278*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "1", 217, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*279*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "A", 160, 0, 24, 64 }, - /*280*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "A", 161, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*281*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "\200", 106, 0, 24, 64 }, - /*282*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "\200", 107, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*283*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "1", 140, 0, 26, 40 }, - /*284*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "1", 141, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*285*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "A", 103, 0, 26, 40 }, - /*286*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "A", 104, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*287*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "\200", 68, 0, 26, 40 }, - /*288*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "\200", 69, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*289*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "1", 180, 0, 26, 48 }, - /*290*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "1", 181, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*291*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "A", 133, 0, 26, 48 }, - /*292*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "A", 134, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*293*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "\200", 88, 0, 26, 48 }, - /*294*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "\200", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*295*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "1", 236, 0, 26, 64 }, - /*296*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "1", 237, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*297*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "A", 175, 0, 26, 64 }, - /*298*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "A", 176, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*299*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "\200", 116, 0, 26, 64 }, - /*300*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "\200", 117, ZINT_ERROR_TOO_LONG, -1, -1 }, + static const struct item data[] = { + /* 0*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "1", 3116, 0, 144, 144, "", "", "" }, + /* 1*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "1", 3117, ZINT_ERROR_TOO_LONG, 0, 0, "Error 719: Input length 3117 too long (maximum 3116)", "", "" }, + /* 2*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "1", 10922, ZINT_ERROR_TOO_LONG, 0, 0, "Error 719: Input length 10922 too long (maximum 3116)", "", "Minimal encoding can handle max (10921 + 1) * 6 = 65532 < 65536 (2*16) due to sizeof(previous)" }, + /* 3*/ { BARCODE_DATAMATRIX, -1, { 1, 2, "001001" }, "1", 3108, 0, 144, 144, "", "", "Structured Append 4 codewords overhead == 8 digits" }, + /* 4*/ { BARCODE_DATAMATRIX, -1, { 1, 2, "001001" }, "1", 3109, ZINT_ERROR_TOO_LONG, 0, 0, "Error 729: Input too long, requires too many codewords (maximum 1558)", "Error 520: Input too long, requires too many codewords (maximum 1558)", "" }, + /* 5*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "A", 2335, 0, 144, 144, "", "", "" }, + /* 6*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "A", 2336, ZINT_ERROR_TOO_LONG, 0, 0, "Error 729: Input too long, requires too many codewords (maximum 1558)", "Error 523: Input too long, requires 1560 codewords (maximum 1558)", "" }, + /* 7*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "\200", 1556, 0, 144, 144, "", "", "Spec says 1555 but 1556 correct as only single byte count of 0 required" }, + /* 8*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "\200", 1557, ZINT_ERROR_TOO_LONG, 0, 0, "Error 729: Input too long, requires too many codewords (maximum 1558)", "Error 520: Input too long, requires too many codewords (maximum 1558)", "" }, + /* 9*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "\001", 1558, 0, 144, 144, "", "", "" }, + /* 10*/ { BARCODE_DATAMATRIX, -1, { 0, 0, "" }, "\001", 1559, ZINT_ERROR_TOO_LONG, 0, 0, "Error 729: Input too long, requires too many codewords (maximum 1558)", "Error 520: Input too long, requires too many codewords (maximum 1558)", "" }, + /* 11*/ { BARCODE_HIBC_DM, -1, { 0, 0, "" }, "1", 110, 0, 32, 32, "", "", "" }, + /* 12*/ { BARCODE_HIBC_DM, -1, { 0, 0, "" }, "1", 111, ZINT_ERROR_TOO_LONG, 0, 0, "Error 202: Input length 111 too long for HIBC LIC (maximum 110)", "", "" }, + /* 13*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "1", 6, 0, 10, 10, "", "", "" }, + /* 14*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "1", 7, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 1, requires 4 codewords (maximum 3)", "", "" }, + /* 15*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "A", 3, 0, 10, 10, "", "", "" }, + /* 16*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "A", 4, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 1, requires 4 codewords (maximum 3)", "", "" }, + /* 17*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "\200", 1, 0, 10, 10, "", "", "" }, + /* 18*/ { BARCODE_DATAMATRIX, 1, { 0, 0, "" }, "\200", 2, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 1, requires 4 codewords (maximum 3)", "", "" }, + /* 19*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "1", 10, 0, 12, 12, "", "", "" }, + /* 20*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "1", 11, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 2, requires 6 codewords (maximum 5)", "", "" }, + /* 21*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "A", 6, 0, 12, 12, "", "", "" }, + /* 22*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "A", 7, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 2, requires 6 codewords (maximum 5)", "", "" }, + /* 23*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "\200", 3, 0, 12, 12, "", "", "" }, + /* 24*/ { BARCODE_DATAMATRIX, 2, { 0, 0, "" }, "\200", 4, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 2, requires 6 codewords (maximum 5)", "", "" }, + /* 25*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "1", 16, 0, 14, 14, "", "", "" }, + /* 26*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "1", 17, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 3, requires 9 codewords (maximum 8)", "", "" }, + /* 27*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "A", 10, 0, 14, 14, "", "", "" }, + /* 28*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "A", 11, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 3, requires 9 codewords (maximum 8)", "Error 522: Input too long for Version 3, requires 10 codewords (maximum 8)", "" }, + /* 29*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "\200", 6, 0, 14, 14, "", "", "" }, + /* 30*/ { BARCODE_DATAMATRIX, 3, { 0, 0, "" }, "\200", 7, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 3, requires 9 codewords (maximum 8)", "", "" }, + /* 31*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "1", 24, 0, 16, 16, "", "", "" }, + /* 32*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "1", 25, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 4, requires 13 codewords (maximum 12)", "", "" }, + /* 33*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "A", 16, 0, 16, 16, "", "", "" }, + /* 34*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "A", 17, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 4, requires 13 codewords (maximum 12)", "Error 522: Input too long for Version 4, requires 14 codewords (maximum 12)", "" }, + /* 35*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "\200", 10, 0, 16, 16, "", "", "" }, + /* 36*/ { BARCODE_DATAMATRIX, 4, { 0, 0, "" }, "\200", 11, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 4, requires 13 codewords (maximum 12)", "", "" }, + /* 37*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "1", 36, 0, 18, 18, "", "", "" }, + /* 38*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "1", 37, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 5, requires 19 codewords (maximum 18)", "", "" }, + /* 39*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "A", 25, 0, 18, 18, "", "", "" }, + /* 40*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "A", 26, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 5, requires 19 codewords (maximum 18)", "Error 522: Input too long for Version 5, requires 20 codewords (maximum 18)", "" }, + /* 41*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "\200", 16, 0, 18, 18, "", "", "" }, + /* 42*/ { BARCODE_DATAMATRIX, 5, { 0, 0, "" }, "\200", 17, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 5, requires 19 codewords (maximum 18)", "", "" }, + /* 43*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "1", 44, 0, 20, 20, "", "", "" }, + /* 44*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 6, requires 23 codewords (maximum 22)", "", "" }, + /* 45*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "A", 31, 0, 20, 20, "", "", "" }, + /* 46*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "A", 32, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 6, requires 23 codewords (maximum 22)", "Error 522: Input too long for Version 6, requires 24 codewords (maximum 22)", "" }, + /* 47*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "\200", 20, 0, 20, 20, "", "", "" }, + /* 48*/ { BARCODE_DATAMATRIX, 6, { 0, 0, "" }, "\200", 21, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 6, requires 23 codewords (maximum 22)", "", "" }, + /* 49*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "1", 60, 0, 22, 22, "", "", "" }, + /* 50*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "1", 61, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 7, requires 31 codewords (maximum 30)", "", "" }, + /* 51*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "A", 43, 0, 22, 22, "", "", "" }, + /* 52*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "A", 44, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 7, requires 31 codewords (maximum 30)", "Error 522: Input too long for Version 7, requires 32 codewords (maximum 30)", "" }, + /* 53*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "\200", 28, 0, 22, 22, "", "", "" }, + /* 54*/ { BARCODE_DATAMATRIX, 7, { 0, 0, "" }, "\200", 29, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 7, requires 31 codewords (maximum 30)", "", "" }, + /* 55*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "1", 72, 0, 24, 24, "", "", "" }, + /* 56*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "1", 73, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 8, requires 37 codewords (maximum 36)", "", "" }, + /* 57*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "A", 52, 0, 24, 24, "", "", "" }, + /* 58*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "A", 53, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 8, requires 37 codewords (maximum 36)", "Error 522: Input too long for Version 8, requires 38 codewords (maximum 36)", "" }, + /* 59*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "\200", 34, 0, 24, 24, "", "", "" }, + /* 60*/ { BARCODE_DATAMATRIX, 8, { 0, 0, "" }, "\200", 35, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 8, requires 37 codewords (maximum 36)", "", "" }, + /* 61*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "1", 88, 0, 26, 26, "", "", "" }, + /* 62*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 9, requires 45 codewords (maximum 44)", "", "" }, + /* 63*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "A", 64, 0, 26, 26, "", "", "" }, + /* 64*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 9, requires 45 codewords (maximum 44)", "Error 522: Input too long for Version 9, requires 46 codewords (maximum 44)", "" }, + /* 65*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "\200", 42, 0, 26, 26, "", "", "" }, + /* 66*/ { BARCODE_DATAMATRIX, 9, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 9, requires 45 codewords (maximum 44)", "", "" }, + /* 67*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "1", 124, 0, 32, 32, "", "", "" }, + /* 68*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "1", 125, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 10, requires 63 codewords (maximum 62)", "", "" }, + /* 69*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "A", 91, 0, 32, 32, "", "", "" }, + /* 70*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "A", 92, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 10, requires 63 codewords (maximum 62)", "Error 522: Input too long for Version 10, requires 64 codewords (maximum 62)", "" }, + /* 71*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "\200", 60, 0, 32, 32, "", "", "" }, + /* 72*/ { BARCODE_DATAMATRIX, 10, { 0, 0, "" }, "\200", 61, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 10, requires 63 codewords (maximum 62)", "", "" }, + /* 73*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "1", 172, 0, 36, 36, "", "", "" }, + /* 74*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "1", 173, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 11, requires 87 codewords (maximum 86)", "", "" }, + /* 75*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "A", 127, 0, 36, 36, "", "", "" }, + /* 76*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "A", 128, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 11, requires 87 codewords (maximum 86)", "Error 522: Input too long for Version 11, requires 88 codewords (maximum 86)", "" }, + /* 77*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "\200", 84, 0, 36, 36, "", "", "" }, + /* 78*/ { BARCODE_DATAMATRIX, 11, { 0, 0, "" }, "\200", 85, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 11, requires 87 codewords (maximum 86)", "", "" }, + /* 79*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "1", 228, 0, 40, 40, "", "", "" }, + /* 80*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "1", 229, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 12, requires 115 codewords (maximum 114)", "", "" }, + /* 81*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "A", 169, 0, 40, 40, "", "", "" }, + /* 82*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "A", 170, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 12, requires 115 codewords (maximum 114)", "Error 522: Input too long for Version 12, requires 116 codewords (maximum 114)", "" }, + /* 83*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "\200", 112, 0, 40, 40, "", "", "" }, + /* 84*/ { BARCODE_DATAMATRIX, 12, { 0, 0, "" }, "\200", 113, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 12, requires 115 codewords (maximum 114)", "", "" }, + /* 85*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "1", 288, 0, 44, 44, "", "", "" }, + /* 86*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "1", 289, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 13, requires 145 codewords (maximum 144)", "", "" }, + /* 87*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "A", 214, 0, 44, 44, "", "", "" }, + /* 88*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "A", 215, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 13, requires 145 codewords (maximum 144)", "Error 522: Input too long for Version 13, requires 146 codewords (maximum 144)", "" }, + /* 89*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "\200", 142, 0, 44, 44, "", "", "" }, + /* 90*/ { BARCODE_DATAMATRIX, 13, { 0, 0, "" }, "\200", 143, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 13, requires 145 codewords (maximum 144)", "", "" }, + /* 91*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "1", 348, 0, 48, 48, "", "", "" }, + /* 92*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "1", 349, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 14, requires 175 codewords (maximum 174)", "", "" }, + /* 93*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "A", 259, 0, 48, 48, "", "", "" }, + /* 94*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "A", 260, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 14, requires 175 codewords (maximum 174)", "Error 522: Input too long for Version 14, requires 176 codewords (maximum 174)", "" }, + /* 95*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "\200", 172, 0, 48, 48, "", "", "" }, + /* 96*/ { BARCODE_DATAMATRIX, 14, { 0, 0, "" }, "\200", 173, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 14, requires 175 codewords (maximum 174)", "", "" }, + /* 97*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "1", 408, 0, 52, 52, "", "", "" }, + /* 98*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "1", 409, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 15, requires 205 codewords (maximum 204)", "", "" }, + /* 99*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "A", 304, 0, 52, 52, "", "", "" }, + /*100*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "A", 305, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 15, requires 205 codewords (maximum 204)", "Error 522: Input too long for Version 15, requires 206 codewords (maximum 204)", "" }, + /*101*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "\200", 202, 0, 52, 52, "", "", "" }, + /*102*/ { BARCODE_DATAMATRIX, 15, { 0, 0, "" }, "\200", 203, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 15, requires 205 codewords (maximum 204)", "", "" }, + /*103*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "1", 560, 0, 64, 64, "", "", "" }, + /*104*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "1", 561, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 16, requires 281 codewords (maximum 280)", "", "" }, + /*105*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "A", 418, 0, 64, 64, "", "", "" }, + /*106*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "A", 419, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 16, requires 281 codewords (maximum 280)", "Error 522: Input too long for Version 16, requires 282 codewords (maximum 280)", "" }, + /*107*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "\200", 278, 0, 64, 64, "", "", "Spec says 277 but 278 correct as only single byte count of 0 required" }, + /*108*/ { BARCODE_DATAMATRIX, 16, { 0, 0, "" }, "\200", 279, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 16, requires 281 codewords (maximum 280)", "", "" }, + /*109*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "1", 736, 0, 72, 72, "", "", "" }, + /*110*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "1", 737, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 17, requires 369 codewords (maximum 368)", "", "" }, + /*111*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "A", 550, 0, 72, 72, "", "", "" }, + /*112*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "A", 551, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 17, requires 369 codewords (maximum 368)", "Error 522: Input too long for Version 17, requires 370 codewords (maximum 368)", "" }, + /*113*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "\200", 366, 0, 72, 72, "", "", "Spec says 365 but 366 correct as only single byte count of 0 required" }, + /*114*/ { BARCODE_DATAMATRIX, 17, { 0, 0, "" }, "\200", 367, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 17, requires 369 codewords (maximum 368)", "", "" }, + /*115*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "1", 912, 0, 80, 80, "", "", "" }, + /*116*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "1", 913, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 18, requires 457 codewords (maximum 456)", "", "" }, + /*117*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "A", 682, 0, 80, 80, "", "", "" }, + /*118*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "A", 683, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 18, requires 457 codewords (maximum 456)", "Error 522: Input too long for Version 18, requires 458 codewords (maximum 456)", "" }, + /*119*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "\200", 454, 0, 80, 80, "", "", "Spec says 453 but 454 correct as only single byte count of 0 required" }, + /*120*/ { BARCODE_DATAMATRIX, 18, { 0, 0, "" }, "\200", 455, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 18, requires 457 codewords (maximum 456)", "", "" }, + /*121*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "1", 1152, 0, 88, 88, "", "", "" }, + /*122*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "1", 1153, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 19, requires 577 codewords (maximum 576)", "", "" }, + /*123*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "A", 862, 0, 88, 88, "", "", "" }, + /*124*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "A", 863, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 19, requires 577 codewords (maximum 576)", "Error 522: Input too long for Version 19, requires 578 codewords (maximum 576)", "" }, + /*125*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "\200", 574, 0, 88, 88, "", "", "Spec says 573 but 574 correct as only single byte count of 0 required" }, + /*126*/ { BARCODE_DATAMATRIX, 19, { 0, 0, "" }, "\200", 575, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 19, requires 577 codewords (maximum 576)", "", "" }, + /*127*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "1", 1392, 0, 96, 96, "", "", "" }, + /*128*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "1", 1393, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 20, requires 697 codewords (maximum 696)", "", "" }, + /*129*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "A", 1042, 0, 96, 96, "", "", "" }, + /*130*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "A", 1043, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 20, requires 697 codewords (maximum 696)", "Error 522: Input too long for Version 20, requires 698 codewords (maximum 696)", "" }, + /*131*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "\200", 694, 0, 96, 96, "", "", "Spec says 693 but 694 correct as only single byte count of 0 required" }, + /*132*/ { BARCODE_DATAMATRIX, 20, { 0, 0, "" }, "\200", 695, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 20, requires 697 codewords (maximum 696)", "", "" }, + /*133*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "1", 1632, 0, 104, 104, "", "", "" }, + /*134*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "1", 1633, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 21, requires 817 codewords (maximum 816)", "", "" }, + /*135*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "A", 1222, 0, 104, 104, "", "", "" }, + /*136*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "A", 1223, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 21, requires 817 codewords (maximum 816)", "Error 522: Input too long for Version 21, requires 818 codewords (maximum 816)", "" }, + /*137*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "\200", 814, 0, 104, 104, "", "", "Spec says 813 but 814 correct as only single byte count of 0 required" }, + /*138*/ { BARCODE_DATAMATRIX, 21, { 0, 0, "" }, "\200", 815, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 21, requires 817 codewords (maximum 816)", "", "" }, + /*139*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "1", 2100, 0, 120, 120, "", "", "" }, + /*140*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "1", 2101, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 22, requires 1051 codewords (maximum 1050)", "", "" }, + /*141*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "A", 1573, 0, 120, 120, "", "", "" }, + /*142*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "A", 1574, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 22, requires 1051 codewords (maximum 1050)", "Error 522: Input too long for Version 22, requires 1052 codewords (maximum 1050)", "" }, + /*143*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "\200", 1048, 0, 120, 120, "", "", "Spec says 1047 but 1048 correct as only single byte count of 0 required" }, + /*144*/ { BARCODE_DATAMATRIX, 22, { 0, 0, "" }, "\200", 1049, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 22, requires 1051 codewords (maximum 1050)", "", "" }, + /*145*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "1", 2608, 0, 132, 132, "", "", "" }, + /*146*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "1", 2609, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 23, requires 1305 codewords (maximum 1304)", "", "" }, + /*147*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "A", 1954, 0, 132, 132, "", "", "" }, + /*148*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "A", 1955, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 23, requires 1305 codewords (maximum 1304)", "Error 522: Input too long for Version 23, requires 1306 codewords (maximum 1304)", "" }, + /*149*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "\200", 1302, 0, 132, 132, "", "", "Spec says 1301 but 1302 correct as only single byte count of 0 required" }, + /*150*/ { BARCODE_DATAMATRIX, 23, { 0, 0, "" }, "\200", 1303, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 23, requires 1305 codewords (maximum 1304)", "", "" }, + /*151*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "1", 3116, 0, 144, 144, "", "", "" }, + /*152*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "1", 3117, ZINT_ERROR_TOO_LONG, 0, 0, "Error 719: Input length 3117 too long (maximum 3116)", "", "" }, + /*153*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "A", 2335, 0, 144, 144, "", "", "" }, + /*154*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "A", 2336, ZINT_ERROR_TOO_LONG, 0, 0, "Error 729: Input too long, requires too many codewords (maximum 1558)", "Error 522: Input too long for Version 24, requires 1560 codewords (maximum 1558)", "" }, + /*155*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "\200", 1556, 0, 144, 144, "", "", "Spec says 1555 but 1556 correct as only single byte count of 0 required" }, + /*156*/ { BARCODE_DATAMATRIX, 24, { 0, 0, "" }, "\200", 1557, ZINT_ERROR_TOO_LONG, 0, 0, "Error 729: Input too long, requires too many codewords (maximum 1558)", "Error 520: Input too long, requires too many codewords (maximum 1558)", "" }, + /*157*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "1", 10, 0, 8, 18, "", "", "" }, + /*158*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "1", 11, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 25, requires 6 codewords (maximum 5)", "", "" }, + /*159*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "A", 6, 0, 8, 18, "", "", "" }, + /*160*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "A", 7, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 25, requires 6 codewords (maximum 5)", "", "" }, + /*161*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "\200", 3, 0, 8, 18, "", "", "" }, + /*162*/ { BARCODE_DATAMATRIX, 25, { 0, 0, "" }, "\200", 4, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 25, requires 6 codewords (maximum 5)", "", "" }, + /*163*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "1", 20, 0, 8, 32, "", "", "" }, + /*164*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "1", 21, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 26, requires 11 codewords (maximum 10)", "", "" }, + /*165*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "A", 13, 0, 8, 32, "", "", "" }, + /*166*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "A", 14, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 26, requires 11 codewords (maximum 10)", "Error 522: Input too long for Version 26, requires 12 codewords (maximum 10)", "" }, + /*167*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "\200", 8, 0, 8, 32, "", "", "" }, + /*168*/ { BARCODE_DATAMATRIX, 26, { 0, 0, "" }, "\200", 9, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 26, requires 11 codewords (maximum 10)", "", "" }, + /*169*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "1", 32, 0, 12, 26, "", "", "" }, + /*170*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "1", 33, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 27, requires 17 codewords (maximum 16)", "", "" }, + /*171*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "A", 22, 0, 12, 26, "", "", "" }, + /*172*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "A", 23, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 27, requires 17 codewords (maximum 16)", "Error 522: Input too long for Version 27, requires 18 codewords (maximum 16)", "" }, + /*173*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "\200", 14, 0, 12, 26, "", "", "" }, + /*174*/ { BARCODE_DATAMATRIX, 27, { 0, 0, "" }, "\200", 15, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 27, requires 17 codewords (maximum 16)", "", "" }, + /*175*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "1", 44, 0, 12, 36, "", "", "" }, + /*176*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "1", 45, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 28, requires 23 codewords (maximum 22)", "", "" }, + /*177*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "A", 31, 0, 12, 36, "", "", "" }, + /*178*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "A", 32, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 28, requires 23 codewords (maximum 22)", "Error 522: Input too long for Version 28, requires 24 codewords (maximum 22)", "" }, + /*179*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "\200", 20, 0, 12, 36, "", "", "" }, + /*180*/ { BARCODE_DATAMATRIX, 28, { 0, 0, "" }, "\200", 21, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 28, requires 23 codewords (maximum 22)", "", "" }, + /*181*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "1", 64, 0, 16, 36, "", "", "" }, + /*182*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "1", 65, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 29, requires 33 codewords (maximum 32)", "", "" }, + /*183*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "A", 46, 0, 16, 36, "", "", "" }, + /*184*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "A", 47, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 29, requires 33 codewords (maximum 32)", "Error 522: Input too long for Version 29, requires 34 codewords (maximum 32)", "" }, + /*185*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "\200", 30, 0, 16, 36, "", "", "" }, + /*186*/ { BARCODE_DATAMATRIX, 29, { 0, 0, "" }, "\200", 31, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 29, requires 33 codewords (maximum 32)", "", "" }, + /*187*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "1", 98, 0, 16, 48, "", "", "" }, + /*188*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "1", 99, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 30, requires 50 codewords (maximum 49)", "", "" }, + /*189*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "A", 72, 0, 16, 48, "", "", "" }, + /*190*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "A", 73, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 30, requires 50 codewords (maximum 49)", "", "" }, + /*191*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "\200", 47, 0, 16, 48, "", "", "" }, + /*192*/ { BARCODE_DATAMATRIX, 30, { 0, 0, "" }, "\200", 48, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 30, requires 50 codewords (maximum 49)", "", "" }, + /*193*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "1", 36, 0, 8, 48, "", "", "" }, + /*194*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "1", 37, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 31, requires 19 codewords (maximum 18)", "", "" }, + /*195*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "A", 25, 0, 8, 48, "", "", "" }, + /*196*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "A", 26, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 31, requires 19 codewords (maximum 18)", "Error 522: Input too long for Version 31, requires 20 codewords (maximum 18)", "" }, + /*197*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "\200", 16, 0, 8, 48, "", "", "" }, + /*198*/ { BARCODE_DATAMATRIX, 31, { 0, 0, "" }, "\200", 17, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 31, requires 19 codewords (maximum 18)", "", "" }, + /*199*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "1", 48, 0, 8, 64, "", "", "" }, + /*200*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "1", 49, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 32, requires 25 codewords (maximum 24)", "", "" }, + /*201*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "A", 34, 0, 8, 64, "", "", "" }, + /*202*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "A", 35, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 32, requires 25 codewords (maximum 24)", "Error 522: Input too long for Version 32, requires 26 codewords (maximum 24)", "" }, + /*203*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "\200", 22, 0, 8, 64, "", "", "" }, + /*204*/ { BARCODE_DATAMATRIX, 32, { 0, 0, "" }, "\200", 23, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 32, requires 25 codewords (maximum 24)", "", "" }, + /*205*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "1", 64, 0, 8, 80, "", "", "" }, + /*206*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "1", 65, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 33, requires 33 codewords (maximum 32)", "", "" }, + /*207*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "A", 46, 0, 8, 80, "", "", "" }, + /*208*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "A", 47, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 33, requires 33 codewords (maximum 32)", "Error 522: Input too long for Version 33, requires 34 codewords (maximum 32)", "" }, + /*209*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "\200", 30, 0, 8, 80, "", "", "" }, + /*210*/ { BARCODE_DATAMATRIX, 33, { 0, 0, "" }, "\200", 31, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 33, requires 33 codewords (maximum 32)", "", "" }, + /*211*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "1", 76, 0, 8, 96, "", "", "" }, + /*212*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "1", 77, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 34, requires 39 codewords (maximum 38)", "", "" }, + /*213*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "A", 55, 0, 8, 96, "", "", "" }, + /*214*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "A", 56, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 34, requires 39 codewords (maximum 38)", "Error 522: Input too long for Version 34, requires 40 codewords (maximum 38)", "" }, + /*215*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "\200", 36, 0, 8, 96, "", "", "" }, + /*216*/ { BARCODE_DATAMATRIX, 34, { 0, 0, "" }, "\200", 37, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 34, requires 39 codewords (maximum 38)", "", "" }, + /*217*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "1", 98, 0, 8, 120, "", "", "" }, + /*218*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "1", 99, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 35, requires 50 codewords (maximum 49)", "", "" }, + /*219*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "A", 72, 0, 8, 120, "", "", "" }, + /*220*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "A", 73, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 35, requires 50 codewords (maximum 49)", "", "" }, + /*221*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "\200", 47, 0, 8, 120, "", "", "" }, + /*222*/ { BARCODE_DATAMATRIX, 35, { 0, 0, "" }, "\200", 48, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 35, requires 50 codewords (maximum 49)", "", "" }, + /*223*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "1", 126, 0, 8, 144, "", "", "" }, + /*224*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "1", 127, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 36, requires 64 codewords (maximum 63)", "", "" }, + /*225*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "A", 93, 0, 8, 144, "", "", "" }, + /*226*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "A", 94, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 36, requires 64 codewords (maximum 63)", "", "" }, + /*227*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "\200", 61, 0, 8, 144, "", "", "" }, + /*228*/ { BARCODE_DATAMATRIX, 36, { 0, 0, "" }, "\200", 62, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 36, requires 64 codewords (maximum 63)", "", "" }, + /*229*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "1", 86, 0, 12, 64, "", "", "" }, + /*230*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "1", 87, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 37, requires 44 codewords (maximum 43)", "", "" }, + /*231*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "A", 63, 0, 12, 64, "", "", "" }, + /*232*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "A", 64, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 37, requires 44 codewords (maximum 43)", "", "" }, + /*233*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "\200", 41, 0, 12, 64, "", "", "" }, + /*234*/ { BARCODE_DATAMATRIX, 37, { 0, 0, "" }, "\200", 42, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 37, requires 44 codewords (maximum 43)", "", "" }, + /*235*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "1", 128, 0, 12, 88, "", "", "" }, + /*236*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "1", 129, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 38, requires 65 codewords (maximum 64)", "", "" }, + /*237*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "A", 94, 0, 12, 88, "", "", "" }, + /*238*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "A", 95, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 38, requires 65 codewords (maximum 64)", "Error 522: Input too long for Version 38, requires 66 codewords (maximum 64)", "" }, + /*239*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "\200", 62, 0, 12, 88, "", "", "" }, + /*240*/ { BARCODE_DATAMATRIX, 38, { 0, 0, "" }, "\200", 63, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 38, requires 65 codewords (maximum 64)", "", "" }, + /*241*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "1", 124, 0, 16, 64, "", "", "" }, + /*242*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "1", 125, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 39, requires 63 codewords (maximum 62)", "", "" }, + /*243*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "A", 91, 0, 16, 64, "", "", "" }, + /*244*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "A", 92, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 39, requires 63 codewords (maximum 62)", "Error 522: Input too long for Version 39, requires 64 codewords (maximum 62)", "" }, + /*245*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "\200", 60, 0, 16, 64, "", "", "" }, + /*246*/ { BARCODE_DATAMATRIX, 39, { 0, 0, "" }, "\200", 61, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 39, requires 63 codewords (maximum 62)", "", "" }, + /*247*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "1", 88, 0, 20, 36, "", "", "" }, + /*248*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "1", 89, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 40, requires 45 codewords (maximum 44)", "", "" }, + /*249*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "A", 64, 0, 20, 36, "", "", "" }, + /*250*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "A", 65, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 40, requires 45 codewords (maximum 44)", "Error 522: Input too long for Version 40, requires 46 codewords (maximum 44)", "" }, + /*251*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "\200", 42, 0, 20, 36, "", "", "" }, + /*252*/ { BARCODE_DATAMATRIX, 40, { 0, 0, "" }, "\200", 43, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 40, requires 45 codewords (maximum 44)", "", "" }, + /*253*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "1", 112, 0, 20, 44, "", "", "" }, + /*254*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "1", 113, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 41, requires 57 codewords (maximum 56)", "", "" }, + /*255*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "A", 82, 0, 20, 44, "", "", "" }, + /*256*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "A", 83, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 41, requires 57 codewords (maximum 56)", "Error 522: Input too long for Version 41, requires 58 codewords (maximum 56)", "" }, + /*257*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "\200", 54, 0, 20, 44, "", "", "" }, + /*258*/ { BARCODE_DATAMATRIX, 41, { 0, 0, "" }, "\200", 55, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 41, requires 57 codewords (maximum 56)", "", "" }, + /*259*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "1", 168, 0, 20, 64, "", "", "Spec says 186 but typo" }, + /*260*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "1", 169, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 42, requires 85 codewords (maximum 84)", "", "" }, + /*261*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "A", 124, 0, 20, 64, "", "", "" }, + /*262*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "A", 125, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 42, requires 85 codewords (maximum 84)", "Error 522: Input too long for Version 42, requires 86 codewords (maximum 84)", "" }, + /*263*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "\200", 82, 0, 20, 64, "", "", "" }, + /*264*/ { BARCODE_DATAMATRIX, 42, { 0, 0, "" }, "\200", 83, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 42, requires 85 codewords (maximum 84)", "", "" }, + /*265*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "1", 144, 0, 22, 48, "", "", "" }, + /*266*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "1", 145, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 43, requires 73 codewords (maximum 72)", "", "" }, + /*267*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "A", 106, 0, 22, 48, "", "", "" }, + /*268*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "A", 107, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 43, requires 73 codewords (maximum 72)", "Error 522: Input too long for Version 43, requires 74 codewords (maximum 72)", "" }, + /*269*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "\200", 70, 0, 22, 48, "", "", "" }, + /*270*/ { BARCODE_DATAMATRIX, 43, { 0, 0, "" }, "\200", 71, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 43, requires 73 codewords (maximum 72)", "", "" }, + /*271*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "1", 160, 0, 24, 48, "", "", "" }, + /*272*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "1", 161, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 44, requires 81 codewords (maximum 80)", "", "" }, + /*273*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "A", 118, 0, 24, 48, "", "", "" }, + /*274*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "A", 119, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 44, requires 81 codewords (maximum 80)", "Error 522: Input too long for Version 44, requires 82 codewords (maximum 80)", "" }, + /*275*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "\200", 78, 0, 24, 48, "", "", "" }, + /*276*/ { BARCODE_DATAMATRIX, 44, { 0, 0, "" }, "\200", 79, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 44, requires 81 codewords (maximum 80)", "", "" }, + /*277*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "1", 216, 0, 24, 64, "", "", "" }, + /*278*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "1", 217, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 45, requires 109 codewords (maximum 108)", "", "" }, + /*279*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "A", 160, 0, 24, 64, "", "", "" }, + /*280*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "A", 161, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 45, requires 109 codewords (maximum 108)", "Error 522: Input too long for Version 45, requires 110 codewords (maximum 108)", "" }, + /*281*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "\200", 106, 0, 24, 64, "", "", "" }, + /*282*/ { BARCODE_DATAMATRIX, 45, { 0, 0, "" }, "\200", 107, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 45, requires 109 codewords (maximum 108)", "", "" }, + /*283*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "1", 140, 0, 26, 40, "", "", "" }, + /*284*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "1", 141, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 46, requires 71 codewords (maximum 70)", "", "" }, + /*285*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "A", 103, 0, 26, 40, "", "", "" }, + /*286*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "A", 104, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 46, requires 71 codewords (maximum 70)", "Error 522: Input too long for Version 46, requires 72 codewords (maximum 70)", "" }, + /*287*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "\200", 68, 0, 26, 40, "", "", "" }, + /*288*/ { BARCODE_DATAMATRIX, 46, { 0, 0, "" }, "\200", 69, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 46, requires 71 codewords (maximum 70)", "", "" }, + /*289*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "1", 180, 0, 26, 48, "", "", "" }, + /*290*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "1", 181, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 47, requires 91 codewords (maximum 90)", "", "" }, + /*291*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "A", 133, 0, 26, 48, "", "", "" }, + /*292*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "A", 134, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 47, requires 91 codewords (maximum 90)", "Error 522: Input too long for Version 47, requires 92 codewords (maximum 90)", "" }, + /*293*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "\200", 88, 0, 26, 48, "", "", "" }, + /*294*/ { BARCODE_DATAMATRIX, 47, { 0, 0, "" }, "\200", 89, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 47, requires 91 codewords (maximum 90)", "", "" }, + /*295*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "1", 236, 0, 26, 64, "", "", "" }, + /*296*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "1", 237, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 48, requires 119 codewords (maximum 118)", "", "" }, + /*297*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "A", 175, 0, 26, 64, "", "", "" }, + /*298*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "A", 176, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 48, requires 119 codewords (maximum 118)", "Error 522: Input too long for Version 48, requires 120 codewords (maximum 118)", "" }, + /*299*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "\200", 116, 0, 26, 64, "", "", "" }, + /*300*/ { BARCODE_DATAMATRIX, 48, { 0, 0, "" }, "\200", 117, ZINT_ERROR_TOO_LONG, 0, 0, "Error 522: Input too long for Version 48, requires 119 codewords (maximum 118)", "", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; char data_buf[ZINT_MAX_DATA_LEN]; + char escaped[64]; testStartSymbol("test_large", &symbol); @@ -374,20 +378,43 @@ static void test_large(const testCtx *const p_ctx) { } ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); - assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); - 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->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); - } + if (p_ctx->generate) { + char errtxt[sizeof(symbol->errtxt)]; + strcpy(errtxt, symbol->errtxt); + printf(" /*%3d*/ { %s, %d, { %d, %d, \"%s\" }, \"%s\", %d, %s, %d, %d, \"%s\",", + i, testUtilBarcodeName(data[i].symbology), data[i].option_2, + data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, + testUtilEscape(data[i].pattern, (int) strlen(data[i].pattern), escaped, sizeof(escaped)), data[i].length, + testUtilErrorName(ret), symbol->rows, symbol->width, errtxt); + symbol->input_mode |= FAST_MODE; + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); + printf(" \"%s\", \"%s\" },\n", strcmp(errtxt, symbol->errtxt) != 0 ? symbol->errtxt : "", data[i].comment); + } else { + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); - symbol->input_mode |= FAST_MODE; - ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); - assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + 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->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); + } - 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->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); + symbol->input_mode |= FAST_MODE; + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + + 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->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); + } else { + if (data[i].expected_errtxt2[0]) { + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt2), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt2); + } else { + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); + } + } } ZBarcode_Delete(symbol); @@ -409,11 +436,11 @@ static void test_buffer(const testCtx *const p_ctx) { char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { 16383, UNICODE_MODE, READER_INIT, "1", 0, "" }, /* 1*/ { 3, UNICODE_MODE, 0, "000106j 05 Galeria A Nação0000000000", 0, "From Okapi, consecutive use of upper shift; #176" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -456,7 +483,7 @@ static void test_options(const testCtx *const p_ctx) { const char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 0, 0, "" }, "1", 0, 10, 10, "" }, /* 1*/ { BARCODE_DATAMATRIX, -1, 2, -1, -1, -1, { 0, 0, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 524: Older Data Matrix standards are no longer supported" }, /* 2*/ { BARCODE_DATAMATRIX, -1, -1, 1, -1, -1, { 0, 0, "" }, "1", 0, 10, 10, "" }, @@ -464,7 +491,7 @@ static void test_options(const testCtx *const p_ctx) { /* 4*/ { BARCODE_DATAMATRIX, -1, -1, 48, -1, -1, { 0, 0, "" }, "1", 0, 26, 64, "" }, /* 5*/ { BARCODE_DATAMATRIX, -1, -1, 49, -1, -1, { 0, 0, "" }, "1", 0, 10, 10, "" }, /* Ignored */ /* 6*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 0, 0, "" }, "____", 0, 12, 12, "" }, /* 4 data */ - /* 7*/ { BARCODE_DATAMATRIX, -1, -1, 1, -1, -1, { 0, 0, "" }, "____", ZINT_ERROR_TOO_LONG, -1, -1, "Error 522: Input too long for selected symbol size" }, + /* 7*/ { BARCODE_DATAMATRIX, -1, -1, 1, -1, -1, { 0, 0, "" }, "____", ZINT_ERROR_TOO_LONG, -1, -1, "Error 522: Input too long for Version 1, requires 4 codewords (maximum 3)" }, /* 8*/ { BARCODE_DATAMATRIX, -1, -1, 25, -1, -1, { 0, 0, "" }, "____", 0, 8, 18, "" }, /* 9*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 0, 0, "" }, "__________", 0, 8, 32, "" }, /* 10 data */ /* 10*/ { BARCODE_DATAMATRIX, -1, -1, -1, DM_DMRE, -1, { 0, 0, "" }, "__________", 0, 8, 32, "" }, @@ -541,23 +568,24 @@ static void test_options(const testCtx *const p_ctx) { /* 81*/ { BARCODE_DATAMATRIX, GS1_MODE | GS1PARENS_MODE, -1, -1, -1, -1, { 0, 0, "" }, "(90)12", 0, 10, 10, "" }, /* 82*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 1, 2, "" }, "1", 0, 12, 12, "" }, /* 83*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 16, 16, "" }, "1", 0, 12, 12, "" }, - /* 84*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 1, 1, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 720: Structured Append count out of range (2-16)" }, - /* 85*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 1, 17, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 720: Structured Append count out of range (2-16)" }, - /* 86*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 0, 16, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 721: Structured Append index out of range (1-16)" }, - /* 87*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 17, 16, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 721: Structured Append index out of range (1-16)" }, + /* 84*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 1, 1, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 720: Structured Append count '1' out of range (2 to 16)" }, + /* 85*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 1, 17, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 720: Structured Append count '17' out of range (2 to 16)" }, + /* 86*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 0, 16, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 721: Structured Append index '0' out of range (1 to count 16)" }, + /* 87*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 17, 16, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 721: Structured Append index '17' out of range (1 to count 16)" }, /* 88*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1001" }, "1", 0, 12, 12, "" }, /* 89*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "A" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 723: Invalid Structured Append ID (digits only)" }, - /* 90*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "0" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 724: Structured Append ID1 '000' and ID2 '000' out of range (001-254) (ID '000000')" }, - /* 91*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 725: Structured Append ID1 '000' out of range (001-254) (ID '000001')" }, - /* 92*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1000" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 726: Structured Append ID2 '000' out of range (001-254) (ID '001000')" }, - /* 93*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "001255" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 726: Structured Append ID2 '255' out of range (001-254) (ID '001255')" }, - /* 94*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "255001" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 725: Structured Append ID1 '255' out of range (001-254) (ID '255001')" }, - /* 95*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "255255" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 724: Structured Append ID1 '255' and ID2 '255' out of range (001-254) (ID '255255')" }, - /* 96*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1234567" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 722: Structured Append ID too long (6 digit maximum)" }, + /* 90*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "0" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 724: Structured Append ID1 '000' and ID2 '000' out of range (001 to 254) (ID \"000000\")" }, + /* 91*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 725: Structured Append ID1 '000' out of range (001 to 254) (ID \"000001\")" }, + /* 92*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1000" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 726: Structured Append ID2 '000' out of range (001 to 254) (ID \"001000\")" }, + /* 93*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "001255" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 726: Structured Append ID2 '255' out of range (001 to 254) (ID \"001255\")" }, + /* 94*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "255001" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 725: Structured Append ID1 '255' out of range (001 to 254) (ID \"255001\")" }, + /* 95*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "255255" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 724: Structured Append ID1 '255' and ID2 '255' out of range (001 to 254) (ID \"255255\")" }, + /* 96*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1234567" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 722: Structured Append ID length 7 too long (6 digit maximum)" }, /* 97*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, READER_INIT, { 2, 3, "1001" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 727: Cannot have Structured Append and Reader Initialisation at the same time" }, /* 98*/ { BARCODE_DATAMATRIX, ESCAPE_MODE, -1, -1, -1, -1, { 2, 3, "1001" }, "[)>\\R05\\GA\\R\\E", 0, 12, 26, "" }, /* Macro05/06 ignored if have Structured Append TODO: error/warning */ + /* 99*/ { BARCODE_HIBC_DM, -1, -1, -1, -1, -1, { 0, 0, "" }, "1234,67", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 203: Invalid character at position 5 in input (alphanumerics, space and \"-.$/+%\" only)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -615,11 +643,11 @@ static void test_reader_init(const testCtx *const p_ctx) { char *expected; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DATAMATRIX, UNICODE_MODE, READER_INIT, "A", 0, 10, 10, "EA 42 81 19 A4 53 21 DF", "TODO: Check this" }, /* 1*/ { BARCODE_DATAMATRIX, GS1_MODE, READER_INIT, "[91]A", ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 521: Cannot encode in GS1 mode and Reader Initialisation at the same time", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -687,7 +715,7 @@ static void test_input(const testCtx *const p_ctx) { int expected_diff; /* Difference between default minimal encodation and ISO encodation (FAST_MODE) */ }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE | FAST_MODE, 0, -1, -1, -1, "0466010592130100000k*AGUATY80", 0, 0, 18, 18, 1, "(32) 86 C4 83 87 DE 8F 83 82 82 31 6C EE 08 85 D6 D2 EF 65 93 B0 1C 3C 76 FB D4 AB 16 11", "#208", 0 }, /* 1*/ { UNICODE_MODE, 0, -1, -1, -1, "0466010592130100000k*AGUATY80", 0, 0, 18, 18, 1, "(32) 86 C4 83 87 DE 8F 83 82 82 31 6C EE 08 85 D6 D2 EF 65 93 B0 1C 3C 76 FB D4 AB 16 11", "#208", 0 }, /* 2*/ { UNICODE_MODE | FAST_MODE, 0, 5, -1, -1, "0466010592130100000k*AGUATY80", 0, 0, 18, 18, 1, "(32) 86 C4 83 87 DE 8F 83 82 82 31 6C EE 08 85 D6 D2 EF 65 93 B0 1C 3C 76 FB D4 AB 16 11", "", 0 }, @@ -696,8 +724,8 @@ static void test_input(const testCtx *const p_ctx) { /* 5*/ { UNICODE_MODE, 0, -1, -1, -1, "0466010592130100000k*AGUATY8", 0, 0, 18, 18, 0, "(32) 86 C4 83 87 DE 8F 83 82 82 31 6C 2B 42 E6 82 5F D4 3D 0A 34 D7 21 4E D2 8D C5 9C D7", "AAAAAAAAAAAAAAAAAAAAAACCCCCC; BWIPP different encodation", 0 }, /* 6*/ { UNICODE_MODE | FAST_MODE, 0, -1, -1, -1, "0466010592130100000k*AGUATY80U", 0, 0, 20, 20, 1, "(40) 86 C4 83 87 DE 8F 83 82 82 31 6C EE 08 85 D6 D2 EF 65 FE 56 81 76 4F AB 22 B8 6F 0A", "", 0 }, /* 7*/ { UNICODE_MODE, 0, -1, -1, -1, "0466010592130100000k*AGUATY80U", 0, 0, 20, 20, 0, "(40) 86 C4 83 87 DE 8F 83 82 82 31 6C F0 A8 11 D5 05 46 5F D2 56 81 76 3C D6 92 14 9F E2", "AAAAAAAAAAAAAAAAAAAAEEEEEEEAAA; BWIPP same as FAST_MODE", 0 }, - /* 8*/ { UNICODE_MODE | FAST_MODE, 0, 5, -1, -1, "0466010592130100000k*AGUATY80U", ZINT_ERROR_TOO_LONG, -1, 0, 0, 0, "Error 522: Input too long for selected symbol size", "", 0 }, - /* 9*/ { UNICODE_MODE, 0, 5, -1, -1, "0466010592130100000k*AGUATY80U", ZINT_ERROR_TOO_LONG, -1, 0, 0, 0, "Error 522: Input too long for selected symbol size", "", 0 }, + /* 8*/ { UNICODE_MODE | FAST_MODE, 0, 5, -1, -1, "0466010592130100000k*AGUATY80U", ZINT_ERROR_TOO_LONG, -1, 0, 0, 0, "Error 522: Input too long for Version 5, requires 19 codewords (maximum 18)", "", 0 }, + /* 9*/ { UNICODE_MODE, 0, 5, -1, -1, "0466010592130100000k*AGUATY80U", ZINT_ERROR_TOO_LONG, -1, 0, 0, 0, "Error 522: Input too long for Version 5, requires 19 codewords (maximum 18)", "", 0 }, /* 10*/ { UNICODE_MODE | FAST_MODE, 0, 6, -1, -1, "0466010592130100000k*AGUATY80U", 0, 0, 20, 20, 1, "(40) 86 C4 83 87 DE 8F 83 82 82 31 6C EE 08 85 D6 D2 EF 65 FE 56 81 76 4F AB 22 B8 6F 0A", "", 0 }, /* 11*/ { UNICODE_MODE, 0, 6, -1, -1, "0466010592130100000k*AGUATY80U", 0, 0, 20, 20, 0, "(40) 86 C4 83 87 DE 8F 83 82 82 31 6C F0 A8 11 D5 05 46 5F D2 56 81 76 3C D6 92 14 9F E2", "AAAAAAAAAAAAAAAAAAAAEEEEEEEAAA; BWIPP same as FAST_MODE", 0 }, /* 12*/ { UNICODE_MODE | FAST_MODE, 0, -1, -1, -1, "0466010592130100000k*AGUATY80UA", 0, 0, 20, 20, 1, "(40) 86 C4 83 87 DE 8F 83 82 82 31 6C E6 07 B7 82 5F D4 3D 1E 5F FE 81 1E 1B B0 FE E7 54", "", 0 }, @@ -934,7 +962,7 @@ static void test_input(const testCtx *const p_ctx) { /*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); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -1085,7 +1113,7 @@ static void test_encode(const testCtx *const p_ctx) { /* Verified manually against ISO/IEC 16022:2006, ISO/IEC 21471:2020, GS1 General Specifications 21.0.1 (GGS), ANSI/HIBC LIC 2.6-2016 (HIBC/LIC), ANSI/HIBC PAS 1.3-2010 (HIBC/PAS) and AIM ITS/04-023:2022 (ECI Part 3: Register), with noted exceptions */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DATAMATRIX, FAST_MODE, -1, -1, -1, -1, "1234abcd", -1, 0, 14, 14, 1, "", 0, "10101010101010" "11001010001111" @@ -5503,7 +5531,7 @@ static void test_encode(const testCtx *const p_ctx) { "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -5637,7 +5665,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 14, 14, 1, "ISO 16022:2006 11.6 example", "10101010101010" "10000100111111" @@ -5799,7 +5827,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { "11111111111111111111111111" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, j, seg_count, ret; struct zint_symbol *symbol = NULL; @@ -5915,7 +5943,7 @@ static void test_minimalenc(const testCtx *const p_ctx) { char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DATAMATRIX, -1, -1, -1, "A", -1, 0, 0, "ASC" }, /* 1*/ { BARCODE_DATAMATRIX, -1, -1, -1, "AA", -1, 0, 0, "ASC" }, /* 2*/ { BARCODE_DATAMATRIX, -1, -1, -1, "AAA", -1, 0, 0, "ASC" }, @@ -6934,7 +6962,7 @@ static void test_minimalenc(const testCtx *const p_ctx) { /*1015*/ { BARCODE_DATAMATRIX, -1, -1, -1, "\200\200\200@A1^B2?C\200\200\200", -1, 0, 0, "" }, /*1016*/ { BARCODE_DATAMATRIX, -1, -1, -1, "@@@@@@@@@_", -1, 0, 1, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -7017,7 +7045,7 @@ static void test_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DATAMATRIX, FAST_MODE, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz&,:#-.$/+%*=^ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLM" "NOPQRSTUVWXYZ;<>@[]_`~!||()?{}'123456789012345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJK" @@ -7089,7 +7117,7 @@ static void test_perf(const testCtx *const p_ctx) { /* 4*/ { BARCODE_DATAMATRIX, FAST_MODE, -1, -1, "https://example.com/01/09506000134369", 0, 22, 22, "37 chars, text/numeric" }, /* 5*/ { BARCODE_DATAMATRIX, -1, -1, -1, "https://example.com/01/09506000134369", 0, 22, 22, "37 chars, text/numeric" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; diff --git a/backend/tests/test_dotcode.c b/backend/tests/test_dotcode.c index 4aa71a50..62f49a84 100644 --- a/backend/tests/test_dotcode.c +++ b/backend/tests/test_dotcode.c @@ -39,17 +39,18 @@ static void test_large(const testCtx *const p_ctx) { char datum; int length; int ret; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { 200, '0', 2940, 0 }, /* 2940 largest Code Set C data that fits in 200x199 HxW */ - /* 1*/ { 200, '0', 2941, ZINT_ERROR_INVALID_OPTION }, - /* 2*/ { 200, '9', 200, 0 }, /* Changes a number of mask scores re pre-Rev. 4 version, but best score still the same (7) */ - /* 3*/ { 201, '0', 2940, ZINT_ERROR_INVALID_OPTION }, - /* 4*/ { 201, '0', 2974, ZINT_ERROR_INVALID_OPTION }, /* Height > 200 also */ - /* 5*/ { 30, '\001', 71, 0 }, /* Codeword length 72, ECC length 39, for ND + 1 == 112 */ + static const struct item data[] = { + /* 0*/ { 200, '0', 2940, 0, "" }, /* 2940 largest Code Set C data that fits in 200x199 HxW */ + /* 1*/ { 200, '0', 2941, ZINT_ERROR_INVALID_OPTION, "Error 528: Symbol height '201' is too large" }, + /* 2*/ { 200, '9', 200, 0, "" }, /* Changes a number of mask scores re pre-Rev. 4 version, but best score still the same (7) */ + /* 3*/ { 201, '0', 2940, ZINT_ERROR_INVALID_OPTION, "Error 528: Symbol width '201' is too large" }, + /* 4*/ { 201, '0', 2974, ZINT_ERROR_INVALID_OPTION, "Error 526: Symbol size '201x202' (WxH) is too large" }, /* Height > 200 also */ + /* 5*/ { 30, '\001', 71, 0, "" }, /* Codeword length 72, ECC length 39, for ND + 1 == 112 */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -70,6 +71,7 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); 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 strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); ZBarcode_Delete(symbol); } @@ -95,29 +97,29 @@ static void test_options(const testCtx *const p_ctx) { const char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { -1, -1, -1, -1, -1, { 0, 0, "" }, "1", 0, 9, 14, "" }, /* 1*/ { -1, -1, -1, -1, -1, { 0, 0, "" }, "1234567890", 0, 12, 19, "" }, /* 2*/ { -1, -1, -1, 19, -1, { 0, 0, "" }, "1234567890", 0, 12, 19, "" }, /* 3*/ { -1, -1, -1, 12, -1, { 0, 0, "" }, "1234567890", 0, 19, 12, "" }, /* 4*/ { -1, -1, -1, 5, -1, { 0, 0, "" }, "1234567890", 0, 44, 5, "" }, - /* 5*/ { -1, -1, -1, 4, -1, { 0, 0, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 529: Symbol width 4 is too small" }, /* Cols < 5 */ - /* 6*/ { -1, -1, -1, 200, -1, { 0, 0, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 529: Symbol height 3 is too small" }, /* Not enough data - height 3 too small */ + /* 5*/ { -1, -1, -1, 4, -1, { 0, 0, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 529: Symbol width '4' is too small" }, /* Cols < 5 */ + /* 6*/ { -1, -1, -1, 200, -1, { 0, 0, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 529: Symbol height '3' is too small" }, /* Not enough data - height 3 too small */ /* 7*/ { -1, -1, -1, 200, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890", 0, 5, 200, "" }, /* Cols 200 max */ /* 8*/ { -1, -1, -1, 200, -1, { 0, 0, "" }, "12345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 7, 200, "" }, - /* 9*/ { -1, -1, -1, 201, -1, { 0, 0, "" }, "12345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 528: Symbol width 201 is too large" }, + /* 9*/ { -1, -1, -1, 201, -1, { 0, 0, "" }, "12345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 528: Symbol width '201' is too large" }, /* 10*/ { -1, -1, -1, -1, 10 << 8, { 0, 0, "" }, "1", 0, 9, 14, "" }, /* Mask > 8 + 1 ignored */ /* 11*/ { -1, -1, -1, 19, -1, { 0, 0, "" }, "ABCDE", 0, 12, 19, "" }, /* 12*/ { -1, -1, -1, 19, -1, { 35, 35, "" }, "ABCDE", 0, 16, 19, "" }, - /* 13*/ { -1, -1, -1, 19, -1, { 1, 1, "" }, "ABCDE", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 730: Structured Append count out of range (2-35)" }, - /* 14*/ { -1, -1, -1, 19, -1, { 1, 36, "" }, "ABCDE", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 730: Structured Append count out of range (2-35)" }, - /* 15*/ { -1, -1, -1, 19, -1, { 3, 2, "" }, "ABCDE", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 731: Structured Append index out of range (1-2)" }, + /* 13*/ { -1, -1, -1, 19, -1, { 1, 1, "" }, "ABCDE", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 730: Structured Append count '1' out of range (2 to 35)" }, + /* 14*/ { -1, -1, -1, 19, -1, { 1, 36, "" }, "ABCDE", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 730: Structured Append count '36' out of range (2 to 35)" }, + /* 15*/ { -1, -1, -1, 19, -1, { 3, 2, "" }, "ABCDE", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 731: Structured Append index '3' out of range (1 to count 2)" }, /* 16*/ { -1, -1, -1, 19, -1, { 1, 2, "1" }, "ABCDE", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 732: Structured Append ID not available for DotCode" }, /* 17*/ { GS1_MODE, 3, -1, -1, -1, { 0, 0, "" }, "[20]01", ZINT_WARN_NONCOMPLIANT, 11, 16, "Warning 733: Using ECI in GS1 mode not supported by GS1 standards" }, /* 18*/ { GS1_MODE, -1, -1, -1, -1, { 1, 2, "" }, "[20]01", ZINT_WARN_NONCOMPLIANT, 12, 19, "Warning 734: Using Structured Append in GS1 mode not supported by GS1 standards" }, /* 19*/ { GS1_MODE, 3, -1, -1, -1, { 1, 2, "" }, "[20]01", ZINT_WARN_NONCOMPLIANT, 14, 21, "Warning 733: Using ECI in GS1 mode not supported by GS1 standards" }, /* ECI trumps Structured Append */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -166,7 +168,7 @@ static void test_input(const testCtx *const p_ctx) { int bwipp_cmp; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "A", -1, 0, "66 21 6A", 1, "" }, /* 1*/ { UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "A", -1, 0, "6C 03 66 21", 1, "" }, /* 2*/ { UNICODE_MODE, 40, 18, -1, { 0, 0, "" }, "A", -1, 0, "6C 28 00 00 66 21", 1, "" }, @@ -174,7 +176,7 @@ static void test_input(const testCtx *const p_ctx) { /* 4*/ { UNICODE_MODE, 899, 18, -1, { 0, 0, "" }, "A", -1, 0, "6C 28 07 44 66 21", 1, "" }, /* 5*/ { UNICODE_MODE, 12769, 18, 8 << 8, { 0, 0, "" }, "A", -1, 0, "6C 28 70 49 66 21", 1, "" }, /* 6*/ { UNICODE_MODE, 811799, 18, -1, { 0, 0, "" }, "A", -1, 0, "6C 67 40 50 66 21", 1, "" }, - /* 7*/ { UNICODE_MODE, 811800, -1, -1, { 0, 0, "" }, "A", -1, ZINT_ERROR_INVALID_OPTION, "Error 525: Invalid ECI", 1, "" }, + /* 7*/ { UNICODE_MODE, 811800, -1, -1, { 0, 0, "" }, "A", -1, ZINT_ERROR_INVALID_OPTION, "Error 525: ECI code '811800' out of range (0 to 811799)", 1, "" }, /* 8*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\000", 1, 0, "65 40 6A", 1, "LatchA (0x65) NUL PAD" }, /* 9*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\010", -1, 0, "65 48 6A", 1, "LatchA (0x65) BS PAD" }, /* 10*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "\011", -1, 0, "65 49 6A", 1, "Lead special; LatchA (0x65) HT PAD" }, @@ -210,7 +212,7 @@ static void test_input(const testCtx *const p_ctx) { /* 40*/ { UNICODE_MODE, -1, -1, -1, { 2, 3, "" }, "\001\002\003\004", -1, 0, "65 41 42 43 44 6A 12 13 6C", 1, "LatchA (0x65) PAD 2 3 FNC2" }, /* 41*/ { DATA_MODE, -1, -1, -1, { 1, 34, "" }, "\200\201\202\203", -1, 0, "70 13 56 0A 59 2C 6D 11 39 6C", 1, "BinaryLatch (0x70) (...) TermA (0x6D) 1 Y FNC2" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -306,7 +308,7 @@ static void test_encode(const testCtx *const p_ctx) { char *expected; }; /* ISS DotCode, Rev 4.0, DRAFT 0.15, TSC Pre-PR #5, MAY 28, 2019 */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { GS1_MODE, 64, -1, { 0, 0, "" }, "[01]00012345678905[17]201231[10]ABC123456", -1, 0, 9, 64, 1, 1, "ISS DotCode Rev 4.0 Figure 1 (left), same", "1010000000101000101010000010000010001010100010101000101000001010" "0100010001010001010001000001010100010100010001000100010101000001" @@ -1077,7 +1079,7 @@ static void test_encode(const testCtx *const p_ctx) { "10100010000010101010000010" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -1179,7 +1181,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { char *expected; }; /* ISS DotCode, Rev 4.0, DRAFT 0.15, TSC Pre-PR #5, MAY 28, 2019 */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, 18, -1, { 0, 0, "" }, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 13, 18, 1, 1, "ISS DotCode Rev 4.0 13.5 example **NOT SAME** different encodation", "100000001010101010" "000100000100010101" @@ -1457,7 +1459,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { "01000101000001010100000100010" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, j, seg_count, ret; struct zint_symbol *symbol = NULL; @@ -1567,7 +1569,7 @@ static void test_fuzz(const testCtx *const p_ctx) { int ret; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { DATA_MODE, "(\207'", -1, 0 }, /* 0x28,0x87,0x27 Note: should but doesn't trigger sanitize error if no length check, for some reason; UPDATE: use up-to-date gcc (9)! */ /* 1*/ { DATA_MODE, "\133\061\106\133\061\106\070\161\116\133\116\116\067\040\116\016\000\116\125\111\125\125\316\125\125\116\116\116\116\117\116\125" @@ -1591,7 +1593,7 @@ static void test_fuzz(const testCtx *const p_ctx) { /* 5*/ { DATA_MODE, "\237\032", -1, 0 }, /* As above L904 */ /* 6*/ { DATA_MODE, "\237", -1, 0 }, /* As above L1090 */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -1692,7 +1694,7 @@ static void test_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DOTCODE, -1, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz&,:#-.$/+%*=^ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLM" "NOPQRSTUVWXYZ;<>@[]_`~!||()?{}'123456789012345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJK" @@ -1702,7 +1704,7 @@ static void test_perf(const testCtx *const p_ctx) { "fghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO", 0, 124, 185, "960 chars, text/numeric" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; clock_t start, total_encode = 0, total_buffer = 0, diff_encode, diff_buffer; diff --git a/backend/tests/test_emf.c b/backend/tests/test_emf.c index d96f9063..5f7aa8d1 100644 --- a/backend/tests/test_emf.c +++ b/backend/tests/test_emf.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2023 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -53,7 +53,7 @@ static void test_print(const testCtx *const p_ctx) { char *expected_file; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "Égjpqy", "code128_egrave_bold.emf", "" }, /* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, 0.0f, 100.0f / 25.4f, "", "", 0, "Égjpqy", "code128_egrave_bold_100dpi.emf", "" }, /* 2*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, 0.0f, 150.0f / 25.4f, "", "", 0, "Égjpqy", "code128_egrave_bold_150dpi.emf", "" }, @@ -95,7 +95,7 @@ static void test_print(const testCtx *const p_ctx) { /* 38*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, 0.0f, 300.0f, "", "FFFFFF00", 90, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", "maxicode_rotate_90_nobg_300dpi.emf", "" }, /* 39*/ { BARCODE_UPU_S10, -1, -1, CMYK_COLOUR, -1, -1, -1, -1, 0.0f, 0, "71,0,40,44", "FFFFFF00", 0, "QA47312482PS", "upu_s10_cmyk_nobg.emf", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -229,12 +229,15 @@ static void test_outfile(const testCtx *const p_ctx) { skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ #endif if (!skip_readonly_test) { + static char expected_errtxt[] = "640: Could not open EMF output file ("; /* Excluding OS-dependent `errno` stuff */ + (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ assert_nonzero(testUtilCreateROFile(symbol.outfile), "emf_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret = emf_plot(&symbol, 0); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "emf_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "emf_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); + assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); } symbol.output_options |= BARCODE_STDOUT; diff --git a/backend/tests/test_gif.c b/backend/tests/test_gif.c index 3a351d3d..c8314f4a 100644 --- a/backend/tests/test_gif.c +++ b/backend/tests/test_gif.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2023 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -45,7 +45,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) { int ret; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, 1, 1, "1", 0, 0 }, /* 1*/ { BARCODE_CODE128, 2, 1, "11", 0, 0 }, /* 2*/ { BARCODE_CODE128, 3, 1, "101", 0, 0 }, @@ -58,7 +58,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) { /* 9*/ { BARCODE_ULTRA, 19, 32, "WWCWBWMWRWYWGWKCCWCMCRCYCGCKBWBCBBMBRBYBGBKMWMCMBMMRMYMGMKRWRCRBRMRRYRGRKYWYCYBYMYRYYGYKGWGCGBGMGRGYGGKKWK", 1, 0 }, /* Two LZW blocks, last size 1 */ /* 10*/ { BARCODE_ULTRA, 1, 1, "D", 0, 0 }, /* This used to fail, now just maps unknown codes to 0 (1st colour index) */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, ret; struct zint_symbol *symbol = NULL; @@ -143,7 +143,7 @@ static void test_print(const testCtx *const p_ctx) { char *expected_file; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 0, 0, { 0, 0, "" }, "", "", "12", "dotcode_1.0.gif", "" }, /* 1*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 0, 0.1, { 0, 0, "" }, "", "", "12", "dotcode_1.0_ds0.1.gif", "" }, /* 2*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 0, 1.1, { 0, 0, "" }, "", "", "12", "dotcode_1.0_ds1.1.gif", "" }, @@ -182,7 +182,7 @@ static void test_print(const testCtx *const p_ctx) { /* 35*/ { BARCODE_ULTRA, -1, -1, 1, -1, -1, 2, 0, 0, 0, { 0, 0, "" }, "", "", "12", "ultra_rev2.gif", "Revision 2" }, /* 36*/ { BARCODE_DPD, -1, BARCODE_QUIET_ZONES | COMPLIANT_HEIGHT, -1, -1, -1, -1, 0, 0, 0, { 0, 0, "" }, "", "", "008182709980000020028101276", "dpd_compliant.gif", "Now with bind top 3X default" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -314,12 +314,15 @@ static void test_outfile(const testCtx *const p_ctx) { skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ #endif if (!skip_readonly_test) { + static char expected_errtxt[] = "611: Could not open GIF output file ("; /* Excluding OS-dependent `errno` stuff */ + (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ assert_nonzero(testUtilCreateROFile(symbol.outfile), "gif_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret = gif_pixel_plot(&symbol, data); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "gif_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "gif_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); + assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); } symbol.output_options |= BARCODE_STDOUT; diff --git a/backend/tests/test_gridmtx.c b/backend/tests/test_gridmtx.c index 75837b32..25116518 100644 --- a/backend/tests/test_gridmtx.c +++ b/backend/tests/test_gridmtx.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2023 Robin Stuart + Copyright (C) 2019-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -42,36 +42,58 @@ static void test_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { -1, -1, "1", 2751, 0, 162, 162 }, - /* 1*/ { -1, -1, "1", 2752, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { -1, -1, "1", 2755, ZINT_ERROR_TOO_LONG, -1, -1 }, /* Triggers buffer > 9191 */ - /* 3*/ { -1, -1, "A", 1836, 0, 162, 162 }, - /* 4*/ { -1, -1, "A", 1837, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 5*/ { -1, -1, "A1", 1529, 0, 162, 162 }, - /* 6*/ { -1, -1, "A1", 1530, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 7*/ { -1, -1, "\200", 1143, 0, 162, 162 }, - /* 8*/ { -1, -1, "\200", 1144, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 9*/ { -1, ZINT_FULL_MULTIBYTE, "\241", 1410, 0, 162, 162 }, - /* 10*/ { -1, ZINT_FULL_MULTIBYTE, "\241", 1412, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 11*/ { 1, -1, "1", 18, 0, 18, 18 }, - /* 12*/ { 1, -1, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 13*/ { 1, -1, "A", 13, 0, 18, 18 }, - /* 14*/ { 1, -1, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 15*/ { 1, -1, "\200", 7, 0, 18, 18 }, - /* 16*/ { 1, -1, "\200", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 17*/ { 1, ZINT_FULL_MULTIBYTE, "\241", 8, 0, 18, 18 }, - /* 18*/ { 1, ZINT_FULL_MULTIBYTE, "\241", 10, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 19*/ { 11, -1, "1", 1995, 0, 138, 138 }, - /* 20*/ { 11, -1, "1", 1996, ZINT_ERROR_TOO_LONG, -1, -1 }, + static const struct item data[] = { + /* 0*/ { -1, -1, "1", 2751, 0, 162, 162, "" }, + /* 1*/ { -1, -1, "1", 2752, ZINT_ERROR_TOO_LONG, -1, -1, "Error 531: Input too long, requires too many codewords (maximum 1313)" }, + /* 2*/ { -1, -1, "1", 2755, ZINT_ERROR_TOO_LONG, -1, -1, "Error 531: Input too long, requires too many codewords (maximum 1313)" }, /* Triggers buffer > 9191 */ + /* 3*/ { -1, -1, "A", 1836, 0, 162, 162, "" }, + /* 4*/ { -1, -1, "A", 1837, ZINT_ERROR_TOO_LONG, -1, -1, "Error 531: Input too long, requires too many codewords (maximum 1313)" }, + /* 5*/ { -1, -1, "A1", 1529, 0, 162, 162, "" }, + /* 6*/ { -1, -1, "A1", 1530, ZINT_ERROR_TOO_LONG, -1, -1, "Error 531: Input too long, requires too many codewords (maximum 1313)" }, + /* 7*/ { -1, -1, "\200", 1143, 0, 162, 162, "" }, + /* 8*/ { -1, -1, "\200", 1144, ZINT_ERROR_TOO_LONG, -1, -1, "Error 531: Input too long, requires too many codewords (maximum 1313)" }, + /* 9*/ { -1, ZINT_FULL_MULTIBYTE, "\241", 1410, 0, 162, 162, "" }, + /* 10*/ { -1, ZINT_FULL_MULTIBYTE, "\241", 1412, ZINT_ERROR_TOO_LONG, -1, -1, "Error 531: Input too long, requires too many codewords (maximum 1313)" }, + /* 11*/ { 1, -1, "1", 18, 0, 18, 18, "" }, + /* 12*/ { 1, -1, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 1, requires 13 codewords (maximum 11)" }, + /* 13*/ { 1, -1, "A", 13, 0, 18, 18, "" }, + /* 14*/ { 1, -1, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 1, requires 12 codewords (maximum 11)" }, + /* 15*/ { 1, -1, "\200", 7, 0, 18, 18, "" }, + /* 16*/ { 1, -1, "\200", 8, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 1, requires 12 codewords (maximum 11)" }, + /* 17*/ { 1, ZINT_FULL_MULTIBYTE, "\241", 8, 0, 18, 18, "" }, + /* 18*/ { 1, ZINT_FULL_MULTIBYTE, "\241", 10, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 1, requires 12 codewords (maximum 11)" }, + /* 19*/ { 2, ZINT_FULL_MULTIBYTE, "\241", 40, 0, 30, 30, "" }, + /* 20*/ { 2, ZINT_FULL_MULTIBYTE, "\241", 41, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 2, requires 42 codewords (maximum 40)" }, + /* 21*/ { 3, -1, "A", 108, 0, 42, 42, "" }, + /* 22*/ { 3, -1, "A", 109, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 3, requires 80 codewords (maximum 79)" }, + /* 23*/ { 4, -1, "A", 202, 0, 54, 54, "" }, + /* 24*/ { 4, -1, "A", 203, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 4, requires 147 codewords (maximum 146)" }, + /* 25*/ { 5, -1, "1", 453, 0, 66, 66, "" }, + /* 26*/ { 5, -1, "1", 454, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 5, requires 220 codewords (maximum 218)" }, + /* 27*/ { 6, -1, "1", 633, 0, 78, 78, "" }, + /* 28*/ { 6, -1, "1", 634, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 6, requires 306 codewords (maximum 305)" }, + /* 29*/ { 7, -1, "\200", 352, 0, 90, 90, "" }, + /* 30*/ { 7, -1, "\200", 353, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 7, requires 406 codewords (maximum 405)" }, + /* 31*/ { 8, -1, "A", 727, 0, 102, 102, "" }, + /* 32*/ { 8, -1, "A", 728, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 8, requires 522 codewords (maximum 521)" }, + /* 33*/ { 9, -1, "A", 908, 0, 114, 114, "" }, + /* 34*/ { 9, -1, "A", 909, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 9, requires 651 codewords (maximum 650)" }, + /* 35*/ { 10, -1, "1", 1662, 0, 126, 126, "" }, + /* 36*/ { 10, -1, "1", 1663, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 10, requires 796 codewords (maximum 794)" }, + /* 37*/ { 11, -1, "1", 1995, 0, 138, 138, "" }, + /* 38*/ { 11, -1, "1", 1996, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 11, requires 954 codewords (maximum 953)" }, + /* 39*/ { 11, -1, "1", 2748, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 11, requires 1311 codewords (maximum 953)" }, + /* 40*/ { 12, -1, "1", 2355, 0, 150, 150, "" }, + /* 41*/ { 12, -1, "1", 2356, ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 12, requires 1126 codewords (maximum 1125)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; - char data_buf[2755 + 1]; + char data_buf[2800 + 1]; testStartSymbol("test_large", &symbol); @@ -89,6 +111,8 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -115,13 +139,13 @@ static void test_options(const testCtx *const p_ctx) { const char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { 0, 0, { 0, 0, "" }, "12345", 0, 0, 18, "" }, /* 1*/ { 0, 1, { 0, 0, "" }, "12345", 0, 0, 18, "" }, /* 2*/ { 0, 2, { 0, 0, "" }, "12345", 0, 0, 30, "" }, /* 3*/ { 0, 14, { 0, 0, "" }, "12345", 0, 0, 18, "" }, /* Version > max version 13 so ignored */ /* 4*/ { 0, 13, { 0, 0, "" }, "12345", 0, 0, 162, "" }, - /* 5*/ { 0, 1, { 0, 0, "" }, "1234567890123456789", ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input data too long for selected symbol size" }, + /* 5*/ { 0, 1, { 0, 0, "" }, "1234567890123456789", ZINT_ERROR_TOO_LONG, -1, -1, "Error 534: Input too long for Version 1, requires 13 codewords (maximum 11)" }, /* 6*/ { 0, 2, { 0, 0, "" }, "1234567890123456789", 0, 0, 30, "" }, /* 7*/ { 0, 0, { 0, 0, "" }, "123456789012345678", 0, 0, 30, "" }, /* Version auto-set to 2 */ /* 8*/ { 0, 1, { 0, 0, "" }, "123456789012345678", 0, 0, 18, "" }, @@ -131,16 +155,16 @@ static void test_options(const testCtx *const p_ctx) { /* 12*/ { 1, 0, { 0, 0, "" }, "123456789012345678", 0, 0, 30, "" }, /* ECC < min ECC 2, ECC 2 used */ /* 13*/ { 4, 1, { 0, 0, "" }, "123456789012345678", 0, 0, 18, "" }, /* 14*/ { 0, 0, { 1, 2, "" }, "12345", 0, 0, 18, "" }, - /* 15*/ { 0, 0, { 1, 1, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 536: Structured Append count out of range (2-16)" }, - /* 16*/ { 0, 0, { 1, 17, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 536: Structured Append count out of range (2-16)" }, - /* 17*/ { 0, 0, { 0, 2, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 537: Structured Append index out of range (1-2)" }, - /* 18*/ { 0, 0, { 3, 2, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 537: Structured Append index out of range (1-2)" }, + /* 15*/ { 0, 0, { 1, 1, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 536: Structured Append count '1' out of range (2 to 16)" }, + /* 16*/ { 0, 0, { 1, 17, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 536: Structured Append count '17' out of range (2 to 16)" }, + /* 17*/ { 0, 0, { 0, 2, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 537: Structured Append index '0' out of range (1 to count 2)" }, + /* 18*/ { 0, 0, { 3, 2, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 537: Structured Append index '3' out of range (1 to count 2)" }, /* 19*/ { 0, 0, { 1, 2, "255" }, "12345", 0, 0, 18, "" }, - /* 20*/ { 0, 0, { 1, 2, "1234" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 538: Structured Append ID too long (3 digit maximum)" }, + /* 20*/ { 0, 0, { 1, 2, "1234" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 538: Structured Append ID length 4 too long (3 digit maximum)" }, /* 21*/ { 0, 0, { 1, 2, "A" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 539: Invalid Structured Append ID (digits only)" }, - /* 22*/ { 0, 0, { 1, 2, "256" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 530: Structured Append ID '256' out of range (0-255)" }, + /* 22*/ { 0, 0, { 1, 2, "256" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 530: Structured Append ID value '256' out of range (0 to 255)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -199,7 +223,7 @@ static void test_input(const testCtx *const p_ctx) { ㈩ U+3229 in GB 2312 0x226E 一 U+4E00 in GB 2312 0x523B */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, 0, -1, -1, { 0, 0, "" }, "é", 0, 0, "08 54 6F 78 00", "H1 (GB 2312) Note: Grid Matrix default is GB 2312, not ISO 8859-1" }, /* 1*/ { UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "é", 0, 3, "60 01 58 00 74 40", "ECI-3 B1 (ISO 8859-1)" }, /* 2*/ { UNICODE_MODE, 29, -1, -1, { 0, 0, "" }, "é", 0, 29, "60 0E 44 2A 37 7C 00", "ECI-29 H1 (GB 2312)" }, @@ -308,8 +332,8 @@ static void test_input(const testCtx *const p_ctx) { /*105*/ { UNICODE_MODE, 900, -1, -1, { 0, 0, "" }, "é", 0, 900, "63 42 18 01 61 6A 20", "ECI-900 B2 (no conversion)" }, /*106*/ { UNICODE_MODE, 1024, -1, -1, { 0, 0, "" }, "é", 0, 1024, "64 08 00 30 03 43 54 40", "ECI-1024 B2 (no conversion)" }, /*107*/ { UNICODE_MODE, 32768, -1, -1, { 0, 0, "" }, "é", 0, 32768, "66 08 00 01 40 0E 0E 52 00", "ECI-32768 B2 (no conversion)" }, - /*108*/ { UNICODE_MODE, 811800, -1, -1, { 0, 0, "" }, "é", ZINT_ERROR_INVALID_OPTION, 811800, "Error 533: Invalid ECI", "" }, - /*109*/ { UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "β", ZINT_ERROR_INVALID_DATA, 3, "Error 535: Invalid character in input data for ECI 3", "" }, + /*108*/ { UNICODE_MODE, 811800, -1, -1, { 0, 0, "" }, "é", ZINT_ERROR_INVALID_OPTION, 811800, "Error 533: ECI code '811800' out of range (0 to 811799)", "" }, + /*109*/ { UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "β", ZINT_ERROR_INVALID_DATA, 3, "Error 535: Invalid character in input for ECI '3'", "" }, /*110*/ { UNICODE_MODE, 0, READER_INIT, -1, { 0, 0, "" }, "12", 0, 0, "51 11 71 7E 40", "" }, /*111*/ { UNICODE_MODE, 0, -1, -1, { 1, 16, "" }, "12", 0, 0, "48 03 60 24 3C 3F 50", "FNC2 ID0 Cnt15 Ind0 N2" }, /*112*/ { UNICODE_MODE, 0, READER_INIT, -1, { 1, 16, "" }, "12", 0, 0, "54 40 1E 02 23 63 7D 00", "FNC3 FNC2 ID0 Cnt15 Ind0 N2" }, @@ -317,7 +341,7 @@ static void test_input(const testCtx *const p_ctx) { /*114*/ { UNICODE_MODE, 0, READER_INIT, -1, { 2, 16, "" }, "12", 0, 0, "48 03 62 24 3C 3F 50", "FNC2 ID0 Cnt15 Ind1 N2 (FNC3 omitted)" }, /*115*/ { UNICODE_MODE, 0, -1, -1, { 3, 3, "255" }, "12", 0, 0, "4F 7C 44 24 3C 3F 50", "FNC2 ID256 Cnt2 Ind2 N2" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -377,7 +401,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { "1234", UNICODE_MODE, -1, -1, 0, 18, 18, "", "111111000000111111" "101111001100101001" @@ -475,7 +499,7 @@ static void test_encode(const testCtx *const p_ctx) { "111111000000111111000000111111000000111111" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -536,7 +560,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { ¶ not in GB 2312 (in ISO/IEC 8869-1) Ж in GB 2312 (and ISO/IEC 8859-5) */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, ZINT_WARN_USES_ECI, 30, 30, "Standard example (adds ECI 3 for ¶)", "111111000000111111000000111111" "111111011110111111011110111111" @@ -810,7 +834,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { "111111000000111111000000111111" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, j, seg_count, ret; struct zint_symbol *symbol = NULL; @@ -886,7 +910,7 @@ static void test_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_GRIDMATRIX, UNICODE_MODE, -1, -1, "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738", 0, 66, 66, "97 chars, mixed modes" }, @@ -903,7 +927,7 @@ static void test_perf(const testCtx *const p_ctx) { "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738 AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738", 0, 162, 162, "970 chars, mixed modes" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; diff --git a/backend/tests/test_gs1.c b/backend/tests/test_gs1.c index 3cfa4d3f..f3280b49 100644 --- a/backend/tests/test_gs1.c +++ b/backend/tests/test_gs1.c @@ -47,7 +47,7 @@ static void test_gs1_reduce(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_GS1_128, -1, "12345678901234", "", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" }, /* 1*/ { BARCODE_GS1_128, -1, "[01]12345678901231", "", 0, "Input mode ignored; verified manually against tec-it", "11010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110100001100101100011101011" @@ -190,9 +190,9 @@ static void test_gs1_reduce(const testCtx *const p_ctx) { "010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char *text; @@ -201,7 +201,7 @@ static void test_gs1_reduce(const testCtx *const p_ctx) { int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ - testStart("test_gs1_reduce"); + testStartSymbol("test_gs1_reduce", &symbol); for (i = 0; i < data_size; i++) { @@ -272,7 +272,7 @@ static void test_hrt(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_GS1_128, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12" }, /* Incorrect check digit */ /* 1*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[01]12345678901234[20]12", "", 0, "(01)12345678901234(20)12" }, /* 2*/ { BARCODE_GS1_128, -1, "[01]12345678901231[20]12", "", 0, "(01)12345678901231(20)12" }, @@ -328,13 +328,13 @@ static void test_hrt(const testCtx *const p_ctx) { /* 52*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]12345678901234[20]12", "[21]12345", 0, "" }, /* 53*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[20]12", "[21]12345", 0, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char *text; - testStart("test_hrt"); + testStartSymbol("test_hrt", &symbol); for (i = 0; i < data_size; i++) { @@ -373,1042 +373,1044 @@ static void test_gs1_verify(const testCtx *const p_ctx) { char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "", ZINT_ERROR_INVALID_DATA, "", "252: Data does not start with an AI" }, - /* 1*/ { "[", ZINT_ERROR_INVALID_DATA, "", "253: Malformed AI in input data (brackets don't match)" }, - /* 2*/ { "[]12", ZINT_ERROR_INVALID_DATA, "", "256: Invalid AI in input data (AI too short)" }, - /* 3*/ { "[1]12", ZINT_ERROR_INVALID_DATA, "", "256: Invalid AI in input data (AI too short)" }, - /* 4*/ { "[12345]12", ZINT_ERROR_INVALID_DATA, "", "255: Invalid AI in input data (AI too long)" }, - /* 5*/ { "[9999]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9999)" }, - /* 6*/ { "[[01]]1234", ZINT_ERROR_INVALID_DATA, "", "254: Found nested brackets in input data" }, - /* 7*/ { "[1A]12", ZINT_ERROR_INVALID_DATA, "", "257: Invalid AI in input data (non-numeric characters in AI)" }, - /* 8*/ { "[10]", ZINT_ERROR_INVALID_DATA, "", "258: Empty data field in input data" }, - /* 9*/ { "[90]\012", ZINT_ERROR_INVALID_DATA, "", "251: Control characters are not supported by GS1" }, - /* 10*/ { "[90]\177", ZINT_ERROR_INVALID_DATA, "", "263: DEL characters are not supported by GS1" }, - /* 11*/ { "[90]\200", ZINT_ERROR_INVALID_DATA, "", "250: Extended ASCII characters are not supported by GS1" }, - /* 12*/ { "[00]123456789012345678", ZINT_WARN_NONCOMPLIANT, "00123456789012345678", "261: AI (00) position 18: Bad checksum '8', expected '5'" }, - /* 13*/ { "[00]123456789012345675", 0, "00123456789012345675", "" }, - /* 14*/ { "[00]12345678901234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (00)" }, - /* 15*/ { "[00]1234567890123456789", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (00)" }, - /* 16*/ { "[00]376104250021234569", 0, "00376104250021234569", "" }, - /* 17*/ { "[00]376104250021234568", ZINT_WARN_NONCOMPLIANT, "00376104250021234568", "261: AI (00) position 18: Bad checksum '8', expected '9'" }, - /* 18*/ { "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, "0112345678901234", "261: AI (01) position 14: Bad checksum '4', expected '1'" }, - /* 19*/ { "[01]12345678901231", 0, "0112345678901231", "" }, - /* 20*/ { "[01]123456789012345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (01)" }, - /* 21*/ { "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, "0212345678901234", "261: AI (02) position 14: Bad checksum '4', expected '1'" }, - /* 22*/ { "[02]12345678901231", 0, "0212345678901231", "" }, - /* 23*/ { "[02]1234567890123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (02)" }, - /* 24*/ { "[03]12345678901234", ZINT_WARN_NONCOMPLIANT, "0312345678901234", "261: AI (03) position 14: Bad checksum '4', expected '1'" }, - /* 25*/ { "[03]12345678901231", 0, "0312345678901231", "" }, - /* 26*/ { "[03]1234567890123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (03)" }, - /* 27*/ { "[04]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (04)" }, - /* 28*/ { "[05]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (05)" }, - /* 29*/ { "[06]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (06)" }, - /* 30*/ { "[07]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (07)" }, - /* 31*/ { "[08]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (08)" }, - /* 32*/ { "[09]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (09)" }, - /* 33*/ { "[10]ABCD123456", 0, "10ABCD123456", "" }, - /* 34*/ { "[10]123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (10)" }, - /* 35*/ { "[100]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (100)" }, - /* 36*/ { "[1000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1000)" }, - /* 37*/ { "[11]990102", 0, "11990102", "" }, - /* 38*/ { "[11]9901023", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (11)" }, - /* 39*/ { "[110]990102", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (110)" }, - /* 40*/ { "[1100]990102", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1100)" }, - /* 41*/ { "[12]000100", 0, "12000100", "" }, - /* 42*/ { "[12]00010", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (12)" }, - /* 43*/ { "[120]000100", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (120)" }, - /* 44*/ { "[1200]000100", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1200)" }, - /* 45*/ { "[13]991301", ZINT_WARN_NONCOMPLIANT, "13991301", "261: AI (13) position 3: Invalid month '13'" }, - /* 46*/ { "[13]991201", 0, "13991201", "" }, - /* 47*/ { "[13]9913011", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (13)" }, - /* 48*/ { "[130]991301", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (130)" }, - /* 49*/ { "[1300]991301", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1300)" }, - /* 50*/ { "[14]991201", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (14)" }, - /* 51*/ { "[140]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (140)" }, - /* 52*/ { "[1400]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1400)" }, - /* 53*/ { "[15]021231", 0, "15021231", "" }, - /* 54*/ { "[15]02123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (15)" }, - /* 55*/ { "[150]021231", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (150)" }, - /* 56*/ { "[1500]021231", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1500)" }, - /* 57*/ { "[16]000000", ZINT_WARN_NONCOMPLIANT, "16000000", "261: AI (16) position 3: Invalid month '00'" }, - /* 58*/ { "[16]000100", 0, "16000100", "" }, - /* 59*/ { "[16]00000", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (16)" }, - /* 60*/ { "[160]000000", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (160)" }, - /* 61*/ { "[1600]000000", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1600)" }, - /* 62*/ { "[17]010200", 0, "17010200", "" }, - /* 63*/ { "[17]0102000", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (17)" }, - /* 64*/ { "[170]010200", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (170)" }, - /* 65*/ { "[1700]010200", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1700)" }, - /* 66*/ { "[18]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (18)" }, - /* 67*/ { "[180]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (180)" }, - /* 68*/ { "[1800]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1800)" }, - /* 69*/ { "[19]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (19)" }, - /* 70*/ { "[190]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (190)" }, - /* 71*/ { "[1900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1900)" }, - /* 72*/ { "[20]12", 0, "2012", "" }, - /* 73*/ { "[20]1", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (20)" }, - /* 74*/ { "[200]12", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (200)" }, - /* 75*/ { "[2000]12", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2000)" }, - /* 76*/ { "[21]A12345678", 0, "21A12345678", "" }, - /* 77*/ { "[21]123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (21)" }, - /* 78*/ { "[210]A12345678", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (210)" }, - /* 79*/ { "[2100]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2100)" }, - /* 80*/ { "[22]abcdefghijklmnopqrst", 0, "22abcdefghijklmnopqrst", "" }, - /* 81*/ { "[22]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (22)" }, - /* 82*/ { "[220]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (220)" }, - /* 83*/ { "[2200]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2200)" }, - /* 84*/ { "[23]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (23)" }, - /* 85*/ { "[230]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (230)" }, - /* 86*/ { "[2300]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2300)" }, - /* 87*/ { "[235]1abcdefghijklmnopqrstuvwxyz0", 0, "2351abcdefghijklmnopqrstuvwxyz0", "" }, - /* 88*/ { "[235]1abcdefghijklmnopqrstuvwxyz01", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (235)" }, - /* 89*/ { "[24]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (24)" }, - /* 90*/ { "[240]abcdefghijklmnopqrstuvwxyz1234", 0, "240abcdefghijklmnopqrstuvwxyz1234", "" }, - /* 91*/ { "[240]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (240)" }, - /* 92*/ { "[2400]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2400)" }, - /* 93*/ { "[241]abcdefghijklmnopqrstuvwxyz1234", 0, "241abcdefghijklmnopqrstuvwxyz1234", "" }, - /* 94*/ { "[241]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (241)" }, - /* 95*/ { "[2410]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2410)" }, - /* 96*/ { "[242]12345", 0, "24212345", "" }, - /* 97*/ { "[242]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (242)" }, - /* 98*/ { "[2420]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2420)" }, - /* 99*/ { "[243]abcdefghijklmnopqrst", 0, "243abcdefghijklmnopqrst", "" }, - /*100*/ { "[243]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (243)" }, - /*101*/ { "[2430]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2430)" }, - /*102*/ { "[244]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (244)" }, - /*103*/ { "[2440]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2440)" }, - /*104*/ { "[249]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (249)" }, - /*105*/ { "[2490]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2490)" }, - /*106*/ { "[25]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (25)" }, - /*107*/ { "[250]abcdefghijklmnopqrstuvwxyz1234", 0, "250abcdefghijklmnopqrstuvwxyz1234", "" }, - /*108*/ { "[250]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (250)" }, - /*109*/ { "[2500]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2500)" }, - /*110*/ { "[251]abcdefghijklmnopqrstuvwxyz1234", 0, "251abcdefghijklmnopqrstuvwxyz1234", "" }, - /*111*/ { "[251]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (251)" }, - /*112*/ { "[2510]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2510)" }, - /*113*/ { "[252]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (252)" }, - /*114*/ { "[2520]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2520)" }, - /*115*/ { "[253]131313131313", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (253)" }, - /*116*/ { "[253]1313131313134", ZINT_WARN_NONCOMPLIANT, "2531313131313134", "261: AI (253) position 13: Bad checksum '4', expected '0'" }, - /*117*/ { "[253]1313131313130", 0, "2531313131313130", "" }, - /*118*/ { "[253]131313131313412345678901234567", ZINT_WARN_NONCOMPLIANT, "253131313131313412345678901234567", "261: AI (253) position 13: Bad checksum '4', expected '0'" }, - /*119*/ { "[253]131313131313012345678901234567", 0, "253131313131313012345678901234567", "" }, - /*120*/ { "[253]1313131313134123456789012345678", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (253)" }, - /*121*/ { "[2530]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2530)" }, - /*122*/ { "[254]abcdefghijklmnopqrst", 0, "254abcdefghijklmnopqrst", "" }, - /*123*/ { "[254]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (254)" }, - /*124*/ { "[2540]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2540)" }, - /*125*/ { "[255]131313131313", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (255)" }, - /*126*/ { "[255]1313131313134", ZINT_WARN_NONCOMPLIANT, "2551313131313134", "261: AI (255) position 13: Bad checksum '4', expected '0'" }, - /*127*/ { "[255]1313131313130", 0, "2551313131313130", "" }, - /*128*/ { "[255]1313131313134123456789012", ZINT_WARN_NONCOMPLIANT, "2551313131313134123456789012", "261: AI (255) position 13: Bad checksum '4', expected '0'" }, - /*129*/ { "[255]1313131313130123456789012", 0, "2551313131313130123456789012", "" }, - /*130*/ { "[255]13131313131341234567890123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (255)" }, - /*131*/ { "[2550]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2550)" }, - /*132*/ { "[256]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (256)" }, - /*133*/ { "[2560]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2560)" }, - /*134*/ { "[259]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (259)" }, - /*135*/ { "[2590]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2590)" }, - /*136*/ { "[26]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (26)" }, - /*137*/ { "[260]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (260)" }, - /*138*/ { "[2600]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2600)" }, - /*139*/ { "[27]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (27)" }, - /*140*/ { "[270]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (270)" }, - /*141*/ { "[2700]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2700)" }, - /*142*/ { "[28]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (28)" }, - /*143*/ { "[280]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (280)" }, - /*144*/ { "[2800]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2800)" }, - /*145*/ { "[29]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (29)" }, - /*146*/ { "[290]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (290)" }, - /*147*/ { "[2900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2900)" }, - /*148*/ { "[30]12345678", 0, "3012345678", "" }, - /*149*/ { "[30]123456789", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (30)" }, - /*150*/ { "[300]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (300)" }, - /*151*/ { "[3000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3000)" }, - /*152*/ { "[31]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (31)" }, - /*153*/ { "[310]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (310)" }, - /*154*/ { "[3100]123456", 0, "3100123456", "" }, - /*155*/ { "[3100]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3100)" }, - /*156*/ { "[3101]123456", 0, "3101123456", "" }, - /*157*/ { "[3101]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3101)" }, - /*158*/ { "[3105]123456", 0, "3105123456", "" }, - /*159*/ { "[3105]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3105)" }, - /*160*/ { "[3106]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3106)" }, - /*161*/ { "[3109]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3109)" }, - /*162*/ { "[3110]123456", 0, "3110123456", "" }, - /*163*/ { "[3110]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3110)" }, - /*164*/ { "[3115]123456", 0, "3115123456", "" }, - /*165*/ { "[3115]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3115)" }, - /*166*/ { "[3116]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3116)" }, - /*167*/ { "[3119]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3119)" }, - /*168*/ { "[3120]123456", 0, "3120123456", "" }, - /*169*/ { "[3120]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3120)" }, - /*170*/ { "[3125]123456", 0, "3125123456", "" }, - /*171*/ { "[3125]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3125)" }, - /*172*/ { "[3126]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3126)" }, - /*173*/ { "[3129]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3129)" }, - /*174*/ { "[3130]123456", 0, "3130123456", "" }, - /*175*/ { "[3130]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3130)" }, - /*176*/ { "[3135]123456", 0, "3135123456", "" }, - /*177*/ { "[3135]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3135)" }, - /*178*/ { "[3136]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3136)" }, - /*179*/ { "[3139]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3139)" }, - /*180*/ { "[3140]123456", 0, "3140123456", "" }, - /*181*/ { "[3140]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3140)" }, - /*182*/ { "[3145]123456", 0, "3145123456", "" }, - /*183*/ { "[3145]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3145)" }, - /*184*/ { "[3146]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3146)" }, - /*185*/ { "[3149]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3149)" }, - /*186*/ { "[3150]123456", 0, "3150123456", "" }, - /*187*/ { "[3150]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3150)" }, - /*188*/ { "[3155]123456", 0, "3155123456", "" }, - /*189*/ { "[3155]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3155)" }, - /*190*/ { "[3156]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3156)" }, - /*191*/ { "[3159]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3159)" }, - /*192*/ { "[3160]123456", 0, "3160123456", "" }, - /*193*/ { "[3160]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3160)" }, - /*194*/ { "[3165]123456", 0, "3165123456", "" }, - /*195*/ { "[3165]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3165)" }, - /*196*/ { "[3166]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3166)" }, - /*197*/ { "[3169]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3169)" }, - /*198*/ { "[3170]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3170)" }, - /*199*/ { "[3179]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3179)" }, - /*200*/ { "[3180]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3180)" }, - /*201*/ { "[3189]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3189)" }, - /*202*/ { "[3190]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3190)" }, - /*203*/ { "[3199]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3199)" }, - /*204*/ { "[32]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (32)" }, - /*205*/ { "[320]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (320)" }, - /*206*/ { "[3200]123456", 0, "3200123456", "" }, - /*207*/ { "[3200]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3200)" }, - /*208*/ { "[3205]123456", 0, "3205123456", "" }, - /*209*/ { "[3205]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3205)" }, - /*210*/ { "[3206]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3206)" }, - /*211*/ { "[3209]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3209)" }, - /*212*/ { "[3210]123456", 0, "3210123456", "" }, - /*213*/ { "[3210]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3210)" }, - /*214*/ { "[3215]123456", 0, "3215123456", "" }, - /*215*/ { "[3215]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3215)" }, - /*216*/ { "[3216]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3216)" }, - /*217*/ { "[3219]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3219)" }, - /*218*/ { "[3220]123456", 0, "3220123456", "" }, - /*219*/ { "[3220]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3220)" }, - /*220*/ { "[3225]123456", 0, "3225123456", "" }, - /*221*/ { "[3225]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3225)" }, - /*222*/ { "[3229]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3229)" }, - /*223*/ { "[3230]123456", 0, "3230123456", "" }, - /*224*/ { "[3230]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3230)" }, - /*225*/ { "[3235]123456", 0, "3235123456", "" }, - /*226*/ { "[3235]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3235)" }, - /*227*/ { "[3239]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3239)" }, - /*228*/ { "[3240]123456", 0, "3240123456", "" }, - /*229*/ { "[3240]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3240)" }, - /*230*/ { "[3245]123456", 0, "3245123456", "" }, - /*231*/ { "[3245]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3245)" }, - /*232*/ { "[3249]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3249)" }, - /*233*/ { "[3250]123456", 0, "3250123456", "" }, - /*234*/ { "[3250]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3250)" }, - /*235*/ { "[3255]123456", 0, "3255123456", "" }, - /*236*/ { "[3255]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3255)" }, - /*237*/ { "[3259]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3259)" }, - /*238*/ { "[3260]123456", 0, "3260123456", "" }, - /*239*/ { "[3260]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3260)" }, - /*240*/ { "[3265]123456", 0, "3265123456", "" }, - /*241*/ { "[3265]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3265)" }, - /*242*/ { "[3269]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3269)" }, - /*243*/ { "[3270]123456", 0, "3270123456", "" }, - /*244*/ { "[3270]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3270)" }, - /*245*/ { "[3275]123456", 0, "3275123456", "" }, - /*246*/ { "[3275]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3275)" }, - /*247*/ { "[3279]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3279)" }, - /*248*/ { "[3280]123456", 0, "3280123456", "" }, - /*249*/ { "[3280]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3280)" }, - /*250*/ { "[3285]123456", 0, "3285123456", "" }, - /*251*/ { "[3285]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3285)" }, - /*252*/ { "[3289]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3289)" }, - /*253*/ { "[3290]123456", 0, "3290123456", "" }, - /*254*/ { "[3290]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3290)" }, - /*255*/ { "[3295]123456", 0, "3295123456", "" }, - /*256*/ { "[3295]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3295)" }, - /*257*/ { "[3296]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3296)" }, - /*258*/ { "[3299]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3299)" }, - /*259*/ { "[33]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (33)" }, - /*260*/ { "[330]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (330)" }, - /*261*/ { "[3300]123456", 0, "3300123456", "" }, - /*262*/ { "[3300]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3300)" }, - /*263*/ { "[3305]123456", 0, "3305123456", "" }, - /*264*/ { "[3305]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3305)" }, - /*265*/ { "[3306]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3306)" }, - /*266*/ { "[3309]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3309)" }, - /*267*/ { "[3310]123456", 0, "3310123456", "" }, - /*268*/ { "[3310]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3310)" }, - /*269*/ { "[3319]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3319)" }, - /*270*/ { "[3320]123456", 0, "3320123456", "" }, - /*271*/ { "[3320]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3320)" }, - /*272*/ { "[3329]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3329)" }, - /*273*/ { "[3330]123456", 0, "3330123456", "" }, - /*274*/ { "[3330]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3330)" }, - /*275*/ { "[3339]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3339)" }, - /*276*/ { "[3340]123456", 0, "3340123456", "" }, - /*277*/ { "[3340]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3340)" }, - /*278*/ { "[3349]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3349)" }, - /*279*/ { "[3350]123456", 0, "3350123456", "" }, - /*280*/ { "[3350]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3350)" }, - /*281*/ { "[3359]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3359)" }, - /*282*/ { "[3360]123456", 0, "3360123456", "" }, - /*283*/ { "[3360]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3360)" }, - /*284*/ { "[3369]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3369)" }, - /*285*/ { "[3370]123456", 0, "3370123456", "" }, - /*286*/ { "[3370]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3370)" }, - /*287*/ { "[3375]123456", 0, "3375123456", "" }, - /*288*/ { "[3375]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3375)" }, - /*289*/ { "[3376]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3376)" }, - /*290*/ { "[3379]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3379)" }, - /*291*/ { "[3380]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3380)" }, - /*292*/ { "[3390]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3390)" }, - /*293*/ { "[3399]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3399)" }, - /*294*/ { "[34]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (34)" }, - /*295*/ { "[340]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (340)" }, - /*296*/ { "[3400]123456", 0, "3400123456", "" }, - /*297*/ { "[3400]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3400)" }, - /*298*/ { "[3405]123456", 0, "3405123456", "" }, - /*299*/ { "[3405]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3405)" }, - /*300*/ { "[3406]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3406)" }, - /*301*/ { "[3409]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3409)" }, - /*302*/ { "[3410]123456", 0, "3410123456", "" }, - /*303*/ { "[3410]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3410)" }, - /*304*/ { "[3419]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3419)" }, - /*305*/ { "[3420]123456", 0, "3420123456", "" }, - /*306*/ { "[3420]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3420)" }, - /*307*/ { "[3429]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3429)" }, - /*308*/ { "[3430]123456", 0, "3430123456", "" }, - /*309*/ { "[3430]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3430)" }, - /*310*/ { "[3439]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3439)" }, - /*311*/ { "[3440]123456", 0, "3440123456", "" }, - /*312*/ { "[3440]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3440)" }, - /*313*/ { "[3449]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3449)" }, - /*314*/ { "[3450]123456", 0, "3450123456", "" }, - /*315*/ { "[3450]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3450)" }, - /*316*/ { "[3459]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3459)" }, - /*317*/ { "[3460]123456", 0, "3460123456", "" }, - /*318*/ { "[3460]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3460)" }, - /*319*/ { "[3469]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3469)" }, - /*320*/ { "[3470]123456", 0, "3470123456", "" }, - /*321*/ { "[3470]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3470)" }, - /*322*/ { "[3479]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3479)" }, - /*323*/ { "[3480]123456", 0, "3480123456", "" }, - /*324*/ { "[3480]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3480)" }, - /*325*/ { "[3489]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3489)" }, - /*326*/ { "[3490]123456", 0, "3490123456", "" }, - /*327*/ { "[3490]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3490)" }, - /*328*/ { "[3495]123456", 0, "3495123456", "" }, - /*329*/ { "[3495]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3495)" }, - /*330*/ { "[3496]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3496)" }, - /*331*/ { "[3499]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3499)" }, - /*332*/ { "[35]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (35)" }, - /*333*/ { "[350]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (350)" }, - /*334*/ { "[3500]123456", 0, "3500123456", "" }, - /*335*/ { "[3500]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3500)" }, - /*336*/ { "[3505]123456", 0, "3505123456", "" }, - /*337*/ { "[3505]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3505)" }, - /*338*/ { "[3506]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3506)" }, - /*339*/ { "[3509]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3509)" }, - /*340*/ { "[3510]123456", 0, "3510123456", "" }, - /*341*/ { "[3510]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3510)" }, - /*342*/ { "[3519]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3519)" }, - /*343*/ { "[3520]123456", 0, "3520123456", "" }, - /*344*/ { "[3520]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3520)" }, - /*345*/ { "[3529]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3529)" }, - /*346*/ { "[3530]123456", 0, "3530123456", "" }, - /*347*/ { "[3530]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3530)" }, - /*348*/ { "[3539]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3539)" }, - /*349*/ { "[3540]123456", 0, "3540123456", "" }, - /*350*/ { "[3540]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3540)" }, - /*351*/ { "[3549]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3549)" }, - /*352*/ { "[3550]123456", 0, "3550123456", "" }, - /*353*/ { "[3550]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3550)" }, - /*354*/ { "[3559]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3559)" }, - /*355*/ { "[3560]123456", 0, "3560123456", "" }, - /*356*/ { "[3560]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3560)" }, - /*357*/ { "[3569]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3569)" }, - /*358*/ { "[3570]123456", 0, "3570123456", "" }, - /*359*/ { "[3570]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3570)" }, - /*360*/ { "[3575]123456", 0, "3575123456", "" }, - /*361*/ { "[3376]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3376)" }, - /*362*/ { "[3579]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3579)" }, - /*363*/ { "[3580]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3580)" }, - /*364*/ { "[3590]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3590)" }, - /*365*/ { "[3599]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3599)" }, - /*366*/ { "[36]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (36)" }, - /*367*/ { "[360]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (360)" }, - /*368*/ { "[3600]123456", 0, "3600123456", "" }, - /*369*/ { "[3600]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3600)" }, - /*370*/ { "[3605]123456", 0, "3605123456", "" }, - /*371*/ { "[3605]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3605)" }, - /*372*/ { "[3606]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3606)" }, - /*373*/ { "[3609]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3609)" }, - /*374*/ { "[3610]123456", 0, "3610123456", "" }, - /*375*/ { "[3610]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3610)" }, - /*376*/ { "[3619]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3619)" }, - /*377*/ { "[3620]123456", 0, "3620123456", "" }, - /*378*/ { "[3620]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3620)" }, - /*379*/ { "[3629]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3629)" }, - /*380*/ { "[3630]123456", 0, "3630123456", "" }, - /*381*/ { "[3630]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3630)" }, - /*382*/ { "[3639]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3639)" }, - /*383*/ { "[3640]123456", 0, "3640123456", "" }, - /*384*/ { "[3640]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3640)" }, - /*385*/ { "[3649]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3649)" }, - /*386*/ { "[3650]123456", 0, "3650123456", "" }, - /*387*/ { "[3650]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3650)" }, - /*388*/ { "[3659]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3659)" }, - /*389*/ { "[3660]123456", 0, "3660123456", "" }, - /*390*/ { "[3660]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3660)" }, - /*391*/ { "[3669]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3669)" }, - /*392*/ { "[3670]123456", 0, "3670123456", "" }, - /*393*/ { "[3670]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3670)" }, - /*394*/ { "[3679]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3679)" }, - /*395*/ { "[3680]123456", 0, "3680123456", "" }, - /*396*/ { "[3680]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3680)" }, - /*397*/ { "[3689]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3689)" }, - /*398*/ { "[3690]123456", 0, "3690123456", "" }, - /*399*/ { "[3690]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3690)" }, - /*400*/ { "[3695]123456", 0, "3695123456", "" }, - /*401*/ { "[3695]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3695)" }, - /*402*/ { "[3696]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3696)" }, - /*403*/ { "[3699]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3699)" }, - /*404*/ { "[37]12345678", 0, "3712345678", "" }, - /*405*/ { "[37]123456789", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (37)" }, - /*406*/ { "[370]12345678", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (370)" }, - /*407*/ { "[3700]12345678", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3700)" }, - /*408*/ { "[38]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (38)" }, - /*409*/ { "[380]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (380)" }, - /*410*/ { "[3800]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3800)" }, - /*411*/ { "[39]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (39)" }, - /*412*/ { "[390]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (390)" }, - /*413*/ { "[3900]123456789012345", 0, "3900123456789012345", "" }, - /*414*/ { "[3900]1234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3900)" }, - /*415*/ { "[3900]12345678901234", 0, "390012345678901234", "" }, - /*416*/ { "[3901]123456789012345", 0, "3901123456789012345", "" }, - /*417*/ { "[3901]1234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3901)" }, - /*418*/ { "[3905]123456789012345", 0, "3905123456789012345", "" }, - /*419*/ { "[3909]123456789012345", 0, "3909123456789012345", "" }, - /*420*/ { "[3909]1234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3909)" }, - /*421*/ { "[3910]123123456789012345", ZINT_WARN_NONCOMPLIANT, "3910123123456789012345", "261: AI (3910) position 1: Unknown currency code '123'" }, - /*422*/ { "[3910]997123456789012345", 0, "3910997123456789012345", "" }, - /*423*/ { "[3910]1231234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3910)" }, - /*424*/ { "[3910]123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3910)" }, - /*425*/ { "[3915]123123456789012345", ZINT_WARN_NONCOMPLIANT, "3915123123456789012345", "261: AI (3915) position 1: Unknown currency code '123'" }, - /*426*/ { "[3915]997123456789012345", 0, "3915997123456789012345", "" }, - /*427*/ { "[3915]1231234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3915)" }, - /*428*/ { "[3919]123123456789012345", ZINT_WARN_NONCOMPLIANT, "3919123123456789012345", "261: AI (3919) position 1: Unknown currency code '123'" }, - /*429*/ { "[3919]997123456789012345", 0, "3919997123456789012345", "" }, - /*430*/ { "[3919]1231234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3919)" }, - /*431*/ { "[3920]123456789012345", 0, "3920123456789012345", "" }, - /*432*/ { "[3920]1234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3920)" }, - /*433*/ { "[3925]123456789012345", 0, "3925123456789012345", "" }, - /*434*/ { "[3925]1234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3925)" }, - /*435*/ { "[3929]123456789012345", 0, "3929123456789012345", "" }, - /*436*/ { "[3929]1234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3929)" }, - /*437*/ { "[3930]123123456789012345", ZINT_WARN_NONCOMPLIANT, "3930123123456789012345", "261: AI (3930) position 1: Unknown currency code '123'" }, - /*438*/ { "[3930]997123456789012345", 0, "3930997123456789012345", "" }, - /*439*/ { "[3930]1231234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3930)" }, - /*440*/ { "[3930]123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3930)" }, - /*441*/ { "[3935]123123456789012345", ZINT_WARN_NONCOMPLIANT, "3935123123456789012345", "261: AI (3935) position 1: Unknown currency code '123'" }, - /*442*/ { "[3935]997123456789012345", 0, "3935997123456789012345", "" }, - /*443*/ { "[3935]1231234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3935)" }, - /*444*/ { "[3939]123123456789012345", ZINT_WARN_NONCOMPLIANT, "3939123123456789012345", "261: AI (3939) position 1: Unknown currency code '123'" }, - /*445*/ { "[3939]997123456789012345", 0, "3939997123456789012345", "" }, - /*446*/ { "[3939]1231234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3939)" }, - /*447*/ { "[3940]1234", 0, "39401234", "" }, - /*448*/ { "[3940]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3940)" }, - /*449*/ { "[3940]123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3940)" }, - /*450*/ { "[3941]1234", 0, "39411234", "" }, - /*451*/ { "[3941]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3941)" }, - /*452*/ { "[3941]123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3941)" }, - /*453*/ { "[3942]1234", 0, "39421234", "" }, - /*454*/ { "[3942]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3942)" }, - /*455*/ { "[3943]1234", 0, "39431234", "" }, - /*456*/ { "[3943]123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3943)" }, - /*457*/ { "[3944]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3944)" }, - /*458*/ { "[3945]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3945)" }, - /*459*/ { "[3949]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3949)" }, - /*460*/ { "[3950]123456", 0, "3950123456", "" }, - /*461*/ { "[3950]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3950)" }, - /*462*/ { "[3950]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3950)" }, - /*463*/ { "[3951]123456", 0, "3951123456", "" }, - /*464*/ { "[3951]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3951)" }, - /*465*/ { "[3952]123456", 0, "3952123456", "" }, - /*466*/ { "[3952]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3952)" }, - /*467*/ { "[3953]123456", 0, "3953123456", "" }, - /*468*/ { "[3953]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3953)" }, - /*469*/ { "[3954]123456", 0, "3954123456", "" }, - /*470*/ { "[3954]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3954)" }, - /*471*/ { "[3955]123456", 0, "3955123456", "" }, - /*472*/ { "[3955]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3955)" }, - /*473*/ { "[3956]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3956)" }, - /*474*/ { "[3959]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3959)" }, - /*475*/ { "[3960]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3960)" }, - /*476*/ { "[3970]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3970)" }, - /*477*/ { "[3980]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3980)" }, - /*478*/ { "[3999]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3999)" }, - /*479*/ { "[40]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (40)" }, - /*480*/ { "[400]123456789012345678901234567890", 0, "400123456789012345678901234567890", "" }, - /*481*/ { "[400]1234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (400)" }, - /*482*/ { "[4000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4000)" }, - /*483*/ { "[401]1234abcdefghijklmnopqrstuvwxyz", 0, "4011234abcdefghijklmnopqrstuvwxyz", "" }, - /*484*/ { "[401]1234abcdefghijklmnopqrstuvwxyz1", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (401)" }, - /*485*/ { "[4010]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4010)" }, - /*486*/ { "[402]13131313131313132", ZINT_WARN_NONCOMPLIANT, "40213131313131313132", "261: AI (402) position 17: Bad checksum '2', expected '0'" }, - /*487*/ { "[402]13131313131313130", 0, "40213131313131313130", "" }, - /*488*/ { "[402]1313131313131313", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (402)" }, - /*489*/ { "[4020]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4020)" }, - /*490*/ { "[403]abcdefghijklmnopqrstuvwxyz1234", 0, "403abcdefghijklmnopqrstuvwxyz1234", "" }, - /*491*/ { "[403]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (403)" }, - /*492*/ { "[4030]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4030)" }, - /*493*/ { "[404]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (404)" }, - /*494*/ { "[4040]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4040)" }, - /*495*/ { "[409]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (409)" }, - /*496*/ { "[4090]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4090)" }, - /*497*/ { "[41]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (41)" }, - /*498*/ { "[410]3898765432108", 0, "4103898765432108", "" }, - /*499*/ { "[410]12345678901234", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (410)" }, - /*500*/ { "[4100]12345678901234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4100)" }, - /*501*/ { "[411]1313131313134", ZINT_WARN_NONCOMPLIANT, "4111313131313134", "261: AI (411) position 13: Bad checksum '4', expected '0'" }, - /*502*/ { "[411]1313131313130", 0, "4111313131313130", "" }, - /*503*/ { "[411]13131313131", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (411)" }, - /*504*/ { "[4110]1313131313134", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4110)" }, - /*505*/ { "[412]1313131313130", 0, "4121313131313130", "" }, - /*506*/ { "[412]13131313131", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (412)" }, - /*507*/ { "[4120]1313131313134", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4120)" }, - /*508*/ { "[413]1313131313130", 0, "4131313131313130", "" }, - /*509*/ { "[413]13131313131", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (413)" }, - /*510*/ { "[4130]1313131313134", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4130)" }, - /*511*/ { "[414]1313131313130", 0, "4141313131313130", "" }, - /*512*/ { "[414]13131313131", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (414)" }, - /*513*/ { "[4140]1313131313134", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4140)" }, - /*514*/ { "[415]1313131313130", 0, "4151313131313130", "" }, - /*515*/ { "[415]13131313131", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (415)" }, - /*516*/ { "[4150]1313131313134", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4150)" }, - /*517*/ { "[416]1313131313130", 0, "4161313131313130", "" }, - /*518*/ { "[416]13131313131", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (416)" }, - /*519*/ { "[4160]1313131313134", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4160)" }, - /*520*/ { "[417]1313131313130", 0, "4171313131313130", "" }, - /*521*/ { "[417]13131313131", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (417)" }, - /*522*/ { "[4170]1313131313134", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4170)" }, - /*523*/ { "[418]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (418)" }, - /*524*/ { "[4180]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4180)" }, - /*525*/ { "[419]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (419)" }, - /*526*/ { "[4190]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4190)" }, - /*527*/ { "[42]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (42)" }, - /*528*/ { "[420]abcdefghijklmnopqrst", 0, "420abcdefghijklmnopqrst", "" }, - /*529*/ { "[420]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (420)" }, - /*530*/ { "[4200]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4200)" }, - /*531*/ { "[421]123abcdefghi", ZINT_WARN_NONCOMPLIANT, "421123abcdefghi", "261: AI (421) position 1: Unknown country code '123'" }, - /*532*/ { "[421]434abcdefghi", 0, "421434abcdefghi", "" }, - /*533*/ { "[421]123abcdefghij", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (421)" }, - /*534*/ { "[421]1231", ZINT_WARN_NONCOMPLIANT, "4211231", "261: AI (421) position 1: Unknown country code '123'" }, - /*535*/ { "[421]4341", 0, "4214341", "" }, - /*536*/ { "[421]123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (421)" }, - /*537*/ { "[4210]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4210)" }, - /*538*/ { "[422]123", ZINT_WARN_NONCOMPLIANT, "422123", "261: AI (422) position 1: Unknown country code '123'" }, - /*539*/ { "[422]004", 0, "422004", "" }, - /*540*/ { "[422]1234", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (422)" }, - /*541*/ { "[422]12", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (422)" }, - /*542*/ { "[4220]123", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4220)" }, - /*543*/ { "[423]123123123123123", ZINT_WARN_NONCOMPLIANT, "423123123123123123", "261: AI (423) position 1: Unknown country code '123'" }, - /*544*/ { "[423]470004012887123", ZINT_WARN_NONCOMPLIANT, "423470004012887123", "261: AI (423) position 13: Unknown country code '123'" }, - /*545*/ { "[423]470004012887438", 0, "423470004012887438", "" }, - /*546*/ { "[423]1231231231231231", ZINT_ERROR_INVALID_DATA, "4231231231231231231", "259: Invalid data length for AI (423)" }, - /*547*/ { "[423]12312312312312", ZINT_WARN_NONCOMPLIANT, "42312312312312312", "259: Invalid data length for AI (423)" }, - /*548*/ { "[423]1231231231231", ZINT_WARN_NONCOMPLIANT, "4231231231231231", "259: Invalid data length for AI (423)" }, - /*549*/ { "[423]12312312312", ZINT_WARN_NONCOMPLIANT, "42312312312312", "259: Invalid data length for AI (423)" }, - /*550*/ { "[423]1231231231", ZINT_WARN_NONCOMPLIANT, "4231231231231", "259: Invalid data length for AI (423)" }, - /*551*/ { "[423]123", ZINT_WARN_NONCOMPLIANT, "423123", "261: AI (423) position 1: Unknown country code '123'" }, - /*552*/ { "[423]004", 0, "423004", "" }, - /*553*/ { "[423]12", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (423)" }, - /*554*/ { "[4230]123123123123123", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4230)" }, - /*555*/ { "[424]123", ZINT_WARN_NONCOMPLIANT, "424123", "261: AI (424) position 1: Unknown country code '123'" }, - /*556*/ { "[424]004", 0, "424004", "" }, - /*557*/ { "[424]1234", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (424)" }, - /*558*/ { "[424]12", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (424)" }, - /*559*/ { "[4240]123", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4240)" }, - /*560*/ { "[425]123123123123123", ZINT_WARN_NONCOMPLIANT, "425123123123123123", "261: AI (425) position 1: Unknown country code '123'" }, - /*561*/ { "[425]010500276634894", 0, "425010500276634894", "" }, - /*562*/ { "[425]010500276123894", ZINT_WARN_NONCOMPLIANT, "425010500276123894", "261: AI (425) position 10: Unknown country code '123'" }, - /*563*/ { "[425]1231231231231231", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (425)" }, - /*564*/ { "[425]12", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (425)" }, - /*565*/ { "[4250]123123123123123", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4250)" }, - /*566*/ { "[426]123", ZINT_WARN_NONCOMPLIANT, "426123", "261: AI (426) position 1: Unknown country code '123'" }, - /*567*/ { "[426]426", 0, "426426", "" }, - /*568*/ { "[426]1234", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (426)" }, - /*569*/ { "[426]12", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (426)" }, - /*570*/ { "[4260]123", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4260)" }, - /*571*/ { "[427]abc", 0, "427abc", "" }, - /*572*/ { "[427]abcd", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (427)" }, - /*573*/ { "[4270]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4270)" }, - /*574*/ { "[428]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (428)" }, - /*575*/ { "[4280]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4280)" }, - /*576*/ { "[429]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (429)" }, - /*577*/ { "[4290]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4290)" }, - /*578*/ { "[43]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (43)" }, - /*579*/ { "[430]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (430)" }, - /*580*/ { "[4300]1", 0, "43001", "" }, - /*581*/ { "[4300]12345678901234567890123456789012345", 0, "430012345678901234567890123456789012345", "" }, - /*582*/ { "[4300]123456789012345678901234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4300)" }, - /*583*/ { "[4301]1", 0, "43011", "" }, - /*584*/ { "[4301]12345678901234567890123456789012345", 0, "430112345678901234567890123456789012345", "" }, - /*585*/ { "[4301]123456789012345678901234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4301)" }, - /*586*/ { "[4302]1", 0, "43021", "" }, - /*587*/ { "[4302]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43021234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*588*/ { "[4302]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4302)" }, - /*589*/ { "[4303]1", 0, "43031", "" }, - /*590*/ { "[4303]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43031234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*591*/ { "[4303]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4303)" }, - /*592*/ { "[4304]1", 0, "43041", "" }, - /*593*/ { "[4304]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43041234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*594*/ { "[4304]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4304)" }, - /*595*/ { "[4305]1", 0, "43051", "" }, - /*596*/ { "[4305]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43051234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*597*/ { "[4305]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4305)" }, - /*598*/ { "[4306]1", 0, "43061", "" }, - /*599*/ { "[4306]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43061234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*600*/ { "[4306]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4306)" }, - /*601*/ { "[4307]FR", 0, "4307FR", "" }, - /*602*/ { "[4307]F", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4307)" }, - /*603*/ { "[4307]FRR", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4307)" }, - /*604*/ { "[4308]1", 0, "43081", "" }, - /*605*/ { "[4308]123456789012345678901234567890", 0, "4308123456789012345678901234567890", "" }, - /*606*/ { "[4308]1234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4308)" }, - /*607*/ { "[4309]12345678901234567890", 0, "430912345678901234567890", "" }, - /*608*/ { "[4309]1234567890123456789", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4309)" }, - /*609*/ { "[4309]1234567890123456789A", ZINT_WARN_NONCOMPLIANT, "43091234567890123456789A", "261: AI (4309) position 20: Non-numeric character 'A'" }, - /*610*/ { "[431]1", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (431)" }, - /*611*/ { "[4310]1", 0, "43101", "" }, - /*612*/ { "[4310]12345678901234567890123456789012345", 0, "431012345678901234567890123456789012345", "" }, - /*613*/ { "[4310]123456789012345678901234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4310)" }, - /*614*/ { "[4311]1", 0, "43111", "" }, - /*615*/ { "[4311]12345678901234567890123456789012345", 0, "431112345678901234567890123456789012345", "" }, - /*616*/ { "[4311]123456789012345678901234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4311)" }, - /*617*/ { "[4312]1", 0, "43121", "" }, - /*618*/ { "[4312]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43121234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*619*/ { "[4312]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4312)" }, - /*620*/ { "[4313]1", 0, "43131", "" }, - /*621*/ { "[4313]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43131234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*622*/ { "[4313]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4313)" }, - /*623*/ { "[4314]1", 0, "43141", "" }, - /*624*/ { "[4314]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43141234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*625*/ { "[4314]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4314)" }, - /*626*/ { "[4315]1", 0, "43151", "" }, - /*627*/ { "[4315]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43151234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*628*/ { "[4315]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4315)" }, - /*629*/ { "[4316]1", 0, "43161", "" }, - /*630*/ { "[4316]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43161234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*631*/ { "[4316]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4316)" }, - /*632*/ { "[4317]FR", 0, "4317FR", "" }, - /*633*/ { "[4317]F", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4317)" }, - /*634*/ { "[4317]FRF", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4317)" }, - /*635*/ { "[4318]1", 0, "43181", "" }, - /*636*/ { "[4318]12345678901234567890", 0, "431812345678901234567890", "" }, - /*637*/ { "[4318]123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4318)" }, - /*638*/ { "[4319]1", 0, "43191", "" }, - /*639*/ { "[4319]123456789012345678901234567890", 0, "4319123456789012345678901234567890", "" }, - /*640*/ { "[4319]1234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4319)" }, - /*641*/ { "[432]1", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (432)" }, - /*642*/ { "[4320]1", 0, "43201", "" }, - /*643*/ { "[4320]12345678901234567890123456789012345", 0, "432012345678901234567890123456789012345", "" }, - /*644*/ { "[4320]123456789012345678901234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4320)" }, - /*645*/ { "[4321]1", 0, "43211", "" }, - /*646*/ { "[4321]10", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4321)" }, - /*647*/ { "[4322]1", 0, "43221", "" }, - /*648*/ { "[4322]10", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4322)" }, - /*649*/ { "[4323]1", 0, "43231", "" }, - /*650*/ { "[4323]10", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4323)" }, - /*651*/ { "[4324]1212120000", 0, "43241212120000", "" }, - /*652*/ { "[4324]121212000", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4324)" }, - /*653*/ { "[4324]12121200000", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4324)" }, - /*654*/ { "[4325]1212120000", 0, "43251212120000", "" }, - /*655*/ { "[4325]121212000", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4325)" }, - /*656*/ { "[4325]12121200000", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4325)" }, - /*657*/ { "[4326]121212", 0, "4326121212", "" }, - /*658*/ { "[4326]12121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4326)" }, - /*659*/ { "[4326]1212120", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4326)" }, - /*660*/ { "[4327]121212", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4327)" }, - /*661*/ { "[4328]121212", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4328)" }, - /*662*/ { "[4329]121212", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4329)" }, - /*663*/ { "[433]121212", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (433)" }, - /*664*/ { "[4330]121212", 0, "4330121212", "" }, - /*665*/ { "[4331]121212-", 0, "4331121212-", "" }, - /*666*/ { "[4332]121212", 0, "4332121212", "" }, - /*667*/ { "[4333]121212-", 0, "4333121212-", "" }, - /*668*/ { "[4334]121212", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4334)" }, - /*669*/ { "[44]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (44)" }, - /*670*/ { "[440]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (440)" }, - /*671*/ { "[4400]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4400)" }, - /*672*/ { "[49]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (49)" }, - /*673*/ { "[490]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (490)" }, - /*674*/ { "[4900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4900)" }, - /*675*/ { "[499]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (499)" }, - /*676*/ { "[4990]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4990)" }, - /*677*/ { "[50]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (50)" }, - /*678*/ { "[500]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (500)" }, - /*679*/ { "[5000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (5000)" }, - /*680*/ { "[51]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (51)" }, - /*681*/ { "[510]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (510)" }, - /*682*/ { "[5100]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (5100)" }, - /*683*/ { "[59]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (59)" }, - /*684*/ { "[590]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (590)" }, - /*685*/ { "[5900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (5900)" }, - /*686*/ { "[60]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (60)" }, - /*687*/ { "[600]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (600)" }, - /*688*/ { "[6000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (6000)" }, - /*689*/ { "[61]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (61)" }, - /*690*/ { "[610]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (610)" }, - /*691*/ { "[6100]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (6100)" }, - /*692*/ { "[69]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (69)" }, - /*693*/ { "[690]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (690)" }, - /*694*/ { "[6900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (6900)" }, - /*695*/ { "[70]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (70)" }, - /*696*/ { "[700]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (700)" }, - /*697*/ { "[7000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7000)" }, - /*698*/ { "[7001]1234567890123", 0, "70011234567890123", "" }, - /*699*/ { "[7001]123456789012", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7001)" }, - /*700*/ { "[7002]abcdefghijklmnopqrstuvwxyz1234", 0, "7002abcdefghijklmnopqrstuvwxyz1234", "" }, - /*701*/ { "[7002]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7002)" }, - /*702*/ { "[7003]1212121212", 0, "70031212121212", "" }, - /*703*/ { "[7003]121212121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7003)" }, - /*704*/ { "[7004]1234", 0, "70041234", "" }, - /*705*/ { "[7004]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7004)" }, - /*706*/ { "[7005]abcdefghijkl", 0, "7005abcdefghijkl", "" }, - /*707*/ { "[7005]abcdefghijklm", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7005)" }, - /*708*/ { "[7006]200132", ZINT_WARN_NONCOMPLIANT, "7006200132", "261: AI (7006) position 5: Invalid day '32'" }, - /*709*/ { "[7006]200100", ZINT_WARN_NONCOMPLIANT, "7006200100", "261: AI (7006) position 5: Invalid day '00'" }, - /*710*/ { "[7006]200120", 0, "7006200120", "" }, - /*711*/ { "[7006]2001320", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7006)" }, - /*712*/ { "[7007]010101121212", 0, "7007010101121212", "" }, - /*713*/ { "[7007]01010112121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7007)" }, - /*714*/ { "[7007]A1010112121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7007)" }, - /*715*/ { "[7007]121212", 0, "7007121212", "" }, - /*716*/ { "[7007]12121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7007)" }, - /*717*/ { "[7007]1212121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7007)" }, - /*718*/ { "[7008]abc", 0, "7008abc", "" }, - /*719*/ { "[7008]abcd", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7008)" }, - /*720*/ { "[7009]abcdefghij", 0, "7009abcdefghij", "" }, - /*721*/ { "[7009]abcdefghijk", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7009)" }, - /*722*/ { "[7010]01", 0, "701001", "" }, - /*723*/ { "[7010]1", 0, "70101", "" }, - /*724*/ { "[7010]012", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7010)" }, - /*725*/ { "[7011]121212", 0, "7011121212", "" }, - /*726*/ { "[7011]1212121212", 0, "70111212121212", "" }, - /*727*/ { "[7011]12121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7011)" }, - /*728*/ { "[7011]121212121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7011)" }, - /*729*/ { "[7012]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7012)" }, - /*730*/ { "[7019]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7019)" }, - /*731*/ { "[7020]abcdefghijklmnopqrst", 0, "7020abcdefghijklmnopqrst", "" }, - /*732*/ { "[7020]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7020)" }, - /*733*/ { "[7021]abcdefghijklmnopqrst", 0, "7021abcdefghijklmnopqrst", "" }, - /*734*/ { "[7021]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7021)" }, - /*735*/ { "[7022]abcdefghijklmnopqrst", 0, "7022abcdefghijklmnopqrst", "" }, - /*736*/ { "[7022]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7022)" }, - /*737*/ { "[7023]1234abcdefghijklmnopqrstuvwxyz", 0, "70231234abcdefghijklmnopqrstuvwxyz", "" }, - /*738*/ { "[7023]1234abcdefghijklmnopqrstuvwxyza", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7023)" }, - /*739*/ { "[7024]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7024)" }, - /*740*/ { "[7025]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7025)" }, - /*741*/ { "[7029]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7029)" }, - /*742*/ { "[7030]123abcdefghijklmnopqrstuvwxyza", ZINT_WARN_NONCOMPLIANT, "7030123abcdefghijklmnopqrstuvwxyza", "261: AI (7030) position 1: Unknown country code '123'" }, - /*743*/ { "[7030]004abcdefghijklmnopqrstuvwxyza", 0, "7030004abcdefghijklmnopqrstuvwxyza", "" }, - /*744*/ { "[7030]123abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7030)" }, - /*745*/ { "[7031]123abcdefghijklmnopqrstuvwxyza", ZINT_WARN_NONCOMPLIANT, "7031123abcdefghijklmnopqrstuvwxyza", "261: AI (7031) position 1: Unknown country code '123'" }, - /*746*/ { "[7031]004abcdefghijklmnopqrstuvwxyza", 0, "7031004abcdefghijklmnopqrstuvwxyza", "" }, - /*747*/ { "[7031]123abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7031)" }, - /*748*/ { "[7032]004abcdefghijklmnopqrstuvwxyza", 0, "7032004abcdefghijklmnopqrstuvwxyza", "" }, - /*749*/ { "[7032]004abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7032)" }, - /*750*/ { "[7033]004abcdefghijklmnopqrstuvwxyza", 0, "7033004abcdefghijklmnopqrstuvwxyza", "" }, - /*751*/ { "[7033]004abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7033)" }, - /*752*/ { "[7034]004abcdefghijklmnopqrstuvwxyza", 0, "7034004abcdefghijklmnopqrstuvwxyza", "" }, - /*753*/ { "[7034]004abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7034)" }, - /*754*/ { "[7035]004abcdefghijklmnopqrstuvwxyza", 0, "7035004abcdefghijklmnopqrstuvwxyza", "" }, - /*755*/ { "[7035]004abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7035)" }, - /*756*/ { "[7036]004abcdefghijklmnopqrstuvwxyza", 0, "7036004abcdefghijklmnopqrstuvwxyza", "" }, - /*757*/ { "[7036]004abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7036)" }, - /*758*/ { "[7037]004abcdefghijklmnopqrstuvwxyza", 0, "7037004abcdefghijklmnopqrstuvwxyza", "" }, - /*759*/ { "[7037]004abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7037)" }, - /*760*/ { "[7038]004abcdefghijklmnopqrstuvwxyza", 0, "7038004abcdefghijklmnopqrstuvwxyza", "" }, - /*761*/ { "[7038]004abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7038)" }, - /*762*/ { "[7039]004abcdefghijklmnopqrstuvwxyza", 0, "7039004abcdefghijklmnopqrstuvwxyza", "" }, - /*763*/ { "[7039]123abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7039)" }, - /*764*/ { "[7040]1abc", 0, "70401abc", "" }, - /*765*/ { "[7040]1ab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7040)" }, - /*766*/ { "[7040]1abcd", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7040)" }, - /*767*/ { "[7041]BGE", 0, "7041BGE", "" }, - /*768*/ { "[7041]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7041)" }, - /*769*/ { "[7042]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7042)" }, - /*770*/ { "[7050]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7050)" }, - /*771*/ { "[7090]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7090)" }, - /*772*/ { "[7099]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7099)" }, - /*773*/ { "[71]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (71)" }, - /*774*/ { "[710]abcdefghijklmnopqrst", 0, "710abcdefghijklmnopqrst", "" }, - /*775*/ { "[710]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (710)" }, - /*776*/ { "[7100]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7100)" }, - /*777*/ { "[711]abcdefghijklmnopqrst", 0, "711abcdefghijklmnopqrst", "" }, - /*778*/ { "[711]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (711)" }, - /*779*/ { "[712]abcdefghijklmnopqrst", 0, "712abcdefghijklmnopqrst", "" }, - /*780*/ { "[712]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (712)" }, - /*781*/ { "[713]abcdefghijklmnopqrst", 0, "713abcdefghijklmnopqrst", "" }, - /*782*/ { "[713]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (713)" }, - /*783*/ { "[714]abcdefghijklmnopqrst", 0, "714abcdefghijklmnopqrst", "" }, - /*784*/ { "[714]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (714)" }, - /*785*/ { "[715]abcdefghijklmnopqrst", 0, "715abcdefghijklmnopqrst", "" }, - /*786*/ { "[715]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (715)" }, - /*787*/ { "[716]abcdefghijklmnopqrst", 0, "716abcdefghijklmnopqrst", "" }, - /*788*/ { "[716]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (716)" }, - /*789*/ { "[717]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (717)" }, - /*790*/ { "[718]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (718)" }, - /*791*/ { "[719]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (719)" }, - /*792*/ { "[72]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (72)" }, - /*793*/ { "[720]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (720)" }, - /*794*/ { "[7200]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7200)" }, - /*795*/ { "[721]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (721)" }, - /*796*/ { "[7210]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7210)" }, - /*797*/ { "[7220]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7220)" }, - /*798*/ { "[7230]EMabcdefghijklmnopqrstuvwxyzab", 0, "7230EMabcdefghijklmnopqrstuvwxyzab", "" }, - /*799*/ { "[7230]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7230)" }, - /*800*/ { "[7230]EM", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7230)" }, - /*801*/ { "[7231]EMabcdefghijklmnopqrstuvwxyzab", 0, "7231EMabcdefghijklmnopqrstuvwxyzab", "" }, - /*802*/ { "[7231]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7231)" }, - /*803*/ { "[7232]EMabcdefghijklmnopqrstuvwxyzab", 0, "7232EMabcdefghijklmnopqrstuvwxyzab", "" }, - /*804*/ { "[7232]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7232)" }, - /*805*/ { "[7233]EMabcdefghijklmnopqrstuvwxyzab", 0, "7233EMabcdefghijklmnopqrstuvwxyzab", "" }, - /*806*/ { "[7233]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7233)" }, - /*807*/ { "[7234]EMabcdefghijklmnopqrstuvwxyzab", 0, "7234EMabcdefghijklmnopqrstuvwxyzab", "" }, - /*808*/ { "[7234]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7234)" }, - /*809*/ { "[7235]EMabcdefghijklmnopqrstuvwxyzab", 0, "7235EMabcdefghijklmnopqrstuvwxyzab", "" }, - /*810*/ { "[7235]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7235)" }, - /*811*/ { "[7236]EMabcdefghijklmnopqrstuvwxyzab", 0, "7236EMabcdefghijklmnopqrstuvwxyzab", "" }, - /*812*/ { "[7236]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7236)" }, - /*813*/ { "[7237]EMabcdefghijklmnopqrstuvwxyzab", 0, "7237EMabcdefghijklmnopqrstuvwxyzab", "" }, - /*814*/ { "[7237]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7237)" }, - /*815*/ { "[7238]EMabcdefghijklmnopqrstuvwxyzab", 0, "7238EMabcdefghijklmnopqrstuvwxyzab", "" }, - /*816*/ { "[7238]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7238)" }, - /*817*/ { "[7239]EMabcdefghijklmnopqrstuvwxyzab", 0, "7239EMabcdefghijklmnopqrstuvwxyzab", "" }, - /*818*/ { "[7239]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7239)" }, - /*819*/ { "[7239]E", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7239)" }, - /*820*/ { "[7240]abcdefghijklmnopqrst", 0, "7240abcdefghijklmnopqrst", "" }, - /*821*/ { "[7240]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7240)" }, - /*822*/ { "[7241]99", 0, "724199", "" }, - /*823*/ { "[7241]100", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7241)" }, - /*824*/ { "[7242]abcdefghijklmnopqrstuvwxy", 0, "7242abcdefghijklmnopqrstuvwxy", "" }, - /*825*/ { "[7242]abcdefghijklmnopqrstuvwxyz", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7242)" }, - /*826*/ { "[7243]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7243)" }, - /*827*/ { "[7249]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7249)" }, - /*828*/ { "[7250]12341201", 0, "725012341201", "" }, - /*829*/ { "[7250]123412012", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7250)" }, - /*830*/ { "[7251]123412011359", 0, "7251123412011359", "" }, - /*831*/ { "[7251]1234120113591", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7251)" }, - /*832*/ { "[7252]2", 0, "72522", "" }, - /*833*/ { "[7252]20", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7252)" }, - /*834*/ { "[7253]abcdefghijklmnopqrstuvwxyzabcdefghijklmn", 0, "7253abcdefghijklmnopqrstuvwxyzabcdefghijklmn", "" }, - /*835*/ { "[7253]abcdefghijklmnopqrstuvwxyzabcdefghijklmno", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7253)" }, - /*836*/ { "[7254]abcdefghijklmnopqrstuvwxyzabcdefghijklmn", 0, "7254abcdefghijklmnopqrstuvwxyzabcdefghijklmn", "" }, - /*837*/ { "[7254]abcdefghijklmnopqrstuvwxyzabcdefghijklmno", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7254)" }, - /*838*/ { "[7255]abcdefghij", 0, "7255abcdefghij", "" }, - /*839*/ { "[7255]abcdefghijk", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7255)" }, - /*840*/ { "[7256]abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl", 0, "7256abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl", "" }, - /*841*/ { "[7256]abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7256)" }, - /*842*/ { "[7257]abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr", 0, "7257abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr", "" }, - /*843*/ { "[7257]abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7257)" }, - /*844*/ { "[7258]1/1", 0, "72581/1", "" }, - /*845*/ { "[7258]1/01", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7258)" }, - /*846*/ { "[7259]abcdefghijklmnopqrstuvwxyzabcdefghijklmn", 0, "7259abcdefghijklmnopqrstuvwxyzabcdefghijklmn", "" }, - /*847*/ { "[7259]abcdefghijklmnopqrstuvwxyzabcdefghijklmno", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7259)" }, - /*848*/ { "[7260]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7260)" }, - /*849*/ { "[7299]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7299)" }, - /*850*/ { "[73]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (73)" }, - /*851*/ { "[7300]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7300)" }, - /*852*/ { "[74]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (74)" }, - /*853*/ { "[7400]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7400)" }, - /*854*/ { "[79]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (79)" }, - /*855*/ { "[7900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7900)" }, - /*856*/ { "[7999]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7999)" }, - /*857*/ { "[80]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (80)" }, - /*858*/ { "[800]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (800)" }, - /*859*/ { "[8000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8000)" }, - /*860*/ { "[8001]12345678901234", ZINT_WARN_NONCOMPLIANT, "800112345678901234", "261: AI (8001) position 13: Invalid winding direction '3'" }, - /*861*/ { "[8001]12345678901204", 0, "800112345678901204", "" }, - /*862*/ { "[8001]1234123456789012345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8001)" }, - /*863*/ { "[8002]abcdefghijklmnopqrst", 0, "8002abcdefghijklmnopqrst", "" }, - /*864*/ { "[8002]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8002)" }, - /*865*/ { "[8003]01234567890123abcdefghijklmnop", ZINT_WARN_NONCOMPLIANT, "800301234567890123abcdefghijklmnop", "261: AI (8003) position 14: Bad checksum '3', expected '8'" }, - /*866*/ { "[8003]01234567890128abcdefghijklmnop", 0, "800301234567890128abcdefghijklmnop", "" }, - /*867*/ { "[8003]01234567890128abcdefghijklmnopq", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8003)" }, - /*868*/ { "[8004]abcdefghijklmnopqrstuvwxyz1234", ZINT_WARN_NONCOMPLIANT, "8004abcdefghijklmnopqrstuvwxyz1234", "261: AI (8004) position 1: Non-numeric company prefix 'a'" }, - /*869*/ { "[8004]12cdefghijklmnopqrstuvwxyz1234", 0, "800412cdefghijklmnopqrstuvwxyz1234", "" }, - /*870*/ { "[8004]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8004)" }, - /*871*/ { "[8005]123456", 0, "8005123456", "" }, - /*872*/ { "[8005]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8005)" }, - /*873*/ { "[8005]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8005)" }, - /*874*/ { "[8006]123456789012341212", ZINT_WARN_NONCOMPLIANT, "8006123456789012341212", "261: AI (8006) position 14: Bad checksum '4', expected '1'" }, - /*875*/ { "[8006]123456789012311212", 0, "8006123456789012311212", "" }, - /*876*/ { "[8006]12345678901234121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8006)" }, - /*877*/ { "[8006]1234567890123412123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8006)" }, - /*878*/ { "[8007]abcdefghijklmnopqrstuvwxyz12345678", ZINT_WARN_NONCOMPLIANT, "8007abcdefghijklmnopqrstuvwxyz12345678", "261: AI (8007) position 1: Non-alphabetic IBAN country code 'ab'" }, - /*879*/ { "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ12345678", 0, "8007AD95EFGHIJKLMNOPQRSTUVWXYZ12345678", "" }, - /*880*/ { "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ123456789", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8007)" }, - /*881*/ { "[8008]123456121212", ZINT_WARN_NONCOMPLIANT, "8008123456121212", "261: AI (8008) position 3: Invalid month '34'" }, - /*882*/ { "[8008]121256121212", ZINT_WARN_NONCOMPLIANT, "8008121256121212", "261: AI (8008) position 5: Invalid day '56'" }, - /*883*/ { "[8008]121231121212", 0, "8008121231121212", "" }, - /*884*/ { "[8008]1234561212", ZINT_WARN_NONCOMPLIANT, "80081234561212", "261: AI (8008) position 3: Invalid month '34'" }, - /*885*/ { "[8008]1212311212", 0, "80081212311212", "" }, - /*886*/ { "[8008]12345612", ZINT_WARN_NONCOMPLIANT, "800812345612", "261: AI (8008) position 3: Invalid month '34'" }, - /*887*/ { "[8008]12010112", 0, "800812010112", "" }, - /*888*/ { "[8008]1234561", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8008)" }, - /*889*/ { "[8008]123456121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8008)" }, - /*890*/ { "[8008]12345612121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8008)" }, - /*891*/ { "[8008]1234561212123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8008)" }, - /*892*/ { "[8009]12345678901234567890123456789012345678901234567890", 0, "800912345678901234567890123456789012345678901234567890", "" }, - /*893*/ { "[8009]123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8009)" }, - /*894*/ { "[8010]1234abcdefghijklmnopqrstuvwxyz1", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8010)" }, - /*895*/ { "[8011]123456789012", 0, "8011123456789012", "" }, - /*896*/ { "[8011]1234567890123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8011)" }, - /*897*/ { "[8012]abcdefghijklmnopqrst", 0, "8012abcdefghijklmnopqrst", "" }, - /*898*/ { "[8012]abcdefghijklmnopqrstuv", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8012)" }, - /*899*/ { "[8013]1234abcdefghijklmnopqrsQP", 0, "80131234abcdefghijklmnopqrsQP", "" }, - /*900*/ { "[8013]1234abcdefghijklmnopqrsQPv", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8013)" }, - /*901*/ { "[8014]1234abcdefghijklmnopqrsQP", 0, "80141234abcdefghijklmnopqrsQP", "" }, - /*902*/ { "[8014]1234abcdefghijklmnopqrsQPv", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8014)" }, - /*903*/ { "[8015]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8015)" }, - /*904*/ { "[8016]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8016)" }, - /*905*/ { "[8017]313131313131313139", ZINT_WARN_NONCOMPLIANT, "8017313131313131313139", "261: AI (8017) position 18: Bad checksum '9', expected '1'" }, - /*906*/ { "[8017]313131313131313131", 0, "8017313131313131313131", "" }, - /*907*/ { "[8017]31313131313131313", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8017)" }, - /*908*/ { "[8017]3131313131313131390", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8017)" }, - /*909*/ { "[8018]313131313131313139", ZINT_WARN_NONCOMPLIANT, "8018313131313131313139", "261: AI (8018) position 18: Bad checksum '9', expected '1'" }, - /*910*/ { "[8018]313131313131313131", 0, "8018313131313131313131", "" }, - /*911*/ { "[8018]31313131313131313", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8018)" }, - /*912*/ { "[8018]3131313131313131390", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8018)" }, - /*913*/ { "[8019]1234567890", 0, "80191234567890", "" }, - /*914*/ { "[8019]12345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8019)" }, - /*915*/ { "[8020]abcdefghijklmnopqrstuvwxy", 0, "8020abcdefghijklmnopqrstuvwxy", "" }, - /*916*/ { "[8020]abcdefghijklmnopqrstuvwxyz", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8020)" }, - /*917*/ { "[8021]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8021)" }, - /*918*/ { "[8025]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8025)" }, - /*919*/ { "[8026]123456789012341212", ZINT_WARN_NONCOMPLIANT, "8026123456789012341212", "261: AI (8026) position 14: Bad checksum '4', expected '1'" }, - /*920*/ { "[8026]123456789012311212", 0, "8026123456789012311212", "" }, - /*921*/ { "[8026]1234567890123451212", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8026)" }, - /*922*/ { "[8026]12345678901234512", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8026)" }, - /*923*/ { "[8027]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8027)" }, - /*924*/ { "[8030]-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, "8030-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ", "" }, - /*925*/ { "[8030]-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ1", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8030)" }, - /*926*/ { "[8031]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8031)" }, - /*927*/ { "[8040]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8040)" }, - /*928*/ { "[8050]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8050)" }, - /*929*/ { "[8060]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8060)" }, - /*930*/ { "[8070]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8070)" }, - /*931*/ { "[8080]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8080)" }, - /*932*/ { "[8090]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8090)" }, - /*933*/ { "[8099]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8099)" }, - /*934*/ { "[81]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (81)" }, - /*935*/ { "[8100]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8100)" }, - /*936*/ { "[8109]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8109)" }, - /*937*/ { "[8110]5123456789011234565123455123450123105123450123512345678901320123190000", 0, "81105123456789011234565123455123450123105123450123512345678901320123190000", "" }, - /*938*/ { "[8110]51234567890112345651234551234501231051234501235123456789013201231900001", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8110)" }, - /*939*/ { "[8111]1234", 0, "81111234", "" }, - /*940*/ { "[8111]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8111)" }, - /*941*/ { "[8111]123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8111)" }, - /*942*/ { "[8112]1234567890123456789012345678901234567890123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, "81121234567890123456789012345678901234567890123456789012345678901234567890", "259: Invalid data length for AI (8112)" }, - /*943*/ { "[8112]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8112)" }, - /*944*/ { "[8112]061234567890121234569123456789012345", 0, "8112061234567890121234569123456789012345", "" }, - /*945*/ { "[8113]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8113)" }, - /*946*/ { "[8120]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8120)" }, - /*947*/ { "[8130]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8130)" }, - /*948*/ { "[8140]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8140)" }, - /*949*/ { "[8150]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8150)" }, - /*950*/ { "[8190]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8190)" }, - /*951*/ { "[8199]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8199)" }, - /*952*/ { "[82]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (82)" }, - /*953*/ { "[8200]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "82001234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*954*/ { "[8201]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8201)" }, - /*955*/ { "[8210]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8210)" }, - /*956*/ { "[8220]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8220)" }, - /*957*/ { "[8230]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8230)" }, - /*958*/ { "[8240]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8240)" }, - /*959*/ { "[8250]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8250)" }, - /*960*/ { "[8290]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8290)" }, - /*961*/ { "[8299]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8299)" }, - /*962*/ { "[83]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (83)" }, - /*963*/ { "[830]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (830)" }, - /*964*/ { "[8300]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8300)" }, - /*965*/ { "[84]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (84)" }, - /*966*/ { "[840]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (840)" }, - /*967*/ { "[8400]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8400)" }, - /*968*/ { "[85]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (85)" }, - /*969*/ { "[850]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (850)" }, - /*970*/ { "[8500]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8500)" }, - /*971*/ { "[89]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (89)" }, - /*972*/ { "[890]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (890)" }, - /*973*/ { "[8900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8900)" }, - /*974*/ { "[90]abcdefghijklmnopqrstuvwxyz1234", 0, "90abcdefghijklmnopqrstuvwxyz1234", "" }, - /*975*/ { "[90]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (90)" }, - /*976*/ { "[900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (900)" }, - /*977*/ { "[9000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9000)" }, - /*978*/ { "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "91123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*979*/ { "[91]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (91)" }, - /*980*/ { "[910]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (910)" }, - /*981*/ { "[9100]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9100)" }, - /*982*/ { "[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "92123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*983*/ { "[92]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (92)" }, - /*984*/ { "[920]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (920)" }, - /*985*/ { "[9200]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9200)" }, - /*986*/ { "[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "93123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*987*/ { "[93]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (93)" }, - /*988*/ { "[930]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (930)" }, - /*989*/ { "[9300]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9300)" }, - /*990*/ { "[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "94123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*991*/ { "[94]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (94)" }, - /*992*/ { "[940]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (940)" }, - /*993*/ { "[9400]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9400)" }, - /*994*/ { "[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "95123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*995*/ { "[95]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (95)" }, - /*996*/ { "[950]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (950)" }, - /*997*/ { "[9500]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9500)" }, - /*998*/ { "[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "96123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*999*/ { "[96]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (96)" }, - /*1000*/ { "[960]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (960)" }, - /*1001*/ { "[9600]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9600)" }, - /*1002*/ { "[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "97123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*1003*/ { "[97]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (97)" }, - /*1004*/ { "[970]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (970)" }, - /*1005*/ { "[9700]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9700)" }, - /*1006*/ { "[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "98123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*1007*/ { "[98]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (98)" }, - /*1008*/ { "[980]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (980)" }, - /*1009*/ { "[9800]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9800)" }, - /*1010*/ { "[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "99123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, - /*1011*/ { "[99]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (99)" }, - /*1012*/ { "[990]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (990)" }, - /*1013*/ { "[9900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9900)" }, - /*1014*/ { "[9999]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9999)" }, - /*1015*/ { "[01]12345678901234[7006]200101", ZINT_WARN_NONCOMPLIANT, "01123456789012347006200101", "261: AI (01) position 14: Bad checksum '4', expected '1'" }, - /*1016*/ { "[01]12345678901231[7006]200101", 0, "01123456789012317006200101", "" }, - /*1017*/ { "[3900]1234567890[01]12345678901234", ZINT_WARN_NONCOMPLIANT, "39001234567890\0350112345678901234", "261: AI (01) position 14: Bad checksum '4', expected '1'" }, - /*1018*/ { "[3900]1234567890[01]12345678901231", 0, "39001234567890\0350112345678901231", "" }, - /*1019*/ { "[253]12345678901234[3901]12345678901234[20]12", ZINT_WARN_NONCOMPLIANT, "25312345678901234\035390112345678901234\0352012", "261: AI (253) position 13: Bad checksum '3', expected '8'" }, - /*1020*/ { "[253]12345678901284[3901]12345678901234[20]12", 0, "25312345678901284\035390112345678901234\0352012", "" }, - /*1021*/ { "[253]12345678901234[01]12345678901234[3901]12345678901234[20]12", ZINT_WARN_NONCOMPLIANT, "25312345678901234\0350112345678901234390112345678901234\0352012", "261: AI (01) position 14: Bad checksum '4', expected '1'" }, - /*1022*/ { "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12", 0, "25312345678901284\0350112345678901231390112345678901234\0352012", "" }, - /*1023*/ { "[01]12345678901231[0A]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "", "257: Invalid AI in input data (non-numeric characters in AI)" }, - /*1024*/ { "[01]12345678901231[0]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "", "256: Invalid AI in input data (AI too short)" }, - /*1025*/ { "[01]12345678901231[]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "", "256: Invalid AI in input data (AI too short)" }, + /* 1*/ { "[", ZINT_ERROR_INVALID_DATA, "", "253: Malformed AI in input (brackets don't match)" }, + /* 2*/ { "[]12", ZINT_ERROR_INVALID_DATA, "", "256: Invalid AI at position 1 in input (AI too short)" }, + /* 3*/ { "[1]12", ZINT_ERROR_INVALID_DATA, "", "256: Invalid AI at position 1 in input (AI too short)" }, + /* 4*/ { "[242]123456[1]12", ZINT_ERROR_INVALID_DATA, "", "256: Invalid AI at position 12 in input (AI too short)" }, + /* 5*/ { "[12345]12", ZINT_ERROR_INVALID_DATA, "", "255: Invalid AI at position 1 in input (AI too long)" }, + /* 6*/ { "[20]12[12345]12", ZINT_ERROR_INVALID_DATA, "", "255: Invalid AI at position 7 in input (AI too long)" }, + /* 7*/ { "[9999]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9999)" }, + /* 8*/ { "[[01]]1234", ZINT_ERROR_INVALID_DATA, "", "254: Found nested brackets in input" }, + /* 9*/ { "[1A]12", ZINT_ERROR_INVALID_DATA, "", "257: Invalid AI at position 1 in input (non-numeric characters in AI)" }, + /* 10*/ { "[10]", ZINT_ERROR_INVALID_DATA, "", "258: Empty data field in input" }, + /* 11*/ { "[90]\012", ZINT_ERROR_INVALID_DATA, "", "251: Control characters are not supported by GS1" }, + /* 12*/ { "[90]\177", ZINT_ERROR_INVALID_DATA, "", "263: DEL characters are not supported by GS1" }, + /* 13*/ { "[90]\200", ZINT_ERROR_INVALID_DATA, "", "250: Extended ASCII characters are not supported by GS1" }, + /* 14*/ { "[00]123456789012345678", ZINT_WARN_NONCOMPLIANT, "00123456789012345678", "261: AI (00) position 18: Bad checksum '8', expected '5'" }, + /* 15*/ { "[00]123456789012345675", 0, "00123456789012345675", "" }, + /* 16*/ { "[00]12345678901234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (00)" }, + /* 17*/ { "[00]1234567890123456789", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (00)" }, + /* 18*/ { "[00]376104250021234569", 0, "00376104250021234569", "" }, + /* 19*/ { "[00]376104250021234568", ZINT_WARN_NONCOMPLIANT, "00376104250021234568", "261: AI (00) position 18: Bad checksum '8', expected '9'" }, + /* 20*/ { "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, "0112345678901234", "261: AI (01) position 14: Bad checksum '4', expected '1'" }, + /* 21*/ { "[01]12345678901231", 0, "0112345678901231", "" }, + /* 22*/ { "[01]123456789012345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (01)" }, + /* 23*/ { "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, "0212345678901234", "261: AI (02) position 14: Bad checksum '4', expected '1'" }, + /* 24*/ { "[02]12345678901231", 0, "0212345678901231", "" }, + /* 25*/ { "[02]1234567890123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (02)" }, + /* 26*/ { "[03]12345678901234", ZINT_WARN_NONCOMPLIANT, "0312345678901234", "261: AI (03) position 14: Bad checksum '4', expected '1'" }, + /* 27*/ { "[03]12345678901231", 0, "0312345678901231", "" }, + /* 28*/ { "[03]1234567890123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (03)" }, + /* 29*/ { "[04]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (04)" }, + /* 30*/ { "[05]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (05)" }, + /* 31*/ { "[06]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (06)" }, + /* 32*/ { "[07]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (07)" }, + /* 33*/ { "[08]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (08)" }, + /* 34*/ { "[09]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (09)" }, + /* 35*/ { "[10]ABCD123456", 0, "10ABCD123456", "" }, + /* 36*/ { "[10]123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (10)" }, + /* 37*/ { "[100]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (100)" }, + /* 38*/ { "[1000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1000)" }, + /* 39*/ { "[11]990102", 0, "11990102", "" }, + /* 40*/ { "[11]9901023", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (11)" }, + /* 41*/ { "[110]990102", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (110)" }, + /* 42*/ { "[1100]990102", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1100)" }, + /* 43*/ { "[12]000100", 0, "12000100", "" }, + /* 44*/ { "[12]00010", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (12)" }, + /* 45*/ { "[120]000100", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (120)" }, + /* 46*/ { "[1200]000100", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1200)" }, + /* 47*/ { "[13]991301", ZINT_WARN_NONCOMPLIANT, "13991301", "261: AI (13) position 3: Invalid month '13'" }, + /* 48*/ { "[13]991201", 0, "13991201", "" }, + /* 49*/ { "[13]9913011", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (13)" }, + /* 50*/ { "[130]991301", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (130)" }, + /* 51*/ { "[1300]991301", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1300)" }, + /* 52*/ { "[14]991201", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (14)" }, + /* 53*/ { "[140]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (140)" }, + /* 54*/ { "[1400]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1400)" }, + /* 55*/ { "[15]021231", 0, "15021231", "" }, + /* 56*/ { "[15]02123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (15)" }, + /* 57*/ { "[150]021231", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (150)" }, + /* 58*/ { "[1500]021231", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1500)" }, + /* 59*/ { "[16]000000", ZINT_WARN_NONCOMPLIANT, "16000000", "261: AI (16) position 3: Invalid month '00'" }, + /* 60*/ { "[16]000100", 0, "16000100", "" }, + /* 61*/ { "[16]00000", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (16)" }, + /* 62*/ { "[160]000000", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (160)" }, + /* 63*/ { "[1600]000000", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1600)" }, + /* 64*/ { "[17]010200", 0, "17010200", "" }, + /* 65*/ { "[17]0102000", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (17)" }, + /* 66*/ { "[170]010200", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (170)" }, + /* 67*/ { "[1700]010200", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1700)" }, + /* 68*/ { "[18]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (18)" }, + /* 69*/ { "[180]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (180)" }, + /* 70*/ { "[1800]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1800)" }, + /* 71*/ { "[19]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (19)" }, + /* 72*/ { "[190]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (190)" }, + /* 73*/ { "[1900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (1900)" }, + /* 74*/ { "[20]12", 0, "2012", "" }, + /* 75*/ { "[20]1", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (20)" }, + /* 76*/ { "[200]12", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (200)" }, + /* 77*/ { "[2000]12", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2000)" }, + /* 78*/ { "[21]A12345678", 0, "21A12345678", "" }, + /* 79*/ { "[21]123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (21)" }, + /* 80*/ { "[210]A12345678", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (210)" }, + /* 81*/ { "[2100]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2100)" }, + /* 82*/ { "[22]abcdefghijklmnopqrst", 0, "22abcdefghijklmnopqrst", "" }, + /* 83*/ { "[22]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (22)" }, + /* 84*/ { "[220]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (220)" }, + /* 85*/ { "[2200]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2200)" }, + /* 86*/ { "[23]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (23)" }, + /* 87*/ { "[230]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (230)" }, + /* 88*/ { "[2300]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2300)" }, + /* 89*/ { "[235]1abcdefghijklmnopqrstuvwxyz0", 0, "2351abcdefghijklmnopqrstuvwxyz0", "" }, + /* 90*/ { "[235]1abcdefghijklmnopqrstuvwxyz01", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (235)" }, + /* 91*/ { "[24]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (24)" }, + /* 92*/ { "[240]abcdefghijklmnopqrstuvwxyz1234", 0, "240abcdefghijklmnopqrstuvwxyz1234", "" }, + /* 93*/ { "[240]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (240)" }, + /* 94*/ { "[2400]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2400)" }, + /* 95*/ { "[241]abcdefghijklmnopqrstuvwxyz1234", 0, "241abcdefghijklmnopqrstuvwxyz1234", "" }, + /* 96*/ { "[241]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (241)" }, + /* 97*/ { "[2410]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2410)" }, + /* 98*/ { "[242]12345", 0, "24212345", "" }, + /* 99*/ { "[242]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (242)" }, + /*100*/ { "[2420]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2420)" }, + /*101*/ { "[243]abcdefghijklmnopqrst", 0, "243abcdefghijklmnopqrst", "" }, + /*102*/ { "[243]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (243)" }, + /*103*/ { "[2430]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2430)" }, + /*104*/ { "[244]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (244)" }, + /*105*/ { "[2440]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2440)" }, + /*106*/ { "[249]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (249)" }, + /*107*/ { "[2490]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2490)" }, + /*108*/ { "[25]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (25)" }, + /*109*/ { "[250]abcdefghijklmnopqrstuvwxyz1234", 0, "250abcdefghijklmnopqrstuvwxyz1234", "" }, + /*110*/ { "[250]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (250)" }, + /*111*/ { "[2500]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2500)" }, + /*112*/ { "[251]abcdefghijklmnopqrstuvwxyz1234", 0, "251abcdefghijklmnopqrstuvwxyz1234", "" }, + /*113*/ { "[251]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (251)" }, + /*114*/ { "[2510]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2510)" }, + /*115*/ { "[252]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (252)" }, + /*116*/ { "[2520]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2520)" }, + /*117*/ { "[253]131313131313", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (253)" }, + /*118*/ { "[253]1313131313134", ZINT_WARN_NONCOMPLIANT, "2531313131313134", "261: AI (253) position 13: Bad checksum '4', expected '0'" }, + /*119*/ { "[253]1313131313130", 0, "2531313131313130", "" }, + /*120*/ { "[253]131313131313412345678901234567", ZINT_WARN_NONCOMPLIANT, "253131313131313412345678901234567", "261: AI (253) position 13: Bad checksum '4', expected '0'" }, + /*121*/ { "[253]131313131313012345678901234567", 0, "253131313131313012345678901234567", "" }, + /*122*/ { "[253]1313131313134123456789012345678", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (253)" }, + /*123*/ { "[2530]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2530)" }, + /*124*/ { "[254]abcdefghijklmnopqrst", 0, "254abcdefghijklmnopqrst", "" }, + /*125*/ { "[254]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (254)" }, + /*126*/ { "[2540]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2540)" }, + /*127*/ { "[255]131313131313", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (255)" }, + /*128*/ { "[255]1313131313134", ZINT_WARN_NONCOMPLIANT, "2551313131313134", "261: AI (255) position 13: Bad checksum '4', expected '0'" }, + /*129*/ { "[255]1313131313130", 0, "2551313131313130", "" }, + /*130*/ { "[255]1313131313134123456789012", ZINT_WARN_NONCOMPLIANT, "2551313131313134123456789012", "261: AI (255) position 13: Bad checksum '4', expected '0'" }, + /*131*/ { "[255]1313131313130123456789012", 0, "2551313131313130123456789012", "" }, + /*132*/ { "[255]13131313131341234567890123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (255)" }, + /*133*/ { "[2550]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2550)" }, + /*134*/ { "[256]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (256)" }, + /*135*/ { "[2560]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2560)" }, + /*136*/ { "[259]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (259)" }, + /*137*/ { "[2590]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2590)" }, + /*138*/ { "[26]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (26)" }, + /*139*/ { "[260]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (260)" }, + /*140*/ { "[2600]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2600)" }, + /*141*/ { "[27]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (27)" }, + /*142*/ { "[270]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (270)" }, + /*143*/ { "[2700]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2700)" }, + /*144*/ { "[28]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (28)" }, + /*145*/ { "[280]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (280)" }, + /*146*/ { "[2800]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2800)" }, + /*147*/ { "[29]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (29)" }, + /*148*/ { "[290]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (290)" }, + /*149*/ { "[2900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (2900)" }, + /*150*/ { "[30]12345678", 0, "3012345678", "" }, + /*151*/ { "[30]123456789", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (30)" }, + /*152*/ { "[300]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (300)" }, + /*153*/ { "[3000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3000)" }, + /*154*/ { "[31]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (31)" }, + /*155*/ { "[310]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (310)" }, + /*156*/ { "[3100]123456", 0, "3100123456", "" }, + /*157*/ { "[3100]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3100)" }, + /*158*/ { "[3101]123456", 0, "3101123456", "" }, + /*159*/ { "[3101]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3101)" }, + /*160*/ { "[3105]123456", 0, "3105123456", "" }, + /*161*/ { "[3105]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3105)" }, + /*162*/ { "[3106]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3106)" }, + /*163*/ { "[3109]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3109)" }, + /*164*/ { "[3110]123456", 0, "3110123456", "" }, + /*165*/ { "[3110]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3110)" }, + /*166*/ { "[3115]123456", 0, "3115123456", "" }, + /*167*/ { "[3115]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3115)" }, + /*168*/ { "[3116]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3116)" }, + /*169*/ { "[3119]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3119)" }, + /*170*/ { "[3120]123456", 0, "3120123456", "" }, + /*171*/ { "[3120]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3120)" }, + /*172*/ { "[3125]123456", 0, "3125123456", "" }, + /*173*/ { "[3125]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3125)" }, + /*174*/ { "[3126]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3126)" }, + /*175*/ { "[3129]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3129)" }, + /*176*/ { "[3130]123456", 0, "3130123456", "" }, + /*177*/ { "[3130]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3130)" }, + /*178*/ { "[3135]123456", 0, "3135123456", "" }, + /*179*/ { "[3135]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3135)" }, + /*180*/ { "[3136]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3136)" }, + /*181*/ { "[3139]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3139)" }, + /*182*/ { "[3140]123456", 0, "3140123456", "" }, + /*183*/ { "[3140]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3140)" }, + /*184*/ { "[3145]123456", 0, "3145123456", "" }, + /*185*/ { "[3145]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3145)" }, + /*186*/ { "[3146]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3146)" }, + /*187*/ { "[3149]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3149)" }, + /*188*/ { "[3150]123456", 0, "3150123456", "" }, + /*189*/ { "[3150]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3150)" }, + /*190*/ { "[3155]123456", 0, "3155123456", "" }, + /*191*/ { "[3155]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3155)" }, + /*192*/ { "[3156]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3156)" }, + /*193*/ { "[3159]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3159)" }, + /*194*/ { "[3160]123456", 0, "3160123456", "" }, + /*195*/ { "[3160]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3160)" }, + /*196*/ { "[3165]123456", 0, "3165123456", "" }, + /*197*/ { "[3165]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3165)" }, + /*198*/ { "[3166]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3166)" }, + /*199*/ { "[3169]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3169)" }, + /*200*/ { "[3170]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3170)" }, + /*201*/ { "[3179]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3179)" }, + /*202*/ { "[3180]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3180)" }, + /*203*/ { "[3189]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3189)" }, + /*204*/ { "[3190]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3190)" }, + /*205*/ { "[3199]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3199)" }, + /*206*/ { "[32]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (32)" }, + /*207*/ { "[320]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (320)" }, + /*208*/ { "[3200]123456", 0, "3200123456", "" }, + /*209*/ { "[3200]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3200)" }, + /*210*/ { "[3205]123456", 0, "3205123456", "" }, + /*211*/ { "[3205]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3205)" }, + /*212*/ { "[3206]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3206)" }, + /*213*/ { "[3209]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3209)" }, + /*214*/ { "[3210]123456", 0, "3210123456", "" }, + /*215*/ { "[3210]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3210)" }, + /*216*/ { "[3215]123456", 0, "3215123456", "" }, + /*217*/ { "[3215]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3215)" }, + /*218*/ { "[3216]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3216)" }, + /*219*/ { "[3219]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3219)" }, + /*220*/ { "[3220]123456", 0, "3220123456", "" }, + /*221*/ { "[3220]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3220)" }, + /*222*/ { "[3225]123456", 0, "3225123456", "" }, + /*223*/ { "[3225]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3225)" }, + /*224*/ { "[3229]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3229)" }, + /*225*/ { "[3230]123456", 0, "3230123456", "" }, + /*226*/ { "[3230]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3230)" }, + /*227*/ { "[3235]123456", 0, "3235123456", "" }, + /*228*/ { "[3235]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3235)" }, + /*229*/ { "[3239]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3239)" }, + /*230*/ { "[3240]123456", 0, "3240123456", "" }, + /*231*/ { "[3240]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3240)" }, + /*232*/ { "[3245]123456", 0, "3245123456", "" }, + /*233*/ { "[3245]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3245)" }, + /*234*/ { "[3249]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3249)" }, + /*235*/ { "[3250]123456", 0, "3250123456", "" }, + /*236*/ { "[3250]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3250)" }, + /*237*/ { "[3255]123456", 0, "3255123456", "" }, + /*238*/ { "[3255]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3255)" }, + /*239*/ { "[3259]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3259)" }, + /*240*/ { "[3260]123456", 0, "3260123456", "" }, + /*241*/ { "[3260]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3260)" }, + /*242*/ { "[3265]123456", 0, "3265123456", "" }, + /*243*/ { "[3265]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3265)" }, + /*244*/ { "[3269]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3269)" }, + /*245*/ { "[3270]123456", 0, "3270123456", "" }, + /*246*/ { "[3270]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3270)" }, + /*247*/ { "[3275]123456", 0, "3275123456", "" }, + /*248*/ { "[3275]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3275)" }, + /*249*/ { "[3279]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3279)" }, + /*250*/ { "[3280]123456", 0, "3280123456", "" }, + /*251*/ { "[3280]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3280)" }, + /*252*/ { "[3285]123456", 0, "3285123456", "" }, + /*253*/ { "[3285]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3285)" }, + /*254*/ { "[3289]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3289)" }, + /*255*/ { "[3290]123456", 0, "3290123456", "" }, + /*256*/ { "[3290]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3290)" }, + /*257*/ { "[3295]123456", 0, "3295123456", "" }, + /*258*/ { "[3295]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3295)" }, + /*259*/ { "[3296]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3296)" }, + /*260*/ { "[3299]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3299)" }, + /*261*/ { "[33]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (33)" }, + /*262*/ { "[330]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (330)" }, + /*263*/ { "[3300]123456", 0, "3300123456", "" }, + /*264*/ { "[3300]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3300)" }, + /*265*/ { "[3305]123456", 0, "3305123456", "" }, + /*266*/ { "[3305]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3305)" }, + /*267*/ { "[3306]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3306)" }, + /*268*/ { "[3309]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3309)" }, + /*269*/ { "[3310]123456", 0, "3310123456", "" }, + /*270*/ { "[3310]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3310)" }, + /*271*/ { "[3319]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3319)" }, + /*272*/ { "[3320]123456", 0, "3320123456", "" }, + /*273*/ { "[3320]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3320)" }, + /*274*/ { "[3329]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3329)" }, + /*275*/ { "[3330]123456", 0, "3330123456", "" }, + /*276*/ { "[3330]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3330)" }, + /*277*/ { "[3339]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3339)" }, + /*278*/ { "[3340]123456", 0, "3340123456", "" }, + /*279*/ { "[3340]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3340)" }, + /*280*/ { "[3349]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3349)" }, + /*281*/ { "[3350]123456", 0, "3350123456", "" }, + /*282*/ { "[3350]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3350)" }, + /*283*/ { "[3359]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3359)" }, + /*284*/ { "[3360]123456", 0, "3360123456", "" }, + /*285*/ { "[3360]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3360)" }, + /*286*/ { "[3369]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3369)" }, + /*287*/ { "[3370]123456", 0, "3370123456", "" }, + /*288*/ { "[3370]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3370)" }, + /*289*/ { "[3375]123456", 0, "3375123456", "" }, + /*290*/ { "[3375]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3375)" }, + /*291*/ { "[3376]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3376)" }, + /*292*/ { "[3379]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3379)" }, + /*293*/ { "[3380]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3380)" }, + /*294*/ { "[3390]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3390)" }, + /*295*/ { "[3399]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3399)" }, + /*296*/ { "[34]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (34)" }, + /*297*/ { "[340]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (340)" }, + /*298*/ { "[3400]123456", 0, "3400123456", "" }, + /*299*/ { "[3400]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3400)" }, + /*300*/ { "[3405]123456", 0, "3405123456", "" }, + /*301*/ { "[3405]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3405)" }, + /*302*/ { "[3406]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3406)" }, + /*303*/ { "[3409]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3409)" }, + /*304*/ { "[3410]123456", 0, "3410123456", "" }, + /*305*/ { "[3410]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3410)" }, + /*306*/ { "[3419]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3419)" }, + /*307*/ { "[3420]123456", 0, "3420123456", "" }, + /*308*/ { "[3420]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3420)" }, + /*309*/ { "[3429]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3429)" }, + /*310*/ { "[3430]123456", 0, "3430123456", "" }, + /*311*/ { "[3430]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3430)" }, + /*312*/ { "[3439]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3439)" }, + /*313*/ { "[3440]123456", 0, "3440123456", "" }, + /*314*/ { "[3440]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3440)" }, + /*315*/ { "[3449]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3449)" }, + /*316*/ { "[3450]123456", 0, "3450123456", "" }, + /*317*/ { "[3450]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3450)" }, + /*318*/ { "[3459]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3459)" }, + /*319*/ { "[3460]123456", 0, "3460123456", "" }, + /*320*/ { "[3460]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3460)" }, + /*321*/ { "[3469]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3469)" }, + /*322*/ { "[3470]123456", 0, "3470123456", "" }, + /*323*/ { "[3470]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3470)" }, + /*324*/ { "[3479]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3479)" }, + /*325*/ { "[3480]123456", 0, "3480123456", "" }, + /*326*/ { "[3480]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3480)" }, + /*327*/ { "[3489]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3489)" }, + /*328*/ { "[3490]123456", 0, "3490123456", "" }, + /*329*/ { "[3490]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3490)" }, + /*330*/ { "[3495]123456", 0, "3495123456", "" }, + /*331*/ { "[3495]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3495)" }, + /*332*/ { "[3496]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3496)" }, + /*333*/ { "[3499]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3499)" }, + /*334*/ { "[35]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (35)" }, + /*335*/ { "[350]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (350)" }, + /*336*/ { "[3500]123456", 0, "3500123456", "" }, + /*337*/ { "[3500]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3500)" }, + /*338*/ { "[3505]123456", 0, "3505123456", "" }, + /*339*/ { "[3505]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3505)" }, + /*340*/ { "[3506]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3506)" }, + /*341*/ { "[3509]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3509)" }, + /*342*/ { "[3510]123456", 0, "3510123456", "" }, + /*343*/ { "[3510]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3510)" }, + /*344*/ { "[3519]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3519)" }, + /*345*/ { "[3520]123456", 0, "3520123456", "" }, + /*346*/ { "[3520]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3520)" }, + /*347*/ { "[3529]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3529)" }, + /*348*/ { "[3530]123456", 0, "3530123456", "" }, + /*349*/ { "[3530]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3530)" }, + /*350*/ { "[3539]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3539)" }, + /*351*/ { "[3540]123456", 0, "3540123456", "" }, + /*352*/ { "[3540]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3540)" }, + /*353*/ { "[3549]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3549)" }, + /*354*/ { "[3550]123456", 0, "3550123456", "" }, + /*355*/ { "[3550]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3550)" }, + /*356*/ { "[3559]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3559)" }, + /*357*/ { "[3560]123456", 0, "3560123456", "" }, + /*358*/ { "[3560]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3560)" }, + /*359*/ { "[3569]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3569)" }, + /*360*/ { "[3570]123456", 0, "3570123456", "" }, + /*361*/ { "[3570]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3570)" }, + /*362*/ { "[3575]123456", 0, "3575123456", "" }, + /*363*/ { "[3376]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3376)" }, + /*364*/ { "[3579]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3579)" }, + /*365*/ { "[3580]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3580)" }, + /*366*/ { "[3590]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3590)" }, + /*367*/ { "[3599]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3599)" }, + /*368*/ { "[36]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (36)" }, + /*369*/ { "[360]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (360)" }, + /*370*/ { "[3600]123456", 0, "3600123456", "" }, + /*371*/ { "[3600]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3600)" }, + /*372*/ { "[3605]123456", 0, "3605123456", "" }, + /*373*/ { "[3605]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3605)" }, + /*374*/ { "[3606]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3606)" }, + /*375*/ { "[3609]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3609)" }, + /*376*/ { "[3610]123456", 0, "3610123456", "" }, + /*377*/ { "[3610]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3610)" }, + /*378*/ { "[3619]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3619)" }, + /*379*/ { "[3620]123456", 0, "3620123456", "" }, + /*380*/ { "[3620]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3620)" }, + /*381*/ { "[3629]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3629)" }, + /*382*/ { "[3630]123456", 0, "3630123456", "" }, + /*383*/ { "[3630]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3630)" }, + /*384*/ { "[3639]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3639)" }, + /*385*/ { "[3640]123456", 0, "3640123456", "" }, + /*386*/ { "[3640]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3640)" }, + /*387*/ { "[3649]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3649)" }, + /*388*/ { "[3650]123456", 0, "3650123456", "" }, + /*389*/ { "[3650]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3650)" }, + /*390*/ { "[3659]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3659)" }, + /*391*/ { "[3660]123456", 0, "3660123456", "" }, + /*392*/ { "[3660]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3660)" }, + /*393*/ { "[3669]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3669)" }, + /*394*/ { "[3670]123456", 0, "3670123456", "" }, + /*395*/ { "[3670]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3670)" }, + /*396*/ { "[3679]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3679)" }, + /*397*/ { "[3680]123456", 0, "3680123456", "" }, + /*398*/ { "[3680]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3680)" }, + /*399*/ { "[3689]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3689)" }, + /*400*/ { "[3690]123456", 0, "3690123456", "" }, + /*401*/ { "[3690]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3690)" }, + /*402*/ { "[3695]123456", 0, "3695123456", "" }, + /*403*/ { "[3695]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3695)" }, + /*404*/ { "[3696]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3696)" }, + /*405*/ { "[3699]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3699)" }, + /*406*/ { "[37]12345678", 0, "3712345678", "" }, + /*407*/ { "[37]123456789", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (37)" }, + /*408*/ { "[370]12345678", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (370)" }, + /*409*/ { "[3700]12345678", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3700)" }, + /*410*/ { "[38]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (38)" }, + /*411*/ { "[380]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (380)" }, + /*412*/ { "[3800]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3800)" }, + /*413*/ { "[39]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (39)" }, + /*414*/ { "[390]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (390)" }, + /*415*/ { "[3900]123456789012345", 0, "3900123456789012345", "" }, + /*416*/ { "[3900]1234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3900)" }, + /*417*/ { "[3900]12345678901234", 0, "390012345678901234", "" }, + /*418*/ { "[3901]123456789012345", 0, "3901123456789012345", "" }, + /*419*/ { "[3901]1234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3901)" }, + /*420*/ { "[3905]123456789012345", 0, "3905123456789012345", "" }, + /*421*/ { "[3909]123456789012345", 0, "3909123456789012345", "" }, + /*422*/ { "[3909]1234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3909)" }, + /*423*/ { "[3910]123123456789012345", ZINT_WARN_NONCOMPLIANT, "3910123123456789012345", "261: AI (3910) position 1: Unknown currency code '123'" }, + /*424*/ { "[3910]997123456789012345", 0, "3910997123456789012345", "" }, + /*425*/ { "[3910]1231234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3910)" }, + /*426*/ { "[3910]123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3910)" }, + /*427*/ { "[3915]123123456789012345", ZINT_WARN_NONCOMPLIANT, "3915123123456789012345", "261: AI (3915) position 1: Unknown currency code '123'" }, + /*428*/ { "[3915]997123456789012345", 0, "3915997123456789012345", "" }, + /*429*/ { "[3915]1231234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3915)" }, + /*430*/ { "[3919]123123456789012345", ZINT_WARN_NONCOMPLIANT, "3919123123456789012345", "261: AI (3919) position 1: Unknown currency code '123'" }, + /*431*/ { "[3919]997123456789012345", 0, "3919997123456789012345", "" }, + /*432*/ { "[3919]1231234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3919)" }, + /*433*/ { "[3920]123456789012345", 0, "3920123456789012345", "" }, + /*434*/ { "[3920]1234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3920)" }, + /*435*/ { "[3925]123456789012345", 0, "3925123456789012345", "" }, + /*436*/ { "[3925]1234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3925)" }, + /*437*/ { "[3929]123456789012345", 0, "3929123456789012345", "" }, + /*438*/ { "[3929]1234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3929)" }, + /*439*/ { "[3930]123123456789012345", ZINT_WARN_NONCOMPLIANT, "3930123123456789012345", "261: AI (3930) position 1: Unknown currency code '123'" }, + /*440*/ { "[3930]997123456789012345", 0, "3930997123456789012345", "" }, + /*441*/ { "[3930]1231234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3930)" }, + /*442*/ { "[3930]123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3930)" }, + /*443*/ { "[3935]123123456789012345", ZINT_WARN_NONCOMPLIANT, "3935123123456789012345", "261: AI (3935) position 1: Unknown currency code '123'" }, + /*444*/ { "[3935]997123456789012345", 0, "3935997123456789012345", "" }, + /*445*/ { "[3935]1231234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3935)" }, + /*446*/ { "[3939]123123456789012345", ZINT_WARN_NONCOMPLIANT, "3939123123456789012345", "261: AI (3939) position 1: Unknown currency code '123'" }, + /*447*/ { "[3939]997123456789012345", 0, "3939997123456789012345", "" }, + /*448*/ { "[3939]1231234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3939)" }, + /*449*/ { "[3940]1234", 0, "39401234", "" }, + /*450*/ { "[3940]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3940)" }, + /*451*/ { "[3940]123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3940)" }, + /*452*/ { "[3941]1234", 0, "39411234", "" }, + /*453*/ { "[3941]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3941)" }, + /*454*/ { "[3941]123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3941)" }, + /*455*/ { "[3942]1234", 0, "39421234", "" }, + /*456*/ { "[3942]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3942)" }, + /*457*/ { "[3943]1234", 0, "39431234", "" }, + /*458*/ { "[3943]123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3943)" }, + /*459*/ { "[3944]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3944)" }, + /*460*/ { "[3945]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3945)" }, + /*461*/ { "[3949]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3949)" }, + /*462*/ { "[3950]123456", 0, "3950123456", "" }, + /*463*/ { "[3950]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3950)" }, + /*464*/ { "[3950]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3950)" }, + /*465*/ { "[3951]123456", 0, "3951123456", "" }, + /*466*/ { "[3951]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3951)" }, + /*467*/ { "[3952]123456", 0, "3952123456", "" }, + /*468*/ { "[3952]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3952)" }, + /*469*/ { "[3953]123456", 0, "3953123456", "" }, + /*470*/ { "[3953]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3953)" }, + /*471*/ { "[3954]123456", 0, "3954123456", "" }, + /*472*/ { "[3954]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3954)" }, + /*473*/ { "[3955]123456", 0, "3955123456", "" }, + /*474*/ { "[3955]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (3955)" }, + /*475*/ { "[3956]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3956)" }, + /*476*/ { "[3959]123456", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3959)" }, + /*477*/ { "[3960]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3960)" }, + /*478*/ { "[3970]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3970)" }, + /*479*/ { "[3980]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3980)" }, + /*480*/ { "[3999]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (3999)" }, + /*481*/ { "[40]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (40)" }, + /*482*/ { "[400]123456789012345678901234567890", 0, "400123456789012345678901234567890", "" }, + /*483*/ { "[400]1234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (400)" }, + /*484*/ { "[4000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4000)" }, + /*485*/ { "[401]1234abcdefghijklmnopqrstuvwxyz", 0, "4011234abcdefghijklmnopqrstuvwxyz", "" }, + /*486*/ { "[401]1234abcdefghijklmnopqrstuvwxyz1", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (401)" }, + /*487*/ { "[4010]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4010)" }, + /*488*/ { "[402]13131313131313132", ZINT_WARN_NONCOMPLIANT, "40213131313131313132", "261: AI (402) position 17: Bad checksum '2', expected '0'" }, + /*489*/ { "[402]13131313131313130", 0, "40213131313131313130", "" }, + /*490*/ { "[402]1313131313131313", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (402)" }, + /*491*/ { "[4020]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4020)" }, + /*492*/ { "[403]abcdefghijklmnopqrstuvwxyz1234", 0, "403abcdefghijklmnopqrstuvwxyz1234", "" }, + /*493*/ { "[403]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (403)" }, + /*494*/ { "[4030]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4030)" }, + /*495*/ { "[404]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (404)" }, + /*496*/ { "[4040]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4040)" }, + /*497*/ { "[409]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (409)" }, + /*498*/ { "[4090]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4090)" }, + /*499*/ { "[41]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (41)" }, + /*500*/ { "[410]3898765432108", 0, "4103898765432108", "" }, + /*501*/ { "[410]12345678901234", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (410)" }, + /*502*/ { "[4100]12345678901234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4100)" }, + /*503*/ { "[411]1313131313134", ZINT_WARN_NONCOMPLIANT, "4111313131313134", "261: AI (411) position 13: Bad checksum '4', expected '0'" }, + /*504*/ { "[411]1313131313130", 0, "4111313131313130", "" }, + /*505*/ { "[411]13131313131", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (411)" }, + /*506*/ { "[4110]1313131313134", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4110)" }, + /*507*/ { "[412]1313131313130", 0, "4121313131313130", "" }, + /*508*/ { "[412]13131313131", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (412)" }, + /*509*/ { "[4120]1313131313134", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4120)" }, + /*510*/ { "[413]1313131313130", 0, "4131313131313130", "" }, + /*511*/ { "[413]13131313131", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (413)" }, + /*512*/ { "[4130]1313131313134", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4130)" }, + /*513*/ { "[414]1313131313130", 0, "4141313131313130", "" }, + /*514*/ { "[414]13131313131", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (414)" }, + /*515*/ { "[4140]1313131313134", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4140)" }, + /*516*/ { "[415]1313131313130", 0, "4151313131313130", "" }, + /*517*/ { "[415]13131313131", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (415)" }, + /*518*/ { "[4150]1313131313134", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4150)" }, + /*519*/ { "[416]1313131313130", 0, "4161313131313130", "" }, + /*520*/ { "[416]13131313131", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (416)" }, + /*521*/ { "[4160]1313131313134", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4160)" }, + /*522*/ { "[417]1313131313130", 0, "4171313131313130", "" }, + /*523*/ { "[417]13131313131", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (417)" }, + /*524*/ { "[4170]1313131313134", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4170)" }, + /*525*/ { "[418]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (418)" }, + /*526*/ { "[4180]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4180)" }, + /*527*/ { "[419]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (419)" }, + /*528*/ { "[4190]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4190)" }, + /*529*/ { "[42]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (42)" }, + /*530*/ { "[420]abcdefghijklmnopqrst", 0, "420abcdefghijklmnopqrst", "" }, + /*531*/ { "[420]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (420)" }, + /*532*/ { "[4200]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4200)" }, + /*533*/ { "[421]123abcdefghi", ZINT_WARN_NONCOMPLIANT, "421123abcdefghi", "261: AI (421) position 1: Unknown country code '123'" }, + /*534*/ { "[421]434abcdefghi", 0, "421434abcdefghi", "" }, + /*535*/ { "[421]123abcdefghij", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (421)" }, + /*536*/ { "[421]1231", ZINT_WARN_NONCOMPLIANT, "4211231", "261: AI (421) position 1: Unknown country code '123'" }, + /*537*/ { "[421]4341", 0, "4214341", "" }, + /*538*/ { "[421]123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (421)" }, + /*539*/ { "[4210]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4210)" }, + /*540*/ { "[422]123", ZINT_WARN_NONCOMPLIANT, "422123", "261: AI (422) position 1: Unknown country code '123'" }, + /*541*/ { "[422]004", 0, "422004", "" }, + /*542*/ { "[422]1234", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (422)" }, + /*543*/ { "[422]12", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (422)" }, + /*544*/ { "[4220]123", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4220)" }, + /*545*/ { "[423]123123123123123", ZINT_WARN_NONCOMPLIANT, "423123123123123123", "261: AI (423) position 1: Unknown country code '123'" }, + /*546*/ { "[423]470004012887123", ZINT_WARN_NONCOMPLIANT, "423470004012887123", "261: AI (423) position 13: Unknown country code '123'" }, + /*547*/ { "[423]470004012887438", 0, "423470004012887438", "" }, + /*548*/ { "[423]1231231231231231", ZINT_ERROR_INVALID_DATA, "4231231231231231231", "259: Invalid data length for AI (423)" }, + /*549*/ { "[423]12312312312312", ZINT_WARN_NONCOMPLIANT, "42312312312312312", "259: Invalid data length for AI (423)" }, + /*550*/ { "[423]1231231231231", ZINT_WARN_NONCOMPLIANT, "4231231231231231", "259: Invalid data length for AI (423)" }, + /*551*/ { "[423]12312312312", ZINT_WARN_NONCOMPLIANT, "42312312312312", "259: Invalid data length for AI (423)" }, + /*552*/ { "[423]1231231231", ZINT_WARN_NONCOMPLIANT, "4231231231231", "259: Invalid data length for AI (423)" }, + /*553*/ { "[423]123", ZINT_WARN_NONCOMPLIANT, "423123", "261: AI (423) position 1: Unknown country code '123'" }, + /*554*/ { "[423]004", 0, "423004", "" }, + /*555*/ { "[423]12", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (423)" }, + /*556*/ { "[4230]123123123123123", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4230)" }, + /*557*/ { "[424]123", ZINT_WARN_NONCOMPLIANT, "424123", "261: AI (424) position 1: Unknown country code '123'" }, + /*558*/ { "[424]004", 0, "424004", "" }, + /*559*/ { "[424]1234", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (424)" }, + /*560*/ { "[424]12", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (424)" }, + /*561*/ { "[4240]123", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4240)" }, + /*562*/ { "[425]123123123123123", ZINT_WARN_NONCOMPLIANT, "425123123123123123", "261: AI (425) position 1: Unknown country code '123'" }, + /*563*/ { "[425]010500276634894", 0, "425010500276634894", "" }, + /*564*/ { "[425]010500276123894", ZINT_WARN_NONCOMPLIANT, "425010500276123894", "261: AI (425) position 10: Unknown country code '123'" }, + /*565*/ { "[425]1231231231231231", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (425)" }, + /*566*/ { "[425]12", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (425)" }, + /*567*/ { "[4250]123123123123123", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4250)" }, + /*568*/ { "[426]123", ZINT_WARN_NONCOMPLIANT, "426123", "261: AI (426) position 1: Unknown country code '123'" }, + /*569*/ { "[426]426", 0, "426426", "" }, + /*570*/ { "[426]1234", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (426)" }, + /*571*/ { "[426]12", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (426)" }, + /*572*/ { "[4260]123", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4260)" }, + /*573*/ { "[427]abc", 0, "427abc", "" }, + /*574*/ { "[427]abcd", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (427)" }, + /*575*/ { "[4270]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4270)" }, + /*576*/ { "[428]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (428)" }, + /*577*/ { "[4280]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4280)" }, + /*578*/ { "[429]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (429)" }, + /*579*/ { "[4290]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4290)" }, + /*580*/ { "[43]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (43)" }, + /*581*/ { "[430]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (430)" }, + /*582*/ { "[4300]1", 0, "43001", "" }, + /*583*/ { "[4300]12345678901234567890123456789012345", 0, "430012345678901234567890123456789012345", "" }, + /*584*/ { "[4300]123456789012345678901234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4300)" }, + /*585*/ { "[4301]1", 0, "43011", "" }, + /*586*/ { "[4301]12345678901234567890123456789012345", 0, "430112345678901234567890123456789012345", "" }, + /*587*/ { "[4301]123456789012345678901234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4301)" }, + /*588*/ { "[4302]1", 0, "43021", "" }, + /*589*/ { "[4302]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43021234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*590*/ { "[4302]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4302)" }, + /*591*/ { "[4303]1", 0, "43031", "" }, + /*592*/ { "[4303]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43031234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*593*/ { "[4303]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4303)" }, + /*594*/ { "[4304]1", 0, "43041", "" }, + /*595*/ { "[4304]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43041234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*596*/ { "[4304]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4304)" }, + /*597*/ { "[4305]1", 0, "43051", "" }, + /*598*/ { "[4305]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43051234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*599*/ { "[4305]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4305)" }, + /*600*/ { "[4306]1", 0, "43061", "" }, + /*601*/ { "[4306]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43061234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*602*/ { "[4306]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4306)" }, + /*603*/ { "[4307]FR", 0, "4307FR", "" }, + /*604*/ { "[4307]F", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4307)" }, + /*605*/ { "[4307]FRR", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4307)" }, + /*606*/ { "[4308]1", 0, "43081", "" }, + /*607*/ { "[4308]123456789012345678901234567890", 0, "4308123456789012345678901234567890", "" }, + /*608*/ { "[4308]1234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4308)" }, + /*609*/ { "[4309]12345678901234567890", 0, "430912345678901234567890", "" }, + /*610*/ { "[4309]1234567890123456789", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4309)" }, + /*611*/ { "[4309]1234567890123456789A", ZINT_WARN_NONCOMPLIANT, "43091234567890123456789A", "261: AI (4309) position 20: Non-numeric character 'A'" }, + /*612*/ { "[431]1", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (431)" }, + /*613*/ { "[4310]1", 0, "43101", "" }, + /*614*/ { "[4310]12345678901234567890123456789012345", 0, "431012345678901234567890123456789012345", "" }, + /*615*/ { "[4310]123456789012345678901234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4310)" }, + /*616*/ { "[4311]1", 0, "43111", "" }, + /*617*/ { "[4311]12345678901234567890123456789012345", 0, "431112345678901234567890123456789012345", "" }, + /*618*/ { "[4311]123456789012345678901234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4311)" }, + /*619*/ { "[4312]1", 0, "43121", "" }, + /*620*/ { "[4312]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43121234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*621*/ { "[4312]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4312)" }, + /*622*/ { "[4313]1", 0, "43131", "" }, + /*623*/ { "[4313]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43131234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*624*/ { "[4313]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4313)" }, + /*625*/ { "[4314]1", 0, "43141", "" }, + /*626*/ { "[4314]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43141234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*627*/ { "[4314]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4314)" }, + /*628*/ { "[4315]1", 0, "43151", "" }, + /*629*/ { "[4315]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43151234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*630*/ { "[4315]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4315)" }, + /*631*/ { "[4316]1", 0, "43161", "" }, + /*632*/ { "[4316]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "43161234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*633*/ { "[4316]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4316)" }, + /*634*/ { "[4317]FR", 0, "4317FR", "" }, + /*635*/ { "[4317]F", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4317)" }, + /*636*/ { "[4317]FRF", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4317)" }, + /*637*/ { "[4318]1", 0, "43181", "" }, + /*638*/ { "[4318]12345678901234567890", 0, "431812345678901234567890", "" }, + /*639*/ { "[4318]123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4318)" }, + /*640*/ { "[4319]1", 0, "43191", "" }, + /*641*/ { "[4319]123456789012345678901234567890", 0, "4319123456789012345678901234567890", "" }, + /*642*/ { "[4319]1234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4319)" }, + /*643*/ { "[432]1", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (432)" }, + /*644*/ { "[4320]1", 0, "43201", "" }, + /*645*/ { "[4320]12345678901234567890123456789012345", 0, "432012345678901234567890123456789012345", "" }, + /*646*/ { "[4320]123456789012345678901234567890123456", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4320)" }, + /*647*/ { "[4321]1", 0, "43211", "" }, + /*648*/ { "[4321]10", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4321)" }, + /*649*/ { "[4322]1", 0, "43221", "" }, + /*650*/ { "[4322]10", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4322)" }, + /*651*/ { "[4323]1", 0, "43231", "" }, + /*652*/ { "[4323]10", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4323)" }, + /*653*/ { "[4324]1212120000", 0, "43241212120000", "" }, + /*654*/ { "[4324]121212000", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4324)" }, + /*655*/ { "[4324]12121200000", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4324)" }, + /*656*/ { "[4325]1212120000", 0, "43251212120000", "" }, + /*657*/ { "[4325]121212000", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4325)" }, + /*658*/ { "[4325]12121200000", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4325)" }, + /*659*/ { "[4326]121212", 0, "4326121212", "" }, + /*660*/ { "[4326]12121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4326)" }, + /*661*/ { "[4326]1212120", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (4326)" }, + /*662*/ { "[4327]121212", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4327)" }, + /*663*/ { "[4328]121212", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4328)" }, + /*664*/ { "[4329]121212", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4329)" }, + /*665*/ { "[433]121212", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (433)" }, + /*666*/ { "[4330]121212", 0, "4330121212", "" }, + /*667*/ { "[4331]121212-", 0, "4331121212-", "" }, + /*668*/ { "[4332]121212", 0, "4332121212", "" }, + /*669*/ { "[4333]121212-", 0, "4333121212-", "" }, + /*670*/ { "[4334]121212", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4334)" }, + /*671*/ { "[44]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (44)" }, + /*672*/ { "[440]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (440)" }, + /*673*/ { "[4400]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4400)" }, + /*674*/ { "[49]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (49)" }, + /*675*/ { "[490]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (490)" }, + /*676*/ { "[4900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4900)" }, + /*677*/ { "[499]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (499)" }, + /*678*/ { "[4990]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (4990)" }, + /*679*/ { "[50]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (50)" }, + /*680*/ { "[500]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (500)" }, + /*681*/ { "[5000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (5000)" }, + /*682*/ { "[51]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (51)" }, + /*683*/ { "[510]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (510)" }, + /*684*/ { "[5100]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (5100)" }, + /*685*/ { "[59]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (59)" }, + /*686*/ { "[590]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (590)" }, + /*687*/ { "[5900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (5900)" }, + /*688*/ { "[60]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (60)" }, + /*689*/ { "[600]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (600)" }, + /*690*/ { "[6000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (6000)" }, + /*691*/ { "[61]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (61)" }, + /*692*/ { "[610]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (610)" }, + /*693*/ { "[6100]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (6100)" }, + /*694*/ { "[69]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (69)" }, + /*695*/ { "[690]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (690)" }, + /*696*/ { "[6900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (6900)" }, + /*697*/ { "[70]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (70)" }, + /*698*/ { "[700]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (700)" }, + /*699*/ { "[7000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7000)" }, + /*700*/ { "[7001]1234567890123", 0, "70011234567890123", "" }, + /*701*/ { "[7001]123456789012", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7001)" }, + /*702*/ { "[7002]abcdefghijklmnopqrstuvwxyz1234", 0, "7002abcdefghijklmnopqrstuvwxyz1234", "" }, + /*703*/ { "[7002]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7002)" }, + /*704*/ { "[7003]1212121212", 0, "70031212121212", "" }, + /*705*/ { "[7003]121212121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7003)" }, + /*706*/ { "[7004]1234", 0, "70041234", "" }, + /*707*/ { "[7004]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7004)" }, + /*708*/ { "[7005]abcdefghijkl", 0, "7005abcdefghijkl", "" }, + /*709*/ { "[7005]abcdefghijklm", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7005)" }, + /*710*/ { "[7006]200132", ZINT_WARN_NONCOMPLIANT, "7006200132", "261: AI (7006) position 5: Invalid day '32'" }, + /*711*/ { "[7006]200100", ZINT_WARN_NONCOMPLIANT, "7006200100", "261: AI (7006) position 5: Invalid day '00'" }, + /*712*/ { "[7006]200120", 0, "7006200120", "" }, + /*713*/ { "[7006]2001320", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7006)" }, + /*714*/ { "[7007]010101121212", 0, "7007010101121212", "" }, + /*715*/ { "[7007]01010112121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7007)" }, + /*716*/ { "[7007]A1010112121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7007)" }, + /*717*/ { "[7007]121212", 0, "7007121212", "" }, + /*718*/ { "[7007]12121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7007)" }, + /*719*/ { "[7007]1212121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7007)" }, + /*720*/ { "[7008]abc", 0, "7008abc", "" }, + /*721*/ { "[7008]abcd", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7008)" }, + /*722*/ { "[7009]abcdefghij", 0, "7009abcdefghij", "" }, + /*723*/ { "[7009]abcdefghijk", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7009)" }, + /*724*/ { "[7010]01", 0, "701001", "" }, + /*725*/ { "[7010]1", 0, "70101", "" }, + /*726*/ { "[7010]012", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7010)" }, + /*727*/ { "[7011]121212", 0, "7011121212", "" }, + /*728*/ { "[7011]1212121212", 0, "70111212121212", "" }, + /*729*/ { "[7011]12121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7011)" }, + /*730*/ { "[7011]121212121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7011)" }, + /*731*/ { "[7012]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7012)" }, + /*732*/ { "[7019]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7019)" }, + /*733*/ { "[7020]abcdefghijklmnopqrst", 0, "7020abcdefghijklmnopqrst", "" }, + /*734*/ { "[7020]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7020)" }, + /*735*/ { "[7021]abcdefghijklmnopqrst", 0, "7021abcdefghijklmnopqrst", "" }, + /*736*/ { "[7021]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7021)" }, + /*737*/ { "[7022]abcdefghijklmnopqrst", 0, "7022abcdefghijklmnopqrst", "" }, + /*738*/ { "[7022]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7022)" }, + /*739*/ { "[7023]1234abcdefghijklmnopqrstuvwxyz", 0, "70231234abcdefghijklmnopqrstuvwxyz", "" }, + /*740*/ { "[7023]1234abcdefghijklmnopqrstuvwxyza", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7023)" }, + /*741*/ { "[7024]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7024)" }, + /*742*/ { "[7025]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7025)" }, + /*743*/ { "[7029]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7029)" }, + /*744*/ { "[7030]123abcdefghijklmnopqrstuvwxyza", ZINT_WARN_NONCOMPLIANT, "7030123abcdefghijklmnopqrstuvwxyza", "261: AI (7030) position 1: Unknown country code '123'" }, + /*745*/ { "[7030]004abcdefghijklmnopqrstuvwxyza", 0, "7030004abcdefghijklmnopqrstuvwxyza", "" }, + /*746*/ { "[7030]123abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7030)" }, + /*747*/ { "[7031]123abcdefghijklmnopqrstuvwxyza", ZINT_WARN_NONCOMPLIANT, "7031123abcdefghijklmnopqrstuvwxyza", "261: AI (7031) position 1: Unknown country code '123'" }, + /*748*/ { "[7031]004abcdefghijklmnopqrstuvwxyza", 0, "7031004abcdefghijklmnopqrstuvwxyza", "" }, + /*749*/ { "[7031]123abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7031)" }, + /*750*/ { "[7032]004abcdefghijklmnopqrstuvwxyza", 0, "7032004abcdefghijklmnopqrstuvwxyza", "" }, + /*751*/ { "[7032]004abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7032)" }, + /*752*/ { "[7033]004abcdefghijklmnopqrstuvwxyza", 0, "7033004abcdefghijklmnopqrstuvwxyza", "" }, + /*753*/ { "[7033]004abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7033)" }, + /*754*/ { "[7034]004abcdefghijklmnopqrstuvwxyza", 0, "7034004abcdefghijklmnopqrstuvwxyza", "" }, + /*755*/ { "[7034]004abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7034)" }, + /*756*/ { "[7035]004abcdefghijklmnopqrstuvwxyza", 0, "7035004abcdefghijklmnopqrstuvwxyza", "" }, + /*757*/ { "[7035]004abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7035)" }, + /*758*/ { "[7036]004abcdefghijklmnopqrstuvwxyza", 0, "7036004abcdefghijklmnopqrstuvwxyza", "" }, + /*759*/ { "[7036]004abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7036)" }, + /*760*/ { "[7037]004abcdefghijklmnopqrstuvwxyza", 0, "7037004abcdefghijklmnopqrstuvwxyza", "" }, + /*761*/ { "[7037]004abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7037)" }, + /*762*/ { "[7038]004abcdefghijklmnopqrstuvwxyza", 0, "7038004abcdefghijklmnopqrstuvwxyza", "" }, + /*763*/ { "[7038]004abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7038)" }, + /*764*/ { "[7039]004abcdefghijklmnopqrstuvwxyza", 0, "7039004abcdefghijklmnopqrstuvwxyza", "" }, + /*765*/ { "[7039]123abcdefghijklmnopqrstuvwxyzab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7039)" }, + /*766*/ { "[7040]1abc", 0, "70401abc", "" }, + /*767*/ { "[7040]1ab", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7040)" }, + /*768*/ { "[7040]1abcd", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7040)" }, + /*769*/ { "[7041]BGE", 0, "7041BGE", "" }, + /*770*/ { "[7041]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7041)" }, + /*771*/ { "[7042]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7042)" }, + /*772*/ { "[7050]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7050)" }, + /*773*/ { "[7090]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7090)" }, + /*774*/ { "[7099]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7099)" }, + /*775*/ { "[71]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (71)" }, + /*776*/ { "[710]abcdefghijklmnopqrst", 0, "710abcdefghijklmnopqrst", "" }, + /*777*/ { "[710]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (710)" }, + /*778*/ { "[7100]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7100)" }, + /*779*/ { "[711]abcdefghijklmnopqrst", 0, "711abcdefghijklmnopqrst", "" }, + /*780*/ { "[711]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (711)" }, + /*781*/ { "[712]abcdefghijklmnopqrst", 0, "712abcdefghijklmnopqrst", "" }, + /*782*/ { "[712]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (712)" }, + /*783*/ { "[713]abcdefghijklmnopqrst", 0, "713abcdefghijklmnopqrst", "" }, + /*784*/ { "[713]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (713)" }, + /*785*/ { "[714]abcdefghijklmnopqrst", 0, "714abcdefghijklmnopqrst", "" }, + /*786*/ { "[714]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (714)" }, + /*787*/ { "[715]abcdefghijklmnopqrst", 0, "715abcdefghijklmnopqrst", "" }, + /*788*/ { "[715]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (715)" }, + /*789*/ { "[716]abcdefghijklmnopqrst", 0, "716abcdefghijklmnopqrst", "" }, + /*790*/ { "[716]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (716)" }, + /*791*/ { "[717]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (717)" }, + /*792*/ { "[718]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (718)" }, + /*793*/ { "[719]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (719)" }, + /*794*/ { "[72]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (72)" }, + /*795*/ { "[720]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (720)" }, + /*796*/ { "[7200]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7200)" }, + /*797*/ { "[721]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (721)" }, + /*798*/ { "[7210]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7210)" }, + /*799*/ { "[7220]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7220)" }, + /*800*/ { "[7230]EMabcdefghijklmnopqrstuvwxyzab", 0, "7230EMabcdefghijklmnopqrstuvwxyzab", "" }, + /*801*/ { "[7230]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7230)" }, + /*802*/ { "[7230]EM", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7230)" }, + /*803*/ { "[7231]EMabcdefghijklmnopqrstuvwxyzab", 0, "7231EMabcdefghijklmnopqrstuvwxyzab", "" }, + /*804*/ { "[7231]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7231)" }, + /*805*/ { "[7232]EMabcdefghijklmnopqrstuvwxyzab", 0, "7232EMabcdefghijklmnopqrstuvwxyzab", "" }, + /*806*/ { "[7232]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7232)" }, + /*807*/ { "[7233]EMabcdefghijklmnopqrstuvwxyzab", 0, "7233EMabcdefghijklmnopqrstuvwxyzab", "" }, + /*808*/ { "[7233]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7233)" }, + /*809*/ { "[7234]EMabcdefghijklmnopqrstuvwxyzab", 0, "7234EMabcdefghijklmnopqrstuvwxyzab", "" }, + /*810*/ { "[7234]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7234)" }, + /*811*/ { "[7235]EMabcdefghijklmnopqrstuvwxyzab", 0, "7235EMabcdefghijklmnopqrstuvwxyzab", "" }, + /*812*/ { "[7235]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7235)" }, + /*813*/ { "[7236]EMabcdefghijklmnopqrstuvwxyzab", 0, "7236EMabcdefghijklmnopqrstuvwxyzab", "" }, + /*814*/ { "[7236]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7236)" }, + /*815*/ { "[7237]EMabcdefghijklmnopqrstuvwxyzab", 0, "7237EMabcdefghijklmnopqrstuvwxyzab", "" }, + /*816*/ { "[7237]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7237)" }, + /*817*/ { "[7238]EMabcdefghijklmnopqrstuvwxyzab", 0, "7238EMabcdefghijklmnopqrstuvwxyzab", "" }, + /*818*/ { "[7238]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7238)" }, + /*819*/ { "[7239]EMabcdefghijklmnopqrstuvwxyzab", 0, "7239EMabcdefghijklmnopqrstuvwxyzab", "" }, + /*820*/ { "[7239]EMabcdefghijklmnopqrstuvwxyzabc", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7239)" }, + /*821*/ { "[7239]E", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7239)" }, + /*822*/ { "[7240]abcdefghijklmnopqrst", 0, "7240abcdefghijklmnopqrst", "" }, + /*823*/ { "[7240]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7240)" }, + /*824*/ { "[7241]99", 0, "724199", "" }, + /*825*/ { "[7241]100", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7241)" }, + /*826*/ { "[7242]abcdefghijklmnopqrstuvwxy", 0, "7242abcdefghijklmnopqrstuvwxy", "" }, + /*827*/ { "[7242]abcdefghijklmnopqrstuvwxyz", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7242)" }, + /*828*/ { "[7243]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7243)" }, + /*829*/ { "[7249]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7249)" }, + /*830*/ { "[7250]12341201", 0, "725012341201", "" }, + /*831*/ { "[7250]123412012", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7250)" }, + /*832*/ { "[7251]123412011359", 0, "7251123412011359", "" }, + /*833*/ { "[7251]1234120113591", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7251)" }, + /*834*/ { "[7252]2", 0, "72522", "" }, + /*835*/ { "[7252]20", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7252)" }, + /*836*/ { "[7253]abcdefghijklmnopqrstuvwxyzabcdefghijklmn", 0, "7253abcdefghijklmnopqrstuvwxyzabcdefghijklmn", "" }, + /*837*/ { "[7253]abcdefghijklmnopqrstuvwxyzabcdefghijklmno", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7253)" }, + /*838*/ { "[7254]abcdefghijklmnopqrstuvwxyzabcdefghijklmn", 0, "7254abcdefghijklmnopqrstuvwxyzabcdefghijklmn", "" }, + /*839*/ { "[7254]abcdefghijklmnopqrstuvwxyzabcdefghijklmno", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7254)" }, + /*840*/ { "[7255]abcdefghij", 0, "7255abcdefghij", "" }, + /*841*/ { "[7255]abcdefghijk", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7255)" }, + /*842*/ { "[7256]abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl", 0, "7256abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl", "" }, + /*843*/ { "[7256]abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7256)" }, + /*844*/ { "[7257]abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr", 0, "7257abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr", "" }, + /*845*/ { "[7257]abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7257)" }, + /*846*/ { "[7258]1/1", 0, "72581/1", "" }, + /*847*/ { "[7258]1/01", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7258)" }, + /*848*/ { "[7259]abcdefghijklmnopqrstuvwxyzabcdefghijklmn", 0, "7259abcdefghijklmnopqrstuvwxyzabcdefghijklmn", "" }, + /*849*/ { "[7259]abcdefghijklmnopqrstuvwxyzabcdefghijklmno", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (7259)" }, + /*850*/ { "[7260]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7260)" }, + /*851*/ { "[7299]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7299)" }, + /*852*/ { "[73]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (73)" }, + /*853*/ { "[7300]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7300)" }, + /*854*/ { "[74]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (74)" }, + /*855*/ { "[7400]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7400)" }, + /*856*/ { "[79]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (79)" }, + /*857*/ { "[7900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7900)" }, + /*858*/ { "[7999]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (7999)" }, + /*859*/ { "[80]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (80)" }, + /*860*/ { "[800]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (800)" }, + /*861*/ { "[8000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8000)" }, + /*862*/ { "[8001]12345678901234", ZINT_WARN_NONCOMPLIANT, "800112345678901234", "261: AI (8001) position 13: Invalid winding direction '3'" }, + /*863*/ { "[8001]12345678901204", 0, "800112345678901204", "" }, + /*864*/ { "[8001]1234123456789012345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8001)" }, + /*865*/ { "[8002]abcdefghijklmnopqrst", 0, "8002abcdefghijklmnopqrst", "" }, + /*866*/ { "[8002]abcdefghijklmnopqrstu", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8002)" }, + /*867*/ { "[8003]01234567890123abcdefghijklmnop", ZINT_WARN_NONCOMPLIANT, "800301234567890123abcdefghijklmnop", "261: AI (8003) position 14: Bad checksum '3', expected '8'" }, + /*868*/ { "[8003]01234567890128abcdefghijklmnop", 0, "800301234567890128abcdefghijklmnop", "" }, + /*869*/ { "[8003]01234567890128abcdefghijklmnopq", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8003)" }, + /*870*/ { "[8004]abcdefghijklmnopqrstuvwxyz1234", ZINT_WARN_NONCOMPLIANT, "8004abcdefghijklmnopqrstuvwxyz1234", "261: AI (8004) position 1: Non-numeric company prefix 'a'" }, + /*871*/ { "[8004]12cdefghijklmnopqrstuvwxyz1234", 0, "800412cdefghijklmnopqrstuvwxyz1234", "" }, + /*872*/ { "[8004]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8004)" }, + /*873*/ { "[8005]123456", 0, "8005123456", "" }, + /*874*/ { "[8005]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8005)" }, + /*875*/ { "[8005]1234567", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8005)" }, + /*876*/ { "[8006]123456789012341212", ZINT_WARN_NONCOMPLIANT, "8006123456789012341212", "261: AI (8006) position 14: Bad checksum '4', expected '1'" }, + /*877*/ { "[8006]123456789012311212", 0, "8006123456789012311212", "" }, + /*878*/ { "[8006]12345678901234121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8006)" }, + /*879*/ { "[8006]1234567890123412123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8006)" }, + /*880*/ { "[8007]abcdefghijklmnopqrstuvwxyz12345678", ZINT_WARN_NONCOMPLIANT, "8007abcdefghijklmnopqrstuvwxyz12345678", "261: AI (8007) position 1: Non-alphabetic IBAN country code 'ab'" }, + /*881*/ { "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ12345678", 0, "8007AD95EFGHIJKLMNOPQRSTUVWXYZ12345678", "" }, + /*882*/ { "[8007]AD95EFGHIJKLMNOPQRSTUVWXYZ123456789", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8007)" }, + /*883*/ { "[8008]123456121212", ZINT_WARN_NONCOMPLIANT, "8008123456121212", "261: AI (8008) position 3: Invalid month '34'" }, + /*884*/ { "[8008]121256121212", ZINT_WARN_NONCOMPLIANT, "8008121256121212", "261: AI (8008) position 5: Invalid day '56'" }, + /*885*/ { "[8008]121231121212", 0, "8008121231121212", "" }, + /*886*/ { "[8008]1234561212", ZINT_WARN_NONCOMPLIANT, "80081234561212", "261: AI (8008) position 3: Invalid month '34'" }, + /*887*/ { "[8008]1212311212", 0, "80081212311212", "" }, + /*888*/ { "[8008]12345612", ZINT_WARN_NONCOMPLIANT, "800812345612", "261: AI (8008) position 3: Invalid month '34'" }, + /*889*/ { "[8008]12010112", 0, "800812010112", "" }, + /*890*/ { "[8008]1234561", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8008)" }, + /*891*/ { "[8008]123456121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8008)" }, + /*892*/ { "[8008]12345612121", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8008)" }, + /*893*/ { "[8008]1234561212123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8008)" }, + /*894*/ { "[8009]12345678901234567890123456789012345678901234567890", 0, "800912345678901234567890123456789012345678901234567890", "" }, + /*895*/ { "[8009]123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8009)" }, + /*896*/ { "[8010]1234abcdefghijklmnopqrstuvwxyz1", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8010)" }, + /*897*/ { "[8011]123456789012", 0, "8011123456789012", "" }, + /*898*/ { "[8011]1234567890123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8011)" }, + /*899*/ { "[8012]abcdefghijklmnopqrst", 0, "8012abcdefghijklmnopqrst", "" }, + /*900*/ { "[8012]abcdefghijklmnopqrstuv", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8012)" }, + /*901*/ { "[8013]1234abcdefghijklmnopqrsQP", 0, "80131234abcdefghijklmnopqrsQP", "" }, + /*902*/ { "[8013]1234abcdefghijklmnopqrsQPv", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8013)" }, + /*903*/ { "[8014]1234abcdefghijklmnopqrsQP", 0, "80141234abcdefghijklmnopqrsQP", "" }, + /*904*/ { "[8014]1234abcdefghijklmnopqrsQPv", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8014)" }, + /*905*/ { "[8015]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8015)" }, + /*906*/ { "[8016]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8016)" }, + /*907*/ { "[8017]313131313131313139", ZINT_WARN_NONCOMPLIANT, "8017313131313131313139", "261: AI (8017) position 18: Bad checksum '9', expected '1'" }, + /*908*/ { "[8017]313131313131313131", 0, "8017313131313131313131", "" }, + /*909*/ { "[8017]31313131313131313", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8017)" }, + /*910*/ { "[8017]3131313131313131390", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8017)" }, + /*911*/ { "[8018]313131313131313139", ZINT_WARN_NONCOMPLIANT, "8018313131313131313139", "261: AI (8018) position 18: Bad checksum '9', expected '1'" }, + /*912*/ { "[8018]313131313131313131", 0, "8018313131313131313131", "" }, + /*913*/ { "[8018]31313131313131313", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8018)" }, + /*914*/ { "[8018]3131313131313131390", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8018)" }, + /*915*/ { "[8019]1234567890", 0, "80191234567890", "" }, + /*916*/ { "[8019]12345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8019)" }, + /*917*/ { "[8020]abcdefghijklmnopqrstuvwxy", 0, "8020abcdefghijklmnopqrstuvwxy", "" }, + /*918*/ { "[8020]abcdefghijklmnopqrstuvwxyz", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8020)" }, + /*919*/ { "[8021]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8021)" }, + /*920*/ { "[8025]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8025)" }, + /*921*/ { "[8026]123456789012341212", ZINT_WARN_NONCOMPLIANT, "8026123456789012341212", "261: AI (8026) position 14: Bad checksum '4', expected '1'" }, + /*922*/ { "[8026]123456789012311212", 0, "8026123456789012311212", "" }, + /*923*/ { "[8026]1234567890123451212", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8026)" }, + /*924*/ { "[8026]12345678901234512", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8026)" }, + /*925*/ { "[8027]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8027)" }, + /*926*/ { "[8030]-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, "8030-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ", "" }, + /*927*/ { "[8030]-1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ1", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8030)" }, + /*928*/ { "[8031]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8031)" }, + /*929*/ { "[8040]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8040)" }, + /*930*/ { "[8050]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8050)" }, + /*931*/ { "[8060]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8060)" }, + /*932*/ { "[8070]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8070)" }, + /*933*/ { "[8080]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8080)" }, + /*934*/ { "[8090]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8090)" }, + /*935*/ { "[8099]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8099)" }, + /*936*/ { "[81]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (81)" }, + /*937*/ { "[8100]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8100)" }, + /*938*/ { "[8109]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8109)" }, + /*939*/ { "[8110]5123456789011234565123455123450123105123450123512345678901320123190000", 0, "81105123456789011234565123455123450123105123450123512345678901320123190000", "" }, + /*940*/ { "[8110]51234567890112345651234551234501231051234501235123456789013201231900001", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8110)" }, + /*941*/ { "[8111]1234", 0, "81111234", "" }, + /*942*/ { "[8111]12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8111)" }, + /*943*/ { "[8111]123", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8111)" }, + /*944*/ { "[8112]1234567890123456789012345678901234567890123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, "81121234567890123456789012345678901234567890123456789012345678901234567890", "259: Invalid data length for AI (8112)" }, + /*945*/ { "[8112]12345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (8112)" }, + /*946*/ { "[8112]061234567890121234569123456789012345", 0, "8112061234567890121234569123456789012345", "" }, + /*947*/ { "[8113]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8113)" }, + /*948*/ { "[8120]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8120)" }, + /*949*/ { "[8130]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8130)" }, + /*950*/ { "[8140]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8140)" }, + /*951*/ { "[8150]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8150)" }, + /*952*/ { "[8190]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8190)" }, + /*953*/ { "[8199]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8199)" }, + /*954*/ { "[82]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (82)" }, + /*955*/ { "[8200]1234567890123456789012345678901234567890123456789012345678901234567890", 0, "82001234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*956*/ { "[8201]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8201)" }, + /*957*/ { "[8210]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8210)" }, + /*958*/ { "[8220]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8220)" }, + /*959*/ { "[8230]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8230)" }, + /*960*/ { "[8240]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8240)" }, + /*961*/ { "[8250]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8250)" }, + /*962*/ { "[8290]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8290)" }, + /*963*/ { "[8299]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8299)" }, + /*964*/ { "[83]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (83)" }, + /*965*/ { "[830]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (830)" }, + /*966*/ { "[8300]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8300)" }, + /*967*/ { "[84]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (84)" }, + /*968*/ { "[840]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (840)" }, + /*969*/ { "[8400]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8400)" }, + /*970*/ { "[85]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (85)" }, + /*971*/ { "[850]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (850)" }, + /*972*/ { "[8500]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8500)" }, + /*973*/ { "[89]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (89)" }, + /*974*/ { "[890]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (890)" }, + /*975*/ { "[8900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (8900)" }, + /*976*/ { "[90]abcdefghijklmnopqrstuvwxyz1234", 0, "90abcdefghijklmnopqrstuvwxyz1234", "" }, + /*977*/ { "[90]abcdefghijklmnopqrstuvwxyz12345", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (90)" }, + /*978*/ { "[900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (900)" }, + /*979*/ { "[9000]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9000)" }, + /*980*/ { "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "91123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*981*/ { "[91]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (91)" }, + /*982*/ { "[910]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (910)" }, + /*983*/ { "[9100]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9100)" }, + /*984*/ { "[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "92123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*985*/ { "[92]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (92)" }, + /*986*/ { "[920]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (920)" }, + /*987*/ { "[9200]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9200)" }, + /*988*/ { "[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "93123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*989*/ { "[93]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (93)" }, + /*990*/ { "[930]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (930)" }, + /*991*/ { "[9300]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9300)" }, + /*992*/ { "[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "94123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*993*/ { "[94]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (94)" }, + /*994*/ { "[940]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (940)" }, + /*995*/ { "[9400]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9400)" }, + /*996*/ { "[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "95123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*997*/ { "[95]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (95)" }, + /*998*/ { "[950]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (950)" }, + /*999*/ { "[9500]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9500)" }, + /*1000*/ { "[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "96123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*1001*/ { "[96]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (96)" }, + /*1002*/ { "[960]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (960)" }, + /*1003*/ { "[9600]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9600)" }, + /*1004*/ { "[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "97123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*1005*/ { "[97]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (97)" }, + /*1006*/ { "[970]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (970)" }, + /*1007*/ { "[9700]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9700)" }, + /*1008*/ { "[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "98123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*1009*/ { "[98]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (98)" }, + /*1010*/ { "[980]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (980)" }, + /*1011*/ { "[9800]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9800)" }, + /*1012*/ { "[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, "99123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "" }, + /*1013*/ { "[99]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_INVALID_DATA, "", "259: Invalid data length for AI (99)" }, + /*1014*/ { "[990]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (990)" }, + /*1015*/ { "[9900]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9900)" }, + /*1016*/ { "[9999]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9999)" }, + /*1017*/ { "[01]12345678901234[7006]200101", ZINT_WARN_NONCOMPLIANT, "01123456789012347006200101", "261: AI (01) position 14: Bad checksum '4', expected '1'" }, + /*1018*/ { "[01]12345678901231[7006]200101", 0, "01123456789012317006200101", "" }, + /*1019*/ { "[3900]1234567890[01]12345678901234", ZINT_WARN_NONCOMPLIANT, "39001234567890\0350112345678901234", "261: AI (01) position 14: Bad checksum '4', expected '1'" }, + /*1020*/ { "[3900]1234567890[01]12345678901231", 0, "39001234567890\0350112345678901231", "" }, + /*1021*/ { "[253]12345678901234[3901]12345678901234[20]12", ZINT_WARN_NONCOMPLIANT, "25312345678901234\035390112345678901234\0352012", "261: AI (253) position 13: Bad checksum '3', expected '8'" }, + /*1022*/ { "[253]12345678901284[3901]12345678901234[20]12", 0, "25312345678901284\035390112345678901234\0352012", "" }, + /*1023*/ { "[253]12345678901234[01]12345678901234[3901]12345678901234[20]12", ZINT_WARN_NONCOMPLIANT, "25312345678901234\0350112345678901234390112345678901234\0352012", "261: AI (01) position 14: Bad checksum '4', expected '1'" }, + /*1024*/ { "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12", 0, "25312345678901284\0350112345678901231390112345678901234\0352012", "" }, + /*1025*/ { "[01]12345678901231[0A]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "", "257: Invalid AI at position 19 in input (non-numeric characters in AI)" }, + /*1026*/ { "[01]12345678901231[0]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "", "256: Invalid AI at position 19 in input (AI too short)" }, + /*1027*/ { "[01]12345678901231[]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "", "256: Invalid AI at position 19 in input (AI too short)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char reduced[1024]; char escaped[1024]; - testStart("test_gs1_verify"); + testStartSymbol("test_gs1_verify", &symbol); for (i = 0; i < data_size; i++) { @@ -1452,7 +1454,7 @@ static void test_gs1_lint(const testCtx *const p_ctx) { char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "[00]123456789012345675", 0, "00123456789012345675", "" }, /* numeric */ /* 1*/ { "[00]12345678901234567.", ZINT_WARN_NONCOMPLIANT, "0012345678901234567.", "261: AI (00) position 18: Non-numeric character '.'" }, /* numeric */ /* 2*/ { "[00]123456789012345678", ZINT_WARN_NONCOMPLIANT, "00123456789012345678", "261: AI (00) position 18: Bad checksum '8', expected '5'" }, /* csum */ @@ -2103,13 +2105,13 @@ static void test_gs1_lint(const testCtx *const p_ctx) { /*647*/ { "[7041]X21", ZINT_WARN_NONCOMPLIANT, "7041X21", "261: AI (7041) position 1: Invalid package type 'X21'" }, /* packagetype */ /*648*/ { "[7041]___", ZINT_WARN_NONCOMPLIANT, "7041___", "261: AI (7041) position 1: Invalid package type '___'" }, /* packagetype */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char reduced[1024]; - testStart("test_gs1_lint"); + testStartSymbol("test_gs1_lint", &symbol); for (i = 0; i < data_size; i++) { @@ -2149,7 +2151,7 @@ static void test_input_mode(const testCtx *const p_ctx) { int compare_previous; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_AZTEC, "[01]12345678901231", GS1_MODE, -1 , 0, 0 }, /* 1*/ { BARCODE_AZTEC, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, 0, 1 }, /* 2*/ { BARCODE_AZTEC, "(01)12345678901231", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 1 }, @@ -2270,13 +2272,13 @@ static void test_input_mode(const testCtx *const p_ctx) { /*117*/ { BARCODE_QRCODE, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, /*118*/ { BARCODE_QRCODE, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; struct zint_symbol previous_symbol; - testStart("test_input_mode"); + testStartSymbol("test_input_mode", &symbol); for (i = 0; i < data_size; i++) { @@ -2316,7 +2318,7 @@ static void test_gs1nocheck_mode(const testCtx *const p_ctx) { char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_GS1_128, -1, "[01]12345678901231", "", 0, "" }, /* 1*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[01]12345678901231", "", 0, "" }, /* 2*/ { BARCODE_GS1_128, -1, "[01]12345678901234", "", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'" }, @@ -2341,72 +2343,72 @@ static void test_gs1nocheck_mode(const testCtx *const p_ctx) { /* 21*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[01]1234567890123\200", "", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1" }, /* Extended ASCII still checked */ /* 22*/ { BARCODE_GS1_128, -1, "0112345678901231", "", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI" }, /* 23*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "0112345678901231", "", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI" }, /* Format still checked */ - /* 24*/ { BARCODE_GS1_128, -1, "[01]", "", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data" }, + /* 24*/ { BARCODE_GS1_128, -1, "[01]", "", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input" }, /* 25*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[01]", "", 0, "" }, /* Zero-length data not checked */ - /* 26*/ { BARCODE_GS1_128, -1, "[01][20]12", "", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data" }, + /* 26*/ { BARCODE_GS1_128, -1, "[01][20]12", "", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input" }, /* 27*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[01][20]12", "", 0, "" }, /* Zero-length data not checked */ - /* 28*/ { BARCODE_GS1_128, -1, "[0]123", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, - /* 29*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[0]123", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 1 AI with no data still checked */ - /* 30*/ { BARCODE_GS1_128, -1, "[0]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, - /* 31*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[0]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 1 AI with no data still checked */ - /* 32*/ { BARCODE_GS1_128, -1, "[]12", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, + /* 28*/ { BARCODE_GS1_128, -1, "[0]123", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, + /* 29*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[0]123", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, /* Length 1 AI with no data still checked */ + /* 30*/ { BARCODE_GS1_128, -1, "[0]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, + /* 31*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[0]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, /* Length 1 AI with no data still checked */ + /* 32*/ { BARCODE_GS1_128, -1, "[]12", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, /* 33*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[]12", "", 0, "" }, /* Length 0 AI with data not checked */ - /* 34*/ { BARCODE_GS1_128, -1, "[]12[01]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, + /* 34*/ { BARCODE_GS1_128, -1, "[]12[01]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, /* 35*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[]12[01]", "", 0, "" }, /* Length 0 AI with data not checked, non-short AI with zero-length data not checked */ - /* 36*/ { BARCODE_GS1_128, -1, "[01][]12", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, + /* 36*/ { BARCODE_GS1_128, -1, "[01][]12", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 5 in input (AI too short)" }, /* 37*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[01][]12", "", 0, "" }, /* Length 0 AI with data not checked, non-short AI with zero-length data not checked */ - /* 38*/ { BARCODE_GS1_128, -1, "[1]1[]12", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, - /* 39*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[1]1[]12", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 1 AI with data still checked */ - /* 40*/ { BARCODE_GS1_128, -1, "[]12[1]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, - /* 41*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[]12[1]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 1 AI with data still checked */ - /* 42*/ { BARCODE_GS1_128, -1, "[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, - /* 43*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 0 AI with no data still checked */ - /* 44*/ { BARCODE_GS1_128, -1, "[01]12345678901231[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, - /* 45*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[01]12345678901231[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 0 AI with no data still checked */ - /* 46*/ { BARCODE_GS1_128, -1, "[01]12345678901231[][20]12", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, - /* 47*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[01]12345678901231[][20]12", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 0 AI with no data still checked */ - /* 48*/ { BARCODE_GS1_128, -1, "[01]12345678901231[]1[20]12", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, + /* 38*/ { BARCODE_GS1_128, -1, "[1]1[]12", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 5 in input (AI too short)" }, + /* 39*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[1]1[]12", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 5 in input (AI too short)" }, /* Length 1 AI with data still checked */ + /* 40*/ { BARCODE_GS1_128, -1, "[]12[1]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, + /* 41*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[]12[1]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, /* Length 1 AI with data still checked */ + /* 42*/ { BARCODE_GS1_128, -1, "[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, + /* 43*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, /* Length 0 AI with no data still checked */ + /* 44*/ { BARCODE_GS1_128, -1, "[01]12345678901231[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 19 in input (AI too short)" }, + /* 45*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[01]12345678901231[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 19 in input (AI too short)" }, /* Length 0 AI with no data still checked */ + /* 46*/ { BARCODE_GS1_128, -1, "[01]12345678901231[][20]12", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 19 in input (AI too short)" }, + /* 47*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[01]12345678901231[][20]12", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 19 in input (AI too short)" }, /* Length 0 AI with no data still checked */ + /* 48*/ { BARCODE_GS1_128, -1, "[01]12345678901231[]1[20]12", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 19 in input (AI too short)" }, /* 49*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[01]12345678901231[]1[20]12", "", 0, "" }, /* Length 0 AI with data not checked */ - /* 50*/ { BARCODE_GS1_128, -1, "[1234567890]123", "", ZINT_ERROR_INVALID_DATA, "Error 255: Invalid AI in input data (AI too long)" }, - /* 51*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[1234567890]123", "", ZINT_ERROR_INVALID_DATA, "Error 255: Invalid AI in input data (AI too long)" }, /* Too long still checked */ - /* 52*/ { BARCODE_GS1_128, -1, "[12345]123", "", ZINT_ERROR_INVALID_DATA, "Error 255: Invalid AI in input data (AI too long)" }, - /* 53*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[12345]123", "", ZINT_ERROR_INVALID_DATA, "Error 255: Invalid AI in input data (AI too long)" }, /* Too long still checked */ + /* 50*/ { BARCODE_GS1_128, -1, "[1234567890]123", "", ZINT_ERROR_INVALID_DATA, "Error 255: Invalid AI at position 1 in input (AI too long)" }, + /* 51*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[1234567890]123", "", ZINT_ERROR_INVALID_DATA, "Error 255: Invalid AI at position 1 in input (AI too long)" }, /* Too long still checked */ + /* 52*/ { BARCODE_GS1_128, -1, "[12345]123", "", ZINT_ERROR_INVALID_DATA, "Error 255: Invalid AI at position 1 in input (AI too long)" }, + /* 53*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[12345]123", "", ZINT_ERROR_INVALID_DATA, "Error 255: Invalid AI at position 1 in input (AI too long)" }, /* Too long still checked */ /* 54*/ { BARCODE_GS1_128, GS1PARENS_MODE, "(91)AB[", "", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (91) position 3: Invalid CSET 82 character '['" }, /* 55*/ { BARCODE_GS1_128, GS1PARENS_MODE | GS1NOCHECK_MODE, "(91)AB[", "", 0, "" }, /* 56*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]12", 0, "" }, /* 57*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231", "[20]12", 0, "" }, - /* 58*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901234", "[20]12", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1' in linear component" }, + /* 58*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901234", "[20]12", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1' (linear component)" }, /* 59*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901234", "[20]12", 0, "" }, - /* 60*/ { BARCODE_GS1_128_CC, -1, "[01]123456789012345", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (01) in linear component" }, + /* 60*/ { BARCODE_GS1_128_CC, -1, "[01]123456789012345", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (01) (linear component)" }, /* 61*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]123456789012345", "[20]12", 0, "" }, - /* 62*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]123", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (20) in 2D component" }, + /* 62*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]123", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (20) (2D component)" }, /* 63*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231", "[20]123", 0, "" }, - /* 64*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, + /* 64*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (20) position 2: Non-numeric character 'A' (2D component)" }, /* 65*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231", "[20]1A", 0, "" }, - /* 66*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, - /* 67*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, /* Nonprintable ASCII still checked */ - /* 68*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121\200", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in linear component" }, - /* 69*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121\200", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in linear component" }, - /* 70*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, - /* 71*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, /* Extended ASCII still checked */ - /* 72*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, - /* 73*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, /* Format still checked */ - /* 74*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data in 2D component" }, + /* 66*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 (2D component)" }, + /* 67*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 (2D component)" }, /* Nonprintable ASCII still checked */ + /* 68*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121\200", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 (linear component)" }, + /* 69*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121\200", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 (linear component)" }, + /* 70*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 (2D component)" }, + /* 71*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 (2D component)" }, /* Extended ASCII still checked */ + /* 72*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI (2D component)" }, + /* 73*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI (2D component)" }, /* Format still checked */ + /* 74*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input (2D component)" }, /* 75*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]", 0, "" }, /* Zero-length data not checked */ - /* 76*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[2]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, - /* 77*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[2]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 1 AI still checked */ - /* 78*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, + /* 76*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[2]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short) (2D component)" }, + /* 77*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[2]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short) (2D component)" }, /* Length 1 AI still checked */ + /* 78*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short) (2D component)" }, /* 79*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[]12", 0, "" }, /* Length 0 AI with data not checked */ - /* 80*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[1]2[]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, - /* 81*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[1]2[]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 1 AI still checked */ - /* 82*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, - /* 83*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */ - /* 84*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[][20]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, - /* 85*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[][20]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */ - /* 86*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]12[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, - /* 87*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]12[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */ - /* 88*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in 2D component input data" }, - /* 89*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in 2D component input data" }, /* Non-CSET 82 always checked for composite data */ + /* 80*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[1]2[]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 5 in input (AI too short) (2D component)" }, + /* 81*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[1]2[]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 5 in input (AI too short) (2D component)" }, /* Length 1 AI still checked */ + /* 82*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short) (2D component)" }, + /* 83*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short) (2D component)" }, /* Length 0 AI with no data still checked */ + /* 84*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[][20]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short) (2D component)" }, + /* 85*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[][20]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short) (2D component)" }, /* Length 0 AI with no data still checked */ + /* 86*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]12[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 7 in input (AI too short) (2D component)" }, + /* 87*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]12[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 7 in input (AI too short) (2D component)" }, /* Length 0 AI with no data still checked */ + /* 88*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in input (2D component)" }, + /* 89*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in input (2D component)" }, /* Non-CSET 82 always checked for composite data */ /* 90*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", "", 0, "" }, /* 91*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]12345678901231", "", 0, "" }, /* 92*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[10]123[11]1234", "", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11)" }, @@ -2421,46 +2423,46 @@ static void test_gs1nocheck_mode(const testCtx *const p_ctx) { /*101*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]1234567890121\200", "", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1" }, /* Extended ASCII still checked */ /*102*/ { BARCODE_DBAR_EXP, -1, "011234567890121", "", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI" }, /*103*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "011234567890121", "", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI" }, /* Format still checked */ - /*104*/ { BARCODE_DBAR_EXP, -1, "[10]", "", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data" }, + /*104*/ { BARCODE_DBAR_EXP, -1, "[10]", "", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input" }, /*105*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[10]", "", 0, "" }, /* Zero-length data not checked */ - /*106*/ { BARCODE_DBAR_EXP, -1, "[2]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, - /*107*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[2]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 1 AI still checked */ - /*108*/ { BARCODE_DBAR_EXP, -1, "[]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, + /*106*/ { BARCODE_DBAR_EXP, -1, "[2]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, + /*107*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[2]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, /* Length 1 AI still checked */ + /*108*/ { BARCODE_DBAR_EXP, -1, "[]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, /*109*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[]1", "", 0, "" }, /* Length 0 AI with data not checked */ - /*110*/ { BARCODE_DBAR_EXP, -1, "[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, - /*111*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 0 AI with no data still checked */ - /*112*/ { BARCODE_DBAR_EXP, -1, "[20]12[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, - /*113*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[20]12[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 0 AI with no data still checked */ + /*110*/ { BARCODE_DBAR_EXP, -1, "[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, + /*111*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short)" }, /* Length 0 AI with no data still checked */ + /*112*/ { BARCODE_DBAR_EXP, -1, "[20]12[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 7 in input (AI too short)" }, + /*113*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[20]12[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 7 in input (AI too short)" }, /* Length 0 AI with no data still checked */ /*114*/ { BARCODE_DBAR_EXP, -1, "[90]12]34", "", ZINT_ERROR_INVALID_DATA, "Error 386: Invalid character in General Field data" }, /*115*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[90]12]34", "", ZINT_ERROR_INVALID_DATA, "Error 386: Invalid character in General Field data" }, /* Non-CSET 82 always checked for DBAR_EXP */ /*116*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345", 0, "" }, /*117*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345", 0, "" }, - /*118*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]1234", "[21]ABC123[22]12345", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11) in linear component" }, + /*118*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]1234", "[21]ABC123[22]12345", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11) (linear component)" }, /*119*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]1234", "[21]ABC123[22]12345", 0, "" }, - /*120*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]123456", "[21]ABC123[22]12345", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (11) position 3: Invalid month '34' in linear component" }, + /*120*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]123456", "[21]ABC123[22]12345", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (11) position 3: Invalid month '34' (linear component)" }, /*121*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]123456", "[21]ABC123[22]12345", 0, "" }, - /*122*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]123456789", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (30) in 2D component" }, + /*122*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]123456789", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (30) (2D component)" }, /*123*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]123456789", 0, "" }, - /*124*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]1234567A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (30) position 8: Non-numeric character 'A' in 2D component" }, + /*124*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]1234567A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (30) position 8: Non-numeric character 'A' (2D component)" }, /*125*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]1234567A", 0, "" }, - /*126*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, - /*127*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, /* Nonprintable ASCII still checked */ - /*128*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, - /*129*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, /* Extended ASCII still checked */ - /*130*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, - /*131*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, /* Format still checked */ - /*132*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[10]", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data in 2D component" }, + /*126*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 (2D component)" }, + /*127*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 (2D component)" }, /* Nonprintable ASCII still checked */ + /*128*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 (2D component)" }, + /*129*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 (2D component)" }, /* Extended ASCII still checked */ + /*130*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI (2D component)" }, + /*131*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI (2D component)" }, /* Format still checked */ + /*132*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[10]", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input (2D component)" }, /*133*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[10]", 0, "" }, /* Zero-length data not checked */ - /*134*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[2]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, - /*135*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[2]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 1 AI still checked */ - /*136*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, + /*134*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[2]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short) (2D component)" }, + /*135*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[2]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short) (2D component)" }, /* Length 1 AI still checked */ + /*136*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short) (2D component)" }, /*137*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[]12", 0, "" }, /* Length 0 AI with data not checked */ - /*138*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, - /*139*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */ - /*140*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[20]12[][10]123", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, - /*141*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]12[][10]123", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */ - /*142*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in 2D component input data" }, - /*143*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in 2D component input data" }, /* Non-CSET 82 always checked for composite */ + /*138*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short) (2D component)" }, + /*139*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 1 in input (AI too short) (2D component)" }, /* Length 0 AI with no data still checked */ + /*140*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[20]12[][10]123", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 7 in input (AI too short) (2D component)" }, + /*141*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]12[][10]123", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI at position 7 in input (AI too short) (2D component)" }, /* Length 0 AI with no data still checked */ + /*142*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in input (2D component)" }, + /*143*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in input (2D component)" }, /* Non-CSET 82 always checked for composite */ /*144*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", "", 0, "" }, /*145*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]12345678901231", "", 0, "" }, /*146*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231[10]123[11]1234", "", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11)" }, @@ -2475,38 +2477,38 @@ static void test_gs1nocheck_mode(const testCtx *const p_ctx) { /*155*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]1234567890121\200", "", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1" }, /* Extended ASCII still checked */ /*156*/ { BARCODE_DBAR_EXPSTK, -1, "011234567890121", "", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI" }, /*157*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "011234567890121", "", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI" }, /* Format still checked */ - /*158*/ { BARCODE_DBAR_EXPSTK, -1, "[01]", "", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data" }, + /*158*/ { BARCODE_DBAR_EXPSTK, -1, "[01]", "", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input" }, /*159*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]", "", 0, "" }, /* Zero-length data not checked */ /*160*/ { BARCODE_DBAR_EXPSTK, -1, "[90]12]34", "", ZINT_ERROR_INVALID_DATA, "Error 386: Invalid character in General Field data" }, /*161*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[90]12]34", "", ZINT_ERROR_INVALID_DATA, "Error 386: Invalid character in General Field data" }, /* Non-CSET 82 always checked for DBAR_EXPSTK */ /*162*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345", 0, "" }, /*163*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345", 0, "" }, - /*164*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]1234", "[21]ABC123[22]12345", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11) in linear component" }, + /*164*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]1234", "[21]ABC123[22]12345", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11) (linear component)" }, /*165*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]1234", "[21]ABC123[22]12345", 0, "" }, - /*166*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]123456", "[21]ABC123[22]12345", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (11) position 3: Invalid month '34' in linear component" }, + /*166*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]123456", "[21]ABC123[22]12345", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (11) position 3: Invalid month '34' (linear component)" }, /*167*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]123456", "[21]ABC123[22]12345", 0, "" }, - /*168*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]123456789", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (30) in 2D component" }, + /*168*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]123456789", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (30) (2D component)" }, /*169*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]123456789", 0, "" }, - /*170*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]1234567A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (30) position 8: Non-numeric character 'A' in 2D component" }, + /*170*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]1234567A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (30) position 8: Non-numeric character 'A' (2D component)" }, /*171*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]1234567A", 0, "" }, - /*172*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, - /*173*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, /* Nonprintable ASCII still checked */ - /*174*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, - /*175*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, /* Extended ASCII still checked */ - /*176*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, - /*177*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, /* Format still checked */ - /*178*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[235]", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data in 2D component" }, + /*172*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 (2D component)" }, + /*173*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 (2D component)" }, /* Nonprintable ASCII still checked */ + /*174*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 (2D component)" }, + /*175*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 (2D component)" }, /* Extended ASCII still checked */ + /*176*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI (2D component)" }, + /*177*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI (2D component)" }, /* Format still checked */ + /*178*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[235]", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input (2D component)" }, /*179*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[235]", 0, "" }, /* Zero-length data not checked */ - /*180*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in 2D component input data" }, - /*181*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in 2D component input data" }, /* Non-CSET 82 always checked for composite */ + /*180*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in input (2D component)" }, + /*181*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in input (2D component)" }, /* Non-CSET 82 always checked for composite */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char *text; - testStart("test_gs1nocheck_mode"); + testStartSymbol("test_gs1nocheck_mode", &symbol); for (i = 0; i < data_size; i++) { diff --git a/backend/tests/test_hanxin.c b/backend/tests/test_hanxin.c index 3d5aad39..4cfa5b4b 100644 --- a/backend/tests/test_hanxin.c +++ b/backend/tests/test_hanxin.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2023 Robin Stuart + Copyright (C) 2019-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -43,33 +43,34 @@ static void test_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { -1, -1, -1, "1", 7827, 0, 189, 189 }, - /* 1*/ { -1, -1, -1, "1", 7828, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { -1, -1, -1, "A", 4350, 0, 189, 189 }, - /* 3*/ { -1, -1, -1, "A", 4351, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 4*/ { -1, -1, -1, "\200", 3261, 0, 189, 189 }, - /* 5*/ { -1, -1, -1, "\200", 3262, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 6*/ { -1, -1, ZINT_FULL_MULTIBYTE, "\241", 4348, 0, 189, 189 }, - /* 7*/ { -1, -1, ZINT_FULL_MULTIBYTE, "\241", 4350, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 8*/ { -1, 1, -1, "1", 45, 0, 23, 23 }, - /* 9*/ { -1, 1, -1, "1", 46, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 10*/ { -1, 1, -1, "A", 26, 0, 23, 23 }, - /* 11*/ { -1, 1, -1, "A", 27, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 12*/ { -1, 1, -1, "\200", 18, 0, 23, 23 }, - /* 13*/ { -1, 1, -1, "\200", 19, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 14*/ { -1, 1, ZINT_FULL_MULTIBYTE, "\241", 24, 0, 23, 23 }, - /* 15*/ { -1, 1, ZINT_FULL_MULTIBYTE, "\241", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 16*/ { 2, 1, -1, "A", 21, 0, 23, 23 }, - /* 17*/ { 2, 1, -1, "A", 22, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 18*/ { 3, 1, -1, "A", 15, 0, 23, 23 }, - /* 19*/ { 3, 1, -1, "A", 16, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 20*/ { 4, 1, -1, "A", 10, 0, 23, 23 }, - /* 21*/ { 4, 1, -1, "A", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, + static const struct item data[] = { + /* 0*/ { -1, -1, -1, "1", 7827, 0, 189, 189, "" }, + /* 1*/ { -1, -1, -1, "1", 7828, ZINT_ERROR_TOO_LONG, -1, -1, "Error 541: Input too long, requires 3265 codewords (maximum 3264)" }, + /* 2*/ { -1, -1, -1, "A", 4350, 0, 189, 189, "" }, + /* 3*/ { -1, -1, -1, "A", 4351, ZINT_ERROR_TOO_LONG, -1, -1, "Error 541: Input too long, requires 3265 codewords (maximum 3264)" }, + /* 4*/ { -1, -1, -1, "\200", 3261, 0, 189, 189, "" }, + /* 5*/ { -1, -1, -1, "\200", 3262, ZINT_ERROR_TOO_LONG, -1, -1, "Error 541: Input too long, requires 3265 codewords (maximum 3264)" }, + /* 6*/ { -1, -1, ZINT_FULL_MULTIBYTE, "\241", 4348, 0, 189, 189, "" }, + /* 7*/ { -1, -1, ZINT_FULL_MULTIBYTE, "\241", 4350, ZINT_ERROR_TOO_LONG, -1, -1, "Error 541: Input too long, requires 3265 codewords (maximum 3264)" }, + /* 8*/ { -1, 1, -1, "1", 45, 0, 23, 23, "" }, + /* 9*/ { -1, 1, -1, "1", 46, ZINT_ERROR_TOO_LONG, -1, -1, "Error 542: Input too long for Version 1, requires 22 codewords (maximum 21)" }, + /* 10*/ { -1, 1, -1, "A", 26, 0, 23, 23, "" }, + /* 11*/ { -1, 1, -1, "A", 27, ZINT_ERROR_TOO_LONG, -1, -1, "Error 542: Input too long for Version 1, requires 22 codewords (maximum 21)" }, + /* 12*/ { -1, 1, -1, "\200", 18, 0, 23, 23, "" }, + /* 13*/ { -1, 1, -1, "\200", 19, ZINT_ERROR_TOO_LONG, -1, -1, "Error 542: Input too long for Version 1, requires 22 codewords (maximum 21)" }, + /* 14*/ { -1, 1, ZINT_FULL_MULTIBYTE, "\241", 24, 0, 23, 23, "" }, + /* 15*/ { -1, 1, ZINT_FULL_MULTIBYTE, "\241", 26, ZINT_ERROR_TOO_LONG, -1, -1, "Error 542: Input too long for Version 1, requires 22 codewords (maximum 21)" }, + /* 16*/ { 2, 1, -1, "A", 21, 0, 23, 23, "" }, + /* 17*/ { 2, 1, -1, "A", 22, ZINT_ERROR_TOO_LONG, -1, -1, "Error 542: Input too long for Version 1, ECC 2, requires 18 codewords (maximum 17)" }, + /* 18*/ { 3, 1, -1, "A", 15, 0, 23, 23, "" }, + /* 19*/ { 3, 1, -1, "A", 16, ZINT_ERROR_TOO_LONG, -1, -1, "Error 542: Input too long for Version 1, ECC 3, requires 14 codewords (maximum 13)" }, + /* 20*/ { 4, 1, -1, "A", 10, 0, 23, 23, "" }, + /* 21*/ { 4, 1, -1, "A", 11, ZINT_ERROR_TOO_LONG, -1, -1, "Error 542: Input too long for Version 1, ECC 4, requires 10 codewords (maximum 9)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -97,6 +98,7 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); 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 strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -133,7 +135,7 @@ static void test_options(const testCtx *const p_ctx) { int expected_size; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { -1, -1, "12345", 0, 0, 23 }, /* Default version 1, ECC auto-set to 4 */ /* 1*/ { 1, -1, "12345", 0, 0, 23 }, /* 2*/ { -1, 2, "12345", 0, 0, 25 }, @@ -147,7 +149,7 @@ static void test_options(const testCtx *const p_ctx) { /* 10*/ { 5, -1, "12345678901234567", 0, 0, 23 }, /* ECC > max ECC 4 so ignored and auto-settings version 1, ECC 3 used */ /* 11*/ { -1, -1, "1234567890123456789012345678901234567890123456", 0, 0, 25 }, /* Version auto-set to 2, ECC auto-set to 2 */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -223,7 +225,7 @@ static void test_input(const testCtx *const p_ctx) { 丂 U+4E02 GB 18030 2-byte Region 0x8140, UTF-8 E4B882 � (REPLACEMENT CHARACTER) U+FFFD GB 18030 4-byte Region 0x81308130, UTF-8 EFBFBD (\357\277\275) */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, 0, -1, "é", -1, 0, 0, "30 00 F4 80 00 00 00 00 00", 1, "B1 (ISO 8859-1)" }, /* 1*/ { UNICODE_MODE, 3, -1, "é", -1, 0, 3, "80 33 00 0F 48 00 00 00 00", 1, "ECI-3 B1 (ISO 8859-1)" }, /* 2*/ { UNICODE_MODE, 29, -1, "é", -1, 0, 29, "81 D4 FC FF FF 00 00 00 00", 1, "ECI-29 H(1)1 (GB 2312)" }, @@ -310,10 +312,10 @@ static void test_input(const testCtx *const p_ctx) { /* 83*/ { DATA_MODE, 900, -1, "\303\251", -1, 0, 900, "88 38 43 00 16 1D 48 00 00", 1, "ECI-900 B2 (no conversion)" }, /* 84*/ { UNICODE_MODE, 16384, -1, "é", -1, 0, 16384, "8C 04 00 03 00 16 1D 48 00", 0, "ECI-16384 B2 (no conversion); ZXing-C++ test can't handle UNICODE_MODE binary" }, /* 85*/ { DATA_MODE, 16384, -1, "\303\251", -1, 0, 16384, "8C 04 00 03 00 16 1D 48 00", 1, "ECI-16384 B2 (no conversion)" }, - /* 86*/ { UNICODE_MODE, 3, -1, "β", -1, ZINT_ERROR_INVALID_DATA, 3, "Error 545: Invalid character in input data for ECI 3", 1, "" }, + /* 86*/ { UNICODE_MODE, 3, -1, "β", -1, ZINT_ERROR_INVALID_DATA, 3, "Error 545: Invalid character in input for ECI '3'", 1, "" }, /* 87*/ { GS1_MODE, -1, -1, "[10]01", -1, ZINT_ERROR_INVALID_OPTION, 0, "Error 220: Selected symbology does not support GS1 mode", 1, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -394,7 +396,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, -1, -1, -1, -1, "1234", -1, 0, 23, 23, "Mode nnnn, mask 10", "11111110101011001111111" "10000000000000100000001" @@ -3162,7 +3164,7 @@ static void test_encode(const testCtx *const p_ctx) { "11101010101010001111111" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -3241,7 +3243,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, -1, -1, -1, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 23, 23, "Standard example", "11111110101100101111111" "10000000010110000000001" @@ -3446,7 +3448,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { "11101010001010001111111" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, j, seg_count, ret; struct zint_symbol *symbol = NULL; @@ -3547,10 +3549,10 @@ static void test_fuzz(const testCtx *const p_ctx) { char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_HANXIN, DATA_MODE, 35, -1, -1, ZINT_FULL_MULTIBYTE, "\215\215\215\215\215\350\215\215999\215\21500000\215\215\215\215\215\215\377O\000\000\036\000\000\000\000\357\376\026\377\377\377\377\241\241\232\232\232\232\232\232\235\032@\374:JGB \000\000@d\000\000\000\241\241\000\000\027\002\241\241\000\000\014\000\000\000\000\357\327\004\000\000\000\000\000\000\000\375\000\000\000\000\000\000\000\000\000\000\000\000\0000253]9R4R44,44,4404[255\350999\215\21599999\215\215\215\2150000\215\215\215\215\215\215\215\215\215]9444442<4444,4044%44vA\000\000\002\000'\000\000\215\377@\215\215\350\215\215\215\215\215\215\215\307\306\306n\215\215\000\000\001\000\000\203\000\000\000\000\000\000@\215\215\215[\2154315@]R0", 229, 0, 1, "" }, /* #300 (#16, adapted to HANXIN), Andre Maute */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -3594,7 +3596,7 @@ static void test_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_HANXIN, UNICODE_MODE, -1, -1, "汉信码(Chinese-Sensible Code)是一种能够有效表示汉字、图像等信息的二维条码。汉信码(Chinese-Sensible Code)是一种能够有效表示汉字、图像等信息的二维条码。", ZINT_WARN_NONCOMPLIANT, 43, 43, "98 chars, Region One and Text" }, @@ -3628,7 +3630,7 @@ static void test_perf(const testCtx *const p_ctx) { "汉信码(Chinese-Sensible Code)是一种能够有效表示汉字、图像等信息的二维条码。汉信码(Chinese-Sensible Code)是一种能够有效表示汉字、图像等信息的二维条码。", ZINT_WARN_NONCOMPLIANT, 147, 147, "1470 chars, Region One and Text" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; clock_t start, total_encode = 0, total_buffer = 0, diff_encode, diff_buffer; diff --git a/backend/tests/test_imail.c b/backend/tests/test_imail.c index bde7e127..f6d4124c 100644 --- a/backend/tests/test_imail.c +++ b/backend/tests/test_imail.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2023 Robin Stuart + Copyright (C) 2019-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -68,7 +68,9 @@ static void test_csv(const testCtx *const p_ctx) { int test_performance = debug & ZINT_DEBUG_TEST_PERFORMANCE; /* -d 256 */ int perf_iterations = test_performance ? TEST_CSV_PERF_ITERATIONS : 1; - testStart("test_csv"); + struct zint_symbol *symbol = NULL; + + testStartSymbol("test_csv", &symbol); if (test_performance) { printf("test_csv perf iterations: %d\n", perf_iterations); @@ -83,7 +85,6 @@ static void test_csv(const testCtx *const p_ctx) { while (fgets(buffer, sizeof(buffer), fd) != NULL) { const char *b; - struct zint_symbol *symbol; lc++; @@ -170,14 +171,14 @@ static void test_hrt(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "53379777234994544928-51135759461", "" }, /* None */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_hrt"); + testStartSymbol("test_hrt", &symbol); for (i = 0; i < data_size; i++) { @@ -207,33 +208,34 @@ static void test_input(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { "53379777234994544928-51135759461", 0, 3, 129 }, - /* 1*/ { "123456789012345678901234567890123", ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { "A", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 3*/ { "12345678901234567890", 0, 3, 129 }, /* Tracker only, no ZIP */ - /* 4*/ { "15345678901234567890", ZINT_ERROR_INVALID_DATA, -1, -1 }, /* Tracker 2nd char > 4 */ - /* 5*/ { "1234567890123456789", ZINT_ERROR_INVALID_DATA, -1, -1 }, /* Tracker 20 chars */ - /* 6*/ { "12345678901234567890-1234", ZINT_ERROR_INVALID_DATA, -1, -1 }, /* ZIP wrong len */ - /* 7*/ { "12345678901234567890-12345", 0, 3, 129 }, - /* 8*/ { "12345678901234567890-123456", ZINT_ERROR_INVALID_DATA, -1, -1 }, /* ZIP wrong len */ - /* 9*/ { "12345678901234567890-12345678", ZINT_ERROR_INVALID_DATA, -1, -1 }, /* ZIP wrong len */ - /* 10*/ { "12345678901234567890-123456789", 0, 3, 129 }, - /* 11*/ { "12345678901234567890-1234567890", ZINT_ERROR_INVALID_DATA, -1, -1 }, /* ZIP wrong len */ - /* 12*/ { "12345678901234567890-12345678901", 0, 3, 129 }, + static const struct item data[] = { + /* 0*/ { "53379777234994544928-51135759461", 0, 3, 129, "" }, + /* 1*/ { "123456789012345678901234567890123", ZINT_ERROR_TOO_LONG, -1, -1, "Error 450: Input length 33 too long (maximum 32)" }, + /* 2*/ { "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 451: Invalid character at position 1 in input (digits and \"-\" only)" }, + /* 3*/ { "12345678901234567890", 0, 3, 129, "" }, /* Tracker only, no ZIP */ + /* 4*/ { "15345678901234567890", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 454: Barcode Identifier (second character) out of range (0 to 4)" }, /* Tracker 2nd char > 4 */ + /* 5*/ { "1234567890123456789", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 452: Invalid length for tracking code (20 characters required)" }, /* Tracker 20 chars */ + /* 6*/ { "12345678901234567890-1234", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 453: Invalid length for ZIP code (5, 9 or 11 characters required)" }, /* ZIP wrong len */ + /* 7*/ { "12345678901234567890-12345", 0, 3, 129, "" }, + /* 8*/ { "12345678901234567890-123456", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 453: Invalid length for ZIP code (5, 9 or 11 characters required)" }, /* ZIP wrong len */ + /* 9*/ { "12345678901234567890-12345678", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 453: Invalid length for ZIP code (5, 9 or 11 characters required)" }, /* ZIP wrong len */ + /* 10*/ { "12345678901234567890-123456789", 0, 3, 129, "" }, + /* 11*/ { "12345678901234567890-1234567890", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 453: Invalid length for ZIP code (5, 9 or 11 characters required)" }, /* ZIP wrong len */ + /* 12*/ { "12345678901234567890-12345678901", 0, 3, 129, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; 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"); + testStartSymbol("test_input", &symbol); for (i = 0; i < data_size; i++) { @@ -246,6 +248,7 @@ static void test_input(const testCtx *const p_ctx) { 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_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -281,16 +284,16 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { "01234567094987654321-01234567891", 0, 3, 129, "USPS-B-3200 Rev. H (2015) Figure 5", "101000001010001000001000001010001010001000000000101010000000000000001010100010000000001010100000000000100010101010001000001010001" "101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101" "000010001010101000100010000000100000001010001010000000101000100000100010001000101010001010101010000000001010000000101000100000100" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[1024]; char bwipp_buf[8192]; @@ -298,7 +301,7 @@ static void test_encode(const testCtx *const p_ctx) { int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ - testStart("test_encode"); + testStartSymbol("test_encode", &symbol); for (i = 0; i < data_size; i++) { diff --git a/backend/tests/test_large.c b/backend/tests/test_large.c index 3c05ee71..5deb77d7 100644 --- a/backend/tests/test_large.c +++ b/backend/tests/test_large.c @@ -42,8 +42,10 @@ # endif # if defined(__clang__) # pragma GCC diagnostic ignored "-Wformat-non-iso" -# elif defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) -# pragma GCC diagnostic ignored "-Wformat" /* Doesn't seem to be way to only avoid non-ISO warnings */ +# elif defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +# pragma GCC diagnostic ignored "-Wno-pedantic-ms-format" +# elif defined(__GNUC__) && __GNUC__ >= 2 +# pragma GCC diagnostic ignored "-Wformat" # endif #elif (defined(__WORDSIZE) && __WORDSIZE == 32) || (defined(ULONG_MAX) && ULONG_MAX <= 0xFFFFFFFF) \ || defined(__APPLE__) || defined(__OpenBSD__) diff --git a/backend/tests/test_library.c b/backend/tests/test_library.c index f6c7a4ee..7573b060 100644 --- a/backend/tests/test_library.c +++ b/backend/tests/test_library.c @@ -60,11 +60,11 @@ static void test_checks(const testCtx *const p_ctx) { int expected_symbology; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, -1, "1234", -1, -1, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", -1 }, /* 1*/ { BARCODE_CODE128, -1, "1234", -1, -1, 0, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 }, /* 2*/ { BARCODE_QRCODE, -1, "1234", -1, -1, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 }, - /* 3*/ { BARCODE_QRCODE, -1, "1234", -1, -1, 999999 + 1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: Invalid ECI code 1000000", -1 }, + /* 3*/ { BARCODE_QRCODE, -1, "1234", -1, -1, 999999 + 1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: ECI code '1000000' out of range (0 to 999999, excluding 1, 2, 14 and 19)", -1 }, /* 4*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, 0.009, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 227: Scale out of range (0.01 to 200)", -1 }, /* 5*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, 200.01, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 227: Scale out of range (0.01 to 200)", -1 }, /* 6*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, -1, 20.1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Dot size out of range (0.01 to 20)", -1 }, @@ -106,7 +106,7 @@ static void test_checks(const testCtx *const p_ctx) { /* 42*/ { 15, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX }, /* 43*/ { 17, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_UPCA }, /* 44*/ { 17, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA }, - /* 45*/ { 19, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_TOO_LONG, "Error 362: Input too short (3 character minimum)", BARCODE_CODABAR }, + /* 45*/ { 19, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_TOO_LONG, "Error 362: Input length 1 too short (minimum 3)", BARCODE_CODABAR }, /* 46*/ { 19, -1, "A1B", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 207: Codabar 18 not supported", BARCODE_CODABAR }, /* 47*/ { 19, -1, "A1B", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 207: Codabar 18 not supported", -1 }, /* 48*/ { 26, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_UPCA }, @@ -119,7 +119,7 @@ static void test_checks(const testCtx *const p_ctx) { /* 55*/ { 36, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA }, /* 56*/ { 39, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_UPCE }, /* 57*/ { 39, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCE }, - /* 58*/ { 41, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 479: Input length is not standard (5, 9 or 11 characters)", BARCODE_POSTNET }, + /* 58*/ { 41, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 479: Input length 1 is not standard (5, 9 or 11)", BARCODE_POSTNET }, /* 59*/ { 41, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_POSTNET }, /* 60*/ { 41, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET }, /* 61*/ { 42, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_POSTNET }, @@ -195,7 +195,7 @@ static void test_checks(const testCtx *const p_ctx) { /*131*/ { 147, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 }, /*132*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 }, /*133*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 }, - /*134*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input data", -1 }, + /*134*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 }, /*135*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /*136*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /*137*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 }, @@ -208,12 +208,12 @@ static void test_checks(const testCtx *const p_ctx) { /*144*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 }, /*145*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, /*146*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, - /*147*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Invalid error correction level - using default instead", -1 }, - /*148*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, + /*147*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Error correction level '6' out of range (1 to 4), ignoring", -1 }, + /*148*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Error correction level '6' out of range (1 to 4)", -1 }, /*149*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, /* ECI warning trumps all other warnings */ - /*150*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, /* But not errors */ + /*150*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Error correction level '6' out of range (1 to 4)", -1 }, /* But not errors */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -289,24 +289,24 @@ static void test_checks_segs(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 0, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 205: No input data" }, - /* 1*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 257, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 771: Too many input segments (max 256)" }, + /* 1*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 257, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 771: Too many input segments (maximum 256)" }, /* 2*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 772: Input segment 0 source NULL" }, /* 3*/ { BARCODE_CODE128, -1, { { TU(""), 0, 0 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 778: No input data" }, /* 4*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 0 }, { NULL, 0, 0 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 772: Input segment 1 source NULL" }, /* 5*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 0 }, { TU(""), 0, 0 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 773: Input segment 1 empty" }, - /* 6*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 0 } }, 2, -1, 4, -1, ZINT_ERROR_INVALID_OPTION, "Error 774: Symbol ECI 4 must match segment zero ECI 3" }, + /* 6*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 0 } }, 2, -1, 4, -1, ZINT_ERROR_INVALID_OPTION, "Error 774: Symbol ECI '4' must match segment zero ECI '3'" }, /* 7*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 4 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 775: Symbology does not support multiple segments" }, /* 8*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 3 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching" }, - /* 9*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 1 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: Invalid ECI code 1" }, + /* 9*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 1 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: ECI code '1' out of range (0 to 999999, excluding 1, 2, 14 and 19)" }, /* 10*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 4 } }, 2, GS1_MODE, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 776: GS1 mode not supported for multiple segments" }, - /* 11*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("\200"), 0, 4 } }, 2, UNICODE_MODE, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input data" }, + /* 11*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("\200"), 0, 4 } }, 2, UNICODE_MODE, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input" }, /* 12*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 4 } }, 2, -1, -1, -1, 0, "" }, /* 13*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 0 }, { TU("B"), 0, 4 } }, 2, -1, 3, -1, 0, "" }, - /* 14*/ { BARCODE_AZTEC, -1, { { TU("A"), ZINT_MAX_DATA_LEN, 3 }, { TU("B"), 1, 4 } }, 2, -1, -1, -1, ZINT_ERROR_TOO_LONG, "Error 243: Input data too long" }, + /* 14*/ { BARCODE_AZTEC, -1, { { TU("A"), ZINT_MAX_DATA_LEN, 3 }, { TU("B"), 1, 4 } }, 2, -1, -1, -1, ZINT_ERROR_TOO_LONG, "Error 243: Input too long" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, ret; struct zint_symbol *symbol = NULL; @@ -350,16 +350,16 @@ static void test_input_data(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, -1, "1234", -1, "", 0, "" }, /* 1*/ { BARCODE_GS1_128, -1, "[01]12345678901231", -1, "", 0, "" }, /* 2*/ { BARCODE_GS1_128, -1, "", -1, "", ZINT_ERROR_INVALID_DATA, "Error 778: No input data" }, /* 3*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", -1, "[10]121212", 0, "" }, - /* 4*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", -1, "", ZINT_ERROR_INVALID_DATA, "Error 779: No composite data in 2D component" }, + /* 4*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", -1, "", ZINT_ERROR_INVALID_DATA, "Error 779: No composite data (2D component)" }, /* 5*/ { BARCODE_GS1_128_CC, -1, "", -1, "[10]121212", ZINT_ERROR_INVALID_OPTION, "Error 445: No primary (linear) message" }, - /* 6*/ { BARCODE_DATAMATRIX, -1, "", -1, "", ZINT_ERROR_INVALID_DATA, "Error 778: No input data (segment 0 empty)" }, + /* 6*/ { BARCODE_DATAMATRIX, -1, "", -1, "", ZINT_ERROR_INVALID_DATA, "Error 228: No input data (segment 0 empty)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -391,6 +391,36 @@ static void test_input_data(const testCtx *const p_ctx) { ZBarcode_Delete(symbol); } + if (p_ctx->index == -1 && p_ctx->exclude[0] == -1) { + char data_buf[ZINT_MAX_DATA_LEN + 10]; + int expected_ret = ZINT_ERROR_TOO_LONG; + char *expected_errtxt[] = { "Error 797: Input too long", "Error 340: Input length 17399 too long (maximum 256)" }; + + symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + /* Caught by `ZBarcode_Encode_Segs()` de-escape loop */ + symbol->input_mode = ESCAPE_MODE; + testUtilStrCpyRepeat(data_buf, "A", ZINT_MAX_DATA_LEN); + data_buf[ZINT_MAX_DATA_LEN] = '\\'; + data_buf[ZINT_MAX_DATA_LEN + 1] = 'n'; + + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, ZINT_MAX_DATA_LEN + 2); + assert_equal(ret, expected_ret, "ZBarcode_Encode(%d) ret %d != %d (%s)\n", symbol->symbology, ret, expected_ret, symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, expected_errtxt[0]), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, expected_errtxt[0]); + + /* Passes de-escape loop, caught by `code128()` */ + symbol->errtxt[0] = '\0'; + data_buf[ZINT_MAX_DATA_LEN - 2] = '\\'; + data_buf[ZINT_MAX_DATA_LEN - 1] = 'n'; + + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, ZINT_MAX_DATA_LEN); + assert_equal(ret, expected_ret, "ZBarcode_Encode(%d) ret %d != %d (%s)\n", symbol->symbology, ret, expected_ret, symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, expected_errtxt[1]), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, expected_errtxt[1]); + + ZBarcode_Delete(symbol); + } + testFinish(); } @@ -485,16 +515,17 @@ static int test_prev_map_invalid_symbology(int *p_symbology) { static void test_symbologies(const testCtx *const p_ctx) { int i, ret; - struct zint_symbol symbol = {0}; + struct zint_symbol s_symbol = {0}; + struct zint_symbol *symbol = &s_symbol; testStart("test_symbologies"); for (i = -1; i < 148; i++) { if (testContinue(p_ctx, i)) continue; - symbol.symbology = i; - ret = ZBarcode_Encode(&symbol, TU(""), 0); - assert_notequal(ret, ZINT_ERROR_ENCODING_PROBLEM, "i:%d Encoding problem (%s)\n", i, symbol.errtxt); + symbol->symbology = i; + ret = ZBarcode_Encode(symbol, TU(""), 0); + assert_notequal(ret, ZINT_ERROR_ENCODING_PROBLEM, "i:%d Encoding problem (%s)\n", i, symbol->errtxt); if (!ZBarcode_ValidID(i)) { int prev_symbology = i; @@ -502,8 +533,8 @@ static void test_symbologies(const testCtx *const p_ctx) { if (ret != ZINT_ERROR_INVALID_DATA) { assert_equal(prev_ret, ret, "i:%d prev_ret (%d) != ret (%d)\n", i, prev_ret, ret); } - assert_equal(prev_symbology, symbol.symbology, "i:%d prev_symbology (%d) != symbol.symbology (%d)\n", - i, prev_symbology, symbol.symbology); + assert_equal(prev_symbology, symbol->symbology, "i:%d prev_symbology (%d) != symbol->symbology (%d)\n", + i, prev_symbology, symbol->symbology); } else { /* No input data */ assert_equal(ret, ZINT_ERROR_INVALID_DATA, "i:%d ret (%d) != ZINT_ERROR_INVALID_DATA\n", i, ret); @@ -525,7 +556,7 @@ static void test_input_mode(const testCtx *const p_ctx) { char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "1234", DATA_MODE, 0, DATA_MODE, "" }, /* 1*/ { "1234", DATA_MODE | ESCAPE_MODE, 0, DATA_MODE | ESCAPE_MODE, "" }, /* 2*/ { "1234", UNICODE_MODE, 0, UNICODE_MODE, "" }, @@ -538,7 +569,7 @@ static void test_input_mode(const testCtx *const p_ctx) { /* 9*/ { "1234", UNICODE_MODE | 0x10, 0, UNICODE_MODE | 0x10, "" }, /* 10*/ { "[01]12345678901231", GS1_MODE | 0x20, 0, GS1_MODE | 0x20, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -579,7 +610,7 @@ static void test_escape_char_process(const testCtx *const p_ctx) { int compare_previous; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 26, "01 05 08 09 0A 0B 0C 0D 0E 1C 1E 1F EB 02 5D 81 21 0D 92 2E 3D FD B6 9A 37 2A CD 61 FB 95", 0, "" }, /* 1*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 101, "(45) 67 62 43 40 44 47 48 29 6A 67 62 0B 49 4A 4B 4C 18 6A 67 62 0C 4D 5B 5D 5E 62 6A 67", 0, "" }, /* 2*/ { BARCODE_CODE16K, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 70, "(20) 14 64 68 71 72 73 74 75 76 77 91 93 94 101 65 60 103 103 45 61", 0, "" }, @@ -591,21 +622,21 @@ static void test_escape_char_process(const testCtx *const p_ctx) { /* 8*/ { BARCODE_ULTRA, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 20, "(15) 257 0 4 7 8 9 10 11 12 13 27 29 30 129 92", 0, "" }, /* 9*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\d129\\o201\\\\", "", 0, 18, "(32) 01 05 08 09 0A 0B 0C 0D 0E 1C 1E 1F E7 32 45 DB 70 5D E3 16 7B 2B 44 60 E1 55 F7 08", 0, "" }, /* 10*/ { BARCODE_HANXIN, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\d129\\o201\\\\", "", 0, 23, "2F 80 10 72 09 28 B3 0D 6F F3 00 30 E8 F4 0C 0C 0A E0 00 00 00", 0, "" }, - /* 11*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\c", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\c' in input data", 0, "" }, - /* 12*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\", "", ZINT_ERROR_INVALID_DATA, 0, "Error 236: Incomplete escape character in input data", 0, "" }, - /* 13*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input data", 0, "" }, - /* 14*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input data", 0, "" }, - /* 15*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1g", "", ZINT_ERROR_INVALID_DATA, 0, "Error 233: Invalid character in escape sequence '\\x1g' in input data (hexadecimal only)", 0, "" }, - /* 16*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input data", 0, "" }, - /* 17*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input data", 0, "" }, - /* 18*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input data", 0, "" }, - /* 19*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12a", "", ZINT_ERROR_INVALID_DATA, 0, "Error 233: Invalid character in escape sequence '\\d12a' in input data (decimal only)", 0, "" }, - /* 20*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d256", "", ZINT_ERROR_INVALID_DATA, 0, "Error 237: Value of escape sequence '\\d256' in input data out of range (000-255)", 0, "" }, - /* 21*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input data", 0, "" }, - /* 22*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input data", 0, "" }, - /* 23*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o12", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input data", 0, "" }, - /* 24*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o128", "", ZINT_ERROR_INVALID_DATA, 0, "Error 233: Invalid character in escape sequence '\\o128' in input data (octal only)", 0, "" }, - /* 25*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o400", "", ZINT_ERROR_INVALID_DATA, 0, "Error 237: Value of escape sequence '\\o400' in input data out of range (000-377)", 0, "" }, + /* 11*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\c", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\c' in input", 0, "" }, + /* 12*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\", "", ZINT_ERROR_INVALID_DATA, 0, "Error 236: Incomplete escape character in input", 0, "" }, + /* 13*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input", 0, "" }, + /* 14*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input", 0, "" }, + /* 15*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1g", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\x1g' in input (hexadecimal only)", 0, "" }, + /* 16*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" }, + /* 17*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" }, + /* 18*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" }, + /* 19*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12a", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\d12a' in input (decimal only)", 0, "" }, + /* 20*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d256", "", ZINT_ERROR_INVALID_DATA, 0, "Error 237: Value of escape sequence '\\d256' in input out of range (000 to 255)", 0, "" }, + /* 21*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" }, + /* 22*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" }, + /* 23*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o12", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" }, + /* 24*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o128", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\o128' in input (octal only)", 0, "" }, + /* 25*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o400", "", ZINT_ERROR_INVALID_DATA, 0, "Error 237: Value of escape sequence '\\o400' in input out of range (000 to 377)", 0, "" }, /* 26*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xA01\\xFF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 0, "" }, /* 27*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1601\\d255", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" }, /* 28*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o2401\\o377", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" }, @@ -621,15 +652,15 @@ static void test_escape_char_process(const testCtx *const p_ctx) { /* 38*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\o303\\o277", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" }, /* 39*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00fF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" }, /* 40*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000fF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" }, - /* 41*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" }, - /* 42*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uF", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" }, - /* 43*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u0F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" }, - /* 44*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uFG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" }, - /* 45*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" }, - /* 46*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00FG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 211: Invalid character for '\\u' escape sequence in input data (hexadecimal only)", 0, "" }, - /* 47*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ufffe", "", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Value of escape sequence '\\ufffe' in input data out of range", 0, "Reversed BOM" }, - /* 48*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ud800", "", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Value of escape sequence '\\ud800' in input data out of range", 0, "Surrogate" }, - /* 49*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\udfff", "", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Value of escape sequence '\\udfff' in input data out of range", 0, "Surrogate" }, + /* 41*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" }, + /* 42*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uF", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" }, + /* 43*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u0F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" }, + /* 44*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uFG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" }, + /* 45*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" }, + /* 46*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00FG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 211: Invalid character for '\\u' escape sequence in input (hexadecimal only)", 0, "" }, + /* 47*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ufffe", "", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Value of escape sequence '\\ufffe' in input out of range", 0, "Reversed BOM" }, + /* 48*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ud800", "", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Value of escape sequence '\\ud800' in input out of range", 0, "Surrogate" }, + /* 49*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\udfff", "", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Value of escape sequence '\\udfff' in input out of range", 0, "Surrogate" }, /* 50*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uffff", "", 0, 12, "E7 2C B0 16 AB A1 1F 85 EB 50 A1 4C", 0, "" }, /* 51*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\xE2\\x82\\xAC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 0, "Zint manual 4.10 Ex1" }, /* 52*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\u20AC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" }, @@ -640,18 +671,18 @@ static void test_escape_char_process(const testCtx *const p_ctx) { /* 57*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\U005E38", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" }, /* 58*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u007F", "", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" }, /* 59*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U00007F", "", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" }, - /* 60*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" }, - /* 61*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UF", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" }, - /* 62*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" }, - /* 63*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UFG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" }, - /* 64*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" }, - /* 65*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00FG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" }, - /* 66*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ufffe", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "Reversed BOM" }, - /* 67*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ud800", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "Surrogate" }, - /* 68*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Udfff", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "Surrogate" }, - /* 69*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U000F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" }, - /* 70*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" }, - /* 71*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U110000", "", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Value of escape sequence '\\U110000' in input data out of range", 0, "" }, + /* 60*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, + /* 61*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UF", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, + /* 62*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, + /* 63*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UFG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, + /* 64*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, + /* 65*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00FG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, + /* 66*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ufffe", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Reversed BOM" }, + /* 67*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ud800", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Surrogate" }, + /* 68*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Udfff", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Surrogate" }, + /* 69*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U000F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, + /* 70*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" }, + /* 71*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U110000", "", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Value of escape sequence '\\U110000' in input out of range", 0, "" }, /* 72*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 25, "\\U10FFFF", "", 0, 14, "F1 1A E7 57 C7 81 F7 AC 09 06 28 51 F3 00 E1 8C 2A 1C", 0, "" }, /* 73*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 26, "\\U10FFFF", "", 0, 14, "F1 1B E7 57 E0 11 D7 6C 4F 45 E2 B3 FF F1 72 AB 54 9F", 0, "" }, /* 74*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 32, "\\U10FFFF", "", 0, 14, "F1 21 EB 64 33 EB 1B 36 1D F7 B1 6D 8C A6 34 64 19 3A", 0, "" }, @@ -664,9 +695,9 @@ static void test_escape_char_process(const testCtx *const p_ctx) { /* 81*/ { BARCODE_CODE128, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^A1", "", 0, 46, "(4) 103 17 17 106", 0, "" }, /* 82*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, "\\^", "", 0, 57, "(5) 104 60 62 82 106", 0, "Partial special escape '\\^' at end allowed" }, /* 83*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, "\\^D1", "", 0, 79, "(7) 104 60 62 36 17 52 106", 0, "Unknown special escapes passed straight thu" }, - /* 84*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\w", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\w' in input data", 0, "" }, + /* 84*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\w", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\w' in input", 0, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -767,14 +798,14 @@ static void test_escape_char_process_test(const testCtx *const p_ctx) { char *expected; int expected_len; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { 0, 0, "BLANK", 0, "BLANK", 5 }, /* 1*/ { 0, 0, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\\\o201\\d255", 0, "\000\004\a\b\t\n\v\f\r\033\035\036\201\\\201\377", 16 }, /* 2*/ { 0, 0, "\\U010283", 0, "\360\220\212\203", 4 }, /* 3*/ { 0, 0, "\\u007F\\u0080\\u011E\\u13C9\\U010283", 0, "\177\302\200\304\236\341\217\211\360\220\212\203", 12 }, /* 4*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, "\\^A\\^^\\^B", 0, "\\^A\\^^\\^B", 9 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -782,26 +813,27 @@ static void test_escape_char_process_test(const testCtx *const p_ctx) { for (i = 0; i < data_size; i++) { - struct zint_symbol symbol = {0}; + struct zint_symbol s_symbol = {0}; + struct zint_symbol *symbol = &s_symbol; int escaped_len; char escaped[1024]; if (testContinue(p_ctx, i)) continue; - symbol.symbology = data[i].symbology; - symbol.input_mode = data[i].input_mode; + symbol->symbology = data[i].symbology; + symbol->input_mode = data[i].input_mode; length = (int) strlen(data[i].data); escaped_len = length; - ret = escape_char_process_test(&symbol, (unsigned char *) data[i].data, &escaped_len, NULL); - assert_equal(ret, data[i].ret, "i:%d escape_char_process_test(NULL) ret %d != %d (%s)\n", i, ret, data[i].ret, symbol.errtxt); + ret = escape_char_process_test(symbol, (unsigned char *) data[i].data, &escaped_len, NULL); + assert_equal(ret, data[i].ret, "i:%d escape_char_process_test(NULL) ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(escaped_len, data[i].expected_len, "i:%d NULL escaped_len %d != %d\n", i, escaped_len, data[i].expected_len); memset(escaped, 0xDD, sizeof(escaped)); escaped_len = length; - ret = escape_char_process_test(&symbol, (unsigned char *) data[i].data, &escaped_len, (unsigned char *) escaped); - assert_equal(ret, data[i].ret, "i:%d escape_char_process_test(escaped) ret %d != %d (%s)\n", i, ret, data[i].ret, symbol.errtxt); + ret = escape_char_process_test(symbol, (unsigned char *) data[i].data, &escaped_len, (unsigned char *) escaped); + assert_equal(ret, data[i].ret, "i:%d escape_char_process_test(escaped) ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(escaped_len, data[i].expected_len, "i:%d escaped escaped_len %d != %d\n", i, escaped_len, data[i].expected_len); assert_zero(memcmp(escaped, data[i].expected, escaped_len), "i:%d memcmp() != 0\n", i); @@ -819,7 +851,7 @@ static void test_cap(const testCtx *const p_ctx) { unsigned int expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, ZINT_CAP_HRT, ZINT_CAP_HRT }, /* 1*/ { BARCODE_CODE128, ZINT_CAP_HRT | ZINT_CAP_STACKABLE | ZINT_CAP_GS1, ZINT_CAP_HRT | ZINT_CAP_STACKABLE }, /* 2*/ { BARCODE_PDF417, ZINT_CAP_HRT | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE, ZINT_CAP_ECI | ZINT_CAP_READER_INIT }, @@ -830,7 +862,7 @@ static void test_cap(const testCtx *const p_ctx) { /* 7*/ { BARCODE_POSTNET, ZINT_CAP_HRT | ZINT_CAP_STACKABLE | ZINT_CAP_EXTENDABLE | ZINT_CAP_COMPOSITE | ZINT_CAP_ECI | ZINT_CAP_GS1 | ZINT_CAP_DOTTY | ZINT_CAP_FIXED_RATIO | ZINT_CAP_READER_INIT | ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK | ZINT_CAP_STRUCTAPP, 0 }, /* 8*/ { 0, 0, 0 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i; unsigned int uret; @@ -942,13 +974,13 @@ static void test_cap_compliant_height(const testCtx *const p_ctx) { static void test_encode_file_empty(const testCtx *const p_ctx) { int ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char filename[] = "in.bin"; FILE *fstream; (void)p_ctx; - testStart("test_encode_file_empty"); + testStartSymbol("test_encode_file_empty", &symbol); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -975,12 +1007,12 @@ static void test_encode_file_too_large(const testCtx *const p_ctx) { char filename[] = "in.bin"; FILE *fstream; int ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char buf[ZINT_MAX_DATA_LEN + 1] = {0}; (void)p_ctx; - testStart("test_encode_file_too_large"); + testStartSymbol("test_encode_file_too_large", &symbol); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -1009,7 +1041,7 @@ static void test_encode_file_too_large(const testCtx *const p_ctx) { static void test_encode_file_unreadable(const testCtx *const p_ctx) { #ifndef _WIN32 int ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char filename[] = "in.bin"; char buf[ZINT_MAX_DATA_LEN + 1] = {0}; @@ -1018,7 +1050,7 @@ static void test_encode_file_unreadable(const testCtx *const p_ctx) { (void)p_ctx; - testStart("test_encode_file_unreadable"); + testStartSymbol("test_encode_file_unreadable", &symbol); #ifdef _WIN32 testSkip("Test not implemented on Windows"); @@ -1054,12 +1086,12 @@ static void test_encode_file_unreadable(const testCtx *const p_ctx) { /* #181 Nico Gunkel OSS-Fuzz (buffer not freed on fread() error) Note: unable to reproduce fread() error using this method */ static void test_encode_file_directory(const testCtx *const p_ctx) { int ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char dirname[] = "in_dir"; (void)p_ctx; - testStart("test_encode_file_directory"); + testStartSymbol("test_encode_file_directory", &symbol); #if defined(__NetBSD__) || defined(_AIX) /* Reading a directory works on NetBSD, and get `code128()` ZINT_ERROR_TOO_LONG instead */ @@ -1087,7 +1119,7 @@ static void test_encode_file_directory(const testCtx *const p_ctx) { static void test_encode_file(const testCtx *const p_ctx) { int ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char *data = "1"; char *filename = "test_encode_file_in.txt"; char *outfile = "test_encode_file_out.gif"; @@ -1095,7 +1127,7 @@ static void test_encode_file(const testCtx *const p_ctx) { (void)p_ctx; - testStart("test_encode_file"); + testStartSymbol("test_encode_file", &symbol); (void) testUtilRemove(filename); /* In case junk hanging around */ (void) testUtilRemove(outfile); /* In case junk hanging around */ @@ -1152,12 +1184,13 @@ static void test_encode_file(const testCtx *const p_ctx) { static void test_encode_print_outfile_directory(const testCtx *const p_ctx) { int ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char dirname[] = "outdir.txt"; + char expected[] = "Error 201: Could not open output file"; (void)p_ctx; - testStart("test_encode_print_outfile_directory"); + testStartSymbol("test_encode_print_outfile_directory", &symbol); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -1169,6 +1202,7 @@ static void test_encode_print_outfile_directory(const testCtx *const p_ctx) { strcpy(symbol->outfile, dirname); ret = ZBarcode_Encode_and_Print(symbol, TU("1"), 0, 0); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "ret %d != ZINT_ERROR_FILE_ACCESS (%s)\n", ret, symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, expected), "strcmp(%s, %s) != 0\n", symbol->errtxt, expected); ret = testUtilRmDir(dirname); assert_zero(ret, "testUtilRmDir(%s) %d != 0 (%d: %s)\n", dirname, ret, errno, strerror(errno)); @@ -1181,17 +1215,27 @@ static void test_encode_print_outfile_directory(const testCtx *const p_ctx) { static void test_bad_args(const testCtx *const p_ctx) { int ret; unsigned int uret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char *data = "1"; char *filename = "1.png"; char *empty = ""; struct zint_seg seg = { TU("1"), -1, 4 }; struct zint_seg seg_empty = { TU(""), -1, 4 }; struct zint_seg seg_too_long = { TU("1"), ZINT_MAX_DATA_LEN + 1, 4 }; + const char *expected[] = { + "Error 772: Input segment 0 source NULL", + "Error 200: Input segments NULL", + "Error 239: Filename NULL", + "Error 778: No input data", + "Error 229: Unable to read input file (2: No such file or directory)", + "Error 771: Too many input segments (maximum 256)", + "Error 205: No input data", + "Error 777: Input too long", + }; (void)p_ctx; - testStart("test_bad_args"); + testStartSymbol("test_bad_args", &symbol); /* These just return, no error */ ZBarcode_Clear(NULL); @@ -1231,91 +1275,91 @@ static void test_bad_args(const testCtx *const p_ctx) { /* NULL data/segs/filename */ symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode(symbol, NULL, 1), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode(symbol, NULL, 1) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode(symbol, NULL, 1) no errtxt\n"); + assert_zero(strcmp(expected[0], symbol->errtxt), "ZBarcode_Encode(symbol, NULL, 1) strcmp(%s, %s) != 0\n", expected[0], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_Segs(symbol, NULL, 1), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs(symbol, NULL, 1) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_Segs(symbol, NULL, 1) no errtxt\n"); + assert_zero(strcmp(expected[1], symbol->errtxt), "ZBarcode_Encode_Segs(symbol, NULL, 1) strcmp(%s, %s) != 0\n", expected[0], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_and_Print(symbol, NULL, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Print(symbol, NULL, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_and_Print(symbol, NULL, 1, 0) no errtxt\n"); + assert_zero(strcmp(expected[0], symbol->errtxt), "ZBarcode_Encode_and_Print(symbol, NULL, 1, 0) strcmp(%s, %s) != 0\n", expected[0], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_and_Buffer(symbol, NULL, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer(symbol, NULL, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_and_Buffer(symbol, NULL, 1, 0) no errtxt\n"); + assert_zero(strcmp(expected[0], symbol->errtxt), "ZBarcode_Encode_and_Buffer(symbol, NULL, 1, 0) strcmp(%s, %s) != 0\n", expected[0], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_Segs_and_Buffer(symbol, NULL, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs_and_Buffer(symbol, NULL, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_Segs_and_Buffer(symbol, NULL, 1, 0) no errtxt\n"); + assert_zero(strcmp(expected[1], symbol->errtxt), "ZBarcode_Encode_Segs_and_Buffer(symbol, NULL, 1, 0) strcmp(%s, %s) != 0\n", expected[0], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_and_Buffer_Vector(symbol, NULL, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer_Vector(symbol, NULL, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_and_Buffer_Vector(symbol, NULL, 1, 0) no errtxt\n"); + assert_zero(strcmp(expected[0], symbol->errtxt), "ZBarcode_Encode_and_Buffer_Vector(symbol, NULL, 1, 0) strcmp(%s, %s) != 0\n", expected[0], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, NULL, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, NULL, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, NULL, 1, 0) no errtxt\n"); + assert_zero(strcmp(expected[1], symbol->errtxt), "ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, NULL, 1, 0) strcmp(%s, %s) != 0\n", expected[0], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_File(symbol, NULL), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_File(symbol, NULL) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_File(symbol, NULL) no errtxt\n"); + assert_zero(strcmp(expected[2], symbol->errtxt), "ZBarcode_Encode_File(symbol, NULL) strcmp(%s, %s) != 0\n", expected[2], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_File_and_Print(symbol, NULL, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_File_and_Print(symbol, NULL, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_File_and_Print(symbol, NULL, 0) no errtxt\n"); + assert_zero(strcmp(expected[2], symbol->errtxt), "ZBarcode_Encode_File_and_Print(symbol, NULL, 0) strcmp(%s, %s) != 0\n", expected[2], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_File_and_Buffer(symbol, NULL, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_File_and_Buffer(symbol, NULL, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_File_and_Buffer(symbol, NULL, 0) no errtxt\n"); + assert_zero(strcmp(expected[2], symbol->errtxt), "ZBarcode_Encode_File_and_Buffer(symbol, NULL, 0) strcmp(%s, %s) != 0\n", expected[2], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_File_and_Buffer_Vector(symbol, NULL, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_File_and_Buffer_Vector(symbol, NULL, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_File_and_Buffer_Vector(symbol, NULL, 0) no errtxt\n"); + assert_zero(strcmp(expected[2], symbol->errtxt), "ZBarcode_Encode_File_and_Buffer_Vector(symbol, NULL, 0) strcmp(%s, %s) != 0\n", expected[2], symbol->errtxt); /* Empty data/segs/filename */ symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode(symbol, TU(empty), 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode(symbol, empty, 0) no errtxt\n"); + assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode(symbol, TU(empty), 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_Segs(symbol, &seg_empty, 1), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs(symbol, &seg_empty, 1) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_Segs(symbol, &seg_empty, 1) no errtxt\n"); + assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_Segs(symbol, &seg_empty, 1) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_and_Print(symbol, TU(empty), 0, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Print(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_and_Print(symbol, empty, 0, 0) no errtxt\n"); + assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_and_Print(symbol, TU(empty), 0, 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_and_Buffer(symbol, TU(empty), 0, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_and_Buffer(symbol, empty, 0, 0) no errtxt\n"); + assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_and_Buffer(symbol, TU(empty), 0, 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0) no errtxt\n"); + assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_and_Buffer_Vector(symbol, TU(empty), 0, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer_Vector(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_and_Buffer_Vector(symbol, empty, 0, 0) no errtxt\n"); + assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_and_Buffer_Vector(symbol, TU(empty), 0, 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, &seg_empty, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, &seg_empty, 1, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, &seg_empty, 1, 0) no errtxt\n"); + assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, &seg_empty, 1, 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_File(symbol, empty), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_File(symbol, empty) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_File(symbol, empty) no errtxt\n"); + assert_zero(strcmp(expected[4], symbol->errtxt), "ZBarcode_Encode_File(symbol, empty) strcmp(%s, %s) != 0\n", expected[4], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_File_and_Print(symbol, empty, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_File_and_Print(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_File_and_Print(symbol, empty, 0) no errtxt\n"); + assert_zero(strcmp(expected[4], symbol->errtxt), "ZBarcode_Encode_File_and_Print(symbol, empty, 0) strcmp(%s, %s) != 0\n", expected[4], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_File_and_Buffer(symbol, empty, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_File_and_Buffer(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_File_and_Buffer(symbol, empty, 0) no errtxt\n"); + assert_zero(strcmp(expected[4], symbol->errtxt), "ZBarcode_Encode_File_and_Buffer(symbol, empty, 0) strcmp(%s, %s) != 0\n", expected[4], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_File_and_Buffer_Vector(symbol, empty, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_File_and_Buffer_Vector(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_File_and_Buffer_Vector(symbol, empty, 0) no errtxt\n"); + assert_zero(strcmp(expected[4], symbol->errtxt), "ZBarcode_Encode_File_and_Buffer_Vector(symbol, empty, 0) strcmp(%s, %s) != 0\n", expected[4], symbol->errtxt); /* Bad seg_count */ symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_Segs(symbol, &seg_empty, ZINT_MAX_SEG_COUNT + 1), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs(symbol, &seg_empty, ZINT_MAX_SEG_COUNT + 1) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_Segs(symbol, &seg_empty, ZINT_MAX_SEG_COUNT + 1) no errtxt\n"); + assert_zero(strcmp(expected[5], symbol->errtxt), "ZBarcode_Encode_Segs(symbol, &seg_empty, ZINT_MAX_SEG_COUNT + 1) strcmp(%s, %s) != 0\n", expected[5], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_Segs(symbol, &seg_empty, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs(symbol, &seg_empty, 0) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_Segs(symbol, &seg_empty, 0) no errtxt\n"); + assert_zero(strcmp(expected[6], symbol->errtxt), "ZBarcode_Encode_Segs(symbol, &seg_empty, 0) strcmp(%s, %s) != 0\n", expected[6], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_Segs(symbol, &seg_empty, -1), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs(symbol, &seg_empty, -1) != ZINT_ERROR_INVALID_DATA\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_Segs(symbol, &seg_empty, -1) no errtxt\n"); + assert_zero(strcmp(expected[6], symbol->errtxt), "ZBarcode_Encode_Segs(symbol, &seg_empty, -1) strcmp(%s, %s) != 0\n", expected[6], symbol->errtxt); /* Data/seg too big */ symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode(symbol, TU(empty), ZINT_MAX_DATA_LEN + 1), ZINT_ERROR_TOO_LONG, "ZBarcode_Encode(symbol, empty, ZINT_MAX_DATA_LEN + 1) != ZINT_ERROR_TOO_LONG\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode(symbol, empty, ZINT_MAX_DATA_LEN + 1) no errtxt\n"); + assert_zero(strcmp(expected[7], symbol->errtxt), "ZBarcode_Encode(symbol, TU(empty), ZINT_MAX_DATA_LEN + 1) strcmp(%s, %s) != 0\n", expected[7], symbol->errtxt); symbol->errtxt[0] = '\0'; assert_equal(ZBarcode_Encode_Segs(symbol, &seg_too_long, 1), ZINT_ERROR_TOO_LONG, "ZBarcode_Encode_Segs(symbol, &seg_too_long, 1) != ZINT_ERROR_TOO_LONG\n"); - assert_nonzero((int) strlen(symbol->errtxt), "ZBarcode_Encode_Segs(symbol, &seg_too_long, 1) no errtxt\n"); + assert_zero(strcmp(expected[7], symbol->errtxt), "ZBarcode_Encode_Segs(symbol, &seg_too_long, 1) strcmp(%s, %s) != 0\n", expected[7], symbol->errtxt); ZBarcode_Delete(symbol); @@ -1552,11 +1596,12 @@ static void test_barcode_name(const testCtx *const p_ctx) { testFinish(); } -INTERNAL int error_tag_test(struct zint_symbol *symbol, int error_number, const char *error_string); +INTERNAL int error_tag_test(int error_number, struct zint_symbol *symbol, const int err_id, const char *error_string); static void test_error_tag(const testCtx *const p_ctx) { struct item { + int debug_test; int error_number; int warn_level; char *data; @@ -1565,45 +1610,50 @@ static void test_error_tag(const testCtx *const p_ctx) { }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ struct item data[] = { - /* 0*/ { ZINT_WARN_INVALID_OPTION, -1, "", ZINT_WARN_INVALID_OPTION, "Warning " }, - /* 1*/ { ZINT_WARN_INVALID_OPTION, WARN_FAIL_ALL, "", ZINT_ERROR_INVALID_OPTION, "Error " }, - /* 2*/ { ZINT_WARN_USES_ECI, -1, "", ZINT_WARN_USES_ECI, "Warning " }, - /* 3*/ { ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "", ZINT_ERROR_USES_ECI, "Error " }, - /* 4*/ { ZINT_WARN_NONCOMPLIANT, -1, "", ZINT_WARN_NONCOMPLIANT, "Warning " }, - /* 5*/ { ZINT_WARN_NONCOMPLIANT, WARN_FAIL_ALL, "", ZINT_ERROR_NONCOMPLIANT, "Error " }, - /* 6*/ { ZINT_WARN_HRT_TRUNCATED, -1, "", ZINT_WARN_HRT_TRUNCATED, "Warning " }, - /* 7*/ { ZINT_WARN_HRT_TRUNCATED, WARN_FAIL_ALL, "", ZINT_ERROR_HRT_TRUNCATED, "Error " }, - /* 8*/ { ZINT_ERROR_TOO_LONG, WARN_DEFAULT, "", ZINT_ERROR_TOO_LONG, "Error " }, - /* 9*/ { ZINT_ERROR_TOO_LONG, WARN_FAIL_ALL, "", ZINT_ERROR_TOO_LONG, "Error " }, - /* 10*/ { ZINT_WARN_USES_ECI, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_WARN_USES_ECI, "Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" }, - /* 11*/ { ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_USES_ECI, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" }, - /* 12*/ { ZINT_ERROR_INVALID_DATA, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" }, - /* 13*/ { ZINT_ERROR_INVALID_DATA, WARN_FAIL_ALL, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" }, - /* 14*/ { ZINT_WARN_USES_ECI, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_WARN_USES_ECI, "Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" }, - /* 15*/ { ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_ERROR_USES_ECI, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" }, - /* 16*/ { ZINT_ERROR_INVALID_DATA, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" }, + /* 0*/ { 0, ZINT_WARN_INVALID_OPTION, -1, "", ZINT_WARN_INVALID_OPTION, "Warning " }, + /* 1*/ { 0, ZINT_WARN_INVALID_OPTION, WARN_FAIL_ALL, "", ZINT_ERROR_INVALID_OPTION, "Error " }, + /* 2*/ { 0, ZINT_WARN_USES_ECI, -1, "", ZINT_WARN_USES_ECI, "Warning " }, + /* 3*/ { 0, ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "", ZINT_ERROR_USES_ECI, "Error " }, + /* 4*/ { 0, ZINT_WARN_NONCOMPLIANT, -1, "", ZINT_WARN_NONCOMPLIANT, "Warning " }, + /* 5*/ { 0, ZINT_WARN_NONCOMPLIANT, WARN_FAIL_ALL, "", ZINT_ERROR_NONCOMPLIANT, "Error " }, + /* 6*/ { 0, ZINT_WARN_HRT_TRUNCATED, -1, "", ZINT_WARN_HRT_TRUNCATED, "Warning " }, + /* 7*/ { 0, ZINT_WARN_HRT_TRUNCATED, WARN_FAIL_ALL, "", ZINT_ERROR_HRT_TRUNCATED, "Error " }, + /* 8*/ { 0, ZINT_ERROR_TOO_LONG, WARN_DEFAULT, "", ZINT_ERROR_TOO_LONG, "Error " }, + /* 9*/ { 0, ZINT_ERROR_TOO_LONG, WARN_FAIL_ALL, "", ZINT_ERROR_TOO_LONG, "Error " }, + /* 10*/ { 0, ZINT_WARN_USES_ECI, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", ZINT_WARN_USES_ECI, "Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" }, + /* 11*/ { 1, ZINT_WARN_USES_ECI, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012", ZINT_WARN_USES_ECI, "Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" }, + /* 12*/ { 0, ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", ZINT_ERROR_USES_ECI, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" }, + /* 13*/ { 1, ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_USES_ECI, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" }, + /* 14*/ { 0, ZINT_ERROR_INVALID_DATA, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" }, + /* 15*/ { 1, ZINT_ERROR_INVALID_DATA, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" }, + /* 16*/ { 1, ZINT_ERROR_INVALID_DATA, WARN_FAIL_ALL, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" }, + /* 17*/ { 1, ZINT_WARN_USES_ECI, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_WARN_USES_ECI, "Warning 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901" }, + /* 18*/ { 1, ZINT_WARN_USES_ECI, WARN_FAIL_ALL, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_ERROR_USES_ECI, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" }, + /* 19*/ { 1, ZINT_ERROR_INVALID_DATA, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ZINT_ERROR_INVALID_DATA, "Error 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, ret; testStart("test_error_tag"); for (i = 0; i < data_size; i++) { - struct zint_symbol symbol = {0}; + struct zint_symbol s_symbol = {0}; + struct zint_symbol *symbol = &s_symbol; if (testContinue(p_ctx, i)) continue; - symbol.warn_level = data[i].warn_level; + if (data[i].debug_test) symbol->debug |= ZINT_DEBUG_TEST; + symbol->warn_level = data[i].warn_level; - ret = error_tag_test(&symbol, data[i].error_number, data[i].data); + ret = error_tag_test(data[i].error_number, symbol, -1, data[i].data); assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); - assert_zero(strcmp(symbol.errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol.errtxt, data[i].expected); + assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); if ((int) strlen(data[i].data) < 100) { - strcpy(symbol.errtxt, data[i].data); - ret = error_tag_test(&symbol, data[i].error_number, NULL); + strcpy(symbol->errtxt, data[i].data); + ret = error_tag_test(data[i].error_number, symbol, -1, NULL); assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); - assert_zero(strcmp(symbol.errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol.errtxt, data[i].expected); + assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); } } @@ -1644,12 +1694,12 @@ static void test_strip_bom(const testCtx *const p_ctx) { static void test_zero_outfile(const testCtx *const p_ctx) { int ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char *data = "1234"; (void)p_ctx; - testStart("test_zero_outfile"); + testStartSymbol("test_zero_outfile", &symbol); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -1677,12 +1727,12 @@ static void test_zero_outfile(const testCtx *const p_ctx) { static void test_clear(const testCtx *const p_ctx) { int ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char *data = "1234"; (void)p_ctx; - testStart("test_clear"); + testStartSymbol("test_clear", &symbol); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); @@ -1931,7 +1981,7 @@ static void test_scale_from_xdimdp(const testCtx *const p_ctx) { float expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_EANX, 0.33f, 2, 50, "gif", 0.5f }, /* 1*/ { BARCODE_EANX, 0.33f, 2, 50, "emf", 0.33000001f }, /* 2*/ { BARCODE_EANX, 0.33f, 2, 50, "svg", 0.33000001f }, @@ -2017,7 +2067,7 @@ static void test_scale_from_xdimdp(const testCtx *const p_ctx) { /* 82*/ { BARCODE_CODE128, 0.5f, 300, -1, "abcd", 0 }, /* filetype unknown */ /* 83*/ { BARCODE_QRCODE, 10, 31, 800, "gif", 155 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i; float ret; float x_dim_from_scale; @@ -2063,7 +2113,7 @@ static void test_xdimdp_from_scale(const testCtx *const p_ctx) { float expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_EANX, 1, 6, 150, "gif", 0.33333334f }, /* 1*/ { BARCODE_EANX, 1.32f, 8, 200, "gif", 0.33000001f }, /* 2*/ { BARCODE_EANX, 1.5f, 8, 200, "gif", 0.375f }, @@ -2092,7 +2142,7 @@ static void test_xdimdp_from_scale(const testCtx *const p_ctx) { /* 25*/ { BARCODE_CODE128, 0.5f, 0, -1, "gif", 0 }, /* xdim_mm_or_dpmm zero */ /* 26*/ { BARCODE_CODE128, 0.5f, 1000.1f, -1, "gif", 0 }, /* xdim_mm_or_dpmm > 1000 */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i; float ret; float dpmm_from_dpi; diff --git a/backend/tests/test_mailmark.c b/backend/tests/test_mailmark.c index e27a665f..ccca5d02 100644 --- a/backend/tests/test_mailmark.c +++ b/backend/tests/test_mailmark.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2022 Robin Stuart + Copyright (C) 2019-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -41,7 +41,7 @@ static void test_4s_input(const testCtx *const p_ctx) { int expected_width; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "41038422416563762XY11 ", 0, 3, 155 }, /* 1*/ { "41038422416563762XY11 ", ZINT_ERROR_TOO_LONG, -1, -1 }, /* 2*/ { "4103842241656", ZINT_ERROR_TOO_LONG, -1, -1 }, /* Too short (< 14) */ @@ -100,11 +100,11 @@ static void test_4s_input(const testCtx *const p_ctx) { /* 55*/ { "01000000000000000C 23JQ4U ", ZINT_ERROR_INVALID_DATA, -1, -1 }, /* F N N N L L N L S bad 1st N (non-alpha otherwise matches 2nd pattern) */ /* 56*/ { "41038422416563762XY1", ZINT_ERROR_INVALID_DATA, -1, -1 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_4s_input"); + testStartSymbol("test_4s_input", &symbol); for (i = 0; i < data_size; i++) { @@ -146,7 +146,7 @@ static void test_4s_encode_vector(const testCtx *const p_ctx) { char *expected_daft; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "1100000000000XY11 ", 0, 100, 30, 0, "TTDTTATTDTAATTDTAATTDTAATTDTTDDAATAADDATAATDDFAFTDDTAADDDTAAFDFAFF" }, /* Example 1 from RMMBCED */ /* 1*/ { "21B2254800659JW5O9QA6Y", 0, 100, 30, 0, "DAATATTTADTAATTFADDDDTTFTFDDDDFFDFDAFTADDTFFTDDATADTTFATTDAFDTFDDA" }, /* Example 2 from RMMBCED */ /* 2*/ { "11000000000000000XY11 ", 0, 100, 30, 0, "TTDTTATDDTTATTDTAATTDTAATDDTTATTDTTDATFTAATDDTAATDDTATATFAADDAATAATDDTAADFTFTA" }, /* Example 1 from RMMBLED */ @@ -168,13 +168,13 @@ static void test_4s_encode_vector(const testCtx *const p_ctx) { /* 18*/ { "31833333333333333C12JQ3U ", 0, 100, 30, 0, "DTTAFFDATATFAADAFDFATFFTFFTTTADTTTDTAAATDDTFFDDFTAADTTDTFFFDAFTFAADFDDAFDFTAFF" }, /* F N N L L N L S S */ /* 19*/ { "22799999999999999C123JQ4U ", 0, 100, 30, 0, "DDATTDDATATTTAFDTAADATDDFFTFFDFFDTFAADDFAADFDFFTFFTFFDFDFTATATFDDFTFFFTFFTDDTF" }, /* F N N N L L N L S */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char actual_daft[80]; - testStart("test_4s_encode_vector"); + testStartSymbol("test_4s_encode_vector", &symbol); for (i = 0; i < data_size; i++) { @@ -215,20 +215,20 @@ static void test_4s_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { "1100000000000XY11 ", 0, 3, 131, "Verified manually against TEC-IT", "00000000001000000000101000000000101000000000101000000000000000101000101000001000101000000010101000000000101000000000101010001010101" "10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101" "00001000000000001000000000001000000000001000000000001000001010000000000010100000000000101010001000101000000010101000000010101000101" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[1024]; - testStart("test_4s_encode"); + testStartSymbol("test_4s_encode", &symbol); for (i = 0; i < data_size; i++) { @@ -278,23 +278,23 @@ static void test_2d_input(const testCtx *const p_ctx) { char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { -1, "012100123412345678AB19XY1A 0", 0, 24, 24, "" }, /* 1*/ { -1, "012100123412345678ab19xy1a 0", 0, 24, 24, "" }, /* Converts to upper */ /* 2*/ { -1, "jgb 012100123412345678ab19xy1a 0", 0, 24, 24, "" }, - /* 3*/ { -1, "012100123412345678AB19XY1A 0901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_TOO_LONG, -1, -1, "Error 589: Input too long (90 character maximum)" }, - /* 4*/ { -1, "012100123412345678AB19XY1A ", ZINT_ERROR_TOO_LONG, -1, -1, "Error 860: Input too short (28 character minimum)" }, - /* 5*/ { -1, "012100123412345678AB19XY1A 090123456789012345678901234567890123456789012345678901234567", ZINT_ERROR_TOO_LONG, -1, -1, "Error 861: Input too long (86 character maximum)" }, - /* 6*/ { -1, "JGB 012100123412345678AB19XY1A ", ZINT_ERROR_TOO_LONG, -1, -1, "Error 862: Input too short (32 character minimum)" }, - /* 7*/ { 9, "JGB 012100123412345678AB19XY1A 0", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 863: Invalid symbol size selected (8, 10, 30 only)" }, + /* 3*/ { -1, "012100123412345678AB19XY1A 0901234567890123456789012345678901234567890123456789012345678901", ZINT_ERROR_TOO_LONG, -1, -1, "Error 589: Input length 91 too long (maximum 90)" }, + /* 4*/ { -1, "012100123412345678AB19XY1A ", ZINT_ERROR_TOO_LONG, -1, -1, "Error 860: Input length 27 too short (minimum 28)" }, + /* 5*/ { -1, "012100123412345678AB19XY1A 090123456789012345678901234567890123456789012345678901234567", ZINT_ERROR_TOO_LONG, -1, -1, "Error 861: Input length 87 too long (maximum 86)" }, + /* 6*/ { -1, "JGB 012100123412345678AB19XY1A ", ZINT_ERROR_TOO_LONG, -1, -1, "Error 862: Input length 31 too short (minimum 32)" }, + /* 7*/ { 9, "JGB 012100123412345678AB19XY1A 0", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 863: Invalid Version '9' (8, 10 or 30 only)" }, /* 8*/ { -1, "JGB 012100123412345678AB19XY1A 0 123456", 0, 24, 24, "" }, - /* 9*/ { 8, "JGB 012100123412345678AB19XY1A 0 1234567", ZINT_ERROR_TOO_LONG, -1, -1, "Error 864: Input too long for selected size (51 character maximum)" }, + /* 9*/ { 8, "JGB 012100123412345678AB19XY1A 0 1234567", ZINT_ERROR_TOO_LONG, -1, -1, "Error 864: Input length 52 too long for Version 8 (maximum 51)" }, /* 10*/ { -1, "JGB 012100123412345678AB19XY1A 0 1234567890123456789012345", 0, 16, 48, "" }, - /* 11*/ { 30, "JGB 012100123412345678AB19XY1A 0 12345678901234567890123456", ZINT_ERROR_TOO_LONG, -1, -1, "Error 865: Input too long for selected size (70 character maximum)" }, + /* 11*/ { 30, "JGB 012100123412345678AB19XY1A 0 12345678901234567890123456", ZINT_ERROR_TOO_LONG, -1, -1, "Error 865: Input length 71 too long for Version 30 (maximum 70)" }, /* 12*/ { -1, "JGB 012100123412345678AB19XY1A 0 123456789012345678901234567890123456789012345", 0, 32, 32, "" }, - /* 13*/ { -1, "JGB 012100123412345678AB19XY1A 0 1234567890123456789012345678901234567890123456", ZINT_ERROR_TOO_LONG, -1, -1, "Error 589: Input too long (90 character maximum)" }, + /* 13*/ { -1, "JGB 012100123412345678AB19XY1A 0 1234567890123456789012345678901234567890123456", ZINT_ERROR_TOO_LONG, -1, -1, "Error 589: Input length 91 too long (maximum 90)" }, /* 14*/ { -1, "JGB 012100123412345678AB19XY1A 0 .23456", 0, 24, 24, "" }, - /* 15*/ { -1, "JGB 012100123412345678AB19XY1A 0 . 23456", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 866: Invalid character in data (alphanumerics and space only in first 45 characters)" }, + /* 15*/ { -1, "JGB 012100123412345678AB19XY1A 0 . 23456", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 866: Invalid character at position 45 in input (alphanumerics and space only in first 45)" }, /* 16*/ { -1, "JGB 12100123412345678AB19XY1A 0", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 867: Invalid Information Type ID (cannot be space)" }, /* 17*/ { -1, " 12100123412345678AB19XY1A 0", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 867: Invalid Information Type ID (cannot be space)" }, /* 18*/ { -1, "JGB 022100123412345678AB19XY1A 0", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 868: Invalid Version ID (\"1\" only)" }, @@ -314,11 +314,11 @@ static void test_2d_input(const testCtx *const p_ctx) { /* 31*/ { -1, "JGB 012100123412345678AB19XY1A 0AB181XY ", 0, 24, 24, "" }, /* 32*/ { -1, "JGB 012100123412345678AB19XY1A 0AB181XYA ", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 875: Invalid Reserved field (must be spaces only)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_2d_input"); + testStartSymbol("test_2d_input", &symbol); for (i = 0; i < data_size; i++) { @@ -362,7 +362,7 @@ static void test_2d_encode(const testCtx *const p_ctx) { https://www.royalmailtechnical.com/rmt_docs/User_Guides_2020/Mailmark_Letters_and_Large_Letters_20200723.pdf */ /* Mailmark Barcode Definition Document 15th Feb 2021 (MBDD) https://www.royalmailtechnical.com/rmt_docs/User_Guides_2021/Mailmark_Barcode_definition_document_20210215.pdf */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { 8, "JGB 01Z999999900000001EC1A1AA1A0SN35TQ ", 0, 24, 24, 1, "MMRLLL Section 2.4 Code Type Format 7 figure **NOT SAME**, figure switches from C40 to ASC to C40 to ASC contrary to spec", "101010101010101010101010" "110000010100011001100001" @@ -528,9 +528,9 @@ static void test_2d_encode(const testCtx *const p_ctx) { "11111111111111111111111111111111" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[8192]; char cmp_buf[32768]; @@ -539,7 +539,7 @@ static void test_2d_encode(const testCtx *const p_ctx) { 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_2d_encode"); + testStartSymbol("test_2d_encode", &symbol); for (i = 0; i < data_size; i++) { diff --git a/backend/tests/test_maxicode.c b/backend/tests/test_maxicode.c index fbdca296..beb4edc9 100644 --- a/backend/tests/test_maxicode.c +++ b/backend/tests/test_maxicode.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2023 Robin Stuart + Copyright (C) 2019-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -45,7 +45,7 @@ static void test_large(const testCtx *const p_ctx) { int expected_width; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { -1, -1, "1", 138, "", 0, 33, 30 }, /* Mode 4 (138 agrees with ISO/IEC 16023:2000) */ /* 1*/ { -1, -1, "1", 139, "", ZINT_ERROR_TOO_LONG, -1, -1 }, /* 2*/ { -1, -1, "1", 145, "", ZINT_ERROR_TOO_LONG, -1, -1 }, /* Absolute max */ @@ -81,13 +81,14 @@ static void test_large(const testCtx *const p_ctx) { /* 32*/ { 6, -1, "A", 93, "", 0, 33, 30 }, /* 33*/ { 6, -1, "A", 94, "", ZINT_ERROR_TOO_LONG, -1, -1 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char data_buf[256]; + const char expected_errtxt[] = "Error 553: Input too long, requires too many codewords (maximum 144)"; - testStart("test_large"); + testStartSymbol("test_large", &symbol); for (i = 0; i < data_size; i++) { @@ -104,10 +105,13 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); 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->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); + } else { + assert_zero(strcmp(symbol->errtxt, expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, expected_errtxt); } ZBarcode_Delete(symbol); @@ -135,21 +139,21 @@ static void test_input(const testCtx *const p_ctx) { int zxingcpp_cmp; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 01 21 21 21 21 21 21 21 21 08 0E 19 2B 20 0C 24 06 32 1C 21 21 21 21 21 21 21 21", 1, 1, "" }, - /* 1*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", 1, 1, "" }, + /* 1*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_DATA, 0, "Error 548: Primary Message empty", 1, 1, "" }, /* 2*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "A123456", ZINT_ERROR_INVALID_DATA, 0, "Error 555: Non-numeric postcode in Primary Message", 1, 1, "" }, /* 3*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "1123456", 0, 30, "(144) 12 00 00 00 00 10 30 1E 20 1C 1A 3D 1C 0D 1B 15 3C 17 3C 08 01 21 21 21 21 21 21 21", 1, 1, "1-digit postcode" }, /* 4*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "1 123456", 0, 30, "(144) 12 00 00 00 00 10 30 1E 20 1C 1A 3D 1C 0D 1B 15 3C 17 3C 08 01 21 21 21 21 21 21 21", 1, 0, "1-digit postcode; ZXing-C++ test can't handle space" }, /* 5*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "123456789123456", 0, 30, "(144) 12 05 0D 2F 35 11 32 1E 20 1C 0D 1D 3B 12 22 3F 30 14 23 1A 01 21 21 21 21 21 21 21", 1, 1, "9-digit postcode" }, - /* 6*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "1234567890123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", 1, 1, "10-digit postcode" }, + /* 6*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "1234567890123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Primary Message length 16 wrong (7 to 15 only)", 1, 1, "10-digit postcode" }, /* 7*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "1123456", 0, 30, "(144) 12 00 00 00 00 10 30 1E 20 1C 1A 3D 1C 0D 1B 15 3C 17 3C 08 01 21 21 21 21 21 21 21", 0, 1, "1-digit postcode; BWIPP requires mode" }, /* 8*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "123456789123456", 0, 30, "(144) 12 05 0D 2F 35 11 32 1E 20 1C 0D 1D 3B 12 22 3F 30 14 23 1A 01 21 21 21 21 21 21 21", 0, 1, "9-digit postcode; BWIPP requires mode" }, - /* 9*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "1234567890123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", 1, 1, "10-digit postcode" }, - /* 10*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", 1, 1, "0-digit postcode" }, + /* 9*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "1234567890123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Primary Message length 16 wrong (7 to 15 only)", 1, 1, "10-digit postcode" }, + /* 10*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "123456", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Primary Message length 6 wrong (7 to 15 only)", 1, 1, "0-digit postcode" }, /* 11*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "12345678123456", 0, 30, "(144) 22 13 21 31 0B 00 32 1E 20 1C 04 14 07 30 10 07 08 28 1D 09 01 21 21 21 21 21 21 21", 0, 1, "8-digit postcode; BWIPP requires mode" }, /* 12*/ { UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", -1, "12345678123456", 0, 30, "(144) 22 13 21 31 0B 00 32 1E 20 1C 04 14 07 30 10 07 08 28 1D 09 01 21 21 21 21 21 21 21", 1, 1, "8-digit postcode" }, - /* 13*/ { UNICODE_MODE, -1, 3, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_DATA, 0, "Error 551: Invalid length for Primary Message", 1, 1, "" }, + /* 13*/ { UNICODE_MODE, -1, 3, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_DATA, 0, "Error 548: Primary Message empty", 1, 1, "" }, /* 14*/ { UNICODE_MODE, -1, 3, -1, { 0, 0, "" }, "A", -1, "A123456", 0, 30, "(144) 03 08 08 08 08 18 30 1E 20 1C 22 35 1C 0F 02 1A 26 04 10 31 01 21 21 21 21 21 21 21", 1, 1, "1-alphanumeric postcode" }, /* 15*/ { UNICODE_MODE, -1, 3, -1, { 0, 0, "" }, "A", -1, "1123456", 0, 30, "(144) 03 08 08 08 08 18 3C 1E 20 1C 13 37 07 2C 26 2D 18 29 3F 2C 01 21 21 21 21 21 21 21", 1, 0, "1-digit postcode; ZXing-C++ test can't handle padding" }, /* 16*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A", -1, "A123456", 0, 30, "(144) 03 08 08 08 08 18 30 1E 20 1C 22 35 1C 0F 02 1A 26 04 10 31 01 21 21 21 21 21 21 21", 1, 1, "1-alphanumeric postcode" }, @@ -166,7 +170,7 @@ static void test_input(const testCtx *const p_ctx) { /* 27*/ { UNICODE_MODE, -1, 0, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_DATA, 0, "Error 554: Primary Message empty", 1, 1, "Auto-determine mode 2/3 requires primary message" }, /* 28*/ { UNICODE_MODE, -1, 0, -1, { 0, 0, "" }, "A", -1, "A23456123456", 0, 30, "(144) 23 1D 0D 3D 2C 1C 30 1E 20 1C 24 35 30 31 2A 0D 17 14 16 3D 01 21 21 21 21 21 21 21", 1, 1, "Auto-determine mode 3" }, /* 29*/ { UNICODE_MODE, -1, -1, 100, { 0, 0, "" }, "A", -1, "123456123456", 0, 30, "(144) 02 10 22 07 00 20 31 1E 20 1C 0E 29 13 1B 0D 26 36 25 3B 22 3B 2A 29 3B 28 1E 30 31", 0, 1, "SCM prefix version" }, - /* 30*/ { UNICODE_MODE, -1, -1, 101, { 0, 0, "" }, "A", -1, "123456123456", ZINT_ERROR_INVALID_OPTION, 0, "Error 557: Invalid SCM prefix version", 1, 1, "SCM prefix version" }, + /* 30*/ { UNICODE_MODE, -1, -1, 101, { 0, 0, "" }, "A", -1, "123456123456", ZINT_ERROR_INVALID_OPTION, 0, "Error 557: SCM prefix version '101' out of range (1 to 100)", 1, 1, "SCM prefix version" }, /* 31*/ { UNICODE_MODE, 3, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 03 01 21 21 21 21 21 21 2F 14 23 21 05 24 27 00 24 0C 21 21 21 21 21 21 21 21", 1, 1, "" }, /* 32*/ { UNICODE_MODE, 31, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 1F 01 21 21 21 21 21 21 00 2F 0E 09 39 3B 24 1A 21 05 21 21 21 21 21 21 21 21", 1, 1, "ECI 0x1F" }, /* 33*/ { UNICODE_MODE, 32, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 20 20 01 21 21 21 21 21 3D 15 0F 30 0D 22 24 35 22 06 21 21 21 21 21 21 21 21", 1, 1, "ECI 0x20" }, @@ -178,19 +182,20 @@ static void test_input(const testCtx *const p_ctx) { /* 39*/ { UNICODE_MODE, 65536, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 38 10 00 00 01 21 21 21 2B 1F 24 06 38 2E 17 1B 10 2F 21 21 21 21 21 21 21 21", 1, 1, "ECI 0x10000" }, /* 40*/ { UNICODE_MODE, 131071, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 38 1F 3F 3F 01 21 21 21 0F 05 09 04 2F 3A 17 09 36 31 21 21 21 21 21 21 21 21", 1, 1, "ECI 0x1FFFF" }, /* 41*/ { UNICODE_MODE, 999999, -1, -1, { 0, 0, "" }, "A", -1, "", 0, 30, "(144) 04 1B 3B 34 08 3F 01 21 21 21 26 3B 2B 23 08 17 32 05 26 35 21 21 21 21 21 21 21 21", 1, 1, "Max ECI" }, - /* 42*/ { UNICODE_MODE, -1, 1, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 550: Invalid MaxiCode Mode", 1, 1, "" }, - /* 43*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\015", -1, "", 0, 30, "(144) 04 00 21 21 21 21 21 21 21 21 37 32 10 01 24 1B 10 11 38 0C 21 21 21 21 21 21 21 21", 1, 0, "ZXing-C++ test can't handle LF" }, - /* 44*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\001\034\001\035\001\036\001a:b", -1, "", 0, 30, "(144) 04 3E 3E 01 20 01 21 01 22 01 27 0B 35 01 08 0D 16 02 17 1A 3F 01 33 02 21 21 21 21", 1, 1, "" }, - /* 45*/ { UNICODE_MODE, -1, -1, -1, { 1, 2, "" }, "A", -1, "", 0, 30, "(144) 04 21 01 01 21 21 21 21 21 21 09 0B 26 03 37 0E 25 27 07 1E 21 21 21 21 21 21 21 21", 1, 1, "" }, - /* 46*/ { UNICODE_MODE, -1, -1, -1, { 0, 2, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 559: Structured Append index out of range (1-2)", 1, 1, "" }, - /* 47*/ { UNICODE_MODE, -1, -1, -1, { 1, 1, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 558: Structured Append count out of range (2-8)", 1, 1, "" }, - /* 48*/ { UNICODE_MODE, -1, -1, -1, { 1, 9, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 558: Structured Append count out of range (2-8)", 1, 1, "" }, - /* 49*/ { UNICODE_MODE, -1, -1, -1, { 3, 2, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 559: Structured Append index out of range (1-2)", 1, 1, "" }, - /* 50*/ { UNICODE_MODE, -1, -1, -1, { 1, 2, "A" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 549: Structured Append ID not available for MaxiCode", 1, 1, "" }, + /* 42*/ { UNICODE_MODE, -1, 1, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 550: Mode '1' out of range (2 to 6)", 1, 1, "" }, + /* 43*/ { UNICODE_MODE, -1, 7, -1, { 0, 0, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 550: Mode '7' out of range (2 to 6)", 1, 1, "" }, + /* 44*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\015", -1, "", 0, 30, "(144) 04 00 21 21 21 21 21 21 21 21 37 32 10 01 24 1B 10 11 38 0C 21 21 21 21 21 21 21 21", 1, 0, "ZXing-C++ test can't handle LF" }, + /* 45*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\001\034\001\035\001\036\001a:b", -1, "", 0, 30, "(144) 04 3E 3E 01 20 01 21 01 22 01 27 0B 35 01 08 0D 16 02 17 1A 3F 01 33 02 21 21 21 21", 1, 1, "" }, + /* 46*/ { UNICODE_MODE, -1, -1, -1, { 1, 2, "" }, "A", -1, "", 0, 30, "(144) 04 21 01 01 21 21 21 21 21 21 09 0B 26 03 37 0E 25 27 07 1E 21 21 21 21 21 21 21 21", 1, 1, "" }, + /* 47*/ { UNICODE_MODE, -1, -1, -1, { 0, 2, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 559: Structured Append index '0' out of range (1 to count 2)", 1, 1, "" }, + /* 48*/ { UNICODE_MODE, -1, -1, -1, { 1, 1, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 558: Structured Append count '1' out of range (2 to 8)", 1, 1, "" }, + /* 49*/ { UNICODE_MODE, -1, -1, -1, { 1, 9, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 558: Structured Append count '9' out of range (2 to 8)", 1, 1, "" }, + /* 50*/ { UNICODE_MODE, -1, -1, -1, { 3, 2, "" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 559: Structured Append index '3' out of range (1 to count 2)", 1, 1, "" }, + /* 51*/ { UNICODE_MODE, -1, -1, -1, { 1, 2, "A" }, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 549: Structured Append ID not available for MaxiCode", 1, 1, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[1024]; char cmp_buf[32768]; @@ -199,7 +204,7 @@ static void test_input(const testCtx *const p_ctx) { 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"); + testStartSymbol("test_input", &symbol); for (i = 0; i < data_size; i++) { @@ -289,7 +294,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { -1, -1, -1, { 0, 0, "" }, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", -1, "", 0, 33, 30, 1, "ISO/IEC 16023:2000 Figure 2 (and L1), same", "011111010000001000001000100111" "000100000001000000001010000000" @@ -1026,9 +1031,9 @@ static void test_encode(const testCtx *const p_ctx) { "110010001001001011011111100111" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[1024]; char cmp_buf[8192]; @@ -1037,7 +1042,7 @@ static void test_encode(const testCtx *const p_ctx) { 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"); + testStartSymbol("test_encode", &symbol); for (i = 0; i < data_size; i++) { @@ -1123,7 +1128,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, "", 0, 33, 30, 1, "ISO 16023:2000 4.15.4 example", "010101010101010101010101010111" "000000000000000000000000000000" @@ -1440,9 +1445,9 @@ static void test_encode_segs(const testCtx *const p_ctx) { "100101010111100011100010101000" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, j, seg_count, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[1024]; char cmp_buf[8192]; @@ -1451,7 +1456,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { 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_segs"); + testStartSymbol("test_encode_segs", &symbol); for (i = 0; i < data_size; i++) { @@ -1552,7 +1557,7 @@ static void test_best_supported_set(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { "am.//ab,\034TA# z\015!", 0, 100, 100, 0, 33, 30, "Different encodation than BWIPP, same number of codewords", "111010000101111000111101010111" "111110000000010100111000000000" @@ -1589,13 +1594,13 @@ static void test_best_supported_set(const testCtx *const p_ctx) { "010100101001110111101010110010" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped_data[1024]; - testStart("test_best_supported_set"); + testStartSymbol("test_best_supported_set", &symbol); for (i = 0; i < data_size; i++) { @@ -1645,7 +1650,7 @@ static void test_fuzz(const testCtx *const p_ctx) { int ret; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { -1, "\223\223\223\223\223\200\000\060\060\020\122\104\060\343\000\000\040\104\104\104\104\177\377\040\000\324\336\000\000\000\000\104\060\060\060\060\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\104\060\104\104\000\000\000\040\104\104\104\104\177\377\377\377\324\336\000\000\000\000\104\377\104\001\104\104\104\104\104\104\233\233\060\060\060\060\060\060\060\060\060\325\074", 107, ZINT_ERROR_TOO_LONG }, /* Original OSS-Fuzz triggering data */ /* 1*/ { -1, "AaAaAaAaAaAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA123456789", -1, ZINT_ERROR_TOO_LONG }, /* Add 6 lowercase a's so 6 SHIFTS inserted so 6 + 138 (max input len) = 144 and numbers come at end of buffer */ /* 2*/ { -1, "AaAaAaAaAaAaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA123456789A", -1, ZINT_ERROR_TOO_LONG }, @@ -1653,11 +1658,11 @@ static void test_fuzz(const testCtx *const p_ctx) { /* 4*/ { 32768, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", -1, ZINT_ERROR_TOO_LONG }, /* 5*/ { -1, "AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa", -1, ZINT_ERROR_TOO_LONG }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_fuzz"); + testStartSymbol("test_fuzz", &symbol); for (i = 0; i < data_size; i++) { @@ -1698,12 +1703,12 @@ static void test_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_MAXICODE, UNICODE_MODE | ESCAPE_MODE, -1, -1, "1Z34567890\\GUPSN\\G102562\\G034\\G\\G1/1\\G\\GY\\G2201 Second St\\GFt Myers\\GFL\\R\\E", "339010000840001", 0, 33, 30, "Mode 2" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; clock_t start, total_encode = 0, total_buffer = 0, diff_encode, diff_buffer; diff --git a/backend/tests/test_medical.c b/backend/tests/test_medical.c index 15f16de8..261575af 100644 --- a/backend/tests/test_medical.c +++ b/backend/tests/test_medical.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2023 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -44,7 +44,7 @@ static void test_large(const testCtx *const p_ctx) { int expected_width; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODABAR, -1, "A+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++B", 103, 0, 1, 1133 }, /* 1*/ { BARCODE_CODABAR, -1, "A++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++B", 104, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 2*/ { BARCODE_CODABAR, 1, "A+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++B", 103, 0, 1, 1143 }, @@ -56,7 +56,7 @@ static void test_large(const testCtx *const p_ctx) { /* 8*/ { BARCODE_CODE32, -1, "1", 8, 0, 1, 103 }, /* 9*/ { BARCODE_CODE32, -1, "1", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -101,7 +101,7 @@ static void test_hrt(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODABAR, -1, "A1234B", "A1234B" }, /* 1*/ { BARCODE_CODABAR, -1, "a1234c", "A1234C" }, /* Converts to upper */ /* 2*/ { BARCODE_CODABAR, 1, "A1234B", "A1234B" }, /* Check not included */ @@ -113,7 +113,7 @@ static void test_hrt(const testCtx *const p_ctx) { /* 8*/ { BARCODE_CODE32, -1, "123456", "A001234564" }, /* 9*/ { BARCODE_CODE32, -1, "12345678", "A123456788" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -153,35 +153,40 @@ static void test_input(const testCtx *const p_ctx) { const char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 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, "" }, /* 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\"", 1, "" }, /* 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)", 1, "" }, + /* 5*/ { BARCODE_CODABAR, "C123,D", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 357: Invalid character at position 5 in input (\"0123456789-$:/.+ABCD\" only)", 1, "" }, /* 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\"", 1, "" }, - /* 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, "", 1, "" }, - /* 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, "", 1, "" }, - /* 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)", 1, "" }, - /* 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, "", 1, "" }, - /* 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, "", 1, "" }, - /* 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)", 1, "" }, - /* 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)", 1, "" }, - /* 22*/ { BARCODE_CODE32, "12345678", 0, 1, 103, "", 1, "" }, - /* 23*/ { BARCODE_CODE32, "9", 0, 1, 103, "", 0, "BWIPP requires length 8 or 9" }, - /* 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)", 1, "" }, + /* 7*/ { BARCODE_CODABAR, "DCC", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 363: Invalid character at position 1 in input (cannot contain \"A\", \"B\", \"C\" or \"D\")", 1, "" }, + /* 8*/ { BARCODE_CODABAR, "A234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123B", ZINT_ERROR_TOO_LONG, -1, -1, "Error 356: Input length 104 too long (maximum 103)", 1, "" }, + /* 9*/ { BARCODE_CODABAR, "AB", ZINT_ERROR_TOO_LONG, -1, -1, "Error 362: Input length 2 too short (minimum 3)", 1, "" }, + /* 10*/ { BARCODE_PHARMA, "131070", 0, 1, 78, "", 1, "" }, + /* 11*/ { BARCODE_PHARMA, "1310700", ZINT_ERROR_TOO_LONG, -1, -1, "Error 350: Input length 7 too long (maximum 6)", 1, "" }, + /* 12*/ { BARCODE_PHARMA, "131071", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 352: Input value '131071' out of range (3 to 131070)", 1, "" }, + /* 13*/ { BARCODE_PHARMA, "3", 0, 1, 4, "", 1, "" }, + /* 14*/ { BARCODE_PHARMA, "2", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 352: Input value '2' out of range (3 to 131070)", 1, "" }, + /* 15*/ { BARCODE_PHARMA, "1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 352: Input value '1' out of range (3 to 131070)", 1, "" }, + /* 16*/ { BARCODE_PHARMA, "12A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 351: Invalid character at position 3 in input (digits only)", 1, "" }, + /* 17*/ { BARCODE_PHARMA_TWO, "64570080", 0, 2, 31, "", 1, "" }, + /* 18*/ { BARCODE_PHARMA_TWO, "64570081", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Input value '64570081' out of range (4 to 64570080)", 1, "" }, + /* 19*/ { BARCODE_PHARMA_TWO, "064570080", ZINT_ERROR_TOO_LONG, -1, -1, "Error 354: Input length 9 too long (maximum 8)", 1, "" }, + /* 20*/ { BARCODE_PHARMA_TWO, "4", 0, 2, 3, "", 1, "" }, + /* 21*/ { BARCODE_PHARMA_TWO, "3", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Input value '3' out of range (4 to 64570080)", 1, "" }, + /* 22*/ { BARCODE_PHARMA_TWO, "2", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Input value '2' out of range (4 to 64570080)", 1, "" }, + /* 23*/ { BARCODE_PHARMA_TWO, "1", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 353: Input value '1' out of range (4 to 64570080)", 1, "" }, + /* 24*/ { BARCODE_PHARMA_TWO, "123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 355: Invalid character at position 4 in input (digits only)", 1, "" }, + /* 25*/ { BARCODE_CODE32, "12345678", 0, 1, 103, "", 1, "" }, + /* 26*/ { BARCODE_CODE32, "9", 0, 1, 103, "", 0, "BWIPP requires length 8 or 9" }, + /* 27*/ { BARCODE_CODE32, "0", 0, 1, 103, "", 0, "BWIPP requires length 8 or 9" }, + /* 28*/ { BARCODE_CODE32, "123456789", ZINT_ERROR_TOO_LONG, -1, -1, "Error 360: Input length 9 too long (maximum 8)", 1, "" }, + /* 29*/ { BARCODE_CODE32, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 361: Invalid character at position 1 in input (digits only)", 1, "" }, + /* 30*/ { BARCODE_CODE32, "99999999", 0, 1, 103, "", 1, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -245,7 +250,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODABAR, -1, "A37859B", 0, 1, 72, "BS EN 798:1995 Figure 1", "101100100101100101010100101101010011010101101010010110100101010010010110" }, @@ -279,7 +284,7 @@ static void test_encode(const testCtx *const p_ctx) { "1001011011010101101001011010110010110101011011010010101100101101011010010101101010101100110100101101101" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; diff --git a/backend/tests/test_output.c b/backend/tests/test_output.c index 8cce8264..8dddd001 100644 --- a/backend/tests/test_output.c +++ b/backend/tests/test_output.c @@ -44,7 +44,7 @@ static void test_check_colour_options(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "FFFFFF", "000000", 0, "" }, /* 1*/ { "ffffff", "ffffff", 0, "" }, /* 2*/ { "77777777", "33333333", 0, "" }, @@ -57,16 +57,16 @@ static void test_check_colour_options(const testCtx *const p_ctx) { /* 9*/ { "100,,100,100", ",1,2,", 0, "" }, /* 10*/ { "100,100,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "882: Malformed foreground CMYK colour (4 decimal numbers, comma-separated)" }, /* 11*/ { "100,100,99,1001", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "883: Malformed foreground CMYK colour (3 digit maximum per number)" }, - /* 12*/ { "101,100,100,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "884: Malformed foreground CMYK colour C (decimal 0-100 only)" }, - /* 13*/ { "100,101,100,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "885: Malformed foreground CMYK colour M (decimal 0-100 only)" }, - /* 14*/ { "100,100,101,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "886: Malformed foreground CMYK colour Y (decimal 0-100 only)" }, - /* 15*/ { "100,100,100,101", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "887: Malformed foreground CMYK colour K (decimal 0-100 only)" }, + /* 12*/ { "101,100,100,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "884: Malformed foreground CMYK colour C (decimal 0 to 100 only)" }, + /* 13*/ { "100,101,100,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "885: Malformed foreground CMYK colour M (decimal 0 to 100 only)" }, + /* 14*/ { "100,100,101,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "886: Malformed foreground CMYK colour Y (decimal 0 to 100 only)" }, + /* 15*/ { "100,100,100,101", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "887: Malformed foreground CMYK colour K (decimal 0 to 100 only)" }, /* 16*/ { "100,100,100,100", "0,1,", ZINT_ERROR_INVALID_OPTION, "882: Malformed background CMYK colour (4 decimal numbers, comma-separated)" }, /* 17*/ { "100,100,100,100", "0,0123,3,4", ZINT_ERROR_INVALID_OPTION, "883: Malformed background CMYK colour (3 digit maximum per number)" }, - /* 18*/ { "100,100,100,100", "0,1,2,101", ZINT_ERROR_INVALID_OPTION, "887: Malformed background CMYK colour K (decimal 0-100 only)" }, + /* 18*/ { "100,100,100,100", "0,1,2,101", ZINT_ERROR_INVALID_OPTION, "887: Malformed background CMYK colour K (decimal 0 to 100 only)" }, /* 19*/ { "100,100,100,100", "0,1,2,3,", ZINT_ERROR_INVALID_OPTION, "882: Malformed background CMYK colour (4 decimal numbers, comma-separated)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, ret; struct zint_symbol symbol; @@ -99,7 +99,7 @@ static void test_colour_get_rgb(const testCtx *const p_ctx) { char *expected_cmyk; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "FFFFFF", 0, 0xFF, 0xFF, 0xFF, 0xFF, "0,0,0,0" }, /* 1*/ { "000000", 0, 0x00, 0x00, 0x00, 0xFF, "0,0,0,100" }, /* 2*/ { "FEDCBA", 0, 0xFE, 0xDC, 0xBA, 0xFF, "0,13,27,0" }, @@ -113,7 +113,7 @@ static void test_colour_get_rgb(const testCtx *const p_ctx) { /* 10*/ { "80,30,60,0", 0, 0x33, 0xB3, 0x66, 0xFF, "72,0,43,30" }, /* 11*/ { "50,50,50,50", 0, 0x40, 0x40, 0x40, 0xFF, "0,0,0,75" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, ret; testStart("test_colour_get_rgb"); @@ -165,7 +165,7 @@ static void test_colour_get_cmyk(const testCtx *const p_ctx) { int ret_rgb; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "80,30,60,0", 0, 80, 30, 60, 0, 0xFF, "33B366FF", 0 }, /* 1*/ { "50,50,50,50", 0, 50, 50, 50, 50, 0xFF, "404040FF", 0 }, /* 2*/ { "0,0,0,100", 0, 0, 0, 0, 100, 0xFF, "000000FF", 0 }, @@ -173,7 +173,7 @@ static void test_colour_get_cmyk(const testCtx *const p_ctx) { /* 4*/ { "123456", 1, 79, 40, 0, 44, 0xFF, "123456FF", 0 }, /* 5*/ { "12345678", 2, 79, 40, 0, 44, 0x78, "12345678", 1 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, ret; testStart("test_colour_get_cmyk"); @@ -249,7 +249,7 @@ static void test_set_whitespace_offsets(const testCtx *const p_ctx) { float expected_qz_right; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, 1, 0, 0, 0, 0, 0, 0.0f, /*expected*/ 1.0f, 0.0f, 1.0f, 0.0f, 0.0f }, /* 1*/ { BARCODE_CODE128, 2, 0, 0, 0, 0, 0, 1.0f, /*expected*/ 2.0f, 0.0f, 2.0f, 0.0f, 0.0f }, /* 2*/ { BARCODE_CODE128, 2, 3, 0, 0, 0, 0, 1.0f, /*expected*/ 2.0f, 3.0f, 2.0f, 3.0f, 0.0f }, @@ -263,7 +263,7 @@ static void test_set_whitespace_offsets(const testCtx *const p_ctx) { /* 10*/ { BARCODE_CODE128, 2, 3, 1, BARCODE_BIND_TOP | BARCODE_BOX | BARCODE_BIND, 0, 0, 1.0f, /*expected*/ 3.0f, 4.0f, 3.0f, 3.0f, 0.0f }, /* BIND_TOP wins */ /* 11*/ { BARCODE_CODE128, 2, 3, 1, BARCODE_BOX | BARCODE_QUIET_ZONES, 0, 0, 1.0f, /*expected*/ 13.0f, 4.0f, 13.0f, 4.0f, 10.0f }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i; struct zint_symbol symbol = {0}; float xoffset, yoffset, roffset, boffset, qz_right; @@ -329,7 +329,7 @@ static void test_fopen(const testCtx *const p_ctx) { int succeed; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "", "", "out.png", 1 }, /* 1*/ { "out_test", "", "out.png", 1 }, /* 2*/ { "out_test_with_subdir", "out_test_subdir", "out.png", 1 }, @@ -347,7 +347,7 @@ static void test_fopen(const testCtx *const p_ctx) { /* 14*/ { "", "", "outé.png", 1 }, /* 15*/ { "outé_test", "", "outé.png", 1 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, len; FILE *ret; diff --git a/backend/tests/test_pcx.c b/backend/tests/test_pcx.c index bf4eaa60..d326e59d 100644 --- a/backend/tests/test_pcx.c +++ b/backend/tests/test_pcx.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2023 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -49,14 +49,14 @@ static void test_print(const testCtx *const p_ctx) { char *expected_file; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_GRIDMATRIX, -1, -1, -1, -1, -1, -1, "C3C3C3", "", 0.75, "Grid Matrix", "gridmatrix_fg_0.75.pcx" }, /* 1*/ { BARCODE_CODABLOCKF, -1, -1, -1, -1, -1, 20, "FFFFFF", "000000", 0, "1234567890123456789012345678901234567890", "codeblockf_reverse.pcx" }, /* 2*/ { BARCODE_QRCODE, -1, -1, -1, -1, 2, 1, "", "D2E3F4", 0, "1234567890", "qr_bg.pcx" }, /* 3*/ { BARCODE_ULTRA, 1, BARCODE_BOX, 1, 1, -1, -1, "FF0000", "0000FF", 0, "ULTRACODE_123456789!", "ultra_fg_bg_hvwsp1_box1.pcx" }, /* 4*/ { BARCODE_CODE11, -1, -1, -1, -1, -1, -1, "12345678", "FEDCBA98", 0, "123", "code11_fgbgtrans.pcx" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; @@ -182,12 +182,15 @@ static void test_outfile(const testCtx *const p_ctx) { skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ #endif if (!skip_readonly_test) { + static char expected_errtxt[] = "621: Could not open PCX output file ("; /* Excluding OS-dependent `errno` stuff */ + (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ assert_nonzero(testUtilCreateROFile(symbol.outfile), "pcx_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret = pcx_pixel_plot(&symbol, data); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "pcx_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "pcx_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); + assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); } symbol.output_options |= BARCODE_STDOUT; diff --git a/backend/tests/test_pdf417.c b/backend/tests/test_pdf417.c index 55e4a553..59a2a5df 100644 --- a/backend/tests/test_pdf417.c +++ b/backend/tests/test_pdf417.c @@ -47,19 +47,21 @@ static void test_large(const testCtx *const p_ctx) { char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_PDF417, 0, -1, -1, "A", 1850, 0, 32, 562, "" }, - /* 1*/ { BARCODE_PDF417, 0, -1, -1, "A", 1851, ZINT_ERROR_TOO_LONG, -1, -1, "Error 464: Input string too long" }, + /* 1*/ { BARCODE_PDF417, 0, -1, -1, "A", 1851, ZINT_ERROR_TOO_LONG, -1, -1, "Error 464: Input too long, requires too many codewords (maximum 928)" }, /* 2*/ { BARCODE_PDF417, 0, -1, -1, "\200", 1108, 0, 32, 562, "" }, - /* 3*/ { BARCODE_PDF417, 0, -1, -1, "\200", 1109, ZINT_ERROR_TOO_LONG, -1, -1, "Error 464: Input string too long" }, + /* 3*/ { BARCODE_PDF417, 0, -1, -1, "\200", 1109, ZINT_ERROR_TOO_LONG, -1, -1, "Error 464: Input too long, requires too many codewords (maximum 928)" }, /* 4*/ { BARCODE_PDF417, 0, -1, -1, "1", 2710, 0, 32, 562, "" }, - /* 5*/ { BARCODE_PDF417, 0, -1, -1, "1", 2711, ZINT_ERROR_TOO_LONG, -1, -1, "Error 463: Input string too long" }, - /* 6*/ { BARCODE_PDF417, 0, -1, 59, "A", 1850, ZINT_ERROR_TOO_LONG, -1, -1, "Error 465: Data too long for specified number of rows" }, - /* 7*/ { BARCODE_PDF417, 0, 1, 3, "A", 1850, ZINT_ERROR_TOO_LONG, 32, 562, "Error 745: Data too long for specified number of columns" }, - /* 8*/ { BARCODE_PDF417, 0, -1, 3, "A", 1850, ZINT_WARN_INVALID_OPTION, 32, 562, "Warning 746: Rows increased from 3 to 32" }, - /* 9*/ { BARCODE_PDF417, 0, 30, -1, "A", 1850, ZINT_ERROR_TOO_LONG, 32, 562, "Error 747: Data too long for specified number of columns" }, + /* 5*/ { BARCODE_PDF417, 0, -1, -1, "1", 2711, ZINT_ERROR_TOO_LONG, -1, -1, "Error 463: Input length 2711 too long (maximum 2710)" }, + /* 6*/ { BARCODE_PDF417, 0, -1, 59, "A", 1850, ZINT_ERROR_TOO_LONG, -1, -1, "Error 465: Input too long, requires too many codewords (maximum 928)" }, + /* 7*/ { BARCODE_PDF417, 0, 1, 3, "A", 1850, ZINT_ERROR_TOO_LONG, -1, -1, "Error 745: Input too long for number of columns '1'" }, + /* 8*/ { BARCODE_PDF417, 0, -1, 3, "A", 1850, ZINT_WARN_INVALID_OPTION, 32, 562, "Warning 746: Number of rows increased from 3 to 32" }, + /* 9*/ { BARCODE_PDF417, 0, 30, -1, "A", 1850, ZINT_ERROR_TOO_LONG, -1, -1, "Error 747: Input too long, requires too many codewords (maximum 928)" }, + /* 10*/ { BARCODE_MICROPDF417, 0, -1, -1, "A", 250, 0, 44, 99, "" }, + /* 11*/ { BARCODE_MICROPDF417, 0, -1, -1, "A", 251, ZINT_ERROR_TOO_LONG, -1, -1, "Error 467: Input too long, requires 127 codewords (maximum 126)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -131,60 +133,60 @@ static void test_options(const testCtx *const p_ctx) { int compare_previous; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_PDF417, -1, -1, -1, 0, { 0, 0, "" }, "12345", 0, 0, 6, 103, "", -1 }, /* ECC auto-set to 2, cols auto-set to 2 */ - /* 1*/ { BARCODE_PDF417, -1, -1, 928, 0, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 466: Number of rows out of range (3 to 90)", -1 }, /* Option 3 no longer ignored */ - /* 2*/ { BARCODE_PDF417, -1, -1, 1, 0, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 466: Number of rows out of range (3 to 90)", -1 }, /* Option 3 no longer ignored */ + /* 1*/ { BARCODE_PDF417, -1, -1, 928, 0, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 466: Number of rows '928' out of range (3 to 90)", -1 }, /* Option 3 no longer ignored */ + /* 2*/ { BARCODE_PDF417, -1, -1, 1, 0, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 466: Number of rows '1' out of range (3 to 90)", -1 }, /* Option 3 no longer ignored */ /* 3*/ { BARCODE_PDF417, 3, -1, -1, 0, { 0, 0, "" }, "12345", 0, 0, 7, 120, "", -1 }, /* ECC 3, cols auto-set to 3 */ /* 4*/ { BARCODE_PDF417, 3, 2, -1, 0, { 0, 0, "" }, "12345", 0, 0, 10, 103, "", -1 }, /* ECC 3, cols 2 */ - /* 5*/ { BARCODE_PDF417, 8, 2, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, 86, 171, "Warning 748: Columns increased from 2 to 6", -1 }, /* ECC 8, cols 2, used to fail, now auto-upped to 3 with warning */ - /* 6*/ { BARCODE_PDF417, 8, 2, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, 0, 86, 171, "Error 748: Columns increased from 2 to 6", -1 }, - /* 7*/ { BARCODE_PDF417, 7, 2, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, 87, 120, "Warning 748: Columns increased from 2 to 3", -1 }, /* ECC 7, cols 2 auto-upped to 3 but now with warning */ - /* 8*/ { BARCODE_PDF417, 7, 2, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, 0, 87, 120, "Error 748: Columns increased from 2 to 3", -1 }, + /* 5*/ { BARCODE_PDF417, 8, 2, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, 86, 171, "Warning 748: Number of columns increased from 2 to 6", -1 }, /* ECC 8, cols 2, used to fail, now auto-upped to 3 with warning */ + /* 6*/ { BARCODE_PDF417, 8, 2, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, 0, 86, 171, "Error 748: Number of columns increased from 2 to 6", -1 }, + /* 7*/ { BARCODE_PDF417, 7, 2, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, 87, 120, "Warning 748: Number of columns increased from 2 to 3", -1 }, /* ECC 7, cols 2 auto-upped to 3 but now with warning */ + /* 8*/ { BARCODE_PDF417, 7, 2, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, 0, 87, 120, "Error 748: Number of columns increased from 2 to 3", -1 }, /* 9*/ { BARCODE_PDF417, -1, 10, -1, 0, { 0, 0, "" }, "12345", 0, 0, 3, 239, "", -1 }, /* ECC auto-set to 2, cols 10 */ - /* 10*/ { BARCODE_PDF417, 9, -1, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, 6, 103, "Warning 460: Security value out of range (0 to 8), ignored", -1 }, /* Invalid ECC, auto-set */ - /* 11*/ { BARCODE_PDF417, -1, 31, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, 6, 103, "Warning 461: Number of columns out of range (1 to 30), ignored", 0 }, /* Invalid cols, auto-set */ - /* 12*/ { BARCODE_PDF417, -1, -1, 2, 0, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 466: Number of rows out of range (3 to 90)", -1 }, /* Invalid rows, error */ - /* 13*/ { BARCODE_PDF417, -1, -1, 91, 0, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 466: Number of rows out of range (3 to 90)", -1 }, /* Invalid rows, error */ - /* 14*/ { BARCODE_PDF417, 9, -1, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 462: Security value out of range (0 to 8)", -1 }, /* Invalid ECC */ - /* 15*/ { BARCODE_PDF417, -1, 31, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 473: Number of columns out of range (1 to 30)", -1 }, /* Invalid cols */ - /* 16*/ { BARCODE_PDF417, -1, 30, 31, 0, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 475: Columns x rows out of range (1 to 928)", -1 }, /* Rows * cols (930) > 928 */ - /* 17*/ { BARCODE_PDF417, -1, 1, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI", ZINT_WARN_INVALID_OPTION, 0, 65, 120, "Warning 748: Columns increased from 1 to 3", -1 }, /* Cols 1 too small, used to fail, now auto-upped to 3 with warning */ + /* 10*/ { BARCODE_PDF417, 9, -1, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, 6, 103, "Warning 460: Error correction level '9' out of range (0 to 8), ignoring", -1 }, /* Invalid ECC, auto-set */ + /* 11*/ { BARCODE_PDF417, -1, 31, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, 6, 103, "Warning 461: Number of columns '31' out of range (1 to 30), ignoring", 0 }, /* Invalid cols, auto-set */ + /* 12*/ { BARCODE_PDF417, -1, -1, 2, 0, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 466: Number of rows '2' out of range (3 to 90)", -1 }, /* Invalid rows, error */ + /* 13*/ { BARCODE_PDF417, -1, -1, 91, 0, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 466: Number of rows '91' out of range (3 to 90)", -1 }, /* Invalid rows, error */ + /* 14*/ { BARCODE_PDF417, 9, -1, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 460: Error correction level '9' out of range (0 to 8)", -1 }, /* Invalid ECC */ + /* 15*/ { BARCODE_PDF417, -1, 31, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 461: Number of columns '31' out of range (1 to 30)", -1 }, /* Invalid cols */ + /* 16*/ { BARCODE_PDF417, -1, 30, 31, 0, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 475: Columns x rows value '930' out of range (1 to 928)", -1 }, /* Rows * cols (930) > 928 */ + /* 17*/ { BARCODE_PDF417, -1, 1, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI", ZINT_WARN_INVALID_OPTION, 0, 65, 120, "Warning 748: Number of columns increased from 1 to 3", -1 }, /* Cols 1 too small, used to fail, now auto-upped to 3 with warning */ /* 18*/ { BARCODE_PDF417, -1, -1, 4, 0, { 0, 0, "" }, "12345", 0, 0, 4, 120, "", -1 }, /* Specify rows 4 (cols 3) */ /* 19*/ { BARCODE_PDF417, -1, 3, 4, 0, { 0, 0, "" }, "12345", 0, 0, 4, 120, "", 0 }, /* Specify cols 3 & rows 4 */ /* 20*/ { BARCODE_PDF417, -1, -1, 90, 0, { 0, 0, "" }, "12345", 0, 0, 90, 86, "", -1 }, /* Specify rows 90 (cols 1) */ /* 21*/ { BARCODE_PDF417, 0, -1, 3, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", 0, 0, 3, 579, "", -1 }, /* Specify rows 3, max cols 30 */ /* 22*/ { BARCODE_PDF417, 0, 30, 3, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", 0, 0, 3, 579, "", 0 }, /* Specify rows 3, cols 30 */ - /* 23*/ { BARCODE_PDF417, 0, 29, 3, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", ZINT_WARN_INVALID_OPTION, 0, 4, 562, "Warning 746: Rows increased from 3 to 4", -1 }, /* Specify rows 3, cols 29, rows auto-upped to 4 */ - /* 24*/ { BARCODE_MICROPDF417, -1, 5, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, 11, 38, "Warning 468: Specified width out of range", -1 }, /* Invalid cols, auto-set to 1 */ - /* 25*/ { BARCODE_MICROPDF417, -1, 5, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 468: Specified width out of range", -1 }, /* Invalid cols */ + /* 23*/ { BARCODE_PDF417, 0, 29, 3, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", ZINT_WARN_INVALID_OPTION, 0, 4, 562, "Warning 746: Number of rows increased from 3 to 4", -1 }, /* Specify rows 3, cols 29, rows auto-upped to 4 */ + /* 24*/ { BARCODE_MICROPDF417, -1, 5, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, 11, 38, "Warning 468: Number of columns '5' out of range (1 to 4), ignoring", -1 }, /* Invalid cols, auto-set to 1 */ + /* 25*/ { BARCODE_MICROPDF417, -1, 5, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 471: Number of columns '5' out of range (1 to 4)", -1 }, /* Invalid cols */ /* 26*/ { BARCODE_MICROPDF417, -1, 5, 3, 0, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 476: Cannot specify rows for MicroPDF417", -1 }, /* Rows option not available */ - /* 27*/ { BARCODE_MICROPDF417, -1, 1, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM", ZINT_WARN_INVALID_OPTION, 0, 17, 55, "Warning 469: Specified symbol size too small for data", -1 }, /* Cols 1 too small, auto-upped to 2 with warning */ - /* 28*/ { BARCODE_MICROPDF417, -1, 1, -1, WARN_FAIL_ALL, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM", ZINT_ERROR_INVALID_OPTION, ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 469: Specified symbol size too small for data", -1 }, /* Cols 1 too small */ - /* 29*/ { BARCODE_MICROPDF417, -1, 2, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWX", ZINT_WARN_INVALID_OPTION, 0, 15, 99, "Warning 470: Specified symbol size too small for data", -1 }, /* Cols 2 too small, auto-upped to 4 with warning */ - /* 30*/ { BARCODE_MICROPDF417, -1, 2, -1, WARN_FAIL_ALL, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWX", ZINT_ERROR_INVALID_OPTION, ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 470: Specified symbol size too small for data", -1 }, /* Cols 2 too small */ - /* 31*/ { BARCODE_MICROPDF417, -1, 3, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKL", ZINT_WARN_INVALID_OPTION, 0, 32, 99, "Warning 471: Specified symbol size too small for data", -1 }, /* Cols 3 too small, auto-upped to 4 with warning */ - /* 32*/ { BARCODE_MICROPDF417, -1, 3, -1, WARN_FAIL_ALL, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKL", ZINT_ERROR_INVALID_OPTION, ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 471: Specified symbol size too small for data", -1 }, /* Cols 3 too small */ - /* 33*/ { BARCODE_PDF417, -1, 1, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH", ZINT_WARN_INVALID_OPTION, 0, 89, 103, "Warning 748: Columns increased from 1 to 2", -1 }, /* Cols 1 auto-upped to 2 just fits, now with warning */ - /* 34*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH", ZINT_WARN_INVALID_OPTION, 0, 67, 120, "Warning 748: Columns increased from 1 to 3", -1 }, /* Cols 1 too small with Structured Append, used to fail, now auto-upped to 3 with warning */ - /* 35*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_WARN_INVALID_OPTION, 0, 89, 103, "Warning 748: Columns increased from 1 to 2", -1 }, /* Cols 1 with Structured Append auto-upped to 2 just fits, now with warning */ - /* 36*/ { BARCODE_PDF417, -1, 1, -1, 0, { 2, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTU", ZINT_WARN_INVALID_OPTION, 0, 65, 120, "Warning 748: Columns increased from 1 to 3", -1 }, /* Cols 1 too small with Structured Append as last symbol (uses extra terminating codeword), used to fail, now auto-upped to 3 with warning */ - /* 37*/ { BARCODE_PDF417, -1, 1, -1, 0, { 2, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", ZINT_WARN_INVALID_OPTION, 0, 89, 103, "Warning 748: Columns increased from 1 to 2", -1 }, /* Cols 1 with Structured Append as last symbol just fits with 1 less character pair when auto-upped to 2, now with warning */ - /* 38*/ { BARCODE_PDF417, -1, 1, -1, 0, { 3, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 741: Structured Append index out of range (1-2)", -1 }, - /* 39*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 1, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 740: Structured Append count out of range (2-99999)", -1 }, - /* 40*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 100000, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 740: Structured Append count out of range (2-99999)", -1 }, - /* 41*/ { BARCODE_PDF417, -1, 1, -1, 0, { 0, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 741: Structured Append index out of range (1-2)", -1 }, - /* 42*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "1" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", ZINT_WARN_INVALID_OPTION, 0, 89, 103, "Warning 748: Columns increased from 1 to 2", -1 }, /* Now with warning */ - /* 43*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "123123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP", ZINT_WARN_INVALID_OPTION, 0, 89, 103, "Warning 748: Columns increased from 1 to 2", -1 }, /* Now with warning */ - /* 44*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "123123123123123123123123123123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", ZINT_WARN_INVALID_OPTION, 0, 89, 103, "Warning 748: Columns increased from 1 to 2", -1 }, /* Now with warning */ - /* 45*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "1231231231231231231231231231231" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 742: Structured Append ID too long (30 digit maximum)", -1 }, - /* 46*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "23123123123123123123123123123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", ZINT_WARN_INVALID_OPTION, 0, 89, 103, "Warning 748: Columns increased from 1 to 2", -1 }, /* Now with warning */ + /* 27*/ { BARCODE_MICROPDF417, -1, 1, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM", ZINT_WARN_INVALID_OPTION, 0, 17, 55, "Warning 470: Input too long for number of columns '1', ignoring", -1 }, /* Cols 1 too small, auto-upped to 2 with warning */ + /* 28*/ { BARCODE_MICROPDF417, -1, 1, -1, WARN_FAIL_ALL, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM", ZINT_ERROR_INVALID_OPTION, ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 469: Input too long for number of columns '1', requires 21 codewords (maximum 20)", -1 }, /* Cols 1 too small */ + /* 29*/ { BARCODE_MICROPDF417, -1, 2, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWX", ZINT_WARN_INVALID_OPTION, 0, 15, 99, "Warning 470: Input too long for number of columns '2', ignoring", -1 }, /* Cols 2 too small, auto-upped to 4 with warning */ + /* 30*/ { BARCODE_MICROPDF417, -1, 2, -1, WARN_FAIL_ALL, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWX", ZINT_ERROR_INVALID_OPTION, ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 469: Input too long for number of columns '2', requires 38 codewords (maximum 37)", -1 }, /* Cols 2 too small */ + /* 31*/ { BARCODE_MICROPDF417, -1, 3, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKL", ZINT_WARN_INVALID_OPTION, 0, 32, 99, "Warning 470: Input too long for number of columns '3', ignoring", -1 }, /* Cols 3 too small, auto-upped to 4 with warning */ + /* 32*/ { BARCODE_MICROPDF417, -1, 3, -1, WARN_FAIL_ALL, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKL", ZINT_ERROR_INVALID_OPTION, ZINT_ERROR_INVALID_OPTION, 0, 0, "Error 469: Input too long for number of columns '3', requires 83 codewords (maximum 82)", -1 }, /* Cols 3 too small */ + /* 33*/ { BARCODE_PDF417, -1, 1, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH", ZINT_WARN_INVALID_OPTION, 0, 89, 103, "Warning 748: Number of columns increased from 1 to 2", -1 }, /* Cols 1 auto-upped to 2 just fits, now with warning */ + /* 34*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH", ZINT_WARN_INVALID_OPTION, 0, 67, 120, "Warning 748: Number of columns increased from 1 to 3", -1 }, /* Cols 1 too small with Structured Append, used to fail, now auto-upped to 3 with warning */ + /* 35*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_WARN_INVALID_OPTION, 0, 89, 103, "Warning 748: Number of columns increased from 1 to 2", -1 }, /* Cols 1 with Structured Append auto-upped to 2 just fits, now with warning */ + /* 36*/ { BARCODE_PDF417, -1, 1, -1, 0, { 2, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTU", ZINT_WARN_INVALID_OPTION, 0, 65, 120, "Warning 748: Number of columns increased from 1 to 3", -1 }, /* Cols 1 too small with Structured Append as last symbol (uses extra terminating codeword), used to fail, now auto-upped to 3 with warning */ + /* 37*/ { BARCODE_PDF417, -1, 1, -1, 0, { 2, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", ZINT_WARN_INVALID_OPTION, 0, 89, 103, "Warning 748: Number of columns increased from 1 to 2", -1 }, /* Cols 1 with Structured Append as last symbol just fits with 1 less character pair when auto-upped to 2, now with warning */ + /* 38*/ { BARCODE_PDF417, -1, 1, -1, 0, { 3, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 741: Structured Append index '3' out of range (1 to count 2)", -1 }, + /* 39*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 1, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 740: Structured Append count '1' out of range (2 to 99999)", -1 }, + /* 40*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 100000, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 740: Structured Append count '100000' out of range (2 to 99999)", -1 }, + /* 41*/ { BARCODE_PDF417, -1, 1, -1, 0, { 0, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 741: Structured Append index '0' out of range (1 to count 2)", -1 }, + /* 42*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "1" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", ZINT_WARN_INVALID_OPTION, 0, 89, 103, "Warning 748: Number of columns increased from 1 to 2", -1 }, /* Now with warning */ + /* 43*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "123123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP", ZINT_WARN_INVALID_OPTION, 0, 89, 103, "Warning 748: Number of columns increased from 1 to 2", -1 }, /* Now with warning */ + /* 44*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "123123123123123123123123123123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", ZINT_WARN_INVALID_OPTION, 0, 89, 103, "Warning 748: Number of columns increased from 1 to 2", -1 }, /* Now with warning */ + /* 45*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "1231231231231231231231231231231" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 742: Structured Append ID length 31 too long (30 digit maximum)", -1 }, + /* 46*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "23123123123123123123123123123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", ZINT_WARN_INVALID_OPTION, 0, 89, 103, "Warning 748: Number of columns increased from 1 to 2", -1 }, /* Now with warning */ /* 47*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "A" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 743: Invalid Structured Append ID (digits only)", -1 }, - /* 48*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "900" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 744: Structured Append ID triplet 1 '900' out of range (000-899)", -1 }, - /* 49*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "123123123123123123123123901123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 744: Structured Append ID triplet 9 '901' out of range (000-899)", -1 }, - /* 50*/ { BARCODE_MICROPDF417, -1, -1, -1, 0, { 1, 2, "1231231231231231231231231231231" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 742: Structured Append ID too long (30 digit maximum)", -1 }, /* Micro PDF417 same error checking code */ + /* 48*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "900" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 744: Structured Append ID triplet 1 value '900' out of range (000 to 899)", -1 }, + /* 49*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "123123123123123123123123901123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 744: Structured Append ID triplet 9 value '901' out of range (000 to 899)", -1 }, + /* 50*/ { BARCODE_MICROPDF417, -1, -1, -1, 0, { 1, 2, "1231231231231231231231231231231" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 742: Structured Append ID length 31 too long (30 digit maximum)", -1 }, /* Micro PDF417 same error checking code */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -251,11 +253,11 @@ static void test_reader_init(const testCtx *const p_ctx) { char *expected; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_PDF417, UNICODE_MODE, READER_INIT, "A", 0, 6, 103, "(12) 4 921 29 900 209 917 46 891 522 472 822 385", "Outputs Test Alpha flag 900" }, /* 1*/ { BARCODE_MICROPDF417, UNICODE_MODE, READER_INIT, "A", 0, 11, 38, "(11) 921 900 29 900 179 499 922 262 777 478 300", "Outputs Test Alpha flag 900" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -335,7 +337,7 @@ static void test_input(const testCtx *const p_ctx) { }; /* é U+00E9 (\351, 233), UTF-8 C3A9 */ /* β U+03B2 in ISO 8859-7 Greek (but not other ISO 8859 or Win page) (\342, 226), UTF-8 CEB2 */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, "é", 0, 0, 6, 103, "(12) 4 913 233 900 398 878 279 350 217 295 231 77", 1, "" }, /* 1*/ { BARCODE_PDF417, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "é", 0, 0, 6, 103, "(12) 4 913 233 900 398 878 279 350 217 295 231 77", 1, "" }, /* 2*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, 3, -1, -1, { 0, 0, "" }, "é", 0, 3, 7, 103, "(14) 6 927 3 913 233 900 162 81 551 529 607 384 164 108", 1, "" }, @@ -346,7 +348,7 @@ static void test_input(const testCtx *const p_ctx) { /* 7*/ { BARCODE_PDF417, UNICODE_MODE, 9, -1, -1, { 0, 0, "" }, "β", 0, 9, 7, 103, "(14) 6 927 9 913 226 900 487 92 418 278 838 500 576 84", 1, "" }, /* 8*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, "β", ZINT_WARN_USES_ECI, 9, 7, 103, "Warning (14) 6 927 9 913 226 900 487 92 418 278 838 500 576 84", 1, "" }, /* 9*/ { BARCODE_PDF417, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "β", ZINT_WARN_USES_ECI, 9, 7, 103, "Warning (14) 6 927 9 913 226 900 487 92 418 278 838 500 576 84", 1, "" }, - /* 10*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, 3, -1, -1, { 0, 0, "" }, "β", ZINT_ERROR_INVALID_DATA, 3, 0, 0, "Error 244: Invalid character in input data for ECI 3", 1, "" }, + /* 10*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, 3, -1, -1, { 0, 0, "" }, "β", ZINT_ERROR_INVALID_DATA, 3, 0, 0, "Error 244: Invalid character in input for ECI '3'", 1, "" }, /* 11*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, 899, -1, -1, { 0, 0, "" }, "A", 0, 899, 6, 103, "(12) 4 927 899 29 567 272 3 384 796 210 839 746", 0, "BWIPP BYTE1" }, /* 12*/ { BARCODE_PDF417, UNICODE_MODE, 899, -1, -1, { 0, 0, "" }, "A", 0, 899, 6, 103, "(12) 4 927 899 29 567 272 3 384 796 210 839 746", 0, "BWIPP BYTE1" }, /* 13*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, 900, -1, -1, { 0, 0, "" }, "A", 0, 900, 7, 103, "(14) 6 926 0 0 29 900 205 526 248 527 915 616 104 416", 0, "BWIPP BYTE1" }, @@ -357,7 +359,7 @@ static void test_input(const testCtx *const p_ctx) { /* 18*/ { BARCODE_PDF417, UNICODE_MODE, 810900, -1, -1, { 0, 0, "" }, "A", 0, 810900, 6, 103, "(12) 4 925 0 29 682 61 599 519 256 742 797 153", 0, "BWIPP BYTE1" }, /* 19*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, 811799, -1, -1, { 0, 0, "" }, "A", 0, 811799, 6, 103, "(12) 4 925 899 29 447 238 770 706 58 39 749 743", 0, "BWIPP BYTE1" }, /* 20*/ { BARCODE_PDF417, UNICODE_MODE, 811799, -1, -1, { 0, 0, "" }, "A", 0, 811799, 6, 103, "(12) 4 925 899 29 447 238 770 706 58 39 749 743", 0, "BWIPP BYTE1" }, - /* 21*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, 811800, -1, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, 811800, 0, 0, "Error 472: Invalid ECI", 1, "" }, + /* 21*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, 811800, -1, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, 811800, 0, 0, "Error 472: ECI code '811800' out of range (0 to 811799)", 1, "" }, /* 22*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, "é", 0, 0, 11, 38, "(11) 901 233 900 900 310 142 569 141 677 300 494", 1, "" }, /* 23*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "é", 0, 0, 11, 38, "(11) 901 233 900 900 310 142 569 141 677 300 494", 1, "" }, /* 24*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, 3, -1, -1, { 0, 0, "" }, "é", 0, 3, 11, 38, "(11) 927 3 901 233 657 863 824 246 172 292 833", 1, "" }, @@ -370,7 +372,7 @@ static void test_input(const testCtx *const p_ctx) { /* 31*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "β", ZINT_WARN_USES_ECI, 9, 11, 38, "Warning (11) 927 9 901 226 806 489 813 191 671 146 327", 1, "" }, /* 32*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, "β", ZINT_WARN_USES_ECI, 9, 11, 38, "Warning (11) 927 9 901 226 806 489 813 191 671 146 327", 1, "" }, /* 33*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "β", ZINT_WARN_USES_ECI, 9, 11, 38, "Warning (11) 927 9 901 226 806 489 813 191 671 146 327", 1, "" }, - /* 34*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, 3, -1, -1, { 0, 0, "" }, "β", ZINT_ERROR_INVALID_DATA, 3, 0, 0, "Error 244: Invalid character in input data for ECI 3", 1, "" }, + /* 34*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, 3, -1, -1, { 0, 0, "" }, "β", ZINT_ERROR_INVALID_DATA, 3, 0, 0, "Error 244: Invalid character in input for ECI '3'", 1, "" }, /* 35*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, 899, -1, -1, { 0, 0, "" }, "A", 0, 899, 11, 38, "(11) 927 899 900 29 533 437 884 3 617 241 747", 0, "BWIPP BYTE" }, /* 36*/ { BARCODE_MICROPDF417, UNICODE_MODE, 899, -1, -1, { 0, 0, "" }, "A", 0, 899, 11, 38, "(11) 927 899 900 29 533 437 884 3 617 241 747", 0, "BWIPP BYTE" }, /* 37*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, 900, -1, 3, { 0, 0, "" }, "A", 0, 900, 6, 82, "(18) 926 0 0 900 29 900 913 543 414 141 214 886 461 1 419 422 54 495", 0, "BWIPP BYTE" }, @@ -379,9 +381,9 @@ static void test_input(const testCtx *const p_ctx) { /* 40*/ { BARCODE_MICROPDF417, UNICODE_MODE, 810899, -1, 3, { 0, 0, "" }, "A", 0, 810899, 6, 82, "(18) 926 899 899 900 29 900 351 555 241 509 787 583 3 326 41 628 534 151", 0, "BWIPP BYTE" }, /* 41*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, 810900, -1, 1, { 0, 0, "" }, "A", 0, 810900, 11, 38, "(11) 925 0 900 29 233 533 43 483 708 659 704", 0, "BWIPP BYTE" }, /* 42*/ { BARCODE_MICROPDF417, UNICODE_MODE, 810900, -1, 1, { 0, 0, "" }, "A", 0, 810900, 11, 38, "(11) 925 0 900 29 233 533 43 483 708 659 704", 0, "BWIPP BYTE" }, - /* 43*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, 811800, -1, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, 811800, 0, 0, "Error 472: Invalid ECI", 0, "BWIPP BYTE" }, - /* 44*/ { BARCODE_HIBC_PDF, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, ",", ZINT_ERROR_INVALID_DATA, 0, 0, 0, "Error 203: Invalid character in data (alphanumerics, space and \"-.$/+%\" only)", 1, "" }, - /* 45*/ { BARCODE_HIBC_MICPDF, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, ",", ZINT_ERROR_INVALID_DATA, 0, 0, 0, "Error 203: Invalid character in data (alphanumerics, space and \"-.$/+%\" only)", 1, "" }, + /* 43*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, 811800, -1, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, 811800, 0, 0, "Error 472: ECI code '811800' out of range (0 to 811799)", 0, "BWIPP BYTE" }, + /* 44*/ { BARCODE_HIBC_PDF, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, ",", ZINT_ERROR_INVALID_DATA, 0, 0, 0, "Error 203: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)", 1, "" }, + /* 45*/ { BARCODE_HIBC_MICPDF, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, ",", ZINT_ERROR_INVALID_DATA, 0, 0, 0, "Error 203: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)", 1, "" }, /* 46*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, "AB{} C#+ de{} {}F 12{} G{} H", 0, 0, 12, 120, "(36) 28 1 865 807 896 782 855 626 807 94 865 807 896 808 776 839 176 808 32 776 839 806 208", 0, "BWIPP different encodation (3 codewords shorter)" }, /* 47*/ { BARCODE_PDF417, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "AB{} C#+ de{} {}F 12{} G{} H", 0, 0, 11, 120, "(33) 25 1 896 897 806 88 470 806 813 149 809 836 809 809 837 178 806 32 776 839 806 209 809", 0, "BWIPP different encodation, same codeword count" }, /* 48*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, "{} #+ de{} 12{} {} H", 0, 0, 10, 120, "(30) 22 865 807 896 808 470 807 94 865 807 896 808 32 776 839 806 865 807 896 787 900 900", 0, "BWIPP different encodation" }, @@ -421,7 +423,7 @@ static void test_input(const testCtx *const p_ctx) { /* 82*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 0, 12, 137, "(48) 40 902 491 81 137 450 302 67 15 174 492 862 667 475 869 12 434 685 326 422 57 117 339", 1, "" }, /* 83*/ { BARCODE_PDF417, DATA_MODE, -1, -1, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 0, 12, 137, "(48) 40 902 491 81 137 450 302 67 15 174 492 862 667 475 869 12 434 685 326 422 57 117 339", 1, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; int last_fast_num_cwds = 0; /* Keep clang-tidy happy */ @@ -534,7 +536,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_PDF417, -1, UNICODE_MODE | FAST_MODE, 1, 2, -1, "PDF417 Symbology Standard", 0, 10, 103, 0, "ISO 15438:2015 Figure 1, same, BWIPP uses different encodation, same codeword count", "1111111101010100011101010011100000111010110011110001110111011001100011110101011110000111111101000101001" "1111111101010100011111010100110000110100001110001001111010001010000011111010100110000111111101000101001" @@ -3922,7 +3924,7 @@ static void test_encode(const testCtx *const p_ctx) { "1111111101010100010100011000001100110100000100001101001011110111100011010001100011100111111101000101001" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; int last_fast_num_cwds = 0; /* Keep clang-tidy happy */ @@ -4036,7 +4038,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 8, 103, 1, "Standard example", "1111111101010100011111010101111100110101000011000001111001111001010011110101011110000111111101000101001" "1111111101010100011111101010001110101000011110010001001111110010110011110101001000000111111101000101001" @@ -4660,7 +4662,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, j, seg_count, ret; struct zint_symbol *symbol = NULL; int last_fast_num_cwds = 0; /* Keep clang-tidy happy */ @@ -4790,7 +4792,7 @@ static void test_fuzz(const testCtx *const p_ctx) { int bwipp_cmp; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, -1, -1, "\060\075\204\060\204\060\204\041\060\075\060\204\060\075\060\075\204\060\075\060\103\204\060\204\060\003\120\060\075\060\004\060\204\060\074\204\060\204\060\075" "\204\060\075\060\103\204\060\214\060\204\060\075\060\031\060\073\060\025\060\075\060\204\060\103\204\060\075\060\204\060\000\075\060\226\060\100\204\060\204\060" @@ -5567,7 +5569,7 @@ static void test_fuzz(const testCtx *const p_ctx) { 2690, ZINT_ERROR_TOO_LONG, 1, "" }, /* #300 (#10) Andre Maute */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -5703,7 +5705,7 @@ static void test_numbprocess(const testCtx *const p_ctx) { int expected[16]; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { TU("1"), 2, { 902, 11, }, }, /* 1*/ { TU("9"), 2, { 902, 19, }, }, /* 2*/ { TU("12"), 2, { 902, 112, }, }, @@ -5757,7 +5759,7 @@ static void test_numbprocess(const testCtx *const p_ctx) { /* 50*/ { TU("12345678901234567890123456789012345678901234"), 16, { 902, 491, 81, 137, 450, 302, 67, 15, 174, 492, 862, 667, 475, 869, 12, 434, }, }, /* 51*/ { TU("99999999999999999999999999999999999999999999"), 16, { 902, 874, 223, 532, 264, 888, 236, 358, 185, 93, 795, 72, 289, 146, 822, 199, }, }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length; short chainemc[32]; @@ -5813,7 +5815,7 @@ static void test_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_PDF417, -1, -1, -1, "1234567890", 0, 7, 103, "10 numerics" }, /* 1*/ { BARCODE_PDF417, -1, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz&,:#-.$/+%*=^ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLM" @@ -5855,7 +5857,7 @@ static void test_perf(const testCtx *const p_ctx) { "+E*F_2D+1.00+0005*", 0, 26, 222, "338 chars, text/numeric/byte" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; diff --git a/backend/tests/test_plessey.c b/backend/tests/test_plessey.c index 5d835a00..c064f914 100644 --- a/backend/tests/test_plessey.c +++ b/backend/tests/test_plessey.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2023 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -42,31 +42,32 @@ static void test_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { BARCODE_MSI_PLESSEY, -1, "9", 92, 0, 1, 1111 }, - /* 1*/ { BARCODE_MSI_PLESSEY, -1, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { BARCODE_MSI_PLESSEY, 1, "9", 92, 0, 1, 1123 }, /* 1 mod-10 check digit */ - /* 3*/ { BARCODE_MSI_PLESSEY, 1, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 4*/ { BARCODE_MSI_PLESSEY, 2, "9", 92, 0, 1, 1135 }, /* 2 mod-10 check digits */ - /* 5*/ { BARCODE_MSI_PLESSEY, 2, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 6*/ { BARCODE_MSI_PLESSEY, 3, "9", 92, 0, 1, 1123 }, /* 1 mod-11 check digit */ - /* 7*/ { BARCODE_MSI_PLESSEY, 3, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 8*/ { BARCODE_MSI_PLESSEY, 3, "4", 92, 0, 1, 1135 }, /* 1 mod-11 double check digit "10" */ - /* 9*/ { BARCODE_MSI_PLESSEY, 3, "4", 93, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 10*/ { BARCODE_MSI_PLESSEY, 4, "9", 92, 0, 1, 1135 }, /* 1 mod-11 and 1 mod-10 check digit */ - /* 11*/ { BARCODE_MSI_PLESSEY, 4, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 12*/ { BARCODE_MSI_PLESSEY, 4, "4", 92, 0, 1, 1147 }, /* 1 mod-11 double check digit "10" and 1 mod-10 check digit */ - /* 13*/ { BARCODE_MSI_PLESSEY, 4, "4", 93, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 14*/ { BARCODE_MSI_PLESSEY, 5, "9", 92, 0, 1, 1123 }, /* 1 NCR mod-11 check digit */ - /* 15*/ { BARCODE_MSI_PLESSEY, 5, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 16*/ { BARCODE_MSI_PLESSEY, 6, "9", 92, 0, 1, 1135 }, /* 1 NCR mod-11 and 1 mod-10 check digit */ - /* 17*/ { BARCODE_MSI_PLESSEY, 6, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 18*/ { BARCODE_PLESSEY, -1, "A", 67, 0, 1, 1139 }, - /* 19*/ { BARCODE_PLESSEY, -1, "A", 68, ZINT_ERROR_TOO_LONG, -1, -1 }, + static const struct item data[] = { + /* 0*/ { BARCODE_MSI_PLESSEY, -1, "9", 92, 0, 1, 1111, "" }, + /* 1*/ { BARCODE_MSI_PLESSEY, -1, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1, "Error 372: Input length 93 too long (maximum 92)" }, + /* 2*/ { BARCODE_MSI_PLESSEY, 1, "9", 92, 0, 1, 1123, "" }, /* 1 mod-10 check digit */ + /* 3*/ { BARCODE_MSI_PLESSEY, 1, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1, "Error 372: Input length 93 too long (maximum 92)" }, + /* 4*/ { BARCODE_MSI_PLESSEY, 2, "9", 92, 0, 1, 1135, "" }, /* 2 mod-10 check digits */ + /* 5*/ { BARCODE_MSI_PLESSEY, 2, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1, "Error 372: Input length 93 too long (maximum 92)" }, + /* 6*/ { BARCODE_MSI_PLESSEY, 3, "9", 92, 0, 1, 1123, "" }, /* 1 mod-11 check digit */ + /* 7*/ { BARCODE_MSI_PLESSEY, 3, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1, "Error 372: Input length 93 too long (maximum 92)" }, + /* 8*/ { BARCODE_MSI_PLESSEY, 3, "4", 92, 0, 1, 1135, "" }, /* 1 mod-11 double check digit "10" */ + /* 9*/ { BARCODE_MSI_PLESSEY, 3, "4", 93, ZINT_ERROR_TOO_LONG, -1, -1, "Error 372: Input length 93 too long (maximum 92)" }, + /* 10*/ { BARCODE_MSI_PLESSEY, 4, "9", 92, 0, 1, 1135, "" }, /* 1 mod-11 and 1 mod-10 check digit */ + /* 11*/ { BARCODE_MSI_PLESSEY, 4, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1, "Error 372: Input length 93 too long (maximum 92)" }, + /* 12*/ { BARCODE_MSI_PLESSEY, 4, "4", 92, 0, 1, 1147, "" }, /* 1 mod-11 double check digit "10" and 1 mod-10 check digit */ + /* 13*/ { BARCODE_MSI_PLESSEY, 4, "4", 93, ZINT_ERROR_TOO_LONG, -1, -1, "Error 372: Input length 93 too long (maximum 92)" }, + /* 14*/ { BARCODE_MSI_PLESSEY, 5, "9", 92, 0, 1, 1123, "" }, /* 1 NCR mod-11 check digit */ + /* 15*/ { BARCODE_MSI_PLESSEY, 5, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1, "Error 372: Input length 93 too long (maximum 92)" }, + /* 16*/ { BARCODE_MSI_PLESSEY, 6, "9", 92, 0, 1, 1135, "" }, /* 1 NCR mod-11 and 1 mod-10 check digit */ + /* 17*/ { BARCODE_MSI_PLESSEY, 6, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1, "Error 372: Input length 93 too long (maximum 92)" }, + /* 18*/ { BARCODE_PLESSEY, -1, "A", 67, 0, 1, 1139, "" }, + /* 19*/ { BARCODE_PLESSEY, -1, "A", 68, ZINT_ERROR_TOO_LONG, -1, -1, "Error 370: Input length 68 too long (maximum 67)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -88,6 +89,8 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -111,7 +114,7 @@ static void test_hrt(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_MSI_PLESSEY, -1, "1234567", "1234567" }, /* 1*/ { BARCODE_MSI_PLESSEY, 0, "1234567", "1234567" }, /* 2*/ { BARCODE_MSI_PLESSEY, 1, "1234567", "12345674" }, @@ -142,7 +145,7 @@ static void test_hrt(const testCtx *const p_ctx) { /* 27*/ { BARCODE_MSI_PLESSEY, 4 + 10, "2211", "2211" }, /* 28*/ { BARCODE_PLESSEY, -1, "0123456789ABCDEF", "0123456789ABCDEF" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -178,17 +181,18 @@ static void test_input(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { BARCODE_MSI_PLESSEY, -1, "1", 0, 1, 19 }, - /* 1*/ { BARCODE_MSI_PLESSEY, -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 2*/ { BARCODE_MSI_PLESSEY, -2, "1", 0, 1, 19 }, /* < 0 ignored */ - /* 3*/ { BARCODE_MSI_PLESSEY, 7, "1", 0, 1, 19 }, /* > 6 ignored */ - /* 4*/ { BARCODE_PLESSEY, -1, "A", 0, 1, 83 }, - /* 5*/ { BARCODE_PLESSEY, -1, "G", ZINT_ERROR_INVALID_DATA, -1, -1 }, + static const struct item data[] = { + /* 0*/ { BARCODE_MSI_PLESSEY, -1, "1", 0, 1, 19, "" }, + /* 1*/ { BARCODE_MSI_PLESSEY, -1, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 377: Invalid character at position 1 in input (digits only)" }, + /* 2*/ { BARCODE_MSI_PLESSEY, -2, "1", 0, 1, 19, "" }, /* < 0 ignored */ + /* 3*/ { BARCODE_MSI_PLESSEY, 7, "1", 0, 1, 19, "" }, /* > 6 ignored */ + /* 4*/ { BARCODE_PLESSEY, -1, "A", 0, 1, 83, "" }, + /* 5*/ { BARCODE_PLESSEY, -1, "G", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 371: Invalid character at position 1 in input (digits and \"ABCDEF\" only)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -205,6 +209,8 @@ static void test_input(const testCtx *const p_ctx) { 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_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); + assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); 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); @@ -231,7 +237,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_MSI_PLESSEY, -1, "1234567890", 0, 1, 127, "Verified manually against tec-it", "1101001001001101001001101001001001101101001101001001001101001101001101101001001101101101101001001001101001001101001001001001001" }, @@ -266,7 +272,7 @@ static void test_encode(const testCtx *const p_ctx) { "1101101001001101101001001101101001001101101001001101101001001101101001001101101001001101101001001101101001001101101001001101101001001101101001001101101001001101101001001101101001001101101001001101101001001101101001001101101001001001001001001101001" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -343,13 +349,13 @@ static void test_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_PLESSEY, -1, "1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1", 0, 1, 1107, "PLESSEY 65" }, /* 1*/ { BARCODE_PLESSEY, -1, "123456ABCD", 0, 1, 227, "PLESSEY 10" }, /* 2*/ { BARCODE_MSI_PLESSEY, -1, "12345678901234567890123456789012345678901234567890123456789012345", 0, 1, 787, "MSI_PLESSEY 65" }, /* 3*/ { BARCODE_MSI_PLESSEY, -1, "1234567890", 0, 1, 127, "MSI_PLESSEY 10" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; diff --git a/backend/tests/test_png.c b/backend/tests/test_png.c index 9dadbec7..e008e57e 100644 --- a/backend/tests/test_png.c +++ b/backend/tests/test_png.c @@ -47,7 +47,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) { int ret; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { 1, 1, "1", 0, 0 }, /* 1*/ { 2, 1, "11", 0, 0 }, /* 2*/ { 2, 2, "10", 1, 0 }, @@ -56,7 +56,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) { /* 5*/ { 3, 3, "101010101", 0, 0 }, /* 6*/ { 8, 2, "CBMWKRYGGYRKWMBC", 0, 0 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, ret; struct zint_symbol *symbol = NULL; @@ -144,7 +144,7 @@ static void test_print(const testCtx *const p_ctx) { char *expected_file; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, -1, -1, -1, -1, -1, -1, 10.0, 0, { 0, 0, "" }, "", "", 1, "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", "", 0, "code128_latin1_1.png", "" }, /* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, -1, -1, -1, -1, -1, -1, 10.0, 0, { 0, 0, "" }, "", "", 1, "¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ", "", 0, "code128_latin1_2.png", "" }, /* 2*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, 10.0, 0, { 0, 0, "" }, "", "", 1, "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", "", 0, "code128_latin1_1_bold.png", "" }, @@ -238,7 +238,7 @@ static void test_print(const testCtx *const p_ctx) { /* 90*/ { BARCODE_DPD, -1, -1, BARCODE_QUIET_ZONES | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "008182709980000020028101276", "", 0, "dpd_compliant.png", "Now with bind top 3X default" }, /* 91*/ { BARCODE_CHANNEL, -1, -1, CMYK_COLOUR | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "100,85,0,20", "FFFFFF00", 1, "123", "", 0, "channel_cmyk_nobg.png", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -386,12 +386,15 @@ static void test_outfile(const testCtx *const p_ctx) { skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ #endif if (!skip_readonly_test) { + static char expected_errtxt[] = "632: Could not open PNG output file ("; /* Excluding OS-dependent `errno` stuff */ + (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ assert_nonzero(testUtilCreateROFile(symbol.outfile), "png_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret = png_pixel_plot(&symbol, data); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "png_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "png_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); + assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); } symbol.output_options |= BARCODE_STDOUT; diff --git a/backend/tests/test_postal.c b/backend/tests/test_postal.c index 2682db4c..9ea1a47c 100644 --- a/backend/tests/test_postal.c +++ b/backend/tests/test_postal.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2023 Robin Stuart + Copyright (C) 2019-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -45,39 +45,40 @@ static void test_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { BARCODE_FLAT, "1", 128, 0, 1, 1152 }, - /* 1*/ { BARCODE_FLAT, "1", 129, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { BARCODE_POSTNET, "1", 11, 0, 2, 123 }, - /* 3*/ { BARCODE_POSTNET, "1", 12, ZINT_WARN_NONCOMPLIANT, 2, 133 }, - /* 4*/ { BARCODE_POSTNET, "1", 38, ZINT_WARN_NONCOMPLIANT, 2, 393 }, - /* 5*/ { BARCODE_POSTNET, "1", 39, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 6*/ { BARCODE_FIM, "D", 1, 0, 1, 17 }, - /* 7*/ { BARCODE_FIM, "D", 2, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 8*/ { BARCODE_CEPNET, "1", 8, 0, 2, 93 }, - /* 9*/ { BARCODE_CEPNET, "1", 7, ZINT_WARN_NONCOMPLIANT, 2, 83 }, - /* 10*/ { BARCODE_CEPNET, "1", 9, ZINT_WARN_NONCOMPLIANT, 2, 103 }, - /* 11*/ { BARCODE_CEPNET, "1", 39, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 12*/ { BARCODE_RM4SCC, "1", 50, 0, 3, 411 }, - /* 13*/ { BARCODE_RM4SCC, "1", 51, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 14*/ { BARCODE_JAPANPOST, "1", 20, 0, 3, 133 }, - /* 15*/ { BARCODE_JAPANPOST, "1", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 16*/ { BARCODE_JAPANPOST, "A", 10, 0, 3, 133 }, - /* 17*/ { BARCODE_JAPANPOST, "A", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 18*/ { BARCODE_KOREAPOST, "1", 6, 0, 1, 162 }, - /* 19*/ { BARCODE_KOREAPOST, "1", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 20*/ { BARCODE_PLANET, "1", 13, 0, 2, 143 }, - /* 21*/ { BARCODE_PLANET, "1", 14, ZINT_WARN_NONCOMPLIANT, 2, 153 }, - /* 22*/ { BARCODE_PLANET, "1", 38, ZINT_WARN_NONCOMPLIANT, 2, 393 }, - /* 23*/ { BARCODE_PLANET, "1", 39, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 24*/ { BARCODE_KIX, "1", 18, 0, 3, 143 }, - /* 25*/ { BARCODE_KIX, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 26*/ { BARCODE_DAFT, "D", 576, 0, 3, 1151 }, - /* 27*/ { BARCODE_DAFT, "D", 577, ZINT_ERROR_TOO_LONG, -1, -1 }, + static const struct item data[] = { + /* 0*/ { BARCODE_FLAT, "1", 128, 0, 1, 1152, "" }, + /* 1*/ { BARCODE_FLAT, "1", 129, ZINT_ERROR_TOO_LONG, -1, -1, "Error 494: Input length 129 too long (maximum 128)" }, + /* 2*/ { BARCODE_POSTNET, "1", 11, 0, 2, 123, "" }, + /* 3*/ { BARCODE_POSTNET, "1", 12, ZINT_WARN_NONCOMPLIANT, 2, 133, "Warning 479: Input length 12 is not standard (5, 9 or 11)" }, + /* 4*/ { BARCODE_POSTNET, "1", 38, ZINT_WARN_NONCOMPLIANT, 2, 393, "Warning 479: Input length 38 is not standard (5, 9 or 11)" }, + /* 5*/ { BARCODE_POSTNET, "1", 39, ZINT_ERROR_TOO_LONG, -1, -1, "Error 480: Input length 39 too long (maximum 38)" }, + /* 6*/ { BARCODE_FIM, "D", 1, 0, 1, 17, "" }, + /* 7*/ { BARCODE_FIM, "D", 2, ZINT_ERROR_TOO_LONG, -1, -1, "Error 486: Input length 2 too long (maximum 1)" }, + /* 8*/ { BARCODE_CEPNET, "1", 8, 0, 2, 93, "" }, + /* 9*/ { BARCODE_CEPNET, "1", 7, ZINT_WARN_NONCOMPLIANT, 2, 83, "Warning 780: Input length 7 wrong (should be 8 digits)" }, + /* 10*/ { BARCODE_CEPNET, "1", 9, ZINT_WARN_NONCOMPLIANT, 2, 103, "Warning 780: Input length 9 wrong (should be 8 digits)" }, + /* 11*/ { BARCODE_CEPNET, "1", 39, ZINT_ERROR_TOO_LONG, -1, -1, "Error 480: Input length 39 too long (maximum 38)" }, + /* 12*/ { BARCODE_RM4SCC, "1", 50, 0, 3, 411, "" }, + /* 13*/ { BARCODE_RM4SCC, "1", 51, ZINT_ERROR_TOO_LONG, -1, -1, "Error 488: Input length 51 too long (maximum 50)" }, + /* 14*/ { BARCODE_JAPANPOST, "1", 20, 0, 3, 133, "" }, + /* 15*/ { BARCODE_JAPANPOST, "1", 21, ZINT_ERROR_TOO_LONG, -1, -1, "Error 496: Input length 21 too long (maximum 20)" }, + /* 16*/ { BARCODE_JAPANPOST, "A", 10, 0, 3, 133, "" }, + /* 17*/ { BARCODE_JAPANPOST, "A", 11, ZINT_ERROR_TOO_LONG, -1, -1, "Error 477: Input too long, requires too many symbol characters (maximum 20)" }, + /* 18*/ { BARCODE_KOREAPOST, "1", 6, 0, 1, 162, "" }, + /* 19*/ { BARCODE_KOREAPOST, "1", 7, ZINT_ERROR_TOO_LONG, -1, -1, "Error 484: Input length 7 too long (maximum 6)" }, + /* 20*/ { BARCODE_PLANET, "1", 13, 0, 2, 143, "" }, + /* 21*/ { BARCODE_PLANET, "1", 14, ZINT_WARN_NONCOMPLIANT, 2, 153, "Warning 478: Input length 14 is not standard (11 or 13)" }, + /* 22*/ { BARCODE_PLANET, "1", 38, ZINT_WARN_NONCOMPLIANT, 2, 393, "Warning 478: Input length 38 is not standard (11 or 13)" }, + /* 23*/ { BARCODE_PLANET, "1", 39, ZINT_ERROR_TOO_LONG, -1, -1, "Error 482: Input length 39 too long (maximum 38)" }, + /* 24*/ { BARCODE_KIX, "1", 18, 0, 3, 143, "" }, + /* 25*/ { BARCODE_KIX, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1, "Error 490: Input length 19 too long (maximum 18)" }, + /* 26*/ { BARCODE_DAFT, "D", 576, 0, 3, 1151, "" }, + /* 27*/ { BARCODE_DAFT, "D", 577, ZINT_ERROR_TOO_LONG, -1, -1, "Error 492: Input length 577 too long (maximum 576)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -99,6 +100,7 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); 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 strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -123,10 +125,10 @@ static void test_koreapost(const testCtx *const p_ctx) { int expected_rows; int expected_width; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { "123456", 0, 0, 50, 1, 167 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -172,14 +174,14 @@ static void test_japanpost(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { "123", 0, 0, 8, 3, 133, "Check 3" }, /* 1*/ { "123456-AB", 0, 0, 8, 3, 133, "Check 10" }, /* 2*/ { "123456", 0, 0, 8, 3, 133, "Check 11" }, /* 3*/ { "999980-KZ", 0, 0, 8, 3, 133, "Check 18" }, /* 4*/ { "987654-TU", 0, 0, 8, 3, 133, "Check 0" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -224,60 +226,61 @@ static void test_input(const testCtx *const p_ctx) { int expected_rows; int expected_width; float expected_height; + char *expected_errtxt; int bwipp_cmp; char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 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, "" }, - /* 2*/ { BARCODE_POSTNET, -1, 0, "12345", 0, 2, 63, 12, 1, "" }, - /* 3*/ { BARCODE_POSTNET, -1, 0, "123457689", 0, 2, 103, 12, 1, "" }, - /* 4*/ { BARCODE_POSTNET, -1, 0, "12345768901", 0, 2, 123, 12, 1, "" }, - /* 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, 0, "BWIPP requires standard lengths" }, - /* 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, 0, "BWIPP requires standard lengths" }, - /* 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, 1, "" }, - /* 11*/ { BARCODE_FIM, -1, 0, "a", 0, 1, 17, 50, 1, "" }, - /* 12*/ { BARCODE_FIM, -1, 0, "b", 0, 1, 17, 50, 1, "" }, - /* 13*/ { BARCODE_FIM, -1, 0, "c", 0, 1, 17, 50, 1, "" }, - /* 14*/ { BARCODE_FIM, -1, 0, "d", 0, 1, 17, 50, 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, 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, 1, "" }, - /* 19*/ { BARCODE_RM4SCC, -1, 0, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 3, 299, 8, 1, "" }, - /* 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, 1, "" }, - /* 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, 1, "" }, /* 20 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, 1, "" }, /* 21 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, 1, "" }, /* Converts to upper */ - /* 28*/ { BARCODE_JAPANPOST, -1, 0, ",", ZINT_ERROR_INVALID_DATA, -1, -1, -1, 1, "" }, - /* 29*/ { BARCODE_KOREAPOST, -1, 0, "123456", 0, 1, 167, 50, 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, 1, "" }, - /* 32*/ { BARCODE_PLANET, -1, 0, "1234567890123", 0, 2, 143, 12, 1, "" }, - /* 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, 0, "BWIPP requires standard lengths" }, - /* 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, 0, "BWIPP requires standard lengths" }, - /* 37*/ { BARCODE_PLANET, -1, 0, "1234567890A", ZINT_ERROR_INVALID_DATA, -1, -1, -1, 1, "" }, - /* 38*/ { BARCODE_KIX, -1, 0, "0123456789ABCDEFGH", 0, 3, 143, 8, 1, "" }, - /* 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, 1, "" }, - /* 41*/ { BARCODE_DAFT, -1, 0, "DAFT", 0, 3, 7, 8, 1, "" }, - /* 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, 1, "" }, - /* 44*/ { BARCODE_DAFT, -1, 1.9, "DAFT", 0, 3, 7, 2, 1, "" }, - /* 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, 1, "" }, /* 50% ratio */ + static const struct item data[] = { + /* 0*/ { BARCODE_FLAT, -1, 0, "1234567890", 0, 1, 90, 50, "", 1, "" }, + /* 1*/ { BARCODE_FLAT, -1, 0, "A", ZINT_ERROR_INVALID_DATA, -1, -1, -1, "Error 495: Invalid character at position 1 in input (digits only)", 1, "" }, + /* 2*/ { BARCODE_POSTNET, -1, 0, "12345", 0, 2, 63, 12, "", 1, "" }, + /* 3*/ { BARCODE_POSTNET, -1, 0, "123457689", 0, 2, 103, 12, "", 1, "" }, + /* 4*/ { BARCODE_POSTNET, -1, 0, "12345768901", 0, 2, 123, 12, "", 1, "" }, + /* 5*/ { BARCODE_POSTNET, -1, 0, "0", ZINT_WARN_NONCOMPLIANT, 2, 23, 12, "Warning 479: Input length 1 is not standard (5, 9 or 11)", 0, "BWIPP requires standard lengths" }, + /* 6*/ { BARCODE_POSTNET, -1, 0, "1234", ZINT_WARN_NONCOMPLIANT, 2, 53, 12, "Warning 479: Input length 4 is not standard (5, 9 or 11)", 0, "BWIPP requires standard lengths" }, + /* 7*/ { BARCODE_POSTNET, -1, 0, "123456", ZINT_WARN_NONCOMPLIANT, 2, 73, 12, "Warning 479: Input length 6 is not standard (5, 9 or 11)", 0, "BWIPP requires standard lengths" }, + /* 8*/ { BARCODE_POSTNET, -1, 0, "123456789012", ZINT_WARN_NONCOMPLIANT, 2, 133, 12, "Warning 479: Input length 12 is not standard (5, 9 or 11)", 0, "BWIPP requires standard lengths" }, + /* 9*/ { BARCODE_POSTNET, -1, 0, "1234A", ZINT_ERROR_INVALID_DATA, -1, -1, -1, "Error 481: Invalid character at position 5 in input (digits only)", 1, "" }, + /* 10*/ { BARCODE_POSTNET, -1, 0.9, "12345", 0, 2, 63, 1, "", 1, "" }, + /* 11*/ { BARCODE_FIM, -1, 0, "a", 0, 1, 17, 50, "", 1, "" }, + /* 12*/ { BARCODE_FIM, -1, 0, "b", 0, 1, 17, 50, "", 1, "" }, + /* 13*/ { BARCODE_FIM, -1, 0, "c", 0, 1, 17, 50, "", 1, "" }, + /* 14*/ { BARCODE_FIM, -1, 0, "d", 0, 1, 17, 50, "", 1, "" }, + /* 15*/ { BARCODE_FIM, -1, 0, "ad", ZINT_ERROR_TOO_LONG, -1, -1, -1, "Error 486: Input length 2 too long (maximum 1)", 1, "" }, + /* 16*/ { BARCODE_FIM, -1, 0, "e", 0, 1, 17, 50, "", 1, "" }, + /* 17*/ { BARCODE_FIM, -1, 0, "f", ZINT_ERROR_INVALID_DATA, -1, -1, -1, "Error 487: Invalid character in input (\"A\", \"B\", \"C\", \"D\" or \"E\" only)", 1, "" }, + /* 18*/ { BARCODE_CEPNET, -1, 0, "1234567A", ZINT_ERROR_INVALID_DATA, -1, -1, -1, "Error 481: Invalid character at position 8 in input (digits only)", 1, "" }, + /* 19*/ { BARCODE_RM4SCC, -1, 0, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 3, 299, 8, "", 1, "" }, + /* 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, "Error 489: Invalid character at position 1 in input (alphanumerics only)", 1, "" }, + /* 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, "", 1, "" }, /* 20 symbol chars */ + /* 24*/ { BARCODE_JAPANPOST, -1, 0, "1234567890-ABCDE", ZINT_ERROR_TOO_LONG, -1, -1, -1, "Error 477: Input too long, requires too many symbol characters (maximum 20)", 1, "" }, /* 21 symbol chars */ + /* 25*/ { BARCODE_JAPANPOST, -1, 0, "1234567890-ABCD12", ZINT_ERROR_TOO_LONG, -1, -1, -1, "Error 477: Input too long, requires too many symbol characters (maximum 20)", 1, "" }, /* 21 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, "", 1, "" }, /* Converts to upper */ + /* 28*/ { BARCODE_JAPANPOST, -1, 0, ",", ZINT_ERROR_INVALID_DATA, -1, -1, -1, "Error 497: Invalid character at position 1 in input (alphanumerics and \"-\" only)", 1, "" }, + /* 29*/ { BARCODE_KOREAPOST, -1, 0, "123456", 0, 1, 167, 50, "", 1, "" }, + /* 30*/ { BARCODE_KOREAPOST, -1, 0, "A", ZINT_ERROR_INVALID_DATA, -1, -1, -1, "Error 485: Invalid character at position 1 in input (digits only)", 1, "" }, + /* 31*/ { BARCODE_PLANET, -1, 0, "12345678901", 0, 2, 123, 12, "", 1, "" }, + /* 32*/ { BARCODE_PLANET, -1, 0, "1234567890123", 0, 2, 143, 12, "", 1, "" }, + /* 33*/ { BARCODE_PLANET, -1, 0, "0", ZINT_WARN_NONCOMPLIANT, 2, 23, 12, "Warning 478: Input length 1 is not standard (11 or 13)", 0, "BWIPP requires standard lengths" }, + /* 34*/ { BARCODE_PLANET, -1, 0, "1234567890", ZINT_WARN_NONCOMPLIANT, 2, 113, 12, "Warning 478: Input length 10 is not standard (11 or 13)", 0, "BWIPP requires standard lengths" }, + /* 35*/ { BARCODE_PLANET, -1, 0, "123456789012", ZINT_WARN_NONCOMPLIANT, 2, 133, 12, "Warning 478: Input length 12 is not standard (11 or 13)", 0, "BWIPP requires standard lengths" }, + /* 36*/ { BARCODE_PLANET, -1, 0, "12345678901234", ZINT_WARN_NONCOMPLIANT, 2, 153, 12, "Warning 478: Input length 14 is not standard (11 or 13)", 0, "BWIPP requires standard lengths" }, + /* 37*/ { BARCODE_PLANET, -1, 0, "1234567890A", ZINT_ERROR_INVALID_DATA, -1, -1, -1, "Error 483: Invalid character at position 11 in input (digits only)", 1, "" }, + /* 38*/ { BARCODE_KIX, -1, 0, "0123456789ABCDEFGH", 0, 3, 143, 8, "", 1, "" }, + /* 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, "Error 491: Invalid character at position 1 in input (alphanumerics only)", 1, "" }, + /* 41*/ { BARCODE_DAFT, -1, 0, "DAFT", 0, 3, 7, 8, "", 1, "" }, + /* 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, "Error 493: Invalid character at position 1 in input (\"D\", \"A\", \"F\" and \"T\" only)", 1, "" }, + /* 44*/ { BARCODE_DAFT, -1, 1.9, "DAFT", 0, 3, 7, 2, "", 1, "" }, + /* 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, "", 1, "" }, /* 50% ratio */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -302,6 +305,7 @@ static void test_input(const testCtx *const p_ctx) { 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_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -343,7 +347,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_FLAT, "1304056", 0, 1, 63, "Verified manually against tec-it", "100000000001000000000000000000100000000000000000010000000001000" }, @@ -473,7 +477,7 @@ static void test_encode(const testCtx *const p_ctx) { "100010000010001010000010000000100" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -550,12 +554,12 @@ static void test_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_POSTNET, -1, "12345678901", 0, 2, 123, "POSTNET 11" }, /* 1*/ { BARCODE_PLANET, -1, "1234567890123", 0, 2, 143, "PLANET 13" }, /* 2*/ { BARCODE_KOREAPOST, -1, "123456", 0, 1, 167, "KOREAPOST 6" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; diff --git a/backend/tests/test_ps.c b/backend/tests/test_ps.c index cd7fd801..3b7d6970 100644 --- a/backend/tests/test_ps.c +++ b/backend/tests/test_ps.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2023 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -52,7 +52,7 @@ static void test_print(const testCtx *const p_ctx) { char *data; char *expected_file; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, 0, 0, "", "", 0, "Égjpqy", "code128_egrave_bold.eps" }, /* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, 0, 0, "", "", 90, "Égjpqy", "code128_egrave_bold_rotate_90.eps" }, /* 2*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, 0, 0, "", "", 180, "Égjpqy", "code128_egrave_bold_rotate_180.eps" }, @@ -113,7 +113,7 @@ static void test_print(const testCtx *const p_ctx) { /* 57*/ { BARCODE_MAXICODE, -1, -1, -1, 3, -1, -1, -1, 0, 0, "", "0000FF00", 180, "12", "maxicode_no_bg_hwsp3_rotate_180.eps" }, /* 58*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, 2.4, 0, "", "", 90, "12", "maxicode_2.4_rotate_90.eps" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -229,10 +229,10 @@ static void test_ps_convert(const testCtx *const p_ctx) { char *data; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { "1\\(é)2€3¿", "1\\\\\\(\351\\)23\277" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i; unsigned char converted[256]; @@ -270,12 +270,15 @@ static void test_outfile(const testCtx *const p_ctx) { skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ #endif if (!skip_readonly_test) { + static char expected_errtxt[] = "645: Could not open EPS output file ("; /* Excluding OS-dependent `errno` stuff */ + (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ assert_nonzero(testUtilCreateROFile(symbol.outfile), "ps_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret = ps_plot(&symbol, 0); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "ps_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "ps_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); + assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); } symbol.output_options |= BARCODE_STDOUT; diff --git a/backend/tests/test_qr.c b/backend/tests/test_qr.c index dbeef22d..86087760 100644 --- a/backend/tests/test_qr.c +++ b/backend/tests/test_qr.c @@ -43,29 +43,30 @@ static void test_qr_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { 1, 32, -1, "A", 2840, 0, 145, 145 }, - /* 1*/ { 1, 32, -1, "A", 2841, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { 1, 33, -1, "A", 3009, 0, 149, 149 }, - /* 3*/ { 1, 33, -1, "A", 3010, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 4*/ { 1, 34, -1, "A", 3183, 0, 153, 153 }, - /* 5*/ { 1, 34, -1, "A", 3184, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 6*/ { 1, 35, -1, "A", 3351, 0, 157, 157 }, - /* 7*/ { 1, 35, -1, "A", 3352, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 8*/ { 1, 36, -1, "A", 3537, 0, 161, 161 }, - /* 9*/ { 1, 36, -1, "A", 3538, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 10*/ { 1, 37, -1, "A", 3729, 0, 165, 165 }, - /* 11*/ { 1, 37, -1, "A", 3730, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 12*/ { 1, 38, -1, "A", 3927, 0, 169, 169 }, - /* 13*/ { 1, 38, -1, "A", 3928, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 14*/ { 1, 39, -1, "A", 4087, 0, 173, 173 }, - /* 15*/ { 1, 39, -1, "A", 4088, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 16*/ { 1, 40, -1, "A", 4296, 0, 177, 177 }, /* ISO/IEC 18004:2015 Section 6.1 (e) (1) */ - /* 17*/ { 1, 40, -1, "A", 4297, ZINT_ERROR_TOO_LONG, -1, -1 }, + static const struct item data[] = { + /* 0*/ { 1, 32, -1, "A", 2840, 0, 145, 145, "" }, + /* 1*/ { 1, 32, -1, "A", 2841, ZINT_ERROR_TOO_LONG, -1, -1, "Error 569: Input too long for Version 32-L, requires 1956 codewords (maximum 1955)" }, + /* 2*/ { 1, 33, -1, "A", 3009, 0, 149, 149, "" }, + /* 3*/ { 1, 33, -1, "A", 3010, ZINT_ERROR_TOO_LONG, -1, -1, "Error 569: Input too long for Version 33-L, requires 2072 codewords (maximum 2071)" }, + /* 4*/ { 1, 34, -1, "A", 3183, 0, 153, 153, "" }, + /* 5*/ { 1, 34, -1, "A", 3184, ZINT_ERROR_TOO_LONG, -1, -1, "Error 569: Input too long for Version 34-L, requires 2192 codewords (maximum 2191)" }, + /* 6*/ { 1, 35, -1, "A", 3351, 0, 157, 157, "" }, + /* 7*/ { 1, 35, -1, "A", 3352, ZINT_ERROR_TOO_LONG, -1, -1, "Error 569: Input too long for Version 35-L, requires 2307 codewords (maximum 2306)" }, + /* 8*/ { 1, 36, -1, "A", 3537, 0, 161, 161, "" }, + /* 9*/ { 1, 36, -1, "A", 3538, ZINT_ERROR_TOO_LONG, -1, -1, "Error 569: Input too long for Version 36-L, requires 2435 codewords (maximum 2434)" }, + /* 10*/ { 1, 37, -1, "A", 3729, 0, 165, 165, "" }, + /* 11*/ { 1, 37, -1, "A", 3730, ZINT_ERROR_TOO_LONG, -1, -1, "Error 569: Input too long for Version 37-L, requires 2567 codewords (maximum 2566)" }, + /* 12*/ { 1, 38, -1, "A", 3927, 0, 169, 169, "" }, + /* 13*/ { 1, 38, -1, "A", 3928, ZINT_ERROR_TOO_LONG, -1, -1, "Error 569: Input too long for Version 38-L, requires 2703 codewords (maximum 2702)" }, + /* 14*/ { 1, 39, -1, "A", 4087, 0, 173, 173, "" }, + /* 15*/ { 1, 39, -1, "A", 4088, ZINT_ERROR_TOO_LONG, -1, -1, "Error 569: Input too long for Version 39-L, requires 2813 codewords (maximum 2812)" }, + /* 16*/ { 1, 40, -1, "A", 4296, 0, 177, 177, "" }, /* ISO/IEC 18004:2015 Section 6.1 (e) (2) */ + /* 17*/ { 1, 40, -1, "A", 4297, ZINT_ERROR_TOO_LONG, -1, -1, "Error 567: Input too long, requires 2957 codewords (maximum 2956)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -94,6 +95,8 @@ static void test_qr_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -103,6 +106,8 @@ static void test_qr_large(const testCtx *const p_ctx) { symbol->input_mode |= FAST_MODE; ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -155,7 +160,7 @@ static void test_qr_options(const testCtx *const p_ctx) { }; /* 貫 U+8CAB kanji, in Shift JIS 0x8AD1 (\212\321), UTF-8 E8B2AB */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { -1, -1, -1, -1, { 0, 0, "" }, "12345", 0, 0, 21, -1, "" }, /* ECC auto-set to 1 (L), version auto-set to 1 */ /* 1*/ { -1, -1, 5, -1, { 0, 0, "" }, "12345", 0, 0, 21, 0, "" }, /* ECC > 4 ignored */ /* 2*/ { -1, -1, -1, 41, { 0, 0, "" }, "12345", 0, 0, 21, 0, "" }, /* Version > 40 ignored */ @@ -166,7 +171,7 @@ static void test_qr_options(const testCtx *const p_ctx) { /* 7*/ { -1, -1, 1, -1, { 0, 0, "" }, "貫やぐ識禁", 0, 0, 21, 0, "" }, /* Version auto-set to 1 */ /* 8*/ { -1, -1, -1, 1, { 0, 0, "" }, "貫やぐ識禁", 0, 0, 21, 0, "" }, /* ECC auto-set to 1 (L) */ /* 9*/ { -1, -1, 1, 1, { 0, 0, "" }, "貫やぐ識禁", 0, 0, 21, 0, "" }, - /* 10*/ { -1, -1, 2, 1, { 0, 0, "" }, "貫やぐ識禁", ZINT_ERROR_TOO_LONG, -1, 0, -1, "Error 569: Input too long for selected symbol size" }, /* ECC 2 (M), version 1 */ + /* 10*/ { -1, -1, 2, 1, { 0, 0, "" }, "貫やぐ識禁", ZINT_ERROR_TOO_LONG, -1, 0, -1, "Error 569: Input too long for Version 1-M, requires 17 codewords (maximum 16)" }, /* ECC 2 (M), version 1 */ /* 11*/ { -1, -1, 2, -1, { 0, 0, "" }, "貫やぐ識禁", 0, 0, 25, -1, "" }, /* Version auto-set to 2 */ /* 12*/ { -1, -1, 2, 2, { 0, 0, "" }, "貫やぐ識禁", 0, 0, 25, 0, "" }, /* 13*/ { -1, -1, 1, 2, { 0, 0, "" }, "貫やぐ識禁", 0, 0, 25, 1, "" }, @@ -189,22 +194,22 @@ static void test_qr_options(const testCtx *const p_ctx) { /* 30*/ { -1, -1, 4, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, 0, 177, -1, "" }, /* 1852 alphanumerics max for ECC 4 (H) */ /* 31*/ { -1, -1, 1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, 0, 177, -1, "" }, /* 4296 alphanumerics max for ECC 1 (L) */ /* 32*/ { -1, -1, 4, -1, { 0, 0, "" }, "貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫", 0, -1, 0, -1, "" }, /* 424 Kanji, ECC 4 (Q), version 1 */ - /* 33*/ { -1, -1, 4, -1, { 0, 0, "" }, "貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫", ZINT_ERROR_TOO_LONG, -1, 0, -1, "Error 561: Input too long for selected error correction level" }, /* 425 Kanji, ECC 4 (Q), version 1 */ + /* 33*/ { -1, -1, 4, -1, { 0, 0, "" }, "貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫貫", ZINT_ERROR_TOO_LONG, -1, 0, -1, "Error 561: Input too long for ECC level H, requires 1278 codewords (maximum 1276)" }, /* 425 Kanji, ECC 4 (H), version 1 */ /* 34*/ { -1, -1, 4, 1, { 0, 0, "" }, "12345678901234567", 0, 0, 21, -1, "" }, - /* 35*/ { -1, -1, 4, 1, { 1, 2, "" }, "12345678901234567", ZINT_ERROR_TOO_LONG, -1, 0, -1, "Error 569: Input too long for selected symbol size" }, - /* 36*/ { -1, -1, 4, 1, { 1, 2, "" }, "123456789012", ZINT_ERROR_TOO_LONG, -1, 0, -1, "Error 569: Input too long for selected symbol size" }, + /* 35*/ { -1, -1, 4, 1, { 1, 2, "" }, "12345678901234567", ZINT_ERROR_TOO_LONG, -1, 0, -1, "Error 569: Input too long for Version 1-H, requires 12 codewords (maximum 9)" }, + /* 36*/ { -1, -1, 4, 1, { 1, 2, "" }, "123456789012", ZINT_ERROR_TOO_LONG, -1, 0, -1, "Error 569: Input too long for Version 1-H, requires 10 codewords (maximum 9)" }, /* 37*/ { -1, -1, 4, 1, { 1, 2, "" }, "12345678901", 0, 0, 21, -1, "" }, /* 38*/ { -1, -1, 4, 1, { 3, 16, "123" }, "12345678901", 0, 0, 21, -1, "" }, - /* 39*/ { -1, -1, 4, 1, { 3, 17, "123" }, "12345678901", ZINT_ERROR_INVALID_OPTION, -1, 0, -1, "Error 750: Structured Append count out of range (2-16)" }, - /* 40*/ { -1, -1, 4, 1, { 3, 2, "123" }, "12345678901", ZINT_ERROR_INVALID_OPTION, -1, 0, -1, "Error 751: Structured Append index out of range (1-2)" }, - /* 41*/ { -1, -1, 4, 1, { 1, 2, "1234" }, "12345678901", ZINT_ERROR_INVALID_OPTION, -1, 0, -1, "Error 752: Structured Append ID too long (3 digit maximum)" }, + /* 39*/ { -1, -1, 4, 1, { 3, 17, "123" }, "12345678901", ZINT_ERROR_INVALID_OPTION, -1, 0, -1, "Error 750: Structured Append count '17' out of range (2 to 16)" }, + /* 40*/ { -1, -1, 4, 1, { 3, 2, "123" }, "12345678901", ZINT_ERROR_INVALID_OPTION, -1, 0, -1, "Error 751: Structured Append index '3' out of range (1 to count 2)" }, + /* 41*/ { -1, -1, 4, 1, { 1, 2, "1234" }, "12345678901", ZINT_ERROR_INVALID_OPTION, -1, 0, -1, "Error 752: Structured Append ID length 4 too long (3 digit maximum)" }, /* 42*/ { -1, -1, 4, 1, { 1, 2, "12A" }, "12345678901", ZINT_ERROR_INVALID_OPTION, -1, 0, -1, "Error 753: Invalid Structured Append ID (digits only)" }, - /* 43*/ { -1, -1, 4, 1, { 1, 2, "256" }, "12345678901", ZINT_ERROR_INVALID_OPTION, -1, 0, -1, "Error 754: Structured Append ID '256' out of range (0-255)" }, + /* 43*/ { -1, -1, 4, 1, { 1, 2, "256" }, "12345678901", ZINT_ERROR_INVALID_OPTION, -1, 0, -1, "Error 754: Structured Append ID value '256' out of range (0 to 255)" }, /* 44*/ { GS1_MODE, 3, -1, -1, { 0, 0, "" }, "[20]12", ZINT_WARN_NONCOMPLIANT, 0, 21, -1, "Warning 755: Using ECI in GS1 mode not supported by GS1 standards" }, /* 45*/ { GS1_MODE, -1, -1, -1, { 1, 2, "" }, "[20]12", ZINT_WARN_NONCOMPLIANT, 0, 21, -1, "Warning 756: Using Structured Append in GS1 mode not supported by GS1 standards" }, /* 46*/ { GS1_MODE, 3, -1, -1, { 1, 2, "" }, "[20]12", ZINT_WARN_NONCOMPLIANT, 0, 21, -1, "Warning 755: Using ECI in GS1 mode not supported by GS1 standards" }, /* ECI trumps Structured Append */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -276,10 +281,10 @@ static void test_qr_input(const testCtx *const p_ctx) { /* 茗 U+8317 kanji, in Shift JIS 0xE4AA (\344\252), UTF-8 E88C97 */ /* テ U+30C6 katakana, in Shift JIS 0x8365 (\203\145), UTF-8 E38386 */ /* Á U+00C1, UTF-8 C381; ȁ U+0201, UTF-8 C881; Ȃ U+0202, UTF-8 C882; ¢ U+00A2, UTF-8 C2A2; á U+00E1, UTF-8 C3A1 */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, 0, 4, 6 << 8, "é", 0, 0, "40 1E 90 EC 11 EC 11 EC 11", 1, 1, "B1 (ISO 8859-1)" }, /* 1*/ { UNICODE_MODE, 3, 4, -1, "é", 0, 3, "70 34 01 E9 00 EC 11 EC 11", 1, 1, "ECI-3 B1 (ISO 8859-1)" }, - /* 2*/ { UNICODE_MODE, 20, -1, -1, "é", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input data", 1, 1, "é not in Shift JIS" }, + /* 2*/ { UNICODE_MODE, 20, -1, -1, "é", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input", 1, 1, "é not in Shift JIS" }, /* 3*/ { UNICODE_MODE, 26, 4, -1, "é", 0, 26, "71 A4 02 C3 A9 00 EC 11 EC", 1, 1, "ECI-26 B2 (UTF-8)" }, /* 4*/ { DATA_MODE, 0, 4, 7 << 8, "é", 0, 0, "40 2C 3A 90 EC 11 EC 11 EC", 1, 0, "B2 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 5*/ { DATA_MODE, 0, 4, 6 << 8, "\351", 0, 0, "40 1E 90 EC 11 EC 11 EC 11", 1, 1, "B1 (ISO 8859-1)" }, @@ -290,7 +295,7 @@ static void test_qr_input(const testCtx *const p_ctx) { /* 10*/ { DATA_MODE, 0, 4, 4 << 8, "β", 0, 0, "40 2C EB 20 EC 11 EC 11 EC", 1, 0, "B2 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 11*/ { UNICODE_MODE, 0, 4, 5 << 8, "ก", ZINT_WARN_USES_ECI, 13, "Warning 70 D4 01 A1 00 EC 11 EC 11", 1, 1, "ECI-13 B1 (ISO 8859-11)" }, /* 12*/ { UNICODE_MODE, 13, 4, 5 << 8, "ก", 0, 13, "70 D4 01 A1 00 EC 11 EC 11", 1, 1, "ECI-13 B1 (ISO 8859-11)" }, - /* 13*/ { UNICODE_MODE, 20, -1, -1, "ก", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input data", 1, 1, "ก not in Shift JIS" }, + /* 13*/ { UNICODE_MODE, 20, -1, -1, "ก", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input", 1, 1, "ก not in Shift JIS" }, /* 14*/ { UNICODE_MODE, 26, 4, 8 << 8, "ก", 0, 26, "71 A4 03 E0 B8 81 00 EC 11", 1, 1, "ECI-26 B3 (UTF-8)" }, /* 15*/ { DATA_MODE, 0, 4, 3 << 8, "ก", 0, 0, "40 3E 0B 88 10 EC 11 EC 11", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 16*/ { UNICODE_MODE, 0, 4, 8 << 8, "Ж", ZINT_WARN_NONCOMPLIANT, 0, "Warning 80 11 23 80 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS)" }, @@ -299,7 +304,7 @@ static void test_qr_input(const testCtx *const p_ctx) { /* 19*/ { UNICODE_MODE, 26, 4, -1, "Ж", 0, 26, "71 A4 02 D0 96 00 EC 11 EC", 1, 1, "ECI-26 B2 (UTF-8)" }, /* 20*/ { DATA_MODE, 0, 4, -1, "Ж", 0, 0, "40 2D 09 60 EC 11 EC 11 EC", 1, 0, "B2 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 21*/ { UNICODE_MODE, 0, 4, -1, "ກ", ZINT_WARN_USES_ECI, 26, "Warning 71 A4 03 E0 BA 81 00 EC 11", 1, 1, "ECI-26 B3 (UTF-8)" }, - /* 22*/ { UNICODE_MODE, 20, -1, -1, "ກ", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input data", 1, 1, "ກ not in Shift JIS" }, + /* 22*/ { UNICODE_MODE, 20, -1, -1, "ກ", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input", 1, 1, "ກ not in Shift JIS" }, /* 23*/ { UNICODE_MODE, 26, 4, -1, "ກ", 0, 26, "71 A4 03 E0 BA 81 00 EC 11", 1, 1, "ECI-26 B3 (UTF-8)" }, /* 24*/ { DATA_MODE, 0, 4, 8 << 8, "ກ", 0, 0, "40 3E 0B A8 10 EC 11 EC 11", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 25*/ { UNICODE_MODE, 0, 4, 2 << 8, "\\", 0, 0, "40 15 C0 EC 11 EC 11 EC 11", 1, 1, "B1 (ASCII)" }, @@ -312,37 +317,37 @@ static void test_qr_input(const testCtx *const p_ctx) { /* 32*/ { UNICODE_MODE, 26, 4, 6 << 8, "¥", 0, 26, "71 A4 02 C2 A5 00 EC 11 EC", 1, 1, "ECI-26 B2 (UTF-8)" }, /* 33*/ { DATA_MODE, 0, 4, 2 << 8, "¥", 0, 0, "40 2C 2A 50 EC 11 EC 11 EC", 1, 0, "B2 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 34*/ { UNICODE_MODE, 0, 4, 2 << 8, "・", ZINT_WARN_NONCOMPLIANT, 0, "Warning 40 1A 50 EC 11 EC 11 EC 11", 1, 1, "B1 (Shift JIS) single-byte codepoint A5 (same bytes as ¥ ISO 8859-1 above, so ambiguous)" }, - /* 35*/ { UNICODE_MODE, 3, -1, -1, "・", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", 1, 1, "" }, + /* 35*/ { UNICODE_MODE, 3, -1, -1, "・", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input for ECI '3'", 1, 1, "" }, /* 36*/ { UNICODE_MODE, 20, 4, 7 << 8, "・", 0, 20, "71 44 01 A5 00 EC 11 EC 11", 1, 1, "ECI-20 B1 (Shift JIS) single-byte codepoint A5" }, /* 37*/ { UNICODE_MODE, 26, 4, -1, "・", 0, 26, "71 A4 03 EF BD A5 00 EC 11", 1, 1, "ECI-26 B3 (UTF-8)" }, /* 38*/ { DATA_MODE, 0, 4, 8 << 8, "・", 0, 0, "40 3E FB DA 50 EC 11 EC 11", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 39*/ { UNICODE_MODE, 0, 4, -1, "¿", 0, 0, "40 1B F0 EC 11 EC 11 EC 11", 1, 1, "B1 (ISO 8859-1) (same bytes as ソ Shift JIS below, so ambiguous)" }, /* 40*/ { UNICODE_MODE, 3, 4, 8 << 8, "¿", 0, 3, "70 34 01 BF 00 EC 11 EC 11", 1, 1, "ECI-3 B1 (ISO 8859-1)" }, - /* 41*/ { UNICODE_MODE, 20, -1, -1, "¿", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input data", 1, 1, "¿ not in Shift JIS" }, + /* 41*/ { UNICODE_MODE, 20, -1, -1, "¿", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input", 1, 1, "¿ not in Shift JIS" }, /* 42*/ { UNICODE_MODE, 26, 4, 2 << 8, "¿", 0, 26, "71 A4 02 C2 BF 00 EC 11 EC", 1, 1, "ECI-26 B2 (UTF-8)" }, /* 43*/ { DATA_MODE, 0, 4, 3 << 8, "¿", 0, 0, "40 2C 2B F0 EC 11 EC 11 EC", 1, 0, "B2 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 44*/ { UNICODE_MODE, 0, 4, -1, "ソ", ZINT_WARN_NONCOMPLIANT, 0, "Warning 40 1B F0 EC 11 EC 11 EC 11", 1, 1, "B1 (Shift JIS) single-byte codepoint BF (same bytes as ¿ ISO 8859-1 above, so ambiguous)" }, - /* 45*/ { UNICODE_MODE, 3, -1, -1, "ソ", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", 1, 1, "" }, + /* 45*/ { UNICODE_MODE, 3, -1, -1, "ソ", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input for ECI '3'", 1, 1, "" }, /* 46*/ { UNICODE_MODE, 20, 4, 6 << 8, "ソ", 0, 20, "71 44 01 BF 00 EC 11 EC 11", 1, 1, "ECI-20 B1 (Shift JIS) single-byte codepoint BF" }, /* 47*/ { UNICODE_MODE, 26, 4, 4 << 8, "ソ", 0, 26, "71 A4 03 EF BD BF 00 EC 11", 1, 1, "ECI-26 B3 (UTF-8)" }, /* 48*/ { DATA_MODE, 0, 4, -1, "ソ", 0, 0, "40 3E FB DB F0 EC 11 EC 11", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 49*/ { UNICODE_MODE, 0, 4, -1, "~", 0, 0, "40 17 E0 EC 11 EC 11 EC 11", 1, 1, "B1 (ASCII) (same bytes as ‾ Shift JIS below, so ambiguous)" }, /* 50*/ { UNICODE_MODE, 3, 4, -1, "~", 0, 3, "70 34 01 7E 00 EC 11 EC 11", 1, 1, "ECI-3 B1 (ASCII)" }, - /* 51*/ { UNICODE_MODE, 20, -1, -1, "~", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input data", 1, 1, "tilde not in Shift JIS (codepoint used for overline)" }, + /* 51*/ { UNICODE_MODE, 20, -1, -1, "~", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input", 1, 1, "tilde not in Shift JIS (codepoint used for overline)" }, /* 52*/ { UNICODE_MODE, 0, 4, -1, "‾", ZINT_WARN_NONCOMPLIANT, 0, "Warning 40 17 E0 EC 11 EC 11 EC 11", 1, 0, "B1 (Shift JIS) single-byte codepoint 7E (same bytes as ~ ASCII above, so ambiguous); ZXing-C++ doesn't map Shift JIS ASCII" }, - /* 53*/ { UNICODE_MODE, 3, -1, -1, "‾", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", 1, 1, "" }, + /* 53*/ { UNICODE_MODE, 3, -1, -1, "‾", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input for ECI '3'", 1, 1, "" }, /* 54*/ { UNICODE_MODE, 20, 4, 7 << 8, "‾", 0, 20, "71 44 01 7E 00 EC 11 EC 11", 1, 0, "ECI-20 B1 (Shift JIS) (to single-byte tilde codepoint 7E, so byte mode); ZXing-C++ doesn't map Shift JIS ASCII" }, /* 55*/ { UNICODE_MODE, 26, 4, 1 << 8, "‾", 0, 26, "71 A4 03 E2 80 BE 00 EC 11", 1, 1, "ECI-26 B3 (UTF-8)" }, /* 56*/ { DATA_MODE, 0, 4, -1, "‾", 0, 0, "40 3E 28 0B E0 EC 11 EC 11", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 57*/ { UNICODE_MODE, 0, 4, -1, "点", ZINT_WARN_NONCOMPLIANT, 0, "Warning 80 16 CF 80 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS)" }, - /* 58*/ { UNICODE_MODE, 3, -1, -1, "点", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", 1, 1, "" }, + /* 58*/ { UNICODE_MODE, 3, -1, -1, "点", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input for ECI '3'", 1, 1, "" }, /* 59*/ { UNICODE_MODE, 20, 4, 3 << 8, "点", 0, 20, "71 48 01 6C F8 00 EC 11 EC", 1, 1, "ECI-20 K1 (Shift JIS)" }, /* 60*/ { UNICODE_MODE, 26, 4, -1, "点", 0, 26, "71 A4 03 E7 82 B9 00 EC 11", 1, 1, "ECI-26 B3 (UTF-8)" }, /* 61*/ { DATA_MODE, 0, 4, 6 << 8, "点", 0, 0, "40 3E 78 2B 90 EC 11 EC 11", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 62*/ { DATA_MODE, 0, 4, 4 << 8, "\223\137", 0, 0, "40 29 35 F0 EC 11 EC 11 EC", 0, 0, "B2 (Shift JIS) (not full multibyte); BWIPP same as FULL_MULTIBYTE; ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 63*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE, "\223\137", 0, 0, "80 16 CF 80 EC 11 EC 11 EC", 1, 1, "K1 (Shift JIS)" }, /* 64*/ { UNICODE_MODE, 0, 4, -1, "¥・点", ZINT_WARN_NONCOMPLIANT, 0, "Warning 40 45 CA 59 35 F0 EC 11 EC", 1, 0, "B4 (Shift JIS) (optimized to byte mode only); ZXing-C++ doesn't map Shift JIS ASCII" }, - /* 65*/ { UNICODE_MODE, 3, -1, -1, "¥・点", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", 1, 1, "" }, + /* 65*/ { UNICODE_MODE, 3, -1, -1, "¥・点", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input for ECI '3'", 1, 1, "" }, /* 66*/ { UNICODE_MODE, 20, 4, 4 << 8, "¥・点", 0, 20, "71 44 04 5C A5 93 5F 00 EC", 1, 0, "ECI-20 B4 (Shift JIS); ZXing-C++ doesn't map Shift JIS ASCII" }, /* 67*/ { UNICODE_MODE, 26, 3, 7 << 8, "¥・点", 0, 26, "71 A4 08 C2 A5 EF BD A5 E7 82 B9 00 EC", 1, 1, "ECI-26 B8 (UTF-8)" }, /* 68*/ { DATA_MODE, 0, 4, -1, "\134\245\223\137", 0, 0, "40 45 CA 59 35 F0 EC 11 EC", 1, 0, "B8 (Shift JIS); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, @@ -423,7 +428,7 @@ static void test_qr_input(const testCtx *const p_ctx) { /*143*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE | (6 << 8), "\201\377", 0, 0, "40 28 1F F0 EC 11 EC 11 EC", 1, 1, "B2 (0x81FF previously used Kanji mode, now excludes trailing 0xFF)" }, /*144*/ { DATA_MODE, 0, 4, ZINT_FULL_MULTIBYTE | (7 << 8), "\201\255", 0, 0, "80 10 36 80 EC 11 EC 11 EC", 1, 1, "K1 (0x81AD undefined in Shift JIS but not checked and uses Kanji mode)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -515,7 +520,7 @@ static void test_qr_gs1(const testCtx *const p_ctx) { int bwipp_cmp; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { GS1_MODE, 4, 7 << 8, "[01]12345678901231", 0, "51 04 00 B3 AA 37 DE 87 B1", 1, "N16" }, /* 1*/ { GS1_MODE | GS1PARENS_MODE, 4, 7 << 8, "(01)12345678901231", 0, "51 04 00 B3 AA 37 DE 87 B1", 1, "N16" }, /* 2*/ { GS1_MODE, 2, 4 << 8, "[01]04912345123459[15]970331[30]128[10]ABC123", 0, "51 07 40 A7 AC EA 80 15 9E 4F CA 52 D2 D3 84 09 D5 E0 28 FD 82 F0 C0 EC 11 EC 11 EC", 1, "N29 A9" }, @@ -635,7 +640,7 @@ static void test_qr_gs1(const testCtx *const p_ctx) { /*116*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%AAAA%A", 0, "52 07 6D 43 D1 B5 35 C1 CC 3D 1A E0 00 EC 11 EC", 1, "A10(14)" }, /*117*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%AAAAA%", 0, "52 07 6D 43 D1 B5 35 C1 CC 39 9B 50 00 EC 11 EC", 1, "A10(14)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -721,7 +726,7 @@ static void test_qr_optimize(const testCtx *const p_ctx) { int bwipp_cmp; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, 4, -1, "1", 0, "10 04 40 EC 11 EC 11 EC 11", 1, "N1" }, /* 1*/ { UNICODE_MODE, 4, 5 << 8, "AAA", 0, "20 19 CC 28 00 EC 11 EC 11", 1, "A3" }, /* 2*/ { UNICODE_MODE, 4, 1 << 8, "0123456789", 0, "10 28 0C 56 6A 69 00 EC 11", 1, " N10 (nayuki.io - pure numeric)" }, @@ -753,7 +758,7 @@ static void test_qr_optimize(const testCtx *const p_ctx) { /* 28*/ { UNICODE_MODE, 2, -1, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁", ZINT_WARN_NONCOMPLIANT, "Warning (44) 80 83 A8 85 88 25 CA 2F 40 B0 53 C2 44 98 41 00 4A 02 0E A8 F8 F5 0D 30 4C 35 A1 CC", 0, "K8 N1 K8 B3; BWIPP different encodation (K8 N1 K8 N1 K1)" }, /* 29*/ { UNICODE_MODE, 1, -1, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機はょが意見想ハ業独案ユヲウ患職ヲ平美さ毎放どぽたけ家没べお化富べ町大シ情魚ッでれ一冬すぼめり。社ト可化モマ試音ばじご育青康演ぴぎ権型固スで能麩ぜらもほ河都しちほラ収90作の年要とだむ部動ま者断チ第41一1米索焦茂げむしれ。測フ物使だて目月国スリカハ夏検にいへ児72告物ゆは載核ロアメヱ登輸どべゃ催行アフエハ議歌ワ河倫剖だ。記タケウ因載ヒイホヤ禁3輩彦関トえび肝区勝ワリロ成禁ぼよ界白ウヒキレ中島べせぜい各安うしぽリ覧生テ基一でむしゃ中新トヒキソ声碁スしび起田ア信大未ゅもばち。", ZINT_WARN_NONCOMPLIANT, "Warning (589) 80 20 EA 21 62 09 72 8B D0 2C 14 F0 91 26 10 40 04 A0 08 3A A3 E3 D4 34 C1 30 D6 87", 0, "K8 N1 K8 N1 K10 N2 K33 N2 K16 N1 K89 N2 K14 B5 K28 N2 K40 N1 K65; BWIPP different encodation (same except A2 B6 instead of B5)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -842,7 +847,7 @@ static void test_qr_encode(const testCtx *const p_ctx) { char *expected; }; /* や U+3084 kanji, in Shift JIS 0x82E2 (\202\342), UTF-8 E38284; its 2nd byte 0xE2 + 0x40-FC also form Shift JIS */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_QRCODE, UNICODE_MODE, -1, -1, -1, -1, { 0, 0, "" }, "QR Code Symbol", -1, 0, 21, 21, 0, "ISO 18004 Figure 1 **NOT SAME** uses mask 110 instead of 101; BWIPP uses 101", "111111101001101111111" "100000101001101000001" @@ -4275,7 +4280,7 @@ static void test_qr_encode(const testCtx *const p_ctx) { "111111101110111010101" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -4374,7 +4379,7 @@ static void test_qr_encode_segs(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_QRCODE, UNICODE_MODE, 4, -1, 8 << 8, { 0, 0, "" }, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 21, 21, 1, "Standard example", "111111101101001111111" "100000101100101000001" @@ -4596,7 +4601,7 @@ static void test_qr_encode_segs(const testCtx *const p_ctx) { "1111111000101101110011001" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, j, seg_count, ret; struct zint_symbol *symbol = NULL; @@ -4718,7 +4723,7 @@ static void test_qr_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_QRCODE, UNICODE_MODE, -1, -1, "12345678901234", 0, 21, 21, "14 chars, Numeric mode" }, /* 1*/ { BARCODE_QRCODE, UNICODE_MODE, -1, -1, "ABC 123 ABC 123 ABCD", 0, 21, 21, "20 chars, Alphanumeric" }, /* 2*/ { BARCODE_QRCODE, UNICODE_MODE, -1, -1, "ABCde fG H 123456 IJKlmn, 1234567890 opQ Rst uvwxyz. 1234", 0, 29, 29, "57 chars, Alphanumeric" }, @@ -4763,7 +4768,7 @@ static void test_qr_perf(const testCtx *const p_ctx) { "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 12345678901234567890123456 点点点点点点点点点点点点点点点点点点点点点点点点点点", ZINT_WARN_NONCOMPLIANT, 133, 133, "1498 chars, Mixed modes" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; @@ -4882,75 +4887,76 @@ static void test_microqr_options(const testCtx *const p_ctx) { int ret_encode; int ret_vector; int expected_size; + char *expected_errtxt; int compare_previous; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { -1, -1, "12345", 0, 0, 11, -1 }, /* ECC auto-set to 1 (L), version auto-set to 1 */ - /* 1*/ { 1, -1, "12345", 0, 0, 11, 0 }, /* ECC 1 (L), version auto-set to 1 */ - /* 2*/ { 2, -1, "12345", 0, 0, 13, 1 }, /* ECC 2 (M), version auto-set to 2 */ - /* 3*/ { 3, -1, "12345", 0, 0, 17, 1 }, /* ECC 3 (Q), version auto-set to 3 */ - /* 4*/ { 4, -1, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, -1 }, - /* 5*/ { -1, 1, "12345", 0, 0, 11, -1 }, /* ECC auto-set to 1, version 1 */ - /* 6*/ { -1, 2, "12345", 0, 0, 13, 1 }, /* ECC auto-set to 2, version 2 */ - /* 7*/ { 2, 2, "12345", 0, 0, 13, 0 }, - /* 8*/ { -1, 3, "12345", 0, 0, 15, 1 }, /* ECC auto-set to 2, version 3 */ - /* 9*/ { 2, 3, "12345", 0, 0, 15, 0 }, - /* 10*/ { 1, 3, "12345", 0, 0, 15, 1 }, - /* 11*/ { -1, 4, "12345", 0, 0, 17, 1 }, /* ECC auto-set to 3, version 4 */ - /* 12*/ { 3, 4, "12345", 0, 0, 17, 0 }, /* ECC auto-set to 3, version 4 */ - /* 13*/ { 2, 4, "12345", 0, 0, 17, 1 }, - /* 14*/ { -1, 5, "12345", 0, 0, 11, -1 }, /* Size > 4 ignored */ - /* 15*/ { 1, 5, "12345", 0, 0, 11, 0 }, /* Ignored also if ECC given */ - /* 16*/ { 1, 1, "12345", 0, 0, 11, 0 }, /* ECC 1, version 1 */ - /* 17*/ { 1, 2, "12345", 0, 0, 13, 1 }, /* ECC 1, version 2 */ - /* 18*/ { 1, 3, "12345", 0, 0, 15, 1 }, /* ECC 1, version 3 */ - /* 19*/ { 1, 4, "12345", 0, 0, 17, 1 }, /* ECC 1, version 4 */ - /* 20*/ { 2, 1, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, -1 }, - /* 21*/ { 2, 2, "12345", 0, -1, 13, -1 }, /* ECC 2, version 2 */ - /* 22*/ { 2, 3, "12345", 0, -1, 15, 1 }, /* ECC 2, version 3 */ - /* 23*/ { 2, 4, "12345", 0, -1, 17, 1 }, /* ECC 2, version 4 */ - /* 24*/ { 3, 1, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, -1 }, - /* 25*/ { 3, 2, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, -1 }, - /* 26*/ { 3, 3, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, -1 }, - /* 27*/ { 3, 4, "12345", 0, -1, 17, -1 }, /* ECC 3, version 4 */ - /* 28*/ { 4, 4, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, -1 }, - /* 29*/ { 5, -1, "12345", 0, 0, 11, -1 }, /* ECC > 4 ignored */ - /* 30*/ { 5, 1, "12345", 0, 0, 11, 0 }, /* Ignored also if size given */ - /* 31*/ { 1, 1, "123456", ZINT_ERROR_TOO_LONG, -1, 0, -1 }, - /* 32*/ { 1, -1, "123456", 0, 0, 13, -1 }, /* ECC 1 (L), version auto-set to 2 */ - /* 33*/ { 1, 2, "123456", 0, 0, 13, 0 }, - /* 34*/ { 2, 2, "ABCDEF", ZINT_ERROR_TOO_LONG, -1, 0, -1 }, - /* 35*/ { 1, -1, "ABCDEF", 0, 0, 13, -1 }, /* ECC 1 (L), version auto-set to 2 */ - /* 36*/ { 1, 2, "ABCDEF", 0, 0, 13, 0 }, - /* 37*/ { 2, -1, "ABCDE", 0, 0, 13, -1 }, /* ECC 2 (M), version auto-set to 2 */ - /* 38*/ { 2, 2, "ABCDE", 0, 0, 13, 0 }, /* ECC 2 (M), version auto-set to 2 */ - /* 39*/ { 1, -1, "ABCDEABCDEABCD", 0, 0, 15, -1 }, /* 14 alphanumerics, ECC 1, version auto-set to 3 */ - /* 40*/ { 1, 3, "ABCDEABCDEABCD", 0, 0, 15, 0 }, - /* 41*/ { 2, 3, "ABCDEABCDEABCD", ZINT_ERROR_TOO_LONG, -1, 0, -1 }, - /* 42*/ { 2, 3, "ABCDEABCDEA", 0, 0, 15, -1 }, /* 11 alphanumerics, ECC 2, version 3 */ - /* 43*/ { 1, -1, "ABCDEFGHIJABCDEFGHIJA", 0, 0, 17, -1 }, /* 21 alphanumerics, ECC 1, version auto-set to 4 */ - /* 44*/ { 1, 4, "ABCDEFGHIJABCDEFGHIJA", 0, 0, 17, 0 }, - /* 45*/ { 2, 4, "ABCDEFGHIJABCDEFGHIJA", ZINT_ERROR_TOO_LONG, -1, 0, -1 }, - /* 46*/ { 2, 4, "ABCDEFGHIJABCDEFGH", 0, 0, 17, -1 }, /* 18 alphanumerics, ECC 2, version 4 */ - /* 47*/ { 3, 4, "ABCDEFGHIJABCDEFGH", ZINT_ERROR_TOO_LONG, -1, 0, -1 }, - /* 48*/ { 3, 4, "ABCDEFGHIJABC", 0, 0, 17, -1 }, /* 13 alphanumerics, ECC 3 (Q), version 4 */ - /* 49*/ { -1, -1, "123456789012345678901234567890123456", ZINT_ERROR_TOO_LONG, -1, 0, -1 }, /* 35 absolute max */ - /* 50*/ { -1, -1, "貫貫貫貫貫", 0, 0, 17, -1 }, /* 5 Kanji max */ - /* 51*/ { -1, -1, "貫貫貫貫貫貫", ZINT_ERROR_TOO_LONG, -1, 0, -1 }, - /* 52*/ { -1, 1, "A", ZINT_ERROR_INVALID_DATA, -1, 0, -1 }, /* Numeric only */ - /* 53*/ { -1, 2, "A", 0, 0, 13, -1 }, - /* 54*/ { -1, 2, " ", 0, 0, 13, -1 }, - /* 55*/ { -1, 2, "$%*+", 0, 0, 13, -1 }, - /* 56*/ { -1, 2, "-./:", 0, 0, 13, -1 }, - /* 57*/ { -1, 2, "a", ZINT_ERROR_INVALID_DATA, -1, 0, -1 }, /* Uppercase only */ - /* 58*/ { -1, 2, "!", ZINT_ERROR_INVALID_DATA, -1, 0, -1 }, /* Certain punctuation only */ - /* 59*/ { -1, 2, "#", ZINT_ERROR_INVALID_DATA, -1, 0, -1 }, /* Certain punctuation only */ - /* 60*/ { -1, 2, ",", ZINT_ERROR_INVALID_DATA, -1, 0, -1 }, /* Certain punctuation only */ - /* 61*/ { -1, 2, "@", ZINT_ERROR_INVALID_DATA, -1, 0, -1 }, /* Certain punctuation only */ - /* 62*/ { -1, 2, "\177", ZINT_ERROR_INVALID_DATA, -1, 0, -1 }, + static const struct item data[] = { + /* 0*/ { -1, -1, "12345", 0, 0, 11, "", -1 }, /* ECC auto-set to 1 (L), version auto-set to 1 */ + /* 1*/ { 1, -1, "12345", 0, 0, 11, "", 0 }, /* ECC 1 (L), version auto-set to 1 */ + /* 2*/ { 2, -1, "12345", 0, 0, 13, "", 1 }, /* ECC 2 (M), version auto-set to 2 */ + /* 3*/ { 3, -1, "12345", 0, 0, 17, "", 1 }, /* ECC 3 (Q), version auto-set to 3 */ + /* 4*/ { 4, -1, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, "Error 566: Error correction level H not available", -1 }, + /* 5*/ { -1, 1, "12345", 0, 0, 11, "", -1 }, /* ECC auto-set to 1, version 1 */ + /* 6*/ { -1, 2, "12345", 0, 0, 13, "", 1 }, /* ECC auto-set to 2, version 2 */ + /* 7*/ { 2, 2, "12345", 0, 0, 13, "", 0 }, + /* 8*/ { -1, 3, "12345", 0, 0, 15, "", 1 }, /* ECC auto-set to 2, version 3 */ + /* 9*/ { 2, 3, "12345", 0, 0, 15, "", 0 }, + /* 10*/ { 1, 3, "12345", 0, 0, 15, "", 1 }, + /* 11*/ { -1, 4, "12345", 0, 0, 17, "", 1 }, /* ECC auto-set to 3, version 4 */ + /* 12*/ { 3, 4, "12345", 0, 0, 17, "", 0 }, /* ECC auto-set to 3, version 4 */ + /* 13*/ { 2, 4, "12345", 0, 0, 17, "", 1 }, + /* 14*/ { -1, 5, "12345", 0, 0, 11, "", -1 }, /* Size > 4 ignored */ + /* 15*/ { 1, 5, "12345", 0, 0, 11, "", 0 }, /* Ignored also if ECC given */ + /* 16*/ { 1, 1, "12345", 0, 0, 11, "", 0 }, /* ECC 1, version 1 */ + /* 17*/ { 1, 2, "12345", 0, 0, 13, "", 1 }, /* ECC 1, version 2 */ + /* 18*/ { 1, 3, "12345", 0, 0, 15, "", 1 }, /* ECC 1, version 3 */ + /* 19*/ { 1, 4, "12345", 0, 0, 17, "", 1 }, /* ECC 1, version 4 */ + /* 20*/ { 2, 1, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, "Error 574: Version M1 supports error correction level L only", -1 }, + /* 21*/ { 2, 2, "12345", 0, -1, 13, "", -1 }, /* ECC 2, version 2 */ + /* 22*/ { 2, 3, "12345", 0, -1, 15, "", 1 }, /* ECC 2, version 3 */ + /* 23*/ { 2, 4, "12345", 0, -1, 17, "", 1 }, /* ECC 2, version 4 */ + /* 24*/ { 3, 1, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, "Error 574: Version M1 supports error correction level L only", -1 }, + /* 25*/ { 3, 2, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, "Error 563: Error correction level Q requires Version M4", -1 }, + /* 26*/ { 3, 3, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, "Error 563: Error correction level Q requires Version M4", -1 }, + /* 27*/ { 3, 4, "12345", 0, -1, 17, "", -1 }, /* ECC 3, version 4 */ + /* 28*/ { 4, 4, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, "Error 566: Error correction level H not available", -1 }, + /* 29*/ { 5, -1, "12345", 0, 0, 11, "", -1 }, /* ECC > 4 ignored */ + /* 30*/ { 5, 1, "12345", 0, 0, 11, "", 0 }, /* Ignored also if size given */ + /* 31*/ { 1, 1, "123456", ZINT_ERROR_TOO_LONG, -1, 0, "Error 570: Input too long for Version M1-L, requires 4 codewords (maximum 3)", -1 }, + /* 32*/ { 1, -1, "123456", 0, 0, 13, "", -1 }, /* ECC 1 (L), version auto-set to 2 */ + /* 33*/ { 1, 2, "123456", 0, 0, 13, "", 0 }, + /* 34*/ { 2, 2, "ABCDEF", ZINT_ERROR_TOO_LONG, -1, 0, "Error 570: Input too long for Version M2-M, requires 5 codewords (maximum 4)", -1 }, + /* 35*/ { 1, -1, "ABCDEF", 0, 0, 13, "", -1 }, /* ECC 1 (L), version auto-set to 2 */ + /* 36*/ { 1, 2, "ABCDEF", 0, 0, 13, "", 0 }, + /* 37*/ { 2, -1, "ABCDE", 0, 0, 13, "", -1 }, /* ECC 2 (M), version auto-set to 2 */ + /* 38*/ { 2, 2, "ABCDE", 0, 0, 13, "", 0 }, /* ECC 2 (M), version auto-set to 2 */ + /* 39*/ { 1, -1, "ABCDEABCDEABCD", 0, 0, 15, "", -1 }, /* 14 alphanumerics, ECC 1, version auto-set to 3 */ + /* 40*/ { 1, 3, "ABCDEABCDEABCD", 0, 0, 15, "", 0 }, + /* 41*/ { 2, 3, "ABCDEABCDEABCD", ZINT_ERROR_TOO_LONG, -1, 0, "Error 570: Input too long for Version M3-M, requires 11 codewords (maximum 9)", -1 }, + /* 42*/ { 2, 3, "ABCDEABCDEA", 0, 0, 15, "", -1 }, /* 11 alphanumerics, ECC 2, version 3 */ + /* 43*/ { 1, -1, "ABCDEFGHIJABCDEFGHIJA", 0, 0, 17, "", -1 }, /* 21 alphanumerics, ECC 1, version auto-set to 4 */ + /* 44*/ { 1, 4, "ABCDEFGHIJABCDEFGHIJA", 0, 0, 17, "", 0 }, + /* 45*/ { 2, 4, "ABCDEFGHIJABCDEFGHIJA", ZINT_ERROR_TOO_LONG, -1, 0, "Error 565: Input too long for Version M4-M, requires 16 codewords (maximum 14)", -1 }, + /* 46*/ { 2, 4, "ABCDEFGHIJABCDEFGH", 0, 0, 17, "", -1 }, /* 18 alphanumerics, ECC 2, version 4 */ + /* 47*/ { 3, 4, "ABCDEFGHIJABCDEFGH", ZINT_ERROR_TOO_LONG, -1, 0, "Error 565: Input too long for Version M4-Q, requires 14 codewords (maximum 10)", -1 }, + /* 48*/ { 3, 4, "ABCDEFGHIJABC", 0, 0, 17, "", -1 }, /* 13 alphanumerics, ECC 3 (Q), version 4 */ + /* 49*/ { -1, -1, "123456789012345678901234567890123456", ZINT_ERROR_TOO_LONG, -1, 0, "Error 562: Input length 36 too long (maximum 35)", -1 }, /* 35 absolute max */ + /* 50*/ { -1, -1, "貫貫貫貫貫", 0, 0, 17, "", -1 }, /* 5 Kanji max */ + /* 51*/ { -1, -1, "貫貫貫貫貫貫", ZINT_ERROR_TOO_LONG, -1, 0, "Error 565: Input too long for Version M4-L, requires 19 codewords (maximum 16)", -1 }, + /* 52*/ { -1, 1, "A", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 758: Invalid character at position 1 in input for Version M1 (digits only)", -1 }, /* Numeric only */ + /* 53*/ { -1, 2, "A", 0, 0, 13, "", -1 }, + /* 54*/ { -1, 2, " ", 0, 0, 13, "", -1 }, + /* 55*/ { -1, 2, "$%*+", 0, 0, 13, "", -1 }, + /* 56*/ { -1, 2, "-./:", 0, 0, 13, "", -1 }, + /* 57*/ { -1, 2, "a", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 759: Invalid character in input for Version M2 (digits, A-Z, space and \"$%*+-./:\" only)", -1 }, /* Uppercase only */ + /* 58*/ { -1, 2, "!", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 759: Invalid character in input for Version M2 (digits, A-Z, space and \"$%*+-./:\" only)", -1 }, /* Certain punctuation only */ + /* 59*/ { -1, 2, "#", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 759: Invalid character in input for Version M2 (digits, A-Z, space and \"$%*+-./:\" only)", -1 }, /* Certain punctuation only */ + /* 60*/ { -1, 2, ",", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 759: Invalid character in input for Version M2 (digits, A-Z, space and \"$%*+-./:\" only)", -1 }, /* Certain punctuation only */ + /* 61*/ { -1, 2, "@", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 759: Invalid character in input for Version M2 (digits, A-Z, space and \"$%*+-./:\" only)", -1 }, /* Certain punctuation only */ + /* 62*/ { -1, 2, "\177", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 759: Invalid character in input for Version M2 (digits, A-Z, space and \"$%*+-./:\" only)", -1 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -4969,6 +4975,7 @@ static void test_microqr_options(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); if (p_ctx->index == -1 && data[i].compare_previous != -1) { ret = testUtilSymbolCmp(symbol, &previous_symbol); assert_equal(!ret, !data[i].compare_previous, "i:%d testUtilSymbolCmp !ret %d != %d\n", i, ret, data[i].compare_previous); @@ -4993,7 +5000,6 @@ static void test_microqr_input(const testCtx *const p_ctx) { struct item { int input_mode; - int option_1; int option_3; char *data; int ret; @@ -5015,50 +5021,50 @@ static void test_microqr_input(const testCtx *const p_ctx) { /* 点 U+70B9 kanji, in Shift JIS 0x935F (\223\137), UTF-8 E782B9 */ /* 茗 U+8317 kanji, in Shift JIS 0xE4AA (\344\252), UTF-8 E88C97 */ /* Á U+00C1, UTF-8 C381; ȁ U+0201, UTF-8 C881; Ȃ U+0202, UTF-8 C882; ¢ U+00A2, UTF-8 C2A2; á U+00E1, UTF-8 C3A1 */ - struct item data[] = { - /* 0*/ { UNICODE_MODE, 2, 1, "é", 0, "87 A4 00 EC 11 EC 11 EC 00", 1, 1, "B1 (ISO 8859-1)" }, - /* 1*/ { DATA_MODE, 2, -1, "é", 0, "8B 0E A4 00 EC 11 EC 11 00", 1, 0, "B2 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, - /* 2*/ { UNICODE_MODE, 2, -1, "β", 0, "C8 80 00 00 EC 11 EC 11 00", 1, 1, "K1 (Shift JIS)" }, - /* 3*/ { UNICODE_MODE, 2, -1, "ก", ZINT_ERROR_INVALID_DATA, "Error 800: Invalid character in input data", 1, 1, "ก not in Shift JIS" }, - /* 4*/ { UNICODE_MODE, 2, -1, "Ж", 0, "C8 91 C0 00 EC 11 EC 11 00", 1, 1, "K1 (Shift JIS)" }, - /* 5*/ { UNICODE_MODE, 2, -1, "ກ", ZINT_ERROR_INVALID_DATA, "Error 800: Invalid character in input data", 1, 1, "ກ not in Shift JIS" }, - /* 6*/ { UNICODE_MODE, 2, -1, "\\", 0, "85 70 00 EC 11 EC 11 EC 00", 1, 1, "B1 (ASCII)" }, - /* 7*/ { UNICODE_MODE, 2, -1, "¥", 0, "86 94 00 EC 11 EC 11 EC 00", 1, 1, "B1 (ISO 8859-1) (same bytes as ・ Shift JIS below, so ambiguous)" }, - /* 8*/ { UNICODE_MODE, 2, -1, "・", 0, "86 94 00 EC 11 EC 11 EC 00", 1, 1, "B1 (Shift JIS) single-byte codepoint A5 (same bytes as ¥ ISO 8859-1 above, so ambiguous)" }, - /* 9*/ { UNICODE_MODE, 2, -1, "¿", 0, "86 FC 00 EC 11 EC 11 EC 00", 1, 1, "B1 (ISO 8859-1) (same bytes as ソ Shift JIS below, so ambiguous)" }, - /* 10*/ { UNICODE_MODE, 2, -1, "ソ", 0, "86 FC 00 EC 11 EC 11 EC 00", 1, 1, "B1 (Shift JIS) (same bytes as ¿ ISO 8859-1 above, so ambiguous)" }, - /* 11*/ { UNICODE_MODE, 2, -1, "~", 0, "85 F8 00 EC 11 EC 11 EC 00", 1, 1, "B1 (ASCII) (same bytes as ‾ Shift JIS below, so ambiguous)" }, - /* 12*/ { UNICODE_MODE, 2, -1, "‾", 0, "85 F8 00 EC 11 EC 11 EC 00", 1, 0, "B1 (Shift JIS) (same bytes as ~ ASCII above, so ambiguous); ZXing-C++ doesn't map Shift JIS ASCII" }, - /* 13*/ { UNICODE_MODE, 2, -1, "点", 0, "CB 67 C0 00 EC 11 EC 11 00", 1, 1, "K1 (Shift JIS)" }, - /* 14*/ { DATA_MODE, 2, -1, "\223\137", 0, "8A 4D 7C 00 EC 11 EC 11 00", 0, 0, "B2 (Shift JIS); BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, - /* 15*/ { DATA_MODE, 2, ZINT_FULL_MULTIBYTE, "\223\137", 0, "CB 67 C0 00 EC 11 EC 11 00", 1, 1, "K1 (Shift JIS) (full multibyte)" }, - /* 16*/ { DATA_MODE, 2, -1, "点", 0, "8F 9E 0A E4 00 EC 11 EC 00", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, - /* 17*/ { UNICODE_MODE, 2, -1, "茗", 0, "CE AA 80 00 EC 11 EC 11 00", 1, 1, "K1 (Shift JIS)" }, - /* 18*/ { DATA_MODE, 2, -1, "\344\252", 0, "8B 92 A8 00 EC 11 EC 11 00", 0, 0, "B2 (Shift JIS); BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below; ZXing-C++ test can't handle DATA_MODE for certain inputs)" }, - /* 19*/ { DATA_MODE, 2, ZINT_FULL_MULTIBYTE, "\344\252", 0, "CE AA 80 00 EC 11 EC 11 00", 1, 1, "K1 (Shift JIS) (full multibyte)" }, - /* 20*/ { DATA_MODE, 2, -1, "茗", 0, "8F A2 32 5C 00 EC 11 EC 00", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, - /* 21*/ { UNICODE_MODE, 2, -1, "¥点", 0, "8D 72 4D 7C 00 EC 11 EC 00", 1, 0, "B3 (Shift JIS) (optimized from B1 K1); ZXing-C++ doesn't map Shift JIS ASCII" }, - /* 22*/ { DATA_MODE, 2, -1, "\134\223\137", 0, "8D 72 4D 7C 00 EC 11 EC 00", 1, 0, "B3 (Shift JIS) (optimized from B1 K1); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, - /* 23*/ { DATA_MODE, 2, -1, "¥点", 0, "97 0A 97 9E 0A E4 00 EC 00", 1, 0, "B5 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, - /* 24*/ { UNICODE_MODE, 2, -1, "点茗", 0, "D3 67 F5 54 00 EC 11 EC 00", 1, 1, "K2 (Shift JIS)" }, - /* 25*/ { DATA_MODE, 2, -1, "\223\137\344\252", 0, "92 4D 7F 92 A8 00 EC 11 00", 0, 0, "B4 (Shift JIS; BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below)); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, - /* 26*/ { DATA_MODE, 2, ZINT_FULL_MULTIBYTE, "\223\137\344\252", 0, "D3 67 F5 54 00 EC 11 EC 00", 1, 1, "K2 (Shift JIS) (full multibyte)" }, - /* 27*/ { DATA_MODE, 2, -1, "点茗", 0, "9B 9E 0A E7 A2 32 5C 00 00", 1, 0, "B6 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, - /* 28*/ { DATA_MODE, 2, ZINT_FULL_MULTIBYTE, "点茗", 0, "9B 9E 0A E7 A2 32 5C 00 00", 1, 1, "B6 (UTF-8)" }, - /* 29*/ { UNICODE_MODE, 2, -1, "点茗・", 0, "D3 67 F5 55 0D 28 00 EC 00", 1, 1, "K2 B1 (Shift JIS)" }, - /* 30*/ { DATA_MODE, 2, -1, "\223\137\344\252\245", 0, "96 4D 7F 92 AA 94 00 EC 00", 0, 0, "B5 (Shift JIS); BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, - /* 31*/ { DATA_MODE, 2, ZINT_FULL_MULTIBYTE, "\223\137\344\252\245", 0, "D3 67 F5 55 0D 28 00 EC 00", 1, 1, "K2 B1 (Shift JIS) (full multibyte)" }, - /* 32*/ { DATA_MODE, 1, -1, "点茗・", 0, "A7 9E 0A E7 A2 32 5F BE F6 94 00", 1, 0, "B9 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, - /* 33*/ { UNICODE_MODE, 2, -1, "¥点茗・", 0, "99 72 4D 7F 92 AA 94 00 00", 1, 0, "B6 (Shift JIS) (optimized from B1 K2 B1); ZXing-C++ doesn't map Shift JIS ASCII" }, - /* 34*/ { DATA_MODE, 2, -1, "\134\223\137\344\252\245", 0, "99 72 4D 7F 92 AA 94 00 00", 1, 0, "B6 (Shift JIS) (optimized from B1 K2 B1); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, - /* 35*/ { DATA_MODE, 2, -1, "¥点茗・", 0, "4B C2 A5 E7 82 B9 E8 8C 97 EF BD A5 00 00", 1, 0, "B11 (UTF-8); ZXing-C++ doesn't map Shift JIS ASCII" }, - /* 36*/ { DATA_MODE, 2, -1, "ÁȁȁȁȂ¢", 0, "4C C3 81 C8 81 C8 81 C8 81 C8 82 C2 A2 00", 1, 0, "B12 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, - /* 37*/ { DATA_MODE, 1, -1, "ÁȁȁȁȁȂ¢", 0, "4E C3 81 C8 81 C8 81 C8 81 C8 81 C8 82 C2 A2 00", 0, 0, "B14 (UTF-8); BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, - /* 38*/ { DATA_MODE, 1, ZINT_FULL_MULTIBYTE, "ÁȁȁȁȁȂ¢", 0, "41 C3 6C 08 80 44 02 20 11 00 88 0A 12 0D 10 00", 1, 1, "B1 K6 B1 (UTF-8) (full multibyte)" }, - /* 39*/ { UNICODE_MODE, 2, -1, "áA", 0, "8B 85 04 00 EC 11 EC 11 00", 0, 1, "B2 (ISO 8859-1); BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below)" }, - /* 40*/ { UNICODE_MODE, 2, ZINT_FULL_MULTIBYTE, "áA", 0, "CE 00 40 00 EC 11 EC 11 00", 1, 1, "K1 (ISO 8859-1) (full multibyte)" }, + static const struct item data[] = { + /* 0*/ { UNICODE_MODE, -1, "é", 0, "87 A4 00 EC 11 EC 11 EC 00 (68)", 1, 1, "B1 (ISO 8859-1)" }, + /* 1*/ { DATA_MODE, -1, "é", 0, "8B 0E A4 00 EC 11 EC 11 00 (68)", 1, 0, "B2 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, + /* 2*/ { UNICODE_MODE, -1, "β", 0, "C8 80 00 00 EC 11 EC 11 00 (68)", 1, 1, "K1 (Shift JIS)" }, + /* 3*/ { UNICODE_MODE, -1, "ก", ZINT_ERROR_INVALID_DATA, "Error 800: Invalid character in input", 1, 1, "ก not in Shift JIS" }, + /* 4*/ { UNICODE_MODE, -1, "Ж", 0, "C8 91 C0 00 EC 11 EC 11 00 (68)", 1, 1, "K1 (Shift JIS)" }, + /* 5*/ { UNICODE_MODE, -1, "ກ", ZINT_ERROR_INVALID_DATA, "Error 800: Invalid character in input", 1, 1, "ກ not in Shift JIS" }, + /* 6*/ { UNICODE_MODE, -1, "\\", 0, "85 70 00 EC 11 EC 11 EC 00 (68)", 1, 1, "B1 (ASCII)" }, + /* 7*/ { UNICODE_MODE, -1, "¥", 0, "86 94 00 EC 11 EC 11 EC 00 (68)", 1, 1, "B1 (ISO 8859-1) (same bytes as ・ Shift JIS below, so ambiguous)" }, + /* 8*/ { UNICODE_MODE, -1, "・", 0, "86 94 00 EC 11 EC 11 EC 00 (68)", 1, 1, "B1 (Shift JIS) single-byte codepoint A5 (same bytes as ¥ ISO 8859-1 above, so ambiguous)" }, + /* 9*/ { UNICODE_MODE, -1, "¿", 0, "86 FC 00 EC 11 EC 11 EC 00 (68)", 1, 1, "B1 (ISO 8859-1) (same bytes as ソ Shift JIS below, so ambiguous)" }, + /* 10*/ { UNICODE_MODE, -1, "ソ", 0, "86 FC 00 EC 11 EC 11 EC 00 (68)", 1, 1, "B1 (Shift JIS) (same bytes as ¿ ISO 8859-1 above, so ambiguous)" }, + /* 11*/ { UNICODE_MODE, -1, "~", 0, "85 F8 00 EC 11 EC 11 EC 00 (68)", 1, 1, "B1 (ASCII) (same bytes as ‾ Shift JIS below, so ambiguous)" }, + /* 12*/ { UNICODE_MODE, -1, "‾", 0, "85 F8 00 EC 11 EC 11 EC 00 (68)", 1, 0, "B1 (Shift JIS) (same bytes as ~ ASCII above, so ambiguous); ZXing-C++ doesn't map Shift JIS ASCII" }, + /* 13*/ { UNICODE_MODE, -1, "点", 0, "CB 67 C0 00 EC 11 EC 11 00 (68)", 1, 1, "K1 (Shift JIS)" }, + /* 14*/ { DATA_MODE, -1, "\223\137", 0, "8A 4D 7C 00 EC 11 EC 11 00 (68)", 0, 0, "B2 (Shift JIS); BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, + /* 15*/ { DATA_MODE, ZINT_FULL_MULTIBYTE, "\223\137", 0, "CB 67 C0 00 EC 11 EC 11 00 (68)", 1, 1, "K1 (Shift JIS) (full multibyte)" }, + /* 16*/ { DATA_MODE, -1, "点", 0, "8F 9E 0A E4 00 EC 11 EC 00 (68)", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, + /* 17*/ { UNICODE_MODE, -1, "茗", 0, "CE AA 80 00 EC 11 EC 11 00 (68)", 1, 1, "K1 (Shift JIS)" }, + /* 18*/ { DATA_MODE, -1, "\344\252", 0, "8B 92 A8 00 EC 11 EC 11 00 (68)", 0, 0, "B2 (Shift JIS); BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below; ZXing-C++ test can't handle DATA_MODE for certain inputs)" }, + /* 19*/ { DATA_MODE, ZINT_FULL_MULTIBYTE, "\344\252", 0, "CE AA 80 00 EC 11 EC 11 00 (68)", 1, 1, "K1 (Shift JIS) (full multibyte)" }, + /* 20*/ { DATA_MODE, -1, "茗", 0, "8F A2 32 5C 00 EC 11 EC 00 (68)", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, + /* 21*/ { UNICODE_MODE, -1, "¥点", 0, "8D 72 4D 7C 00 EC 11 EC 00 (68)", 1, 0, "B3 (Shift JIS) (optimized from B1 K1); ZXing-C++ doesn't map Shift JIS ASCII" }, + /* 22*/ { DATA_MODE, -1, "\134\223\137", 0, "8D 72 4D 7C 00 EC 11 EC 00 (68)", 1, 0, "B3 (Shift JIS) (optimized from B1 K1); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, + /* 23*/ { DATA_MODE, -1, "¥点", 0, "97 0A 97 9E 0A E4 00 EC 00 (68)", 1, 0, "B5 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, + /* 24*/ { UNICODE_MODE, -1, "点茗", 0, "D3 67 F5 54 00 EC 11 EC 00 (68)", 1, 1, "K2 (Shift JIS)" }, + /* 25*/ { DATA_MODE, -1, "\223\137\344\252", 0, "92 4D 7F 92 A8 00 EC 11 00 (68)", 0, 0, "B4 (Shift JIS; BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below)); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, + /* 26*/ { DATA_MODE, ZINT_FULL_MULTIBYTE, "\223\137\344\252", 0, "D3 67 F5 54 00 EC 11 EC 00 (68)", 1, 1, "K2 (Shift JIS) (full multibyte)" }, + /* 27*/ { DATA_MODE, -1, "点茗", 0, "9B 9E 0A E7 A2 32 5C 00 00 (68)", 1, 0, "B6 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, + /* 28*/ { DATA_MODE, ZINT_FULL_MULTIBYTE, "点茗", 0, "9B 9E 0A E7 A2 32 5C 00 00 (68)", 1, 1, "B6 (UTF-8)" }, + /* 29*/ { UNICODE_MODE, -1, "点茗・", 0, "D3 67 F5 55 0D 28 00 EC 00 (68)", 1, 1, "K2 B1 (Shift JIS)" }, + /* 30*/ { DATA_MODE, -1, "\223\137\344\252\245", 0, "96 4D 7F 92 AA 94 00 EC 00 (68)", 0, 0, "B5 (Shift JIS); BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, + /* 31*/ { DATA_MODE, ZINT_FULL_MULTIBYTE, "\223\137\344\252\245", 0, "D3 67 F5 55 0D 28 00 EC 00 (68)", 1, 1, "K2 B1 (Shift JIS) (full multibyte)" }, + /* 32*/ { DATA_MODE, -1, "点茗・", 0, "A7 9E 0A E7 A2 32 5F BE F6 94 00 (84)", 1, 0, "B9 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, + /* 33*/ { UNICODE_MODE, -1, "¥点茗・", 0, "99 72 4D 7F 92 AA 94 00 00 (68)", 1, 0, "B6 (Shift JIS) (optimized from B1 K2 B1); ZXing-C++ doesn't map Shift JIS ASCII" }, + /* 34*/ { DATA_MODE, -1, "\134\223\137\344\252\245", 0, "99 72 4D 7F 92 AA 94 00 00 (68)", 1, 0, "B6 (Shift JIS) (optimized from B1 K2 B1); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, + /* 35*/ { DATA_MODE, -1, "¥点茗・", 0, "4B C2 A5 E7 82 B9 E8 8C 97 EF BD A5 00 00 (112)", 1, 0, "B11 (UTF-8); ZXing-C++ doesn't map Shift JIS ASCII" }, + /* 36*/ { DATA_MODE, -1, "ÁȁȁȁȂ¢", 0, "4C C3 81 C8 81 C8 81 C8 81 C8 82 C2 A2 00 (112)", 1, 0, "B12 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, + /* 37*/ { DATA_MODE, -1, "ÁȁȁȁȁȂ¢", 0, "4E C3 81 C8 81 C8 81 C8 81 C8 81 C8 82 C2 A2 00 (128)", 0, 0, "B14 (UTF-8); BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, + /* 38*/ { DATA_MODE, ZINT_FULL_MULTIBYTE, "ÁȁȁȁȁȂ¢", 0, "41 C3 6C 08 80 44 02 20 11 00 88 0A 12 0D 10 00 (128)", 1, 1, "B1 K6 B1 (UTF-8) (full multibyte)" }, + /* 39*/ { UNICODE_MODE, -1, "áA", 0, "8B 85 04 00 EC 11 EC 11 00 (68)", 0, 1, "B2 (ISO 8859-1); BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below)" }, + /* 40*/ { UNICODE_MODE, ZINT_FULL_MULTIBYTE, "áA", 0, "CE 00 40 00 EC 11 EC 11 00 (68)", 1, 1, "K1 (ISO 8859-1) (full multibyte)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -5086,8 +5092,8 @@ static void test_microqr_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); if (p_ctx->generate) { - printf(" /*%3d*/ { %s, %d, %s, \"%s\", %s, \"%s\", %d, %d, \"%s\" },\n", - i, testUtilInputModeName(data[i].input_mode), data[i].option_1, + printf(" /*%3d*/ { %s, %s, \"%s\", %s, \"%s\", %d, %d, \"%s\" },\n", + i, testUtilInputModeName(data[i].input_mode), testUtilOption3Name(BARCODE_MICROQR, data[i].option_3), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->errtxt, data[i].bwipp_cmp, data[i].zxingcpp_cmp, data[i].comment); @@ -5095,13 +5101,13 @@ static void test_microqr_input(const testCtx *const p_ctx) { 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 (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, data[i].option_3, debug)) { + if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, data[i].option_3, 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[17 * 17 + 1]; 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, data[i].option_3, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL); + ret = testUtilBwipp(i, symbol, -1, -1, data[i].option_3, 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); @@ -5144,44 +5150,44 @@ static void test_microqr_padding(const testCtx *const p_ctx) { char *expected; char *comment; }; - struct item data[] = { - /* 0*/ { -1, "1", 0, "22 00 00", "M1, bits left 13" }, - /* 1*/ { -1, "12", 0, "43 00 00", "M1, bits left 10" }, - /* 2*/ { -1, "123", 0, "63 D8 00", "M1, bits left 7" }, - /* 3*/ { -1, "1234", 0, "83 DA 00", "M1, bits left 3" }, - /* 4*/ { -1, "12345", 0, "A3 DA D0", "M1, bits left 0" }, - /* 5*/ { 1, "123456", 0, "30 F6 E4 00 EC", "M2-L, bits left 15" }, - /* 6*/ { 1, "1234567", 0, "38 F6 E4 38 00", "M2-L, bits left 11" }, - /* 7*/ { 1, "12345678", 0, "40 F6 E4 4E 00", "M2-L, bits left 8" }, - /* 8*/ { 1, "123456789", 0, "48 F6 E4 62 A0", "M2-L, bits left 5" }, - /* 9*/ { 1, "1234567890", 0, "50 F6 E4 62 A0", "M2-L, bits left 1" }, - /* 10*/ { 2, "1234", 0, "20 F6 80 EC", "M2-M, bits left 13" }, - /* 11*/ { 2, "123456", 0, "30 F6 E4 00", "M2-M, bits left 7" }, - /* 12*/ { 2, "1234567", 0, "38 F6 E4 38", "M2-M, bits left 3" }, - /* 13*/ { 2, "12345678", 0, "40 F6 E4 4E", "M2-M, bits left 0" }, - /* 14*/ { 1, "ABCDEF", 0, "E3 9A 8A 54 28", "M2-L, bits left 3" }, - /* 15*/ { 2, "ABCDE", 0, "D3 9A 8A 4E", "M2-M, bits left 0" }, - /* 16*/ { 1, "1234567890123456789", 0, "26 3D B9 18 A8 18 AC D4 D2 00 00", "M3-L, bits left 13" }, - /* 17*/ { 1, "12345678901234567890", 0, "28 3D B9 18 A8 18 AC D4 D6 80 00", "M3-L, bits left 10" }, - /* 18*/ { 1, "123456789012345678901", 0, "2A 3D B9 18 A8 18 AC D4 DC 28 00", "M3-L, bits left 7" }, - /* 19*/ { 1, "1234567890123456789012", 0, "2C 3D B9 18 A8 18 AC D4 DC 29 00", "M3-L, bits left 3" }, - /* 20*/ { 1, "12345678901234567890123", 0, "2E 3D B9 18 A8 18 AC D4 DC 29 70", "M3-L, bits left 0" }, - /* 21*/ { 2, "1234567890", 0, "14 3D B9 18 A8 00 EC 11 00", "M3-M, bits left 27" }, - /* 22*/ { 2, "123456789012345678", 0, "24 3D B9 18 A8 18 AC D4 C0", "M3-M, bits left 1" }, - /* 23*/ { 1, "ABCDEFGHIJKLMN", 0, "78 E6 A2 95 0A B8 59 EB 99 7E A0", "M3-L, bits left 1" }, - /* 24*/ { 2, "ABCDEFGHIJK", 0, "6C E6 A2 95 0A B8 59 EA 80", "M3-M, bits left 1" }, - /* 25*/ { 1, "1234567890123456789012345678", 0, "0E 0F 6E 46 2A 06 2B 35 37 0A 75 46 F0 00 EC 11", "M4-L, bits left 25" }, - /* 26*/ { 1, "123456789012345678901234567890", 0, "0F 0F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0 00 EC", "M4-L, bits left 19" }, - /* 27*/ { 1, "1234567890123456789012345678901234", 0, "11 0F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0 F6 80", "M4-L, bits left 5" }, - /* 28*/ { 1, "12345678901234567890123456789012345", 0, "11 8F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0 F6 B4", "M4-L, bits left 1" }, - /* 29*/ { 1, "123456789012345ABCDEFGHIJK", 0, "07 8F 6E 46 2A 06 2B 25 67 35 14 A8 55 C2 CF 54", "M4-L, bits left 0" }, - /* 30*/ { 2, "123456789012345678901234567890", 0, "0F 0F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0", "M4-M, bits left 3" }, - /* 31*/ { 3, "123456789012345678901", 0, "0A 8F 6E 46 2A 06 2B 35 37 0A", "M4-Q, bits left 1" }, - /* 32*/ { 1, "ABCDEFGHIJKLMNOPQRSTU", 0, "35 39 A8 A5 42 AE 16 7A E6 5F AC 51 95 B4 25 E0", "M4-L, bits left 4" }, - /* 33*/ { 2, "ABCDEFGHIJKLMNOPQR", 0, "32 39 A8 A5 42 AE 16 7A E6 5F AC 51 95 A0", "M4-M, bits left 5" }, - /* 34*/ { 3, "ABCDEFGHIJKLM", 0, "2D 39 A8 A5 42 AE 16 7A E6 56", "M4-Q, bits left 0" }, + static const struct item data[] = { + /* 0*/ { -1, "1", 0, "22 00 00 (20)", "M1, bits left 13" }, + /* 1*/ { -1, "12", 0, "43 00 00 (20)", "M1, bits left 10" }, + /* 2*/ { -1, "123", 0, "63 D8 00 (20)", "M1, bits left 7" }, + /* 3*/ { -1, "1234", 0, "83 DA 00 (20)", "M1, bits left 3" }, + /* 4*/ { -1, "12345", 0, "A3 DA D0 (20)", "M1, bits left 0" }, + /* 5*/ { 1, "123456", 0, "30 F6 E4 00 EC (40)", "M2-L, bits left 15" }, + /* 6*/ { 1, "1234567", 0, "38 F6 E4 38 00 (40)", "M2-L, bits left 11" }, + /* 7*/ { 1, "12345678", 0, "40 F6 E4 4E 00 (40)", "M2-L, bits left 8" }, + /* 8*/ { 1, "123456789", 0, "48 F6 E4 62 A0 (40)", "M2-L, bits left 5" }, + /* 9*/ { 1, "1234567890", 0, "50 F6 E4 62 A0 (40)", "M2-L, bits left 1" }, + /* 10*/ { 2, "1234", 0, "20 F6 80 EC (32)", "M2-M, bits left 13" }, + /* 11*/ { 2, "123456", 0, "30 F6 E4 00 (32)", "M2-M, bits left 7" }, + /* 12*/ { 2, "1234567", 0, "38 F6 E4 38 (32)", "M2-M, bits left 3" }, + /* 13*/ { 2, "12345678", 0, "40 F6 E4 4E (32)", "M2-M, bits left 0" }, + /* 14*/ { 1, "ABCDEF", 0, "E3 9A 8A 54 28 (40)", "M2-L, bits left 3" }, + /* 15*/ { 2, "ABCDE", 0, "D3 9A 8A 4E (32)", "M2-M, bits left 0" }, + /* 16*/ { 1, "1234567890123456789", 0, "26 3D B9 18 A8 18 AC D4 D2 00 00 (84)", "M3-L, bits left 13" }, + /* 17*/ { 1, "12345678901234567890", 0, "28 3D B9 18 A8 18 AC D4 D6 80 00 (84)", "M3-L, bits left 10" }, + /* 18*/ { 1, "123456789012345678901", 0, "2A 3D B9 18 A8 18 AC D4 DC 28 00 (84)", "M3-L, bits left 7" }, + /* 19*/ { 1, "1234567890123456789012", 0, "2C 3D B9 18 A8 18 AC D4 DC 29 00 (84)", "M3-L, bits left 3" }, + /* 20*/ { 1, "12345678901234567890123", 0, "2E 3D B9 18 A8 18 AC D4 DC 29 70 (84)", "M3-L, bits left 0" }, + /* 21*/ { 2, "1234567890", 0, "14 3D B9 18 A8 00 EC 11 00 (68)", "M3-M, bits left 27" }, + /* 22*/ { 2, "123456789012345678", 0, "24 3D B9 18 A8 18 AC D4 C0 (68)", "M3-M, bits left 1" }, + /* 23*/ { 1, "ABCDEFGHIJKLMN", 0, "78 E6 A2 95 0A B8 59 EB 99 7E A0 (84)", "M3-L, bits left 1" }, + /* 24*/ { 2, "ABCDEFGHIJK", 0, "6C E6 A2 95 0A B8 59 EA 80 (68)", "M3-M, bits left 1" }, + /* 25*/ { 1, "1234567890123456789012345678", 0, "0E 0F 6E 46 2A 06 2B 35 37 0A 75 46 F0 00 EC 11 (128)", "M4-L, bits left 25" }, + /* 26*/ { 1, "123456789012345678901234567890", 0, "0F 0F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0 00 EC (128)", "M4-L, bits left 19" }, + /* 27*/ { 1, "1234567890123456789012345678901234", 0, "11 0F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0 F6 80 (128)", "M4-L, bits left 5" }, + /* 28*/ { 1, "12345678901234567890123456789012345", 0, "11 8F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0 F6 B4 (128)", "M4-L, bits left 1" }, + /* 29*/ { 1, "123456789012345ABCDEFGHIJK", 0, "07 8F 6E 46 2A 06 2B 25 67 35 14 A8 55 C2 CF 54 (128)", "M4-L, bits left 0" }, + /* 30*/ { 2, "123456789012345678901234567890", 0, "0F 0F 6E 46 2A 06 2B 35 37 0A 75 46 FB D0 (112)", "M4-M, bits left 3" }, + /* 31*/ { 3, "123456789012345678901", 0, "0A 8F 6E 46 2A 06 2B 35 37 0A (80)", "M4-Q, bits left 1" }, + /* 32*/ { 1, "ABCDEFGHIJKLMNOPQRSTU", 0, "35 39 A8 A5 42 AE 16 7A E6 5F AC 51 95 B4 25 E0 (128)", "M4-L, bits left 4" }, + /* 33*/ { 2, "ABCDEFGHIJKLMNOPQR", 0, "32 39 A8 A5 42 AE 16 7A E6 5F AC 51 95 A0 (112)", "M4-M, bits left 5" }, + /* 34*/ { 3, "ABCDEFGHIJKLM", 0, "2D 39 A8 A5 42 AE 16 7A E6 56 (80)", "M4-Q, bits left 0" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -5264,22 +5270,22 @@ static void test_microqr_optimize(const testCtx *const p_ctx) { int zxingcpp_cmp; char *comment; }; - struct item data[] = { - /* 0*/ { UNICODE_MODE, -1, -1, -1, "1", 0, "22 00 00", 1, 1, "N1" }, - /* 1*/ { UNICODE_MODE, 1, 2, -1, "A123", 0, "92 86 3D 80 EC", 1, 1, "A1 N3" }, - /* 2*/ { UNICODE_MODE, 1, -1, -1, "AAAAAA", 0, "E3 98 73 0E 60", 1, 1, "A6" }, - /* 3*/ { UNICODE_MODE, 1, -1, -1, "AA123456", 0, "A3 98 61 ED C8", 1, 1, "A2 N6" }, - /* 4*/ { UNICODE_MODE, 1, 3, -1, "01a", 0, "04 06 16 10 00 EC 11 EC 11 EC 00", 1, 1, "N3 B1" }, - /* 5*/ { UNICODE_MODE, 1, 4, -1, "01a", 0, "43 30 31 61 00 00 EC 11 EC 11 EC 11 EC 11 EC 11", 1, 1, "B3" }, - /* 6*/ { UNICODE_MODE, 1, -1, -1, "こんwa、αβ", 0, "46 82 B1 82 F1 77 61 66 00 10 FF 88 00 00 EC 11", 1, 1, "B6 K3" }, - /* 7*/ { UNICODE_MODE, 1, -1, -1, "こんにwa、αβ", 0, "66 13 10 B8 85 25 09 DD 85 98 00 43 FE 20 00 00", 1, 1, "K3 B2 K3" }, - /* 8*/ { UNICODE_MODE, 1, 3, -1, "こんAB123\177", 0, "D0 4C 42 E2 91 CD 06 3D C2 FE 00", 0, 1, "K2 A2 N3 B1; BWIPP different encodation (K2 A5 B1)" }, - /* 9*/ { UNICODE_MODE, 1, 4, -1, "こんAB123\177", 0, "64 13 10 B8 92 9C D0 5E 1A 0B F8 00 EC 11 EC 11", 1, 1, "K2 A5 B1" }, - /* 10*/ { DATA_MODE, 1, -1, -1, "\223\137", 0, "8A 4D 7C 00 EC 11 EC 11 EC 11 00", 0, 0, "B2; BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, - /* 11*/ { DATA_MODE, 1, -1, ZINT_FULL_MULTIBYTE, "\223\137", 0, "CB 67 C0 00 EC 11 EC 11 EC 11 00", 1, 1, "K1" }, - /* 12*/ { DATA_MODE, 1, -1, ZINT_FULL_MULTIBYTE | (1 << 8), "\223\137", 0, "CB 67 C0 00 EC 11 EC 11 EC 11 00", 1, 1, "K1" }, + static const struct item data[] = { + /* 0*/ { UNICODE_MODE, -1, -1, -1, "1", 0, "22 00 00 (20)", 1, 1, "N1" }, + /* 1*/ { UNICODE_MODE, 1, 2, -1, "A123", 0, "92 86 3D 80 EC (40)", 1, 1, "A1 N3" }, + /* 2*/ { UNICODE_MODE, 1, -1, -1, "AAAAAA", 0, "E3 98 73 0E 60 (40)", 1, 1, "A6" }, + /* 3*/ { UNICODE_MODE, 1, -1, -1, "AA123456", 0, "A3 98 61 ED C8 (40)", 1, 1, "A2 N6" }, + /* 4*/ { UNICODE_MODE, 1, 3, -1, "01a", 0, "04 06 16 10 00 EC 11 EC 11 EC 00 (84)", 1, 1, "N3 B1" }, + /* 5*/ { UNICODE_MODE, 1, 4, -1, "01a", 0, "43 30 31 61 00 00 EC 11 EC 11 EC 11 EC 11 EC 11 (128)", 1, 1, "B3" }, + /* 6*/ { UNICODE_MODE, 1, -1, -1, "こんwa、αβ", 0, "46 82 B1 82 F1 77 61 66 00 10 FF 88 00 00 EC 11 (128)", 1, 1, "B6 K3" }, + /* 7*/ { UNICODE_MODE, 1, -1, -1, "こんにwa、αβ", 0, "66 13 10 B8 85 25 09 DD 85 98 00 43 FE 20 00 00 (128)", 1, 1, "K3 B2 K3" }, + /* 8*/ { UNICODE_MODE, 1, 3, -1, "こんAB123\177", 0, "D0 4C 42 E2 91 CD 06 3D C2 FE 00 (84)", 0, 1, "K2 A2 N3 B1; BWIPP different encodation (K2 A5 B1)" }, + /* 9*/ { UNICODE_MODE, 1, 4, -1, "こんAB123\177", 0, "64 13 10 B8 92 9C D0 5E 1A 0B F8 00 EC 11 EC 11 (128)", 1, 1, "K2 A5 B1" }, + /* 10*/ { DATA_MODE, 1, -1, -1, "\223\137", 0, "8A 4D 7C 00 EC 11 EC 11 EC 11 00 (84)", 0, 0, "B2; BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, + /* 11*/ { DATA_MODE, 1, -1, ZINT_FULL_MULTIBYTE, "\223\137", 0, "CB 67 C0 00 EC 11 EC 11 EC 11 00 (84)", 1, 1, "K1" }, + /* 12*/ { DATA_MODE, 1, -1, ZINT_FULL_MULTIBYTE | (1 << 8), "\223\137", 0, "CB 67 C0 00 EC 11 EC 11 EC 11 00 (84)", 1, 1, "K1" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -5369,7 +5375,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, 1, -1, -1, "01234567", 0, 13, 13, 1, "ISO 18004 Figure 2 (and I.2) (mask 01)", "1111111010101" "1000001011101" @@ -5933,7 +5939,24 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "010001110101110" "110101101101111" }, - /* 35*/ { UNICODE_MODE, 1, 4, -1, "A1abcdefghijklm", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B15)", + /* 35*/ { UNICODE_MODE, 2, 3, -1, "é", 0, 15, 15, 1, "M3-M byte (B1), bits left 54", + "111111101010101" + "100000101000101" + "101110101011111" + "101110101111010" + "101110100111111" + "100000100010011" + "111111100001101" + "000000000100100" + "100010011101010" + "000111100100111" + "101101101000110" + "010010011100000" + "100011100101111" + "001111011101000" + "110100010100101" + }, + /* 36*/ { UNICODE_MODE, 1, 4, -1, "A1abcdefghijklm", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B15)", "11111110101010101" "10000010110110110" "10111010110001111" @@ -5952,7 +5975,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "01101110010001101" "11001111000011100" }, - /* 36*/ { UNICODE_MODE, 1, 4, -1, "abcdefghijklmA1", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B15)", + /* 37*/ { UNICODE_MODE, 1, 4, -1, "abcdefghijklmA1", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B15)", "11111110101010101" "10000010010100111" "10111010110110111" @@ -5971,7 +5994,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "01010111011111011" "10111101110110010" }, - /* 37*/ { UNICODE_MODE, 1, 4, -1, "1Aabcdefghijklm", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B15)", + /* 38*/ { UNICODE_MODE, 1, 4, -1, "1Aabcdefghijklm", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B15)", "11111110101010101" "10000010110101010" "10111010010101011" @@ -5990,7 +6013,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "00101111011011000" "10110011001010101" }, - /* 38*/ { UNICODE_MODE, 1, 4, -1, "abcdefghijklm1A", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B15)", + /* 39*/ { UNICODE_MODE, 1, 4, -1, "abcdefghijklm1A", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B15)", "11111110101010101" "10000010110111011" "10111010010101011" @@ -6009,7 +6032,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "01000101100011000" "11110110101010001" }, - /* 39*/ { UNICODE_MODE, 1, 4, -1, "A1Aabcdefghijkl", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B15)", + /* 40*/ { UNICODE_MODE, 1, 4, -1, "A1Aabcdefghijkl", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B15)", "11111110101010101" "10000010110001010" "10111010010101011" @@ -6028,7 +6051,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "01010100111011000" "11100110011011101" }, - /* 40*/ { UNICODE_MODE, 1, 4, -1, "abcdefghijklA1A", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B15)", + /* 41*/ { UNICODE_MODE, 1, 4, -1, "abcdefghijklA1A", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B15)", "11111110101010101" "10000010110111011" "10111010010101011" @@ -6047,7 +6070,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "01100100100011000" "11100100101010001" }, - /* 41*/ { UNICODE_MODE, 1, 4, -1, "A1A1abcdefghijk", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A4 B11)", + /* 42*/ { UNICODE_MODE, 1, 4, -1, "A1A1abcdefghijk", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A4 B11)", "11111110101010101" "10000010101100010" "10111010010001000" @@ -6066,7 +6089,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "01011100011101101" "11010100111100111" }, - /* 42*/ { UNICODE_MODE, 1, 4, -1, "abcdefghijkA1A1", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B11 A4)", + /* 43*/ { UNICODE_MODE, 1, 4, -1, "abcdefghijkA1A1", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B11 A4)", "11111110101010101" "10000010100111011" "10111010010101011" @@ -6085,7 +6108,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "01111111011011000" "11100111011010001" }, - /* 43*/ { UNICODE_MODE, 1, 4, -1, "A1A1Aabcdefghij", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A5 B10)", + /* 44*/ { UNICODE_MODE, 1, 4, -1, "A1A1Aabcdefghij", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A5 B10)", "11111110101010101" "10000010110010100" "10111010000011000" @@ -6104,7 +6127,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "00111101000111001" "11010001011111011" }, - /* 44*/ { UNICODE_MODE, 1, 4, -1, "abcdefghijA1A1A", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B10 A5)", + /* 45*/ { UNICODE_MODE, 1, 4, -1, "abcdefghijA1A1A", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B10 A5)", "11111110101010101" "10000010100101011" "10111010000011011" @@ -6123,7 +6146,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "01100100000011000" "11101010011010001" }, - /* 45*/ { UNICODE_MODE, 1, 4, -1, "A1A1A1abcdefghi", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A6 B9)", + /* 46*/ { UNICODE_MODE, 1, 4, -1, "A1A1A1abcdefghi", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A6 B9)", "11111110101010101" "10000010100111100" "10111010000111000" @@ -6142,7 +6165,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "01101100100110001" "10110010111110111" }, - /* 46*/ { UNICODE_MODE, 1, 4, -1, "abcdefghiA1A1A1", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B9 A6)", + /* 47*/ { UNICODE_MODE, 1, 4, -1, "abcdefghiA1A1A1", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B9 A6)", "11111110101010101" "10000010110001011" "10111010010101011" @@ -6161,7 +6184,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "00001000100011000" "11110110111010001" }, - /* 47*/ { UNICODE_MODE, 1, 4, -1, "A1A1A1Aabcdefghi", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A7 B9)", + /* 50*/ { UNICODE_MODE, 1, 4, -1, "A1A1A1Aabcdefghi", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A7 B9)", "11111110101010101" "10000010111011100" "10111010011101000" @@ -6180,7 +6203,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "01101000000000001" "11010011110001011" }, - /* 48*/ { UNICODE_MODE, 1, 4, -1, "abcdefghiA1A1A1A", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B9 A7)", + /* 49*/ { UNICODE_MODE, 1, 4, -1, "abcdefghiA1A1A1A", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (B9 A7)", "11111110101010101" "10000010110001011" "10111010010101011" @@ -6199,7 +6222,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "00111010110011000" "11000101111010001" }, - /* 49*/ { UNICODE_MODE, 1, 4, -1, "A1A1A1A1abcdefgh", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A8 B8)", + /* 50*/ { UNICODE_MODE, 1, 4, -1, "A1A1A1A1abcdefgh", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A8 B8)", "11111110101010101" "10000010110011100" "10111010001011000" @@ -6218,7 +6241,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "00110010100101001" "11010101111111011" }, - /* 50*/ { UNICODE_MODE, 1, 4, -1, "abcdefghA1A1A1A1", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A8 B8)", + /* 51*/ { UNICODE_MODE, 1, 4, -1, "abcdefghA1A1A1A1", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A8 B8)", "11111110101010101" "10000010100111011" "10111010011011011" @@ -6237,7 +6260,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "00011001000011000" "11101100111010001" }, - /* 51*/ { UNICODE_MODE, 1, 4, -1, "A1A1A1A1A1abcdefg", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A10 B7)", + /* 52*/ { UNICODE_MODE, 1, 4, -1, "A1A1A1A1A1abcdefg", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A10 B7)", "11111110101010101" "10000010111011100" "10111010011011000" @@ -6256,7 +6279,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "00101010111001001" "10000110110101011" }, - /* 52*/ { UNICODE_MODE, 1, 4, -1, "abcdefgA1A1A1A1A1", 0, 17, 17, 0, "M4-L alpha/numeric/byte mix (B7 A10); BWIPP fails with Maximum length exceeded", + /* 53*/ { UNICODE_MODE, 1, 4, -1, "abcdefgA1A1A1A1A1", 0, 17, 17, 0, "M4-L alpha/numeric/byte mix (B7 A10); BWIPP fails with Maximum length exceeded", "11111110101010101" "10000010111010111" "10111010110101111" @@ -6275,7 +6298,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "00001010111001101" "11111111011111000" }, - /* 53*/ { UNICODE_MODE, 1, 4, -1, "A1A1A1A1A1Aabcdef", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A11 B6)", + /* 54*/ { UNICODE_MODE, 1, 4, -1, "A1A1A1A1A1Aabcdef", 0, 17, 17, 1, "M4-L alpha/numeric/byte mix (A11 B6)", "11111110101010101" "10000010100111100" "10111010001111000" @@ -6294,7 +6317,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "01110100100101001" "11000111011011011" }, - /* 54*/ { UNICODE_MODE, 1, 4, -1, "abcdefA1A1A1A1A1A", 0, 17, 17, 0, "M4-L alpha/numeric/byte mix (A11 B6); BWIPP fails with Maximum length exceeded", + /* 55*/ { UNICODE_MODE, 1, 4, -1, "abcdefA1A1A1A1A1A", 0, 17, 17, 0, "M4-L alpha/numeric/byte mix (A11 B6); BWIPP fails with Maximum length exceeded", "11111110101010101" "10000010101101011" "10111010001111011" @@ -6314,7 +6337,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) { "11010110111110001" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -6404,13 +6427,13 @@ static void test_microqr_perf(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_MICROQR, UNICODE_MODE, 1, 1, "12345", 0, 11, 11, "Max 5 numbers, M1" }, /* 1*/ { BARCODE_MICROQR, UNICODE_MODE, 1, 2, "1234567890", 0, 13, 13, "Max 10 numbers, M2-L" }, /* 2*/ { BARCODE_MICROQR, UNICODE_MODE, 1, 3, "123456789012345", 0, 15, 15, "Max 15 numbers, M3-L" }, /* 3*/ { BARCODE_MICROQR, UNICODE_MODE, 1, 4, "12345678901234567890123456789012345", 0, 17, 17, "Max 35 numbers, M4-L" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; clock_t start, total_encode = 0, total_buffer = 0, diff_encode, diff_buffer; @@ -6472,18 +6495,18 @@ static void test_upnqr_input(const testCtx *const p_ctx) { /* Ŕ U+0154 in ISO 8859-2 0xC0, in Win 1250 but not other ISO 8859 or Win page, UTF-8 C594 */ /* é U+00E9 in ISO 8859-1 plus other ISO 8859 (but not in ISO 8859-7 or ISO 8859-11), Win 1250 plus other Win, not in Shift JIS, UTF-8 C3A9 */ /* β U+03B2 in ISO 8859-7 Greek (but not other ISO 8859 or Win page), in Shift JIS 0x83C0, UTF-8 CEB2 */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, "ĄŔ", 0, "(415) 70 44 00 02 A1 C0 00 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC", "ECI-4 B2 (ISO 8859-2)" }, /* 1*/ { UNICODE_MODE, "é", 0, "(415) 70 44 00 01 E9 00 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11", "ECI-4 B1 (ISO 8859-2)" }, - /* 2*/ { UNICODE_MODE, "β", ZINT_ERROR_INVALID_DATA, "Error 572: Invalid character in input data for ECI 4", "β not in ISO 8859-2" }, + /* 2*/ { UNICODE_MODE, "β", ZINT_ERROR_INVALID_DATA, "Error 572: Invalid character in input for ECI '4'", "β not in ISO 8859-2" }, /* 3*/ { DATA_MODE, "\300\241", 0, "(415) 70 44 00 02 C0 A1 00 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11 EC", "ŔĄ" }, /* 4*/ { GS1_MODE, "[20]12", ZINT_ERROR_INVALID_OPTION, "Error 220: Selected symbology does not support GS1 mode", "" }, /* 5*/ { UNICODE_MODE, "ĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄ", 0, "(415) 70 44 01 9B A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1 A1", "Length 411" }, - /* 6*/ { UNICODE_MODE, "ĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄ", ZINT_ERROR_TOO_LONG, "Error 573: Input too long for selected symbol", "Length 412" }, + /* 6*/ { UNICODE_MODE, "ĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄĄ", ZINT_ERROR_TOO_LONG, "Error 573: Input too long, requires 416 codewords (maximum 415)", "Length 412" }, /* 7*/ { DATA_MODE, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", 0, "(415) 70 44 01 9B 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34", "Length 411" }, - /* 8*/ { DATA_MODE, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012", ZINT_ERROR_TOO_LONG, "Error 573: Input too long for selected symbol", "Length 412" }, + /* 8*/ { DATA_MODE, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012", ZINT_ERROR_TOO_LONG, "Error 573: Input too long, requires 416 codewords (maximum 415)", "Length 412" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -6561,7 +6584,7 @@ static void test_upnqr_encode(const testCtx *const p_ctx) { }; /* https://www.upn-qr.si/uploads/files/Tehnicni standard UPN QR.pdf */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, -1, -1, -1, "UPNQR\012\012\012\012\012Janez Novak\012Dunajska 1\0121000 Ljubljana\01200000008105\012\012\012COST\012Plačilo obveznosti 10/2016\012\012SI56051008010486080\012SI0598765432100\012Novo podjetje d.o.o.\012Lepa cesta 15\0123698 Loški Potok\012183\012 ", 0, 77, 77, "Example A", "11111110111111111100010011100010110001111000010010000011011111010000001111111" "10000010100011011111111001110100100100111110110100100100100111100010101000001" @@ -7037,7 +7060,7 @@ static void test_upnqr_encode(const testCtx *const p_ctx) { "11111110100011011001111101001100101100000010111001100000111111111001000100010" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -7128,524 +7151,526 @@ static void test_rmqr_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + const char *expected_errtxt; + const char *comment; }; /* ISO/IEC 23941:2022 Table 6 */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { 2, 1, "1", 12, 0, 7, 43 }, - /* 1*/ { 2, 1, "1", 13, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { 2, 1, "A", 7, 0, 7, 43 }, - /* 3*/ { 2, 1, "A", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 4*/ { 2, 1, "\200", 5, 0, 7, 43 }, - /* 5*/ { 2, 1, "\200", 6, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 6*/ { 2, 1, "\201", 6, 0, 7, 43 }, /* 3 Shift JIS 0x8181 */ - /* 7*/ { 2, 1, "\201", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 4 Shift JIS 0x8181 */ - /* 8*/ { 4, 1, "1", 5, 0, 7, 43 }, - /* 9*/ { 4, 1, "1", 6, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 10*/ { 4, 1, "A", 3, 0, 7, 43 }, - /* 11*/ { 4, 1, "A", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 12*/ { 4, 1, "\200", 2, 0, 7, 43 }, - /* 13*/ { 4, 1, "\200", 3, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 14*/ { 4, 1, "\201", 2, 0, 7, 43 }, /* 1 Shift JIS 0x8181 */ - /* 15*/ { 4, 1, "\201", 4, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 2 Shift JIS 0x8181 */ - /* 16*/ { 2, 2, "1", 26, 0, 7, 59 }, - /* 17*/ { 2, 2, "1", 27, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 18*/ { 2, 2, "A", 16, 0, 7, 59 }, - /* 19*/ { 2, 2, "A", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 20*/ { 2, 2, "\200", 11, 0, 7, 59 }, - /* 21*/ { 2, 2, "\200", 12, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 22*/ { 2, 2, "\201", 12, 0, 7, 59 }, /* 6 Shift JIS 0x8181 */ - /* 23*/ { 2, 2, "\201", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 7 Shift JIS 0x8181 */ - /* 24*/ { 4, 2, "1", 14, 0, 7, 59 }, - /* 25*/ { 4, 2, "1", 15, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 26*/ { 4, 2, "A", 8, 0, 7, 59 }, - /* 27*/ { 4, 2, "A", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 28*/ { 4, 2, "\200", 6, 0, 7, 59 }, - /* 29*/ { 4, 2, "\200", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 30*/ { 4, 2, "\201", 6, 0, 7, 59 }, /* 3 Shift JIS 0x8181 */ - /* 31*/ { 4, 2, "\201", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 4 Shift JIS 0x8181 */ - /* 32*/ { 2, 3, "1", 45, 0, 7, 77 }, - /* 33*/ { 2, 3, "1", 46, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 34*/ { 2, 3, "A", 27, 0, 7, 77 }, - /* 35*/ { 2, 3, "A", 28, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 36*/ { 2, 3, "\200", 19, 0, 7, 77 }, - /* 37*/ { 2, 3, "\200", 20, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 38*/ { 2, 3, "\201", 22, 0, 7, 77 }, /* 11 Shift JIS 0x8181 */ - /* 39*/ { 2, 3, "\201", 24, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 12 Shift JIS 0x8181 */ - /* 40*/ { 4, 3, "1", 21, 0, 7, 77 }, - /* 41*/ { 4, 3, "1", 22, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 42*/ { 4, 3, "A", 13, 0, 7, 77 }, - /* 43*/ { 4, 3, "A", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 44*/ { 4, 3, "\200", 9, 0, 7, 77 }, - /* 45*/ { 4, 3, "\200", 10, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 46*/ { 4, 3, "\201", 10, 0, 7, 77 }, /* 5 Shift JIS 0x8181 */ - /* 47*/ { 4, 3, "\201", 12, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 6 Shift JIS 0x8181 */ - /* 48*/ { 2, 4, "1", 64, 0, 7, 99 }, - /* 49*/ { 2, 4, "1", 65, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 50*/ { 2, 4, "A", 39, 0, 7, 99 }, - /* 51*/ { 2, 4, "A", 40, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 52*/ { 2, 4, "\200", 27, 0, 7, 99 }, - /* 53*/ { 2, 4, "\200", 28, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 54*/ { 2, 4, "\201", 32, 0, 7, 99 }, /* 16 Shift JIS 0x8181 */ - /* 55*/ { 2, 4, "\201", 34, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 17 Shift JIS 0x8181 */ - /* 56*/ { 4, 4, "1", 30, 0, 7, 99 }, - /* 57*/ { 4, 4, "1", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 58*/ { 4, 4, "A", 18, 0, 7, 99 }, - /* 59*/ { 4, 4, "A", 19, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 60*/ { 4, 4, "\200", 13, 0, 7, 99 }, - /* 61*/ { 4, 4, "\200", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 62*/ { 4, 4, "\201", 16, 0, 7, 99 }, /* 8 Shift JIS 0x8181 */ - /* 63*/ { 4, 4, "\201", 18, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 9 Shift JIS 0x8181 */ - /* 64*/ { 2, 5, "1", 102, 0, 7, 139 }, - /* 65*/ { 2, 5, "1", 103, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 66*/ { 2, 5, "A", 62, 0, 7, 139 }, - /* 67*/ { 2, 5, "A", 63, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 68*/ { 2, 5, "\200", 42, 0, 7, 139 }, - /* 69*/ { 2, 5, "\200", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 70*/ { 2, 5, "\201", 52, 0, 7, 139 }, /* 26 Shift JIS 0x8181 */ - /* 71*/ { 2, 5, "\201", 54, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 27 Shift JIS 0x8181 */ - /* 72*/ { 4, 5, "1", 54, 0, 7, 139 }, - /* 73*/ { 4, 5, "1", 55, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 74*/ { 4, 5, "A", 33, 0, 7, 139 }, - /* 75*/ { 4, 5, "A", 34, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 76*/ { 4, 5, "\200", 22, 0, 7, 139 }, - /* 77*/ { 4, 5, "\200", 23, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 78*/ { 4, 5, "\201", 28, 0, 7, 139 }, /* 14 Shift JIS 0x8181 */ - /* 79*/ { 4, 5, "\201", 30, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 15 Shift JIS 0x8181 */ - /* 80*/ { 2, 6, "1", 26, 0, 9, 43 }, - /* 81*/ { 2, 6, "1", 27, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 82*/ { 2, 6, "A", 16, 0, 9, 43 }, - /* 83*/ { 2, 6, "A", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 84*/ { 2, 6, "\200", 11, 0, 9, 43 }, - /* 85*/ { 2, 6, "\200", 12, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 86*/ { 2, 6, "\201", 12, 0, 9, 43 }, /* 6 Shift JIS 0x8181 */ - /* 87*/ { 2, 6, "\201", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 7 Shift JIS 0x8181 */ - /* 88*/ { 4, 6, "1", 14, 0, 9, 43 }, - /* 89*/ { 4, 6, "1", 15, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 90*/ { 4, 6, "A", 8, 0, 9, 43 }, - /* 91*/ { 4, 6, "A", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 92*/ { 4, 6, "\200", 6, 0, 9, 43 }, - /* 93*/ { 4, 6, "\200", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 94*/ { 4, 6, "\201", 6, 0, 9, 43 }, /* 3 Shift JIS 0x8181 */ - /* 95*/ { 4, 6, "\201", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 4 Shift JIS 0x8181 */ - /* 96*/ { 2, 7, "1", 47, 0, 9, 59 }, - /* 97*/ { 2, 7, "1", 48, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 98*/ { 2, 7, "A", 29, 0, 9, 59 }, - /* 99*/ { 2, 7, "A", 30, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*100*/ { 2, 7, "\200", 20, 0, 9, 59 }, - /*101*/ { 2, 7, "\200", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*102*/ { 2, 7, "\201", 24, 0, 9, 59 }, /* 12 Shift JIS 0x8181 */ - /*103*/ { 2, 7, "\201", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 13 Shift JIS 0x8181 */ - /*104*/ { 4, 7, "1", 23, 0, 9, 59 }, - /*105*/ { 4, 7, "1", 24, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*106*/ { 4, 7, "A", 14, 0, 9, 59 }, - /*107*/ { 4, 7, "A", 15, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*108*/ { 4, 7, "\200", 10, 0, 9, 59 }, - /*109*/ { 4, 7, "\200", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*110*/ { 4, 7, "\201", 12, 0, 9, 59 }, /* 6 Shift JIS 0x8181 */ - /*111*/ { 4, 7, "\201", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 7 Shift JIS 0x8181 */ - /*112*/ { 2, 8, "1", 71, 0, 9, 77 }, - /*113*/ { 2, 8, "1", 72, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*114*/ { 2, 8, "A", 43, 0, 9, 77 }, - /*115*/ { 2, 8, "A", 44, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*116*/ { 2, 8, "\200", 30, 0, 9, 77 }, - /*117*/ { 2, 8, "\200", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*118*/ { 2, 8, "\201", 36, 0, 9, 77 }, /* 18 Shift JIS 0x8181 */ - /*119*/ { 2, 8, "\201", 38, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 19 Shift JIS 0x8181 */ - /*120*/ { 4, 8, "1", 37, 0, 9, 77 }, - /*121*/ { 4, 8, "1", 38, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*122*/ { 4, 8, "A", 23, 0, 9, 77 }, - /*123*/ { 4, 8, "A", 24, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*124*/ { 4, 8, "\200", 16, 0, 9, 77 }, - /*125*/ { 4, 8, "\200", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*126*/ { 4, 8, "\201", 18, 0, 9, 77 }, /* 9 Shift JIS 0x8181 */ - /*127*/ { 4, 8, "\201", 20, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 10 Shift JIS 0x8181 */ - /*128*/ { 2, 9, "1", 97, 0, 9, 99 }, - /*129*/ { 2, 9, "1", 98, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*130*/ { 2, 9, "A", 59, 0, 9, 99 }, - /*131*/ { 2, 9, "A", 60, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*132*/ { 2, 9, "\200", 40, 0, 9, 99 }, - /*133*/ { 2, 9, "\200", 41, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*134*/ { 2, 9, "\201", 50, 0, 9, 99 }, /* 25 Shift JIS 0x8181 */ - /*135*/ { 2, 9, "\201", 52, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 26 Shift JIS 0x8181 */ - /*136*/ { 4, 9, "1", 49, 0, 9, 99 }, - /*137*/ { 4, 9, "1", 50, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*138*/ { 4, 9, "A", 30, 0, 9, 99 }, - /*139*/ { 4, 9, "A", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*140*/ { 4, 9, "\200", 20, 0, 9, 99 }, - /*141*/ { 4, 9, "\200", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*142*/ { 4, 9, "\201", 24, 0, 9, 99 }, /* 12 Shift JIS 0x8181 */ - /*143*/ { 4, 9, "\201", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 13 Shift JIS 0x8181 */ - /*144*/ { 2, 10, "1", 147, 0, 9, 139 }, - /*145*/ { 2, 10, "1", 148, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*146*/ { 2, 10, "A", 89, 0, 9, 139 }, - /*147*/ { 2, 10, "A", 90, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*148*/ { 2, 10, "\200", 61, 0, 9, 139 }, - /*149*/ { 2, 10, "\200", 62, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*150*/ { 2, 10, "\201", 76, 0, 9, 139 }, /* 36 Shift JIS 0x8181 */ - /*151*/ { 2, 10, "\201", 78, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 37 Shift JIS 0x8181 */ - /*152*/ { 4, 10, "1", 75, 0, 9, 139 }, - /*153*/ { 4, 10, "1", 76, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*154*/ { 4, 10, "A", 46, 0, 9, 139 }, - /*155*/ { 4, 10, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*156*/ { 4, 10, "\200", 31, 0, 9, 139 }, - /*157*/ { 4, 10, "\200", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*158*/ { 4, 10, "\201", 38, 0, 9, 139 }, /* 19 Shift JIS 0x8181 */ - /*159*/ { 4, 10, "\201", 40, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 20 Shift JIS 0x8181 */ - /*160*/ { 2, 11, "1", 14, 0, 11, 27 }, - /*161*/ { 2, 11, "1", 15, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*162*/ { 2, 11, "A", 8, 0, 11, 27 }, - /*163*/ { 2, 11, "A", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*164*/ { 2, 11, "\200", 6, 0, 11, 27 }, - /*165*/ { 2, 11, "\200", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*166*/ { 2, 11, "\201", 6, 0, 11, 27 }, /* 3 Shift JIS 0x8181 */ - /*167*/ { 2, 11, "\201", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 4 Shift JIS 0x8181 */ - /*168*/ { 4, 11, "1", 9, 0, 11, 27 }, - /*169*/ { 4, 11, "1", 10, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*170*/ { 4, 11, "A", 6, 0, 11, 27 }, - /*171*/ { 4, 11, "A", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*172*/ { 4, 11, "\200", 4, 0, 11, 27 }, - /*173*/ { 4, 11, "\200", 5, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*174*/ { 4, 11, "\201", 4, 0, 11, 27 }, /* 2 Shift JIS 0x8181 */ - /*175*/ { 4, 11, "\201", 6, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 3 Shift JIS 0x8181 */ - /*176*/ { 2, 12, "1", 42, 0, 11, 43 }, - /*177*/ { 2, 12, "1", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*178*/ { 2, 12, "A", 26, 0, 11, 43 }, - /*179*/ { 2, 12, "A", 27, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*180*/ { 2, 12, "\200", 18, 0, 11, 43 }, - /*181*/ { 2, 12, "\200", 19, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*182*/ { 2, 12, "\201", 22, 0, 11, 43 }, /* 11 Shift JIS 0x8181 */ - /*183*/ { 2, 12, "\201", 24, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 12 Shift JIS 0x8181 */ - /*184*/ { 4, 12, "1", 23, 0, 11, 43 }, - /*185*/ { 4, 12, "1", 24, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*186*/ { 4, 12, "A", 14, 0, 11, 43 }, - /*187*/ { 4, 12, "A", 15, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*188*/ { 4, 12, "\200", 10, 0, 11, 43 }, - /*189*/ { 4, 12, "\200", 11, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*190*/ { 4, 12, "\201", 12, 0, 11, 43 }, /* 6 Shift JIS 0x8181 */ - /*191*/ { 4, 12, "\201", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 7 Shift JIS 0x8181 */ - /*192*/ { 2, 13, "1", 71, 0, 11, 59 }, - /*193*/ { 2, 13, "1", 72, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*194*/ { 2, 13, "A", 43, 0, 11, 59 }, - /*195*/ { 2, 13, "A", 44, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*196*/ { 2, 13, "\200", 30, 0, 11, 59 }, - /*197*/ { 2, 13, "\200", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*198*/ { 2, 13, "\201", 36, 0, 11, 59 }, /* 18 Shift JIS 0x8181 */ - /*199*/ { 2, 13, "\201", 38, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 19 Shift JIS 0x8181 */ - /*200*/ { 4, 13, "1", 33, 0, 11, 59 }, - /*201*/ { 4, 13, "1", 34, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*202*/ { 4, 13, "A", 20, 0, 11, 59 }, - /*203*/ { 4, 13, "A", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*204*/ { 4, 13, "\200", 14, 0, 11, 59 }, - /*205*/ { 4, 13, "\200", 15, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*206*/ { 4, 13, "\201", 16, 0, 11, 59 }, /* 8 Shift JIS 0x8181 */ - /*207*/ { 4, 13, "\201", 18, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 9 Shift JIS 0x8181 */ - /*208*/ { 2, 14, "1", 100, 0, 11, 77 }, - /*209*/ { 2, 14, "1", 101, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*210*/ { 2, 14, "A", 60, 0, 11, 77 }, - /*211*/ { 2, 14, "A", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*212*/ { 2, 14, "\200", 41, 0, 11, 77 }, - /*213*/ { 2, 14, "\200", 42, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*214*/ { 2, 14, "\201", 50, 0, 11, 77 }, /* 25 Shift JIS 0x8181 */ - /*215*/ { 2, 14, "\201", 52, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 26 Shift JIS 0x8181 */ - /*216*/ { 4, 14, "1", 52, 0, 11, 77 }, - /*217*/ { 4, 14, "1", 53, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*218*/ { 4, 14, "A", 31, 0, 11, 77 }, - /*219*/ { 4, 14, "A", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*220*/ { 4, 14, "\200", 21, 0, 11, 77 }, - /*221*/ { 4, 14, "\200", 22, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*222*/ { 4, 14, "\201", 26, 0, 11, 77 }, /* 13 Shift JIS 0x8181 */ - /*223*/ { 4, 14, "\201", 28, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 14 Shift JIS 0x8181 */ - /*224*/ { 2, 15, "1", 133, 0, 11, 99 }, - /*225*/ { 2, 15, "1", 134, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*226*/ { 2, 15, "A", 81, 0, 11, 99 }, - /*227*/ { 2, 15, "A", 82, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*228*/ { 2, 15, "\200", 55, 0, 11, 99 }, - /*229*/ { 2, 15, "\200", 56, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*230*/ { 2, 15, "\201", 68, 0, 11, 99 }, /* 34 Shift JIS 0x8181 */ - /*231*/ { 2, 15, "\201", 70, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 35 Shift JIS 0x8181 */ - /*232*/ { 4, 15, "1", 66, 0, 11, 99 }, - /*233*/ { 4, 15, "1", 67, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*234*/ { 4, 15, "A", 40, 0, 11, 99 }, - /*235*/ { 4, 15, "A", 41, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*236*/ { 4, 15, "\200", 27, 0, 11, 99 }, - /*237*/ { 4, 15, "\200", 28, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*238*/ { 4, 15, "\201", 34, 0, 11, 99 }, /* 17 Shift JIS 0x8181 */ - /*239*/ { 4, 15, "\201", 36, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 18 Shift JIS 0x8181 */ - /*240*/ { 2, 16, "1", 198, 0, 11, 139 }, - /*241*/ { 2, 16, "1", 199, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*242*/ { 2, 16, "A", 120, 0, 11, 139 }, - /*243*/ { 2, 16, "A", 121, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*244*/ { 2, 16, "\200", 82, 0, 11, 139 }, - /*245*/ { 2, 16, "\200", 83, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*246*/ { 2, 16, "\201", 102, 0, 11, 139 }, /* 51 Shift JIS 0x8181 */ - /*247*/ { 2, 16, "\201", 104, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 52 Shift JIS 0x8181 */ - /*248*/ { 4, 16, "1", 97, 0, 11, 139 }, - /*249*/ { 4, 16, "1", 98, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*250*/ { 4, 16, "A", 59, 0, 11, 139 }, - /*251*/ { 4, 16, "A", 60, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*252*/ { 4, 16, "\200", 40, 0, 11, 139 }, - /*253*/ { 4, 16, "\200", 41, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*254*/ { 4, 16, "\201", 50, 0, 11, 139 }, /* 25 Shift JIS 0x8181 */ - /*255*/ { 4, 16, "\201", 52, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 26 Shift JIS 0x8181 */ - /*256*/ { 2, 17, "1", 26, 0, 13, 27 }, - /*257*/ { 2, 17, "1", 27, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*258*/ { 2, 17, "A", 16, 0, 13, 27 }, - /*259*/ { 2, 17, "A", 17, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*260*/ { 2, 17, "\200", 11, 0, 13, 27 }, - /*261*/ { 2, 17, "\200", 12, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*262*/ { 2, 17, "\201", 12, 0, 13, 27 }, /* 6 Shift JIS 0x8181 */ - /*263*/ { 2, 17, "\201", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 7 Shift JIS 0x8181 */ - /*264*/ { 4, 17, "1", 14, 0, 13, 27 }, - /*265*/ { 4, 17, "1", 15, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*266*/ { 4, 17, "A", 8, 0, 13, 27 }, - /*267*/ { 4, 17, "A", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*268*/ { 4, 17, "\200", 6, 0, 13, 27 }, - /*269*/ { 4, 17, "\200", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*270*/ { 4, 17, "\201", 6, 0, 13, 27 }, /* 3 Shift JIS 0x8181 */ - /*271*/ { 4, 17, "\201", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 4 Shift JIS 0x8181 */ - /*272*/ { 2, 18, "1", 62, 0, 13, 43 }, - /*273*/ { 2, 18, "1", 63, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*274*/ { 2, 18, "A", 37, 0, 13, 43 }, - /*275*/ { 2, 18, "A", 38, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*276*/ { 2, 18, "\200", 26, 0, 13, 43 }, - /*277*/ { 2, 18, "\200", 27, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*278*/ { 2, 18, "\201", 32, 0, 13, 43 }, /* 16 Shift JIS 0x8181 */ - /*279*/ { 2, 18, "\201", 34, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 17 Shift JIS 0x8181 */ - /*280*/ { 4, 18, "1", 28, 0, 13, 43 }, - /*281*/ { 4, 18, "1", 29, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*282*/ { 4, 18, "A", 17, 0, 13, 43 }, - /*283*/ { 4, 18, "A", 18, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*284*/ { 4, 18, "\200", 12, 0, 13, 43 }, - /*285*/ { 4, 18, "\200", 13, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*286*/ { 4, 18, "\201", 14, 0, 13, 43 }, /* 7 Shift JIS 0x8181 */ - /*287*/ { 4, 18, "\201", 16, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 8 Shift JIS 0x8181 */ - /*288*/ { 2, 19, "1", 88, 0, 13, 59 }, - /*289*/ { 2, 19, "1", 89, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*290*/ { 2, 19, "A", 53, 0, 13, 59 }, - /*291*/ { 2, 19, "A", 54, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*292*/ { 2, 19, "\200", 36, 0, 13, 59 }, - /*293*/ { 2, 19, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*294*/ { 2, 19, "\201", 44, 0, 13, 59 }, /* 22 Shift JIS 0x8181 */ - /*295*/ { 2, 19, "\201", 46, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 23 Shift JIS 0x8181 */ - /*296*/ { 4, 19, "1", 45, 0, 13, 59 }, - /*297*/ { 4, 19, "1", 46, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*298*/ { 4, 19, "A", 27, 0, 13, 59 }, - /*299*/ { 4, 19, "A", 28, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*300*/ { 4, 19, "\200", 18, 0, 13, 59 }, - /*301*/ { 4, 19, "\200", 19, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*302*/ { 4, 19, "\201", 22, 0, 13, 59 }, /* 11 Shift JIS 0x8181 */ - /*303*/ { 4, 19, "\201", 24, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 12 Shift JIS 0x8181 */ - /*304*/ { 2, 20, "1", 124, 0, 13, 77 }, - /*305*/ { 2, 20, "1", 125, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*306*/ { 2, 20, "A", 75, 0, 13, 77 }, - /*307*/ { 2, 20, "A", 76, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*308*/ { 2, 20, "\200", 51, 0, 13, 77 }, - /*309*/ { 2, 20, "\200", 52, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*310*/ { 2, 20, "\201", 62, 0, 13, 77 }, /* 31 Shift JIS 0x8181 */ - /*311*/ { 2, 20, "\201", 64, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 32 Shift JIS 0x8181 */ - /*312*/ { 4, 20, "1", 66, 0, 13, 77 }, - /*313*/ { 4, 20, "1", 67, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*314*/ { 4, 20, "A", 40, 0, 13, 77 }, - /*315*/ { 4, 20, "A", 41, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*316*/ { 4, 20, "\200", 27, 0, 13, 77 }, - /*317*/ { 4, 20, "\200", 28, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*318*/ { 4, 20, "\201", 34, 0, 13, 77 }, /* 17 Shift JIS 0x8181 */ - /*319*/ { 4, 20, "\201", 36, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 18 Shift JIS 0x8181 */ - /*320*/ { 2, 21, "1", 171, 0, 13, 99 }, - /*321*/ { 2, 21, "1", 172, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*322*/ { 2, 21, "A", 104, 0, 13, 99 }, - /*323*/ { 2, 21, "A", 105, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*324*/ { 2, 21, "\200", 71, 0, 13, 99 }, - /*325*/ { 2, 21, "\200", 72, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*326*/ { 2, 21, "\201", 88, 0, 13, 99 }, /* 44 Shift JIS 0x8181 */ - /*327*/ { 2, 21, "\201", 90, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 45 Shift JIS 0x8181 */ - /*328*/ { 4, 21, "1", 80, 0, 13, 99 }, - /*329*/ { 4, 21, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*330*/ { 4, 21, "A", 49, 0, 13, 99 }, - /*331*/ { 4, 21, "A", 50, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*332*/ { 4, 21, "\200", 33, 0, 13, 99 }, - /*333*/ { 4, 21, "\200", 34, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*334*/ { 4, 21, "\201", 40, 0, 13, 99 }, /* 20 Shift JIS 0x8181 */ - /*335*/ { 4, 21, "\201", 42, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 21 Shift JIS 0x8181 */ - /*336*/ { 2, 22, "1", 251, 0, 13, 139 }, - /*337*/ { 2, 22, "1", 252, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*338*/ { 2, 22, "A", 152, 0, 13, 139 }, - /*339*/ { 2, 22, "A", 153, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*340*/ { 2, 22, "\200", 104, 0, 13, 139 }, - /*341*/ { 2, 22, "\200", 105, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*342*/ { 2, 22, "\201", 128, 0, 13, 139 }, /* 64 Shift JIS 0x8181 */ - /*343*/ { 2, 22, "\201", 130, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 65 Shift JIS 0x8181 */ - /*344*/ { 4, 22, "1", 126, 0, 13, 139 }, - /*345*/ { 4, 22, "1", 127, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*346*/ { 4, 22, "A", 76, 0, 13, 139 }, - /*347*/ { 4, 22, "A", 77, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*348*/ { 4, 22, "\200", 52, 0, 13, 139 }, - /*349*/ { 4, 22, "\200", 53, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*350*/ { 4, 22, "\201", 64, 0, 13, 139 }, /* 32 Shift JIS 0x8181 */ - /*351*/ { 4, 22, "\201", 66, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 33 Shift JIS 0x8181 */ - /*352*/ { 2, 23, "1", 76, 0, 15, 43 }, - /*353*/ { 2, 23, "1", 77, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*354*/ { 2, 23, "A", 46, 0, 15, 43 }, - /*355*/ { 2, 23, "A", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*356*/ { 2, 23, "\200", 31, 0, 15, 43 }, - /*357*/ { 2, 23, "\200", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*358*/ { 2, 23, "\201", 38, 0, 15, 43 }, /* 19 Shift JIS 0x8181 */ - /*359*/ { 2, 23, "\201", 40, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 20 Shift JIS 0x8181 */ - /*360*/ { 4, 23, "1", 33, 0, 15, 43 }, - /*361*/ { 4, 23, "1", 34, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*362*/ { 4, 23, "A", 20, 0, 15, 43 }, - /*363*/ { 4, 23, "A", 21, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*364*/ { 4, 23, "\200", 13, 0, 15, 43 }, - /*365*/ { 4, 23, "\200", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*366*/ { 4, 23, "\201", 16, 0, 15, 43 }, /* 8 Shift JIS 0x8181 */ - /*367*/ { 4, 23, "\201", 18, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 9 Shift JIS 0x8181 */ - /*368*/ { 2, 24, "1", 112, 0, 15, 59 }, - /*369*/ { 2, 24, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*370*/ { 2, 24, "A", 68, 0, 15, 59 }, - /*371*/ { 2, 24, "A", 69, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*372*/ { 2, 24, "\200", 46, 0, 15, 59 }, - /*373*/ { 2, 24, "\200", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*374*/ { 2, 24, "\201", 56, 0, 15, 59 }, /* 28 Shift JIS 0x8181 */ - /*375*/ { 2, 24, "\201", 58, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 29 Shift JIS 0x8181 */ - /*376*/ { 4, 24, "1", 59, 0, 15, 59 }, - /*377*/ { 4, 24, "1", 60, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*378*/ { 4, 24, "A", 36, 0, 15, 59 }, - /*379*/ { 4, 24, "A", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*380*/ { 4, 24, "\200", 24, 0, 15, 59 }, - /*381*/ { 4, 24, "\200", 25, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*382*/ { 4, 24, "\201", 30, 0, 15, 59 }, /* 30 Shift JIS 0x8181 */ - /*383*/ { 4, 24, "\201", 32, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 31 Shift JIS 0x8181 */ - /*384*/ { 2, 25, "1", 157, 0, 15, 77 }, - /*385*/ { 2, 25, "1", 158, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*386*/ { 2, 25, "A", 95, 0, 15, 77 }, - /*387*/ { 2, 25, "A", 96, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*388*/ { 2, 25, "\200", 65, 0, 15, 77 }, - /*389*/ { 2, 25, "\200", 66, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*390*/ { 2, 25, "\201", 80, 0, 15, 77 }, /* 40 Shift JIS 0x8181 */ - /*391*/ { 2, 25, "\201", 82, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 41 Shift JIS 0x8181 */ - /*392*/ { 4, 25, "1", 71, 0, 15, 77 }, - /*393*/ { 4, 25, "1", 72, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*394*/ { 4, 25, "A", 43, 0, 15, 77 }, - /*395*/ { 4, 25, "A", 44, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*396*/ { 4, 25, "\200", 29, 0, 15, 77 }, - /*397*/ { 4, 25, "\200", 30, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*398*/ { 4, 25, "\201", 36, 0, 15, 77 }, /* 18 Shift JIS 0x8181 */ - /*399*/ { 4, 25, "\201", 38, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 19 Shift JIS 0x8181 */ - /*400*/ { 2, 26, "1", 207, 0, 15, 99 }, - /*401*/ { 2, 26, "1", 208, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*402*/ { 2, 26, "A", 126, 0, 15, 99 }, - /*403*/ { 2, 26, "A", 127, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*404*/ { 2, 26, "\200", 86, 0, 15, 99 }, - /*405*/ { 2, 26, "\200", 87, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*406*/ { 2, 26, "\201", 106, 0, 15, 99 }, /* 53 Shift JIS 0x8181 */ - /*407*/ { 2, 26, "\201", 108, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 54 Shift JIS 0x8181 */ - /*408*/ { 4, 26, "1", 111, 0, 15, 99 }, - /*409*/ { 4, 26, "1", 112, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*410*/ { 4, 26, "A", 68, 0, 15, 99 }, - /*411*/ { 4, 26, "A", 69, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*412*/ { 4, 26, "\200", 46, 0, 15, 99 }, - /*413*/ { 4, 26, "\200", 47, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*414*/ { 4, 26, "\201", 56, 0, 15, 99 }, /* 28 Shift JIS 0x8181 */ - /*415*/ { 4, 26, "\201", 58, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 29 Shift JIS 0x8181 */ - /*416*/ { 2, 27, "1", 301, 0, 15, 139 }, - /*417*/ { 2, 27, "1", 302, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*418*/ { 2, 27, "A", 182, 0, 15, 139 }, - /*419*/ { 2, 27, "A", 183, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*420*/ { 2, 27, "\200", 125, 0, 15, 139 }, - /*421*/ { 2, 27, "\200", 126, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*422*/ { 2, 27, "\201", 154, 0, 15, 139 }, /* 77 Shift JIS 0x8181 */ - /*423*/ { 2, 27, "\201", 156, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 78 Shift JIS 0x8181 */ - /*424*/ { 4, 27, "1", 162, 0, 15, 139 }, - /*425*/ { 4, 27, "1", 163, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*426*/ { 4, 27, "A", 98, 0, 15, 139 }, - /*427*/ { 4, 27, "A", 99, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*428*/ { 4, 27, "\200", 67, 0, 15, 139 }, - /*429*/ { 4, 27, "\200", 68, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*430*/ { 4, 27, "\201", 82, 0, 15, 139 }, /* 41 Shift JIS 0x8181 */ - /*431*/ { 4, 27, "\201", 84, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 42 Shift JIS 0x8181 */ - /*432*/ { 2, 28, "1", 90, 0, 17, 43 }, - /*433*/ { 2, 28, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*434*/ { 2, 28, "A", 55, 0, 17, 43 }, - /*435*/ { 2, 28, "A", 56, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*436*/ { 2, 28, "\200", 37, 0, 17, 43 }, - /*437*/ { 2, 28, "\200", 38, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*438*/ { 2, 28, "\201", 46, 0, 17, 43 }, /* 23 Shift JIS 0x8181 */ - /*439*/ { 2, 28, "\201", 48, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 24 Shift JIS 0x8181 */ - /*440*/ { 4, 28, "1", 47, 0, 17, 43 }, - /*441*/ { 4, 28, "1", 48, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*442*/ { 4, 28, "A", 28, 0, 17, 43 }, - /*443*/ { 4, 28, "A", 29, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*444*/ { 4, 28, "\200", 19, 0, 17, 43 }, - /*445*/ { 4, 28, "\200", 20, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*446*/ { 4, 28, "\201", 24, 0, 17, 43 }, /* 12 Shift JIS 0x8181 */ - /*447*/ { 4, 28, "\201", 26, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 13 Shift JIS 0x8181 */ - /*448*/ { 2, 29, "1", 131, 0, 17, 59 }, - /*449*/ { 2, 29, "1", 132, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*450*/ { 2, 29, "A", 79, 0, 17, 59 }, - /*451*/ { 2, 29, "A", 80, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*452*/ { 2, 29, "\200", 54, 0, 17, 59 }, - /*453*/ { 2, 29, "\200", 55, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*454*/ { 2, 29, "\201", 66, 0, 17, 59 }, /* 33 Shift JIS 0x8181 */ - /*455*/ { 2, 29, "\201", 68, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 34 Shift JIS 0x8181 */ - /*456*/ { 4, 29, "1", 63, 0, 17, 59 }, - /*457*/ { 4, 29, "1", 64, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*458*/ { 4, 29, "A", 38, 0, 17, 59 }, - /*459*/ { 4, 29, "A", 39, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*460*/ { 4, 29, "\200", 26, 0, 17, 59 }, - /*461*/ { 4, 29, "\200", 27, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*462*/ { 4, 29, "\201", 32, 0, 17, 59 }, /* 16 Shift JIS 0x8181 */ - /*463*/ { 4, 29, "\201", 34, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 17 Shift JIS 0x8181 */ - /*464*/ { 2, 30, "1", 183, 0, 17, 77 }, - /*465*/ { 2, 30, "1", 184, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*466*/ { 2, 30, "A", 111, 0, 17, 77 }, - /*467*/ { 2, 30, "A", 112, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*468*/ { 2, 30, "\200", 76, 0, 17, 77 }, - /*469*/ { 2, 30, "\200", 77, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*470*/ { 2, 30, "\201", 94, 0, 17, 77 }, /* 47 Shift JIS 0x8181 */ - /*471*/ { 2, 30, "\201", 96, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 48 Shift JIS 0x8181 */ - /*472*/ { 4, 30, "1", 87, 0, 17, 77 }, - /*473*/ { 4, 30, "1", 88, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*474*/ { 4, 30, "A", 53, 0, 17, 77 }, - /*475*/ { 4, 30, "A", 54, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*476*/ { 4, 30, "\200", 36, 0, 17, 77 }, - /*477*/ { 4, 30, "\200", 37, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*478*/ { 4, 30, "\201", 44, 0, 17, 77 }, /* 22 Shift JIS 0x8181 */ - /*479*/ { 4, 30, "\201", 46, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 23 Shift JIS 0x8181 */ - /*480*/ { 2, 31, "1", 236, 0, 17, 99 }, - /*481*/ { 2, 31, "1", 237, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*482*/ { 2, 31, "A", 143, 0, 17, 99 }, - /*483*/ { 2, 31, "A", 144, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*484*/ { 2, 31, "\200", 98, 0, 17, 99 }, - /*485*/ { 2, 31, "\200", 99, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*486*/ { 2, 31, "\201", 120, 0, 17, 99 }, /* 60 Shift JIS 0x8181 */ - /*487*/ { 2, 31, "\201", 122, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 61 Shift JIS 0x8181 */ - /*488*/ { 4, 31, "1", 131, 0, 17, 99 }, - /*489*/ { 4, 31, "1", 132, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*490*/ { 4, 31, "A", 79, 0, 17, 99 }, - /*491*/ { 4, 31, "A", 80, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*492*/ { 4, 31, "\200", 54, 0, 17, 99 }, - /*493*/ { 4, 31, "\200", 55, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*494*/ { 4, 31, "\201", 66, 0, 17, 99 }, /* 33 Shift JIS 0x8181 */ - /*495*/ { 4, 31, "\201", 68, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 34 Shift JIS 0x8181 */ - /*496*/ { 2, 32, "1", 361, 0, 17, 139 }, - /*497*/ { 2, 32, "1", 362, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*498*/ { 2, 32, "A", 219, 0, 17, 139 }, - /*499*/ { 2, 32, "A", 220, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*500*/ { 2, 32, "\200", 150, 0, 17, 139 }, - /*501*/ { 2, 32, "\200", 151, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*502*/ { 2, 32, "\201", 184, 0, 17, 139 }, /* 92 Shift JIS 0x8181 */ - /*503*/ { 2, 32, "\201", 186, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 93 Shift JIS 0x8181 */ - /*504*/ { 4, 32, "1", 178, 0, 17, 139 }, - /*505*/ { 4, 32, "1", 179, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*506*/ { 4, 32, "A", 108, 0, 17, 139 }, - /*507*/ { 4, 32, "A", 109, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*508*/ { 4, 32, "\200", 74, 0, 17, 139 }, - /*509*/ { 4, 32, "\200", 75, ZINT_ERROR_TOO_LONG, -1, -1 }, - /*510*/ { 4, 32, "\201", 92, 0, 17, 139 }, /* 46 Shift JIS 0x8181 */ - /*511*/ { 4, 32, "\201", 94, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 47 Shift JIS 0x8181 */ + static const struct item data[] = { + /* 0*/ { 2, 1, "1", 12, 0, 7, 43, "", "" }, + /* 1*/ { 2, 1, "1", 13, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 1 R7x43-M, requires 7 codewords (maximum 6)", "" }, + /* 2*/ { 2, 1, "A", 7, 0, 7, 43, "", "" }, + /* 3*/ { 2, 1, "A", 8, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 1 R7x43-M, requires 7 codewords (maximum 6)", "" }, + /* 4*/ { 2, 1, "\200", 5, 0, 7, 43, "", "" }, + /* 5*/ { 2, 1, "\200", 6, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 1 R7x43-M, requires 7 codewords (maximum 6)", "" }, + /* 6*/ { 2, 1, "\201", 6, 0, 7, 43, "", "3 Shift JIS 0x8181" }, + /* 7*/ { 2, 1, "\201", 8, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 1 R7x43-M, requires 8 codewords (maximum 6)", "4 Shift JIS 0x8181" }, + /* 8*/ { 4, 1, "1", 5, 0, 7, 43, "", "" }, + /* 9*/ { 4, 1, "1", 6, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 1 R7x43-H, requires 4 codewords (maximum 3)", "" }, + /* 10*/ { 4, 1, "A", 3, 0, 7, 43, "", "" }, + /* 11*/ { 4, 1, "A", 4, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 1 R7x43-H, requires 4 codewords (maximum 3)", "" }, + /* 12*/ { 4, 1, "\200", 2, 0, 7, 43, "", "" }, + /* 13*/ { 4, 1, "\200", 3, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 1 R7x43-H, requires 4 codewords (maximum 3)", "" }, + /* 14*/ { 4, 1, "\201", 2, 0, 7, 43, "", "1 Shift JIS 0x8181" }, + /* 15*/ { 4, 1, "\201", 4, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 1 R7x43-H, requires 4 codewords (maximum 3)", "2 Shift JIS 0x8181" }, + /* 16*/ { 2, 2, "1", 26, 0, 7, 59, "", "" }, + /* 17*/ { 2, 2, "1", 27, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 2 R7x59-M, requires 13 codewords (maximum 12)", "" }, + /* 18*/ { 2, 2, "A", 16, 0, 7, 59, "", "" }, + /* 19*/ { 2, 2, "A", 17, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 2 R7x59-M, requires 13 codewords (maximum 12)", "" }, + /* 20*/ { 2, 2, "\200", 11, 0, 7, 59, "", "" }, + /* 21*/ { 2, 2, "\200", 12, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 2 R7x59-M, requires 13 codewords (maximum 12)", "" }, + /* 22*/ { 2, 2, "\201", 12, 0, 7, 59, "", "6 Shift JIS 0x8181" }, + /* 23*/ { 2, 2, "\201", 14, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 2 R7x59-M, requires 13 codewords (maximum 12)", "7 Shift JIS 0x8181" }, + /* 24*/ { 4, 2, "1", 14, 0, 7, 59, "", "" }, + /* 25*/ { 4, 2, "1", 15, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 2 R7x59-H, requires 8 codewords (maximum 7)", "" }, + /* 26*/ { 4, 2, "A", 8, 0, 7, 59, "", "" }, + /* 27*/ { 4, 2, "A", 9, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 2 R7x59-H, requires 8 codewords (maximum 7)", "" }, + /* 28*/ { 4, 2, "\200", 6, 0, 7, 59, "", "" }, + /* 29*/ { 4, 2, "\200", 7, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 2 R7x59-H, requires 8 codewords (maximum 7)", "" }, + /* 30*/ { 4, 2, "\201", 6, 0, 7, 59, "", "3 Shift JIS 0x8181" }, + /* 31*/ { 4, 2, "\201", 8, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 2 R7x59-H, requires 8 codewords (maximum 7)", "4 Shift JIS 0x8181" }, + /* 32*/ { 2, 3, "1", 45, 0, 7, 77, "", "" }, + /* 33*/ { 2, 3, "1", 46, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 3 R7x77-M, requires 21 codewords (maximum 20)", "" }, + /* 34*/ { 2, 3, "A", 27, 0, 7, 77, "", "" }, + /* 35*/ { 2, 3, "A", 28, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 3 R7x77-M, requires 21 codewords (maximum 20)", "" }, + /* 36*/ { 2, 3, "\200", 19, 0, 7, 77, "", "" }, + /* 37*/ { 2, 3, "\200", 20, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 3 R7x77-M, requires 21 codewords (maximum 20)", "" }, + /* 38*/ { 2, 3, "\201", 22, 0, 7, 77, "", "11 Shift JIS 0x8181" }, + /* 39*/ { 2, 3, "\201", 24, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 3 R7x77-M, requires 21 codewords (maximum 20)", "12 Shift JIS 0x8181" }, + /* 40*/ { 4, 3, "1", 21, 0, 7, 77, "", "" }, + /* 41*/ { 4, 3, "1", 22, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 3 R7x77-H, requires 11 codewords (maximum 10)", "" }, + /* 42*/ { 4, 3, "A", 13, 0, 7, 77, "", "" }, + /* 43*/ { 4, 3, "A", 14, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 3 R7x77-H, requires 11 codewords (maximum 10)", "" }, + /* 44*/ { 4, 3, "\200", 9, 0, 7, 77, "", "" }, + /* 45*/ { 4, 3, "\200", 10, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 3 R7x77-H, requires 11 codewords (maximum 10)", "" }, + /* 46*/ { 4, 3, "\201", 10, 0, 7, 77, "", "5 Shift JIS 0x8181" }, + /* 47*/ { 4, 3, "\201", 12, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 3 R7x77-H, requires 11 codewords (maximum 10)", "6 Shift JIS 0x8181" }, + /* 48*/ { 2, 4, "1", 64, 0, 7, 99, "", "" }, + /* 49*/ { 2, 4, "1", 65, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 4 R7x99-M, requires 29 codewords (maximum 28)", "" }, + /* 50*/ { 2, 4, "A", 39, 0, 7, 99, "", "" }, + /* 51*/ { 2, 4, "A", 40, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 4 R7x99-M, requires 29 codewords (maximum 28)", "" }, + /* 52*/ { 2, 4, "\200", 27, 0, 7, 99, "", "" }, + /* 53*/ { 2, 4, "\200", 28, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 4 R7x99-M, requires 29 codewords (maximum 28)", "" }, + /* 54*/ { 2, 4, "\201", 32, 0, 7, 99, "", "16 Shift JIS 0x8181" }, + /* 55*/ { 2, 4, "\201", 34, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 4 R7x99-M, requires 29 codewords (maximum 28)", "17 Shift JIS 0x8181" }, + /* 56*/ { 4, 4, "1", 30, 0, 7, 99, "", "" }, + /* 57*/ { 4, 4, "1", 31, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 4 R7x99-H, requires 15 codewords (maximum 14)", "" }, + /* 58*/ { 4, 4, "A", 18, 0, 7, 99, "", "" }, + /* 59*/ { 4, 4, "A", 19, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 4 R7x99-H, requires 15 codewords (maximum 14)", "" }, + /* 60*/ { 4, 4, "\200", 13, 0, 7, 99, "", "" }, + /* 61*/ { 4, 4, "\200", 14, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 4 R7x99-H, requires 15 codewords (maximum 14)", "" }, + /* 62*/ { 4, 4, "\201", 16, 0, 7, 99, "", "8 Shift JIS 0x8181" }, + /* 63*/ { 4, 4, "\201", 18, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 4 R7x99-H, requires 16 codewords (maximum 14)", "9 Shift JIS 0x8181" }, + /* 64*/ { 2, 5, "1", 102, 0, 7, 139, "", "" }, + /* 65*/ { 2, 5, "1", 103, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 5 R7x139-M, requires 45 codewords (maximum 44)", "" }, + /* 66*/ { 2, 5, "A", 62, 0, 7, 139, "", "" }, + /* 67*/ { 2, 5, "A", 63, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 5 R7x139-M, requires 45 codewords (maximum 44)", "" }, + /* 68*/ { 2, 5, "\200", 42, 0, 7, 139, "", "" }, + /* 69*/ { 2, 5, "\200", 43, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 5 R7x139-M, requires 45 codewords (maximum 44)", "" }, + /* 70*/ { 2, 5, "\201", 52, 0, 7, 139, "", "26 Shift JIS 0x8181" }, + /* 71*/ { 2, 5, "\201", 54, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 5 R7x139-M, requires 45 codewords (maximum 44)", "27 Shift JIS 0x8181" }, + /* 72*/ { 4, 5, "1", 54, 0, 7, 139, "", "" }, + /* 73*/ { 4, 5, "1", 55, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 5 R7x139-H, requires 25 codewords (maximum 24)", "" }, + /* 74*/ { 4, 5, "A", 33, 0, 7, 139, "", "" }, + /* 75*/ { 4, 5, "A", 34, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 5 R7x139-H, requires 25 codewords (maximum 24)", "" }, + /* 76*/ { 4, 5, "\200", 22, 0, 7, 139, "", "" }, + /* 77*/ { 4, 5, "\200", 23, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 5 R7x139-H, requires 25 codewords (maximum 24)", "" }, + /* 78*/ { 4, 5, "\201", 28, 0, 7, 139, "", "14 Shift JIS 0x8181" }, + /* 79*/ { 4, 5, "\201", 30, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 5 R7x139-H, requires 26 codewords (maximum 24)", "15 Shift JIS 0x8181" }, + /* 80*/ { 2, 6, "1", 26, 0, 9, 43, "", "" }, + /* 81*/ { 2, 6, "1", 27, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 6 R9x43-M, requires 13 codewords (maximum 12)", "" }, + /* 82*/ { 2, 6, "A", 16, 0, 9, 43, "", "" }, + /* 83*/ { 2, 6, "A", 17, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 6 R9x43-M, requires 13 codewords (maximum 12)", "" }, + /* 84*/ { 2, 6, "\200", 11, 0, 9, 43, "", "" }, + /* 85*/ { 2, 6, "\200", 12, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 6 R9x43-M, requires 13 codewords (maximum 12)", "" }, + /* 86*/ { 2, 6, "\201", 12, 0, 9, 43, "", "6 Shift JIS 0x8181" }, + /* 87*/ { 2, 6, "\201", 14, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 6 R9x43-M, requires 13 codewords (maximum 12)", "7 Shift JIS 0x8181" }, + /* 88*/ { 4, 6, "1", 14, 0, 9, 43, "", "" }, + /* 89*/ { 4, 6, "1", 15, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 6 R9x43-H, requires 8 codewords (maximum 7)", "" }, + /* 90*/ { 4, 6, "A", 8, 0, 9, 43, "", "" }, + /* 91*/ { 4, 6, "A", 9, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 6 R9x43-H, requires 8 codewords (maximum 7)", "" }, + /* 92*/ { 4, 6, "\200", 6, 0, 9, 43, "", "" }, + /* 93*/ { 4, 6, "\200", 7, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 6 R9x43-H, requires 8 codewords (maximum 7)", "" }, + /* 94*/ { 4, 6, "\201", 6, 0, 9, 43, "", "3 Shift JIS 0x8181" }, + /* 95*/ { 4, 6, "\201", 8, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 6 R9x43-H, requires 8 codewords (maximum 7)", "4 Shift JIS 0x8181" }, + /* 96*/ { 2, 7, "1", 47, 0, 9, 59, "", "" }, + /* 97*/ { 2, 7, "1", 48, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 7 R9x59-M, requires 22 codewords (maximum 21)", "" }, + /* 98*/ { 2, 7, "A", 29, 0, 9, 59, "", "" }, + /* 99*/ { 2, 7, "A", 30, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 7 R9x59-M, requires 22 codewords (maximum 21)", "" }, + /*100*/ { 2, 7, "\200", 20, 0, 9, 59, "", "" }, + /*101*/ { 2, 7, "\200", 21, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 7 R9x59-M, requires 22 codewords (maximum 21)", "" }, + /*102*/ { 2, 7, "\201", 24, 0, 9, 59, "", "12 Shift JIS 0x8181" }, + /*103*/ { 2, 7, "\201", 26, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 7 R9x59-M, requires 22 codewords (maximum 21)", "13 Shift JIS 0x8181" }, + /*104*/ { 4, 7, "1", 23, 0, 9, 59, "", "" }, + /*105*/ { 4, 7, "1", 24, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 7 R9x59-H, requires 12 codewords (maximum 11)", "" }, + /*106*/ { 4, 7, "A", 14, 0, 9, 59, "", "" }, + /*107*/ { 4, 7, "A", 15, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 7 R9x59-H, requires 12 codewords (maximum 11)", "" }, + /*108*/ { 4, 7, "\200", 10, 0, 9, 59, "", "" }, + /*109*/ { 4, 7, "\200", 11, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 7 R9x59-H, requires 12 codewords (maximum 11)", "" }, + /*110*/ { 4, 7, "\201", 12, 0, 9, 59, "", "6 Shift JIS 0x8181" }, + /*111*/ { 4, 7, "\201", 14, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 7 R9x59-H, requires 13 codewords (maximum 11)", "7 Shift JIS 0x8181" }, + /*112*/ { 2, 8, "1", 71, 0, 9, 77, "", "" }, + /*113*/ { 2, 8, "1", 72, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 8 R9x77-M, requires 32 codewords (maximum 31)", "" }, + /*114*/ { 2, 8, "A", 43, 0, 9, 77, "", "" }, + /*115*/ { 2, 8, "A", 44, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 8 R9x77-M, requires 32 codewords (maximum 31)", "" }, + /*116*/ { 2, 8, "\200", 30, 0, 9, 77, "", "" }, + /*117*/ { 2, 8, "\200", 31, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 8 R9x77-M, requires 32 codewords (maximum 31)", "" }, + /*118*/ { 2, 8, "\201", 36, 0, 9, 77, "", "18 Shift JIS 0x8181" }, + /*119*/ { 2, 8, "\201", 38, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 8 R9x77-M, requires 32 codewords (maximum 31)", "19 Shift JIS 0x8181" }, + /*120*/ { 4, 8, "1", 37, 0, 9, 77, "", "" }, + /*121*/ { 4, 8, "1", 38, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 8 R9x77-H, requires 18 codewords (maximum 17)", "" }, + /*122*/ { 4, 8, "A", 23, 0, 9, 77, "", "" }, + /*123*/ { 4, 8, "A", 24, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 8 R9x77-H, requires 18 codewords (maximum 17)", "" }, + /*124*/ { 4, 8, "\200", 16, 0, 9, 77, "", "" }, + /*125*/ { 4, 8, "\200", 17, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 8 R9x77-H, requires 18 codewords (maximum 17)", "" }, + /*126*/ { 4, 8, "\201", 18, 0, 9, 77, "", "9 Shift JIS 0x8181" }, + /*127*/ { 4, 8, "\201", 20, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 8 R9x77-H, requires 18 codewords (maximum 17)", "10 Shift JIS 0x8181" }, + /*128*/ { 2, 9, "1", 97, 0, 9, 99, "", "" }, + /*129*/ { 2, 9, "1", 98, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 9 R9x99-M, requires 43 codewords (maximum 42)", "" }, + /*130*/ { 2, 9, "A", 59, 0, 9, 99, "", "" }, + /*131*/ { 2, 9, "A", 60, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 9 R9x99-M, requires 43 codewords (maximum 42)", "" }, + /*132*/ { 2, 9, "\200", 40, 0, 9, 99, "", "" }, + /*133*/ { 2, 9, "\200", 41, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 9 R9x99-M, requires 43 codewords (maximum 42)", "" }, + /*134*/ { 2, 9, "\201", 50, 0, 9, 99, "", "25 Shift JIS 0x8181" }, + /*135*/ { 2, 9, "\201", 52, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 9 R9x99-M, requires 44 codewords (maximum 42)", "26 Shift JIS 0x8181" }, + /*136*/ { 4, 9, "1", 49, 0, 9, 99, "", "" }, + /*137*/ { 4, 9, "1", 50, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 9 R9x99-H, requires 23 codewords (maximum 22)", "" }, + /*138*/ { 4, 9, "A", 30, 0, 9, 99, "", "" }, + /*139*/ { 4, 9, "A", 31, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 9 R9x99-H, requires 23 codewords (maximum 22)", "" }, + /*140*/ { 4, 9, "\200", 20, 0, 9, 99, "", "" }, + /*141*/ { 4, 9, "\200", 21, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 9 R9x99-H, requires 23 codewords (maximum 22)", "" }, + /*142*/ { 4, 9, "\201", 24, 0, 9, 99, "", "12 Shift JIS 0x8181" }, + /*143*/ { 4, 9, "\201", 26, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 9 R9x99-H, requires 23 codewords (maximum 22)", "13 Shift JIS 0x8181" }, + /*144*/ { 2, 10, "1", 147, 0, 9, 139, "", "" }, + /*145*/ { 2, 10, "1", 148, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 10 R9x139-M, requires 64 codewords (maximum 63)", "" }, + /*146*/ { 2, 10, "A", 89, 0, 9, 139, "", "" }, + /*147*/ { 2, 10, "A", 90, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 10 R9x139-M, requires 64 codewords (maximum 63)", "" }, + /*148*/ { 2, 10, "\200", 61, 0, 9, 139, "", "" }, + /*149*/ { 2, 10, "\200", 62, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 10 R9x139-M, requires 64 codewords (maximum 63)", "" }, + /*150*/ { 2, 10, "\201", 76, 0, 9, 139, "", "36 Shift JIS 0x8181" }, + /*151*/ { 2, 10, "\201", 78, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 10 R9x139-M, requires 65 codewords (maximum 63)", "37 Shift JIS 0x8181" }, + /*152*/ { 4, 10, "1", 75, 0, 9, 139, "", "" }, + /*153*/ { 4, 10, "1", 76, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 10 R9x139-H, requires 34 codewords (maximum 33)", "" }, + /*154*/ { 4, 10, "A", 46, 0, 9, 139, "", "" }, + /*155*/ { 4, 10, "A", 47, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 10 R9x139-H, requires 34 codewords (maximum 33)", "" }, + /*156*/ { 4, 10, "\200", 31, 0, 9, 139, "", "" }, + /*157*/ { 4, 10, "\200", 32, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 10 R9x139-H, requires 34 codewords (maximum 33)", "" }, + /*158*/ { 4, 10, "\201", 38, 0, 9, 139, "", "19 Shift JIS 0x8181" }, + /*159*/ { 4, 10, "\201", 40, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 10 R9x139-H, requires 34 codewords (maximum 33)", "20 Shift JIS 0x8181" }, + /*160*/ { 2, 11, "1", 14, 0, 11, 27, "", "" }, + /*161*/ { 2, 11, "1", 15, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 11 R11x27-M, requires 8 codewords (maximum 7)", "" }, + /*162*/ { 2, 11, "A", 8, 0, 11, 27, "", "" }, + /*163*/ { 2, 11, "A", 9, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 11 R11x27-M, requires 8 codewords (maximum 7)", "" }, + /*164*/ { 2, 11, "\200", 6, 0, 11, 27, "", "" }, + /*165*/ { 2, 11, "\200", 7, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 11 R11x27-M, requires 8 codewords (maximum 7)", "" }, + /*166*/ { 2, 11, "\201", 6, 0, 11, 27, "", "3 Shift JIS 0x8181" }, + /*167*/ { 2, 11, "\201", 8, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 11 R11x27-M, requires 8 codewords (maximum 7)", "4 Shift JIS 0x8181" }, + /*168*/ { 4, 11, "1", 9, 0, 11, 27, "", "" }, + /*169*/ { 4, 11, "1", 10, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 11 R11x27-H, requires 6 codewords (maximum 5)", "" }, + /*170*/ { 4, 11, "A", 6, 0, 11, 27, "", "" }, + /*171*/ { 4, 11, "A", 7, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 11 R11x27-H, requires 6 codewords (maximum 5)", "" }, + /*172*/ { 4, 11, "\200", 4, 0, 11, 27, "", "" }, + /*173*/ { 4, 11, "\200", 5, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 11 R11x27-H, requires 6 codewords (maximum 5)", "" }, + /*174*/ { 4, 11, "\201", 4, 0, 11, 27, "", "2 Shift JIS 0x8181" }, + /*175*/ { 4, 11, "\201", 6, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 11 R11x27-H, requires 6 codewords (maximum 5)", "3 Shift JIS 0x8181" }, + /*176*/ { 2, 12, "1", 42, 0, 11, 43, "", "" }, + /*177*/ { 2, 12, "1", 43, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 12 R11x43-M, requires 20 codewords (maximum 19)", "" }, + /*178*/ { 2, 12, "A", 26, 0, 11, 43, "", "" }, + /*179*/ { 2, 12, "A", 27, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 12 R11x43-M, requires 20 codewords (maximum 19)", "" }, + /*180*/ { 2, 12, "\200", 18, 0, 11, 43, "", "" }, + /*181*/ { 2, 12, "\200", 19, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 12 R11x43-M, requires 20 codewords (maximum 19)", "" }, + /*182*/ { 2, 12, "\201", 22, 0, 11, 43, "", "11 Shift JIS 0x8181" }, + /*183*/ { 2, 12, "\201", 24, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 12 R11x43-M, requires 21 codewords (maximum 19)", "12 Shift JIS 0x8181" }, + /*184*/ { 4, 12, "1", 23, 0, 11, 43, "", "" }, + /*185*/ { 4, 12, "1", 24, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 12 R11x43-H, requires 12 codewords (maximum 11)", "" }, + /*186*/ { 4, 12, "A", 14, 0, 11, 43, "", "" }, + /*187*/ { 4, 12, "A", 15, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 12 R11x43-H, requires 12 codewords (maximum 11)", "" }, + /*188*/ { 4, 12, "\200", 10, 0, 11, 43, "", "" }, + /*189*/ { 4, 12, "\200", 11, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 12 R11x43-H, requires 12 codewords (maximum 11)", "" }, + /*190*/ { 4, 12, "\201", 12, 0, 11, 43, "", "6 Shift JIS 0x8181" }, + /*191*/ { 4, 12, "\201", 14, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 12 R11x43-H, requires 13 codewords (maximum 11)", "7 Shift JIS 0x8181" }, + /*192*/ { 2, 13, "1", 71, 0, 11, 59, "", "" }, + /*193*/ { 2, 13, "1", 72, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 13 R11x59-M, requires 32 codewords (maximum 31)", "" }, + /*194*/ { 2, 13, "A", 43, 0, 11, 59, "", "" }, + /*195*/ { 2, 13, "A", 44, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 13 R11x59-M, requires 32 codewords (maximum 31)", "" }, + /*196*/ { 2, 13, "\200", 30, 0, 11, 59, "", "" }, + /*197*/ { 2, 13, "\200", 31, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 13 R11x59-M, requires 32 codewords (maximum 31)", "" }, + /*198*/ { 2, 13, "\201", 36, 0, 11, 59, "", "18 Shift JIS 0x8181" }, + /*199*/ { 2, 13, "\201", 38, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 13 R11x59-M, requires 32 codewords (maximum 31)", "19 Shift JIS 0x8181" }, + /*200*/ { 4, 13, "1", 33, 0, 11, 59, "", "" }, + /*201*/ { 4, 13, "1", 34, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 13 R11x59-H, requires 16 codewords (maximum 15)", "" }, + /*202*/ { 4, 13, "A", 20, 0, 11, 59, "", "" }, + /*203*/ { 4, 13, "A", 21, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 13 R11x59-H, requires 16 codewords (maximum 15)", "" }, + /*204*/ { 4, 13, "\200", 14, 0, 11, 59, "", "" }, + /*205*/ { 4, 13, "\200", 15, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 13 R11x59-H, requires 16 codewords (maximum 15)", "" }, + /*206*/ { 4, 13, "\201", 16, 0, 11, 59, "", "8 Shift JIS 0x8181" }, + /*207*/ { 4, 13, "\201", 18, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 13 R11x59-H, requires 16 codewords (maximum 15)", "9 Shift JIS 0x8181" }, + /*208*/ { 2, 14, "1", 100, 0, 11, 77, "", "" }, + /*209*/ { 2, 14, "1", 101, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 14 R11x77-M, requires 44 codewords (maximum 43)", "" }, + /*210*/ { 2, 14, "A", 60, 0, 11, 77, "", "" }, + /*211*/ { 2, 14, "A", 61, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 14 R11x77-M, requires 44 codewords (maximum 43)", "" }, + /*212*/ { 2, 14, "\200", 41, 0, 11, 77, "", "" }, + /*213*/ { 2, 14, "\200", 42, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 14 R11x77-M, requires 44 codewords (maximum 43)", "" }, + /*214*/ { 2, 14, "\201", 50, 0, 11, 77, "", "25 Shift JIS 0x8181" }, + /*215*/ { 2, 14, "\201", 52, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 14 R11x77-M, requires 44 codewords (maximum 43)", "26 Shift JIS 0x8181" }, + /*216*/ { 4, 14, "1", 52, 0, 11, 77, "", "" }, + /*217*/ { 4, 14, "1", 53, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 14 R11x77-H, requires 24 codewords (maximum 23)", "" }, + /*218*/ { 4, 14, "A", 31, 0, 11, 77, "", "" }, + /*219*/ { 4, 14, "A", 32, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 14 R11x77-H, requires 24 codewords (maximum 23)", "" }, + /*220*/ { 4, 14, "\200", 21, 0, 11, 77, "", "" }, + /*221*/ { 4, 14, "\200", 22, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 14 R11x77-H, requires 24 codewords (maximum 23)", "" }, + /*222*/ { 4, 14, "\201", 26, 0, 11, 77, "", "13 Shift JIS 0x8181" }, + /*223*/ { 4, 14, "\201", 28, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 14 R11x77-H, requires 24 codewords (maximum 23)", "14 Shift JIS 0x8181" }, + /*224*/ { 2, 15, "1", 133, 0, 11, 99, "", "" }, + /*225*/ { 2, 15, "1", 134, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 15 R11x99-M, requires 58 codewords (maximum 57)", "" }, + /*226*/ { 2, 15, "A", 81, 0, 11, 99, "", "" }, + /*227*/ { 2, 15, "A", 82, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 15 R11x99-M, requires 58 codewords (maximum 57)", "" }, + /*228*/ { 2, 15, "\200", 55, 0, 11, 99, "", "" }, + /*229*/ { 2, 15, "\200", 56, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 15 R11x99-M, requires 58 codewords (maximum 57)", "" }, + /*230*/ { 2, 15, "\201", 68, 0, 11, 99, "", "34 Shift JIS 0x8181" }, + /*231*/ { 2, 15, "\201", 70, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 15 R11x99-M, requires 58 codewords (maximum 57)", "35 Shift JIS 0x8181" }, + /*232*/ { 4, 15, "1", 66, 0, 11, 99, "", "" }, + /*233*/ { 4, 15, "1", 67, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 15 R11x99-H, requires 30 codewords (maximum 29)", "" }, + /*234*/ { 4, 15, "A", 40, 0, 11, 99, "", "" }, + /*235*/ { 4, 15, "A", 41, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 15 R11x99-H, requires 30 codewords (maximum 29)", "" }, + /*236*/ { 4, 15, "\200", 27, 0, 11, 99, "", "" }, + /*237*/ { 4, 15, "\200", 28, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 15 R11x99-H, requires 30 codewords (maximum 29)", "" }, + /*238*/ { 4, 15, "\201", 34, 0, 11, 99, "", "17 Shift JIS 0x8181" }, + /*239*/ { 4, 15, "\201", 36, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 15 R11x99-H, requires 31 codewords (maximum 29)", "18 Shift JIS 0x8181" }, + /*240*/ { 2, 16, "1", 198, 0, 11, 139, "", "" }, + /*241*/ { 2, 16, "1", 199, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 16 R11x139-M, requires 85 codewords (maximum 84)", "" }, + /*242*/ { 2, 16, "A", 120, 0, 11, 139, "", "" }, + /*243*/ { 2, 16, "A", 121, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 16 R11x139-M, requires 85 codewords (maximum 84)", "" }, + /*244*/ { 2, 16, "\200", 82, 0, 11, 139, "", "" }, + /*245*/ { 2, 16, "\200", 83, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 16 R11x139-M, requires 85 codewords (maximum 84)", "" }, + /*246*/ { 2, 16, "\201", 102, 0, 11, 139, "", "51 Shift JIS 0x8181" }, + /*247*/ { 2, 16, "\201", 104, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 16 R11x139-M, requires 86 codewords (maximum 84)", "52 Shift JIS 0x8181" }, + /*248*/ { 4, 16, "1", 97, 0, 11, 139, "", "" }, + /*249*/ { 4, 16, "1", 98, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 16 R11x139-H, requires 43 codewords (maximum 42)", "" }, + /*250*/ { 4, 16, "A", 59, 0, 11, 139, "", "" }, + /*251*/ { 4, 16, "A", 60, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 16 R11x139-H, requires 43 codewords (maximum 42)", "" }, + /*252*/ { 4, 16, "\200", 40, 0, 11, 139, "", "" }, + /*253*/ { 4, 16, "\200", 41, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 16 R11x139-H, requires 43 codewords (maximum 42)", "" }, + /*254*/ { 4, 16, "\201", 50, 0, 11, 139, "", "25 Shift JIS 0x8181" }, + /*255*/ { 4, 16, "\201", 52, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 16 R11x139-H, requires 44 codewords (maximum 42)", "26 Shift JIS 0x8181" }, + /*256*/ { 2, 17, "1", 26, 0, 13, 27, "", "" }, + /*257*/ { 2, 17, "1", 27, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 17 R13x27-M, requires 13 codewords (maximum 12)", "" }, + /*258*/ { 2, 17, "A", 16, 0, 13, 27, "", "" }, + /*259*/ { 2, 17, "A", 17, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 17 R13x27-M, requires 13 codewords (maximum 12)", "" }, + /*260*/ { 2, 17, "\200", 11, 0, 13, 27, "", "" }, + /*261*/ { 2, 17, "\200", 12, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 17 R13x27-M, requires 13 codewords (maximum 12)", "" }, + /*262*/ { 2, 17, "\201", 12, 0, 13, 27, "", "6 Shift JIS 0x8181" }, + /*263*/ { 2, 17, "\201", 14, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 17 R13x27-M, requires 13 codewords (maximum 12)", "7 Shift JIS 0x8181" }, + /*264*/ { 4, 17, "1", 14, 0, 13, 27, "", "" }, + /*265*/ { 4, 17, "1", 15, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 17 R13x27-H, requires 8 codewords (maximum 7)", "" }, + /*266*/ { 4, 17, "A", 8, 0, 13, 27, "", "" }, + /*267*/ { 4, 17, "A", 9, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 17 R13x27-H, requires 8 codewords (maximum 7)", "" }, + /*268*/ { 4, 17, "\200", 6, 0, 13, 27, "", "" }, + /*269*/ { 4, 17, "\200", 7, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 17 R13x27-H, requires 8 codewords (maximum 7)", "" }, + /*270*/ { 4, 17, "\201", 6, 0, 13, 27, "", "3 Shift JIS 0x8181" }, + /*271*/ { 4, 17, "\201", 8, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 17 R13x27-H, requires 8 codewords (maximum 7)", "4 Shift JIS 0x8181" }, + /*272*/ { 2, 18, "1", 62, 0, 13, 43, "", "" }, + /*273*/ { 2, 18, "1", 63, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 18 R13x43-M, requires 28 codewords (maximum 27)", "" }, + /*274*/ { 2, 18, "A", 37, 0, 13, 43, "", "" }, + /*275*/ { 2, 18, "A", 38, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 18 R13x43-M, requires 28 codewords (maximum 27)", "" }, + /*276*/ { 2, 18, "\200", 26, 0, 13, 43, "", "" }, + /*277*/ { 2, 18, "\200", 27, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 18 R13x43-M, requires 28 codewords (maximum 27)", "" }, + /*278*/ { 2, 18, "\201", 32, 0, 13, 43, "", "16 Shift JIS 0x8181" }, + /*279*/ { 2, 18, "\201", 34, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 18 R13x43-M, requires 29 codewords (maximum 27)", "17 Shift JIS 0x8181" }, + /*280*/ { 4, 18, "1", 28, 0, 13, 43, "", "" }, + /*281*/ { 4, 18, "1", 29, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 18 R13x43-H, requires 14 codewords (maximum 13)", "" }, + /*282*/ { 4, 18, "A", 17, 0, 13, 43, "", "" }, + /*283*/ { 4, 18, "A", 18, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 18 R13x43-H, requires 14 codewords (maximum 13)", "" }, + /*284*/ { 4, 18, "\200", 12, 0, 13, 43, "", "" }, + /*285*/ { 4, 18, "\200", 13, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 18 R13x43-H, requires 14 codewords (maximum 13)", "" }, + /*286*/ { 4, 18, "\201", 14, 0, 13, 43, "", "7 Shift JIS 0x8181" }, + /*287*/ { 4, 18, "\201", 16, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 18 R13x43-H, requires 14 codewords (maximum 13)", "8 Shift JIS 0x8181" }, + /*288*/ { 2, 19, "1", 88, 0, 13, 59, "", "" }, + /*289*/ { 2, 19, "1", 89, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 19 R13x59-M, requires 39 codewords (maximum 38)", "" }, + /*290*/ { 2, 19, "A", 53, 0, 13, 59, "", "" }, + /*291*/ { 2, 19, "A", 54, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 19 R13x59-M, requires 39 codewords (maximum 38)", "" }, + /*292*/ { 2, 19, "\200", 36, 0, 13, 59, "", "" }, + /*293*/ { 2, 19, "\200", 37, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 19 R13x59-M, requires 39 codewords (maximum 38)", "" }, + /*294*/ { 2, 19, "\201", 44, 0, 13, 59, "", "22 Shift JIS 0x8181" }, + /*295*/ { 2, 19, "\201", 46, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 19 R13x59-M, requires 39 codewords (maximum 38)", "23 Shift JIS 0x8181" }, + /*296*/ { 4, 19, "1", 45, 0, 13, 59, "", "" }, + /*297*/ { 4, 19, "1", 46, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 19 R13x59-H, requires 21 codewords (maximum 20)", "" }, + /*298*/ { 4, 19, "A", 27, 0, 13, 59, "", "" }, + /*299*/ { 4, 19, "A", 28, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 19 R13x59-H, requires 21 codewords (maximum 20)", "" }, + /*300*/ { 4, 19, "\200", 18, 0, 13, 59, "", "" }, + /*301*/ { 4, 19, "\200", 19, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 19 R13x59-H, requires 21 codewords (maximum 20)", "" }, + /*302*/ { 4, 19, "\201", 22, 0, 13, 59, "", "11 Shift JIS 0x8181" }, + /*303*/ { 4, 19, "\201", 24, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 19 R13x59-H, requires 21 codewords (maximum 20)", "12 Shift JIS 0x8181" }, + /*304*/ { 2, 20, "1", 124, 0, 13, 77, "", "" }, + /*305*/ { 2, 20, "1", 125, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 20 R13x77-M, requires 54 codewords (maximum 53)", "" }, + /*306*/ { 2, 20, "A", 75, 0, 13, 77, "", "" }, + /*307*/ { 2, 20, "A", 76, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 20 R13x77-M, requires 54 codewords (maximum 53)", "" }, + /*308*/ { 2, 20, "\200", 51, 0, 13, 77, "", "" }, + /*309*/ { 2, 20, "\200", 52, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 20 R13x77-M, requires 54 codewords (maximum 53)", "" }, + /*310*/ { 2, 20, "\201", 62, 0, 13, 77, "", "31 Shift JIS 0x8181" }, + /*311*/ { 2, 20, "\201", 64, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 20 R13x77-M, requires 54 codewords (maximum 53)", "32 Shift JIS 0x8181" }, + /*312*/ { 4, 20, "1", 66, 0, 13, 77, "", "" }, + /*313*/ { 4, 20, "1", 67, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 20 R13x77-H, requires 30 codewords (maximum 29)", "" }, + /*314*/ { 4, 20, "A", 40, 0, 13, 77, "", "" }, + /*315*/ { 4, 20, "A", 41, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 20 R13x77-H, requires 30 codewords (maximum 29)", "" }, + /*316*/ { 4, 20, "\200", 27, 0, 13, 77, "", "" }, + /*317*/ { 4, 20, "\200", 28, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 20 R13x77-H, requires 30 codewords (maximum 29)", "" }, + /*318*/ { 4, 20, "\201", 34, 0, 13, 77, "", "17 Shift JIS 0x8181" }, + /*319*/ { 4, 20, "\201", 36, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 20 R13x77-H, requires 31 codewords (maximum 29)", "18 Shift JIS 0x8181" }, + /*320*/ { 2, 21, "1", 171, 0, 13, 99, "", "" }, + /*321*/ { 2, 21, "1", 172, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 21 R13x99-M, requires 74 codewords (maximum 73)", "" }, + /*322*/ { 2, 21, "A", 104, 0, 13, 99, "", "" }, + /*323*/ { 2, 21, "A", 105, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 21 R13x99-M, requires 74 codewords (maximum 73)", "" }, + /*324*/ { 2, 21, "\200", 71, 0, 13, 99, "", "" }, + /*325*/ { 2, 21, "\200", 72, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 21 R13x99-M, requires 74 codewords (maximum 73)", "" }, + /*326*/ { 2, 21, "\201", 88, 0, 13, 99, "", "44 Shift JIS 0x8181" }, + /*327*/ { 2, 21, "\201", 90, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 21 R13x99-M, requires 75 codewords (maximum 73)", "45 Shift JIS 0x8181" }, + /*328*/ { 4, 21, "1", 80, 0, 13, 99, "", "" }, + /*329*/ { 4, 21, "1", 81, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 21 R13x99-H, requires 36 codewords (maximum 35)", "" }, + /*330*/ { 4, 21, "A", 49, 0, 13, 99, "", "" }, + /*331*/ { 4, 21, "A", 50, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 21 R13x99-H, requires 36 codewords (maximum 35)", "" }, + /*332*/ { 4, 21, "\200", 33, 0, 13, 99, "", "" }, + /*333*/ { 4, 21, "\200", 34, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 21 R13x99-H, requires 36 codewords (maximum 35)", "" }, + /*334*/ { 4, 21, "\201", 40, 0, 13, 99, "", "20 Shift JIS 0x8181" }, + /*335*/ { 4, 21, "\201", 42, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 21 R13x99-H, requires 36 codewords (maximum 35)", "21 Shift JIS 0x8181" }, + /*336*/ { 2, 22, "1", 251, 0, 13, 139, "", "" }, + /*337*/ { 2, 22, "1", 252, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 22 R13x139-M, requires 107 codewords (maximum 106)", "" }, + /*338*/ { 2, 22, "A", 152, 0, 13, 139, "", "" }, + /*339*/ { 2, 22, "A", 153, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 22 R13x139-M, requires 107 codewords (maximum 106)", "" }, + /*340*/ { 2, 22, "\200", 104, 0, 13, 139, "", "" }, + /*341*/ { 2, 22, "\200", 105, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 22 R13x139-M, requires 107 codewords (maximum 106)", "" }, + /*342*/ { 2, 22, "\201", 128, 0, 13, 139, "", "64 Shift JIS 0x8181" }, + /*343*/ { 2, 22, "\201", 130, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 22 R13x139-M, requires 107 codewords (maximum 106)", "65 Shift JIS 0x8181" }, + /*344*/ { 4, 22, "1", 126, 0, 13, 139, "", "" }, + /*345*/ { 4, 22, "1", 127, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 22 R13x139-H, requires 55 codewords (maximum 54)", "" }, + /*346*/ { 4, 22, "A", 76, 0, 13, 139, "", "" }, + /*347*/ { 4, 22, "A", 77, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 22 R13x139-H, requires 55 codewords (maximum 54)", "" }, + /*348*/ { 4, 22, "\200", 52, 0, 13, 139, "", "" }, + /*349*/ { 4, 22, "\200", 53, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 22 R13x139-H, requires 55 codewords (maximum 54)", "" }, + /*350*/ { 4, 22, "\201", 64, 0, 13, 139, "", "32 Shift JIS 0x8181" }, + /*351*/ { 4, 22, "\201", 66, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 22 R13x139-H, requires 55 codewords (maximum 54)", "33 Shift JIS 0x8181" }, + /*352*/ { 2, 23, "1", 76, 0, 15, 43, "", "" }, + /*353*/ { 2, 23, "1", 77, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 23 R15x43-M, requires 34 codewords (maximum 33)", "" }, + /*354*/ { 2, 23, "A", 46, 0, 15, 43, "", "" }, + /*355*/ { 2, 23, "A", 47, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 23 R15x43-M, requires 34 codewords (maximum 33)", "" }, + /*356*/ { 2, 23, "\200", 31, 0, 15, 43, "", "" }, + /*357*/ { 2, 23, "\200", 32, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 23 R15x43-M, requires 34 codewords (maximum 33)", "" }, + /*358*/ { 2, 23, "\201", 38, 0, 15, 43, "", "19 Shift JIS 0x8181" }, + /*359*/ { 2, 23, "\201", 40, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 23 R15x43-M, requires 34 codewords (maximum 33)", "20 Shift JIS 0x8181" }, + /*360*/ { 4, 23, "1", 33, 0, 15, 43, "", "" }, + /*361*/ { 4, 23, "1", 34, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 23 R15x43-H, requires 16 codewords (maximum 15)", "" }, + /*362*/ { 4, 23, "A", 20, 0, 15, 43, "", "" }, + /*363*/ { 4, 23, "A", 21, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 23 R15x43-H, requires 16 codewords (maximum 15)", "" }, + /*364*/ { 4, 23, "\200", 13, 0, 15, 43, "", "" }, + /*365*/ { 4, 23, "\200", 14, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 23 R15x43-H, requires 16 codewords (maximum 15)", "" }, + /*366*/ { 4, 23, "\201", 16, 0, 15, 43, "", "8 Shift JIS 0x8181" }, + /*367*/ { 4, 23, "\201", 18, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 23 R15x43-H, requires 16 codewords (maximum 15)", "9 Shift JIS 0x8181" }, + /*368*/ { 2, 24, "1", 112, 0, 15, 59, "", "" }, + /*369*/ { 2, 24, "1", 113, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 24 R15x59-M, requires 49 codewords (maximum 48)", "" }, + /*370*/ { 2, 24, "A", 68, 0, 15, 59, "", "" }, + /*371*/ { 2, 24, "A", 69, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 24 R15x59-M, requires 49 codewords (maximum 48)", "" }, + /*372*/ { 2, 24, "\200", 46, 0, 15, 59, "", "" }, + /*373*/ { 2, 24, "\200", 47, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 24 R15x59-M, requires 49 codewords (maximum 48)", "" }, + /*374*/ { 2, 24, "\201", 56, 0, 15, 59, "", "28 Shift JIS 0x8181" }, + /*375*/ { 2, 24, "\201", 58, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 24 R15x59-M, requires 49 codewords (maximum 48)", "29 Shift JIS 0x8181" }, + /*376*/ { 4, 24, "1", 59, 0, 15, 59, "", "" }, + /*377*/ { 4, 24, "1", 60, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 24 R15x59-H, requires 27 codewords (maximum 26)", "" }, + /*378*/ { 4, 24, "A", 36, 0, 15, 59, "", "" }, + /*379*/ { 4, 24, "A", 37, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 24 R15x59-H, requires 27 codewords (maximum 26)", "" }, + /*380*/ { 4, 24, "\200", 24, 0, 15, 59, "", "" }, + /*381*/ { 4, 24, "\200", 25, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 24 R15x59-H, requires 27 codewords (maximum 26)", "" }, + /*382*/ { 4, 24, "\201", 30, 0, 15, 59, "", "30 Shift JIS 0x8181" }, + /*383*/ { 4, 24, "\201", 32, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 24 R15x59-H, requires 27 codewords (maximum 26)", "31 Shift JIS 0x8181" }, + /*384*/ { 2, 25, "1", 157, 0, 15, 77, "", "" }, + /*385*/ { 2, 25, "1", 158, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 25 R15x77-M, requires 68 codewords (maximum 67)", "" }, + /*386*/ { 2, 25, "A", 95, 0, 15, 77, "", "" }, + /*387*/ { 2, 25, "A", 96, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 25 R15x77-M, requires 68 codewords (maximum 67)", "" }, + /*388*/ { 2, 25, "\200", 65, 0, 15, 77, "", "" }, + /*389*/ { 2, 25, "\200", 66, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 25 R15x77-M, requires 68 codewords (maximum 67)", "" }, + /*390*/ { 2, 25, "\201", 80, 0, 15, 77, "", "40 Shift JIS 0x8181" }, + /*391*/ { 2, 25, "\201", 82, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 25 R15x77-M, requires 68 codewords (maximum 67)", "41 Shift JIS 0x8181" }, + /*392*/ { 4, 25, "1", 71, 0, 15, 77, "", "" }, + /*393*/ { 4, 25, "1", 72, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 25 R15x77-H, requires 32 codewords (maximum 31)", "" }, + /*394*/ { 4, 25, "A", 43, 0, 15, 77, "", "" }, + /*395*/ { 4, 25, "A", 44, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 25 R15x77-H, requires 32 codewords (maximum 31)", "" }, + /*396*/ { 4, 25, "\200", 29, 0, 15, 77, "", "" }, + /*397*/ { 4, 25, "\200", 30, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 25 R15x77-H, requires 32 codewords (maximum 31)", "" }, + /*398*/ { 4, 25, "\201", 36, 0, 15, 77, "", "18 Shift JIS 0x8181" }, + /*399*/ { 4, 25, "\201", 38, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 25 R15x77-H, requires 32 codewords (maximum 31)", "" }, + /*400*/ { 2, 26, "1", 207, 0, 15, 99, "", "" }, + /*401*/ { 2, 26, "1", 208, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 26 R15x99-M, requires 89 codewords (maximum 88)", "" }, + /*402*/ { 2, 26, "A", 126, 0, 15, 99, "", "" }, + /*403*/ { 2, 26, "A", 127, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 26 R15x99-M, requires 89 codewords (maximum 88)", "" }, + /*404*/ { 2, 26, "\200", 86, 0, 15, 99, "", "" }, + /*405*/ { 2, 26, "\200", 87, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 26 R15x99-M, requires 89 codewords (maximum 88)", "" }, + /*406*/ { 2, 26, "\201", 106, 0, 15, 99, "", "53 Shift JIS 0x8181" }, + /*407*/ { 2, 26, "\201", 108, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 26 R15x99-M, requires 89 codewords (maximum 88)", "54 Shift JIS 0x8181" }, + /*408*/ { 4, 26, "1", 111, 0, 15, 99, "", "" }, + /*409*/ { 4, 26, "1", 112, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 26 R15x99-H, requires 49 codewords (maximum 48)", "" }, + /*410*/ { 4, 26, "A", 68, 0, 15, 99, "", "" }, + /*411*/ { 4, 26, "A", 69, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 26 R15x99-H, requires 49 codewords (maximum 48)", "" }, + /*412*/ { 4, 26, "\200", 46, 0, 15, 99, "", "" }, + /*413*/ { 4, 26, "\200", 47, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 26 R15x99-H, requires 49 codewords (maximum 48)", "" }, + /*414*/ { 4, 26, "\201", 56, 0, 15, 99, "", "28 Shift JIS 0x8181" }, + /*415*/ { 4, 26, "\201", 58, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 26 R15x99-H, requires 49 codewords (maximum 48)", "29 Shift JIS 0x8181" }, + /*416*/ { 2, 27, "1", 301, 0, 15, 139, "", "" }, + /*417*/ { 2, 27, "1", 302, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 27 R15x139-M, requires 128 codewords (maximum 127)", "" }, + /*418*/ { 2, 27, "A", 182, 0, 15, 139, "", "" }, + /*419*/ { 2, 27, "A", 183, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 27 R15x139-M, requires 128 codewords (maximum 127)", "" }, + /*420*/ { 2, 27, "\200", 125, 0, 15, 139, "", "" }, + /*421*/ { 2, 27, "\200", 126, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 27 R15x139-M, requires 128 codewords (maximum 127)", "" }, + /*422*/ { 2, 27, "\201", 154, 0, 15, 139, "", "77 Shift JIS 0x8181" }, + /*423*/ { 2, 27, "\201", 156, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 27 R15x139-M, requires 128 codewords (maximum 127)", "78 Shift JIS 0x8181" }, + /*424*/ { 4, 27, "1", 162, 0, 15, 139, "", "" }, + /*425*/ { 4, 27, "1", 163, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 27 R15x139-H, requires 70 codewords (maximum 69)", "" }, + /*426*/ { 4, 27, "A", 98, 0, 15, 139, "", "" }, + /*427*/ { 4, 27, "A", 99, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 27 R15x139-H, requires 70 codewords (maximum 69)", "" }, + /*428*/ { 4, 27, "\200", 67, 0, 15, 139, "", "" }, + /*429*/ { 4, 27, "\200", 68, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 27 R15x139-H, requires 70 codewords (maximum 69)", "" }, + /*430*/ { 4, 27, "\201", 82, 0, 15, 139, "", "41 Shift JIS 0x8181" }, + /*431*/ { 4, 27, "\201", 84, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 27 R15x139-H, requires 70 codewords (maximum 69)", "42 Shift JIS 0x8181" }, + /*432*/ { 2, 28, "1", 90, 0, 17, 43, "", "" }, + /*433*/ { 2, 28, "1", 91, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 28 R17x43-M, requires 40 codewords (maximum 39)", "" }, + /*434*/ { 2, 28, "A", 55, 0, 17, 43, "", "" }, + /*435*/ { 2, 28, "A", 56, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 28 R17x43-M, requires 40 codewords (maximum 39)", "" }, + /*436*/ { 2, 28, "\200", 37, 0, 17, 43, "", "" }, + /*437*/ { 2, 28, "\200", 38, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 28 R17x43-M, requires 40 codewords (maximum 39)", "" }, + /*438*/ { 2, 28, "\201", 46, 0, 17, 43, "", "23 Shift JIS 0x8181" }, + /*439*/ { 2, 28, "\201", 48, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 28 R17x43-M, requires 40 codewords (maximum 39)", "24 Shift JIS 0x8181" }, + /*440*/ { 4, 28, "1", 47, 0, 17, 43, "", "" }, + /*441*/ { 4, 28, "1", 48, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 28 R17x43-H, requires 22 codewords (maximum 21)", "" }, + /*442*/ { 4, 28, "A", 28, 0, 17, 43, "", "" }, + /*443*/ { 4, 28, "A", 29, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 28 R17x43-H, requires 22 codewords (maximum 21)", "" }, + /*444*/ { 4, 28, "\200", 19, 0, 17, 43, "", "" }, + /*445*/ { 4, 28, "\200", 20, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 28 R17x43-H, requires 22 codewords (maximum 21)", "" }, + /*446*/ { 4, 28, "\201", 24, 0, 17, 43, "", "12 Shift JIS 0x8181" }, + /*447*/ { 4, 28, "\201", 26, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 28 R17x43-H, requires 23 codewords (maximum 21)", "13 Shift JIS 0x8181" }, + /*448*/ { 2, 29, "1", 131, 0, 17, 59, "", "" }, + /*449*/ { 2, 29, "1", 132, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 29 R17x59-M, requires 57 codewords (maximum 56)", "" }, + /*450*/ { 2, 29, "A", 79, 0, 17, 59, "", "" }, + /*451*/ { 2, 29, "A", 80, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 29 R17x59-M, requires 57 codewords (maximum 56)", "" }, + /*452*/ { 2, 29, "\200", 54, 0, 17, 59, "", "" }, + /*453*/ { 2, 29, "\200", 55, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 29 R17x59-M, requires 57 codewords (maximum 56)", "" }, + /*454*/ { 2, 29, "\201", 66, 0, 17, 59, "", "33 Shift JIS 0x8181" }, + /*455*/ { 2, 29, "\201", 68, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 29 R17x59-M, requires 57 codewords (maximum 56)", "34 Shift JIS 0x8181" }, + /*456*/ { 4, 29, "1", 63, 0, 17, 59, "", "" }, + /*457*/ { 4, 29, "1", 64, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 29 R17x59-H, requires 29 codewords (maximum 28)", "" }, + /*458*/ { 4, 29, "A", 38, 0, 17, 59, "", "" }, + /*459*/ { 4, 29, "A", 39, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 29 R17x59-H, requires 29 codewords (maximum 28)", "" }, + /*460*/ { 4, 29, "\200", 26, 0, 17, 59, "", "" }, + /*461*/ { 4, 29, "\200", 27, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 29 R17x59-H, requires 29 codewords (maximum 28)", "" }, + /*462*/ { 4, 29, "\201", 32, 0, 17, 59, "", "16 Shift JIS 0x8181" }, + /*463*/ { 4, 29, "\201", 34, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 29 R17x59-H, requires 29 codewords (maximum 28)", "17 Shift JIS 0x8181" }, + /*464*/ { 2, 30, "1", 183, 0, 17, 77, "", "" }, + /*465*/ { 2, 30, "1", 184, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 30 R17x77-M, requires 79 codewords (maximum 78)", "" }, + /*466*/ { 2, 30, "A", 111, 0, 17, 77, "", "" }, + /*467*/ { 2, 30, "A", 112, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 30 R17x77-M, requires 79 codewords (maximum 78)", "" }, + /*468*/ { 2, 30, "\200", 76, 0, 17, 77, "", "" }, + /*469*/ { 2, 30, "\200", 77, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 30 R17x77-M, requires 79 codewords (maximum 78)", "" }, + /*470*/ { 2, 30, "\201", 94, 0, 17, 77, "", "47 Shift JIS 0x8181" }, + /*471*/ { 2, 30, "\201", 96, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 30 R17x77-M, requires 80 codewords (maximum 78)", "48 Shift JIS 0x8181" }, + /*472*/ { 4, 30, "1", 87, 0, 17, 77, "", "" }, + /*473*/ { 4, 30, "1", 88, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 30 R17x77-H, requires 39 codewords (maximum 38)", "" }, + /*474*/ { 4, 30, "A", 53, 0, 17, 77, "", "" }, + /*475*/ { 4, 30, "A", 54, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 30 R17x77-H, requires 39 codewords (maximum 38)", "" }, + /*476*/ { 4, 30, "\200", 36, 0, 17, 77, "", "" }, + /*477*/ { 4, 30, "\200", 37, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 30 R17x77-H, requires 39 codewords (maximum 38)", "" }, + /*478*/ { 4, 30, "\201", 44, 0, 17, 77, "", "22 Shift JIS 0x8181" }, + /*479*/ { 4, 30, "\201", 46, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 30 R17x77-H, requires 39 codewords (maximum 38)", "23 Shift JIS 0x8181" }, + /*480*/ { 2, 31, "1", 236, 0, 17, 99, "", "" }, + /*481*/ { 2, 31, "1", 237, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 31 R17x99-M, requires 101 codewords (maximum 100)", "" }, + /*482*/ { 2, 31, "A", 143, 0, 17, 99, "", "" }, + /*483*/ { 2, 31, "A", 144, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 31 R17x99-M, requires 101 codewords (maximum 100)", "" }, + /*484*/ { 2, 31, "\200", 98, 0, 17, 99, "", "" }, + /*485*/ { 2, 31, "\200", 99, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 31 R17x99-M, requires 101 codewords (maximum 100)", "" }, + /*486*/ { 2, 31, "\201", 120, 0, 17, 99, "", "60 Shift JIS 0x8181" }, + /*487*/ { 2, 31, "\201", 122, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 31 R17x99-M, requires 101 codewords (maximum 100)", "61 Shift JIS 0x8181" }, + /*488*/ { 4, 31, "1", 131, 0, 17, 99, "", "" }, + /*489*/ { 4, 31, "1", 132, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 31 R17x99-H, requires 57 codewords (maximum 56)", "" }, + /*490*/ { 4, 31, "A", 79, 0, 17, 99, "", "" }, + /*491*/ { 4, 31, "A", 80, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 31 R17x99-H, requires 57 codewords (maximum 56)", "" }, + /*492*/ { 4, 31, "\200", 54, 0, 17, 99, "", "" }, + /*493*/ { 4, 31, "\200", 55, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 31 R17x99-H, requires 57 codewords (maximum 56)", "" }, + /*494*/ { 4, 31, "\201", 66, 0, 17, 99, "", "33 Shift JIS 0x8181" }, + /*495*/ { 4, 31, "\201", 68, ZINT_ERROR_TOO_LONG, 0, 0, "Error 560: Input too long for Version 31 R17x99-H, requires 57 codewords (maximum 56)", "34 Shift JIS 0x8181" }, + /*496*/ { 2, 32, "1", 361, 0, 17, 139, "", "" }, + /*497*/ { 2, 32, "1", 362, ZINT_ERROR_TOO_LONG, 0, 0, "Error 578: Input too long for ECC level M, requires 153 codewords (maximum 152)", "" }, + /*498*/ { 2, 32, "A", 219, 0, 17, 139, "", "" }, + /*499*/ { 2, 32, "A", 220, ZINT_ERROR_TOO_LONG, 0, 0, "Error 578: Input too long for ECC level M, requires 153 codewords (maximum 152)", "" }, + /*500*/ { 2, 32, "\200", 150, 0, 17, 139, "", "" }, + /*501*/ { 2, 32, "\200", 151, ZINT_ERROR_TOO_LONG, 0, 0, "Error 578: Input too long for ECC level M, requires 153 codewords (maximum 152)", "" }, + /*502*/ { 2, 32, "\201", 184, 0, 17, 139, "", "92 Shift JIS 0x8181" }, + /*503*/ { 2, 32, "\201", 186, ZINT_ERROR_TOO_LONG, 0, 0, "Error 578: Input too long for ECC level M, requires 153 codewords (maximum 152)", "93 Shift JIS 0x8181" }, + /*504*/ { 4, 32, "1", 178, 0, 17, 139, "", "" }, + /*505*/ { 4, 32, "1", 179, ZINT_ERROR_TOO_LONG, 0, 0, "Error 578: Input too long for ECC level H, requires 77 codewords (maximum 76)", "" }, + /*506*/ { 4, 32, "A", 108, 0, 17, 139, "", "" }, + /*507*/ { 4, 32, "A", 109, ZINT_ERROR_TOO_LONG, 0, 0, "Error 578: Input too long for ECC level H, requires 77 codewords (maximum 76)", "" }, + /*508*/ { 4, 32, "\200", 74, 0, 17, 139, "", "" }, + /*509*/ { 4, 32, "\200", 75, ZINT_ERROR_TOO_LONG, 0, 0, "Error 578: Input too long for ECC level H, requires 77 codewords (maximum 76)", "" }, + /*510*/ { 4, 32, "\201", 92, 0, 17, 139, "", "46 Shift JIS 0x8181" }, + /*511*/ { 4, 32, "\201", 94, ZINT_ERROR_TOO_LONG, 0, 0, "Error 578: Input too long for ECC level H, requires 78 codewords (maximum 76)", "47 Shift JIS 0x8181" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -7673,30 +7698,39 @@ static void test_rmqr_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); - 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->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); - } + if (p_ctx->generate) { + printf(" /*%3d*/ { %d, %d, \"%s\", %d, %s, %d, %d, \"%s\", \"%s\" },\n", + i, data[i].option_1, data[i].option_2, + testUtilEscape(data[i].pattern, (int) strlen(data[i].pattern), escaped, sizeof(escaped)), data[i].length, + testUtilErrorName(data[i].ret), symbol->rows, symbol->width, symbol->errtxt, data[i].comment); + } else { + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d errtxt %s != %s\n", i, symbol->errtxt, data[i].expected_errtxt); + 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->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); + } - symbol->input_mode |= FAST_MODE; - ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); - assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + symbol->input_mode |= FAST_MODE; + ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); - 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->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); + 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->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); - if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data_buf, length, debug)) { - int cmp_len, ret_len; - char modules_dump[17 * 139 + 1]; - assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); - ret = testUtilZXingCPP(i, symbol, data_buf, 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); + if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data_buf, length, debug)) { + int cmp_len, ret_len; + char modules_dump[17 * 139 + 1]; + assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1, "i:%d testUtilModulesDump == -1\n", i); + ret = testUtilZXingCPP(i, symbol, data_buf, 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_buf, 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); + ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data_buf, 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); + } } } @@ -7719,83 +7753,86 @@ static void test_rmqr_options(const testCtx *const p_ctx) { int ret_vector; int expected_rows; int expected_width; + char *expected_errtxt; int zxingcpp_cmp; char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { UNICODE_MODE, -1, -1, -1, "12345", 0, 0, 11, 27, 1, "" }, /* ECC auto-set to H, version auto-set to 11 (R11x27) */ - /* 1*/ { UNICODE_MODE, -1, 4, 11, "12345", 0, 0, 11, 27, 1, "" }, - /* 2*/ { UNICODE_MODE, -1, 1, -1, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, 1, "" }, /* ECC L not available */ - /* 3*/ { UNICODE_MODE, -1, 3, -1, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, 1, "" }, /* ECC Q not available */ - /* 4*/ { UNICODE_MODE, -1, 4, 11, "123456789", 0, 0, 11, 27, 1, "" }, /* Max capacity ECC H, version 11, 9 numbers */ - /* 5*/ { UNICODE_MODE, -1, 4, 11, "1234567890", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 6*/ { UNICODE_MODE, -1, 2, 11, "12345678901234", 0, 0, 11, 27, 1, "" }, /* Max capacity ECC M, version 11, 14 numbers */ - /* 7*/ { UNICODE_MODE, -1, 2, 11, "123456789012345", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 8*/ { UNICODE_MODE, -1, 4, 11, "ABCDEF", 0, 0, 11, 27, 1, "" }, /* Max capacity ECC H, version 11, 6 letters */ - /* 9*/ { UNICODE_MODE, -1, 4, 11, "ABCDEFG", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 10*/ { UNICODE_MODE, -1, 2, 11, "ABCDEFGH", 0, 0, 11, 27, 1, "" }, /* Max capacity ECC M, version 11, 8 letters */ - /* 11*/ { UNICODE_MODE, -1, 2, 11, "ABCDEFGHI", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 12*/ { UNICODE_MODE, -1, 4, 11, "\177\177\177\177", 0, 0, 11, 27, 1, "" }, /* Max capacity ECC H, version 11, 4 bytes */ - /* 13*/ { UNICODE_MODE, -1, 4, 11, "\177\177\177\177\177", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 14*/ { UNICODE_MODE, -1, 2, 11, "\177\177\177\177\177\177", 0, 0, 11, 27, 1, "" }, /* Max capacity ECC M, version 11, 6 bytes */ - /* 15*/ { UNICODE_MODE, -1, 2, 11, "\177\177\177\177\177\177\177", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 16*/ { UNICODE_MODE, -1, 4, 11, "点茗", ZINT_WARN_NONCOMPLIANT, 0, 11, 27, 1, "" }, /* Max capacity ECC H, version 11, 2 kanji */ - /* 17*/ { UNICODE_MODE, -1, 4, 11, "点茗点", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 18*/ { UNICODE_MODE, -1, 2, 11, "点茗点", ZINT_WARN_NONCOMPLIANT, 0, 11, 27, 1, "" }, /* Max capacity ECC M, version 11, 3 kanji */ - /* 19*/ { UNICODE_MODE, -1, 2, 11, "点茗点茗", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 20*/ { UNICODE_MODE, -1, -1, 1, "12345", 0, 0, 7, 43, 1, "" }, /* ECC auto-set to M, version 1 (R7x43) */ - /* 21*/ { UNICODE_MODE, -1, 2, 1, "12345", 0, 0, 7, 43, 1, "" }, - /* 22*/ { UNICODE_MODE, -1, 4, 1, "12345", 0, 0, 7, 43, 1, "" }, /* Max capacity ECC H, version 1, 5 numbers */ - /* 23*/ { UNICODE_MODE, -1, 4, 1, "123456", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 24*/ { UNICODE_MODE, -1, 2, 1, "123456789012", 0, 0, 7, 43, 1, "" }, /* Max capacity ECC M, version 1, 12 numbers */ - /* 25*/ { UNICODE_MODE, -1, 2, 1, "1234567890123", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 26*/ { UNICODE_MODE, -1, 4, 1, "ABC", 0, 0, 7, 43, 1, "" }, /* Max capacity ECC H, version 1, 3 letters */ - /* 27*/ { UNICODE_MODE, -1, 4, 1, "ABCD", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 28*/ { UNICODE_MODE, -1, 2, 1, "ABCDEFG", 0, 0, 7, 43, 1, "" }, /* Max capacity ECC M, version 1, 7 letters */ - /* 29*/ { UNICODE_MODE, -1, 2, 1, "ABCDEFGH", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 30*/ { UNICODE_MODE, -1, 4, 1, "\177\177", 0, 0, 7, 43, 1, "" }, /* Max capacity ECC H, version 1, 2 bytes */ - /* 31*/ { UNICODE_MODE, -1, 4, 1, "\177\177\177", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 32*/ { UNICODE_MODE, -1, 2, 1, "\177\177\177\177\177", 0, 0, 7, 43, 1, "" }, /* Max capacity ECC M, version 1, 5 bytes */ - /* 33*/ { UNICODE_MODE, -1, 2, 1, "\177\177\177\177\177\177", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 34*/ { UNICODE_MODE, -1, 4, 1, "点", ZINT_WARN_NONCOMPLIANT, 0, 7, 43, 1, "" }, /* Max capacity ECC H, version 1, 1 kanji */ - /* 35*/ { UNICODE_MODE, -1, 4, 1, "点茗", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 36*/ { UNICODE_MODE, -1, 2, 1, "点茗点", ZINT_WARN_NONCOMPLIANT, 0, 7, 43, 1, "" }, /* Max capacity ECC M, version 1, 3 kanji */ - /* 37*/ { UNICODE_MODE, -1, 2, 1, "点茗点茗", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 38*/ { UNICODE_MODE, -1, 4, 7, "12345678901234567890123", 0, 0, 9, 59, 1, "" }, /* Max capacity ECC H, version 7 (R9x59), 23 numbers */ - /* 39*/ { UNICODE_MODE, -1, 4, 7, "123456789012345678901234", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 40*/ { UNICODE_MODE, -1, 4, 7, "点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 9, 59, 1, "" }, /* Max capacity ECC H, version 7, 6 kanji */ - /* 41*/ { UNICODE_MODE, -1, 4, 7, "点茗点茗点茗点", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 42*/ { UNICODE_MODE, -1, 4, 13, "点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 11, 59, 1, "" }, /* Max capacity ECC H, version 13 (R11x59), 8 kanji */ - /* 43*/ { UNICODE_MODE, -1, 4, 13, "点茗点茗点茗点茗点", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 44*/ { UNICODE_MODE, -1, 4, 20, "点茗点茗点茗点茗点茗点茗点茗点茗点", ZINT_WARN_NONCOMPLIANT, 0, 13, 77, 1, "" }, /* Max capacity ECC H, version 20 (R13x77), 17 kanji */ - /* 45*/ { UNICODE_MODE, -1, 4, 20, "点茗点茗点茗点茗点茗点茗点茗点茗点茗", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 46*/ { UNICODE_MODE, -1, 4, 26, "点茗点茗点茗点茗点茗点茗点茗点茗点点茗点茗点茗点点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 15, 99, 1, "" }, /* Max capacity ECC H, version 26 (R15x99), 28 kanji */ - /* 47*/ { UNICODE_MODE, -1, 4, 26, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 48*/ { UNICODE_MODE, -1, 4, 32, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 17, 139, 1, "" }, /* Max capacity ECC H, version 32 (R17x139), 46 kanji */ - /* 49*/ { UNICODE_MODE, -1, 4, 32, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 50*/ { UNICODE_MODE, -1, -1, 32, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 17, 139, 1, "" }, /* Max capacity ECC M, version 32, 92 kanji */ - /* 51*/ { UNICODE_MODE, -1, 4, 32, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点", ZINT_ERROR_TOO_LONG, -1, 0, 0, 1, "" }, - /* 52*/ { UNICODE_MODE, -1, -1, 33, "点茗点", ZINT_WARN_NONCOMPLIANT, 0, 7, 43, 1, "" }, /* ECC auto-set to M, version 33 (R7xAuto-width) auto-sets R7x43 */ - /* 53*/ { UNICODE_MODE, -1, 4, 33, "点茗点", ZINT_WARN_NONCOMPLIANT, 0, 7, 59, 1, "" }, /* ECC set to H, version 33 (R7xAuto-width) auto-sets R7x59 */ - /* 54*/ { UNICODE_MODE, -1, -1, 34, "点茗点", ZINT_WARN_NONCOMPLIANT, 0, 9, 43, 1, "" }, /* ECC auto-set to H, version 34 (R9xAuto-width) auto-sets R9x43 */ - /* 55*/ { UNICODE_MODE, -1, -1, 35, "点茗点", ZINT_WARN_NONCOMPLIANT, 0, 11, 27, 1, "" }, /* ECC auto-set to M, version 35 (R11xAuto-width) auto-sets R11x27 */ - /* 56*/ { UNICODE_MODE, -1, 4, 35, "点茗点茗点茗点", ZINT_WARN_NONCOMPLIANT, 0, 11, 59, 1, "" }, /* ECC set to H, version 35 (R11xAuto-width) auto-sets R11x59 */ - /* 57*/ { UNICODE_MODE, -1, -1, 35, "点茗点茗点茗点", ZINT_WARN_NONCOMPLIANT, 0, 11, 43, 1, "" }, /* ECC auto-set to M, version 35 (R11xAuto-width) auto-sets R11x43 */ - /* 58*/ { UNICODE_MODE, -1, -1, 36, "点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 13, 43, 1, "" }, /* ECC auto-set to M, version 36 (R13xAuto-width) auto-sets R13x43 */ - /* 59*/ { UNICODE_MODE, -1, 4, 36, "点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 13, 59, 1, "" }, /* ECC set to H, version 36 (R13xAuto-width) auto-sets R13x59 */ - /* 60*/ { UNICODE_MODE, -1, -1, 37, "点茗点茗点茗点茗点", ZINT_WARN_NONCOMPLIANT, 0, 15, 43, 1, "" }, /* ECC auto-set to M, version 37 (R15xAuto-width) auto-sets R15x43 */ - /* 61*/ { UNICODE_MODE, -1, 4, 37, "点茗点茗点茗点茗点", ZINT_WARN_NONCOMPLIANT, 0, 15, 59, 1, "" }, /* ECC set to H, version 37 (R15xAuto-width) auto-sets R15x59 */ - /* 62*/ { UNICODE_MODE, -1, -1, 38, "点茗点茗点茗点茗点茗点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 17, 43, 1, "" }, /* ECC auto-set to M, version 38 (R17xAuto-width) auto-sets R17x43 */ - /* 63*/ { UNICODE_MODE, -1, 4, 38, "点茗点茗点茗点茗点茗点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 17, 77, 1, "" }, /* ECC set to H, version 38 (R17xAuto-width) auto-sets R17x77 */ - /* 64*/ { UNICODE_MODE, -1, -1, 39, "点茗点", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, 1, "" }, - /* 65*/ { UNICODE_MODE, -1, 4, -1, "点茗点", ZINT_WARN_NONCOMPLIANT, 0, 13, 27, 1, "" }, /* ECC set to H, auto-sets R13x27 */ - /* 66*/ { UNICODE_MODE, -1, 4, -1, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 15, 99, 1, "" }, /* ECC set to H, auto-sets R15x99 (max capacity) */ - /* 67*/ { UNICODE_MODE, -1, 4, -1, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点", ZINT_WARN_NONCOMPLIANT, 0, 17, 99, 1, "" }, /* ECC set to H, auto-sets R17x99 */ - /* 68*/ { UNICODE_MODE, -1, 4, -1, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 17, 139, 1, "" }, /* ECC set to H, auto-sets R17x139 (max capacity) */ - /* 69*/ { GS1_MODE, 3, -1, -1, "[20]12", ZINT_WARN_NONCOMPLIANT, 0, 11, 27, 1, "" }, + static const struct item data[] = { + /* 0*/ { UNICODE_MODE, -1, -1, -1, "12345", 0, 0, 11, 27, "", 1, "" }, /* ECC auto-set to H, version auto-set to 11 (R11x27) */ + /* 1*/ { UNICODE_MODE, -1, 4, 11, "12345", 0, 0, 11, 27, "", 1, "" }, + /* 2*/ { UNICODE_MODE, -1, 1, -1, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 576: Error correction level L not available in rMQR", 1, "" }, /* ECC L not available */ + /* 3*/ { UNICODE_MODE, -1, 3, -1, "12345", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 577: Error correction level Q not available in rMQR", 1, "" }, /* ECC Q not available */ + /* 4*/ { UNICODE_MODE, -1, 4, 11, "123456789", 0, 0, 11, 27, "", 1, "" }, /* Max capacity ECC H, version 11, 9 numbers */ + /* 5*/ { UNICODE_MODE, -1, 4, 11, "1234567890", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 11 R11x27-H, requires 6 codewords (maximum 5)", 1, "" }, + /* 6*/ { UNICODE_MODE, -1, 2, 11, "12345678901234", 0, 0, 11, 27, "", 1, "" }, /* Max capacity ECC M, version 11, 14 numbers */ + /* 7*/ { UNICODE_MODE, -1, 2, 11, "123456789012345", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 11 R11x27-M, requires 8 codewords (maximum 7)", 1, "" }, + /* 8*/ { UNICODE_MODE, -1, 4, 11, "ABCDEF", 0, 0, 11, 27, "", 1, "" }, /* Max capacity ECC H, version 11, 6 letters */ + /* 9*/ { UNICODE_MODE, -1, 4, 11, "ABCDEFG", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 11 R11x27-H, requires 6 codewords (maximum 5)", 1, "" }, + /* 10*/ { UNICODE_MODE, -1, 2, 11, "ABCDEFGH", 0, 0, 11, 27, "", 1, "" }, /* Max capacity ECC M, version 11, 8 letters */ + /* 11*/ { UNICODE_MODE, -1, 2, 11, "ABCDEFGHI", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 11 R11x27-M, requires 8 codewords (maximum 7)", 1, "" }, + /* 12*/ { UNICODE_MODE, -1, 4, 11, "\177\177\177\177", 0, 0, 11, 27, "", 1, "" }, /* Max capacity ECC H, version 11, 4 bytes */ + /* 13*/ { UNICODE_MODE, -1, 4, 11, "\177\177\177\177\177", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 11 R11x27-H, requires 6 codewords (maximum 5)", 1, "" }, + /* 14*/ { UNICODE_MODE, -1, 2, 11, "\177\177\177\177\177\177", 0, 0, 11, 27, "", 1, "" }, /* Max capacity ECC M, version 11, 6 bytes */ + /* 15*/ { UNICODE_MODE, -1, 2, 11, "\177\177\177\177\177\177\177", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 11 R11x27-M, requires 8 codewords (maximum 7)", 1, "" }, + /* 16*/ { UNICODE_MODE, -1, 4, 11, "点茗", ZINT_WARN_NONCOMPLIANT, 0, 11, 27, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* Max capacity ECC H, version 11, 2 kanji */ + /* 17*/ { UNICODE_MODE, -1, 4, 11, "点茗点", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 11 R11x27-H, requires 6 codewords (maximum 5)", 1, "" }, + /* 18*/ { UNICODE_MODE, -1, 2, 11, "点茗点", ZINT_WARN_NONCOMPLIANT, 0, 11, 27, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* Max capacity ECC M, version 11, 3 kanji */ + /* 19*/ { UNICODE_MODE, -1, 2, 11, "点茗点茗", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 11 R11x27-M, requires 8 codewords (maximum 7)", 1, "" }, + /* 20*/ { UNICODE_MODE, -1, -1, 1, "12345", 0, 0, 7, 43, "", 1, "" }, /* ECC auto-set to M, version 1 (R7x43) */ + /* 21*/ { UNICODE_MODE, -1, 2, 1, "12345", 0, 0, 7, 43, "", 1, "" }, + /* 22*/ { UNICODE_MODE, -1, 4, 1, "12345", 0, 0, 7, 43, "", 1, "" }, /* Max capacity ECC H, version 1, 5 numbers */ + /* 23*/ { UNICODE_MODE, -1, 4, 1, "123456", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 1 R7x43-H, requires 4 codewords (maximum 3)", 1, "" }, + /* 24*/ { UNICODE_MODE, -1, 2, 1, "123456789012", 0, 0, 7, 43, "", 1, "" }, /* Max capacity ECC M, version 1, 12 numbers */ + /* 25*/ { UNICODE_MODE, -1, 2, 1, "1234567890123", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 1 R7x43-M, requires 7 codewords (maximum 6)", 1, "" }, + /* 26*/ { UNICODE_MODE, -1, 4, 1, "ABC", 0, 0, 7, 43, "", 1, "" }, /* Max capacity ECC H, version 1, 3 letters */ + /* 27*/ { UNICODE_MODE, -1, 4, 1, "ABCD", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 1 R7x43-H, requires 4 codewords (maximum 3)", 1, "" }, + /* 28*/ { UNICODE_MODE, -1, 2, 1, "ABCDEFG", 0, 0, 7, 43, "", 1, "" }, /* Max capacity ECC M, version 1, 7 letters */ + /* 29*/ { UNICODE_MODE, -1, 2, 1, "ABCDEFGH", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 1 R7x43-M, requires 7 codewords (maximum 6)", 1, "" }, + /* 30*/ { UNICODE_MODE, -1, 4, 1, "\177\177", 0, 0, 7, 43, "", 1, "" }, /* Max capacity ECC H, version 1, 2 bytes */ + /* 31*/ { UNICODE_MODE, -1, 4, 1, "\177\177\177", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 1 R7x43-H, requires 4 codewords (maximum 3)", 1, "" }, + /* 32*/ { UNICODE_MODE, -1, 2, 1, "\177\177\177\177\177", 0, 0, 7, 43, "", 1, "" }, /* Max capacity ECC M, version 1, 5 bytes */ + /* 33*/ { UNICODE_MODE, -1, 2, 1, "\177\177\177\177\177\177", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 1 R7x43-M, requires 7 codewords (maximum 6)", 1, "" }, + /* 34*/ { UNICODE_MODE, -1, 4, 1, "点", ZINT_WARN_NONCOMPLIANT, 0, 7, 43, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* Max capacity ECC H, version 1, 1 kanji */ + /* 35*/ { UNICODE_MODE, -1, 4, 1, "点茗", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 1 R7x43-H, requires 4 codewords (maximum 3)", 1, "" }, + /* 36*/ { UNICODE_MODE, -1, 2, 1, "点茗点", ZINT_WARN_NONCOMPLIANT, 0, 7, 43, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* Max capacity ECC M, version 1, 3 kanji */ + /* 37*/ { UNICODE_MODE, -1, 2, 1, "点茗点茗", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 1 R7x43-M, requires 8 codewords (maximum 6)", 1, "" }, + /* 38*/ { UNICODE_MODE, -1, 4, 7, "12345678901234567890123", 0, 0, 9, 59, "", 1, "" }, /* Max capacity ECC H, version 7 (R9x59), 23 numbers */ + /* 39*/ { UNICODE_MODE, -1, 4, 7, "123456789012345678901234", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 7 R9x59-H, requires 12 codewords (maximum 11)", 1, "" }, + /* 40*/ { UNICODE_MODE, -1, 4, 7, "点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 9, 59, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* Max capacity ECC H, version 7, 6 kanji */ + /* 41*/ { UNICODE_MODE, -1, 4, 7, "点茗点茗点茗点", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 7 R9x59-H, requires 13 codewords (maximum 11)", 1, "" }, + /* 42*/ { UNICODE_MODE, -1, 4, 13, "点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 11, 59, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* Max capacity ECC H, version 13 (R11x59), 8 kanji */ + /* 43*/ { UNICODE_MODE, -1, 4, 13, "点茗点茗点茗点茗点", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 13 R11x59-H, requires 16 codewords (maximum 15)", 1, "" }, + /* 44*/ { UNICODE_MODE, -1, 4, 20, "点茗点茗点茗点茗点茗点茗点茗点茗点", ZINT_WARN_NONCOMPLIANT, 0, 13, 77, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* Max capacity ECC H, version 20 (R13x77), 17 kanji */ + /* 45*/ { UNICODE_MODE, -1, 4, 20, "点茗点茗点茗点茗点茗点茗点茗点茗点茗", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 20 R13x77-H, requires 31 codewords (maximum 29)", 1, "" }, + /* 46*/ { UNICODE_MODE, -1, 4, 26, "点茗点茗点茗点茗点茗点茗点茗点茗点点茗点茗点茗点点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 15, 99, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* Max capacity ECC H, version 26 (R15x99), 28 kanji */ + /* 47*/ { UNICODE_MODE, -1, 4, 26, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 26 R15x99-H, requires 49 codewords (maximum 48)", 1, "" }, + /* 48*/ { UNICODE_MODE, -1, 4, 32, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 17, 139, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* Max capacity ECC H, version 32 (R17x139), 46 kanji */ + /* 49*/ { UNICODE_MODE, -1, 4, 32, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 578: Input too long for ECC level H, requires 78 codewords (maximum 76)", 1, "" }, + /* 50*/ { UNICODE_MODE, -1, -1, 32, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 17, 139, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* Max capacity ECC M, version 32, 92 kanji */ + /* 51*/ { UNICODE_MODE, -1, 4, 32, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 578: Input too long for ECC level H, requires 153 codewords (maximum 76)", 1, "" }, + /* 52*/ { UNICODE_MODE, -1, -1, 33, "点茗点", ZINT_WARN_NONCOMPLIANT, 0, 7, 43, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC auto-set to M, version 33 (R7xAuto-width) auto-sets R7x43 */ + /* 53*/ { UNICODE_MODE, -1, 4, 33, "点茗点", ZINT_WARN_NONCOMPLIANT, 0, 7, 59, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC set to H, version 33 (R7xAuto-width) auto-sets R7x59 */ + /* 54*/ { UNICODE_MODE, -1, 4, 33, "点茗点茗点茗点点茗点茗点茗点点", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 33 R7xW-H, requires 26 codewords (maximum 24)", 1, "" }, + /* 55*/ { UNICODE_MODE, -1, -1, 34, "点茗点", ZINT_WARN_NONCOMPLIANT, 0, 9, 43, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC auto-set to H, version 34 (R9xAuto-width) auto-sets R9x43 */ + /* 56*/ { UNICODE_MODE, -1, -1, 35, "点茗点", ZINT_WARN_NONCOMPLIANT, 0, 11, 27, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC auto-set to M, version 35 (R11xAuto-width) auto-sets R11x27 */ + /* 57*/ { UNICODE_MODE, -1, 4, 35, "点茗点茗点茗点", ZINT_WARN_NONCOMPLIANT, 0, 11, 59, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC set to H, version 35 (R11xAuto-width) auto-sets R11x59 */ + /* 58*/ { UNICODE_MODE, -1, -1, 35, "点茗点茗点茗点", ZINT_WARN_NONCOMPLIANT, 0, 11, 43, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC auto-set to M, version 35 (R11xAuto-width) auto-sets R11x43 */ + /* 59*/ { UNICODE_MODE, -1, -1, 36, "点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 13, 43, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC auto-set to M, version 36 (R13xAuto-width) auto-sets R13x43 */ + /* 60*/ { UNICODE_MODE, -1, 4, 36, "点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 13, 59, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC set to H, version 36 (R13xAuto-width) auto-sets R13x59 */ + /* 61*/ { UNICODE_MODE, -1, -1, 37, "点茗点茗点茗点茗点", ZINT_WARN_NONCOMPLIANT, 0, 15, 43, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC auto-set to M, version 37 (R15xAuto-width) auto-sets R15x43 */ + /* 62*/ { UNICODE_MODE, -1, 4, 37, "点茗点茗点茗点茗点", ZINT_WARN_NONCOMPLIANT, 0, 15, 59, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC set to H, version 37 (R15xAuto-width) auto-sets R15x59 */ + /* 63*/ { UNICODE_MODE, -1, 4, 37, "点茗点茗点茗点茗点点茗点茗点茗点茗点点茗点茗点茗点茗点点茗点茗点茗点茗点点茗点茗点茗", ZINT_ERROR_TOO_LONG, -1, 0, 0, "Error 560: Input too long for Version 37 R15xW-H, requires 70 codewords (maximum 69)", 1, "" }, + /* 64*/ { UNICODE_MODE, -1, -1, 38, "点茗点茗点茗点茗点茗点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 17, 43, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC auto-set to M, version 38 (R17xAuto-width) auto-sets R17x43 */ + /* 65*/ { UNICODE_MODE, -1, 4, 38, "点茗点茗点茗点茗点茗点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 17, 77, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC set to H, version 38 (R17xAuto-width) auto-sets R17x77 */ + /* 66*/ { UNICODE_MODE, -1, -1, 39, "点茗点", ZINT_ERROR_INVALID_OPTION, -1, 0, 0, "Error 579: Version '39' out of range (1 to 38)", 1, "" }, + /* 67*/ { UNICODE_MODE, -1, 4, -1, "点茗点", ZINT_WARN_NONCOMPLIANT, 0, 13, 27, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC set to H, auto-sets R13x27 */ + /* 68*/ { UNICODE_MODE, -1, 4, -1, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 15, 99, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC set to H, auto-sets R15x99 (max capacity) */ + /* 69*/ { UNICODE_MODE, -1, 4, -1, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点", ZINT_WARN_NONCOMPLIANT, 0, 17, 99, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC set to H, auto-sets R17x99 */ + /* 70*/ { UNICODE_MODE, -1, 4, -1, "点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗点茗", ZINT_WARN_NONCOMPLIANT, 0, 17, 139, "Warning 760: Converted to Shift JIS but no ECI specified", 1, "" }, /* ECC set to H, auto-sets R17x139 (max capacity) */ + /* 71*/ { GS1_MODE, 3, -1, -1, "[20]12", ZINT_WARN_NONCOMPLIANT, 0, 11, 27, "Warning 757: Using ECI in GS1 mode not supported by GS1 standards", 1, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -7818,6 +7855,8 @@ static void test_rmqr_options(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt); + assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -7867,10 +7906,10 @@ static void test_rmqr_input(const testCtx *const p_ctx) { char *comment; }; /* See test_qr_input() for details about test characters */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, 0, 4, 11, -1, "é", 0, 0, "67 A4 00 EC 11", 1, 1, "B1 (ISO 8859-1)" }, /* 1*/ { UNICODE_MODE, 3, 4, 11, -1, "é", 0, 3, "E0 6C F4 80 EC", 1, 1, "ECI-3 B1 (ISO 8859-1)" }, - /* 2*/ { UNICODE_MODE, 20, -1, -1, -1, "é", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input data", 1, 1, "é not in Shift JIS" }, + /* 2*/ { UNICODE_MODE, 20, -1, -1, -1, "é", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input", 1, 1, "é not in Shift JIS" }, /* 3*/ { UNICODE_MODE, 26, 4, 11, -1, "é", 0, 26, "E3 4D 61 D4 80", 1, 1, "ECI-26 B2 (UTF-8)" }, /* 4*/ { DATA_MODE, 0, 4, 11, -1, "é", 0, 0, "6B 0E A4 00 EC", 1, 0, "B2 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 5*/ { DATA_MODE, 0, 4, 11, -1, "\351", 0, 0, "67 A4 00 EC 11", 1, 1, "B1 (ISO 8859-1)" }, @@ -7881,7 +7920,7 @@ static void test_rmqr_input(const testCtx *const p_ctx) { /* 10*/ { DATA_MODE, 0, 4, 11, -1, "β", 0, 0, "6B 3A C8 00 EC", 1, 0, "B2 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 11*/ { UNICODE_MODE, 0, 4, 11, -1, "ก", ZINT_WARN_USES_ECI, 13, "Warning E1 AC D0 80 EC", 1, 1, "ECI-13 B1 (ISO 8859-11)" }, /* 12*/ { UNICODE_MODE, 13, 4, 11, -1, "ก", 0, 13, "E1 AC D0 80 EC", 1, 1, "ECI-13 B1 (ISO 8859-11)" }, - /* 13*/ { UNICODE_MODE, 20, -1, -1, -1, "ก", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input data", 1, 1, "ก not in Shift JIS" }, + /* 13*/ { UNICODE_MODE, 20, -1, -1, -1, "ก", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input", 1, 1, "ก not in Shift JIS" }, /* 14*/ { UNICODE_MODE, 26, 2, 11, -1, "ก", 0, 26, "E3 4D F0 5C 40 80 EC", 1, 1, "ECI-26 B3 (UTF-8)" }, /* 15*/ { DATA_MODE, 0, 4, 11, -1, "ก", 0, 0, "6F 82 E2 04 00", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 16*/ { UNICODE_MODE, 0, 4, 11, -1, "Ж", ZINT_WARN_NONCOMPLIANT, 0, "Warning 88 91 C0 EC 11", 1, 1, "K1 (Shift JIS)" }, @@ -7890,7 +7929,7 @@ static void test_rmqr_input(const testCtx *const p_ctx) { /* 19*/ { UNICODE_MODE, 26, 4, 11, -1, "Ж", 0, 26, "E3 4D 68 4B 00", 1, 1, "ECI-26 B2 (UTF-8)" }, /* 20*/ { DATA_MODE, 0, 4, 11, -1, "Ж", 0, 0, "6B 42 58 00 EC", 1, 0, "B2 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 21*/ { UNICODE_MODE, 0, 2, 11, -1, "ກ", ZINT_WARN_USES_ECI, 26, "Warning E3 4D F0 5D 40 80 EC", 1, 1, "ECI-26 B3 (UTF-8)" }, - /* 22*/ { UNICODE_MODE, 20, -1, -1, -1, "ກ", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input data", 1, 1, "ກ not in Shift JIS" }, + /* 22*/ { UNICODE_MODE, 20, -1, -1, -1, "ກ", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input", 1, 1, "ກ not in Shift JIS" }, /* 23*/ { UNICODE_MODE, 26, 2, 11, -1, "ກ", 0, 26, "E3 4D F0 5D 40 80 EC", 1, 1, "ECI-26 B3 (UTF-8)" }, /* 24*/ { DATA_MODE, 0, 4, 11, -1, "ກ", 0, 0, "6F 82 EA 04 00", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 25*/ { UNICODE_MODE, 0, 4, 11, -1, "\\", 0, 0, "65 70 00 EC 11", 1, 1, "B1 (ASCII)" }, @@ -7903,37 +7942,37 @@ static void test_rmqr_input(const testCtx *const p_ctx) { /* 32*/ { UNICODE_MODE, 26, 4, 11, -1, "¥", 0, 26, "E3 4D 61 52 80", 1, 1, "ECI-26 B2 (UTF-8)" }, /* 33*/ { DATA_MODE, 0, 4, 11, -1, "¥", 0, 0, "6B 0A 94 00 EC", 1, 0, "B2 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 34*/ { UNICODE_MODE, 0, 4, 11, -1, "・", ZINT_WARN_NONCOMPLIANT, 0, "Warning 66 94 00 EC 11", 1, 1, "B1 (Shift JIS) single-byte codepoint A5 (same bytes as ¥ ISO 8859-1 above, so ambiguous)" }, - /* 35*/ { UNICODE_MODE, 3, -1, -1, -1, "・", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", 1, 1, "" }, + /* 35*/ { UNICODE_MODE, 3, -1, -1, -1, "・", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input for ECI '3'", 1, 1, "" }, /* 36*/ { UNICODE_MODE, 20, 4, 11, -1, "・", 0, 20, "E2 8C D2 80 EC", 1, 1, "ECI-20 B1 (Shift JIS) single-byte codepoint A5" }, /* 37*/ { UNICODE_MODE, 26, 2, 11, -1, "・", 0, 26, "E3 4D F7 DE D2 80 EC", 1, 1, "ECI-26 B3 (UTF-8)" }, /* 38*/ { DATA_MODE, 0, 4, 11, -1, "・", 0, 0, "6F BE F6 94 00", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 39*/ { UNICODE_MODE, 0, 4, 11, -1, "¿", 0, 0, "66 FC 00 EC 11", 1, 0, "B1 (ISO 8859-1) (same bytes as ソ Shift JIS below, so ambiguous); ZXing-C++ test can't handle it" }, /* 40*/ { UNICODE_MODE, 3, 4, 11, -1, "¿", 0, 3, "E0 6C DF 80 EC", 1, 1, "ECI-3 B1 (ISO 8859-1)" }, - /* 41*/ { UNICODE_MODE, 20, 4, 11, -1, "¿", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input data", 1, 1, "¿ not in Shift JIS" }, + /* 41*/ { UNICODE_MODE, 20, 4, 11, -1, "¿", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input", 1, 1, "¿ not in Shift JIS" }, /* 42*/ { UNICODE_MODE, 26, 4, 11, -1, "¿", 0, 26, "E3 4D 61 5F 80", 1, 1, "ECI-26 B2 (UTF-8)" }, /* 43*/ { DATA_MODE, 0, 4, 11, -1, "¿", 0, 0, "6B 0A FC 00 EC", 1, 0, "B2 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 44*/ { UNICODE_MODE, 0, 4, 11, -1, "ソ", ZINT_WARN_NONCOMPLIANT, 0, "Warning 66 FC 00 EC 11", 1, 1, "B1 (Shift JIS) single-byte codepoint BF (same bytes as ¿ ISO 8859-1 above, so ambiguous)" }, - /* 45*/ { UNICODE_MODE, 3, 4, 11, -1, "ソ", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", 1, 1, "" }, + /* 45*/ { UNICODE_MODE, 3, 4, 11, -1, "ソ", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input for ECI '3'", 1, 1, "" }, /* 46*/ { UNICODE_MODE, 20, 4, 11, -1, "ソ", 0, 20, "E2 8C DF 80 EC", 1, 1, "ECI-20 B1 (Shift JIS) single-byte codepoint BF" }, /* 47*/ { UNICODE_MODE, 26, 2, 11, -1, "ソ", 0, 26, "E3 4D F7 DE DF 80 EC", 1, 1, "ECI-26 B3 (UTF-8)" }, /* 48*/ { DATA_MODE, 0, 4, 11, -1, "ソ", 0, 0, "6F BE F6 FC 00", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 49*/ { UNICODE_MODE, 0, 4, 11, -1, "~", 0, 0, "65 F8 00 EC 11", 1, 1, "B1 (ASCII) (same bytes as ‾ Shift JIS below, so ambiguous)" }, /* 50*/ { UNICODE_MODE, 3, 4, 11, -1, "~", 0, 3, "E0 6C BF 00 EC", 1, 1, "ECI-3 B1 (ASCII)" }, - /* 51*/ { UNICODE_MODE, 20, 4, 11, -1, "~", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input data", 1, 1, "tilde not in Shift JIS (codepoint used for overline)" }, + /* 51*/ { UNICODE_MODE, 20, 4, 11, -1, "~", ZINT_ERROR_INVALID_DATA, -1, "Error 800: Invalid character in input", 1, 1, "tilde not in Shift JIS (codepoint used for overline)" }, /* 52*/ { UNICODE_MODE, 0, 4, 11, -1, "‾", ZINT_WARN_NONCOMPLIANT, 0, "Warning 65 F8 00 EC 11", 1, 0, "B1 (Shift JIS) single-byte codepoint 7E (same bytes as ~ ASCII above, so ambiguous); ZXing-C++ test can't handle it" }, - /* 53*/ { UNICODE_MODE, 3, 4, 11, -1, "‾", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", 1, 1, "" }, + /* 53*/ { UNICODE_MODE, 3, 4, 11, -1, "‾", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input for ECI '3'", 1, 1, "" }, /* 54*/ { UNICODE_MODE, 20, 4, 11, -1, "‾", 0, 20, "E2 8C BF 00 EC", 1, 0, "ECI-20 B1 (Shift JIS) (to single-byte tilde codepoint 7E, so byte mode); ZXing-C++ test can't handle it" }, /* 55*/ { UNICODE_MODE, 26, 2, 11, -1, "‾", 0, 26, "E3 4D F1 40 5F 00 EC", 1, 1, "ECI-26 B3 (UTF-8)" }, /* 56*/ { DATA_MODE, 0, 4, 11, -1, "‾", 0, 0, "6F 8A 02 F8 00", 1, 0, "B3 (UTF-8); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 57*/ { UNICODE_MODE, 0, 4, 11, -1, "点", ZINT_WARN_NONCOMPLIANT, 0, "Warning 8B 67 C0 EC 11", 1, 1, "K1 (Shift JIS)" }, - /* 58*/ { UNICODE_MODE, 3, 4, 11, -1, "点", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", 1, 1, "" }, + /* 58*/ { UNICODE_MODE, 3, 4, 11, -1, "点", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input for ECI '3'", 1, 1, "" }, /* 59*/ { UNICODE_MODE, 20, 4, 11, -1, "点", 0, 20, "E2 91 6C F8 EC", 1, 1, "ECI-20 K1 (Shift JIS)" }, /* 60*/ { UNICODE_MODE, 26, 2, 11, -1, "点", 0, 26, "E3 4D F3 C1 5C 80 EC", 1, 1, "ECI-26 B3 (UTF-8)" }, /* 61*/ { DATA_MODE, 0, 4, 11, -1, "点", 0, 0, "6F 9E 0A E4 00", 1, 0, "B3 (UTF-8; ZXing-C++ test can't handle DATA_MODE for certain inputs)" }, /* 62*/ { DATA_MODE, 0, 4, 11, -1, "\223\137", 0, 0, "6A 4D 7C 00 EC", 0, 0, "B2 (Shift JIS) (not full multibyte); BWIPP uses Kanji (ZINT_FULL_MULTIBYTE) mode, see below); ZXing-C++ test can't handle DATA_MODE for certain inputs" }, /* 63*/ { DATA_MODE, 0, 4, 11, ZINT_FULL_MULTIBYTE, "\223\137", 0, 0, "8B 67 C0 EC 11", 1, 1, "K1 (Shift JIS)" }, /* 64*/ { UNICODE_MODE, 0, 4, 11, -1, "¥・点", ZINT_WARN_NONCOMPLIANT, 0, "Warning 71 72 96 4D 7C", 1, 0, "B4 (Shift JIS) (optimized to byte mode only); ZXing-C++ test can't handle it" }, - /* 65*/ { UNICODE_MODE, 3, -1, -1, -1, "¥・点", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input data for ECI 3", 1, 1, "" }, + /* 65*/ { UNICODE_MODE, 3, -1, -1, -1, "¥・点", ZINT_ERROR_INVALID_DATA, -1, "Error 575: Invalid character in input for ECI '3'", 1, 1, "" }, /* 66*/ { UNICODE_MODE, 20, 2, 11, -1, "¥・点", 0, 20, "E2 8E 2E 52 C9 AF 80", 1, 0, "ECI-20 B4 (Shift JIS); ZXing-C++ test can't handle it" }, /* 67*/ { UNICODE_MODE, 26, 2, 17, -1, "¥・点", 0, 26, "E3 4E 30 A9 7B EF 69 79 E0 AE 40 EC", 1, 1, "ECI-26 B8 (UTF-8)" }, /* 68*/ { DATA_MODE, 0, 4, 11, -1, "\134\245\223\137", 0, 0, "71 72 96 4D 7C", 1, 0, "B8 (Shift JIS; ZXing-C++ test can't handle DATA_MODE for certain inputs)" }, @@ -7986,7 +8025,7 @@ static void test_rmqr_input(const testCtx *const p_ctx) { /*115*/ { UNICODE_MODE, 29, 2, 20, -1, "Google 谷歌 Pixel 4a 128 GB黑色;零售价:¥3149.79", 0, 29, "(53) E3 AE 94 76 F6 F6 76 C6 52 0B 9C 8B 8E 82 05 06 97 86 56 C2 03 46 12 03 13 23 82 04", 1, 1, "ECI-29 B41 A7" }, /*116*/ { UNICODE_MODE, 17, 2, 24, -1, "Google Pixel 4a 128 GB Schwarz;Preis:444,90 €", 0, 17, "(48) E2 2C F4 76 F6 F6 76 C6 52 05 06 97 86 56 C2 03 46 14 27 2A 86 2C C8 84 DC 6A B1 B4", 0, 1, "ECI-17 B15 A9 B21; BWIPP different encodation (B46)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -8075,7 +8114,7 @@ static void test_rmqr_gs1(const testCtx *const p_ctx) { char *expected; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { GS1_MODE, "[01]12345678901231", 0, "A6 00 59 D5 1B EF 43 D8 80 EC 11 EC", "N16" }, /* 1*/ { GS1_MODE | GS1PARENS_MODE, "(01)12345678901231", 0, "A6 00 59 D5 1B EF 43 D8 80 EC 11 EC", "N16" }, /* 2*/ { GS1_MODE, "[01]04912345123459[15]970331[30]128[10]ABC123", 0, "A5 D0 29 EB 3A A0 05 67 93 F2 94 B4 B4 E2 4E AF 01 47 EC 17 86", "N29 A9" }, @@ -8090,7 +8129,7 @@ static void test_rmqr_gs1(const testCtx *const p_ctx) { /* 11*/ { GS1_MODE, "[91]A%%%%12345678A%A", 0, "AC E7 26 28 24 A4 A4 A4 A4 81 ED C8 9C 88 7A 35 C0 EC 11", "B7 N8 A3(4)" }, /* 12*/ { GS1_MODE, "[91]%23%%6789%%%34567%%%%234%%%%%", 0, "(33) A9 43 2D B5 02 EE D4 DA 84 54 B8 ED 4D A9 B5 08 55 66 1B 30 94 94 94 94 C8 CC D0 94", "A14(20) N5 B12" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -8156,7 +8195,7 @@ static void test_rmqr_optimize(const testCtx *const p_ctx) { int bwipp_cmp; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, 4, 11, "1", 0, "22 20 EC 11 EC", 1, "N1" }, /* 1*/ { UNICODE_MODE, 4, 11, "AAA", 0, "46 73 0A 00 EC", 1, "A3" }, /* 2*/ { UNICODE_MODE, 2, 11, "0123456789", 0, "34 06 2B 35 34 80 EC", 1, "N10 (nayuki.io - pure numeric)" }, @@ -8180,7 +8219,7 @@ static void test_rmqr_optimize(const testCtx *const p_ctx) { /* 20*/ { UNICODE_MODE, 2, 11, "テaAB1", ZINT_WARN_NONCOMPLIANT, "Warning 6E 0D 95 85 19 CD 04", 0, "B3 A3; BWIPP different encodation (B6)" }, /* 21*/ { UNICODE_MODE, 2, 32, "貫やぐ識禁ぱい再2間変字全ノレ没無8裁花ほゃ過法ひなご札17能つーびれ投覧マ勝動エヨ額界よみ作皇ナヲニ打題ヌルヲ掲布益フが。入35能ト権話しこを断兆モヘ細情おじ名4減エヘイハ側機", ZINT_WARN_NONCOMPLIANT, "Warning (152) 82 0E A2 16 20 97 28 BD 02 C1 4F 09 12 61 08 04 A0 83 AA 3E 3D 43 4C 13 0D 68 73 1F", 1, "K8 N1 K8 N1 K10 N2 K33 N2 K16 N1 K7" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -8267,7 +8306,7 @@ static void test_rmqr_encode(const testCtx *const p_ctx) { char *expected; }; /* ISO/IEC 23941:2022 */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, -1, 4, 11, ZINT_FULL_MULTIBYTE, "0123456", 0, 11, 27, 1, "ISO 23941 Annex I Figure I.2, R11x27-H, same", "111111101010101010101010111" "100000100110100001110100101" @@ -8648,7 +8687,7 @@ static void test_rmqr_encode(const testCtx *const p_ctx) { "1110101010101010101010101011101010101010101010101010101110101010101010101010101010111010101010101010101010101011101010101010101010101011111" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -8739,7 +8778,7 @@ static void test_rmqr_encode_segs(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, 2, 11, -1, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 11, 27, 1, "Standard example", "111111101010101010101010111" "100000101110110001100111101" @@ -8830,7 +8869,7 @@ static void test_rmqr_encode_segs(const testCtx *const p_ctx) { "111111101010101010101011101010101010101010101010111010101010101010101010101110101010101010101011111" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, j, seg_count, ret; struct zint_symbol *symbol = NULL; @@ -8941,12 +8980,12 @@ static void test_fuzz(const testCtx *const p_ctx) { char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_QRCODE, GS1_MODE | GS1NOCHECK_MODE, -1, -1, -1, -1, "[]CCCCCLLLLLLLLLLLLLLLLLLLLLCCCCCCCC@CCCCCCCCCCCCCCCCCCCCCCC%%C%C%%%%%%%%%%%%%%LLLCCCCCCCC%%C%C%%%%%%%%%%%%%%LLLLLLLLLLLLLLLLLLL000000032861710*383556LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL155816162LLLLLCC%%C%C%%%%%%%%%%%%%%LLLCCCCCCCC%%C%C%%%%%%%%%%%%%%LLLLLLLLLL)!1661055777[723]T5", -1, 0, 1, "" }, /* #300 (#14), Andre Maute */ /* 1*/ { BARCODE_QRCODE, DATA_MODE, -1, -1, -1, ZINT_FULL_MULTIBYTE, "\215\215\350\2156750\215\215\215\215\215\215\000\000\000\025\215\215\215\215\215\232\215\232\232\001\361\215\215\215\215\215\221\215\215\215\215JJJJJJNJJJJJJ\215\215\215\2159999\215\215\215\215\215\215\215\215\215\235\215\215\215\215\215\035\004\000\000@\000\000\000\000\375\000\000\000\000\000\000\000\000\000\000\000\000\000\241\000\000\000\000\000\000\000\241\247^^^\377\377\377\000 \000\000\000\000\000\000\377\377u\000\000\000\000\000\000\000^\377\377^^\000:\000\177\377\377\377?\377\377\377\377\377\377\377\377\377\377\377\377\377\377\241\241\232\232\232\232\232\232\232\232\000\377\377\377\242\003\000\000\377\377/\000AA\000\000\000\000\000\000\000\000\000\000\000\000T\000\000\000\000\000\000\000\000WWW\237\250WWWWWW\377\377R30 \377\377\000\000\000", 231, 0, 1, "" }, /* #300 (#15), Andre Maute */ /* 2*/ { BARCODE_QRCODE, DATA_MODE, 35, -1, -1, ZINT_FULL_MULTIBYTE, "\215\215\215\215\215\350\215\215999\215\21500000\215\215\215\215\215\215\377O\000\000\036\000\000\000\000\357\376\026\377\377\377\377\241\241\232\232\232\232\232\232\235\032@\374:JGB \000\000@d\000\000\000\241\241\000\000\027\002\241\241\000\000\014\000\000\000\000\357\327\004\000\000\000\000\000\000\000\375\000\000\000\000\000\000\000\000\000\000\000\000\0000253]9R4R44,44,4404[255\350999\215\21599999\215\215\215\2150000\215\215\215\215\215\215\215\215\215]9444442<4444,4044%44vA\000\000\002\000'\000\000\215\377@\215\215\350\215\215\215\215\215\215\215\307\306\306n\215\215\000\000\001\000\000\203\000\000\000\000\000\000@\215\215\215[\2154315@]R0", 229, 0, 1, "" }, /* #300 (#16), Andre Maute */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; diff --git a/backend/tests/test_raster.c b/backend/tests/test_raster.c index 7c84d7d2..0041ca5f 100644 --- a/backend/tests/test_raster.c +++ b/backend/tests/test_raster.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2023 Robin Stuart + Copyright (C) 2019-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -57,7 +57,7 @@ static void test_options(const testCtx *const p_ctx) { int expected_bitmap_height; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, "123456", "7890AB", 0, "A", 0, 1, 46, 92, 116 }, /* 1*/ { BARCODE_CODE128, "123456", "7890ab", 90, "A", 0, 1, 46, 116, 92 }, /* 2*/ { BARCODE_CODE128, NULL, NULL, 180, "A", 0, 1, 46, 92, 116 }, @@ -68,7 +68,7 @@ static void test_options(const testCtx *const p_ctx) { /* 7*/ { BARCODE_CODE128, "12345 ", NULL, 0, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, -1, -1 }, /* 8*/ { BARCODE_CODE128, NULL, "EEFFGG", 0, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, -1, -1 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -121,7 +121,7 @@ static void test_buffer(const testCtx *const p_ctx) { int expected_bitmap_width; int expected_bitmap_height; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE11, -1, "1234567890", "", 50, 1, 108, 216, 116 }, /* 1*/ { BARCODE_CODE11, COMPLIANT_HEIGHT, "1234567890", "", 50, 1, 108, 216, 116 }, /* 2*/ { BARCODE_C25STANDARD, -1, "1234567890", "", 50, 1, 117, 234, 116 }, @@ -463,7 +463,7 @@ static void test_upcean_hrt(const testCtx *const p_ctx) { int expected_text2_len; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_EANX, -1, -1, "123456789012", 0, 50, 1, 95, 226, 116, 102 /*text_row*/, 0, 22, -1, -1, -1 }, /* EAN-13 */ /* 1*/ { BARCODE_EANX, 0, -1, "123456789012", 0, 50, 1, 95, 226, 110, 102 /*text_row*/, 0, 22, -1, -1, -1 }, /* EAN-13 */ /* 2*/ { BARCODE_EANX, -1, EANUPC_GUARD_WHITESPACE, "123456789012", 0, 50, 1, 95, 226, 116, 108 /*text_row*/, 212, 14, -1, -1, -1 }, /* EAN-13 */ @@ -639,7 +639,7 @@ static void test_row_separator(const testCtx *const p_ctx) { int expected_separator_height; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODABLOCKF, -1, -1, -1, "A", 0, 20, 2, 101, 242, 44, 21, 42, 2 }, /* 1*/ { BARCODE_CODABLOCKF, -1, -1, 0, "A", 0, 20, 2, 101, 242, 44, 21, 42, 2 }, /* Same as default */ /* 2*/ { BARCODE_CODABLOCKF, -1, -1, 1, "A", 0, 20, 2, 101, 242, 44, 21, 42, 2 }, /* Same as default */ @@ -650,7 +650,7 @@ static void test_row_separator(const testCtx *const p_ctx) { /* 7*/ { BARCODE_CODABLOCKF, -1, 1, -1, "A", 0, 5, 1, 46, 132, 14, 0, 20 + 2, 2 }, /* CODE128 top separator, add 2 to skip over end of start char; note no longer includes HRT */ /* 8*/ { BARCODE_CODABLOCKF, 0, -1, -1, "A", 0, 20, 2, 101, 242, 44, 21, 42, 2 }, /* Border width zero, same as default */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -726,12 +726,12 @@ static void test_stacking(const testCtx *const p_ctx) { int expected_separator_height; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, -1, -1, -1, "A", "B", 50, 2, 46, 92, 116, -1, -1, -1 }, /* 1*/ { BARCODE_CODE128, BARCODE_BIND, -1, -1, "A", "B", 50, 2, 46, 92, 116, 49, 4, 2 }, /* 2*/ { BARCODE_CODE128, BARCODE_BIND, -1, 2, "A", "B", 50, 2, 46, 92, 116, 48, 4, 4 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -845,7 +845,7 @@ static void test_output_options(const testCtx *const p_ctx) { int expected_set_col; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, -1, -1, -1, -1, 0, 0, "A123", 0, 50, 1, 79, 158, 116, 0, 0, 4 }, /* 1*/ { BARCODE_CODE128, -1, -1, -1, -1, 180, 0, "A123", 0, 50, 1, 79, 158, 116, 0, 115, 4 }, /* 2*/ { BARCODE_CODE128, -1, -1, 2, -1, 0, 0, "A123", 0, 50, 1, 79, 158, 116, 0, 0, 4 }, @@ -943,7 +943,7 @@ static void test_output_options(const testCtx *const p_ctx) { /* 94*/ { BARCODE_CODE49, -1, -1, -1, -1, 0, 0, "A123", 0, 20, 2, 70, 162, 44, 1, 43, 0 }, /* 95*/ { BARCODE_CODE49, -1, -1, -1, BARCODE_BIND_TOP, 0, 0, "A123", 0, 20, 2, 70, 162, 42, 0, 41, 0 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -1025,12 +1025,12 @@ static void test_draw_string_wrap(const testCtx *const p_ctx) { int expected_no_text_col; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, -1, "12", " E", 50, 1, 46, 92, 116, 104, 0 }, /* 1*/ { BARCODE_CODE128, BOLD_TEXT, "12", " E", 50, 1, 46, 92, 116, 104, 0 }, /* 2*/ { BARCODE_CODE128, SMALL_TEXT, "12", " E", 50, 1, 46, 92, 112, 103, 0 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -1100,10 +1100,10 @@ static void test_code128_utf8(const testCtx *const p_ctx) { int expected_text_len; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "é", 50, 1, 57, 114, 116, 110, 53, 6 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -1178,7 +1178,7 @@ static void test_scale(const testCtx *const p_ctx) { int expected_set_len; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE16K, -1, -1, -1, 0, 0, "1234567890123456789012345678901234567890", "", 0, 50, 5, 70, 162, 104, 0 /*set_row*/, 43, 30, 2 }, /* With no scaling */ /* 1*/ { BARCODE_CODE16K, -1, -1, -1, 0, 0.5, "1234567890123456789012345678901234567890", "", 0, 50, 5, 70, 162 * 0.5, 104 * 0.5, 0 /*set_row*/, (43 * 0.5) + 1, 30 * 0.5, 2 * 0.5 }, /* 2*/ { BARCODE_CODE16K, -1, -1, -1, 37, 0.5, "1234567890123456789012345678901234567890", "", 0, 35, 5, 70, 162 * 0.5, 37, 0 /*set_row*/, 16, 30 * 0.5, 2 * 0.5 }, /* Height specified */ @@ -1267,7 +1267,7 @@ static void test_scale(const testCtx *const p_ctx) { /* 85*/ { BARCODE_ITF14, -1, 4, BARCODE_BIND, 61.8, 2, "12345", "", 0, 61.75, 1, 135, 310 * 2, 156 * 2 - 1, 8 * 2 /*set_row*/, 132 * 2 - 1, 20 * 2, 2 * 2 }, /* -1's due to height rounding */ /* 86*/ { BARCODE_ITF14, -1, 4, BARCODE_BIND, 61.8, 2.1, "12345", "", 0, 62, 1, 135, 310 * 2.1, 156 * 2.1, 8 * 2.1 /*set_row*/, 132 * 2.1, 20 * 2.1, 2 * 2.1 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -1369,7 +1369,7 @@ static void test_guard_descent(const testCtx *const p_ctx) { int expected_set_len; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 134, 116, 1 /*set*/, 100 /*set_row*/, 100 + 10, 18, 2 }, /* 1*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 134, 116, 0 /*set*/, 100 + 10 /*set_row*/, 100 + 16, 18, 2 }, /* 2*/ { BARCODE_UPCE, 0, "1234567", 0, 50, 1, 51, 134, 116, 0 /*set*/, 100 /*set_row*/, 100 + 16, 18, 2 }, @@ -1402,7 +1402,7 @@ static void test_guard_descent(const testCtx *const p_ctx) { /* 29*/ { BARCODE_ISBNX, -1, "123456789", 0, 50, 1, 95, 226, 116, 0 /*set*/, 100 + 10 /*set_row*/, 100 + 16, 206, 2 }, /* 30*/ { BARCODE_ISBNX, 0, "123456789", 0, 50, 1, 95, 226, 116, 0 /*set*/, 100 /*set_row*/, 100 + 16, 206, 2 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -1489,7 +1489,7 @@ static void test_quiet_zones(const testCtx *const p_ctx) { int expected_set_len; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE11, -1, -1, -1, -1, "1234", "", 0, 50, 1, 62, 124, 116, 1 /*set*/, 0, 100, 0, 2 }, /* 1*/ { BARCODE_CODE11, BARCODE_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 50, 1, 62, 164, 116, 0 /*set*/, 0, 100, 0, 20 }, /* 2*/ { BARCODE_CODE11, BARCODE_QUIET_ZONES | BARCODE_NO_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 50, 1, 62, 124, 116, 1 /*set*/, 0, 100, 0, 2 }, /* BARCODE_NO_QUIET_ZONES trumps BARCODE_QUIET_ZONES */ @@ -1797,7 +1797,7 @@ static void test_quiet_zones(const testCtx *const p_ctx) { /*304*/ { BARCODE_BC412, -1, -1, -1, -1, "1234567", "", 0, 16.5, 1, 102, 204, 49, 1 /*set*/, 0, 32, 0, 2 }, /*305*/ { BARCODE_BC412, BARCODE_QUIET_ZONES, -1, -1, -1, "1234567", "", 0, 16.5, 1, 102, 244, 49, 0 /*set*/, 0, 32, 0, 2 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -1908,7 +1908,7 @@ static void test_text_gap(const testCtx *const p_ctx) { int expected_set_len; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE11, -1, -1, -1, 1, 0, "1234", "", 0, 50, 1, 62, 124, 116, 1 /*set*/, 104, 105, 55, 6 }, /* Default */ /* 1*/ { BARCODE_CODE11, -1, -1, -1, 1, 0, "1234", "", 0, 50, 1, 62, 124, 116, 0 /*set*/, 103, 104, 0, 124 }, /* Default */ /* 2*/ { BARCODE_CODE11, -1, -1, -1, 0.1, 0, "1234", "", 0, 50, 1, 62, 124, 115, 1 /*set*/, 102, 103, 55, 6 }, @@ -1968,7 +1968,7 @@ static void test_text_gap(const testCtx *const p_ctx) { /* 56*/ { BARCODE_UPCA_CC, -1, -1, 0, 3.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 0 /*set*/, 38, 44, 208, 68 }, /* Hide text */ /* 57*/ { BARCODE_UPCA_CC, -1, -1, 0, 3.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 1 /*set*/, 44, 100, 258, 4 }, /* Hide text */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -2068,7 +2068,7 @@ static void test_buffer_plot(const testCtx *const p_ctx) { int expected_bitmap_height; char *expected_bitmap; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_PDF417, 0, 1, -1, -1, 15, "", "", "1", 0, 16, 4, 86, 86, 16, "11111111010101000111101010111100001111101010111110011101010111000000111111101000101001" "11111111010101000111101010111100001111101010111110011101010111000000111111101000101001" @@ -2161,7 +2161,7 @@ static void test_buffer_plot(const testCtx *const p_ctx) { "CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -2254,628 +2254,629 @@ static void test_height(const testCtx *const p_ctx) { int expected_width; int expected_bitmap_width; int expected_bitmap_height; + char *expected_errtxt; const char *comment; }; - struct item data[] = { - /* 0*/ { BARCODE_CODE11, -1, 1, "1234567890", "", 0, 1, 1, 108, 216, 2, "" }, - /* 1*/ { BARCODE_CODE11, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 108, 216, 2, "TODO: Find doc" }, - /* 2*/ { BARCODE_CODE11, -1, 4, "1234567890", "", 0, 4, 1, 108, 216, 8, "" }, - /* 3*/ { BARCODE_CODE11, -1, 10, "1234567890", "", 0, 10, 1, 108, 216, 20, "" }, - /* 4*/ { BARCODE_C25STANDARD, -1, 1, "1234567890", "", 0, 1, 1, 117, 234, 2, "" }, - /* 5*/ { BARCODE_C25STANDARD, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 117, 234, 2, "No doc for C25 except C25INTER" }, - /* 6*/ { BARCODE_C25STANDARD, -1, 4, "1234567890", "", 0, 4, 1, 117, 234, 8, "" }, - /* 7*/ { BARCODE_C25STANDARD, -1, 11, "1234567890", "", 0, 11, 1, 117, 234, 22, "" }, - /* 8*/ { BARCODE_C25INTER, -1, 1, "1234567890", "", 0, 1, 1, 99, 198, 2, "" }, - /* 9*/ { BARCODE_C25INTER, -1, 15, "1234567890", "", 0, 15, 1, 99, 198, 30, "" }, - /* 10*/ { BARCODE_C25INTER, COMPLIANT_HEIGHT, 15, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 15, 1, 99, 198, 30, "Min height data-length dependent" }, - /* 11*/ { BARCODE_C25INTER, COMPLIANT_HEIGHT, 15.5, "1234567890", "", 0, 15.5, 1, 99, 198, 31, "" }, - /* 12*/ { BARCODE_C25INTER, COMPLIANT_HEIGHT, 17.5, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 17.5, 1, 117, 234, 35, "Min height data-length dependent" }, - /* 13*/ { BARCODE_C25INTER, COMPLIANT_HEIGHT, 17.75, "12345678901", "", 0, 18, 1, 117, 234, 36, "" }, - /* 14*/ { BARCODE_C25IATA, -1, 1, "1234567890", "", 0, 1, 1, 149, 298, 2, "" }, - /* 15*/ { BARCODE_C25IATA, -1, 4, "1234567890", "", 0, 4, 1, 149, 298, 8, "" }, - /* 16*/ { BARCODE_C25IATA, -1, 30, "1234567890", "", 0, 30, 1, 149, 298, 60, "" }, - /* 17*/ { BARCODE_C25LOGIC, -1, 1, "1234567890", "", 0, 1, 1, 109, 218, 2, "" }, - /* 18*/ { BARCODE_C25LOGIC, -1, 4, "1234567890", "", 0, 4, 1, 109, 218, 8, "" }, - /* 19*/ { BARCODE_C25LOGIC, -1, 41, "1234567890", "", 0, 41, 1, 109, 218, 82, "" }, - /* 20*/ { BARCODE_C25IND, -1, 1, "1234567890", "", 0, 1, 1, 159, 318, 2, "" }, - /* 21*/ { BARCODE_C25IND, -1, 4, "1234567890", "", 0, 4, 1, 159, 318, 8, "" }, - /* 22*/ { BARCODE_C25IND, -1, 21, "1234567890", "", 0, 21, 1, 159, 318, 42, "" }, - /* 23*/ { BARCODE_CODE39, -1, 1, "1234567890", "", 0, 1, 1, 155, 310, 2, "" }, - /* 24*/ { BARCODE_CODE39, -1, 4, "1", "", 0, 4, 1, 38, 76, 8, "" }, - /* 25*/ { BARCODE_CODE39, COMPLIANT_HEIGHT, 4, "1", "", ZINT_WARN_NONCOMPLIANT, 4, 1, 38, 76, 8, "Min height data-length dependent" }, - /* 26*/ { BARCODE_CODE39, COMPLIANT_HEIGHT, 4.4, "1", "", 0, 4.5, 1, 38, 76, 9, "" }, - /* 27*/ { BARCODE_CODE39, -1, 17, "1234567890", "", 0, 17, 1, 155, 310, 34, "" }, - /* 28*/ { BARCODE_CODE39, COMPLIANT_HEIGHT, 17, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 17, 1, 155, 310, 34, "Min height data-length dependent" }, - /* 29*/ { BARCODE_CODE39, COMPLIANT_HEIGHT, 17.85, "1234567890", "", 0, 18, 1, 155, 310, 36, "" }, - /* 30*/ { BARCODE_EXCODE39, -1, 1, "1234567890", "", 0, 1, 1, 155, 310, 2, "" }, - /* 31*/ { BARCODE_EXCODE39, -1, 17.8, "1234567890", "", 0, 18, 1, 155, 310, 36, "" }, - /* 32*/ { BARCODE_EXCODE39, COMPLIANT_HEIGHT, 17.8, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 18, 1, 155, 310, 36, "" }, - /* 33*/ { BARCODE_EXCODE39, COMPLIANT_HEIGHT, 17.9, "1234567890", "", 0, 18, 1, 155, 310, 36, "" }, - /* 34*/ { BARCODE_EANX, -1, 1, "123456789012", "", 0, 1, 1, 95, 226, 12, "EAN-13" }, - /* 35*/ { BARCODE_EANX, -1, 69, "123456789012", "", 0, 69, 1, 95, 226, 148, "" }, - /* 36*/ { BARCODE_EANX, COMPLIANT_HEIGHT, 69, "123456789012", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "" }, - /* 37*/ { BARCODE_EANX, COMPLIANT_HEIGHT, 69.25, "123456789012", "", 0, 69.5, 1, 95, 226, 149, "" }, - /* 38*/ { BARCODE_EANX, -1, 55, "1234567", "", 0, 55, 1, 67, 162, 120, "EAN-8" }, - /* 39*/ { BARCODE_EANX, COMPLIANT_HEIGHT, 55, "1234567", "", ZINT_WARN_NONCOMPLIANT, 55, 1, 67, 162, 120, "EAN-8" }, - /* 40*/ { BARCODE_EANX, COMPLIANT_HEIGHT, 55.25, "1234567", "", 0, 55.5, 1, 67, 162, 121, "EAN-8" }, - /* 41*/ { BARCODE_EANX_CHK, -1, 1, "1234567890128", "", 0, 1, 1, 95, 226, 12, "EAN-13" }, - /* 42*/ { BARCODE_EANX_CHK, -1, 69, "1234567890128", "", 0, 69, 1, 95, 226, 148, "" }, - /* 43*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, 69, "1234567890128", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "" }, - /* 44*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, 69.25, "1234567890128", "", 0, 69.5, 1, 95, 226, 149, "" }, - /* 45*/ { BARCODE_GS1_128, -1, 1, "[01]12345678901231", "", 0, 1, 1, 134, 268, 2, "" }, - /* 46*/ { BARCODE_GS1_128, -1, 5.7, "[01]12345678901231", "", 0, 5.5, 1, 134, 268, 11, "" }, - /* 47*/ { BARCODE_GS1_128, COMPLIANT_HEIGHT, 5.7, "[01]12345678901231", "", ZINT_WARN_NONCOMPLIANT, 5.5, 1, 134, 268, 11, "" }, - /* 48*/ { BARCODE_GS1_128, COMPLIANT_HEIGHT, 5.725, "[01]12345678901231", "", 0, 5.5, 1, 134, 268, 11, "Note considered compliant even though rendered height same as before" }, - /* 49*/ { BARCODE_GS1_128, -1, 50, "[01]12345678901231", "", 0, 50, 1, 134, 268, 100, "" }, - /* 50*/ { BARCODE_CODABAR, -1, 1, "A0B", "", 0, 1, 1, 32, 64, 2, "" }, - /* 51*/ { BARCODE_CODABAR, -1, 4, "A0B", "", 0, 4, 1, 32, 64, 8, "" }, - /* 52*/ { BARCODE_CODABAR, -1, 26, "A0B", "", 0, 26, 1, 32, 64, 52, "" }, - /* 53*/ { BARCODE_CODABAR, COMPLIANT_HEIGHT, 11, "A0B", "", ZINT_WARN_NONCOMPLIANT, 11, 1, 32, 64, 22, "" }, - /* 54*/ { BARCODE_CODABAR, COMPLIANT_HEIGHT, 12, "A0B", "", 0, 12, 1, 32, 64, 24, "" }, - /* 55*/ { BARCODE_CODE128, -1, 1, "1234567890", "", 0, 1, 1, 90, 180, 2, "" }, - /* 56*/ { BARCODE_CODE128, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 90, 180, 2, "" }, - /* 57*/ { BARCODE_CODE128, -1, 4, "1234567890", "", 0, 4, 1, 90, 180, 8, "" }, - /* 58*/ { BARCODE_CODE128, -1, 7, "1234567890", "", 0, 7, 1, 90, 180, 14, "" }, - /* 59*/ { BARCODE_DPLEIT, -1, 1, "1234567890123", "", 0, 1, 1, 135, 270, 2, "" }, - /* 60*/ { BARCODE_DPLEIT, COMPLIANT_HEIGHT, 1, "1234567890123", "", 0, 1, 1, 135, 270, 2, "TODO: Find doc" }, - /* 61*/ { BARCODE_DPLEIT, -1, 4, "1234567890123", "", 0, 4, 1, 135, 270, 8, "" }, - /* 62*/ { BARCODE_DPIDENT, -1, 1, "12345678901", "", 0, 1, 1, 117, 234, 2, "" }, - /* 63*/ { BARCODE_DPIDENT, COMPLIANT_HEIGHT, 1, "12345678901", "", 0, 1, 1, 117, 234, 2, "TODO: Find doc" }, - /* 64*/ { BARCODE_DPIDENT, -1, 4, "12345678901", "", 0, 4, 1, 117, 234, 8, "" }, - /* 65*/ { BARCODE_CODE16K, -1, -1, "1234567890", "", 0, 20, 2, 70, 162, 44, "2 rows" }, - /* 66*/ { BARCODE_CODE16K, -1, 1, "1234567890", "", 0, 1, 2, 70, 162, 6, "" }, - /* 67*/ { BARCODE_CODE16K, -1, 4, "1234567890", "", 0, 4, 2, 70, 162, 12, "" }, - /* 68*/ { BARCODE_CODE16K, -1, 16.75, "1234567890", "", 0, 17, 2, 70, 162, 38, "" }, - /* 69*/ { BARCODE_CODE16K, COMPLIANT_HEIGHT, 16.75, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 17, 2, 70, 162, 38, "" }, - /* 70*/ { BARCODE_CODE16K, COMPLIANT_HEIGHT, 17, "1234567890", "", 0, 17, 2, 70, 162, 38, "" }, - /* 71*/ { BARCODE_CODE16K, -1, -1, "12345678901234567890123456789012345678901234567890", "", 0, 60, 6, 70, 162, 124, "6 rows" }, - /* 72*/ { BARCODE_CODE16K, -1, 52.5, "12345678901234567890123456789012345678901234567890", "", 0, 54, 6, 70, 162, 112, "" }, - /* 73*/ { BARCODE_CODE16K, COMPLIANT_HEIGHT, 52.5, "12345678901234567890123456789012345678901234567890", "", ZINT_WARN_NONCOMPLIANT, 54, 6, 70, 162, 112, "" }, - /* 74*/ { BARCODE_CODE16K, COMPLIANT_HEIGHT, 53, "12345678901234567890123456789012345678901234567890", "", 0, 54, 6, 70, 162, 112, "" }, - /* 75*/ { BARCODE_CODE49, -1, -1, "1234567890", "", 0, 20, 2, 70, 162, 44, "2 rows" }, - /* 76*/ { BARCODE_CODE49, -1, 1, "1234567890", "", 0, 1, 2, 70, 162, 6, "" }, - /* 77*/ { BARCODE_CODE49, -1, 16.75, "1234567890", "", 0, 17, 2, 70, 162, 38, "" }, - /* 78*/ { BARCODE_CODE49, COMPLIANT_HEIGHT, 16.75, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 17, 2, 70, 162, 38, "" }, - /* 79*/ { BARCODE_CODE49, COMPLIANT_HEIGHT, 17, "1234567890", "", 0, 17, 2, 70, 162, 38, "" }, - /* 80*/ { BARCODE_CODE49, -1, -1, "12345678901234567890", "", 0, 30, 3, 70, 162, 64, "3 rows" }, - /* 81*/ { BARCODE_CODE49, -1, 25.75, "12345678901234567890", "", 0, 25.5, 3, 70, 162, 55, "" }, - /* 82*/ { BARCODE_CODE49, COMPLIANT_HEIGHT, 25.75, "12345678901234567890", "", ZINT_WARN_NONCOMPLIANT, 25.5, 3, 70, 162, 55, "" }, - /* 83*/ { BARCODE_CODE49, COMPLIANT_HEIGHT, 26, "12345678901234567890", "", 0, 25.5, 3, 70, 162, 55, "" }, - /* 84*/ { BARCODE_CODE93, -1, 1, "1234567890", "", 0, 1, 1, 127, 254, 2, "" }, - /* 85*/ { BARCODE_CODE93, -1, 9.9, "1", "", 0, 10, 1, 46, 92, 20, "" }, - /* 86*/ { BARCODE_CODE93, COMPLIANT_HEIGHT, 9.9, "1", "", ZINT_WARN_NONCOMPLIANT, 10, 1, 46, 92, 20, "Min height data-length dependent" }, - /* 87*/ { BARCODE_CODE93, COMPLIANT_HEIGHT, 10, "1", "", 0, 10, 1, 46, 92, 20, "" }, - /* 88*/ { BARCODE_CODE93, COMPLIANT_HEIGHT, 22, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 22, 1, 127, 254, 44, "Min height data-length dependent" }, - /* 89*/ { BARCODE_CODE93, COMPLIANT_HEIGHT, 22.1, "1234567890", "", 0, 22, 1, 127, 254, 44, "" }, - /* 90*/ { BARCODE_FLAT, -1, 1, "1234567890", "", 0, 1, 1, 90, 180, 2, "" }, - /* 91*/ { BARCODE_FLAT, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 90, 180, 2, "TODO: Find doc" }, - /* 92*/ { BARCODE_FLAT, -1, 4, "1234567890", "", 0, 4, 1, 90, 180, 8, "" }, - /* 93*/ { BARCODE_DBAR_OMN, -1, 1, "1234567890123", "", 0, 1, 1, 96, 192, 2, "" }, - /* 94*/ { BARCODE_DBAR_OMN, -1, 12.9, "1234567890123", "", 0, 13, 1, 96, 192, 26, "" }, - /* 95*/ { BARCODE_DBAR_OMN, COMPLIANT_HEIGHT, 12.9, "1234567890123", "", ZINT_WARN_NONCOMPLIANT, 13, 1, 96, 192, 26, "" }, - /* 96*/ { BARCODE_DBAR_OMN, COMPLIANT_HEIGHT, 13, "1234567890123", "", 0, 13, 1, 96, 192, 26, "" }, - /* 97*/ { BARCODE_DBAR_LTD, -1, 1, "1234567890123", "", 0, 1, 1, 79, 158, 2, "" }, - /* 98*/ { BARCODE_DBAR_LTD, -1, 9, "1234567890123", "", 0, 9, 1, 79, 158, 18, "" }, - /* 99*/ { BARCODE_DBAR_LTD, COMPLIANT_HEIGHT, 9, "1234567890123", "", ZINT_WARN_NONCOMPLIANT, 9, 1, 79, 158, 18, "" }, - /*100*/ { BARCODE_DBAR_LTD, COMPLIANT_HEIGHT, 10, "1234567890123", "", 0, 10, 1, 79, 158, 20, "" }, - /*101*/ { BARCODE_DBAR_EXP, -1, 1, "[01]12345678901231", "", 0, 1, 1, 134, 268, 2, "" }, - /*102*/ { BARCODE_DBAR_EXP, -1, 33, "[01]12345678901231", "", 0, 33, 1, 134, 268, 66, "" }, - /*103*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 33, "[01]12345678901231", "", ZINT_WARN_NONCOMPLIANT, 33, 1, 134, 268, 66, "" }, - /*104*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 34, "[01]12345678901231", "", 0, 34, 1, 134, 268, 68, "" }, - /*105*/ { BARCODE_TELEPEN, -1, 1, "1234567890", "", 0, 1, 1, 208, 416, 2, "" }, - /*106*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 208, 416, 2, "No known min" }, - /*107*/ { BARCODE_TELEPEN, -1, 4, "1234567890", "", 0, 4, 1, 208, 416, 8, "" }, - /*108*/ { BARCODE_UPCA, -1, 1, "12345678901", "", 0, 1, 1, 95, 226, 12, "" }, - /*109*/ { BARCODE_UPCA, -1, 69, "12345678901", "", 0, 69, 1, 95, 226, 148, "" }, - /*110*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, 69, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "" }, - /*111*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, 69.25, "12345678901", "", 0, 69.5, 1, 95, 226, 149, "" }, - /*112*/ { BARCODE_UPCA_CHK, -1, 1, "123456789012", "", 0, 1, 1, 95, 226, 12, "" }, - /*113*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, 69, "123456789012", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "" }, - /*114*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, 69.5, "123456789012", "", 0, 69.5, 1, 95, 226, 149, "" }, - /*115*/ { BARCODE_UPCE, -1, 1, "1234567", "", 0, 1, 1, 51, 134, 12, "" }, - /*116*/ { BARCODE_UPCE, -1, 69, "1234567", "", 0, 69, 1, 51, 134, 148, "" }, - /*117*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, 69, "1234567", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 51, 134, 148, "" }, - /*118*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, 69.25, "1234567", "", 0, 69.5, 1, 51, 134, 149, "" }, - /*119*/ { BARCODE_UPCE_CHK, -1, 1, "12345670", "", 0, 1, 1, 51, 134, 12, "" }, - /*120*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, 69.24, "12345670", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 51, 134, 148, "" }, - /*121*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, 69.25, "12345670", "", 0, 69.5, 1, 51, 134, 149, "" }, - /*122*/ { BARCODE_POSTNET, -1, -1, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /*123*/ { BARCODE_POSTNET, -1, 1, "12345678901", "", 0, 1, 2, 123, 246, 2, "" }, - /*124*/ { BARCODE_POSTNET, -1, 4.5, "12345678901", "", 0, 5, 2, 123, 246, 10, "" }, - /*125*/ { BARCODE_POSTNET, COMPLIANT_HEIGHT, 4.5, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 4.5, 2, 123, 246, 9, "" }, - /*126*/ { BARCODE_POSTNET, COMPLIANT_HEIGHT, 4.6, "12345678901", "", 0, 5, 2, 123, 246, 10, "" }, - /*127*/ { BARCODE_POSTNET, -1, 9, "12345678901", "", 0, 9, 2, 123, 246, 18, "" }, - /*128*/ { BARCODE_POSTNET, COMPLIANT_HEIGHT, 9, "12345678901", "", 0, 9, 2, 123, 246, 18, "" }, - /*129*/ { BARCODE_POSTNET, COMPLIANT_HEIGHT, 9.1, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 9, 2, 123, 246, 18, "" }, - /*130*/ { BARCODE_POSTNET, -1, 20, "12345678901", "", 0, 20, 2, 123, 246, 40, "" }, - /*131*/ { BARCODE_POSTNET, COMPLIANT_HEIGHT, 20, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 20, 2, 123, 246, 40, "" }, - /*132*/ { BARCODE_MSI_PLESSEY, -1, 1, "1234567890", "", 0, 1, 1, 127, 254, 2, "" }, - /*133*/ { BARCODE_MSI_PLESSEY, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 127, 254, 2, "TODO: Find doc" }, - /*134*/ { BARCODE_MSI_PLESSEY, -1, 4, "1234567890", "", 0, 4, 1, 127, 254, 8, "" }, - /*135*/ { BARCODE_FIM, -1, 1, "A", "", 0, 1, 1, 17, 34, 2, "" }, - /*136*/ { BARCODE_FIM, -1, 12.7, "A", "", 0, 12.5, 1, 17, 34, 25, "" }, - /*137*/ { BARCODE_FIM, COMPLIANT_HEIGHT, 12.7, "A", "", ZINT_WARN_NONCOMPLIANT, 12.5, 1, 17, 34, 25, "" }, - /*138*/ { BARCODE_FIM, COMPLIANT_HEIGHT, 12.8, "A", "", 0, 13, 1, 17, 34, 26, "" }, - /*139*/ { BARCODE_LOGMARS, -1, 1, "1234567890", "", 0, 1, 1, 191, 382, 2, "" }, - /*140*/ { BARCODE_LOGMARS, -1, 6, "1234567890", "", 0, 6, 1, 191, 382, 12, "" }, - /*141*/ { BARCODE_LOGMARS, COMPLIANT_HEIGHT, 6, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 6, 1, 191, 382, 12, "" }, - /*142*/ { BARCODE_LOGMARS, -1, 6.25, "1234567890", "", 0, 6.5, 1, 191, 382, 13, "" }, - /*143*/ { BARCODE_LOGMARS, COMPLIANT_HEIGHT, 6.25, "1234567890", "", 0, 6.5, 1, 191, 382, 13, "" }, - /*144*/ { BARCODE_LOGMARS, COMPLIANT_HEIGHT, 116, "1234567890", "", 0, 116, 1, 191, 382, 232, "" }, - /*145*/ { BARCODE_LOGMARS, COMPLIANT_HEIGHT, 117, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 117, 1, 191, 382, 234, "" }, - /*146*/ { BARCODE_PHARMA, -1, 1, "123456", "", 0, 1, 1, 58, 116, 2, "" }, - /*147*/ { BARCODE_PHARMA, -1, 15, "123456", "", 0, 15, 1, 58, 116, 30, "" }, - /*148*/ { BARCODE_PHARMA, COMPLIANT_HEIGHT, 15, "123456", "", ZINT_WARN_NONCOMPLIANT, 15, 1, 58, 116, 30, "" }, - /*149*/ { BARCODE_PHARMA, COMPLIANT_HEIGHT, 16, "123456", "", 0, 16, 1, 58, 116, 32, "" }, - /*150*/ { BARCODE_PZN, -1, 1, "123456", "", 0, 1, 1, 142, 284, 2, "" }, - /*151*/ { BARCODE_PZN, -1, 17.7, "123456", "", 0, 17.5, 1, 142, 284, 35, "" }, - /*152*/ { BARCODE_PZN, COMPLIANT_HEIGHT, 17.7, "123456", "", ZINT_WARN_NONCOMPLIANT, 17.5, 1, 142, 284, 35, "" }, - /*153*/ { BARCODE_PZN, COMPLIANT_HEIGHT, 17.8, "123456", "", 0, 18, 1, 142, 284, 36, "" }, - /*154*/ { BARCODE_PHARMA_TWO, -1, -1, "12345678", "", 0, 10, 2, 29, 58, 20, "" }, - /*155*/ { BARCODE_PHARMA_TWO, -1, 1, "12345678", "", 0, 1, 2, 29, 58, 2, "" }, - /*156*/ { BARCODE_PHARMA_TWO, -1, 3.9, "12345678", "", 0, 4, 2, 29, 58, 8, "" }, - /*157*/ { BARCODE_PHARMA_TWO, COMPLIANT_HEIGHT, 3.9, "12345678", "", ZINT_WARN_NONCOMPLIANT, 4, 2, 29, 58, 8, "" }, - /*158*/ { BARCODE_PHARMA_TWO, COMPLIANT_HEIGHT, 4, "12345678", "", 0, 4, 2, 29, 58, 8, "" }, - /*159*/ { BARCODE_PHARMA_TWO, -1, 15, "12345678", "", 0, 15, 2, 29, 58, 30, "" }, - /*160*/ { BARCODE_PHARMA_TWO, COMPLIANT_HEIGHT, 15, "12345678", "", 0, 15, 2, 29, 58, 30, "" }, - /*161*/ { BARCODE_PHARMA_TWO, COMPLIANT_HEIGHT, 15.1, "12345678", "", ZINT_WARN_NONCOMPLIANT, 15, 2, 29, 58, 30, "" }, - /*162*/ { BARCODE_CEPNET, -1, -1, "12345678", "", 0, 5, 2, 93, 186, 10, "" }, - /*163*/ { BARCODE_CEPNET, -1, 1, "12345678", "", 0, 1.5, 2, 93, 186, 3, "" }, - /*164*/ { BARCODE_CEPNET, -1, 4.5, "12345678", "", 0, 4.5, 2, 93, 186, 9, "" }, - /*165*/ { BARCODE_CEPNET, COMPLIANT_HEIGHT, 4.5, "12345678", "", ZINT_WARN_NONCOMPLIANT, 4.5, 2, 93, 186, 9, "" }, - /*166*/ { BARCODE_CEPNET, COMPLIANT_HEIGHT, 4.6, "12345678", "", 0, 5, 2, 93, 186, 10, "" }, - /*167*/ { BARCODE_CEPNET, -1, 9, "12345678", "", 0, 9, 2, 93, 186, 18, "" }, - /*168*/ { BARCODE_CEPNET, COMPLIANT_HEIGHT, 9, "12345678", "", 0, 9, 2, 93, 186, 18, "" }, - /*169*/ { BARCODE_CEPNET, COMPLIANT_HEIGHT, 9.1, "12345678", "", ZINT_WARN_NONCOMPLIANT, 9, 2, 93, 186, 18, "" }, - /*170*/ { BARCODE_CEPNET, -1, 20, "12345678", "", 0, 20, 2, 93, 186, 40, "" }, - /*171*/ { BARCODE_CEPNET, COMPLIANT_HEIGHT, 20, "12345678", "", ZINT_WARN_NONCOMPLIANT, 20, 2, 93, 186, 40, "" }, - /*172*/ { BARCODE_PDF417, -1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 4, 8, 120, 240, 8, "8 rows" }, - /*173*/ { BARCODE_PDF417, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 4, 8, 120, 240, 8, "" }, - /*174*/ { BARCODE_PDF417, -1, 9, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 8, 8, 120, 240, 16, "" }, - /*175*/ { BARCODE_PDF417, -1, 10, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 12, 8, 120, 240, 24, "" }, - /*176*/ { BARCODE_PDF417, -1, 11, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 12, 8, 120, 240, 24, "" }, - /*177*/ { BARCODE_PDF417, -1, 12, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 12, 8, 120, 240, 24, "" }, - /*178*/ { BARCODE_PDF417, -1, 13, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 12, 8, 120, 240, 24, "" }, - /*179*/ { BARCODE_PDF417, -1, 14, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 16, 8, 120, 240, 32, "" }, - /*180*/ { BARCODE_PDF417, -1, 15, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 16, 8, 120, 240, 32, "" }, - /*181*/ { BARCODE_PDF417, -1, 16, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 16, 8, 120, 240, 32, "" }, - /*182*/ { BARCODE_PDF417, -1, 17, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 16, 8, 120, 240, 32, "" }, - /*183*/ { BARCODE_PDF417, -1, 18, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 8, 120, 240, 40, "" }, - /*184*/ { BARCODE_PDF417, -1, 19, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 8, 120, 240, 40, "" }, - /*185*/ { BARCODE_PDF417, -1, 20, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 8, 120, 240, 40, "" }, - /*186*/ { BARCODE_PDF417, -1, 21, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 8, 120, 240, 40, "" }, - /*187*/ { BARCODE_PDF417, -1, 22, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 24, 8, 120, 240, 48, "" }, - /*188*/ { BARCODE_PDF417, -1, 23, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 24, 8, 120, 240, 48, "" }, - /*189*/ { BARCODE_PDF417, -1, 24, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 24, 8, 120, 240, 48, "" }, - /*190*/ { BARCODE_PDF417, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 36, 12, 120, 240, 72, "12 rows" }, - /*191*/ { BARCODE_PDF417, -1, 12, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 12, 12, 120, 240, 24, "" }, - /*192*/ { BARCODE_PDF417COMP, -1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ", "", ZINT_WARN_NONCOMPLIANT, 4.5, 9, 86, 172, 9, "9 rows" }, - /*193*/ { BARCODE_PDF417COMP, -1, 24, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ", "", ZINT_WARN_NONCOMPLIANT, 22.5, 9, 86, 172, 45, "" }, - /*194*/ { BARCODE_MAXICODE, -1, 1, "1234567890", "", 0, 16.5, 33, 30, 299, 298, "Fixed size, symbol->height ignored" }, - /*195*/ { BARCODE_QRCODE, -1, 1, "ABCD", "", 0, 21, 21, 21, 42, 42, "Fixed width-to-height ratio, symbol->height ignored" }, - /*196*/ { BARCODE_CODE128AB, -1, 1, "1234567890", "", 0, 1, 1, 145, 290, 2, "" }, - /*197*/ { BARCODE_CODE128AB, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 145, 290, 2, "" }, - /*198*/ { BARCODE_CODE128AB, -1, 4, "1234567890", "", 0, 4, 1, 145, 290, 8, "" }, - /*199*/ { BARCODE_AUSPOST, -1, -1, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16, "" }, - /*200*/ { BARCODE_AUSPOST, -1, 1, "12345678901234567890123", "", 0, 2.5, 3, 133, 266, 5, "" }, - /*201*/ { BARCODE_AUSPOST, COMPLIANT_HEIGHT, 1, "12345678901234567890123", "", ZINT_WARN_NONCOMPLIANT, 1.5, 3, 133, 266, 3, "" }, - /*202*/ { BARCODE_AUSPOST, -1, 6.9, "12345678901234567890123", "", 0, 6.5, 3, 133, 266, 13, "" }, - /*203*/ { BARCODE_AUSPOST, COMPLIANT_HEIGHT, 6.9, "12345678901234567890123", "", ZINT_WARN_NONCOMPLIANT, 7, 3, 133, 266, 14, "" }, - /*204*/ { BARCODE_AUSPOST, COMPLIANT_HEIGHT, 7, "12345678901234567890123", "", 0, 7, 3, 133, 266, 14, "" }, - /*205*/ { BARCODE_AUSPOST, -1, 14, "12345678901234567890123", "", 0, 14.5, 3, 133, 266, 29, "" }, - /*206*/ { BARCODE_AUSPOST, COMPLIANT_HEIGHT, 14, "12345678901234567890123", "", 0, 13.5, 3, 133, 266, 27, "" }, - /*207*/ { BARCODE_AUSPOST, COMPLIANT_HEIGHT, 14.1, "12345678901234567890123", "", ZINT_WARN_NONCOMPLIANT, 13.5, 3, 133, 266, 27, "" }, - /*208*/ { BARCODE_AUSREPLY, -1, 14, "12345678", "", 0, 14.5, 3, 73, 146, 29, "" }, - /*209*/ { BARCODE_AUSREPLY, COMPLIANT_HEIGHT, 14, "12345678", "", 0, 13.5, 3, 73, 146, 27, "" }, - /*210*/ { BARCODE_AUSREPLY, COMPLIANT_HEIGHT, 14.25, "12345678", "", ZINT_WARN_NONCOMPLIANT, 14.5, 3, 73, 146, 29, "" }, - /*211*/ { BARCODE_AUSROUTE, -1, 7, "12345678", "", 0, 7, 3, 73, 146, 14, "" }, - /*212*/ { BARCODE_AUSROUTE, COMPLIANT_HEIGHT, 7, "12345678", "", 0, 7, 3, 73, 146, 14, "" }, - /*213*/ { BARCODE_AUSREDIRECT, -1, 14, "12345678", "", 0, 14.5, 3, 73, 146, 29, "" }, - /*214*/ { BARCODE_AUSREDIRECT, COMPLIANT_HEIGHT, 14, "12345678", "", 0, 13.5, 3, 73, 146, 27, "" }, - /*215*/ { BARCODE_ISBNX, -1, 1, "123456789", "", 0, 1, 1, 95, 226, 12, "" }, - /*216*/ { BARCODE_ISBNX, -1, 69, "123456789", "", 0, 69, 1, 95, 226, 148, "" }, - /*217*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, 69, "123456789", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "" }, - /*218*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, 69.5, "123456789", "", 0, 69.5, 1, 95, 226, 149, "" }, - /*219*/ { BARCODE_RM4SCC, -1, -1, "1234567890", "", 0, 8, 3, 91, 182, 16, "" }, - /*220*/ { BARCODE_RM4SCC, -1, 1, "1234567890", "", 0, 2.5, 3, 91, 182, 5, "" }, - /*221*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, 1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 1.5, 3, 91, 182, 3, "" }, - /*222*/ { BARCODE_RM4SCC, -1, 4, "1234567890", "", 0, 4, 3, 91, 182, 8, "" }, - /*223*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, 4, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 4, 3, 91, 182, 8, "" }, - /*224*/ { BARCODE_RM4SCC, -1, 6, "1234567890", "", 0, 6.5, 3, 91, 182, 13, "" }, - /*225*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, 6, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 5.5, 3, 91, 182, 11, "" }, - /*226*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, 6.5, "1234567890", "", 0, 6.5, 3, 91, 182, 13, "" }, - /*227*/ { BARCODE_RM4SCC, -1, 10.8, "1234567890", "", 0, 10.5, 3, 91, 182, 21, "" }, - /*228*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, 10.8, "1234567890", "", 0, 11, 3, 91, 182, 22, "" }, - /*229*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, 11, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 11, 3, 91, 182, 22, "" }, - /*230*/ { BARCODE_RM4SCC, -1, 16, "1234567890", "", 0, 16, 3, 91, 182, 32, "" }, - /*231*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, 16, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 16, 3, 91, 182, 32, "" }, - /*232*/ { BARCODE_DATAMATRIX, -1, 1, "ABCD", "", 0, 12, 12, 12, 24, 24, "Fixed width-to-height ratio, symbol->height ignored" }, - /*233*/ { BARCODE_EAN14, -1, 1, "1234567890123", "", 0, 1, 1, 134, 268, 2, "" }, - /*234*/ { BARCODE_EAN14, -1, 5.7, "1234567890123", "", 0, 5.5, 1, 134, 268, 11, "" }, - /*235*/ { BARCODE_EAN14, COMPLIANT_HEIGHT, 5.7, "1234567890123", "", ZINT_WARN_NONCOMPLIANT, 5.5, 1, 134, 268, 11, "" }, - /*236*/ { BARCODE_EAN14, COMPLIANT_HEIGHT, 5.8, "1234567890123", "", 0, 6, 1, 134, 268, 12, "" }, - /*237*/ { BARCODE_VIN, -1, 1, "12345678701234567", "", 0, 1, 1, 246, 492, 2, "" }, - /*238*/ { BARCODE_VIN, COMPLIANT_HEIGHT, 1, "12345678701234567", "", 0, 1, 1, 246, 492, 2, "Doc unlikely" }, - /*239*/ { BARCODE_VIN, -1, 4, "12345678701234567", "", 0, 4, 1, 246, 492, 8, "" }, - /*240*/ { BARCODE_CODABLOCKF, -1, -1, "1234567890", "", 0, 20, 2, 101, 242, 44, "2 rows" }, - /*241*/ { BARCODE_CODABLOCKF, -1, 1, "1234567890", "", 0, 1, 2, 101, 242, 6, "" }, - /*242*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 1, 2, 101, 242, 6, "" }, - /*243*/ { BARCODE_CODABLOCKF, -1, 15.5, "1234567890", "", 0, 16, 2, 101, 242, 36, "" }, - /*244*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 15.5, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 16, 2, 101, 242, 36, "" }, - /*245*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 16, "1234567890", "", 0, 16, 2, 101, 242, 36, "" }, - /*246*/ { BARCODE_CODABLOCKF, -1, -1, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 110, 11, 156, 352, 224, "11 rows, 14 cols" }, - /*247*/ { BARCODE_CODABLOCKF, -1, 87, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 88, 11, 156, 352, 180, "" }, - /*248*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 87, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", ZINT_WARN_NONCOMPLIANT, 88, 11, 156, 352, 180, "" }, - /*249*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 88, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 88, 11, 156, 352, 180, "" }, - /*250*/ { BARCODE_CODABLOCKF, -1, 220, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 220, 11, 156, 352, 444, "" }, - /*251*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 220, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 220, 11, 156, 352, 444, "" }, - /*252*/ { BARCODE_CODABLOCKF, -1, -1, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv", "", 0, 110, 11, 167, 374, 224, "11 rows, 15 cols" }, - /*253*/ { BARCODE_CODABLOCKF, -1, 93, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv", "", 0, 93.5, 11, 167, 374, 191, "" }, - /*254*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 93, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv", "", ZINT_WARN_NONCOMPLIANT, 93.5, 11, 167, 374, 191, "" }, - /*255*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 93.5, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv", "", 0, 93.5, 11, 167, 374, 191, "" }, - /*256*/ { BARCODE_NVE18, -1, 1, "12345678901234567", "", 0, 1, 1, 156, 312, 2, "" }, - /*257*/ { BARCODE_NVE18, -1, 5.7, "12345678901234567", "", 0, 5.5, 1, 156, 312, 11, "" }, - /*258*/ { BARCODE_NVE18, COMPLIANT_HEIGHT, 5.7, "12345678901234567", "", ZINT_WARN_NONCOMPLIANT, 5.5, 1, 156, 312, 11, "" }, - /*259*/ { BARCODE_NVE18, COMPLIANT_HEIGHT, 5.8, "12345678901234567", "", 0, 6, 1, 156, 312, 12, "" }, - /*260*/ { BARCODE_JAPANPOST, -1, -1, "1234567890", "", 0, 8, 3, 133, 266, 16, "" }, - /*261*/ { BARCODE_JAPANPOST, -1, 1, "1234567890", "", 0, 2.5, 3, 133, 266, 5, "" }, - /*262*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, 1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 1.5, 3, 133, 266, 3, "" }, - /*263*/ { BARCODE_JAPANPOST, -1, 4.8, "1234567890", "", 0, 5, 3, 133, 266, 10, "" }, - /*264*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, 4.8, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 4.5, 3, 133, 266, 9, "" }, - /*265*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, 4.9, "1234567890", "", 0, 4.5, 3, 133, 266, 9, "" }, - /*266*/ { BARCODE_JAPANPOST, -1, 7, "1234567890", "", 0, 7, 3, 133, 266, 14, "" }, - /*267*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, 7, "1234567890", "", 0, 7.5, 3, 133, 266, 15, "" }, - /*268*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, 7.5, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 7.5, 3, 133, 266, 15, "" }, - /*269*/ { BARCODE_JAPANPOST, -1, 16, "1234567890", "", 0, 16, 3, 133, 266, 32, "" }, - /*270*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, 16, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 16.5, 3, 133, 266, 33, "" }, - /*271*/ { BARCODE_KOREAPOST, -1, 1, "123456", "", 0, 1, 1, 167, 334, 2, "" }, - /*272*/ { BARCODE_KOREAPOST, COMPLIANT_HEIGHT, 1, "123456", "", 0, 1, 1, 167, 334, 2, "TODO: Find doc" }, - /*273*/ { BARCODE_KOREAPOST, -1, 4, "123456", "", 0, 4, 1, 167, 334, 8, "" }, - /*274*/ { BARCODE_DBAR_STK, -1, -1, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, - /*275*/ { BARCODE_DBAR_STK, -1, 1, "1234567890123", "", 0, 2, 3, 50, 100, 4, "" }, - /*276*/ { BARCODE_DBAR_STK, -1, 12, "1234567890123", "", 0, 12, 3, 50, 100, 24, "" }, - /*277*/ { BARCODE_DBAR_STK, COMPLIANT_HEIGHT, 12, "1234567890123", "", ZINT_WARN_NONCOMPLIANT, 12, 3, 50, 100, 24, "" }, - /*278*/ { BARCODE_DBAR_STK, COMPLIANT_HEIGHT, 13, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, - /*279*/ { BARCODE_DBAR_OMNSTK, -1, -1, "1234567890123", "", 0, 69, 5, 50, 100, 138, "" }, - /*280*/ { BARCODE_DBAR_OMNSTK, -1, 1, "1234567890123", "", 0, 4, 5, 50, 100, 8, "" }, - /*281*/ { BARCODE_DBAR_OMNSTK, -1, 68, "1234567890123", "", 0, 68, 5, 50, 100, 136, "" }, - /*282*/ { BARCODE_DBAR_OMNSTK, COMPLIANT_HEIGHT, 68, "1234567890123", "", ZINT_WARN_NONCOMPLIANT, 68, 5, 50, 100, 136, "" }, - /*283*/ { BARCODE_DBAR_OMNSTK, COMPLIANT_HEIGHT, 69, "1234567890123", "", 0, 69, 5, 50, 100, 138, "" }, - /*284*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142, "2 rows" }, - /*285*/ { BARCODE_DBAR_EXPSTK, -1, 1, "[01]12345678901231", "", 0, 4, 5, 102, 204, 8, "" }, - /*286*/ { BARCODE_DBAR_EXPSTK, -1, 70, "[01]12345678901231", "", 0, 70, 5, 102, 204, 140, "" }, - /*287*/ { BARCODE_DBAR_EXPSTK, COMPLIANT_HEIGHT, 70, "[01]12345678901231", "", ZINT_WARN_NONCOMPLIANT, 70, 5, 102, 204, 140, "" }, - /*288*/ { BARCODE_DBAR_EXPSTK, COMPLIANT_HEIGHT, 71, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142, "" }, - /*289*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "3 rows" }, - /*290*/ { BARCODE_DBAR_EXPSTK, -1, 1, "[01]09501101530003[3920]123456789012345", "", 0, 7.5, 9, 102, 204, 15, "" }, - /*291*/ { BARCODE_DBAR_EXPSTK, -1, 107.5, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "" }, - /*292*/ { BARCODE_DBAR_EXPSTK, COMPLIANT_HEIGHT, 107.5, "[01]09501101530003[3920]123456789012345", "", ZINT_WARN_NONCOMPLIANT, 108, 9, 102, 204, 216, "" }, - /*293*/ { BARCODE_DBAR_EXPSTK, COMPLIANT_HEIGHT, 108, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "" }, - /*294*/ { BARCODE_PLANET, -1, -1, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /*295*/ { BARCODE_PLANET, -1, 1, "12345678901", "", 0, 1, 2, 123, 246, 2, "" }, - /*296*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, 1, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 1.5, 2, 123, 246, 3, "" }, - /*297*/ { BARCODE_PLANET, -1, 4.5, "12345678901", "", 0, 5, 2, 123, 246, 10, "" }, - /*298*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, 4.5, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 4.5, 2, 123, 246, 9, "" }, - /*299*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, 4.6, "12345678901", "", 0, 5, 2, 123, 246, 10, "" }, - /*300*/ { BARCODE_PLANET, -1, 9, "12345678901", "", 0, 9, 2, 123, 246, 18, "" }, - /*301*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, 9, "12345678901", "", 0, 9, 2, 123, 246, 18, "" }, - /*302*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, 9.1, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 9, 2, 123, 246, 18, "" }, - /*303*/ { BARCODE_PLANET, -1, 24, "12345678901", "", 0, 24, 2, 123, 246, 48, "" }, - /*304*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, 24, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 24, 2, 123, 246, 48, "" }, - /*305*/ { BARCODE_MICROPDF417, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 20, 10, 82, 164, 40, "10 rows" }, - /*306*/ { BARCODE_MICROPDF417, -1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 5, 10, 82, 164, 10, "" }, - /*307*/ { BARCODE_MICROPDF417, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 5, 10, 82, 164, 10, "" }, - /*308*/ { BARCODE_MICROPDF417, -1, 19, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 10, 82, 164, 40, "" }, - /*309*/ { BARCODE_MICROPDF417, -1, 30, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 30, 10, 82, 164, 60, "" }, - /*310*/ { BARCODE_MICROPDF417, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 40, 20, 55, 110, 80, "20 rows" }, - /*311*/ { BARCODE_MICROPDF417, -1, 20, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 20, 55, 110, 40, "" }, - /*312*/ { BARCODE_USPS_IMAIL, -1, -1, "12345678901234567890", "", 0, 8, 3, 129, 258, 16, "" }, - /*313*/ { BARCODE_USPS_IMAIL, -1, 1, "12345678901234567890", "", 0, 2.5, 3, 129, 258, 5, "" }, - /*314*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 1, "12345678901234567890", "", ZINT_WARN_NONCOMPLIANT, 1.5, 3, 129, 258, 3, "" }, - /*315*/ { BARCODE_USPS_IMAIL, -1, 4.8, "12345678901234567890", "", 0, 5, 3, 129, 258, 10, "" }, - /*316*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 4.8, "12345678901234567890", "", ZINT_WARN_NONCOMPLIANT, 4.5, 3, 129, 258, 9, "" }, - /*317*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 4.9, "12345678901234567890", "", 0, 4.5, 3, 129, 258, 9, "" }, - /*318*/ { BARCODE_USPS_IMAIL, -1, 7.7, "12345678901234567890", "", 0, 8, 3, 129, 258, 16, "" }, - /*319*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 7.7, "12345678901234567890", "", 0, 7.5, 3, 129, 258, 15, "" }, - /*320*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 7.8, "12345678901234567890", "", ZINT_WARN_NONCOMPLIANT, 7.5, 3, 129, 258, 15, "" }, - /*321*/ { BARCODE_PLESSEY, -1, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "" }, - /*322*/ { BARCODE_PLESSEY, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "TODO: Find doc" }, - /*323*/ { BARCODE_PLESSEY, -1, 4, "1234567890", "", 0, 4, 1, 227, 454, 8, "" }, - /*324*/ { BARCODE_TELEPEN_NUM, -1, 1, "1234567890", "", 0, 1, 1, 128, 256, 2, "" }, - /*325*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 128, 256, 2, "No known min" }, - /*326*/ { BARCODE_TELEPEN_NUM, -1, 4, "1234567890", "", 0, 4, 1, 128, 256, 8, "" }, - /*327*/ { BARCODE_ITF14, -1, 1, "1234567890", "", 0, 1, 1, 135, 330, 22, "" }, - /*328*/ { BARCODE_ITF14, -1, 5.7, "1234567890", "", 0, 5.5, 1, 135, 330, 31, "" }, - /*329*/ { BARCODE_ITF14, COMPLIANT_HEIGHT, 5.7, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 5.5, 1, 135, 330, 31, "" }, - /*330*/ { BARCODE_ITF14, COMPLIANT_HEIGHT, 5.8, "1234567890", "", 0, 6, 1, 135, 330, 32, "" }, - /*331*/ { BARCODE_KIX, -1, -1, "1234567890", "", 0, 8, 3, 79, 158, 16, "" }, - /*332*/ { BARCODE_KIX, -1, 1, "1234567890", "", 0, 2.5, 3, 79, 158, 5, "" }, - /*333*/ { BARCODE_KIX, COMPLIANT_HEIGHT, 1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 1.5, 3, 79, 158, 3, "" }, - /*334*/ { BARCODE_KIX, -1, 6.4, "1234567890", "", 0, 6.5, 3, 79, 158, 13, "" }, - /*335*/ { BARCODE_KIX, COMPLIANT_HEIGHT, 6.4, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 6.5, 3, 79, 158, 13, "" }, - /*336*/ { BARCODE_KIX, COMPLIANT_HEIGHT, 6.5, "1234567890", "", 0, 6.5, 3, 79, 158, 13, "" }, - /*337*/ { BARCODE_KIX, -1, 10.8, "1234567890", "", 0, 10.5, 3, 79, 158, 21, "" }, - /*338*/ { BARCODE_KIX, COMPLIANT_HEIGHT, 10.8, "1234567890", "", 0, 11, 3, 79, 158, 22, "" }, - /*339*/ { BARCODE_KIX, COMPLIANT_HEIGHT, 10.9, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 11, 3, 79, 158, 22, "" }, - /*340*/ { BARCODE_KIX, -1, 16, "1234567890", "", 0, 16, 3, 79, 158, 32, "" }, - /*341*/ { BARCODE_KIX, COMPLIANT_HEIGHT, 16, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 16, 3, 79, 158, 32, "" }, - /*342*/ { BARCODE_AZTEC, -1, 1, "1234567890AB", "", 0, 15, 15, 15, 30, 30, "Fixed width-to-height ratio, symbol->height ignored" }, - /*343*/ { BARCODE_DAFT, -1, -1, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16, "" }, - /*344*/ { BARCODE_DAFT, -1, 1, "DAFTDAFTDAFTDAFT", "", 0, 2.5, 3, 31, 62, 5, "" }, - /*345*/ { BARCODE_DAFT, COMPLIANT_HEIGHT, 1, "DAFTDAFTDAFTDAFT", "", 0, 2.5, 3, 31, 62, 5, "" }, - /*346*/ { BARCODE_DAFT, -1, 4, "DAFTDAFTDAFTDAFT", "", 0, 4, 3, 31, 62, 8, "" }, - /*347*/ { BARCODE_DAFT, -1, 6, "DAFTDAFTDAFTDAFT", "", 0, 6.5, 3, 31, 62, 13, "" }, - /*348*/ { BARCODE_DAFT, -1, 12, "DAFTDAFTDAFTDAFT", "", 0, 12, 3, 31, 62, 24, "" }, - /*349*/ { BARCODE_DAFT, -1, 16, "DAFTDAFTDAFTDAFT", "", 0, 16, 3, 31, 62, 32, "" }, - /*350*/ { BARCODE_DAFT, COMPLIANT_HEIGHT, 16, "DAFTDAFTDAFTDAFT", "", 0, 16, 3, 31, 62, 32, "" }, - /*351*/ { BARCODE_DPD, -1, 1, "0123456789012345678901234567", "", 0, 1, 1, 189, 378, 8, "" }, - /*352*/ { BARCODE_DPD, -1, 62, "0123456789012345678901234567", "", 0, 62, 1, 189, 378, 130, "" }, - /*353*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62, "0123456789012345678901234567", "", ZINT_WARN_NONCOMPLIANT, 62, 1, 189, 378, 130, "" }, - /*354*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62.5, "0123456789012345678901234567", "", 0, 62.5, 1, 189, 378, 131, "" }, - /*355*/ { BARCODE_MICROQR, -1, 1, "12345", "", 0, 11, 11, 11, 22, 22, "Fixed width-to-height ratio, symbol->height ignored" }, - /*356*/ { BARCODE_HIBC_128, -1, 1, "1234567890", "", 0, 1, 1, 123, 246, 2, "" }, - /*357*/ { BARCODE_HIBC_128, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 123, 246, 2, "" }, - /*358*/ { BARCODE_HIBC_128, -1, 4, "1234567890", "", 0, 4, 1, 123, 246, 8, "" }, - /*359*/ { BARCODE_HIBC_39, -1, 1, "1234567890", "", 0, 1, 1, 223, 446, 2, "" }, - /*360*/ { BARCODE_HIBC_39, COMPLIANT_HEIGHT, 1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 1, 1, 223, 446, 2, "" }, - /*361*/ { BARCODE_HIBC_39, -1, 4, "1234567890", "", 0, 4, 1, 223, 446, 8, "" }, - /*362*/ { BARCODE_HIBC_DM, -1, 1, "ABC", "", 0, 12, 12, 12, 24, 24, "Fixed width-to-height ratio, symbol->height ignored" }, - /*363*/ { BARCODE_HIBC_QR, -1, 1, "1234567890AB", "", 0, 21, 21, 21, 42, 42, "Fixed width-to-height ratio, symbol->height ignored" }, - /*364*/ { BARCODE_HIBC_PDF, -1, -1, "ABCDEF", "", 0, 21, 7, 103, 206, 42, "7 rows" }, - /*365*/ { BARCODE_HIBC_PDF, -1, 1, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 3.5, 7, 103, 206, 7, "" }, - /*366*/ { BARCODE_HIBC_PDF, -1, 4, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 3.5, 7, 103, 206, 7, "" }, - /*367*/ { BARCODE_HIBC_PDF, -1, 36, "ABCDEF", "", 0, 35, 7, 103, 206, 70, "" }, - /*368*/ { BARCODE_HIBC_MICPDF, -1, -1, "ABCDEF", "", 0, 12, 6, 82, 164, 24, "6 rows" }, - /*369*/ { BARCODE_HIBC_MICPDF, -1, 1, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 3, 6, 82, 164, 6, "" }, - /*370*/ { BARCODE_HIBC_MICPDF, -1, 4, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 3, 6, 82, 164, 6, "" }, - /*371*/ { BARCODE_HIBC_MICPDF, -1, 47, "ABCDEF", "", 0, 48, 6, 82, 164, 96, "" }, - /*372*/ { BARCODE_HIBC_BLOCKF, -1, -1, "1234567890", "", 0, 30, 3, 101, 242, 64, "3 rows" }, - /*373*/ { BARCODE_HIBC_BLOCKF, -1, 1, "1234567890", "", 0, 1.5, 3, 101, 242, 7, "" }, - /*374*/ { BARCODE_HIBC_BLOCKF, COMPLIANT_HEIGHT, 1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 1.5, 3, 101, 242, 7, "" }, - /*375*/ { BARCODE_HIBC_BLOCKF, -1, 4, "1234567890", "", 0, 4.5, 3, 101, 242, 13, "" }, - /*376*/ { BARCODE_HIBC_BLOCKF, COMPLIANT_HEIGHT, 4, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 4.5, 3, 101, 242, 13, "" }, - /*377*/ { BARCODE_HIBC_BLOCKF, -1, 23, "1234567890", "", 0, 22.5, 3, 101, 242, 49, "" }, - /*378*/ { BARCODE_HIBC_BLOCKF, COMPLIANT_HEIGHT, 23, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 22.5, 3, 101, 242, 49, "" }, - /*379*/ { BARCODE_HIBC_BLOCKF, COMPLIANT_HEIGHT, 24, "1234567890", "", 0, 24, 3, 101, 242, 52, "" }, - /*380*/ { BARCODE_HIBC_BLOCKF, -1, 60, "1234567890", "", 0, 60, 3, 101, 242, 124, "" }, - /*381*/ { BARCODE_HIBC_BLOCKF, COMPLIANT_HEIGHT, 60, "1234567890", "", 0, 60, 3, 101, 242, 124, "" }, - /*382*/ { BARCODE_HIBC_AZTEC, -1, 1, "1234567890AB", "", 0, 19, 19, 19, 38, 38, "Fixed width-to-height ratio, symbol->height ignored" }, - /*383*/ { BARCODE_DOTCODE, -1, 1, "ABC", "", 0, 11, 11, 16, 33, 23, "Fixed width-to-height ratio, symbol->height ignored" }, - /*384*/ { BARCODE_HANXIN, -1, 1, "1234567890AB", "", 0, 23, 23, 23, 46, 46, "Fixed width-to-height ratio, symbol->height ignored" }, - /*385*/ { BARCODE_MAILMARK_2D, -1, 1, "012100123412345678AB19XY1A 0", "", 0, 24, 24, 24, 48, 48, "Fixed width-to-height ratio, symbol->height ignored" }, - /*386*/ { BARCODE_UPU_S10, -1, 1, "EE876543216CA", "", 0, 1, 1, 156, 312, 2, "" }, - /*387*/ { BARCODE_UPU_S10, COMPLIANT_HEIGHT, 1, "EE876543216CA", "", ZINT_WARN_NONCOMPLIANT, 1, 1, 156, 312, 2, "" }, - /*388*/ { BARCODE_UPU_S10, -1, 24.5, "EE876543216CA", "", 0, 24.5, 1, 156, 312, 49, "" }, - /*389*/ { BARCODE_UPU_S10, COMPLIANT_HEIGHT, 24.5, "EE876543216CA", "", ZINT_WARN_NONCOMPLIANT, 24.5, 1, 156, 312, 49, "" }, - /*390*/ { BARCODE_UPU_S10, -1, 25, "EE876543216CA", "", 0, 25, 1, 156, 312, 50, "" }, - /*391*/ { BARCODE_UPU_S10, COMPLIANT_HEIGHT, 25, "EE876543216CA", "", 0, 25, 1, 156, 312, 50, "" }, - /*392*/ { BARCODE_MAILMARK_4S, -1, -1, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, - /*393*/ { BARCODE_MAILMARK_4S, -1, 1, "01000000000000000AA00AA0A", "", 0, 2.5, 3, 155, 310, 5, "" }, - /*394*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, 1, "01000000000000000AA00AA0A", "", ZINT_WARN_NONCOMPLIANT, 1.5, 3, 155, 310, 3, "" }, - /*395*/ { BARCODE_MAILMARK_4S, -1, 6.4, "01000000000000000AA00AA0A", "", 0, 6.5, 3, 155, 310, 13, "" }, - /*396*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, 6.4, "01000000000000000AA00AA0A", "", ZINT_WARN_NONCOMPLIANT, 6.5, 3, 155, 310, 13, "" }, - /*397*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, 6.5, "01000000000000000AA00AA0A", "", 0, 6.5, 3, 155, 310, 13, "" }, - /*398*/ { BARCODE_MAILMARK_4S, -1, 10, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, - /*399*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, 10, "01000000000000000AA00AA0A", "", 0, 9.5, 3, 155, 310, 19, "" }, - /*400*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, 11, "01000000000000000AA00AA0A", "", ZINT_WARN_NONCOMPLIANT, 11, 3, 155, 310, 22, "" }, - /*401*/ { BARCODE_MAILMARK_4S, -1, 15, "01000000000000000AA00AA0A", "", 0, 15, 3, 155, 310, 30, "" }, - /*402*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, 15, "01000000000000000AA00AA0A", "", ZINT_WARN_NONCOMPLIANT, 15, 3, 155, 310, 30, "" }, - /*403*/ { BARCODE_MAILMARK_4S, -1, 20, "01000000000000000AA00AA0A", "", 0, 20, 3, 155, 310, 40, "" }, - /*404*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, 20, "01000000000000000AA00AA0A", "", ZINT_WARN_NONCOMPLIANT, 20, 3, 155, 310, 40, "" }, - /*405*/ { BARCODE_AZRUNE, -1, 1, "1", "", 0, 11, 11, 11, 22, 22, "Fixed width-to-height ratio, symbol->height ignored" }, - /*406*/ { BARCODE_CODE32, -1, 1, "12345678", "", 0, 1, 1, 103, 206, 2, "" }, - /*407*/ { BARCODE_CODE32, COMPLIANT_HEIGHT, 1, "12345678", "", ZINT_WARN_NONCOMPLIANT, 1, 1, 103, 206, 2, "" }, - /*408*/ { BARCODE_CODE32, -1, 19, "12345678", "", 0, 19, 1, 103, 206, 38, "" }, - /*409*/ { BARCODE_CODE32, COMPLIANT_HEIGHT, 19, "12345678", "", ZINT_WARN_NONCOMPLIANT, 19, 1, 103, 206, 38, "" }, - /*410*/ { BARCODE_CODE32, COMPLIANT_HEIGHT, 20, "12345678", "", 0, 20, 1, 103, 206, 40, "" }, - /*411*/ { BARCODE_EANX_CC, -1, -1, "123456789012", "[20]01", 0, 50, 7, 99, 226, 110, "EAN-13, CC-A 3 rows" }, - /*412*/ { BARCODE_EANX_CC, -1, 1, "123456789012", "[20]01", 0, 12.5, 7, 99, 226, 35, "" }, - /*413*/ { BARCODE_EANX_CC, -1, 81, "123456789012", "[20]01", 0, 81, 7, 99, 226, 172, "" }, - /*414*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 81, "123456789012", "[20]01", ZINT_WARN_NONCOMPLIANT, 81, 7, 99, 226, 172, "" }, - /*415*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 81.25, "123456789012", "[20]01", 0, 81.5, 7, 99, 226, 173, "" }, - /*416*/ { BARCODE_EANX_CC, -1, -1, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 50, 9, 99, 226, 110, "EAN-13, CC-A 5 rows" }, - /*417*/ { BARCODE_EANX_CC, -1, 1, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 16.5, 9, 99, 226, 43, "" }, - /*418*/ { BARCODE_EANX_CC, -1, 85, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 85, 9, 99, 226, 180, "" }, - /*419*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 85, "123456789012", "[20]01[90]123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, 85, 9, 99, 226, 180, "" }, - /*420*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 85.25, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 85.5, 9, 99, 226, 181, "" }, - /*421*/ { BARCODE_EANX_CC, -1, -1, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 50, 11, 99, 226, 110, "EAN-13, CC-A 7 rows" }, - /*422*/ { BARCODE_EANX_CC, -1, 1, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 20.5, 11, 99, 226, 51, "" }, - /*423*/ { BARCODE_EANX_CC, -1, 89, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 89, 11, 99, 226, 188, "" }, - /*424*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 89, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", ZINT_WARN_NONCOMPLIANT, 89, 11, 99, 226, 188, "" }, - /*425*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 89.25, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 89.5, 11, 99, 226, 189, "" }, - /*426*/ { BARCODE_EANX_CC, -1, -1, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 50, 14, 99, 226, 110, "EAN-13, CC-B 10 rows" }, - /*427*/ { BARCODE_EANX_CC, -1, 1, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 26.5, 14, 99, 226, 63, "" }, - /*428*/ { BARCODE_EANX_CC, -1, 95, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 95, 14, 99, 226, 200, "" }, - /*429*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 95, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 95, 14, 99, 226, 200, "" }, - /*430*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 95.25, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 95.5, 14, 99, 226, 201, "" }, - /*431*/ { BARCODE_EANX_CC, -1, -1, "1234567", "[20]01[90]123456789012345678901234", 0, 50, 10, 72, 162, 110, "EAN-8, CC-A 4 rows" }, - /*432*/ { BARCODE_EANX_CC, -1, 1, "1234567", "[20]01[90]123456789012345678901234", 0, 18.5, 10, 72, 162, 47, "" }, - /*433*/ { BARCODE_EANX_CC, -1, 73, "1234567", "[20]01[90]123456789012345678901234", 0, 73, 10, 72, 162, 156, "" }, - /*434*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 73, "1234567", "[20]01[90]123456789012345678901234", ZINT_WARN_NONCOMPLIANT, 73, 10, 72, 162, 156, "" }, - /*435*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 73.25, "1234567", "[20]01[90]123456789012345678901234", 0, 73.5, 10, 72, 162, 157, "" }, - /*436*/ { BARCODE_EANX_CC, -1, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 50, 24, 82, 178, 110, "EAN-8, CC-B 15 rows" }, - /*437*/ { BARCODE_EANX_CC, -1, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 46.5, 24, 82, 178, 103, "" }, - /*438*/ { BARCODE_EANX_CC, -1, 101, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 101, 24, 82, 178, 212, "" }, - /*439*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 101, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, 101, 24, 82, 178, 212, "" }, - /*440*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 101.25, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 101.5, 24, 82, 178, 213, "" }, - /*441*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231", "[20]01", 0, 50, 5, 145, 290, 100, "CC-A 3 rows" }, - /*442*/ { BARCODE_GS1_128_CC, -1, 1, "[01]12345678901231", "[20]01", 0, 7.5, 5, 145, 290, 15, "" }, - /*443*/ { BARCODE_GS1_128_CC, -1, 12.5, "[01]12345678901231", "[20]01", 0, 12.5, 5, 145, 290, 25, "" }, - /*444*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 12.5, "[01]12345678901231", "[20]01", ZINT_WARN_NONCOMPLIANT, 12.5, 5, 145, 290, 25, "" }, - /*445*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 12.75, "[01]12345678901231", "[20]01", 0, 13, 5, 145, 290, 26, "" }, - /*446*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 50, 9, 145, 290, 100, "CC-A 7 rows" }, - /*447*/ { BARCODE_GS1_128_CC, -1, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 15.5, 9, 145, 290, 31, "" }, - /*448*/ { BARCODE_GS1_128_CC, -1, 20.7, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 20.5, 9, 145, 290, 41, "" }, - /*449*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 20.7, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", ZINT_WARN_NONCOMPLIANT, 20.5, 9, 145, 290, 41, "" }, - /*450*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 20.75, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 21, 9, 145, 290, 42, "" }, - /*451*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 50, 12, 145, 290, 100, "CC-B 10 rows" }, - /*452*/ { BARCODE_GS1_128_CC, -1, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 21.5, 12, 145, 290, 43, "" }, - /*453*/ { BARCODE_GS1_128_CC, -1, 26.5, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 26.5, 12, 145, 290, 53, "" }, - /*454*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 26.5, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 26.5, 12, 145, 290, 53, "" }, - /*455*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 26.75, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 27, 12, 145, 290, 54, "" }, - /*456*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 91.5, 32, 154, 308, 183, "CC-C 30 rows" }, - /*457*/ { BARCODE_GS1_128_CC, -1, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 91.5, 32, 154, 308, 183, "" }, - /*458*/ { BARCODE_GS1_128_CC, -1, 96.5, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 96.5, 32, 154, 308, 193, "" }, - /*459*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 96.5, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, 96.5, 32, 154, 308, 193, "" }, - /*460*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 96.75, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 97, 32, 154, 308, 194, "" }, - /*461*/ { BARCODE_DBAR_OMN_CC, -1, -1, "1234567890123", "[20]01[90]1234567890", 0, 21, 5, 100, 200, 42, "CC-A 3 rows" }, - /*462*/ { BARCODE_DBAR_OMN_CC, -1, 1, "1234567890123", "[20]01[90]1234567890", 0, 7.5, 5, 100, 200, 15, "" }, - /*463*/ { BARCODE_DBAR_OMN_CC, -1, 19.9, "1234567890123", "[20]01[90]1234567890", 0, 20, 5, 100, 200, 40, "" }, - /*464*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 19.9, "1234567890123", "[20]01[90]1234567890", ZINT_WARN_NONCOMPLIANT, 20, 5, 100, 200, 40, "" }, - /*465*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 20, "1234567890123", "[20]01[90]1234567890", 0, 20, 5, 100, 200, 40, "" }, - /*466*/ { BARCODE_DBAR_OMN_CC, -1, -1, "1234567890123", "[20]01[90]12345678901234567890", 0, 23, 6, 100, 200, 46, "CC-A 4 rows" }, - /*467*/ { BARCODE_DBAR_OMN_CC, -1, 1, "1234567890123", "[20]01[90]12345678901234567890", 0, 9.5, 6, 100, 200, 19, "" }, - /*468*/ { BARCODE_DBAR_OMN_CC, -1, 21.9, "1234567890123", "[20]01[90]12345678901234567890", 0, 22, 6, 100, 200, 44, "" }, - /*469*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 21.9, "1234567890123", "[20]01[90]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 22, 6, 100, 200, 44, "" }, - /*470*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 22, "1234567890123", "[20]01[90]12345678901234567890", 0, 22, 6, 100, 200, 44, "" }, - /*471*/ { BARCODE_DBAR_OMN_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 35, 12, 100, 200, 70, "CC-B 10 rows" }, - /*472*/ { BARCODE_DBAR_OMN_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 21.5, 12, 100, 200, 43, "" }, - /*473*/ { BARCODE_DBAR_OMN_CC, -1, 33.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 34, 12, 100, 200, 68, "" }, - /*474*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 33.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 34, 12, 100, 200, 68, "" }, - /*475*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 34, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 34, 12, 100, 200, 68, "" }, - /*476*/ { BARCODE_DBAR_OMN_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 39, 14, 100, 200, 78, "CC-B 12 rows" }, - /*477*/ { BARCODE_DBAR_OMN_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 25.5, 14, 100, 200, 51, "" }, - /*478*/ { BARCODE_DBAR_OMN_CC, -1, 37.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 38, 14, 100, 200, 76, "" }, - /*479*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 37.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, 38, 14, 100, 200, 76, "" }, - /*480*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 38, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 38, 14, 100, 200, 76, "" }, - /*481*/ { BARCODE_DBAR_LTD_CC, -1, -1, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 38, "CC-A 4 rows" }, - /*482*/ { BARCODE_DBAR_LTD_CC, -1, 1, "1234567890123", "[20]01", 0, 9.5, 6, 79, 158, 19, "" }, - /*483*/ { BARCODE_DBAR_LTD_CC, -1, 18, "1234567890123", "[20]01", 0, 18, 6, 79, 158, 36, "" }, - /*484*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, 18, "1234567890123", "[20]01", ZINT_WARN_NONCOMPLIANT, 18, 6, 79, 158, 36, "" }, - /*485*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, 19, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 38, "" }, - /*486*/ { BARCODE_DBAR_LTD_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 25, 9, 79, 158, 50, "CC-A 7 rows" }, - /*487*/ { BARCODE_DBAR_LTD_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 15.5, 9, 79, 158, 31, "" }, - /*488*/ { BARCODE_DBAR_LTD_CC, -1, 24.9, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 25, 9, 79, 158, 50, "" }, - /*489*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, 24.9, "1234567890123", "[20]01[90]123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, 25, 9, 79, 158, 50, "" }, - /*490*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, 25, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 25, 9, 79, 158, 50, "" }, - /*491*/ { BARCODE_DBAR_LTD_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 22, 88, 176, 102, "CC-B 20 rows" }, - /*492*/ { BARCODE_DBAR_LTD_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 41.5, 22, 88, 176, 83, "" }, - /*493*/ { BARCODE_DBAR_LTD_CC, -1, 50.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 22, 88, 176, 102, "" }, - /*494*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, 50.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, 51, 22, 88, 176, 102, "" }, - /*495*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, 51, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 22, 88, 176, 102, "" }, - /*496*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 82, "CC-A 3 rows" }, - /*497*/ { BARCODE_DBAR_EXP_CC, -1, 1, "[01]12345678901231", "[20]01", 0, 7.5, 5, 134, 268, 15, "" }, - /*498*/ { BARCODE_DBAR_EXP_CC, -1, 40, "[01]12345678901231", "[20]01", 0, 40, 5, 134, 268, 80, "" }, - /*499*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, 40, "[01]12345678901231", "[20]01", ZINT_WARN_NONCOMPLIANT, 40, 5, 134, 268, 80, "" }, - /*500*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, 41, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 82, "" }, - /*501*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 45, 7, 134, 268, 90, "CC-A 5 rows" }, - /*502*/ { BARCODE_DBAR_EXP_CC, -1, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 11.5, 7, 134, 268, 23, "" }, - /*503*/ { BARCODE_DBAR_EXP_CC, -1, 44, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 44, 7, 134, 268, 88, "" }, - /*504*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, 44, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, 44, 7, 134, 268, 88, "" }, - /*505*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, 45, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 45, 7, 134, 268, 90, "" }, - /*506*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 55, 12, 134, 268, 110, "CC-B 10 rows" }, - /*507*/ { BARCODE_DBAR_EXP_CC, -1, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 21.5, 12, 134, 268, 43, "" }, - /*508*/ { BARCODE_DBAR_EXP_CC, -1, 54, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 54, 12, 134, 268, 108, "" }, - /*509*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, 54, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 54, 12, 134, 268, 108, "" }, - /*510*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, 55, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 55, 12, 134, 268, 110, "" }, - /*511*/ { BARCODE_UPCA_CC, -1, -1, "12345678901", "[20]01", 0, 50, 7, 99, 226, 110, "CC-A 3 rows" }, - /*512*/ { BARCODE_UPCA_CC, -1, 1, "12345678901", "[20]01", 0, 12.5, 7, 99, 226, 35, "" }, - /*513*/ { BARCODE_UPCA_CC, -1, 81.24, "12345678901", "[20]01", 0, 81, 7, 99, 226, 172, "" }, - /*514*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, 81.24, "12345678901", "[20]01", ZINT_WARN_NONCOMPLIANT, 81, 7, 99, 226, 172, "" }, - /*515*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, 81.25, "12345678901", "[20]01", 0, 81.5, 7, 99, 226, 173, "" }, - /*516*/ { BARCODE_UPCA_CC, -1, -1, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 50, 10, 99, 226, 110, "CC-A 6 rows" }, - /*517*/ { BARCODE_UPCA_CC, -1, 1, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 18.5, 10, 99, 226, 47, "" }, - /*518*/ { BARCODE_UPCA_CC, -1, 87.24, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 87, 10, 99, 226, 184, "" }, - /*519*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, 87.24, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", ZINT_WARN_NONCOMPLIANT, 87, 10, 99, 226, 184, "" }, - /*520*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, 87.25, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 87.5, 10, 99, 226, 185, "" }, - /*521*/ { BARCODE_UPCA_CC, -1, -1, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 50, 16, 99, 226, 110, "CC-B 12 rows" }, - /*522*/ { BARCODE_UPCA_CC, -1, 1, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 30.5, 16, 99, 226, 71, "" }, - /*523*/ { BARCODE_UPCA_CC, -1, 99, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 99, 16, 99, 226, 208, "" }, - /*524*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, 99, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", ZINT_WARN_NONCOMPLIANT, 99, 16, 99, 226, 208, "" }, - /*525*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, 99.25, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 99.5, 16, 99, 226, 209, "" }, - /*526*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]01[90]123456789012345678", 0, 50, 11, 55, 134, 110, "CC-A 7 rows" }, - /*527*/ { BARCODE_UPCE_CC, -1, 1, "1234567", "[20]01[90]123456789012345678", 0, 20.5, 11, 55, 134, 51, "" }, - /*528*/ { BARCODE_UPCE_CC, -1, 89, "1234567", "[20]01[90]123456789012345678", 0, 89, 11, 55, 134, 188, "" }, - /*529*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 89, "1234567", "[20]01[90]123456789012345678", ZINT_WARN_NONCOMPLIANT, 89, 11, 55, 134, 188, "" }, - /*530*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 89.25, "1234567", "[20]01[90]123456789012345678", 0, 89.5, 11, 55, 134, 189, "" }, - /*531*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 50, 16, 55, 134, 110, "CC-A 12 rows" }, - /*532*/ { BARCODE_UPCE_CC, -1, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 30.5, 16, 55, 134, 71, "" }, - /*533*/ { BARCODE_UPCE_CC, -1, 99, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 99, 16, 55, 134, 208, "" }, - /*534*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 99, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", ZINT_WARN_NONCOMPLIANT, 99, 16, 55, 134, 208, "" }, - /*535*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 99.25, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 99.5, 16, 55, 134, 209, "" }, - /*536*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 50, 21, 55, 134, 110, "CC-B 17 rows" }, - /*537*/ { BARCODE_UPCE_CC, -1, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 40.5, 21, 55, 134, 91, "" }, - /*538*/ { BARCODE_UPCE_CC, -1, 109, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 109, 21, 55, 134, 228, "" }, - /*539*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 109, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 109, 21, 55, 134, 228, "" }, - /*540*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 109.25, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 109.5, 21, 55, 134, 229, "" }, - /*541*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 52.5, 27, 55, 134, 115, "CC-B 23 rows" }, - /*542*/ { BARCODE_UPCE_CC, -1, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 52.5, 27, 55, 134, 115, "" }, - /*543*/ { BARCODE_UPCE_CC, -1, 121, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 121, 27, 55, 134, 252, "" }, - /*544*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 121, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", ZINT_WARN_NONCOMPLIANT, 121, 27, 55, 134, 252, "" }, - /*545*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 121.25, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 121.5, 27, 55, 134, 253, "" }, - /*546*/ { BARCODE_DBAR_STK_CC, -1, -1, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48, "CC-A 5 rows" }, - /*547*/ { BARCODE_DBAR_STK_CC, -1, 1, "1234567890123", "[20]01", 0, 13, 9, 56, 112, 26, "" }, - /*548*/ { BARCODE_DBAR_STK_CC, -1, 23.9, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48, "" }, - /*549*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, 23.9, "1234567890123", "[20]01", ZINT_WARN_NONCOMPLIANT, 24, 9, 56, 112, 48, "" }, - /*550*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, 24, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48, "" }, - /*551*/ { BARCODE_DBAR_STK_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 38, 16, 56, 112, 76, "CC-A 12 rows" }, - /*552*/ { BARCODE_DBAR_STK_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 27, 16, 56, 112, 54, "" }, - /*553*/ { BARCODE_DBAR_STK_CC, -1, 37.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 38, 16, 56, 112, 76, "" }, - /*554*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, 37.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", ZINT_WARN_NONCOMPLIANT, 38, 16, 56, 112, 76, "" }, - /*555*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, 38, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 38, 16, 56, 112, 76, "" }, - /*556*/ { BARCODE_DBAR_STK_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 48, 21, 56, 112, 96, "CC-B 17 rows" }, - /*557*/ { BARCODE_DBAR_STK_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 37, 21, 56, 112, 74, "" }, - /*558*/ { BARCODE_DBAR_STK_CC, -1, 47.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 48, 21, 56, 112, 96, "" }, - /*559*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, 47.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 48, 21, 56, 112, 96, "" }, - /*560*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, 48, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 48, 21, 56, 112, 96, "" }, - /*561*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "1234567890123", "[20]01[90]1234567890123456", 0, 82, 12, 56, 112, 164, "CC-A 6 rows" }, - /*562*/ { BARCODE_DBAR_OMNSTK_CC, -1, 1, "1234567890123", "[20]01[90]1234567890123456", 0, 17, 12, 56, 112, 34, "" }, - /*563*/ { BARCODE_DBAR_OMNSTK_CC, -1, 81, "1234567890123", "[20]01[90]1234567890123456", 0, 81, 12, 56, 112, 162, "" }, - /*564*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, 81, "1234567890123", "[20]01[90]1234567890123456", ZINT_WARN_NONCOMPLIANT, 81, 12, 56, 112, 162, "" }, - /*565*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, 82, "1234567890123", "[20]01[90]1234567890123456", 0, 82, 12, 56, 112, 164, "" }, - /*566*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", 0, 94, 18, 56, 112, 188, "CC-A 12 rows" }, - /*567*/ { BARCODE_DBAR_OMNSTK_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", 0, 29, 18, 56, 112, 58, "" }, - /*568*/ { BARCODE_DBAR_OMNSTK_CC, -1, 93.5, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", 0, 94, 18, 56, 112, 188, "" }, - /*569*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, 93.5, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", ZINT_WARN_NONCOMPLIANT, 94, 18, 56, 112, 188, "" }, - /*570*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, 94, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", 0, 94, 18, 56, 112, 188, "" }, - /*571*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 104, 23, 56, 112, 208, "CC-B 17 rows" }, - /*572*/ { BARCODE_DBAR_OMNSTK_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 39, 23, 56, 112, 78, "" }, - /*573*/ { BARCODE_DBAR_OMNSTK_CC, -1, 103, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 103, 23, 56, 112, 206, "" }, - /*574*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, 103, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", ZINT_WARN_NONCOMPLIANT, 103, 23, 56, 112, 206, "" }, - /*575*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, 104, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 104, 23, 56, 112, 208, "" }, - /*576*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156, "3 rows, CC-A 3 rows" }, - /*577*/ { BARCODE_DBAR_EXPSTK_CC, -1, 1, "[01]12345678901231", "[20]01", 0, 11, 9, 102, 204, 22, "" }, - /*578*/ { BARCODE_DBAR_EXPSTK_CC, -1, 77, "[01]12345678901231", "[20]01", 0, 77, 9, 102, 204, 154, "" }, - /*579*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 77, "[01]12345678901231", "[20]01", ZINT_WARN_NONCOMPLIANT, 77, 9, 102, 204, 154, "" }, - /*580*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 78, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156, "" }, - /*581*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 189, 21, 102, 204, 378, "5 rows, CC-A 3 rows" }, - /*582*/ { BARCODE_DBAR_EXPSTK_CC, -1, 1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 21.5, 21, 102, 204, 43, "" }, - /*583*/ { BARCODE_DBAR_EXPSTK_CC, -1, 188, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 189, 21, 102, 204, 378, "" }, - /*584*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 188, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", ZINT_WARN_NONCOMPLIANT, 189, 21, 102, 204, 378, "" }, - /*585*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 189, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 189, 21, 102, 204, 378, "" }, - /*586*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 80, 10, 102, 204, 160, "3 rows, CC-A 4 rows" }, - /*587*/ { BARCODE_DBAR_EXPSTK_CC, -1, 1, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 13, 10, 102, 204, 26, "" }, - /*588*/ { BARCODE_DBAR_EXPSTK_CC, -1, 79, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 79, 10, 102, 204, 158, "" }, - /*589*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 79, "[01]12345678901231", "[20]01[90]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 79, 10, 102, 204, 158, "" }, - /*590*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 80, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 80, 10, 102, 204, 160, "" }, - /*591*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 92, 16, 102, 204, 184, "3 rows, CC-B 10 rows" }, - /*592*/ { BARCODE_DBAR_EXPSTK_CC, -1, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 25, 16, 102, 204, 50, "" }, - /*593*/ { BARCODE_DBAR_EXPSTK_CC, -1, 91, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 91, 16, 102, 204, 182, "" }, - /*594*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 91, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 91, 16, 102, 204, 182, "" }, - /*595*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 92, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 92, 16, 102, 204, 184, "" }, - /*596*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 203, 28, 102, 204, 406, "5 rows, CC-B 10 rows" }, - /*597*/ { BARCODE_DBAR_EXPSTK_CC, -1, 1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 35.5, 28, 102, 204, 71, "" }, - /*598*/ { BARCODE_DBAR_EXPSTK_CC, -1, 202, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 203, 28, 102, 204, 406, "" }, - /*599*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 202, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 203, 28, 102, 204, 406, "" }, - /*600*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 203, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 203, 28, 102, 204, 406, "" }, - /*601*/ { BARCODE_CHANNEL, -1, 1, "1", "", 0, 1, 1, 19, 38, 2, "" }, - /*602*/ { BARCODE_CHANNEL, -1, 3.75, "123", "", 0, 4, 1, 23, 46, 8, "" }, - /*603*/ { BARCODE_CHANNEL, COMPLIANT_HEIGHT, 3.75, "123", "", ZINT_WARN_NONCOMPLIANT, 4, 1, 23, 46, 8, "Min height data-length dependent" }, - /*604*/ { BARCODE_CHANNEL, COMPLIANT_HEIGHT, 4, "123", "", 0, 4, 1, 23, 46, 8, "" }, - /*605*/ { BARCODE_CODEONE, -1, 1, "12345678901234567890", "", 0, 16, 16, 18, 36, 32, "Fixed height, symbol->height ignored" }, - /*606*/ { BARCODE_GRIDMATRIX, -1, 1, "ABC", "", 0, 18, 18, 18, 36, 36, "Fixed width-to-height ratio, symbol->height ignored" }, - /*607*/ { BARCODE_UPNQR, -1, 1, "1234567890AB", "", 0, 77, 77, 77, 154, 154, "Fixed width-to-height ratio, symbol->height ignored" }, - /*608*/ { BARCODE_ULTRA, -1, 1, "1234567890", "", 0, 13, 13, 18, 36, 26, "Fixed width-to-height ratio, symbol->height ignored" }, - /*609*/ { BARCODE_RMQR, -1, 1, "12345", "", 0, 11, 11, 27, 54, 22, "Fixed width-to-height ratio, symbol->height ignored" }, - /*610*/ { BARCODE_BC412, -1, 1, "1234567", "", 0, 1, 1, 102, 204, 2, "" }, - /*611*/ { BARCODE_BC412, -1, 13.6, "1234567", "", 0, 13.5, 1, 102, 204, 27, "" }, - /*612*/ { BARCODE_BC412, COMPLIANT_HEIGHT, 13.6, "1234567", "", ZINT_WARN_NONCOMPLIANT, 13.5, 1, 102, 204, 27, "" }, - /*613*/ { BARCODE_BC412, COMPLIANT_HEIGHT, 13.65, "1234567", "", 0, 13.5, 1, 102, 204, 27, "" }, - /*614*/ { BARCODE_BC412, COMPLIANT_HEIGHT, 21.3, "1234567", "", 0, 21.5, 1, 102, 204, 43, "" }, - /*615*/ { BARCODE_BC412, COMPLIANT_HEIGHT, 21.35, "1234567", "", ZINT_WARN_NONCOMPLIANT, 21.5, 1, 102, 204, 43, "" }, + static const struct item data[] = { + /* 0*/ { BARCODE_CODE11, -1, 1, "1234567890", "", 0, 1, 1, 108, 216, 2, "", "" }, + /* 1*/ { BARCODE_CODE11, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 108, 216, 2, "", "TODO: Find doc" }, + /* 2*/ { BARCODE_CODE11, -1, 4, "1234567890", "", 0, 4, 1, 108, 216, 8, "", "" }, + /* 3*/ { BARCODE_CODE11, -1, 10, "1234567890", "", 0, 10, 1, 108, 216, 20, "", "" }, + /* 4*/ { BARCODE_C25STANDARD, -1, 1, "1234567890", "", 0, 1, 1, 117, 234, 2, "", "" }, + /* 5*/ { BARCODE_C25STANDARD, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 117, 234, 2, "", "No doc for C25 except C25INTER" }, + /* 6*/ { BARCODE_C25STANDARD, -1, 4, "1234567890", "", 0, 4, 1, 117, 234, 8, "", "" }, + /* 7*/ { BARCODE_C25STANDARD, -1, 11, "1234567890", "", 0, 11, 1, 117, 234, 22, "", "" }, + /* 8*/ { BARCODE_C25INTER, -1, 1, "1234567890", "", 0, 1, 1, 99, 198, 2, "", "" }, + /* 9*/ { BARCODE_C25INTER, -1, 15, "1234567890", "", 0, 15, 1, 99, 198, 30, "", "" }, + /* 10*/ { BARCODE_C25INTER, COMPLIANT_HEIGHT, 15, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 15, 1, 99, 198, 30, "Warning 247: Height not compliant with standards", "Min height data-length dependent" }, + /* 11*/ { BARCODE_C25INTER, COMPLIANT_HEIGHT, 15.5, "1234567890", "", 0, 15.5, 1, 99, 198, 31, "", "" }, + /* 12*/ { BARCODE_C25INTER, COMPLIANT_HEIGHT, 17.5, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 17.5, 1, 117, 234, 35, "Warning 247: Height not compliant with standards", "Min height data-length dependent" }, + /* 13*/ { BARCODE_C25INTER, COMPLIANT_HEIGHT, 17.75, "12345678901", "", 0, 18, 1, 117, 234, 36, "", "" }, + /* 14*/ { BARCODE_C25IATA, -1, 1, "1234567890", "", 0, 1, 1, 149, 298, 2, "", "" }, + /* 15*/ { BARCODE_C25IATA, -1, 4, "1234567890", "", 0, 4, 1, 149, 298, 8, "", "" }, + /* 16*/ { BARCODE_C25IATA, -1, 30, "1234567890", "", 0, 30, 1, 149, 298, 60, "", "" }, + /* 17*/ { BARCODE_C25LOGIC, -1, 1, "1234567890", "", 0, 1, 1, 109, 218, 2, "", "" }, + /* 18*/ { BARCODE_C25LOGIC, -1, 4, "1234567890", "", 0, 4, 1, 109, 218, 8, "", "" }, + /* 19*/ { BARCODE_C25LOGIC, -1, 41, "1234567890", "", 0, 41, 1, 109, 218, 82, "", "" }, + /* 20*/ { BARCODE_C25IND, -1, 1, "1234567890", "", 0, 1, 1, 159, 318, 2, "", "" }, + /* 21*/ { BARCODE_C25IND, -1, 4, "1234567890", "", 0, 4, 1, 159, 318, 8, "", "" }, + /* 22*/ { BARCODE_C25IND, -1, 21, "1234567890", "", 0, 21, 1, 159, 318, 42, "", "" }, + /* 23*/ { BARCODE_CODE39, -1, 1, "1234567890", "", 0, 1, 1, 155, 310, 2, "", "" }, + /* 24*/ { BARCODE_CODE39, -1, 4, "1", "", 0, 4, 1, 38, 76, 8, "", "" }, + /* 25*/ { BARCODE_CODE39, COMPLIANT_HEIGHT, 4, "1", "", ZINT_WARN_NONCOMPLIANT, 4, 1, 38, 76, 8, "Warning 247: Height not compliant with standards", "Min height data-length dependent" }, + /* 26*/ { BARCODE_CODE39, COMPLIANT_HEIGHT, 4.4, "1", "", 0, 4.5, 1, 38, 76, 9, "", "" }, + /* 27*/ { BARCODE_CODE39, -1, 17, "1234567890", "", 0, 17, 1, 155, 310, 34, "", "" }, + /* 28*/ { BARCODE_CODE39, COMPLIANT_HEIGHT, 17, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 17, 1, 155, 310, 34, "Warning 247: Height not compliant with standards", "Min height data-length dependent" }, + /* 29*/ { BARCODE_CODE39, COMPLIANT_HEIGHT, 17.85, "1234567890", "", 0, 18, 1, 155, 310, 36, "", "" }, + /* 30*/ { BARCODE_EXCODE39, -1, 1, "1234567890", "", 0, 1, 1, 155, 310, 2, "", "" }, + /* 31*/ { BARCODE_EXCODE39, -1, 17.8, "1234567890", "", 0, 18, 1, 155, 310, 36, "", "" }, + /* 32*/ { BARCODE_EXCODE39, COMPLIANT_HEIGHT, 17.8, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 18, 1, 155, 310, 36, "Warning 247: Height not compliant with standards", "" }, + /* 33*/ { BARCODE_EXCODE39, COMPLIANT_HEIGHT, 17.9, "1234567890", "", 0, 18, 1, 155, 310, 36, "", "" }, + /* 34*/ { BARCODE_EANX, -1, 1, "123456789012", "", 0, 1, 1, 95, 226, 12, "", "EAN-13" }, + /* 35*/ { BARCODE_EANX, -1, 69, "123456789012", "", 0, 69, 1, 95, 226, 148, "", "" }, + /* 36*/ { BARCODE_EANX, COMPLIANT_HEIGHT, 69, "123456789012", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "Warning 247: Height not compliant with standards", "" }, + /* 37*/ { BARCODE_EANX, COMPLIANT_HEIGHT, 69.25, "123456789012", "", 0, 69.5, 1, 95, 226, 149, "", "" }, + /* 38*/ { BARCODE_EANX, -1, 55, "1234567", "", 0, 55, 1, 67, 162, 120, "", "EAN-8" }, + /* 39*/ { BARCODE_EANX, COMPLIANT_HEIGHT, 55, "1234567", "", ZINT_WARN_NONCOMPLIANT, 55, 1, 67, 162, 120, "Warning 247: Height not compliant with standards", "EAN-8" }, + /* 40*/ { BARCODE_EANX, COMPLIANT_HEIGHT, 55.25, "1234567", "", 0, 55.5, 1, 67, 162, 121, "", "EAN-8" }, + /* 41*/ { BARCODE_EANX_CHK, -1, 1, "1234567890128", "", 0, 1, 1, 95, 226, 12, "", "EAN-13" }, + /* 42*/ { BARCODE_EANX_CHK, -1, 69, "1234567890128", "", 0, 69, 1, 95, 226, 148, "", "" }, + /* 43*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, 69, "1234567890128", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "Warning 247: Height not compliant with standards", "" }, + /* 44*/ { BARCODE_EANX_CHK, COMPLIANT_HEIGHT, 69.25, "1234567890128", "", 0, 69.5, 1, 95, 226, 149, "", "" }, + /* 45*/ { BARCODE_GS1_128, -1, 1, "[01]12345678901231", "", 0, 1, 1, 134, 268, 2, "", "" }, + /* 46*/ { BARCODE_GS1_128, -1, 5.7, "[01]12345678901231", "", 0, 5.5, 1, 134, 268, 11, "", "" }, + /* 47*/ { BARCODE_GS1_128, COMPLIANT_HEIGHT, 5.7, "[01]12345678901231", "", ZINT_WARN_NONCOMPLIANT, 5.5, 1, 134, 268, 11, "Warning 247: Height not compliant with standards", "" }, + /* 48*/ { BARCODE_GS1_128, COMPLIANT_HEIGHT, 5.725, "[01]12345678901231", "", 0, 5.5, 1, 134, 268, 11, "", "Note considered compliant even though rendered height same as before" }, + /* 49*/ { BARCODE_GS1_128, -1, 50, "[01]12345678901231", "", 0, 50, 1, 134, 268, 100, "", "" }, + /* 50*/ { BARCODE_CODABAR, -1, 1, "A0B", "", 0, 1, 1, 32, 64, 2, "", "" }, + /* 51*/ { BARCODE_CODABAR, -1, 4, "A0B", "", 0, 4, 1, 32, 64, 8, "", "" }, + /* 52*/ { BARCODE_CODABAR, -1, 26, "A0B", "", 0, 26, 1, 32, 64, 52, "", "" }, + /* 53*/ { BARCODE_CODABAR, COMPLIANT_HEIGHT, 11, "A0B", "", ZINT_WARN_NONCOMPLIANT, 11, 1, 32, 64, 22, "Warning 247: Height not compliant with standards", "" }, + /* 54*/ { BARCODE_CODABAR, COMPLIANT_HEIGHT, 12, "A0B", "", 0, 12, 1, 32, 64, 24, "", "" }, + /* 55*/ { BARCODE_CODE128, -1, 1, "1234567890", "", 0, 1, 1, 90, 180, 2, "", "" }, + /* 56*/ { BARCODE_CODE128, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 90, 180, 2, "", "" }, + /* 57*/ { BARCODE_CODE128, -1, 4, "1234567890", "", 0, 4, 1, 90, 180, 8, "", "" }, + /* 58*/ { BARCODE_CODE128, -1, 7, "1234567890", "", 0, 7, 1, 90, 180, 14, "", "" }, + /* 59*/ { BARCODE_DPLEIT, -1, 1, "1234567890123", "", 0, 1, 1, 135, 270, 2, "", "" }, + /* 60*/ { BARCODE_DPLEIT, COMPLIANT_HEIGHT, 1, "1234567890123", "", 0, 1, 1, 135, 270, 2, "", "TODO: Find doc" }, + /* 61*/ { BARCODE_DPLEIT, -1, 4, "1234567890123", "", 0, 4, 1, 135, 270, 8, "", "" }, + /* 62*/ { BARCODE_DPIDENT, -1, 1, "12345678901", "", 0, 1, 1, 117, 234, 2, "", "" }, + /* 63*/ { BARCODE_DPIDENT, COMPLIANT_HEIGHT, 1, "12345678901", "", 0, 1, 1, 117, 234, 2, "", "TODO: Find doc" }, + /* 64*/ { BARCODE_DPIDENT, -1, 4, "12345678901", "", 0, 4, 1, 117, 234, 8, "", "" }, + /* 65*/ { BARCODE_CODE16K, -1, -1, "1234567890", "", 0, 20, 2, 70, 162, 44, "", "2 rows" }, + /* 66*/ { BARCODE_CODE16K, -1, 1, "1234567890", "", 0, 1, 2, 70, 162, 6, "", "" }, + /* 67*/ { BARCODE_CODE16K, -1, 4, "1234567890", "", 0, 4, 2, 70, 162, 12, "", "" }, + /* 68*/ { BARCODE_CODE16K, -1, 16.75, "1234567890", "", 0, 17, 2, 70, 162, 38, "", "" }, + /* 69*/ { BARCODE_CODE16K, COMPLIANT_HEIGHT, 16.75, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 17, 2, 70, 162, 38, "Warning 247: Height not compliant with standards", "" }, + /* 70*/ { BARCODE_CODE16K, COMPLIANT_HEIGHT, 17, "1234567890", "", 0, 17, 2, 70, 162, 38, "", "" }, + /* 71*/ { BARCODE_CODE16K, -1, -1, "12345678901234567890123456789012345678901234567890", "", 0, 60, 6, 70, 162, 124, "", "6 rows" }, + /* 72*/ { BARCODE_CODE16K, -1, 52.5, "12345678901234567890123456789012345678901234567890", "", 0, 54, 6, 70, 162, 112, "", "" }, + /* 73*/ { BARCODE_CODE16K, COMPLIANT_HEIGHT, 52.5, "12345678901234567890123456789012345678901234567890", "", ZINT_WARN_NONCOMPLIANT, 54, 6, 70, 162, 112, "Warning 247: Height not compliant with standards", "" }, + /* 74*/ { BARCODE_CODE16K, COMPLIANT_HEIGHT, 53, "12345678901234567890123456789012345678901234567890", "", 0, 54, 6, 70, 162, 112, "", "" }, + /* 75*/ { BARCODE_CODE49, -1, -1, "1234567890", "", 0, 20, 2, 70, 162, 44, "", "2 rows" }, + /* 76*/ { BARCODE_CODE49, -1, 1, "1234567890", "", 0, 1, 2, 70, 162, 6, "", "" }, + /* 77*/ { BARCODE_CODE49, -1, 16.75, "1234567890", "", 0, 17, 2, 70, 162, 38, "", "" }, + /* 78*/ { BARCODE_CODE49, COMPLIANT_HEIGHT, 16.75, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 17, 2, 70, 162, 38, "Warning 247: Height not compliant with standards", "" }, + /* 79*/ { BARCODE_CODE49, COMPLIANT_HEIGHT, 17, "1234567890", "", 0, 17, 2, 70, 162, 38, "", "" }, + /* 80*/ { BARCODE_CODE49, -1, -1, "12345678901234567890", "", 0, 30, 3, 70, 162, 64, "", "3 rows" }, + /* 81*/ { BARCODE_CODE49, -1, 25.75, "12345678901234567890", "", 0, 25.5, 3, 70, 162, 55, "", "" }, + /* 82*/ { BARCODE_CODE49, COMPLIANT_HEIGHT, 25.75, "12345678901234567890", "", ZINT_WARN_NONCOMPLIANT, 25.5, 3, 70, 162, 55, "Warning 247: Height not compliant with standards", "" }, + /* 83*/ { BARCODE_CODE49, COMPLIANT_HEIGHT, 26, "12345678901234567890", "", 0, 25.5, 3, 70, 162, 55, "", "" }, + /* 84*/ { BARCODE_CODE93, -1, 1, "1234567890", "", 0, 1, 1, 127, 254, 2, "", "" }, + /* 85*/ { BARCODE_CODE93, -1, 9.9, "1", "", 0, 10, 1, 46, 92, 20, "", "" }, + /* 86*/ { BARCODE_CODE93, COMPLIANT_HEIGHT, 9.9, "1", "", ZINT_WARN_NONCOMPLIANT, 10, 1, 46, 92, 20, "Warning 247: Height not compliant with standards", "Min height data-length dependent" }, + /* 87*/ { BARCODE_CODE93, COMPLIANT_HEIGHT, 10, "1", "", 0, 10, 1, 46, 92, 20, "", "" }, + /* 88*/ { BARCODE_CODE93, COMPLIANT_HEIGHT, 22, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 22, 1, 127, 254, 44, "Warning 247: Height not compliant with standards", "Min height data-length dependent" }, + /* 89*/ { BARCODE_CODE93, COMPLIANT_HEIGHT, 22.1, "1234567890", "", 0, 22, 1, 127, 254, 44, "", "" }, + /* 90*/ { BARCODE_FLAT, -1, 1, "1234567890", "", 0, 1, 1, 90, 180, 2, "", "" }, + /* 91*/ { BARCODE_FLAT, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 90, 180, 2, "", "TODO: Find doc" }, + /* 92*/ { BARCODE_FLAT, -1, 4, "1234567890", "", 0, 4, 1, 90, 180, 8, "", "" }, + /* 93*/ { BARCODE_DBAR_OMN, -1, 1, "1234567890123", "", 0, 1, 1, 96, 192, 2, "", "" }, + /* 94*/ { BARCODE_DBAR_OMN, -1, 12.9, "1234567890123", "", 0, 13, 1, 96, 192, 26, "", "" }, + /* 95*/ { BARCODE_DBAR_OMN, COMPLIANT_HEIGHT, 12.9, "1234567890123", "", ZINT_WARN_NONCOMPLIANT, 13, 1, 96, 192, 26, "Warning 247: Height not compliant with standards", "" }, + /* 96*/ { BARCODE_DBAR_OMN, COMPLIANT_HEIGHT, 13, "1234567890123", "", 0, 13, 1, 96, 192, 26, "", "" }, + /* 97*/ { BARCODE_DBAR_LTD, -1, 1, "1234567890123", "", 0, 1, 1, 79, 158, 2, "", "" }, + /* 98*/ { BARCODE_DBAR_LTD, -1, 9, "1234567890123", "", 0, 9, 1, 79, 158, 18, "", "" }, + /* 99*/ { BARCODE_DBAR_LTD, COMPLIANT_HEIGHT, 9, "1234567890123", "", ZINT_WARN_NONCOMPLIANT, 9, 1, 79, 158, 18, "Warning 247: Height not compliant with standards", "" }, + /*100*/ { BARCODE_DBAR_LTD, COMPLIANT_HEIGHT, 10, "1234567890123", "", 0, 10, 1, 79, 158, 20, "", "" }, + /*101*/ { BARCODE_DBAR_EXP, -1, 1, "[01]12345678901231", "", 0, 1, 1, 134, 268, 2, "", "" }, + /*102*/ { BARCODE_DBAR_EXP, -1, 33, "[01]12345678901231", "", 0, 33, 1, 134, 268, 66, "", "" }, + /*103*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 33, "[01]12345678901231", "", ZINT_WARN_NONCOMPLIANT, 33, 1, 134, 268, 66, "Warning 247: Height not compliant with standards", "" }, + /*104*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 34, "[01]12345678901231", "", 0, 34, 1, 134, 268, 68, "", "" }, + /*105*/ { BARCODE_TELEPEN, -1, 1, "1234567890", "", 0, 1, 1, 208, 416, 2, "", "" }, + /*106*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 208, 416, 2, "", "No known min" }, + /*107*/ { BARCODE_TELEPEN, -1, 4, "1234567890", "", 0, 4, 1, 208, 416, 8, "", "" }, + /*108*/ { BARCODE_UPCA, -1, 1, "12345678901", "", 0, 1, 1, 95, 226, 12, "", "" }, + /*109*/ { BARCODE_UPCA, -1, 69, "12345678901", "", 0, 69, 1, 95, 226, 148, "", "" }, + /*110*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, 69, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "Warning 247: Height not compliant with standards", "" }, + /*111*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, 69.25, "12345678901", "", 0, 69.5, 1, 95, 226, 149, "", "" }, + /*112*/ { BARCODE_UPCA_CHK, -1, 1, "123456789012", "", 0, 1, 1, 95, 226, 12, "", "" }, + /*113*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, 69, "123456789012", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "Warning 247: Height not compliant with standards", "" }, + /*114*/ { BARCODE_UPCA_CHK, COMPLIANT_HEIGHT, 69.5, "123456789012", "", 0, 69.5, 1, 95, 226, 149, "", "" }, + /*115*/ { BARCODE_UPCE, -1, 1, "1234567", "", 0, 1, 1, 51, 134, 12, "", "" }, + /*116*/ { BARCODE_UPCE, -1, 69, "1234567", "", 0, 69, 1, 51, 134, 148, "", "" }, + /*117*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, 69, "1234567", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 51, 134, 148, "Warning 247: Height not compliant with standards", "" }, + /*118*/ { BARCODE_UPCE, COMPLIANT_HEIGHT, 69.25, "1234567", "", 0, 69.5, 1, 51, 134, 149, "", "" }, + /*119*/ { BARCODE_UPCE_CHK, -1, 1, "12345670", "", 0, 1, 1, 51, 134, 12, "", "" }, + /*120*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, 69.24, "12345670", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 51, 134, 148, "Warning 247: Height not compliant with standards", "" }, + /*121*/ { BARCODE_UPCE_CHK, COMPLIANT_HEIGHT, 69.25, "12345670", "", 0, 69.5, 1, 51, 134, 149, "", "" }, + /*122*/ { BARCODE_POSTNET, -1, -1, "12345678901", "", 0, 12, 2, 123, 246, 24, "", "" }, + /*123*/ { BARCODE_POSTNET, -1, 1, "12345678901", "", 0, 1, 2, 123, 246, 2, "", "" }, + /*124*/ { BARCODE_POSTNET, -1, 4.5, "12345678901", "", 0, 5, 2, 123, 246, 10, "", "" }, + /*125*/ { BARCODE_POSTNET, COMPLIANT_HEIGHT, 4.5, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 4.5, 2, 123, 246, 9, "Warning 498: Height not compliant with standards", "" }, + /*126*/ { BARCODE_POSTNET, COMPLIANT_HEIGHT, 4.6, "12345678901", "", 0, 5, 2, 123, 246, 10, "", "" }, + /*127*/ { BARCODE_POSTNET, -1, 9, "12345678901", "", 0, 9, 2, 123, 246, 18, "", "" }, + /*128*/ { BARCODE_POSTNET, COMPLIANT_HEIGHT, 9, "12345678901", "", 0, 9, 2, 123, 246, 18, "", "" }, + /*129*/ { BARCODE_POSTNET, COMPLIANT_HEIGHT, 9.1, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 9, 2, 123, 246, 18, "Warning 498: Height not compliant with standards", "" }, + /*130*/ { BARCODE_POSTNET, -1, 20, "12345678901", "", 0, 20, 2, 123, 246, 40, "", "" }, + /*131*/ { BARCODE_POSTNET, COMPLIANT_HEIGHT, 20, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 20, 2, 123, 246, 40, "Warning 498: Height not compliant with standards", "" }, + /*132*/ { BARCODE_MSI_PLESSEY, -1, 1, "1234567890", "", 0, 1, 1, 127, 254, 2, "", "" }, + /*133*/ { BARCODE_MSI_PLESSEY, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 127, 254, 2, "", "TODO: Find doc" }, + /*134*/ { BARCODE_MSI_PLESSEY, -1, 4, "1234567890", "", 0, 4, 1, 127, 254, 8, "", "" }, + /*135*/ { BARCODE_FIM, -1, 1, "A", "", 0, 1, 1, 17, 34, 2, "", "" }, + /*136*/ { BARCODE_FIM, -1, 12.7, "A", "", 0, 12.5, 1, 17, 34, 25, "", "" }, + /*137*/ { BARCODE_FIM, COMPLIANT_HEIGHT, 12.7, "A", "", ZINT_WARN_NONCOMPLIANT, 12.5, 1, 17, 34, 25, "Warning 247: Height not compliant with standards", "" }, + /*138*/ { BARCODE_FIM, COMPLIANT_HEIGHT, 12.8, "A", "", 0, 13, 1, 17, 34, 26, "", "" }, + /*139*/ { BARCODE_LOGMARS, -1, 1, "1234567890", "", 0, 1, 1, 191, 382, 2, "", "" }, + /*140*/ { BARCODE_LOGMARS, -1, 6, "1234567890", "", 0, 6, 1, 191, 382, 12, "", "" }, + /*141*/ { BARCODE_LOGMARS, COMPLIANT_HEIGHT, 6, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 6, 1, 191, 382, 12, "Warning 247: Height not compliant with standards", "" }, + /*142*/ { BARCODE_LOGMARS, -1, 6.25, "1234567890", "", 0, 6.5, 1, 191, 382, 13, "", "" }, + /*143*/ { BARCODE_LOGMARS, COMPLIANT_HEIGHT, 6.25, "1234567890", "", 0, 6.5, 1, 191, 382, 13, "", "" }, + /*144*/ { BARCODE_LOGMARS, COMPLIANT_HEIGHT, 116, "1234567890", "", 0, 116, 1, 191, 382, 232, "", "" }, + /*145*/ { BARCODE_LOGMARS, COMPLIANT_HEIGHT, 117, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 117, 1, 191, 382, 234, "Warning 248: Height not compliant with standards", "" }, + /*146*/ { BARCODE_PHARMA, -1, 1, "123456", "", 0, 1, 1, 58, 116, 2, "", "" }, + /*147*/ { BARCODE_PHARMA, -1, 15, "123456", "", 0, 15, 1, 58, 116, 30, "", "" }, + /*148*/ { BARCODE_PHARMA, COMPLIANT_HEIGHT, 15, "123456", "", ZINT_WARN_NONCOMPLIANT, 15, 1, 58, 116, 30, "Warning 247: Height not compliant with standards", "" }, + /*149*/ { BARCODE_PHARMA, COMPLIANT_HEIGHT, 16, "123456", "", 0, 16, 1, 58, 116, 32, "", "" }, + /*150*/ { BARCODE_PZN, -1, 1, "123456", "", 0, 1, 1, 142, 284, 2, "", "" }, + /*151*/ { BARCODE_PZN, -1, 17.7, "123456", "", 0, 17.5, 1, 142, 284, 35, "", "" }, + /*152*/ { BARCODE_PZN, COMPLIANT_HEIGHT, 17.7, "123456", "", ZINT_WARN_NONCOMPLIANT, 17.5, 1, 142, 284, 35, "Warning 247: Height not compliant with standards", "" }, + /*153*/ { BARCODE_PZN, COMPLIANT_HEIGHT, 17.8, "123456", "", 0, 18, 1, 142, 284, 36, "", "" }, + /*154*/ { BARCODE_PHARMA_TWO, -1, -1, "12345678", "", 0, 10, 2, 29, 58, 20, "", "" }, + /*155*/ { BARCODE_PHARMA_TWO, -1, 1, "12345678", "", 0, 1, 2, 29, 58, 2, "", "" }, + /*156*/ { BARCODE_PHARMA_TWO, -1, 3.9, "12345678", "", 0, 4, 2, 29, 58, 8, "", "" }, + /*157*/ { BARCODE_PHARMA_TWO, COMPLIANT_HEIGHT, 3.9, "12345678", "", ZINT_WARN_NONCOMPLIANT, 4, 2, 29, 58, 8, "Warning 247: Height not compliant with standards", "" }, + /*158*/ { BARCODE_PHARMA_TWO, COMPLIANT_HEIGHT, 4, "12345678", "", 0, 4, 2, 29, 58, 8, "", "" }, + /*159*/ { BARCODE_PHARMA_TWO, -1, 15, "12345678", "", 0, 15, 2, 29, 58, 30, "", "" }, + /*160*/ { BARCODE_PHARMA_TWO, COMPLIANT_HEIGHT, 15, "12345678", "", 0, 15, 2, 29, 58, 30, "", "" }, + /*161*/ { BARCODE_PHARMA_TWO, COMPLIANT_HEIGHT, 15.1, "12345678", "", ZINT_WARN_NONCOMPLIANT, 15, 2, 29, 58, 30, "Warning 248: Height not compliant with standards", "" }, + /*162*/ { BARCODE_CEPNET, -1, -1, "12345678", "", 0, 5, 2, 93, 186, 10, "", "" }, + /*163*/ { BARCODE_CEPNET, -1, 1, "12345678", "", 0, 1.5, 2, 93, 186, 3, "", "" }, + /*164*/ { BARCODE_CEPNET, -1, 4.5, "12345678", "", 0, 4.5, 2, 93, 186, 9, "", "" }, + /*165*/ { BARCODE_CEPNET, COMPLIANT_HEIGHT, 4.5, "12345678", "", ZINT_WARN_NONCOMPLIANT, 4.5, 2, 93, 186, 9, "Warning 498: Height not compliant with standards", "" }, + /*166*/ { BARCODE_CEPNET, COMPLIANT_HEIGHT, 4.6, "12345678", "", 0, 5, 2, 93, 186, 10, "", "" }, + /*167*/ { BARCODE_CEPNET, -1, 9, "12345678", "", 0, 9, 2, 93, 186, 18, "", "" }, + /*168*/ { BARCODE_CEPNET, COMPLIANT_HEIGHT, 9, "12345678", "", 0, 9, 2, 93, 186, 18, "", "" }, + /*169*/ { BARCODE_CEPNET, COMPLIANT_HEIGHT, 9.1, "12345678", "", ZINT_WARN_NONCOMPLIANT, 9, 2, 93, 186, 18, "Warning 498: Height not compliant with standards", "" }, + /*170*/ { BARCODE_CEPNET, -1, 20, "12345678", "", 0, 20, 2, 93, 186, 40, "", "" }, + /*171*/ { BARCODE_CEPNET, COMPLIANT_HEIGHT, 20, "12345678", "", ZINT_WARN_NONCOMPLIANT, 20, 2, 93, 186, 40, "Warning 498: Height not compliant with standards", "" }, + /*172*/ { BARCODE_PDF417, -1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 4, 8, 120, 240, 8, "Warning 247: Height not compliant with standards", "8 rows" }, + /*173*/ { BARCODE_PDF417, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 4, 8, 120, 240, 8, "Warning 247: Height not compliant with standards", "" }, + /*174*/ { BARCODE_PDF417, -1, 9, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 8, 8, 120, 240, 16, "Warning 247: Height not compliant with standards", "" }, + /*175*/ { BARCODE_PDF417, -1, 10, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 12, 8, 120, 240, 24, "Warning 247: Height not compliant with standards", "" }, + /*176*/ { BARCODE_PDF417, -1, 11, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 12, 8, 120, 240, 24, "Warning 247: Height not compliant with standards", "" }, + /*177*/ { BARCODE_PDF417, -1, 12, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 12, 8, 120, 240, 24, "Warning 247: Height not compliant with standards", "" }, + /*178*/ { BARCODE_PDF417, -1, 13, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 12, 8, 120, 240, 24, "Warning 247: Height not compliant with standards", "" }, + /*179*/ { BARCODE_PDF417, -1, 14, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 16, 8, 120, 240, 32, "Warning 247: Height not compliant with standards", "" }, + /*180*/ { BARCODE_PDF417, -1, 15, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 16, 8, 120, 240, 32, "Warning 247: Height not compliant with standards", "" }, + /*181*/ { BARCODE_PDF417, -1, 16, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 16, 8, 120, 240, 32, "Warning 247: Height not compliant with standards", "" }, + /*182*/ { BARCODE_PDF417, -1, 17, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 16, 8, 120, 240, 32, "Warning 247: Height not compliant with standards", "" }, + /*183*/ { BARCODE_PDF417, -1, 18, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 8, 120, 240, 40, "Warning 247: Height not compliant with standards", "" }, + /*184*/ { BARCODE_PDF417, -1, 19, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 8, 120, 240, 40, "Warning 247: Height not compliant with standards", "" }, + /*185*/ { BARCODE_PDF417, -1, 20, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 8, 120, 240, 40, "Warning 247: Height not compliant with standards", "" }, + /*186*/ { BARCODE_PDF417, -1, 21, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 8, 120, 240, 40, "Warning 247: Height not compliant with standards", "" }, + /*187*/ { BARCODE_PDF417, -1, 22, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 24, 8, 120, 240, 48, "Warning 247: Height not compliant with standards", "" }, + /*188*/ { BARCODE_PDF417, -1, 23, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 24, 8, 120, 240, 48, "Warning 247: Height not compliant with standards", "" }, + /*189*/ { BARCODE_PDF417, -1, 24, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 24, 8, 120, 240, 48, "", "" }, + /*190*/ { BARCODE_PDF417, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 36, 12, 120, 240, 72, "", "12 rows" }, + /*191*/ { BARCODE_PDF417, -1, 12, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 12, 12, 120, 240, 24, "Warning 247: Height not compliant with standards", "" }, + /*192*/ { BARCODE_PDF417COMP, -1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ", "", ZINT_WARN_NONCOMPLIANT, 4.5, 9, 86, 172, 9, "Warning 247: Height not compliant with standards", "9 rows" }, + /*193*/ { BARCODE_PDF417COMP, -1, 24, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ", "", ZINT_WARN_NONCOMPLIANT, 22.5, 9, 86, 172, 45, "Warning 247: Height not compliant with standards", "" }, + /*194*/ { BARCODE_MAXICODE, -1, 1, "1234567890", "", 0, 16.5, 33, 30, 299, 298, "", "Fixed size, symbol->height ignored" }, + /*195*/ { BARCODE_QRCODE, -1, 1, "ABCD", "", 0, 21, 21, 21, 42, 42, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*196*/ { BARCODE_CODE128AB, -1, 1, "1234567890", "", 0, 1, 1, 145, 290, 2, "", "" }, + /*197*/ { BARCODE_CODE128AB, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 145, 290, 2, "", "" }, + /*198*/ { BARCODE_CODE128AB, -1, 4, "1234567890", "", 0, 4, 1, 145, 290, 8, "", "" }, + /*199*/ { BARCODE_AUSPOST, -1, -1, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16, "", "" }, + /*200*/ { BARCODE_AUSPOST, -1, 1, "12345678901234567890123", "", 0, 2.5, 3, 133, 266, 5, "", "" }, + /*201*/ { BARCODE_AUSPOST, COMPLIANT_HEIGHT, 1, "12345678901234567890123", "", ZINT_WARN_NONCOMPLIANT, 1.5, 3, 133, 266, 3, "Warning 499: Height not compliant with standards", "" }, + /*202*/ { BARCODE_AUSPOST, -1, 6.9, "12345678901234567890123", "", 0, 6.5, 3, 133, 266, 13, "", "" }, + /*203*/ { BARCODE_AUSPOST, COMPLIANT_HEIGHT, 6.9, "12345678901234567890123", "", ZINT_WARN_NONCOMPLIANT, 7, 3, 133, 266, 14, "Warning 499: Height not compliant with standards", "" }, + /*204*/ { BARCODE_AUSPOST, COMPLIANT_HEIGHT, 7, "12345678901234567890123", "", 0, 7, 3, 133, 266, 14, "", "" }, + /*205*/ { BARCODE_AUSPOST, -1, 14, "12345678901234567890123", "", 0, 14.5, 3, 133, 266, 29, "", "" }, + /*206*/ { BARCODE_AUSPOST, COMPLIANT_HEIGHT, 14, "12345678901234567890123", "", 0, 13.5, 3, 133, 266, 27, "", "" }, + /*207*/ { BARCODE_AUSPOST, COMPLIANT_HEIGHT, 14.1, "12345678901234567890123", "", ZINT_WARN_NONCOMPLIANT, 13.5, 3, 133, 266, 27, "Warning 499: Height not compliant with standards", "" }, + /*208*/ { BARCODE_AUSREPLY, -1, 14, "12345678", "", 0, 14.5, 3, 73, 146, 29, "", "" }, + /*209*/ { BARCODE_AUSREPLY, COMPLIANT_HEIGHT, 14, "12345678", "", 0, 13.5, 3, 73, 146, 27, "", "" }, + /*210*/ { BARCODE_AUSREPLY, COMPLIANT_HEIGHT, 14.25, "12345678", "", ZINT_WARN_NONCOMPLIANT, 14.5, 3, 73, 146, 29, "Warning 499: Height not compliant with standards", "" }, + /*211*/ { BARCODE_AUSROUTE, -1, 7, "12345678", "", 0, 7, 3, 73, 146, 14, "", "" }, + /*212*/ { BARCODE_AUSROUTE, COMPLIANT_HEIGHT, 7, "12345678", "", 0, 7, 3, 73, 146, 14, "", "" }, + /*213*/ { BARCODE_AUSREDIRECT, -1, 14, "12345678", "", 0, 14.5, 3, 73, 146, 29, "", "" }, + /*214*/ { BARCODE_AUSREDIRECT, COMPLIANT_HEIGHT, 14, "12345678", "", 0, 13.5, 3, 73, 146, 27, "", "" }, + /*215*/ { BARCODE_ISBNX, -1, 1, "123456789", "", 0, 1, 1, 95, 226, 12, "", "" }, + /*216*/ { BARCODE_ISBNX, -1, 69, "123456789", "", 0, 69, 1, 95, 226, 148, "", "" }, + /*217*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, 69, "123456789", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "Warning 247: Height not compliant with standards", "" }, + /*218*/ { BARCODE_ISBNX, COMPLIANT_HEIGHT, 69.5, "123456789", "", 0, 69.5, 1, 95, 226, 149, "", "" }, + /*219*/ { BARCODE_RM4SCC, -1, -1, "1234567890", "", 0, 8, 3, 91, 182, 16, "", "" }, + /*220*/ { BARCODE_RM4SCC, -1, 1, "1234567890", "", 0, 2.5, 3, 91, 182, 5, "", "" }, + /*221*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, 1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 1.5, 3, 91, 182, 3, "Warning 499: Height not compliant with standards", "" }, + /*222*/ { BARCODE_RM4SCC, -1, 4, "1234567890", "", 0, 4, 3, 91, 182, 8, "", "" }, + /*223*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, 4, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 4, 3, 91, 182, 8, "Warning 499: Height not compliant with standards", "" }, + /*224*/ { BARCODE_RM4SCC, -1, 6, "1234567890", "", 0, 6.5, 3, 91, 182, 13, "", "" }, + /*225*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, 6, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 5.5, 3, 91, 182, 11, "Warning 499: Height not compliant with standards", "" }, + /*226*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, 6.5, "1234567890", "", 0, 6.5, 3, 91, 182, 13, "", "" }, + /*227*/ { BARCODE_RM4SCC, -1, 10.8, "1234567890", "", 0, 10.5, 3, 91, 182, 21, "", "" }, + /*228*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, 10.8, "1234567890", "", 0, 11, 3, 91, 182, 22, "", "" }, + /*229*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, 11, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 11, 3, 91, 182, 22, "Warning 499: Height not compliant with standards", "" }, + /*230*/ { BARCODE_RM4SCC, -1, 16, "1234567890", "", 0, 16, 3, 91, 182, 32, "", "" }, + /*231*/ { BARCODE_RM4SCC, COMPLIANT_HEIGHT, 16, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 16, 3, 91, 182, 32, "Warning 499: Height not compliant with standards", "" }, + /*232*/ { BARCODE_DATAMATRIX, -1, 1, "ABCD", "", 0, 12, 12, 12, 24, 24, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*233*/ { BARCODE_EAN14, -1, 1, "1234567890123", "", 0, 1, 1, 134, 268, 2, "", "" }, + /*234*/ { BARCODE_EAN14, -1, 5.7, "1234567890123", "", 0, 5.5, 1, 134, 268, 11, "", "" }, + /*235*/ { BARCODE_EAN14, COMPLIANT_HEIGHT, 5.7, "1234567890123", "", ZINT_WARN_NONCOMPLIANT, 5.5, 1, 134, 268, 11, "Warning 247: Height not compliant with standards", "" }, + /*236*/ { BARCODE_EAN14, COMPLIANT_HEIGHT, 5.8, "1234567890123", "", 0, 6, 1, 134, 268, 12, "", "" }, + /*237*/ { BARCODE_VIN, -1, 1, "12345678701234567", "", 0, 1, 1, 246, 492, 2, "", "" }, + /*238*/ { BARCODE_VIN, COMPLIANT_HEIGHT, 1, "12345678701234567", "", 0, 1, 1, 246, 492, 2, "", "Doc unlikely" }, + /*239*/ { BARCODE_VIN, -1, 4, "12345678701234567", "", 0, 4, 1, 246, 492, 8, "", "" }, + /*240*/ { BARCODE_CODABLOCKF, -1, -1, "1234567890", "", 0, 20, 2, 101, 242, 44, "", "2 rows" }, + /*241*/ { BARCODE_CODABLOCKF, -1, 1, "1234567890", "", 0, 1, 2, 101, 242, 6, "", "" }, + /*242*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 1, 2, 101, 242, 6, "Warning 247: Height not compliant with standards", "" }, + /*243*/ { BARCODE_CODABLOCKF, -1, 15.5, "1234567890", "", 0, 16, 2, 101, 242, 36, "", "" }, + /*244*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 15.5, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 16, 2, 101, 242, 36, "Warning 247: Height not compliant with standards", "" }, + /*245*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 16, "1234567890", "", 0, 16, 2, 101, 242, 36, "", "" }, + /*246*/ { BARCODE_CODABLOCKF, -1, -1, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 110, 11, 156, 352, 224, "", "11 rows, 14 cols" }, + /*247*/ { BARCODE_CODABLOCKF, -1, 87, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 88, 11, 156, 352, 180, "", "" }, + /*248*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 87, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", ZINT_WARN_NONCOMPLIANT, 88, 11, 156, 352, 180, "Warning 247: Height not compliant with standards", "" }, + /*249*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 88, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 88, 11, 156, 352, 180, "", "" }, + /*250*/ { BARCODE_CODABLOCKF, -1, 220, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 220, 11, 156, 352, 444, "", "" }, + /*251*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 220, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 220, 11, 156, 352, 444, "", "" }, + /*252*/ { BARCODE_CODABLOCKF, -1, -1, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv", "", 0, 110, 11, 167, 374, 224, "", "11 rows, 15 cols" }, + /*253*/ { BARCODE_CODABLOCKF, -1, 93, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv", "", 0, 93.5, 11, 167, 374, 191, "", "" }, + /*254*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 93, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv", "", ZINT_WARN_NONCOMPLIANT, 93.5, 11, 167, 374, 191, "Warning 247: Height not compliant with standards", "" }, + /*255*/ { BARCODE_CODABLOCKF, COMPLIANT_HEIGHT, 93.5, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv", "", 0, 93.5, 11, 167, 374, 191, "", "" }, + /*256*/ { BARCODE_NVE18, -1, 1, "12345678901234567", "", 0, 1, 1, 156, 312, 2, "", "" }, + /*257*/ { BARCODE_NVE18, -1, 5.7, "12345678901234567", "", 0, 5.5, 1, 156, 312, 11, "", "" }, + /*258*/ { BARCODE_NVE18, COMPLIANT_HEIGHT, 5.7, "12345678901234567", "", ZINT_WARN_NONCOMPLIANT, 5.5, 1, 156, 312, 11, "Warning 247: Height not compliant with standards", "" }, + /*259*/ { BARCODE_NVE18, COMPLIANT_HEIGHT, 5.8, "12345678901234567", "", 0, 6, 1, 156, 312, 12, "", "" }, + /*260*/ { BARCODE_JAPANPOST, -1, -1, "1234567890", "", 0, 8, 3, 133, 266, 16, "", "" }, + /*261*/ { BARCODE_JAPANPOST, -1, 1, "1234567890", "", 0, 2.5, 3, 133, 266, 5, "", "" }, + /*262*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, 1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 1.5, 3, 133, 266, 3, "Warning 499: Height not compliant with standards", "" }, + /*263*/ { BARCODE_JAPANPOST, -1, 4.8, "1234567890", "", 0, 5, 3, 133, 266, 10, "", "" }, + /*264*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, 4.8, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 4.5, 3, 133, 266, 9, "Warning 499: Height not compliant with standards", "" }, + /*265*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, 4.9, "1234567890", "", 0, 4.5, 3, 133, 266, 9, "", "" }, + /*266*/ { BARCODE_JAPANPOST, -1, 7, "1234567890", "", 0, 7, 3, 133, 266, 14, "", "" }, + /*267*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, 7, "1234567890", "", 0, 7.5, 3, 133, 266, 15, "", "" }, + /*268*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, 7.5, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 7.5, 3, 133, 266, 15, "Warning 499: Height not compliant with standards", "" }, + /*269*/ { BARCODE_JAPANPOST, -1, 16, "1234567890", "", 0, 16, 3, 133, 266, 32, "", "" }, + /*270*/ { BARCODE_JAPANPOST, COMPLIANT_HEIGHT, 16, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 16.5, 3, 133, 266, 33, "Warning 499: Height not compliant with standards", "" }, + /*271*/ { BARCODE_KOREAPOST, -1, 1, "123456", "", 0, 1, 1, 167, 334, 2, "", "" }, + /*272*/ { BARCODE_KOREAPOST, COMPLIANT_HEIGHT, 1, "123456", "", 0, 1, 1, 167, 334, 2, "", "TODO: Find doc" }, + /*273*/ { BARCODE_KOREAPOST, -1, 4, "123456", "", 0, 4, 1, 167, 334, 8, "", "" }, + /*274*/ { BARCODE_DBAR_STK, -1, -1, "1234567890123", "", 0, 13, 3, 50, 100, 26, "", "" }, + /*275*/ { BARCODE_DBAR_STK, -1, 1, "1234567890123", "", 0, 2, 3, 50, 100, 4, "", "" }, + /*276*/ { BARCODE_DBAR_STK, -1, 12, "1234567890123", "", 0, 12, 3, 50, 100, 24, "", "" }, + /*277*/ { BARCODE_DBAR_STK, COMPLIANT_HEIGHT, 12, "1234567890123", "", ZINT_WARN_NONCOMPLIANT, 12, 3, 50, 100, 24, "Warning 379: Height not compliant with standards", "" }, + /*278*/ { BARCODE_DBAR_STK, COMPLIANT_HEIGHT, 13, "1234567890123", "", 0, 13, 3, 50, 100, 26, "", "" }, + /*279*/ { BARCODE_DBAR_OMNSTK, -1, -1, "1234567890123", "", 0, 69, 5, 50, 100, 138, "", "" }, + /*280*/ { BARCODE_DBAR_OMNSTK, -1, 1, "1234567890123", "", 0, 4, 5, 50, 100, 8, "", "" }, + /*281*/ { BARCODE_DBAR_OMNSTK, -1, 68, "1234567890123", "", 0, 68, 5, 50, 100, 136, "", "" }, + /*282*/ { BARCODE_DBAR_OMNSTK, COMPLIANT_HEIGHT, 68, "1234567890123", "", ZINT_WARN_NONCOMPLIANT, 68, 5, 50, 100, 136, "Warning 247: Height not compliant with standards", "" }, + /*283*/ { BARCODE_DBAR_OMNSTK, COMPLIANT_HEIGHT, 69, "1234567890123", "", 0, 69, 5, 50, 100, 138, "", "" }, + /*284*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142, "", "2 rows" }, + /*285*/ { BARCODE_DBAR_EXPSTK, -1, 1, "[01]12345678901231", "", 0, 4, 5, 102, 204, 8, "", "" }, + /*286*/ { BARCODE_DBAR_EXPSTK, -1, 70, "[01]12345678901231", "", 0, 70, 5, 102, 204, 140, "", "" }, + /*287*/ { BARCODE_DBAR_EXPSTK, COMPLIANT_HEIGHT, 70, "[01]12345678901231", "", ZINT_WARN_NONCOMPLIANT, 70, 5, 102, 204, 140, "Warning 247: Height not compliant with standards", "" }, + /*288*/ { BARCODE_DBAR_EXPSTK, COMPLIANT_HEIGHT, 71, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142, "", "" }, + /*289*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "", "3 rows" }, + /*290*/ { BARCODE_DBAR_EXPSTK, -1, 1, "[01]09501101530003[3920]123456789012345", "", 0, 7.5, 9, 102, 204, 15, "", "" }, + /*291*/ { BARCODE_DBAR_EXPSTK, -1, 107.5, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "", "" }, + /*292*/ { BARCODE_DBAR_EXPSTK, COMPLIANT_HEIGHT, 107.5, "[01]09501101530003[3920]123456789012345", "", ZINT_WARN_NONCOMPLIANT, 108, 9, 102, 204, 216, "Warning 247: Height not compliant with standards", "" }, + /*293*/ { BARCODE_DBAR_EXPSTK, COMPLIANT_HEIGHT, 108, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "", "" }, + /*294*/ { BARCODE_PLANET, -1, -1, "12345678901", "", 0, 12, 2, 123, 246, 24, "", "" }, + /*295*/ { BARCODE_PLANET, -1, 1, "12345678901", "", 0, 1, 2, 123, 246, 2, "", "" }, + /*296*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, 1, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 1.5, 2, 123, 246, 3, "Warning 498: Height not compliant with standards", "" }, + /*297*/ { BARCODE_PLANET, -1, 4.5, "12345678901", "", 0, 5, 2, 123, 246, 10, "", "" }, + /*298*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, 4.5, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 4.5, 2, 123, 246, 9, "Warning 498: Height not compliant with standards", "" }, + /*299*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, 4.6, "12345678901", "", 0, 5, 2, 123, 246, 10, "", "" }, + /*300*/ { BARCODE_PLANET, -1, 9, "12345678901", "", 0, 9, 2, 123, 246, 18, "", "" }, + /*301*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, 9, "12345678901", "", 0, 9, 2, 123, 246, 18, "", "" }, + /*302*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, 9.1, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 9, 2, 123, 246, 18, "Warning 498: Height not compliant with standards", "" }, + /*303*/ { BARCODE_PLANET, -1, 24, "12345678901", "", 0, 24, 2, 123, 246, 48, "", "" }, + /*304*/ { BARCODE_PLANET, COMPLIANT_HEIGHT, 24, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 24, 2, 123, 246, 48, "Warning 498: Height not compliant with standards", "" }, + /*305*/ { BARCODE_MICROPDF417, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 20, 10, 82, 164, 40, "", "10 rows" }, + /*306*/ { BARCODE_MICROPDF417, -1, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 5, 10, 82, 164, 10, "Warning 247: Height not compliant with standards", "" }, + /*307*/ { BARCODE_MICROPDF417, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 5, 10, 82, 164, 10, "Warning 247: Height not compliant with standards", "" }, + /*308*/ { BARCODE_MICROPDF417, -1, 19, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 10, 82, 164, 40, "Warning 247: Height not compliant with standards", "" }, + /*309*/ { BARCODE_MICROPDF417, -1, 30, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 30, 10, 82, 164, 60, "", "" }, + /*310*/ { BARCODE_MICROPDF417, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 40, 20, 55, 110, 80, "", "20 rows" }, + /*311*/ { BARCODE_MICROPDF417, -1, 20, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 20, 55, 110, 40, "Warning 247: Height not compliant with standards", "" }, + /*312*/ { BARCODE_USPS_IMAIL, -1, -1, "12345678901234567890", "", 0, 8, 3, 129, 258, 16, "", "" }, + /*313*/ { BARCODE_USPS_IMAIL, -1, 1, "12345678901234567890", "", 0, 2.5, 3, 129, 258, 5, "", "" }, + /*314*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 1, "12345678901234567890", "", ZINT_WARN_NONCOMPLIANT, 1.5, 3, 129, 258, 3, "Warning 499: Height not compliant with standards", "" }, + /*315*/ { BARCODE_USPS_IMAIL, -1, 4.8, "12345678901234567890", "", 0, 5, 3, 129, 258, 10, "", "" }, + /*316*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 4.8, "12345678901234567890", "", ZINT_WARN_NONCOMPLIANT, 4.5, 3, 129, 258, 9, "Warning 499: Height not compliant with standards", "" }, + /*317*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 4.9, "12345678901234567890", "", 0, 4.5, 3, 129, 258, 9, "", "" }, + /*318*/ { BARCODE_USPS_IMAIL, -1, 7.7, "12345678901234567890", "", 0, 8, 3, 129, 258, 16, "", "" }, + /*319*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 7.7, "12345678901234567890", "", 0, 7.5, 3, 129, 258, 15, "", "" }, + /*320*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 7.8, "12345678901234567890", "", ZINT_WARN_NONCOMPLIANT, 7.5, 3, 129, 258, 15, "Warning 499: Height not compliant with standards", "" }, + /*321*/ { BARCODE_PLESSEY, -1, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "", "" }, + /*322*/ { BARCODE_PLESSEY, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "", "TODO: Find doc" }, + /*323*/ { BARCODE_PLESSEY, -1, 4, "1234567890", "", 0, 4, 1, 227, 454, 8, "", "" }, + /*324*/ { BARCODE_TELEPEN_NUM, -1, 1, "1234567890", "", 0, 1, 1, 128, 256, 2, "", "" }, + /*325*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 128, 256, 2, "", "No known min" }, + /*326*/ { BARCODE_TELEPEN_NUM, -1, 4, "1234567890", "", 0, 4, 1, 128, 256, 8, "", "" }, + /*327*/ { BARCODE_ITF14, -1, 1, "1234567890", "", 0, 1, 1, 135, 330, 22, "", "" }, + /*328*/ { BARCODE_ITF14, -1, 5.7, "1234567890", "", 0, 5.5, 1, 135, 330, 31, "", "" }, + /*329*/ { BARCODE_ITF14, COMPLIANT_HEIGHT, 5.7, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 5.5, 1, 135, 330, 31, "Warning 247: Height not compliant with standards", "" }, + /*330*/ { BARCODE_ITF14, COMPLIANT_HEIGHT, 5.8, "1234567890", "", 0, 6, 1, 135, 330, 32, "", "" }, + /*331*/ { BARCODE_KIX, -1, -1, "1234567890", "", 0, 8, 3, 79, 158, 16, "", "" }, + /*332*/ { BARCODE_KIX, -1, 1, "1234567890", "", 0, 2.5, 3, 79, 158, 5, "", "" }, + /*333*/ { BARCODE_KIX, COMPLIANT_HEIGHT, 1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 1.5, 3, 79, 158, 3, "Warning 499: Height not compliant with standards", "" }, + /*334*/ { BARCODE_KIX, -1, 6.4, "1234567890", "", 0, 6.5, 3, 79, 158, 13, "", "" }, + /*335*/ { BARCODE_KIX, COMPLIANT_HEIGHT, 6.4, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 6.5, 3, 79, 158, 13, "Warning 499: Height not compliant with standards", "" }, + /*336*/ { BARCODE_KIX, COMPLIANT_HEIGHT, 6.5, "1234567890", "", 0, 6.5, 3, 79, 158, 13, "", "" }, + /*337*/ { BARCODE_KIX, -1, 10.8, "1234567890", "", 0, 10.5, 3, 79, 158, 21, "", "" }, + /*338*/ { BARCODE_KIX, COMPLIANT_HEIGHT, 10.8, "1234567890", "", 0, 11, 3, 79, 158, 22, "", "" }, + /*339*/ { BARCODE_KIX, COMPLIANT_HEIGHT, 10.9, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 11, 3, 79, 158, 22, "Warning 499: Height not compliant with standards", "" }, + /*340*/ { BARCODE_KIX, -1, 16, "1234567890", "", 0, 16, 3, 79, 158, 32, "", "" }, + /*341*/ { BARCODE_KIX, COMPLIANT_HEIGHT, 16, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 16, 3, 79, 158, 32, "Warning 499: Height not compliant with standards", "" }, + /*342*/ { BARCODE_AZTEC, -1, 1, "1234567890AB", "", 0, 15, 15, 15, 30, 30, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*343*/ { BARCODE_DAFT, -1, -1, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16, "", "" }, + /*344*/ { BARCODE_DAFT, -1, 1, "DAFTDAFTDAFTDAFT", "", 0, 2.5, 3, 31, 62, 5, "", "" }, + /*345*/ { BARCODE_DAFT, COMPLIANT_HEIGHT, 1, "DAFTDAFTDAFTDAFT", "", 0, 2.5, 3, 31, 62, 5, "", "" }, + /*346*/ { BARCODE_DAFT, -1, 4, "DAFTDAFTDAFTDAFT", "", 0, 4, 3, 31, 62, 8, "", "" }, + /*347*/ { BARCODE_DAFT, -1, 6, "DAFTDAFTDAFTDAFT", "", 0, 6.5, 3, 31, 62, 13, "", "" }, + /*348*/ { BARCODE_DAFT, -1, 12, "DAFTDAFTDAFTDAFT", "", 0, 12, 3, 31, 62, 24, "", "" }, + /*349*/ { BARCODE_DAFT, -1, 16, "DAFTDAFTDAFTDAFT", "", 0, 16, 3, 31, 62, 32, "", "" }, + /*350*/ { BARCODE_DAFT, COMPLIANT_HEIGHT, 16, "DAFTDAFTDAFTDAFT", "", 0, 16, 3, 31, 62, 32, "", "" }, + /*351*/ { BARCODE_DPD, -1, 1, "0123456789012345678901234567", "", 0, 1, 1, 189, 378, 8, "", "" }, + /*352*/ { BARCODE_DPD, -1, 62, "0123456789012345678901234567", "", 0, 62, 1, 189, 378, 130, "", "" }, + /*353*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62, "0123456789012345678901234567", "", ZINT_WARN_NONCOMPLIANT, 62, 1, 189, 378, 130, "Warning 247: Height not compliant with standards", "" }, + /*354*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62.5, "0123456789012345678901234567", "", 0, 62.5, 1, 189, 378, 131, "", "" }, + /*355*/ { BARCODE_MICROQR, -1, 1, "12345", "", 0, 11, 11, 11, 22, 22, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*356*/ { BARCODE_HIBC_128, -1, 1, "1234567890", "", 0, 1, 1, 123, 246, 2, "", "" }, + /*357*/ { BARCODE_HIBC_128, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 123, 246, 2, "", "" }, + /*358*/ { BARCODE_HIBC_128, -1, 4, "1234567890", "", 0, 4, 1, 123, 246, 8, "", "" }, + /*359*/ { BARCODE_HIBC_39, -1, 1, "1234567890", "", 0, 1, 1, 223, 446, 2, "", "" }, + /*360*/ { BARCODE_HIBC_39, COMPLIANT_HEIGHT, 1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 1, 1, 223, 446, 2, "Warning 247: Height not compliant with standards", "" }, + /*361*/ { BARCODE_HIBC_39, -1, 4, "1234567890", "", 0, 4, 1, 223, 446, 8, "", "" }, + /*362*/ { BARCODE_HIBC_DM, -1, 1, "ABC", "", 0, 12, 12, 12, 24, 24, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*363*/ { BARCODE_HIBC_QR, -1, 1, "1234567890AB", "", 0, 21, 21, 21, 42, 42, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*364*/ { BARCODE_HIBC_PDF, -1, -1, "ABCDEF", "", 0, 21, 7, 103, 206, 42, "", "7 rows" }, + /*365*/ { BARCODE_HIBC_PDF, -1, 1, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 3.5, 7, 103, 206, 7, "Warning 247: Height not compliant with standards", "" }, + /*366*/ { BARCODE_HIBC_PDF, -1, 4, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 3.5, 7, 103, 206, 7, "Warning 247: Height not compliant with standards", "" }, + /*367*/ { BARCODE_HIBC_PDF, -1, 36, "ABCDEF", "", 0, 35, 7, 103, 206, 70, "", "" }, + /*368*/ { BARCODE_HIBC_MICPDF, -1, -1, "ABCDEF", "", 0, 12, 6, 82, 164, 24, "", "6 rows" }, + /*369*/ { BARCODE_HIBC_MICPDF, -1, 1, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 3, 6, 82, 164, 6, "Warning 247: Height not compliant with standards", "" }, + /*370*/ { BARCODE_HIBC_MICPDF, -1, 4, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 3, 6, 82, 164, 6, "Warning 247: Height not compliant with standards", "" }, + /*371*/ { BARCODE_HIBC_MICPDF, -1, 47, "ABCDEF", "", 0, 48, 6, 82, 164, 96, "", "" }, + /*372*/ { BARCODE_HIBC_BLOCKF, -1, -1, "1234567890", "", 0, 30, 3, 101, 242, 64, "", "3 rows" }, + /*373*/ { BARCODE_HIBC_BLOCKF, -1, 1, "1234567890", "", 0, 1.5, 3, 101, 242, 7, "", "" }, + /*374*/ { BARCODE_HIBC_BLOCKF, COMPLIANT_HEIGHT, 1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 1.5, 3, 101, 242, 7, "Warning 247: Height not compliant with standards", "" }, + /*375*/ { BARCODE_HIBC_BLOCKF, -1, 4, "1234567890", "", 0, 4.5, 3, 101, 242, 13, "", "" }, + /*376*/ { BARCODE_HIBC_BLOCKF, COMPLIANT_HEIGHT, 4, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 4.5, 3, 101, 242, 13, "Warning 247: Height not compliant with standards", "" }, + /*377*/ { BARCODE_HIBC_BLOCKF, -1, 23, "1234567890", "", 0, 22.5, 3, 101, 242, 49, "", "" }, + /*378*/ { BARCODE_HIBC_BLOCKF, COMPLIANT_HEIGHT, 23, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 22.5, 3, 101, 242, 49, "Warning 247: Height not compliant with standards", "" }, + /*379*/ { BARCODE_HIBC_BLOCKF, COMPLIANT_HEIGHT, 24, "1234567890", "", 0, 24, 3, 101, 242, 52, "", "" }, + /*380*/ { BARCODE_HIBC_BLOCKF, -1, 60, "1234567890", "", 0, 60, 3, 101, 242, 124, "", "" }, + /*381*/ { BARCODE_HIBC_BLOCKF, COMPLIANT_HEIGHT, 60, "1234567890", "", 0, 60, 3, 101, 242, 124, "", "" }, + /*382*/ { BARCODE_HIBC_AZTEC, -1, 1, "1234567890AB", "", 0, 19, 19, 19, 38, 38, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*383*/ { BARCODE_DOTCODE, -1, 1, "ABC", "", 0, 11, 11, 16, 33, 23, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*384*/ { BARCODE_HANXIN, -1, 1, "1234567890AB", "", 0, 23, 23, 23, 46, 46, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*385*/ { BARCODE_MAILMARK_2D, -1, 1, "012100123412345678AB19XY1A 0", "", 0, 24, 24, 24, 48, 48, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*386*/ { BARCODE_UPU_S10, -1, 1, "EE876543216CA", "", 0, 1, 1, 156, 312, 2, "", "" }, + /*387*/ { BARCODE_UPU_S10, COMPLIANT_HEIGHT, 1, "EE876543216CA", "", ZINT_WARN_NONCOMPLIANT, 1, 1, 156, 312, 2, "Warning 247: Height not compliant with standards", "" }, + /*388*/ { BARCODE_UPU_S10, -1, 24.5, "EE876543216CA", "", 0, 24.5, 1, 156, 312, 49, "", "" }, + /*389*/ { BARCODE_UPU_S10, COMPLIANT_HEIGHT, 24.5, "EE876543216CA", "", ZINT_WARN_NONCOMPLIANT, 24.5, 1, 156, 312, 49, "Warning 247: Height not compliant with standards", "" }, + /*390*/ { BARCODE_UPU_S10, -1, 25, "EE876543216CA", "", 0, 25, 1, 156, 312, 50, "", "" }, + /*391*/ { BARCODE_UPU_S10, COMPLIANT_HEIGHT, 25, "EE876543216CA", "", 0, 25, 1, 156, 312, 50, "", "" }, + /*392*/ { BARCODE_MAILMARK_4S, -1, -1, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "", "" }, + /*393*/ { BARCODE_MAILMARK_4S, -1, 1, "01000000000000000AA00AA0A", "", 0, 2.5, 3, 155, 310, 5, "", "" }, + /*394*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, 1, "01000000000000000AA00AA0A", "", ZINT_WARN_NONCOMPLIANT, 1.5, 3, 155, 310, 3, "Warning 499: Height not compliant with standards", "" }, + /*395*/ { BARCODE_MAILMARK_4S, -1, 6.4, "01000000000000000AA00AA0A", "", 0, 6.5, 3, 155, 310, 13, "", "" }, + /*396*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, 6.4, "01000000000000000AA00AA0A", "", ZINT_WARN_NONCOMPLIANT, 6.5, 3, 155, 310, 13, "Warning 499: Height not compliant with standards", "" }, + /*397*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, 6.5, "01000000000000000AA00AA0A", "", 0, 6.5, 3, 155, 310, 13, "", "" }, + /*398*/ { BARCODE_MAILMARK_4S, -1, 10, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "", "" }, + /*399*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, 10, "01000000000000000AA00AA0A", "", 0, 9.5, 3, 155, 310, 19, "", "" }, + /*400*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, 11, "01000000000000000AA00AA0A", "", ZINT_WARN_NONCOMPLIANT, 11, 3, 155, 310, 22, "Warning 499: Height not compliant with standards", "" }, + /*401*/ { BARCODE_MAILMARK_4S, -1, 15, "01000000000000000AA00AA0A", "", 0, 15, 3, 155, 310, 30, "", "" }, + /*402*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, 15, "01000000000000000AA00AA0A", "", ZINT_WARN_NONCOMPLIANT, 15, 3, 155, 310, 30, "Warning 499: Height not compliant with standards", "" }, + /*403*/ { BARCODE_MAILMARK_4S, -1, 20, "01000000000000000AA00AA0A", "", 0, 20, 3, 155, 310, 40, "", "" }, + /*404*/ { BARCODE_MAILMARK_4S, COMPLIANT_HEIGHT, 20, "01000000000000000AA00AA0A", "", ZINT_WARN_NONCOMPLIANT, 20, 3, 155, 310, 40, "Warning 499: Height not compliant with standards", "" }, + /*405*/ { BARCODE_AZRUNE, -1, 1, "1", "", 0, 11, 11, 11, 22, 22, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*406*/ { BARCODE_CODE32, -1, 1, "12345678", "", 0, 1, 1, 103, 206, 2, "", "" }, + /*407*/ { BARCODE_CODE32, COMPLIANT_HEIGHT, 1, "12345678", "", ZINT_WARN_NONCOMPLIANT, 1, 1, 103, 206, 2, "Warning 247: Height not compliant with standards", "" }, + /*408*/ { BARCODE_CODE32, -1, 19, "12345678", "", 0, 19, 1, 103, 206, 38, "", "" }, + /*409*/ { BARCODE_CODE32, COMPLIANT_HEIGHT, 19, "12345678", "", ZINT_WARN_NONCOMPLIANT, 19, 1, 103, 206, 38, "Warning 247: Height not compliant with standards", "" }, + /*410*/ { BARCODE_CODE32, COMPLIANT_HEIGHT, 20, "12345678", "", 0, 20, 1, 103, 206, 40, "", "" }, + /*411*/ { BARCODE_EANX_CC, -1, -1, "123456789012", "[20]01", 0, 50, 7, 99, 226, 110, "", "EAN-13, CC-A 3 rows" }, + /*412*/ { BARCODE_EANX_CC, -1, 1, "123456789012", "[20]01", 0, 12.5, 7, 99, 226, 35, "", "" }, + /*413*/ { BARCODE_EANX_CC, -1, 81, "123456789012", "[20]01", 0, 81, 7, 99, 226, 172, "", "" }, + /*414*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 81, "123456789012", "[20]01", ZINT_WARN_NONCOMPLIANT, 81, 7, 99, 226, 172, "Warning 247: Height not compliant with standards", "" }, + /*415*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 81.25, "123456789012", "[20]01", 0, 81.5, 7, 99, 226, 173, "", "" }, + /*416*/ { BARCODE_EANX_CC, -1, -1, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 50, 9, 99, 226, 110, "", "EAN-13, CC-A 5 rows" }, + /*417*/ { BARCODE_EANX_CC, -1, 1, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 16.5, 9, 99, 226, 43, "", "" }, + /*418*/ { BARCODE_EANX_CC, -1, 85, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 85, 9, 99, 226, 180, "", "" }, + /*419*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 85, "123456789012", "[20]01[90]123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, 85, 9, 99, 226, 180, "Warning 247: Height not compliant with standards", "" }, + /*420*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 85.25, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 85.5, 9, 99, 226, 181, "", "" }, + /*421*/ { BARCODE_EANX_CC, -1, -1, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 50, 11, 99, 226, 110, "", "EAN-13, CC-A 7 rows" }, + /*422*/ { BARCODE_EANX_CC, -1, 1, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 20.5, 11, 99, 226, 51, "", "" }, + /*423*/ { BARCODE_EANX_CC, -1, 89, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 89, 11, 99, 226, 188, "", "" }, + /*424*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 89, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", ZINT_WARN_NONCOMPLIANT, 89, 11, 99, 226, 188, "Warning 247: Height not compliant with standards", "" }, + /*425*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 89.25, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 89.5, 11, 99, 226, 189, "", "" }, + /*426*/ { BARCODE_EANX_CC, -1, -1, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 50, 14, 99, 226, 110, "", "EAN-13, CC-B 10 rows" }, + /*427*/ { BARCODE_EANX_CC, -1, 1, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 26.5, 14, 99, 226, 63, "", "" }, + /*428*/ { BARCODE_EANX_CC, -1, 95, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 95, 14, 99, 226, 200, "", "" }, + /*429*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 95, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 95, 14, 99, 226, 200, "Warning 247: Height not compliant with standards", "" }, + /*430*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 95.25, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 95.5, 14, 99, 226, 201, "", "" }, + /*431*/ { BARCODE_EANX_CC, -1, -1, "1234567", "[20]01[90]123456789012345678901234", 0, 50, 10, 72, 162, 110, "", "EAN-8, CC-A 4 rows" }, + /*432*/ { BARCODE_EANX_CC, -1, 1, "1234567", "[20]01[90]123456789012345678901234", 0, 18.5, 10, 72, 162, 47, "", "" }, + /*433*/ { BARCODE_EANX_CC, -1, 73, "1234567", "[20]01[90]123456789012345678901234", 0, 73, 10, 72, 162, 156, "", "" }, + /*434*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 73, "1234567", "[20]01[90]123456789012345678901234", ZINT_WARN_NONCOMPLIANT, 73, 10, 72, 162, 156, "Warning 247: Height not compliant with standards", "" }, + /*435*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 73.25, "1234567", "[20]01[90]123456789012345678901234", 0, 73.5, 10, 72, 162, 157, "", "" }, + /*436*/ { BARCODE_EANX_CC, -1, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 50, 24, 82, 178, 110, "", "EAN-8, CC-B 15 rows" }, + /*437*/ { BARCODE_EANX_CC, -1, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 46.5, 24, 82, 178, 103, "", "" }, + /*438*/ { BARCODE_EANX_CC, -1, 101, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 101, 24, 82, 178, 212, "", "" }, + /*439*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 101, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, 101, 24, 82, 178, 212, "Warning 247: Height not compliant with standards", "" }, + /*440*/ { BARCODE_EANX_CC, COMPLIANT_HEIGHT, 101.25, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 101.5, 24, 82, 178, 213, "", "" }, + /*441*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231", "[20]01", 0, 50, 5, 145, 290, 100, "", "CC-A 3 rows" }, + /*442*/ { BARCODE_GS1_128_CC, -1, 1, "[01]12345678901231", "[20]01", 0, 7.5, 5, 145, 290, 15, "", "" }, + /*443*/ { BARCODE_GS1_128_CC, -1, 12.5, "[01]12345678901231", "[20]01", 0, 12.5, 5, 145, 290, 25, "", "" }, + /*444*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 12.5, "[01]12345678901231", "[20]01", ZINT_WARN_NONCOMPLIANT, 12.5, 5, 145, 290, 25, "Warning 247: Height not compliant with standards", "" }, + /*445*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 12.75, "[01]12345678901231", "[20]01", 0, 13, 5, 145, 290, 26, "", "" }, + /*446*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 50, 9, 145, 290, 100, "", "CC-A 7 rows" }, + /*447*/ { BARCODE_GS1_128_CC, -1, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 15.5, 9, 145, 290, 31, "", "" }, + /*448*/ { BARCODE_GS1_128_CC, -1, 20.7, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 20.5, 9, 145, 290, 41, "", "" }, + /*449*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 20.7, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", ZINT_WARN_NONCOMPLIANT, 20.5, 9, 145, 290, 41, "Warning 247: Height not compliant with standards", "" }, + /*450*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 20.75, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 21, 9, 145, 290, 42, "", "" }, + /*451*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 50, 12, 145, 290, 100, "", "CC-B 10 rows" }, + /*452*/ { BARCODE_GS1_128_CC, -1, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 21.5, 12, 145, 290, 43, "", "" }, + /*453*/ { BARCODE_GS1_128_CC, -1, 26.5, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 26.5, 12, 145, 290, 53, "", "" }, + /*454*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 26.5, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 26.5, 12, 145, 290, 53, "Warning 247: Height not compliant with standards", "" }, + /*455*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 26.75, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 27, 12, 145, 290, 54, "", "" }, + /*456*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 91.5, 32, 154, 308, 183, "", "CC-C 30 rows" }, + /*457*/ { BARCODE_GS1_128_CC, -1, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 91.5, 32, 154, 308, 183, "", "" }, + /*458*/ { BARCODE_GS1_128_CC, -1, 96.5, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 96.5, 32, 154, 308, 193, "", "" }, + /*459*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 96.5, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, 96.5, 32, 154, 308, 193, "Warning 247: Height not compliant with standards", "" }, + /*460*/ { BARCODE_GS1_128_CC, COMPLIANT_HEIGHT, 96.75, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 97, 32, 154, 308, 194, "", "" }, + /*461*/ { BARCODE_DBAR_OMN_CC, -1, -1, "1234567890123", "[20]01[90]1234567890", 0, 21, 5, 100, 200, 42, "", "CC-A 3 rows" }, + /*462*/ { BARCODE_DBAR_OMN_CC, -1, 1, "1234567890123", "[20]01[90]1234567890", 0, 7.5, 5, 100, 200, 15, "", "" }, + /*463*/ { BARCODE_DBAR_OMN_CC, -1, 19.9, "1234567890123", "[20]01[90]1234567890", 0, 20, 5, 100, 200, 40, "", "" }, + /*464*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 19.9, "1234567890123", "[20]01[90]1234567890", ZINT_WARN_NONCOMPLIANT, 20, 5, 100, 200, 40, "Warning 247: Height not compliant with standards", "" }, + /*465*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 20, "1234567890123", "[20]01[90]1234567890", 0, 20, 5, 100, 200, 40, "", "" }, + /*466*/ { BARCODE_DBAR_OMN_CC, -1, -1, "1234567890123", "[20]01[90]12345678901234567890", 0, 23, 6, 100, 200, 46, "", "CC-A 4 rows" }, + /*467*/ { BARCODE_DBAR_OMN_CC, -1, 1, "1234567890123", "[20]01[90]12345678901234567890", 0, 9.5, 6, 100, 200, 19, "", "" }, + /*468*/ { BARCODE_DBAR_OMN_CC, -1, 21.9, "1234567890123", "[20]01[90]12345678901234567890", 0, 22, 6, 100, 200, 44, "", "" }, + /*469*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 21.9, "1234567890123", "[20]01[90]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 22, 6, 100, 200, 44, "Warning 247: Height not compliant with standards", "" }, + /*470*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 22, "1234567890123", "[20]01[90]12345678901234567890", 0, 22, 6, 100, 200, 44, "", "" }, + /*471*/ { BARCODE_DBAR_OMN_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 35, 12, 100, 200, 70, "", "CC-B 10 rows" }, + /*472*/ { BARCODE_DBAR_OMN_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 21.5, 12, 100, 200, 43, "", "" }, + /*473*/ { BARCODE_DBAR_OMN_CC, -1, 33.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 34, 12, 100, 200, 68, "", "" }, + /*474*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 33.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 34, 12, 100, 200, 68, "Warning 247: Height not compliant with standards", "" }, + /*475*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 34, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 34, 12, 100, 200, 68, "", "" }, + /*476*/ { BARCODE_DBAR_OMN_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 39, 14, 100, 200, 78, "", "CC-B 12 rows" }, + /*477*/ { BARCODE_DBAR_OMN_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 25.5, 14, 100, 200, 51, "", "" }, + /*478*/ { BARCODE_DBAR_OMN_CC, -1, 37.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 38, 14, 100, 200, 76, "", "" }, + /*479*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 37.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, 38, 14, 100, 200, 76, "Warning 247: Height not compliant with standards", "" }, + /*480*/ { BARCODE_DBAR_OMN_CC, COMPLIANT_HEIGHT, 38, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 38, 14, 100, 200, 76, "", "" }, + /*481*/ { BARCODE_DBAR_LTD_CC, -1, -1, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 38, "", "CC-A 4 rows" }, + /*482*/ { BARCODE_DBAR_LTD_CC, -1, 1, "1234567890123", "[20]01", 0, 9.5, 6, 79, 158, 19, "", "" }, + /*483*/ { BARCODE_DBAR_LTD_CC, -1, 18, "1234567890123", "[20]01", 0, 18, 6, 79, 158, 36, "", "" }, + /*484*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, 18, "1234567890123", "[20]01", ZINT_WARN_NONCOMPLIANT, 18, 6, 79, 158, 36, "Warning 247: Height not compliant with standards", "" }, + /*485*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, 19, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 38, "", "" }, + /*486*/ { BARCODE_DBAR_LTD_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 25, 9, 79, 158, 50, "", "CC-A 7 rows" }, + /*487*/ { BARCODE_DBAR_LTD_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 15.5, 9, 79, 158, 31, "", "" }, + /*488*/ { BARCODE_DBAR_LTD_CC, -1, 24.9, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 25, 9, 79, 158, 50, "", "" }, + /*489*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, 24.9, "1234567890123", "[20]01[90]123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, 25, 9, 79, 158, 50, "Warning 247: Height not compliant with standards", "" }, + /*490*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, 25, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 25, 9, 79, 158, 50, "", "" }, + /*491*/ { BARCODE_DBAR_LTD_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 22, 88, 176, 102, "", "CC-B 20 rows" }, + /*492*/ { BARCODE_DBAR_LTD_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 41.5, 22, 88, 176, 83, "", "" }, + /*493*/ { BARCODE_DBAR_LTD_CC, -1, 50.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 22, 88, 176, 102, "", "" }, + /*494*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, 50.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, 51, 22, 88, 176, 102, "Warning 247: Height not compliant with standards", "" }, + /*495*/ { BARCODE_DBAR_LTD_CC, COMPLIANT_HEIGHT, 51, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 22, 88, 176, 102, "", "" }, + /*496*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 82, "", "CC-A 3 rows" }, + /*497*/ { BARCODE_DBAR_EXP_CC, -1, 1, "[01]12345678901231", "[20]01", 0, 7.5, 5, 134, 268, 15, "", "" }, + /*498*/ { BARCODE_DBAR_EXP_CC, -1, 40, "[01]12345678901231", "[20]01", 0, 40, 5, 134, 268, 80, "", "" }, + /*499*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, 40, "[01]12345678901231", "[20]01", ZINT_WARN_NONCOMPLIANT, 40, 5, 134, 268, 80, "Warning 247: Height not compliant with standards", "" }, + /*500*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, 41, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 82, "", "" }, + /*501*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 45, 7, 134, 268, 90, "", "CC-A 5 rows" }, + /*502*/ { BARCODE_DBAR_EXP_CC, -1, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 11.5, 7, 134, 268, 23, "", "" }, + /*503*/ { BARCODE_DBAR_EXP_CC, -1, 44, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 44, 7, 134, 268, 88, "", "" }, + /*504*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, 44, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", ZINT_WARN_NONCOMPLIANT, 44, 7, 134, 268, 88, "Warning 247: Height not compliant with standards", "" }, + /*505*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, 45, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 45, 7, 134, 268, 90, "", "" }, + /*506*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 55, 12, 134, 268, 110, "", "CC-B 10 rows" }, + /*507*/ { BARCODE_DBAR_EXP_CC, -1, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 21.5, 12, 134, 268, 43, "", "" }, + /*508*/ { BARCODE_DBAR_EXP_CC, -1, 54, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 54, 12, 134, 268, 108, "", "" }, + /*509*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, 54, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 54, 12, 134, 268, 108, "Warning 247: Height not compliant with standards", "" }, + /*510*/ { BARCODE_DBAR_EXP_CC, COMPLIANT_HEIGHT, 55, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 55, 12, 134, 268, 110, "", "" }, + /*511*/ { BARCODE_UPCA_CC, -1, -1, "12345678901", "[20]01", 0, 50, 7, 99, 226, 110, "", "CC-A 3 rows" }, + /*512*/ { BARCODE_UPCA_CC, -1, 1, "12345678901", "[20]01", 0, 12.5, 7, 99, 226, 35, "", "" }, + /*513*/ { BARCODE_UPCA_CC, -1, 81.24, "12345678901", "[20]01", 0, 81, 7, 99, 226, 172, "", "" }, + /*514*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, 81.24, "12345678901", "[20]01", ZINT_WARN_NONCOMPLIANT, 81, 7, 99, 226, 172, "Warning 247: Height not compliant with standards", "" }, + /*515*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, 81.25, "12345678901", "[20]01", 0, 81.5, 7, 99, 226, 173, "", "" }, + /*516*/ { BARCODE_UPCA_CC, -1, -1, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 50, 10, 99, 226, 110, "", "CC-A 6 rows" }, + /*517*/ { BARCODE_UPCA_CC, -1, 1, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 18.5, 10, 99, 226, 47, "", "" }, + /*518*/ { BARCODE_UPCA_CC, -1, 87.24, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 87, 10, 99, 226, 184, "", "" }, + /*519*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, 87.24, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", ZINT_WARN_NONCOMPLIANT, 87, 10, 99, 226, 184, "Warning 247: Height not compliant with standards", "" }, + /*520*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, 87.25, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 87.5, 10, 99, 226, 185, "", "" }, + /*521*/ { BARCODE_UPCA_CC, -1, -1, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 50, 16, 99, 226, 110, "", "CC-B 12 rows" }, + /*522*/ { BARCODE_UPCA_CC, -1, 1, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 30.5, 16, 99, 226, 71, "", "" }, + /*523*/ { BARCODE_UPCA_CC, -1, 99, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 99, 16, 99, 226, 208, "", "" }, + /*524*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, 99, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", ZINT_WARN_NONCOMPLIANT, 99, 16, 99, 226, 208, "Warning 247: Height not compliant with standards", "" }, + /*525*/ { BARCODE_UPCA_CC, COMPLIANT_HEIGHT, 99.25, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 99.5, 16, 99, 226, 209, "", "" }, + /*526*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]01[90]123456789012345678", 0, 50, 11, 55, 134, 110, "", "CC-A 7 rows" }, + /*527*/ { BARCODE_UPCE_CC, -1, 1, "1234567", "[20]01[90]123456789012345678", 0, 20.5, 11, 55, 134, 51, "", "" }, + /*528*/ { BARCODE_UPCE_CC, -1, 89, "1234567", "[20]01[90]123456789012345678", 0, 89, 11, 55, 134, 188, "", "" }, + /*529*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 89, "1234567", "[20]01[90]123456789012345678", ZINT_WARN_NONCOMPLIANT, 89, 11, 55, 134, 188, "Warning 247: Height not compliant with standards", "" }, + /*530*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 89.25, "1234567", "[20]01[90]123456789012345678", 0, 89.5, 11, 55, 134, 189, "", "" }, + /*531*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 50, 16, 55, 134, 110, "", "CC-A 12 rows" }, + /*532*/ { BARCODE_UPCE_CC, -1, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 30.5, 16, 55, 134, 71, "", "" }, + /*533*/ { BARCODE_UPCE_CC, -1, 99, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 99, 16, 55, 134, 208, "", "" }, + /*534*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 99, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", ZINT_WARN_NONCOMPLIANT, 99, 16, 55, 134, 208, "Warning 247: Height not compliant with standards", "" }, + /*535*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 99.25, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 99.5, 16, 55, 134, 209, "", "" }, + /*536*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 50, 21, 55, 134, 110, "", "CC-B 17 rows" }, + /*537*/ { BARCODE_UPCE_CC, -1, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 40.5, 21, 55, 134, 91, "", "" }, + /*538*/ { BARCODE_UPCE_CC, -1, 109, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 109, 21, 55, 134, 228, "", "" }, + /*539*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 109, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 109, 21, 55, 134, 228, "Warning 247: Height not compliant with standards", "" }, + /*540*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 109.25, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 109.5, 21, 55, 134, 229, "", "" }, + /*541*/ { BARCODE_UPCE_CC, -1, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 52.5, 27, 55, 134, 115, "", "CC-B 23 rows" }, + /*542*/ { BARCODE_UPCE_CC, -1, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 52.5, 27, 55, 134, 115, "", "" }, + /*543*/ { BARCODE_UPCE_CC, -1, 121, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 121, 27, 55, 134, 252, "", "" }, + /*544*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 121, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", ZINT_WARN_NONCOMPLIANT, 121, 27, 55, 134, 252, "Warning 247: Height not compliant with standards", "" }, + /*545*/ { BARCODE_UPCE_CC, COMPLIANT_HEIGHT, 121.25, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 121.5, 27, 55, 134, 253, "", "" }, + /*546*/ { BARCODE_DBAR_STK_CC, -1, -1, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48, "", "CC-A 5 rows" }, + /*547*/ { BARCODE_DBAR_STK_CC, -1, 1, "1234567890123", "[20]01", 0, 13, 9, 56, 112, 26, "", "" }, + /*548*/ { BARCODE_DBAR_STK_CC, -1, 23.9, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48, "", "" }, + /*549*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, 23.9, "1234567890123", "[20]01", ZINT_WARN_NONCOMPLIANT, 24, 9, 56, 112, 48, "Warning 379: Height not compliant with standards", "" }, + /*550*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, 24, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48, "", "" }, + /*551*/ { BARCODE_DBAR_STK_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 38, 16, 56, 112, 76, "", "CC-A 12 rows" }, + /*552*/ { BARCODE_DBAR_STK_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 27, 16, 56, 112, 54, "", "" }, + /*553*/ { BARCODE_DBAR_STK_CC, -1, 37.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 38, 16, 56, 112, 76, "", "" }, + /*554*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, 37.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", ZINT_WARN_NONCOMPLIANT, 38, 16, 56, 112, 76, "Warning 379: Height not compliant with standards", "" }, + /*555*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, 38, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 38, 16, 56, 112, 76, "", "" }, + /*556*/ { BARCODE_DBAR_STK_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 48, 21, 56, 112, 96, "", "CC-B 17 rows" }, + /*557*/ { BARCODE_DBAR_STK_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 37, 21, 56, 112, 74, "", "" }, + /*558*/ { BARCODE_DBAR_STK_CC, -1, 47.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 48, 21, 56, 112, 96, "", "" }, + /*559*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, 47.9, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 48, 21, 56, 112, 96, "Warning 379: Height not compliant with standards", "" }, + /*560*/ { BARCODE_DBAR_STK_CC, COMPLIANT_HEIGHT, 48, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 48, 21, 56, 112, 96, "", "" }, + /*561*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "1234567890123", "[20]01[90]1234567890123456", 0, 82, 12, 56, 112, 164, "", "CC-A 6 rows" }, + /*562*/ { BARCODE_DBAR_OMNSTK_CC, -1, 1, "1234567890123", "[20]01[90]1234567890123456", 0, 17, 12, 56, 112, 34, "", "" }, + /*563*/ { BARCODE_DBAR_OMNSTK_CC, -1, 81, "1234567890123", "[20]01[90]1234567890123456", 0, 81, 12, 56, 112, 162, "", "" }, + /*564*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, 81, "1234567890123", "[20]01[90]1234567890123456", ZINT_WARN_NONCOMPLIANT, 81, 12, 56, 112, 162, "Warning 247: Height not compliant with standards", "" }, + /*565*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, 82, "1234567890123", "[20]01[90]1234567890123456", 0, 82, 12, 56, 112, 164, "", "" }, + /*566*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", 0, 94, 18, 56, 112, 188, "", "CC-A 12 rows" }, + /*567*/ { BARCODE_DBAR_OMNSTK_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", 0, 29, 18, 56, 112, 58, "", "" }, + /*568*/ { BARCODE_DBAR_OMNSTK_CC, -1, 93.5, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", 0, 94, 18, 56, 112, 188, "", "" }, + /*569*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, 93.5, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", ZINT_WARN_NONCOMPLIANT, 94, 18, 56, 112, 188, "Warning 247: Height not compliant with standards", "" }, + /*570*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, 94, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", 0, 94, 18, 56, 112, 188, "", "" }, + /*571*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 104, 23, 56, 112, 208, "", "CC-B 17 rows" }, + /*572*/ { BARCODE_DBAR_OMNSTK_CC, -1, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 39, 23, 56, 112, 78, "", "" }, + /*573*/ { BARCODE_DBAR_OMNSTK_CC, -1, 103, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 103, 23, 56, 112, 206, "", "" }, + /*574*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, 103, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", ZINT_WARN_NONCOMPLIANT, 103, 23, 56, 112, 206, "Warning 247: Height not compliant with standards", "" }, + /*575*/ { BARCODE_DBAR_OMNSTK_CC, COMPLIANT_HEIGHT, 104, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 104, 23, 56, 112, 208, "", "" }, + /*576*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156, "", "3 rows, CC-A 3 rows" }, + /*577*/ { BARCODE_DBAR_EXPSTK_CC, -1, 1, "[01]12345678901231", "[20]01", 0, 11, 9, 102, 204, 22, "", "" }, + /*578*/ { BARCODE_DBAR_EXPSTK_CC, -1, 77, "[01]12345678901231", "[20]01", 0, 77, 9, 102, 204, 154, "", "" }, + /*579*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 77, "[01]12345678901231", "[20]01", ZINT_WARN_NONCOMPLIANT, 77, 9, 102, 204, 154, "Warning 247: Height not compliant with standards", "" }, + /*580*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 78, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156, "", "" }, + /*581*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 189, 21, 102, 204, 378, "", "5 rows, CC-A 3 rows" }, + /*582*/ { BARCODE_DBAR_EXPSTK_CC, -1, 1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 21.5, 21, 102, 204, 43, "", "" }, + /*583*/ { BARCODE_DBAR_EXPSTK_CC, -1, 188, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 189, 21, 102, 204, 378, "", "" }, + /*584*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 188, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", ZINT_WARN_NONCOMPLIANT, 189, 21, 102, 204, 378, "Warning 247: Height not compliant with standards", "" }, + /*585*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 189, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 189, 21, 102, 204, 378, "", "" }, + /*586*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 80, 10, 102, 204, 160, "", "3 rows, CC-A 4 rows" }, + /*587*/ { BARCODE_DBAR_EXPSTK_CC, -1, 1, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 13, 10, 102, 204, 26, "", "" }, + /*588*/ { BARCODE_DBAR_EXPSTK_CC, -1, 79, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 79, 10, 102, 204, 158, "", "" }, + /*589*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 79, "[01]12345678901231", "[20]01[90]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 79, 10, 102, 204, 158, "Warning 247: Height not compliant with standards", "" }, + /*590*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 80, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 80, 10, 102, 204, 160, "", "" }, + /*591*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 92, 16, 102, 204, 184, "", "3 rows, CC-B 10 rows" }, + /*592*/ { BARCODE_DBAR_EXPSTK_CC, -1, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 25, 16, 102, 204, 50, "", "" }, + /*593*/ { BARCODE_DBAR_EXPSTK_CC, -1, 91, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 91, 16, 102, 204, 182, "", "" }, + /*594*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 91, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 91, 16, 102, 204, 182, "Warning 247: Height not compliant with standards", "" }, + /*595*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 92, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 92, 16, 102, 204, 184, "", "" }, + /*596*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 203, 28, 102, 204, 406, "", "5 rows, CC-B 10 rows" }, + /*597*/ { BARCODE_DBAR_EXPSTK_CC, -1, 1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 35.5, 28, 102, 204, 71, "", "" }, + /*598*/ { BARCODE_DBAR_EXPSTK_CC, -1, 202, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 203, 28, 102, 204, 406, "", "" }, + /*599*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 202, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", ZINT_WARN_NONCOMPLIANT, 203, 28, 102, 204, 406, "Warning 247: Height not compliant with standards", "" }, + /*600*/ { BARCODE_DBAR_EXPSTK_CC, COMPLIANT_HEIGHT, 203, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 203, 28, 102, 204, 406, "", "" }, + /*601*/ { BARCODE_CHANNEL, -1, 1, "1", "", 0, 1, 1, 19, 38, 2, "", "" }, + /*602*/ { BARCODE_CHANNEL, -1, 3.75, "123", "", 0, 4, 1, 23, 46, 8, "", "" }, + /*603*/ { BARCODE_CHANNEL, COMPLIANT_HEIGHT, 3.75, "123", "", ZINT_WARN_NONCOMPLIANT, 4, 1, 23, 46, 8, "Warning 247: Height not compliant with standards", "Min height data-length dependent" }, + /*604*/ { BARCODE_CHANNEL, COMPLIANT_HEIGHT, 4, "123", "", 0, 4, 1, 23, 46, 8, "", "" }, + /*605*/ { BARCODE_CODEONE, -1, 1, "12345678901234567890", "", 0, 16, 16, 18, 36, 32, "", "Fixed height, symbol->height ignored" }, + /*606*/ { BARCODE_GRIDMATRIX, -1, 1, "ABC", "", 0, 18, 18, 18, 36, 36, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*607*/ { BARCODE_UPNQR, -1, 1, "1234567890AB", "", 0, 77, 77, 77, 154, 154, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*608*/ { BARCODE_ULTRA, -1, 1, "1234567890", "", 0, 13, 13, 18, 36, 26, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*609*/ { BARCODE_RMQR, -1, 1, "12345", "", 0, 11, 11, 27, 54, 22, "", "Fixed width-to-height ratio, symbol->height ignored" }, + /*610*/ { BARCODE_BC412, -1, 1, "1234567", "", 0, 1, 1, 102, 204, 2, "", "" }, + /*611*/ { BARCODE_BC412, -1, 13.6, "1234567", "", 0, 13.5, 1, 102, 204, 27, "", "" }, + /*612*/ { BARCODE_BC412, COMPLIANT_HEIGHT, 13.6, "1234567", "", ZINT_WARN_NONCOMPLIANT, 13.5, 1, 102, 204, 27, "Warning 247: Height not compliant with standards", "" }, + /*613*/ { BARCODE_BC412, COMPLIANT_HEIGHT, 13.65, "1234567", "", 0, 13.5, 1, 102, 204, 27, "", "" }, + /*614*/ { BARCODE_BC412, COMPLIANT_HEIGHT, 21.3, "1234567", "", 0, 21.5, 1, 102, 204, 43, "", "" }, + /*615*/ { BARCODE_BC412, COMPLIANT_HEIGHT, 21.35, "1234567", "", ZINT_WARN_NONCOMPLIANT, 21.5, 1, 102, 204, 43, "Warning 248: Height not compliant with standards", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -2919,11 +2920,12 @@ static void test_height(const testCtx *const p_ctx) { if (p_ctx->index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL); if (p_ctx->generate) { - printf(" /*%3d*/ { %s, %s, %.5g, \"%s\", \"%s\", %s, %.8g, %d, %d, %d, %d, \"%s\" },\n", + printf(" /*%3d*/ { %s, %s, %.5g, \"%s\", \"%s\", %s, %.8g, %d, %d, %d, %d, \"%s\", \"%s\" },\n", i, testUtilBarcodeName(data[i].symbology), testUtilOutputOptionsName(data[i].output_options), data[i].height, data[i].data, data[i].composite, testUtilErrorName(data[i].ret), - symbol->height, symbol->rows, symbol->width, symbol->bitmap_width, symbol->bitmap_height, data[i].comment); + symbol->height, symbol->rows, symbol->width, symbol->bitmap_width, symbol->bitmap_height, symbol->errtxt, data[i].comment); } else { + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %.8g != %.8g\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height); assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows); assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width); @@ -2962,7 +2964,7 @@ static void test_height_per_row(const testCtx *const p_ctx) { const char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, "1234567890", "", 0, 21, 7, 103, 206, 42, "" }, /* 1*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 0.5, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 3.5, 7, 103, 206, 7, "" }, /* 2*/ { BARCODE_PDF417, HEIGHTPERROW_MODE, -1, -1, -1, 1, -1, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 7, 7, 103, 206, 14, "" }, @@ -3040,7 +3042,7 @@ static void test_height_per_row(const testCtx *const p_ctx) { /* 74*/ { BARCODE_EANX_CC, HEIGHTPERROW_MODE, -1, -1, -1, 4, -1, "123456789012", "[20]01", 0, 16, 7, 99, 226, 42, "" }, /* 75*/ { BARCODE_EANX_CC, -1, -1, -1, -1, 4, -1, "123456789012", "[20]01", 0, 12.5, 7, 99, 226, 35, "4 height below fixed height" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -3128,7 +3130,7 @@ static void test_perf_scale(const testCtx *const p_ctx) { int expected_width; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, 0, 1.3, "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz&,:#-.$/+%*=^ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLM" "NOPQRSTUVWXYZ;<>@[]_`~!||()?{}'123456789012345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJK" @@ -3140,7 +3142,7 @@ static void test_perf_scale(const testCtx *const p_ctx) { /* 1*/ { BARCODE_POSTNET, -1, -1, BARCODE_QUIET_ZONES, -1, -1, 0, 1.1, "12345", 0, 2, 63, "POSTNET 5 chars, quiet zones, 1.1" }, /* 2*/ { BARCODE_ITF14, -1, 4, BARCODE_BIND, -1, -1, 61.8, 3.1, "12345", 0, 1, 135, "ITF14 bind 4, height 61.8, 3.1" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; diff --git a/backend/tests/test_rss.c b/backend/tests/test_rss.c index 54764dff..46dbab03 100644 --- a/backend/tests/test_rss.c +++ b/backend/tests/test_rss.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2022 Robin Stuart + Copyright (C) 2019-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -44,7 +44,7 @@ static void test_binary_div_modulo_divisor(const testCtx *const p_ctx) { int expected_width; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DBAR_OMN, "1234567890123", 100, 30, 1, 96, "010111010010000001001110000000010100001011111010110100011001100101111111110001011011000111000101" }, /* 1*/ { BARCODE_DBAR_OMN, "0000004537076", 100, 30, 1, 96, "010101001000000001000100000000010111111100101010111101111101010101111111110111010100100000000101" }, /* 2*/ { BARCODE_DBAR_OMN, "0000004537077", 100, 30, 1, 96, "010101001000000001000111000000010111111101001010101010110000000101111100000111011111111011010101" }, @@ -117,9 +117,9 @@ static void test_binary_div_modulo_divisor(const testCtx *const p_ctx) { /* 69*/ { BARCODE_DBAR_LTD, "1651257071912", 100, 30, 1, 79, "0100000111100011110101010101010111010100100101010101010101111110111111110100000" }, /* 70*/ { BARCODE_DBAR_LTD_CC, "0987144605916", 100, 30, 6, 79, "0101010101010011111000011111011010110100100101010101010100111110000111110100000" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char *text; @@ -130,7 +130,7 @@ static void test_binary_div_modulo_divisor(const testCtx *const p_ctx) { 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_binary_div_modulo_divisor"); + testStartSymbol("test_binary_div_modulo_divisor", &symbol); for (i = 0; i < data_size; i++) { @@ -212,7 +212,7 @@ static void test_examples(const testCtx *const p_ctx) { char *expected; }; /* Verified manually against GS1 General Specifications 21.0.1 (GGS) and ISO/IEC 24724:2011, and verified via bwipp_dump.ps against BWIPP */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DBAR_OMN, -1, -1, -1, "0950110153001", 0, 1, 96, 1, "GGS Figure 5.5.2.1.1-1. GS1 DataBar Omnidirectional", "010000010100000101000111110000010111101101011100100011011101000101100000000111001110110111001101" }, @@ -861,9 +861,9 @@ static void test_examples(const testCtx *const p_ctx) { "101110001111011010010111111000011100001011011100011000011110110010110001100000000101100000001010010011101101001100000101111100000011000010101111101110001110110011001100110000000001011100111000110100111101100101111101011111111100110100000000000000000" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[4096]; char cmp_buf[16384]; @@ -872,7 +872,7 @@ static void test_examples(const testCtx *const p_ctx) { 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_examples"); + testStartSymbol("test_examples", &symbol); for (i = 0; i < data_size; i++) { @@ -947,7 +947,7 @@ static void test_general_field(const testCtx *const p_ctx) { char *expected; }; /* Verified via bwipp_dump.ps against BWIPP and manually against tec-it.com (some separators differ from tec-it.com where noted) */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DBAR_EXP, "[91]1", 1, 102, "Single numeric", "010100000001000101101111111100001011001000010000010110111110101100001011110000000010101111100001011101" }, @@ -1195,11 +1195,11 @@ static void test_general_field(const testCtx *const p_ctx) { "101110011100010010011100111111110100111101001000011000010010001011110100001111110001100010100000100010" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_general_field"); + testStartSymbol("test_general_field", &symbol); for (i = 0; i < data_size; i++) { @@ -1244,26 +1244,28 @@ static void test_binary_buffer_size(const testCtx *const p_ctx) { int expected_rows; int expected_width; + char *expected_errtxt; char *comment; }; - struct item data[] = { - /* 0*/ { -1, "[91]1", 0, 1, 102, "Minimum digit" }, - /* 1*/ { -1, "[91]+", 0, 1, 102, "Minimum ISO-646" }, - /* 2*/ { -1, "[00]123456789012345675[00]123456789012345675[00]123456789012345675[91]12345678", 0, 1, 543, "70 == any AIs max" }, - /* 3*/ { -1, "[00]123456789012345675[00]123456789012345675[00]123456789012345675[91]123456789", ZINT_ERROR_TOO_LONG, 0, 0, "71 > any AIs max" }, - /* 4*/ { GS1NOCHECK_MODE, "[00]123456789012345675[00]123456789012345675[00]123456789012345675[91]123456789", ZINT_ERROR_TOO_LONG, 0, 0, "No check doesn't affect limit" }, - /* 5*/ { -1, "[01]12345678901231[00]123456789012345675[00]123456789012345675[91]1234567890123456", 0, 1, 543, "74 == 01 + other AIs max" }, - /* 6*/ { -1, "[01]12345678901231[00]123456789012345675[00]123456789012345675[91]12345678901234567", ZINT_ERROR_TOO_LONG, 0, 0, "75 > 01 + other AIs max" }, - /* 7*/ { GS1NOCHECK_MODE, "[01]12345678901231[00]123456789012345675[00]123456789012345675[91]12345678901234567", ZINT_ERROR_TOO_LONG, 0, 0, "No check doesn't affect limit" }, - /* 8*/ { -1, "[01]92345678901237[3920]123456789012345[00]123456789012345675[91]1234567890123456789", 0, 1, 543, "77 (incl. FNC1 after 3920) == 01 + 392x + other AIs max" }, - /* 9*/ { -1, "[01]92345678901237[3920]123456789012345[00]123456789012345675[91]12345678901234567890", ZINT_ERROR_TOO_LONG, 0, 0, "78 > 01 + 392x + other AIs max" }, - /* 10*/ { GS1NOCHECK_MODE, "[01]92345678901237[3920]123456789012345[00]123456789012345675[91]12345678901234567890", ZINT_ERROR_TOO_LONG, 0, 0, "No check doesn't affect limit" }, + static const struct item data[] = { + /* 0*/ { -1, "[91]1", 0, 1, 102, "", "Minimum digit" }, + /* 1*/ { -1, "[91]+", 0, 1, 102, "", "Minimum ISO-646" }, + /* 2*/ { -1, "[00]123456789012345675[00]123456789012345675[00]123456789012345675[91]12345678", 0, 1, 543, "", "70 == any AIs max" }, + /* 3*/ { -1, "[00]123456789012345675[00]123456789012345675[00]123456789012345675[91]1234567890", ZINT_ERROR_TOO_LONG, 0, 0, "Error 387: Input too long, requires 22 symbol characters (maximum 21)", "71 > any AIs max" }, + /* 4*/ { GS1NOCHECK_MODE, "[00]123456789012345675[00]123456789012345675[00]123456789012345675[91]123456789", ZINT_ERROR_TOO_LONG, 0, 0, "Error 387: Input too long, requires 22 symbol characters (maximum 21)", "No check doesn't affect limit" }, + /* 5*/ { -1, "[01]12345678901231[00]123456789012345675[00]123456789012345675[91]1234567890123456", 0, 1, 543, "", "74 == 01 + other AIs max" }, + /* 6*/ { -1, "[01]12345678901231[00]123456789012345675[00]123456789012345675[91]12345678901234567", ZINT_ERROR_TOO_LONG, 0, 0, "Error 387: Input too long, requires 22 symbol characters (maximum 21)", "75 > 01 + other AIs max" }, + /* 7*/ { GS1NOCHECK_MODE, "[01]12345678901231[00]123456789012345675[00]123456789012345675[91]12345678901234567", ZINT_ERROR_TOO_LONG, 0, 0, "Error 387: Input too long, requires 22 symbol characters (maximum 21)", "No check doesn't affect limit" }, + /* 8*/ { -1, "[01]92345678901237[3920]123456789012345[00]123456789012345675[91]1234567890123456789", 0, 1, 543, "", "77 (incl. FNC1 after 3920) == 01 + 392x + other AIs max" }, + /* 9*/ { -1, "[01]92345678901237[3920]123456789012345[00]123456789012345675[91]12345678901234567890", ZINT_ERROR_TOO_LONG, 0, 0, "Error 378: Processed input length 78 too long (maximum 77)", "78 > 01 + 392x + other AIs max" }, + /* 10*/ { GS1NOCHECK_MODE, "[01]92345678901237[3920]123456789012345[00]123456789012345675[91]12345678901234567890", ZINT_ERROR_TOO_LONG, 0, 0, "Error 378: Processed input length 78 too long (maximum 77)", "No check doesn't affect limit" }, + /* 11*/ { -1, "[00]123456789012345675[00]123456789012345675[00]123456789012345675[91]123456789012345", ZINT_ERROR_TOO_LONG, 0, 0, "Error 387: Input too long, requires 23 symbol characters (maximum 21)", "Reduced length 77" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_binary_buffer_size"); + testStartSymbol("test_binary_buffer_size", &symbol); for (i = 0; i < data_size; i++) { @@ -1276,11 +1278,14 @@ static void test_binary_buffer_size(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (const 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); if (p_ctx->generate) { - printf(" /*%3d*/ { %s, \"%s\", %s, %d, %d, \"%s\" },\n", - i, testUtilInputModeName(data[i].input_mode), data[i].data, testUtilErrorName(ret), symbol->rows, symbol->width, data[i].comment); + printf(" /*%3d*/ { %s, \"%s\", %s, %d, %d, \"%s\", \"%s\" },\n", + i, testUtilInputModeName(data[i].input_mode), data[i].data, testUtilErrorName(ret), symbol->rows, + symbol->width, symbol->errtxt, data[i].comment); } else { + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); } @@ -1303,7 +1308,7 @@ static void test_hrt(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DBAR_OMN, -1, "1234567890123", 0, "(01)12345678901231" }, /* 1*/ { BARCODE_DBAR_OMN, -1, "12345678901231", 0, "(01)12345678901231" }, /* 4*/ { BARCODE_DBAR_OMN, -1, "1000000000009", 0, "(01)10000000000090" }, @@ -1314,11 +1319,11 @@ static void test_hrt(const testCtx *const p_ctx) { /* 11*/ { BARCODE_DBAR_OMNSTK, -1, "10000000000090", 0, "" }, /* 12*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", 0, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_hrt"); + testStartSymbol("test_hrt", &symbol); for (i = 0; i < data_size; i++) { @@ -1355,25 +1360,25 @@ static void test_input(const testCtx *const p_ctx) { char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_DBAR_OMN, -1, -1, -1, "1234567890123", 0, 1, 96, "" }, - /* 1*/ { BARCODE_DBAR_OMN, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, - /* 2*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, + /* 1*/ { BARCODE_DBAR_OMN, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)" }, + /* 2*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)" }, /* 3*/ { BARCODE_DBAR_OMN, -1, -1, -1, "12345678901234", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '4', expecting '1'" }, /* 4*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, -1, "12345678901234", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '4', expecting '1'" }, /* Still checked */ - /* 5*/ { BARCODE_DBAR_OMN, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, - /* 6*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, + /* 5*/ { BARCODE_DBAR_OMN, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)" }, + /* 6*/ { BARCODE_DBAR_OMN, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)" }, /* 7*/ { BARCODE_DBAR_LTD, -1, -1, -1, "1234567890123", 0, 1, 79, "" }, - /* 8*/ { BARCODE_DBAR_LTD, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character in data (digits only)" }, - /* 9*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character in data (digits only)" }, + /* 8*/ { BARCODE_DBAR_LTD, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character at position 13 in input (digits only)" }, + /* 9*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 383: Invalid character at position 13 in input (digits only)" }, /* 10*/ { BARCODE_DBAR_LTD, -1, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '5', expecting '1'" }, /* 11*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 389: Invalid check digit '5', expecting '1'" }, /* Still checked */ - /* 12*/ { BARCODE_DBAR_LTD, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input too long (14 character maximum)" }, - /* 13*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input too long (14 character maximum)" }, - /* 14*/ { BARCODE_DBAR_LTD, -1, -1, -1, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input out of range (0 to 1999999999999)" }, - /* 15*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input out of range (0 to 1999999999999)" }, - /* 16*/ { BARCODE_DBAR_LTD, -1, -1, -1, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input out of range (0 to 1999999999999)" }, - /* 17*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input out of range (0 to 1999999999999)" }, + /* 12*/ { BARCODE_DBAR_LTD, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input length 15 too long (maximum 14)" }, + /* 13*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input length 15 too long (maximum 14)" }, + /* 14*/ { BARCODE_DBAR_LTD, -1, -1, -1, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input value out of range (0 to 1999999999999)" }, + /* 15*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "2234567890123", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input value out of range (0 to 1999999999999)" }, + /* 16*/ { BARCODE_DBAR_LTD, -1, -1, -1, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input value out of range (0 to 1999999999999)" }, + /* 17*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input value out of range (0 to 1999999999999)" }, /* 18*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 1, 134, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'" }, /* 19*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 1, 134, "" }, /* 20*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231", 0, 1, 134, "" }, @@ -1388,20 +1393,20 @@ static void test_input(const testCtx *const p_ctx) { /* 29*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_", 0, 1, 494, "" }, /* ISOIEC punc less space */ /* 30*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_", 0, 1, 494, "" }, /* 31*/ { BARCODE_DBAR_STK, -1, -1, -1, "1234567890123", 0, 3, 50, "" }, - /* 32*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, - /* 33*/ { BARCODE_DBAR_STK, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, - /* 34*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, + /* 32*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)" }, + /* 33*/ { BARCODE_DBAR_STK, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)" }, + /* 34*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)" }, /* 35*/ { BARCODE_DBAR_STK, -1, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '5', expecting '1'" }, /* 36*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "12345678901235", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '5', expecting '1'" }, /* Still checked */ - /* 37*/ { BARCODE_DBAR_STK, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, - /* 38*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, + /* 37*/ { BARCODE_DBAR_STK, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)" }, + /* 38*/ { BARCODE_DBAR_STK, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)" }, /* 39*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "1234567890123", 0, 5, 50, "" }, - /* 40*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, - /* 41*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character in data (digits only)" }, + /* 40*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)" }, + /* 41*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, -1, "123456789012A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 381: Invalid character at position 13 in input (digits only)" }, /* 42*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "12345678901236", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '6', expecting '1'" }, /* 43*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, -1, "12345678901236", ZINT_ERROR_INVALID_CHECK, -1, -1, "Error 388: Invalid check digit '6', expecting '1'" }, /* Still checked */ - /* 44*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, - /* 45*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input too long (14 character maximum)" }, + /* 44*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)" }, + /* 45*/ { BARCODE_DBAR_OMNSTK, GS1NOCHECK_MODE, -1, -1, "123456789012315", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 15 too long (maximum 14)" }, /* 46*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 5, 102, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'" }, /* 47*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 5, 102, "" }, /* 48*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]12345678901231", 0, 5, 102, "" }, @@ -1468,11 +1473,11 @@ static void test_input(const testCtx *const p_ctx) { /*109*/ { BARCODE_DBAR_EXPSTK, -1, -1, 6, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "" }, /*110*/ { BARCODE_DBAR_EXPSTK, -1, -1, 7, "[91]12345678901234567890123456789012345678901234567890123456789012", 0, 21, 102, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_input"); + testStartSymbol("test_input", &symbol); for (i = 0; i < data_size; i++) { diff --git a/backend/tests/test_svg.c b/backend/tests/test_svg.c index b5944d52..5e7424d4 100644 --- a/backend/tests/test_svg.c +++ b/backend/tests/test_svg.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2023 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -56,7 +56,7 @@ static void test_print(const testCtx *const p_ctx) { char *expected_file; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "<>\"&'", "", 0, "code128_amperands.svg", "" }, /* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold.svg", "" }, /* 2*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT | EMBED_VECTOR_FONT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_embed.svg", "" }, @@ -140,7 +140,7 @@ static void test_print(const testCtx *const p_ctx) { /* 80*/ { BARCODE_DPD, -1, -1, BARCODE_QUIET_ZONES | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "008182709980000020028101276", "", 0, "dpd_compliant.svg", "" }, /* 81*/ { BARCODE_CHANNEL, -1, -1, CMYK_COLOUR | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "100,85,0,20", "FFFFFF00", 0, "123", "", 0, "channel_cmyk_nobg.svg", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -288,12 +288,15 @@ static void test_outfile(const testCtx *const p_ctx) { skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ #endif if (!skip_readonly_test) { + static char expected_errtxt[] = "680: Could not open SVG output file ("; /* Excluding OS-dependent `errno` stuff */ + (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ assert_nonzero(testUtilCreateROFile(symbol.outfile), "svg_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret = svg_plot(&symbol, 0); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "svg_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "svg_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); + assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); } symbol.output_options |= BARCODE_STDOUT; diff --git a/backend/tests/test_telepen.c b/backend/tests/test_telepen.c index 979aa763..c18de770 100644 --- a/backend/tests/test_telepen.c +++ b/backend/tests/test_telepen.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2023 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -41,15 +41,16 @@ static void test_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { BARCODE_TELEPEN, "\177", 69, 0, 1, 1152 }, - /* 1*/ { BARCODE_TELEPEN, "\177", 70, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { BARCODE_TELEPEN_NUM, "1", 136, 0, 1, 1136 }, - /* 3*/ { BARCODE_TELEPEN_NUM, "1", 137, ZINT_ERROR_TOO_LONG, -1, -1 }, + static const struct item data[] = { + /* 0*/ { BARCODE_TELEPEN, "\177", 69, 0, 1, 1152, "" }, + /* 1*/ { BARCODE_TELEPEN, "\177", 70, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 70 too long (maximum 69)" }, + /* 2*/ { BARCODE_TELEPEN_NUM, "1", 136, 0, 1, 1136, "" }, + /* 3*/ { BARCODE_TELEPEN_NUM, "1", 137, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 137 too long (maximum 136)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -71,6 +72,8 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -94,7 +97,7 @@ static void test_hrt(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_TELEPEN, "ABC1234.;$", -1, "ABC1234.;$" }, /* 1*/ { BARCODE_TELEPEN, "abc1234.;$", -1, "abc1234.;$" }, /* 2*/ { BARCODE_TELEPEN, "ABC1234\001", -1, "ABC1234\001" }, @@ -104,7 +107,7 @@ static void test_hrt(const testCtx *const p_ctx) { /* 6*/ { BARCODE_TELEPEN_NUM, "123x", -1, "123X" }, /* Converts to upper */ /* 7*/ { BARCODE_TELEPEN_NUM, "12345", -1, "012345" }, /* Adds leading zero if odd */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -140,20 +143,21 @@ static void test_input(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { BARCODE_TELEPEN, " !\"#$%&'()*+,-./0123456789:;<", -1, 0, 1, 512 }, - /* 1*/ { BARCODE_TELEPEN, "AZaz\176\001", -1, 0, 1, 144 }, - /* 2*/ { BARCODE_TELEPEN, "\000\177", 2, 0, 1, 80 }, - /* 3*/ { BARCODE_TELEPEN, "é", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 4*/ { BARCODE_TELEPEN_NUM, "1234567890", -1, 0, 1, 128 }, - /* 5*/ { BARCODE_TELEPEN_NUM, "123456789A", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 6*/ { BARCODE_TELEPEN_NUM, "123456789X", -1, 0, 1, 128 }, /* [0-9]X allowed */ - /* 7*/ { BARCODE_TELEPEN_NUM, "12345678X9", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* X[0-9] not allowed */ - /* 8*/ { BARCODE_TELEPEN_NUM, "1X34567X9X", -1, 0, 1, 128 }, /* [0-9]X allowed multiple times */ + static const struct item data[] = { + /* 0*/ { BARCODE_TELEPEN, " !\"#$%&'()*+,-./0123456789:;<", -1, 0, 1, 512, "" }, + /* 1*/ { BARCODE_TELEPEN, "AZaz\176\001", -1, 0, 1, 144, "" }, + /* 2*/ { BARCODE_TELEPEN, "\000\177", 2, 0, 1, 80, "" }, + /* 3*/ { BARCODE_TELEPEN, "é", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 391: Invalid character at position 1 in input, extended ASCII not allowed" }, + /* 4*/ { BARCODE_TELEPEN_NUM, "1234567890", -1, 0, 1, 128, "" }, + /* 5*/ { BARCODE_TELEPEN_NUM, "123456789A", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 393: Invalid character at position 10 in input (digits and \"X\" only)" }, + /* 6*/ { BARCODE_TELEPEN_NUM, "123456789X", -1, 0, 1, 128, "" }, /* [0-9]X allowed */ + /* 7*/ { BARCODE_TELEPEN_NUM, "12345678X9", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 394: Invalid odd position 9 of \"X\" in Telepen data" }, /* X[0-9] not allowed */ + /* 8*/ { BARCODE_TELEPEN_NUM, "1X34567X9X", -1, 0, 1, 128, "" }, /* [0-9]X allowed multiple times */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -170,6 +174,8 @@ static void test_input(const testCtx *const p_ctx) { 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -200,7 +206,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_TELEPEN, "1A", -1, 0, 1, 80, "Telepen BSiH Example, same", "10101010101110001011101000100010101110111011100010100010001110101110001010101010" }, @@ -232,7 +238,7 @@ static void test_encode(const testCtx *const p_ctx) { "10101010101110001010101010101110111011101110101011101110111011101110001010101010" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -301,7 +307,7 @@ static void test_fuzz(const testCtx *const p_ctx) { }; /* Note NULs where using DELs code (16 binary characters wide) */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_TELEPEN, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 69, 0 }, /* 1*/ { BARCODE_TELEPEN, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 70, ZINT_ERROR_TOO_LONG }, /* 2*/ { BARCODE_TELEPEN_NUM, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 70, ZINT_ERROR_INVALID_DATA }, @@ -311,7 +317,7 @@ static void test_fuzz(const testCtx *const p_ctx) { /* 6*/ { BARCODE_TELEPEN_NUM, "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", 136, 0 }, /* 7*/ { BARCODE_TELEPEN_NUM, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 4, 0 }, /* Length given, strlen > 137, so pseudo not NUL-terminated */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; diff --git a/backend/tests/test_tif.c b/backend/tests/test_tif.c index ff1b8ec6..fb6e1646 100644 --- a/backend/tests/test_tif.c +++ b/backend/tests/test_tif.c @@ -47,7 +47,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) { int ret; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { 1, 1, "1", 0, 0, 0 }, /* 1*/ { 2, 1, "11", 0, 0, 0 }, /* 2*/ { 1, 2, "11", 0, 0, 0 }, @@ -87,7 +87,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) { /* 36*/ { ZINT_MAX_DATA_LEN, 2, "10", 1, 1, 0 }, /* Strip Count 2, Rows Per Strip 1 */ /* 37*/ { 2, ZINT_MAX_DATA_LEN, "10", 1, 1 /*NOTE: disabled due to failing on github CI, works locally*/, 0 }, /* Strip Count 17, Rows Per Strip 1024 */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, ret; struct zint_symbol *symbol = NULL; @@ -179,7 +179,7 @@ static void test_print(const testCtx *const p_ctx) { char *expected_file; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_CODE128, -1, -1, -1, 1, -1, -1, -1, -1, 0, 0, "112233", "EEDDCC", "A", "", "code128_fgbg.tif", "" }, /* 1*/ { BARCODE_CODE128, -1, -1, -1, 1, -1, -1, -1, -1, 0, 0, "FFFFFF", "000000", "A", "", "code128_reverse.tif", "" }, /* 2*/ { BARCODE_CODE128, -1, -1, CMYK_COLOUR, 1, -1, -1, -1, -1, 0, 0, "112233", "CCDDEE", "A", "", "code128_cmyk_fgbg.tif", "" }, @@ -205,7 +205,7 @@ static void test_print(const testCtx *const p_ctx) { /* 22*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9501234", "", "ean8_gss_5.2.2.2-1.tif", "" }, /* 23*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, "", "", "9501234", "", "ean8_gss_5.2.2.2-1_gws.tif", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -347,12 +347,15 @@ static void test_outfile(const testCtx *const p_ctx) { skip_readonly_test = getuid() == 0; /* Skip if running as root on Unix as can't create read-only file */ #endif if (!skip_readonly_test) { + static char expected_errtxt[] = "672: Could not open TIF output file ("; /* Excluding OS-dependent `errno` stuff */ + (void) testUtilRmROFile(symbol.outfile); /* In case lying around from previous fail */ assert_nonzero(testUtilCreateROFile(symbol.outfile), "tif_pixel_plot testUtilCreateROFile(%s) fail (%d: %s)\n", symbol.outfile, errno, strerror(errno)); ret = tif_pixel_plot(&symbol, data); assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "tif_pixel_plot ret %d != ZINT_ERROR_FILE_ACCESS (%d) (%s)\n", ret, ZINT_ERROR_FILE_ACCESS, symbol.errtxt); assert_zero(testUtilRmROFile(symbol.outfile), "tif_pixel_plot testUtilRmROFile(%s) != 0 (%d: %s)\n", symbol.outfile, errno, strerror(errno)); + assert_zero(strncmp(symbol.errtxt, expected_errtxt, sizeof(expected_errtxt) - 1), "strncmp(%s, %s) != 0\n", symbol.errtxt, expected_errtxt); } symbol.output_options |= BARCODE_STDOUT; diff --git a/backend/tests/test_ultra.c b/backend/tests/test_ultra.c index be8184a2..a1f3ab43 100644 --- a/backend/tests/test_ultra.c +++ b/backend/tests/test_ultra.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2023 Robin Stuart + Copyright (C) 2020-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -43,48 +43,50 @@ static void test_large(const testCtx *const p_ctx) { int ret; int expected_rows; int expected_width; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { -1, -1, { 0, 0, "" }, "1", 252, 0, 31, 66 }, /* Default EC2 */ - /* 1*/ { -1, -1, { 0, 0, "" }, "1", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 2*/ { -1, -1, { 0, 0, "" }, "1", ZINT_MAX_DATA_LEN, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 3*/ { -1, -1, { 1, 2, "" }, "1", 251, 0, 31, 66 }, /* Structured Append no File Number 1 codeword overhead */ - /* 4*/ { -1, -1, { 1, 2, "" }, "1", 252, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 5*/ { -1, -1, { 1, 2, "1" }, "1", 249, 0, 31, 66 }, /* Structured Append with File Number 3 codewords overhead */ - /* 6*/ { -1, -1, { 1, 2, "1" }, "1", 250, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 7*/ { -1, -1, { 0, 0, "" }, "A", 252, 0, 31, 66 }, - /* 8*/ { -1, -1, { 0, 0, "" }, "A", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 9*/ { -1, -1, { 0, 0, "" }, "\200", 252, 0, 31, 66 }, - /* 10*/ { -1, -1, { 0, 0, "" }, "\200", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 11*/ { -1, -1, { 0, 0, "" }, "\001", 252, 0, 31, 66 }, - /* 12*/ { -1, -1, { 0, 0, "" }, "\001", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 13*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "1", 504, 0, 31, 66 }, - /* 14*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "1", 505, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 15*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "A", 375, 0, 31, 66 }, - /* 16*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "A", 376, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 17*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "\200", 252, 0, 31, 66 }, - /* 18*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "\200", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 19*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "\001", 252, 0, 31, 66 }, - /* 20*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "\001", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 21*/ { 1, -1, { 0, 0, "" }, "1", 276, 0, 31, 66 }, - /* 22*/ { 1, -1, { 0, 0, "" }, "1", 277, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 23*/ { 1, -1, { 1, 2, "" }, "1", 275, 0, 31, 66 }, - /* 24*/ { 1, -1, { 1, 2, "" }, "1", 276, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 25*/ { 1, -1, { 1, 2, "1" }, "1", 273, 0, 31, 66 }, - /* 26*/ { 1, -1, { 1, 2, "1" }, "1", 274, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 27*/ { 2, -1, { 0, 0, "" }, "1", 263, 0, 31, 66 }, - /* 28*/ { 2, -1, { 0, 0, "" }, "1", 264, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 29*/ { 3, -1, { 0, 0, "" }, "1", 252, 0, 31, 66 }, - /* 30*/ { 3, -1, { 0, 0, "" }, "1", 253, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 31*/ { 4, -1, { 0, 0, "" }, "1", 234, 0, 31, 66 }, - /* 32*/ { 4, -1, { 0, 0, "" }, "1", 235, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 33*/ { 5, -1, { 0, 0, "" }, "1", 220, 0, 31, 66 }, - /* 34*/ { 5, -1, { 0, 0, "" }, "1", 221, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 35*/ { 6, -1, { 0, 0, "" }, "1", 202, 0, 31, 66 }, - /* 36*/ { 6, -1, { 0, 0, "" }, "1", 203, ZINT_ERROR_TOO_LONG, -1, -1 }, + static const struct item data[] = { + /* 0*/ { -1, -1, { 0, 0, "" }, "1", 252, 0, 31, 66, "" }, /* Default EC2 */ + /* 1*/ { -1, -1, { 0, 0, "" }, "1", 253, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC2, requires 256 codewords (maximum 255)" }, + /* 2*/ { -1, -1, { 0, 0, "" }, "1", ZINT_MAX_DATA_LEN, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC2, requires 17403 codewords (maximum 255)" }, + /* 3*/ { -1, -1, { 1, 2, "" }, "1", 251, 0, 31, 66, "" }, /* Structured Append no File Number 1 codeword overhead */ + /* 4*/ { -1, -1, { 1, 2, "" }, "1", 252, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC2, requires 256 codewords (maximum 255)" }, + /* 5*/ { -1, -1, { 1, 2, "1" }, "1", 249, 0, 31, 66, "" }, /* Structured Append with File Number 3 codewords overhead */ + /* 6*/ { -1, -1, { 1, 2, "1" }, "1", 250, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC2, requires 256 codewords (maximum 255)" }, + /* 7*/ { -1, -1, { 0, 0, "" }, "A", 252, 0, 31, 66, "" }, + /* 8*/ { -1, -1, { 0, 0, "" }, "A", 253, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC2, requires 256 codewords (maximum 255)" }, + /* 9*/ { -1, -1, { 0, 0, "" }, "\200", 252, 0, 31, 66, "" }, + /* 10*/ { -1, -1, { 0, 0, "" }, "\200", 253, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC2, requires 256 codewords (maximum 255)" }, + /* 11*/ { -1, -1, { 0, 0, "" }, "\001", 252, 0, 31, 66, "" }, + /* 12*/ { -1, -1, { 0, 0, "" }, "\001", 253, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC2, requires 256 codewords (maximum 255)" }, + /* 13*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "1", 504, 0, 31, 66, "" }, + /* 14*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "1", 505, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC2, requires 256 codewords (maximum 255)" }, + /* 15*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "A", 375, 0, 31, 66, "" }, + /* 16*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "A", 376, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC2, requires 256 codewords (maximum 255)" }, + /* 17*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "\200", 252, 0, 31, 66, "" }, + /* 18*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "\200", 253, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC2, requires 256 codewords (maximum 255)" }, + /* 19*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "\001", 252, 0, 31, 66, "" }, + /* 20*/ { -1, ULTRA_COMPRESSION, { 0, 0, "" }, "\001", 253, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC2, requires 256 codewords (maximum 255)" }, + /* 21*/ { 1, -1, { 0, 0, "" }, "1", 276, 0, 31, 66, "" }, + /* 22*/ { 1, -1, { 0, 0, "" }, "1", 277, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC0, requires 280 codewords (maximum 279)" }, + /* 23*/ { 1, -1, { 1, 2, "" }, "1", 275, 0, 31, 66, "" }, + /* 24*/ { 1, -1, { 1, 2, "" }, "1", 276, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC0, requires 280 codewords (maximum 279)" }, + /* 25*/ { 1, -1, { 1, 2, "1" }, "1", 273, 0, 31, 66, "" }, + /* 26*/ { 1, -1, { 1, 2, "1" }, "1", 274, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC0, requires 280 codewords (maximum 279)" }, + /* 27*/ { 2, -1, { 0, 0, "" }, "1", 263, 0, 31, 66, "" }, + /* 28*/ { 2, -1, { 0, 0, "" }, "1", 264, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC1, requires 267 codewords (maximum 266)" }, + /* 29*/ { 3, -1, { 0, 0, "" }, "1", 252, 0, 31, 66, "" }, + /* 30*/ { 3, -1, { 0, 0, "" }, "1", 253, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC2, requires 256 codewords (maximum 255)" }, + /* 31*/ { 4, -1, { 0, 0, "" }, "1", 234, 0, 31, 66, "" }, + /* 32*/ { 4, -1, { 0, 0, "" }, "1", 235, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC3, requires 238 codewords (maximum 237)" }, + /* 33*/ { 5, -1, { 0, 0, "" }, "1", 220, 0, 31, 66, "" }, + /* 34*/ { 5, -1, { 0, 0, "" }, "1", 221, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC4, requires 224 codewords (maximum 223)" }, + /* 35*/ { 6, -1, { 0, 0, "" }, "1", 202, 0, 31, 66, "" }, + /* 36*/ { 6, -1, { 0, 0, "" }, "1", 203, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC5, requires 206 codewords (maximum 205)" }, + /* 37*/ { 6, -1, { 0, 0, "" }, "A", ZINT_MAX_DATA_LEN / 2, ZINT_ERROR_TOO_LONG, -1, -1, "Error 591: Input too long for ECC level EC5, requires 8703 codewords (maximum 205)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -109,6 +111,8 @@ static void test_large(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, 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(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); 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); @@ -135,11 +139,11 @@ static void test_reader_init(const testCtx *const p_ctx) { char *expected; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, READER_INIT, 0, "A", 0, 13, 14, "(3) 257 269 65", "8-bit FNC3 A" }, /* 1*/ { UNICODE_MODE, READER_INIT, ULTRA_COMPRESSION, "A", 0, 13, 14, "(3) 272 271 65", "ASCII FNC3 A Note: draft spec inconsistent and FNC3 may be 272 in ASCII mode (and FNC1 271)" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -196,7 +200,7 @@ static void test_input(const testCtx *const p_ctx) { char *expected; char *comment; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "A", 0, "(2) 257 65", "Default (Revision 1)" }, /* 1*/ { UNICODE_MODE, 0, -1, 1, -1, { 0, 0, "" }, "A", 0, "(2) 257 65", "Revision 1" }, /* 2*/ { UNICODE_MODE, 0, -1, 2, -1, { 0, 0, "" }, "A", 0, "(2) 257 65", "Revision 2 (no codeword changes)" }, @@ -209,9 +213,9 @@ static void test_input(const testCtx *const p_ctx) { /* 9*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ABC", 0, "(4) 272 65 66 67", "" }, /* 10*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ULTRACODE_123456789!", 0, "(17) 272 85 76 84 82 65 67 79 68 69 95 140 162 184 206 57 33", "" }, /* 11*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(253) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "252 chars EC2" }, - /* 12*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "253 chars EC2" }, + /* 12*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Input too long for ECC level EC2, requires 256 codewords (maximum 255)", "253 chars EC2" }, /* 13*/ { UNICODE_MODE, 0, 1, -1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 0, "(277) 257 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65", "276 chars EC0" }, - /* 14*/ { UNICODE_MODE, 0, 1, -1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Data too long for selected error correction capacity", "277 chars EC0" }, + /* 14*/ { UNICODE_MODE, 0, 1, -1, -1, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", ZINT_ERROR_TOO_LONG, "Error 591: Input too long for ECC level EC0, requires 280 codewords (maximum 279)", "277 chars EC0" }, /* 15*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "é", 0, "(2) 257 233", "" }, /* 16*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "β", ZINT_WARN_USES_ECI, "Warning (2) 263 226", "" }, /* 17*/ { UNICODE_MODE, 9, -1, -1, -1, { 0, 0, "" }, "β", 0, "(2) 263 226", "" }, @@ -224,7 +228,7 @@ static void test_input(const testCtx *const p_ctx) { /* 24*/ { DATA_MODE, 9999, -1, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(9) 257 274 227 227 1 2 3 4 255", "" }, /* 25*/ { DATA_MODE, 10000, -1, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(10) 257 275 129 128 128 1 2 3 4 255", "" }, /* 26*/ { DATA_MODE, 811799, -1, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", 0, "(10) 257 275 209 145 227 1 2 3 4 255", "" }, - /* 27*/ { DATA_MODE, 811800, -1, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", ZINT_ERROR_INVALID_OPTION, "Error 590: ECI value not supported by Ultracode", "" }, + /* 27*/ { DATA_MODE, 811800, -1, -1, -1, { 0, 0, "" }, "\001\002\003\004\377", ZINT_ERROR_INVALID_OPTION, "Error 590: ECI code '811800' out of range (0 to 811799)", "" }, /* 28*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "123,456,789/12,/3,4,/5//", 0, "(15) 272 140 231 173 234 206 257 140 44 262 242 44 264 47 47", "Mode: a (24)" }, /* 29*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, "(32) 257 256 46 151 78 210 205 208 258 5 148 28 72 2 167 52 127 193 83 75 211 267 76 65 32", "Mode: cccccc88cccccccccc8888aaa8cccccc (32)" }, /* 30*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS", 0, "(33) 257 72 69 73 77 65 83 205 208 65 32 75 69 78 78 65 82 65 72 193 83 75 211 76 65 32 205", "" }, @@ -254,18 +258,18 @@ static void test_input(const testCtx *const p_ctx) { /* 54*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "https://url.com", 0, "(6) 282 262 133 216 269 251", "Mode: ccccccc (7)" }, /* 55*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "{", 0, "(2) 272 123", "Mode: a (1)" }, /* 56*/ { UNICODE_MODE, 0, -1, -1, -1, { 2, 3, "" }, "A", 0, "(2) 257 65", "" }, - /* 57*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 1, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 596: Structured Append count out of range (2-8)", "" }, - /* 58*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 9, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 596: Structured Append count out of range (2-8)", "" }, - /* 59*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 597: Structured Append index out of range (1-3)", "" }, - /* 60*/ { UNICODE_MODE, 0, -1, -1, -1, { 4, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 597: Structured Append index out of range (1-3)", "" }, + /* 57*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 1, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 596: Structured Append count '1' out of range (2 to 8)", "" }, + /* 58*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 9, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 596: Structured Append count '9' out of range (2 to 8)", "" }, + /* 59*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 597: Structured Append index '0' out of range (1 to count 3)", "" }, + /* 60*/ { UNICODE_MODE, 0, -1, -1, -1, { 4, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 597: Structured Append index '4' out of range (1 to count 3)", "" }, /* 61*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "0" }, "A", 0, "(2) 257 65", "" }, /* 62*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "80088" }, "A", 0, "(2) 257 65", "" }, - /* 63*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "123456" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 593: Structured Append ID too long (5 digit maximum)", "" }, + /* 63*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "123456" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 593: Structured Append ID length 6 too long (5 digit maximum)", "" }, /* 64*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "A" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 594: Invalid Structured Append ID (digits only)", "" }, - /* 65*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "80089" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 595: Structured Append ID '80089' out of range (1-80088)", "" }, - /* 66*/ { UNICODE_MODE, 0, -1, 3, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 592: Revision must be 1 or 2", "" }, + /* 65*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "80089" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 595: Structured Append ID value '80089' out of range (1 to 80088)", "" }, + /* 66*/ { UNICODE_MODE, 0, -1, 3, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 592: Revision '3' out of range (1 or 2 only)", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -330,7 +334,7 @@ static void test_encode(const testCtx *const p_ctx) { /* Based on AIMD/TSC15032-43 (v 0.99c), with values updated from BWIPP update 2021-07-14 https://github.com/bwipp/postscriptbarcode/commit/4255810845fa8d45c6192dd30aee1fdad1aaf0cc */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ULTRACODE_123456789!", 0, 13, 22, 1, "AIMD/TSC15032-43 Figure G.1 **NOT SAME** different compression", "7777777777777777777777" "7857865353533131551857" @@ -776,7 +780,7 @@ static void test_encode(const testCtx *const p_ctx) { "777777777777777777777777" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol = NULL; @@ -863,7 +867,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { /* Based on AIMD/TSC15032-43 (v 0.99c), with values updated from BWIPP update 2021-07-14 https://github.com/bwipp/postscriptbarcode/commit/4255810845fa8d45c6192dd30aee1fdad1aaf0cc */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { UNICODE_MODE, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, { { TU("¶"), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 13, 15, 0, "Standard example; BWIPP no ECI support for Ultracode", "777777777777777" "785786131155157" @@ -1018,7 +1022,7 @@ static void test_encode_segs(const testCtx *const p_ctx) { "777777777777777777777777777" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, j, seg_count, ret; struct zint_symbol *symbol = NULL; diff --git a/backend/tests/test_upcean.c b/backend/tests/test_upcean.c index f6d46198..120504a6 100644 --- a/backend/tests/test_upcean.c +++ b/backend/tests/test_upcean.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2022 Robin Stuart + Copyright (C) 2019-2024 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -42,7 +42,7 @@ static void test_upce_input(const testCtx *const p_ctx) { char *hrt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_UPCE, "12345", 0, "00123457" }, /* equivalent: 00123400005, Check digit: 7 */ /* 1*/ { BARCODE_UPCE_CHK, "12345", ZINT_ERROR_INVALID_CHECK, "" }, /* 2*/ { BARCODE_UPCE_CHK, "12344", 0, "00012344" }, /* equivalent: 00012000003, Check digit: 4 */ @@ -94,9 +94,9 @@ static void test_upce_input(const testCtx *const p_ctx) { /* 48*/ { BARCODE_UPCE, "000001", 0, "00000019" }, /* 49*/ { BARCODE_UPCE, "000002", 0, "00000028" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[4096]; char cmp_buf[4096]; @@ -105,7 +105,7 @@ static void test_upce_input(const testCtx *const p_ctx) { 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_upce_input"); + testStartSymbol("test_upce_input", &symbol); for (i = 0; i < data_size; i++) { @@ -159,14 +159,14 @@ static void test_upca_print(const testCtx *const p_ctx) { int ret; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_UPCA, "01234567890", 0 }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_upca_print"); + testStartSymbol("test_upca_print", &symbol); for (i = 0; i < data_size; i++) { @@ -199,90 +199,94 @@ static void test_upca_input(const testCtx *const p_ctx) { int symbology; char *data; int ret; + char *expected_errtxt; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { - /* 0*/ { BARCODE_UPCA, "12345678901", 0 }, - /* 1*/ { BARCODE_UPCA, "1234567890", 0 }, - /* 2*/ { BARCODE_UPCA, "123456789012", 0 }, /* UPC-A accepts CHK */ - /* 3*/ { BARCODE_UPCA, "123456789011", ZINT_ERROR_INVALID_CHECK }, - /* 4*/ { BARCODE_UPCA, "1234567890123", ZINT_ERROR_TOO_LONG }, - /* 5*/ { BARCODE_UPCA, "123456789012A", ZINT_ERROR_INVALID_DATA }, - /* 6*/ { BARCODE_UPCA, "12345678901A", ZINT_ERROR_INVALID_DATA }, - /* 7*/ { BARCODE_UPCA, "12345678901+1", 0 }, - /* 8*/ { BARCODE_UPCA, "123456789012+1", 0 }, - /* 9*/ { BARCODE_UPCA, "123456789013+1", ZINT_ERROR_INVALID_CHECK }, - /* 10*/ { BARCODE_UPCA, "12345678901+12", 0 }, - /* 11*/ { BARCODE_UPCA, "123456789012+12", 0 }, - /* 12*/ { BARCODE_UPCA, "123456789014+12", ZINT_ERROR_INVALID_CHECK }, - /* 13*/ { BARCODE_UPCA, "12345678901+123", 0 }, - /* 14*/ { BARCODE_UPCA, "123456789012+123", 0 }, - /* 15*/ { BARCODE_UPCA, "123456789015+123", ZINT_ERROR_INVALID_CHECK }, - /* 16*/ { BARCODE_UPCA, "123456789012+1234", 0 }, - /* 17*/ { BARCODE_UPCA, "123456789016+1234", ZINT_ERROR_INVALID_CHECK }, - /* 18*/ { BARCODE_UPCA, "123456789012+12345", 0 }, - /* 19*/ { BARCODE_UPCA, "123456789017+12345", ZINT_ERROR_INVALID_CHECK }, - /* 20*/ { BARCODE_UPCA, "123456789012+123456", ZINT_ERROR_TOO_LONG }, - /* 21*/ { BARCODE_UPCA, "123456789017+123456", ZINT_ERROR_TOO_LONG }, - /* 22*/ { BARCODE_UPCA, "123456789017+12345A", ZINT_ERROR_INVALID_DATA }, - /* 23*/ { BARCODE_UPCA_CHK, "123456789012", 0 }, - /* 24*/ { BARCODE_UPCA_CHK, "123456789011", ZINT_ERROR_INVALID_CHECK }, - /* 25*/ { BARCODE_UPCA_CHK, "1234567890123", ZINT_ERROR_TOO_LONG }, - /* 26*/ { BARCODE_UPCA_CHK, "123456789012A", ZINT_ERROR_INVALID_DATA }, - /* 27*/ { BARCODE_UPCA_CHK, "12345678901A", ZINT_ERROR_INVALID_DATA }, - /* 28*/ { BARCODE_UPCA_CHK, "12345678901", ZINT_ERROR_INVALID_CHECK }, - /* 29*/ { BARCODE_UPCA_CHK, "12345678905", 0 }, - /* 30*/ { BARCODE_UPCA_CHK, "1234567890", ZINT_ERROR_INVALID_CHECK }, - /* 31*/ { BARCODE_UPCA_CHK, "1234567895", 0 }, - /* 32*/ { BARCODE_UPCA_CHK, "123456789", ZINT_ERROR_INVALID_CHECK }, - /* 33*/ { BARCODE_UPCA_CHK, "123456784", 0 }, - /* 34*/ { BARCODE_UPCA_CHK, "12345678", ZINT_ERROR_INVALID_CHECK }, - /* 35*/ { BARCODE_UPCA_CHK, "12345670", 0 }, - /* 36*/ { BARCODE_UPCA_CHK, "1234567", ZINT_ERROR_INVALID_CHECK }, - /* 37*/ { BARCODE_UPCA_CHK, "1234565", 0 }, - /* 38*/ { BARCODE_UPCA_CHK, "123456", ZINT_ERROR_INVALID_CHECK }, - /* 39*/ { BARCODE_UPCA_CHK, "123457", 0 }, - /* 40*/ { BARCODE_UPCA_CHK, "12345", ZINT_ERROR_INVALID_CHECK }, - /* 41*/ { BARCODE_UPCA_CHK, "12348", 0 }, - /* 42*/ { BARCODE_UPCA_CHK, "1234", ZINT_ERROR_INVALID_CHECK }, - /* 43*/ { BARCODE_UPCA_CHK, "1236", 0 }, - /* 44*/ { BARCODE_UPCA_CHK, "123", 0 }, /* Happens to be correct check digit */ - /* 45*/ { BARCODE_UPCA_CHK, "124", ZINT_ERROR_INVALID_CHECK }, - /* 46*/ { BARCODE_UPCA_CHK, "12", ZINT_ERROR_INVALID_CHECK }, - /* 47*/ { BARCODE_UPCA_CHK, "17", 0 }, - /* 48*/ { BARCODE_UPCA_CHK, "1", ZINT_ERROR_INVALID_CHECK }, - /* 49*/ { BARCODE_UPCA_CHK, "0", 0 }, - /* 50*/ { BARCODE_UPCA_CHK, "12345678905+12", 0 }, - /* 51*/ { BARCODE_UPCA_CHK, "12345678905+12345", 0 }, - /* 52*/ { BARCODE_UPCA_CHK, "12345678905+123456", ZINT_ERROR_TOO_LONG }, - /* 53*/ { BARCODE_UPCA_CHK, "12345678905+12345A", ZINT_ERROR_INVALID_DATA }, - /* 54*/ { BARCODE_UPCA_CHK, "12345678905+1234A", ZINT_ERROR_INVALID_DATA }, - /* 55*/ { BARCODE_UPCA_CHK, "1234567895+12345", 0 }, - /* 56*/ { BARCODE_UPCA_CHK, "1234567891+12345", ZINT_ERROR_INVALID_CHECK }, - /* 57*/ { BARCODE_UPCA_CHK, "123456784+12345", 0 }, - /* 58*/ { BARCODE_UPCA_CHK, "123456782+12345", ZINT_ERROR_INVALID_CHECK }, - /* 59*/ { BARCODE_UPCA_CHK, "12345670+12345", 0 }, - /* 60*/ { BARCODE_UPCA_CHK, "12345673+12345", ZINT_ERROR_INVALID_CHECK }, - /* 61*/ { BARCODE_UPCA_CHK, "1234565+12345", 0 }, - /* 62*/ { BARCODE_UPCA_CHK, "1234564+12345", ZINT_ERROR_INVALID_CHECK }, - /* 63*/ { BARCODE_UPCA_CHK, "123457+12345", 0 }, - /* 64*/ { BARCODE_UPCA_CHK, "123455+12345", ZINT_ERROR_INVALID_CHECK }, - /* 65*/ { BARCODE_UPCA_CHK, "12348+12345", 0 }, - /* 66*/ { BARCODE_UPCA_CHK, "12346+12345", ZINT_ERROR_INVALID_CHECK }, - /* 67*/ { BARCODE_UPCA_CHK, "1236+12345", 0 }, - /* 68*/ { BARCODE_UPCA_CHK, "1237+12345", ZINT_ERROR_INVALID_CHECK }, - /* 69*/ { BARCODE_UPCA_CHK, "123+12345", 0 }, - /* 70*/ { BARCODE_UPCA_CHK, "128+12345", ZINT_ERROR_INVALID_CHECK }, - /* 71*/ { BARCODE_UPCA_CHK, "17+12345", 0 }, - /* 72*/ { BARCODE_UPCA_CHK, "19+12345", ZINT_ERROR_INVALID_CHECK }, - /* 73*/ { BARCODE_UPCA_CHK, "1+12345", ZINT_ERROR_INVALID_CHECK }, - /* 74*/ { BARCODE_UPCA_CHK, "0+12345", 0 }, + static const struct item data[] = { + /* 0*/ { BARCODE_UPCA, "12345678901", 0, "" }, + /* 1*/ { BARCODE_UPCA, "1234567890", 0, "" }, + /* 2*/ { BARCODE_UPCA, "123456789012", 0, "" }, /* UPC-A accepts CHK */ + /* 3*/ { BARCODE_UPCA, "123456789011", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '1', expecting '2'" }, + /* 4*/ { BARCODE_UPCA, "1234567890123", ZINT_ERROR_TOO_LONG, "Error 288: Input length 13 wrong (11 or 12 only)" }, + /* 5*/ { BARCODE_UPCA, "123456789012A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 13 in input (digits and \"+\" only)" }, + /* 6*/ { BARCODE_UPCA, "12345678901A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 12 in input (digits and \"+\" only)" }, + /* 7*/ { BARCODE_UPCA, "12345", 0, "" }, + /* 8*/ { BARCODE_UPCA, "1X345", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 2 in input (digits and \"+\" only)" }, + /* 9*/ { BARCODE_UPCA, "01A345", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 3 in input (digits and \"+\" only)" }, + /* 10*/ { BARCODE_UPCA, "12345678901+1", 0, "" }, + /* 11*/ { BARCODE_UPCA, "123456789012+1", 0, "" }, + /* 12*/ { BARCODE_UPCA, "123456789013+1", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '3', expecting '2'" }, + /* 13*/ { BARCODE_UPCA, "12345678901+12", 0, "" }, + /* 14*/ { BARCODE_UPCA, "123456789012+12", 0, "" }, + /* 15*/ { BARCODE_UPCA, "123456789014+12", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '4', expecting '2'" }, + /* 16*/ { BARCODE_UPCA, "12345678901+123", 0, "" }, + /* 17*/ { BARCODE_UPCA, "123456789012+123", 0, "" }, + /* 18*/ { BARCODE_UPCA, "123456789015+123", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '5', expecting '2'" }, + /* 19*/ { BARCODE_UPCA, "123456789012+1234", 0, "" }, + /* 20*/ { BARCODE_UPCA, "123456789016+1234", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '6', expecting '2'" }, + /* 21*/ { BARCODE_UPCA, "123456789012+12345", 0, "" }, + /* 22*/ { BARCODE_UPCA, "123456789017+12345", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '7', expecting '2'" }, + /* 23*/ { BARCODE_UPCA, "123456789012+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)" }, + /* 24*/ { BARCODE_UPCA, "123456789017+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)" }, + /* 25*/ { BARCODE_UPCA, "123456789017+12345A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 19 in input (digits and \"+\" only)" }, + /* 26*/ { BARCODE_UPCA_CHK, "123456789012", 0, "" }, + /* 27*/ { BARCODE_UPCA_CHK, "123456789011", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '1', expecting '2'" }, + /* 28*/ { BARCODE_UPCA_CHK, "1234567890123", ZINT_ERROR_TOO_LONG, "Error 288: Input length 13 wrong (11 or 12 only)" }, + /* 29*/ { BARCODE_UPCA_CHK, "123456789012A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 13 in input (digits and \"+\" only)" }, + /* 30*/ { BARCODE_UPCA_CHK, "12345678901A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 12 in input (digits and \"+\" only)" }, + /* 31*/ { BARCODE_UPCA_CHK, "12345678901", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '1', expecting '5'" }, + /* 32*/ { BARCODE_UPCA_CHK, "12345678905", 0, "" }, + /* 33*/ { BARCODE_UPCA_CHK, "1234567890", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '0', expecting '5'" }, + /* 34*/ { BARCODE_UPCA_CHK, "1234567895", 0, "" }, + /* 35*/ { BARCODE_UPCA_CHK, "123456789", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '9', expecting '4'" }, + /* 36*/ { BARCODE_UPCA_CHK, "123456784", 0, "" }, + /* 37*/ { BARCODE_UPCA_CHK, "12345678", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '8', expecting '0'" }, + /* 38*/ { BARCODE_UPCA_CHK, "12345670", 0, "" }, + /* 39*/ { BARCODE_UPCA_CHK, "1234567", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '7', expecting '5'" }, + /* 40*/ { BARCODE_UPCA_CHK, "1234565", 0, "" }, + /* 41*/ { BARCODE_UPCA_CHK, "123456", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '6', expecting '7'" }, + /* 42*/ { BARCODE_UPCA_CHK, "123457", 0, "" }, + /* 43*/ { BARCODE_UPCA_CHK, "12345", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '5', expecting '8'" }, + /* 44*/ { BARCODE_UPCA_CHK, "12348", 0, "" }, + /* 45*/ { BARCODE_UPCA_CHK, "1234", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '4', expecting '6'" }, + /* 46*/ { BARCODE_UPCA_CHK, "1236", 0, "" }, + /* 47*/ { BARCODE_UPCA_CHK, "123", 0, "" }, /* Happens to be correct check digit */ + /* 48*/ { BARCODE_UPCA_CHK, "124", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '4', expecting '3'" }, + /* 49*/ { BARCODE_UPCA_CHK, "12", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '2', expecting '7'" }, + /* 50*/ { BARCODE_UPCA_CHK, "17", 0, "" }, + /* 51*/ { BARCODE_UPCA_CHK, "1", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '1', expecting '0'" }, + /* 52*/ { BARCODE_UPCA_CHK, "0", 0, "" }, + /* 53*/ { BARCODE_UPCA_CHK, "12345678905+12", 0, "" }, + /* 54*/ { BARCODE_UPCA_CHK, "12345678905+12345", 0, "" }, + /* 55*/ { BARCODE_UPCA_CHK, "12345678905+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)" }, + /* 56*/ { BARCODE_UPCA_CHK, "12345678905+12345A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 18 in input (digits and \"+\" only)" }, + /* 57*/ { BARCODE_UPCA_CHK, "12345678905+1234A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 17 in input (digits and \"+\" only)" }, + /* 58*/ { BARCODE_UPCA_CHK, "1234567895+12345", 0, "" }, + /* 59*/ { BARCODE_UPCA_CHK, "1234567891+12345", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '1', expecting '5'" }, + /* 60*/ { BARCODE_UPCA_CHK, "123456784+12345", 0, "" }, + /* 61*/ { BARCODE_UPCA_CHK, "123456782+12345", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '2', expecting '4'" }, + /* 62*/ { BARCODE_UPCA_CHK, "12345670+12345", 0, "" }, + /* 63*/ { BARCODE_UPCA_CHK, "12345673+12345", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '3', expecting '0'" }, + /* 64*/ { BARCODE_UPCA_CHK, "1234565+12345", 0, "" }, + /* 65*/ { BARCODE_UPCA_CHK, "1234564+12345", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '4', expecting '5'" }, + /* 66*/ { BARCODE_UPCA_CHK, "123457+12345", 0, "" }, + /* 67*/ { BARCODE_UPCA_CHK, "123455+12345", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '5', expecting '7'" }, + /* 68*/ { BARCODE_UPCA_CHK, "12348+12345", 0, "" }, + /* 69*/ { BARCODE_UPCA_CHK, "12346+12345", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '6', expecting '8'" }, + /* 70*/ { BARCODE_UPCA_CHK, "1236+12345", 0, "" }, + /* 71*/ { BARCODE_UPCA_CHK, "1237+12345", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '7', expecting '6'" }, + /* 72*/ { BARCODE_UPCA_CHK, "123+12345", 0, "" }, + /* 73*/ { BARCODE_UPCA_CHK, "128+12345", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '8', expecting '3'" }, + /* 74*/ { BARCODE_UPCA_CHK, "17+12345", 0, "" }, + /* 75*/ { BARCODE_UPCA_CHK, "19+12345", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '9', expecting '7'" }, + /* 76*/ { BARCODE_UPCA_CHK, "1+12345", ZINT_ERROR_INVALID_CHECK, "Error 270: Invalid check digit '1', expecting '0'" }, + /* 77*/ { BARCODE_UPCA_CHK, "0+12345", 0, "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_upca_input"); + testStartSymbol("test_upca_input", &symbol); for (i = 0; i < data_size; i++) { @@ -295,6 +299,7 @@ static void test_upca_input(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt); ZBarcode_Delete(symbol); } @@ -313,145 +318,147 @@ static void test_eanx_input(const testCtx *const p_ctx) { char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_EANX, "123456789012", 0, "", "" }, - /* 1*/ { BARCODE_EANX, "12345678901A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only)", "" }, - /* 2*/ { BARCODE_EANX, "12345678901", 0, "", "" }, - /* 3*/ { BARCODE_EANX, "1234567890128", 0, "", "EANX accepts CHK (treated as such if no leading zeroes required)" }, - /* 4*/ { BARCODE_EANX, "1234567890120", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '0', expecting '8'", "" }, - /* 5*/ { BARCODE_EANX, "123456789012+1", 0, "", "" }, - /* 6*/ { BARCODE_EANX, "1234567890128+1", 0, "", "" }, - /* 7*/ { BARCODE_EANX, "1234567890121+1", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '1', expecting '8'", "" }, - /* 8*/ { BARCODE_EANX, "123456789012+12", 0, "", "" }, - /* 9*/ { BARCODE_EANX, "1234567890128+12", 0, "", "" }, - /* 10*/ { BARCODE_EANX, "1234567890122+12", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '2', expecting '8'", "" }, - /* 11*/ { BARCODE_EANX, "12345678901234+12", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /* 12*/ { BARCODE_EANX, "123456789012345+12", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /* 13*/ { BARCODE_EANX, "1234567890123456+12", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /* 14*/ { BARCODE_EANX, "123456789012+123", 0, "", "" }, - /* 15*/ { BARCODE_EANX, "1234567890128+123", 0, "", "" }, - /* 16*/ { BARCODE_EANX, "1234567890123+123", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '3', expecting '8'", "" }, - /* 17*/ { BARCODE_EANX, "12345678901234+123", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /* 18*/ { BARCODE_EANX, "123456789012345+123", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /* 19*/ { BARCODE_EANX, "123456789012+1234", 0, "", "" }, - /* 20*/ { BARCODE_EANX, "1234567890128+1234", 0, "", "" }, - /* 21*/ { BARCODE_EANX, "1234567890124+1234", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '4', expecting '8'", "" }, - /* 22*/ { BARCODE_EANX, "12345678901234+1234", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /* 23*/ { BARCODE_EANX, "123456789012+12345", 0, "", "" }, - /* 24*/ { BARCODE_EANX, "1234567890128+12345", 0, "", "" }, - /* 25*/ { BARCODE_EANX, "12345678901234+12345", ZINT_ERROR_TOO_LONG, "Error 283: Input too long (19 character maximum)", "" }, - /* 26*/ { BARCODE_EANX, "1234567890125+12345", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '5', expecting '8'", "" }, - /* 27*/ { BARCODE_EANX, "123456789012+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 28*/ { BARCODE_EANX, "1234567890128+123456", ZINT_ERROR_TOO_LONG, "Error 283: Input too long (19 character maximum)", "" }, - /* 29*/ { BARCODE_EANX, "12345678901+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 30*/ { BARCODE_EANX, "12345678901+1234567", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 31*/ { BARCODE_EANX, "1234567890+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 32*/ { BARCODE_EANX, "1234567890+1234567", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 33*/ { BARCODE_EANX, "123456789+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 34*/ { BARCODE_EANX, "123456789+1234567", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 35*/ { BARCODE_EANX, "12345678+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 36*/ { BARCODE_EANX, "1234567+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "EAN-8" }, - /* 37*/ { BARCODE_EANX, "123456+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 38*/ { BARCODE_EANX, "12345+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 39*/ { BARCODE_EANX, "1234+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 40*/ { BARCODE_EANX, "123+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 41*/ { BARCODE_EANX, "12+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 42*/ { BARCODE_EANX, "1+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 43*/ { BARCODE_EANX, "1+12345678901234", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 44*/ { BARCODE_EANX, "1+12345", 0, "", "" }, - /* 45*/ { BARCODE_EANX, "1+", 0, "", "EAN-2" }, - /* 46*/ { BARCODE_EANX, "+1", 0, "", "EAN-8" }, - /* 47*/ { BARCODE_EANX, "+", 0, "", "EAN-2" }, - /* 48*/ { BARCODE_EANX, "1", 0, "", "EAN-2" }, - /* 49*/ { BARCODE_EANX, "12", 0, "", "EAN-2" }, - /* 50*/ { BARCODE_EANX, "123", 0, "", "EAN-5" }, - /* 51*/ { BARCODE_EANX, "12345678901234", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /* 52*/ { BARCODE_EANX, "1234567890123A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only)", "" }, - /* 53*/ { BARCODE_EANX, "123456789012345", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /* 54*/ { BARCODE_EANX, "12345678901234A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only)", "" }, - /* 55*/ { BARCODE_EANX, "1234567890123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /* 56*/ { BARCODE_EANX, "12345678901234567", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /* 57*/ { BARCODE_EANX, "123456789012345678", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /* 58*/ { BARCODE_EANX, "1234567890123456789", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /* 59*/ { BARCODE_EANX_CHK, "1234567890128", 0, "", "" }, - /* 60*/ { BARCODE_EANX_CHK, "1234567890126", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '6', expecting '8'", "" }, - /* 61*/ { BARCODE_EANX_CHK, "123456789012A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only)", "" }, - /* 62*/ { BARCODE_EANX_CHK, "123456789012", 0, "", "Note: this is '0123456789012' with '2' happening to be the correct check digit" }, - /* 63*/ { BARCODE_EANX_CHK, "123456789013", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '3', expecting '2'", "" }, - /* 64*/ { BARCODE_EANX_CHK, "12345678901", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '1', expecting '5'", "" }, - /* 65*/ { BARCODE_EANX_CHK, "12345678905", 0, "", "" }, - /* 66*/ { BARCODE_EANX_CHK, "1234567890", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '0', expecting '5'", "" }, - /* 67*/ { BARCODE_EANX_CHK, "123456789", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '9', expecting '4'", "" }, - /* 68*/ { BARCODE_EANX_CHK, "12345678", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '8', expecting '0'", "EAN-8" }, - /* 69*/ { BARCODE_EANX_CHK, "1234567", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '7', expecting '5'", "" }, - /* 70*/ { BARCODE_EANX_CHK, "123456", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '6', expecting '7'", "" }, - /* 71*/ { BARCODE_EANX_CHK, "12345", 0, "", "EAN-5" }, - /* 72*/ { BARCODE_EANX_CHK, "1234", 0, "", "" }, - /* 73*/ { BARCODE_EANX_CHK, "123", 0, "", "" }, - /* 74*/ { BARCODE_EANX_CHK, "12", 0, "", "EAN-2" }, - /* 75*/ { BARCODE_EANX_CHK, "1", 0, "", "" }, - /* 76*/ { BARCODE_EANX_CHK, "123456789012+1", 0, "", "" }, - /* 77*/ { BARCODE_EANX_CHK, "1234567890128+1", 0, "", "" }, - /* 78*/ { BARCODE_EANX_CHK, "1234567890127+1", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '7', expecting '8'", "" }, - /* 79*/ { BARCODE_EANX_CHK, "123456789012+12", 0, "", "" }, - /* 80*/ { BARCODE_EANX_CHK, "1234567890128+12", 0, "", "" }, - /* 81*/ { BARCODE_EANX_CHK, "1234567890129+12", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '9', expecting '8'", "" }, - /* 82*/ { BARCODE_EANX_CHK, "123456789012+123", 0, "", "" }, - /* 83*/ { BARCODE_EANX_CHK, "1234567890128+123", 0, "", "" }, - /* 84*/ { BARCODE_EANX_CHK, "1234567890120+1234", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '0', expecting '8'", "" }, - /* 85*/ { BARCODE_EANX_CHK, "123456789012+1234", 0, "", "" }, - /* 86*/ { BARCODE_EANX_CHK, "1234567890128+1234", 0, "", "" }, - /* 87*/ { BARCODE_EANX_CHK, "1234567890121+1234", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '1', expecting '8'", "" }, - /* 88*/ { BARCODE_EANX_CHK, "123456789012+12345", 0, "", "" }, - /* 89*/ { BARCODE_EANX_CHK, "1234567890128+12345", 0, "", "" }, - /* 90*/ { BARCODE_EANX_CHK, "1234567890122+12345", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '2', expecting '8'", "" }, - /* 91*/ { BARCODE_EANX_CHK, "1234567890122+1234A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only)", "" }, - /* 92*/ { BARCODE_EANX_CHK, "123456789012+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 93*/ { BARCODE_EANX_CHK, "123456789012+12345A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only)", "" }, - /* 94*/ { BARCODE_EANX_CHK, "1234567890128+123456", ZINT_ERROR_TOO_LONG, "Error 283: Input too long (19 character maximum)", "" }, - /* 95*/ { BARCODE_EANX_CHK, "12345678901+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 96*/ { BARCODE_EANX_CHK, "12345678901+1234567", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /* 97*/ { BARCODE_EANX_CHK, "12345678901+12345", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '1', expecting '5'", "" }, - /* 98*/ { BARCODE_EANX_CHK, "1234567890+12345", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '0', expecting '5'", "" }, - /* 99*/ { BARCODE_EANX_CHK, "1234567890+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /*100*/ { BARCODE_EANX_CHK, "123456789+12345", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '9', expecting '4'", "" }, - /*101*/ { BARCODE_EANX_CHK, "12345678+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '8', expecting '0'", "EAN-8" }, - /*102*/ { BARCODE_EANX_CHK, "12345670+12345", 0, "", "" }, - /*103*/ { BARCODE_EANX_CHK, "1234567+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '7', expecting '5'", "" }, - /*104*/ { BARCODE_EANX_CHK, "1234565+12345", 0, "", "" }, - /*105*/ { BARCODE_EANX_CHK, "123456+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '6', expecting '7'", "" }, - /*106*/ { BARCODE_EANX_CHK, "123457+12345", 0, "", "" }, - /*107*/ { BARCODE_EANX_CHK, "12345+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '5', expecting '8'", "" }, - /*108*/ { BARCODE_EANX_CHK, "12348+12345", 0, "", "" }, - /*109*/ { BARCODE_EANX_CHK, "1234+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '4', expecting '6'", "" }, - /*110*/ { BARCODE_EANX_CHK, "1236+12345", 0, "", "" }, - /*111*/ { BARCODE_EANX_CHK, "123+12345", 0, "", "3 happens to be correct check digit" }, - /*112*/ { BARCODE_EANX_CHK, "124+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '4', expecting '3'", "" }, - /*113*/ { BARCODE_EANX_CHK, "12+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '2', expecting '7'", "" }, - /*114*/ { BARCODE_EANX_CHK, "17+12345", 0, "", "" }, - /*115*/ { BARCODE_EANX_CHK, "1+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '1', expecting '0'", "" }, - /*116*/ { BARCODE_EANX_CHK, "0+12345", 0, "", "" }, - /*117*/ { BARCODE_EANX_CHK, "0+123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /*118*/ { BARCODE_EANX_CHK, "1+12345678901234", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /*119*/ { BARCODE_EANX_CHK, "0+12345678901234", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (5 character maximum for add-on)", "" }, - /*120*/ { BARCODE_EANX_CHK, "1+", 0, "", "EAN-2" }, - /*121*/ { BARCODE_EANX_CHK, "+1", 0, "", "EAN-8" }, - /*122*/ { BARCODE_EANX_CHK, "+", 0, "", "EAN-2" }, - /*123*/ { BARCODE_EANX_CHK, "12345678901234", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /*124*/ { BARCODE_EANX_CHK, "1234567890123A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character in data (digits and \"+\" only)", "" }, - /*125*/ { BARCODE_EANX_CHK, "123456789012345", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /*126*/ { BARCODE_EANX_CHK, "1234567890123456", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /*127*/ { BARCODE_EANX_CHK, "12345678901234567", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /*128*/ { BARCODE_EANX_CHK, "123456789012345678", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, - /*129*/ { BARCODE_EANX_CHK, "1234567890123456789", ZINT_ERROR_TOO_LONG, "Error 294: Input too long (13 character maximum)", "" }, + /* 1*/ { BARCODE_EANX, "12345678901A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 12 in input (digits and \"+\" only)", "" }, + /* 2*/ { BARCODE_EANX, "12345A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 6 in input (digits and \"+\" only)", "" }, + /* 3*/ { BARCODE_EANX, "123A56", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 4 in input (digits and \"+\" only)", "" }, + /* 4*/ { BARCODE_EANX, "12345678901", 0, "", "" }, + /* 5*/ { BARCODE_EANX, "1234567890128", 0, "", "EANX accepts CHK (treated as such if no leading zeroes required)" }, + /* 6*/ { BARCODE_EANX, "1234567890120", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '0', expecting '8'", "" }, + /* 7*/ { BARCODE_EANX, "123456789012+1", 0, "", "" }, + /* 8*/ { BARCODE_EANX, "1234567890128+1", 0, "", "" }, + /* 9*/ { BARCODE_EANX, "1234567890121+1", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '1', expecting '8'", "" }, + /* 10*/ { BARCODE_EANX, "123456789012+12", 0, "", "" }, + /* 11*/ { BARCODE_EANX, "1234567890128+12", 0, "", "" }, + /* 12*/ { BARCODE_EANX, "1234567890122+12", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '2', expecting '8'", "" }, + /* 13*/ { BARCODE_EANX, "12345678901234+12", ZINT_ERROR_TOO_LONG, "Error 298: Input EAN length 14 too long (maximum 13)", "" }, + /* 14*/ { BARCODE_EANX, "123456789012345+12", ZINT_ERROR_TOO_LONG, "Error 298: Input EAN length 15 too long (maximum 13)", "" }, + /* 15*/ { BARCODE_EANX, "1234567890123456+12", ZINT_ERROR_TOO_LONG, "Error 298: Input EAN length 16 too long (maximum 13)", "" }, + /* 16*/ { BARCODE_EANX, "123456789012+123", 0, "", "" }, + /* 17*/ { BARCODE_EANX, "1234567890128+123", 0, "", "" }, + /* 18*/ { BARCODE_EANX, "1234567890123+123", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '3', expecting '8'", "" }, + /* 19*/ { BARCODE_EANX, "12345678901234+123", ZINT_ERROR_TOO_LONG, "Error 298: Input EAN length 14 too long (maximum 13)", "" }, + /* 20*/ { BARCODE_EANX, "123456789012345+123", ZINT_ERROR_TOO_LONG, "Error 298: Input EAN length 15 too long (maximum 13)", "" }, + /* 21*/ { BARCODE_EANX, "123456789012+1234", 0, "", "" }, + /* 22*/ { BARCODE_EANX, "1234567890128+1234", 0, "", "" }, + /* 23*/ { BARCODE_EANX, "1234567890124+1234", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '4', expecting '8'", "" }, + /* 24*/ { BARCODE_EANX, "12345678901234+1234", ZINT_ERROR_TOO_LONG, "Error 298: Input EAN length 14 too long (maximum 13)", "" }, + /* 25*/ { BARCODE_EANX, "123456789012+12345", 0, "", "" }, + /* 26*/ { BARCODE_EANX, "1234567890128+12345", 0, "", "" }, + /* 27*/ { BARCODE_EANX, "12345678901234+12345", ZINT_ERROR_TOO_LONG, "Error 283: Input length 20 too long (maximum 19)", "" }, + /* 28*/ { BARCODE_EANX, "1234567890125+12345", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '5', expecting '8'", "" }, + /* 29*/ { BARCODE_EANX, "123456789012+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /* 30*/ { BARCODE_EANX, "1234567890128+123456", ZINT_ERROR_TOO_LONG, "Error 283: Input length 20 too long (maximum 19)", "" }, + /* 31*/ { BARCODE_EANX, "12345678901+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /* 32*/ { BARCODE_EANX, "12345678901+1234567", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 7 too long (maximum 5)", "" }, + /* 33*/ { BARCODE_EANX, "1234567890+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /* 34*/ { BARCODE_EANX, "1234567890+1234567", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 7 too long (maximum 5)", "" }, + /* 35*/ { BARCODE_EANX, "123456789+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /* 36*/ { BARCODE_EANX, "123456789+1234567", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 7 too long (maximum 5)", "" }, + /* 37*/ { BARCODE_EANX, "12345678+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /* 38*/ { BARCODE_EANX, "1234567+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "EAN-8" }, + /* 39*/ { BARCODE_EANX, "123456+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /* 40*/ { BARCODE_EANX, "12345+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /* 41*/ { BARCODE_EANX, "1234+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /* 42*/ { BARCODE_EANX, "123+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /* 43*/ { BARCODE_EANX, "12+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /* 44*/ { BARCODE_EANX, "1+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /* 45*/ { BARCODE_EANX, "1+12345678901234", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 14 too long (maximum 5)", "" }, + /* 46*/ { BARCODE_EANX, "1+12345", 0, "", "" }, + /* 47*/ { BARCODE_EANX, "1+", 0, "", "EAN-2" }, + /* 48*/ { BARCODE_EANX, "+1", 0, "", "EAN-8" }, + /* 49*/ { BARCODE_EANX, "+", 0, "", "EAN-2" }, + /* 50*/ { BARCODE_EANX, "1", 0, "", "EAN-2" }, + /* 51*/ { BARCODE_EANX, "12", 0, "", "EAN-2" }, + /* 52*/ { BARCODE_EANX, "123", 0, "", "EAN-5" }, + /* 53*/ { BARCODE_EANX, "12345678901234", ZINT_ERROR_TOO_LONG, "Error 294: Input length 14 too long (maximum 13)", "" }, + /* 54*/ { BARCODE_EANX, "1234567890123A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 14 in input (digits and \"+\" only)", "" }, + /* 55*/ { BARCODE_EANX, "123456789012345", ZINT_ERROR_TOO_LONG, "Error 294: Input length 15 too long (maximum 13)", "" }, + /* 56*/ { BARCODE_EANX, "12345678901234A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 15 in input (digits and \"+\" only)", "" }, + /* 57*/ { BARCODE_EANX, "1234567890123456", ZINT_ERROR_TOO_LONG, "Error 294: Input length 16 too long (maximum 13)", "" }, + /* 58*/ { BARCODE_EANX, "12345678901234567", ZINT_ERROR_TOO_LONG, "Error 294: Input length 17 too long (maximum 13)", "" }, + /* 59*/ { BARCODE_EANX, "123456789012345678", ZINT_ERROR_TOO_LONG, "Error 294: Input length 18 too long (maximum 13)", "" }, + /* 60*/ { BARCODE_EANX, "1234567890123456789", ZINT_ERROR_TOO_LONG, "Error 294: Input length 19 too long (maximum 13)", "" }, + /* 61*/ { BARCODE_EANX_CHK, "1234567890128", 0, "", "" }, + /* 62*/ { BARCODE_EANX_CHK, "1234567890126", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '6', expecting '8'", "" }, + /* 63*/ { BARCODE_EANX_CHK, "123456789012A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 13 in input (digits and \"+\" only)", "" }, + /* 64*/ { BARCODE_EANX_CHK, "123456789012", 0, "", "Note: this is '0123456789012' with '2' happening to be the correct check digit" }, + /* 65*/ { BARCODE_EANX_CHK, "123456789013", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '3', expecting '2'", "" }, + /* 66*/ { BARCODE_EANX_CHK, "12345678901", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '1', expecting '5'", "" }, + /* 67*/ { BARCODE_EANX_CHK, "12345678905", 0, "", "" }, + /* 68*/ { BARCODE_EANX_CHK, "1234567890", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '0', expecting '5'", "" }, + /* 69*/ { BARCODE_EANX_CHK, "123456789", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '9', expecting '4'", "" }, + /* 70*/ { BARCODE_EANX_CHK, "12345678", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '8', expecting '0'", "EAN-8" }, + /* 71*/ { BARCODE_EANX_CHK, "1234567", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '7', expecting '5'", "" }, + /* 72*/ { BARCODE_EANX_CHK, "123456", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '6', expecting '7'", "" }, + /* 73*/ { BARCODE_EANX_CHK, "12345", 0, "", "EAN-5" }, + /* 74*/ { BARCODE_EANX_CHK, "1234", 0, "", "" }, + /* 75*/ { BARCODE_EANX_CHK, "123", 0, "", "" }, + /* 76*/ { BARCODE_EANX_CHK, "12", 0, "", "EAN-2" }, + /* 77*/ { BARCODE_EANX_CHK, "1", 0, "", "" }, + /* 78*/ { BARCODE_EANX_CHK, "123456789012+1", 0, "", "" }, + /* 79*/ { BARCODE_EANX_CHK, "1234567890128+1", 0, "", "" }, + /* 80*/ { BARCODE_EANX_CHK, "1234567890127+1", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '7', expecting '8'", "" }, + /* 81*/ { BARCODE_EANX_CHK, "123456789012+12", 0, "", "" }, + /* 82*/ { BARCODE_EANX_CHK, "1234567890128+12", 0, "", "" }, + /* 83*/ { BARCODE_EANX_CHK, "1234567890129+12", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '9', expecting '8'", "" }, + /* 84*/ { BARCODE_EANX_CHK, "123456789012+123", 0, "", "" }, + /* 85*/ { BARCODE_EANX_CHK, "1234567890128+123", 0, "", "" }, + /* 86*/ { BARCODE_EANX_CHK, "1234567890120+1234", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '0', expecting '8'", "" }, + /* 87*/ { BARCODE_EANX_CHK, "123456789012+1234", 0, "", "" }, + /* 88*/ { BARCODE_EANX_CHK, "1234567890128+1234", 0, "", "" }, + /* 89*/ { BARCODE_EANX_CHK, "1234567890121+1234", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '1', expecting '8'", "" }, + /* 90*/ { BARCODE_EANX_CHK, "123456789012+12345", 0, "", "" }, + /* 91*/ { BARCODE_EANX_CHK, "1234567890128+12345", 0, "", "" }, + /* 92*/ { BARCODE_EANX_CHK, "1234567890122+12345", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '2', expecting '8'", "" }, + /* 93*/ { BARCODE_EANX_CHK, "1234567890122+1234A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 19 in input (digits and \"+\" only)", "" }, + /* 94*/ { BARCODE_EANX_CHK, "123456789012+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /* 95*/ { BARCODE_EANX_CHK, "123456789012+12345A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 19 in input (digits and \"+\" only)", "" }, + /* 96*/ { BARCODE_EANX_CHK, "1234567890128+123456", ZINT_ERROR_TOO_LONG, "Error 283: Input length 20 too long (maximum 19)", "" }, + /* 97*/ { BARCODE_EANX_CHK, "12345678901+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /* 98*/ { BARCODE_EANX_CHK, "12345678901+1234567", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 7 too long (maximum 5)", "" }, + /* 99*/ { BARCODE_EANX_CHK, "12345678901+12345", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '1', expecting '5'", "" }, + /*100*/ { BARCODE_EANX_CHK, "1234567890+12345", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '0', expecting '5'", "" }, + /*101*/ { BARCODE_EANX_CHK, "1234567890+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /*102*/ { BARCODE_EANX_CHK, "123456789+12345", ZINT_ERROR_INVALID_CHECK, "Error 275: Invalid check digit '9', expecting '4'", "" }, + /*103*/ { BARCODE_EANX_CHK, "12345678+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '8', expecting '0'", "EAN-8" }, + /*104*/ { BARCODE_EANX_CHK, "12345670+12345", 0, "", "" }, + /*105*/ { BARCODE_EANX_CHK, "1234567+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '7', expecting '5'", "" }, + /*106*/ { BARCODE_EANX_CHK, "1234565+12345", 0, "", "" }, + /*107*/ { BARCODE_EANX_CHK, "123456+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '6', expecting '7'", "" }, + /*108*/ { BARCODE_EANX_CHK, "123457+12345", 0, "", "" }, + /*109*/ { BARCODE_EANX_CHK, "12345+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '5', expecting '8'", "" }, + /*110*/ { BARCODE_EANX_CHK, "12348+12345", 0, "", "" }, + /*111*/ { BARCODE_EANX_CHK, "1234+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '4', expecting '6'", "" }, + /*112*/ { BARCODE_EANX_CHK, "1236+12345", 0, "", "" }, + /*113*/ { BARCODE_EANX_CHK, "123+12345", 0, "", "3 happens to be correct check digit" }, + /*114*/ { BARCODE_EANX_CHK, "124+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '4', expecting '3'", "" }, + /*115*/ { BARCODE_EANX_CHK, "12+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '2', expecting '7'", "" }, + /*116*/ { BARCODE_EANX_CHK, "17+12345", 0, "", "" }, + /*117*/ { BARCODE_EANX_CHK, "1+12345", ZINT_ERROR_INVALID_CHECK, "Error 276: Invalid check digit '1', expecting '0'", "" }, + /*118*/ { BARCODE_EANX_CHK, "0+12345", 0, "", "" }, + /*119*/ { BARCODE_EANX_CHK, "0+123456", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, + /*120*/ { BARCODE_EANX_CHK, "1+12345678901234", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 14 too long (maximum 5)", "" }, + /*121*/ { BARCODE_EANX_CHK, "0+12345678901234", ZINT_ERROR_TOO_LONG, "Error 297: Input add-on length 14 too long (maximum 5)", "" }, + /*122*/ { BARCODE_EANX_CHK, "1+", 0, "", "EAN-2" }, + /*123*/ { BARCODE_EANX_CHK, "+1", 0, "", "EAN-8" }, + /*124*/ { BARCODE_EANX_CHK, "+", 0, "", "EAN-2" }, + /*125*/ { BARCODE_EANX_CHK, "12345678901234", ZINT_ERROR_TOO_LONG, "Error 294: Input length 14 too long (maximum 13)", "" }, + /*126*/ { BARCODE_EANX_CHK, "1234567890123A", ZINT_ERROR_INVALID_DATA, "Error 284: Invalid character at position 14 in input (digits and \"+\" only)", "" }, + /*127*/ { BARCODE_EANX_CHK, "123456789012345", ZINT_ERROR_TOO_LONG, "Error 294: Input length 15 too long (maximum 13)", "" }, + /*128*/ { BARCODE_EANX_CHK, "1234567890123456", ZINT_ERROR_TOO_LONG, "Error 294: Input length 16 too long (maximum 13)", "" }, + /*129*/ { BARCODE_EANX_CHK, "12345678901234567", ZINT_ERROR_TOO_LONG, "Error 294: Input length 17 too long (maximum 13)", "" }, + /*130*/ { BARCODE_EANX_CHK, "123456789012345678", ZINT_ERROR_TOO_LONG, "Error 294: Input length 18 too long (maximum 13)", "" }, + /*131*/ { BARCODE_EANX_CHK, "1234567890123456789", ZINT_ERROR_TOO_LONG, "Error 294: Input length 19 too long (maximum 13)", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char errtxt_escaped[256]; - testStart("test_eanx_input"); + testStartSymbol("test_eanx_input", &symbol); for (i = 0; i < data_size; i++) { @@ -491,37 +498,37 @@ static void test_isbn_input(const testCtx *const p_ctx) { char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { "0", 0, 0, "", "Left zero-padded if < 10 chars" }, /* 1*/ { "1", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid SBN check digit '1', expecting '0'", "" }, /* 2*/ { "X", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid SBN check digit 'X', expecting '0'", "" }, /* 3*/ { "12", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid SBN check digit '2', expecting '9'", "" }, /* 4*/ { "19", 0, 0, "", "" }, - /* 5*/ { "X9", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 5*/ { "X9", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 6*/ { "123", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid SBN check digit '3', expecting '4'", "" }, /* 7*/ { "124", 0, 0, "", "" }, - /* 8*/ { "1X4", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 8*/ { "1X4", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 9*/ { "1234", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid SBN check digit '4', expecting '6'", "" }, /* 10*/ { "1236", 0, 0, "", "" }, - /* 11*/ { "12X6", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 11*/ { "12X6", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 12*/ { "12345", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid SBN check digit '5', expecting '3'", "" }, /* 13*/ { "12343", 0, 0, "", "" }, - /* 14*/ { "123X3", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 14*/ { "123X3", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 15*/ { "123456", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid SBN check digit '6', expecting '5'", "" }, /* 16*/ { "123455", 0, 0, "", "" }, - /* 17*/ { "1234X5", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 17*/ { "1234X5", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 18*/ { "1234567", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid SBN check digit '7', expecting '0'", "" }, /* 19*/ { "1234560", 0, 0, "", "" }, - /* 20*/ { "12345X0", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 20*/ { "12345X0", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 21*/ { "12345678", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid SBN check digit '8', expecting '9'", "" }, /* 22*/ { "12345679", 0, 0, "", "9 is correct check digit" }, /* 23*/ { "98765434", 0, 0, "", "4 is correct check digit" }, - /* 24*/ { "123456X9", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 24*/ { "123456X9", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 25*/ { "123456789", 0, 0, "", "" }, /* 26*/ { "340013817", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid SBN check digit '7', expecting '8'", "" }, /* 27*/ { "340013818", 0, 0, "", "8 is correct check digit" }, /* 28*/ { "902888455", 0, 0, "", "5 is correct check digit" }, - /* 29*/ { "9028884X5", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 29*/ { "9028884X5", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 30*/ { "0123456789", 0, 0, "", "" }, /* 31*/ { "1234567890", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid ISBN check digit '0', expecting 'X'", "" }, /* 32*/ { "123456789X", 0, 0, "", "X is correct check digit" }, @@ -532,13 +539,13 @@ static void test_isbn_input(const testCtx *const p_ctx) { /* 37*/ { "0140430016", 0, 0, "", "6 is correct check digit" }, /* 38*/ { "0571086187", 0, 0, "", "7 is correct check digit" }, /* 39*/ { "0486600882", 0, 0, "", "2 is correct check digit" }, - /* 40*/ { "04866008X2", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, - /* 41*/ { "123456789A", ZINT_ERROR_INVALID_DATA, -1, "Error 285: Invalid character in data (digits, \"X\" and \"+\" only)", "" }, - /* 42*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input wrong length (9, 10, or 13 characters only)", "" }, - /* 43*/ { "1234567890A", ZINT_ERROR_INVALID_DATA, -1, "Error 285: Invalid character in data (digits, \"X\" and \"+\" only)", "" }, - /* 44*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input wrong length (9, 10, or 13 characters only)", "" }, - /* 45*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input wrong length (9, 10, or 13 characters only)", "" }, - /* 46*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input wrong length (9, 10, or 13 characters only)", "" }, + /* 40*/ { "04866008X2", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, + /* 41*/ { "123456789A", ZINT_ERROR_INVALID_DATA, -1, "Error 285: Invalid character at position 10 in input (digits, \"X\" and \"+\" only)", "" }, + /* 42*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input length 11 wrong (9, 10, or 13 only)", "" }, + /* 43*/ { "1234567890A", ZINT_ERROR_INVALID_DATA, -1, "Error 285: Invalid character at position 11 in input (digits, \"X\" and \"+\" only)", "" }, + /* 44*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input length 12 wrong (9, 10, or 13 only)", "" }, + /* 45*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input length 11 wrong (9, 10, or 13 only)", "" }, + /* 46*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1, "Error 278: Input length 12 wrong (9, 10, or 13 only)", "" }, /* 47*/ { "1234567890123", ZINT_ERROR_INVALID_DATA, -1, "Error 279: Invalid ISBN (must begin with \"978\" or \"979\")", "" }, /* 48*/ { "9784567890123", ZINT_ERROR_INVALID_CHECK, -1, "Error 280: Invalid ISBN check digit '3', expecting '0'", "" }, /* 49*/ { "9784567890120", 0, 0, "", "0 is correct check digit" }, @@ -547,64 +554,64 @@ static void test_isbn_input(const testCtx *const p_ctx) { /* 52*/ { "9781847657954", 0, 0, "", "4 is correct check digit" }, /* 53*/ { "9781846688188", 0, 0, "", "8 is correct check digit" }, /* 54*/ { "9781847659293", 0, 0, "", "3 is correct check digit" }, - /* 55*/ { "97845678901201", ZINT_ERROR_TOO_LONG, -1, "Error 294: Input too long (13 character maximum)", "" }, - /* 56*/ { "978456789012012", ZINT_ERROR_TOO_LONG, -1, "Error 294: Input too long (13 character maximum)", "" }, + /* 55*/ { "97845678901201", ZINT_ERROR_TOO_LONG, -1, "Error 294: Input length 14 too long (maximum 13)", "" }, + /* 56*/ { "978456789012012", ZINT_ERROR_TOO_LONG, -1, "Error 294: Input length 15 too long (maximum 13)", "" }, /* 57*/ { "3954994+12", 0, 0, "", "" }, /* 58*/ { "3954994+1X", ZINT_ERROR_INVALID_DATA, -1, "Error 295: Invalid add-on data (digits only)", "" }, - /* 59*/ { "39549X4+12", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 59*/ { "39549X4+12", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 60*/ { "3954994+12345", 0, 0, "", "" }, /* 61*/ { "3954994+1234X", ZINT_ERROR_INVALID_DATA, -1, "Error 295: Invalid add-on data (digits only)", "" }, - /* 62*/ { "39549X4+12345", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, - /* 63*/ { "3954994+123456", ZINT_ERROR_TOO_LONG, -1, "Error 294: Input too long (5 character maximum for add-on)", "" }, + /* 62*/ { "39549X4+12345", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, + /* 63*/ { "3954994+123456", ZINT_ERROR_TOO_LONG, -1, "Error 297: Input add-on length 6 too long (maximum 5)", "" }, /* 64*/ { "3954994+", 0, 0, "", "" }, - /* 65*/ { "3954X94+", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 65*/ { "3954X94+", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 66*/ { "61954993+1", 0, 0, "", "" }, /* 67*/ { "61954993+X", ZINT_ERROR_INVALID_DATA, -1, "Error 295: Invalid add-on data (digits only)", "" }, - /* 68*/ { "619549X3+1", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 68*/ { "619549X3+1", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 69*/ { "61954992+123", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid SBN check digit '2', expecting '3'", "" }, /* 70*/ { "61954993+123", 0, 0, "", "" }, /* 71*/ { "61954993+12X", ZINT_ERROR_INVALID_DATA, -1, "Error 295: Invalid add-on data (digits only)", "" }, - /* 72*/ { "619549X3+123", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 72*/ { "619549X3+123", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 73*/ { "361954990+12", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid SBN check digit '0', expecting '9'", "" }, /* 74*/ { "361954999+12", 0, 0, "", "" }, /* 75*/ { "361954999+1X", ZINT_ERROR_INVALID_DATA, -1, "Error 295: Invalid add-on data (digits only)", "" }, - /* 76*/ { "3619549X9+12", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 76*/ { "3619549X9+12", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 77*/ { "361954999+1234", 0, 0, "", "" }, /* 78*/ { "361954999+123X", ZINT_ERROR_INVALID_DATA, -1, "Error 295: Invalid add-on data (digits only)", "" }, - /* 79*/ { "3619549X9+1234", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 79*/ { "3619549X9+1234", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 80*/ { "1999000030+12", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid ISBN check digit '0', expecting 'X'", "" }, /* 81*/ { "199900003X+12", 0, 0, "", "" }, /* 82*/ { "199900003x+12", 0, 0, "", "" }, - /* 83*/ { "19990000XX+12", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, + /* 83*/ { "19990000XX+12", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, /* 84*/ { "199900003X+1X", ZINT_ERROR_INVALID_DATA, -1, "Error 295: Invalid add-on data (digits only)", "" }, /* 85*/ { "1999000031+12345", ZINT_ERROR_INVALID_CHECK, -1, "Error 281: Invalid ISBN check digit '1', expecting 'X'", "" }, /* 86*/ { "199900003X+12345", 0, 0, "", "" }, /* 87*/ { "199900003x+12345", 0, 0, "", "" }, /* 88*/ { "199900003X+1234X", ZINT_ERROR_INVALID_DATA, -1, "Error 295: Invalid add-on data (digits only)", "" }, - /* 89*/ { "19990000XX+12345", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in data, \"X\" allowed in last position only", "" }, - /* 90*/ { "199900003X+1234A", ZINT_ERROR_INVALID_DATA, -1, "Error 285: Invalid character in data (digits, \"X\" and \"+\" only)", "" }, + /* 89*/ { "19990000XX+12345", ZINT_ERROR_INVALID_DATA, -1, "Error 296: Invalid character in input, \"X\" allowed in last position only", "" }, + /* 90*/ { "199900003X+1234A", ZINT_ERROR_INVALID_DATA, -1, "Error 285: Invalid character at position 16 in input (digits, \"X\" and \"+\" only)", "" }, /* 91*/ { "9791234567895+12", ZINT_ERROR_INVALID_CHECK, -1, "Error 280: Invalid ISBN check digit '5', expecting '6'", "" }, /* 92*/ { "9791234567896+12", 0, 0, "", "" }, /* 93*/ { "9791234567896+1X", ZINT_ERROR_INVALID_DATA, -1, "Error 295: Invalid add-on data (digits only)", "" }, - /* 94*/ { "97912345678X6+12", ZINT_ERROR_INVALID_DATA, -1, "Error 282: Invalid character in data, \"X\" not allowed in ISBN-13", "" }, + /* 94*/ { "97912345678X6+12", ZINT_ERROR_INVALID_DATA, -1, "Error 282: Invalid character in input, \"X\" not allowed in ISBN-13", "" }, /* 95*/ { "9791234567897+12345", ZINT_ERROR_INVALID_CHECK, -1, "Error 280: Invalid ISBN check digit '7', expecting '6'", "" }, /* 96*/ { "9791234567896+12345", 0, 0, "", "" }, /* 97*/ { "9791234567896+1234X", ZINT_ERROR_INVALID_DATA, -1, "Error 295: Invalid add-on data (digits only)", "" }, - /* 98*/ { "979123456X896+12345", ZINT_ERROR_INVALID_DATA, -1, "Error 282: Invalid character in data, \"X\" not allowed in ISBN-13", "" }, + /* 98*/ { "979123456X896+12345", ZINT_ERROR_INVALID_DATA, -1, "Error 282: Invalid character in input, \"X\" not allowed in ISBN-13", "" }, /* 99*/ { "9791234567892+", ZINT_ERROR_INVALID_CHECK, -1, "Error 280: Invalid ISBN check digit '2', expecting '6'", "" }, /*100*/ { "9791234567896+", 0, 0, "", "" }, - /*101*/ { "97912345678X6+", ZINT_ERROR_INVALID_DATA, -1, "Error 282: Invalid character in data, \"X\" not allowed in ISBN-13", "" }, - /*102*/ { "97912345678961+", ZINT_ERROR_TOO_LONG, -1, "Error 294: Input too long (13 character maximum)", "" }, - /*103*/ { "97912345678961+12345", ZINT_ERROR_TOO_LONG, -1, "Error 283: Input too long (19 character maximum)", "" }, - /*104*/ { "9791234567896+123456", ZINT_ERROR_TOO_LONG, -1, "Error 283: Input too long (19 character maximum)", "" }, + /*101*/ { "97912345678X6+", ZINT_ERROR_INVALID_DATA, -1, "Error 282: Invalid character in input, \"X\" not allowed in ISBN-13", "" }, + /*102*/ { "97912345678961+", ZINT_ERROR_TOO_LONG, -1, "Error 294: Input length 14 too long (maximum 13)", "" }, + /*103*/ { "97912345678961+12345", ZINT_ERROR_TOO_LONG, -1, "Error 283: Input length 20 too long (maximum 19)", "" }, + /*104*/ { "9791234567896+123456", ZINT_ERROR_TOO_LONG, -1, "Error 283: Input length 20 too long (maximum 19)", "" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char errtxt_escaped[256]; - testStart("test_isbn_input"); + testStartSymbol("test_isbn_input", &symbol); for (i = 0; i < data_size; i++) { @@ -648,7 +655,7 @@ static void test_hrt(const testCtx *const p_ctx) { char *expected; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_EANX, "12345678901", 0, "0123456789012" }, /* 1*/ { BARCODE_EANX, "123456789012", 0, "1234567890128" }, /* 2*/ { BARCODE_EANX, "1234567890128", 0, "1234567890128" }, /* EANX accepts CHK (treated as such if no leading zeroes required) */ @@ -707,11 +714,11 @@ static void test_hrt(const testCtx *const p_ctx) { /* 55*/ { BARCODE_UPCE_CHK, "12345670+1", 0, "12345670+01" }, /* 56*/ { BARCODE_UPCE_CHK, "1234565+1", 0, "01234565+01" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_hrt"); + testStartSymbol("test_hrt", &symbol); for (i = 0; i < data_size; i++) { @@ -742,16 +749,16 @@ static void test_vector_same(const testCtx *const p_ctx) { int ret_encode; int ret_vector; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_UPCE, "123456", 0, 0 }, /* 1*/ { BARCODE_UPCE_CHK, "1234565", 0, 0 }, /* 5 is correct check digit */ /* 2*/ { BARCODE_ISBNX, "0195049969", 0, 0 }, /* 9 is correct check digit */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_vector_same"); + testStartSymbol("test_vector_same", &symbol); for (i = 0; i < data_size; i++) { struct zint_vector *vectors[4]; @@ -809,7 +816,7 @@ static void test_encode(const testCtx *const p_ctx) { char *comment; char *expected; }; - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_UPCA, -1, "01234567890", 0, 1, 95, "GGS Figure 5.1-1 UPC-A (also Figure 5.2.2.3-1., 5.2.6.6-2., 6.4.9-1. and BS EN 797:1996 Figure 3)", "10100011010011001001001101111010100011011000101010101000010001001001000111010011100101001110101" }, @@ -919,9 +926,9 @@ static void test_encode(const testCtx *const p_ctx) { "10101110110010111011001100100110100001010001101010100111010100001000100100100011101001010000101000000010110011001010010011" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[4096]; char cmp_buf[4096]; @@ -930,7 +937,7 @@ static void test_encode(const testCtx *const p_ctx) { 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"); + testStartSymbol("test_encode", &symbol); for (i = 0; i < data_size; i++) { @@ -998,7 +1005,7 @@ static void test_fuzz(const testCtx *const p_ctx) { int ret; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_EANX, "55++15", -1, ZINT_ERROR_INVALID_DATA }, /* 1*/ { BARCODE_EANX, "+123456789012345678", -1, ZINT_ERROR_TOO_LONG }, /* 2*/ { BARCODE_EANX_CHK, "+123456789012345678", -1, ZINT_ERROR_TOO_LONG }, @@ -1011,11 +1018,11 @@ static void test_fuzz(const testCtx *const p_ctx) { /* 9*/ { BARCODE_EANX, "+123456", -1, ZINT_ERROR_TOO_LONG }, /*10*/ { BARCODE_EANX, "000002000000200+203", -1, ZINT_ERROR_TOO_LONG }, /* #218 Jan Schrewe CI-Fuzz */ }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_fuzz"); + testStartSymbol("test_fuzz", &symbol); for (i = 0; i < data_size; i++) { @@ -1056,7 +1063,7 @@ static void test_perf(const testCtx *const p_ctx) { char *comment; }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ - struct item data[] = { + static const struct item data[] = { /* 0*/ { BARCODE_EANX, -1, "123456789012+12345", 0, 1, 149, "EAN-13 add-on 5" }, /* 1*/ { BARCODE_EANX, -1, "123456789012", 0, 1, 95, "EAN-13 no add-on" }, /* 2*/ { BARCODE_UPCA, -1, "12345678901+12345", 0, 1, 151, "UPC-A add-on 5" }, @@ -1068,7 +1075,7 @@ static void test_perf(const testCtx *const p_ctx) { /* 8*/ { BARCODE_EANX, -1, "12345", 0, 1, 47, "EAN-5" }, /* 9*/ { BARCODE_EANX, -1, "12", 0, 1, 20, "EAN-2" }, }; - int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int i, length, ret; struct zint_symbol *symbol; diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index 9455d1de..c395b7b0 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -381,6 +381,7 @@ int testContinue(const testCtx *const p_ctx, const int i) { } if ((p_ctx->debug & ZINT_DEBUG_TEST_PRINT) && !(p_ctx->debug & ZINT_DEBUG_TEST_LESS_NOISY)) { printf("i:%d\n", i); + fflush(stdout); /* For assertion failures */ } return 0; } @@ -451,7 +452,7 @@ const char *testUtilErrorName(int error_number) { { "ZINT_ERROR_NONCOMPLIANT", ZINT_ERROR_NONCOMPLIANT, 14 }, { "ZINT_ERROR_HRT_TRUNCATED", ZINT_ERROR_HRT_TRUNCATED, 15 }, }; - static const int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); if (error_number < 0 || error_number >= data_size) { return ""; @@ -482,7 +483,7 @@ const char *testUtilInputModeName(int input_mode) { { "FAST_MODE", FAST_MODE, 0x0080 }, { "EXTRA_ESCAPE_MODE", EXTRA_ESCAPE_MODE, 0x0100 }, }; - static const int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); int set, i; if (input_mode < 0) { @@ -2302,7 +2303,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol { "rectangularmicroqrcode", BARCODE_RMQR, 145, 1, 1, 1, 0, 0, }, { "bc412", BARCODE_BC412, 146, 1, 1, 0, 0, 0, }, }; - static const int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); const int symbology = symbol->symbology; const int gs1 = (symbol->input_mode & 0x07) == GS1_MODE; @@ -2449,6 +2450,9 @@ static void testUtilBwippCvtGS1Data(char *bwipp_data, const int upcean, const in } } +#define z_isxdigit(c) (z_isdigit(c) || ((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f')) +#define z_isodigit(c) ((c) <= '7' && (c) >= '0') + /* Convert data to Ghostscript format for passing to bwipp_dump.ps */ static char *testUtilBwippEscape(char *bwipp_data, int bwipp_data_size, const char *data, int length, int zint_escape_mode, int eci, int *parse, int *parsefnc) { @@ -2491,9 +2495,24 @@ static char *testUtilBwippEscape(char *bwipp_data, int bwipp_data_size, const ch case 'e': val = 0x1b; /* Escape */ break; case 'G': val = 0x1d; /* Group Separator */ break; case 'R': val = 0x1e; /* Record Separator */ break; - /*case 'x': val = 0; TODO: implement break; */ + case 'x': + val = d + 1 + 2 < de && z_isxdigit(d[1]) && z_isxdigit(d[2]) ? (ctoi(d[1]) << 4) | ctoi(d[2]) : -1; + if (val != -1) d+= 2; + break; + case 'd': + val = d + 1 + 3 < de ? to_int(d + 1, 3) : -1; + if (val > 255) val = -1; + if (val != -1) d += 3; + break; + case 'o': + val = d + 1 + 3 < de && z_isodigit(d[1]) && z_isodigit(d[2]) && z_isodigit(d[3]) + ? (ctoi(d[1]) << 6) | (ctoi(d[2]) << 3) | ctoi(d[3]) : -1; + if (val > 255) val = -1; + if (val != -1) d += 3; + break; case '\\': val = '\\'; break; /*case 'u': val = 0; TODO: implement break; */ + /*case 'U': val = 0; TODO: implement break; */ case '^': val = -1; break; /* Code 128 special escapes */ default: fprintf(stderr, "testUtilBwippEscape: unknown escape %c\n", *d); return NULL; break; } @@ -3602,7 +3621,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym { "", -1, 27, }, { "", BARCODE_FLAT, 28, }, { "DataBar", BARCODE_DBAR_OMN, 29, }, - { "", BARCODE_DBAR_LTD, 30, }, + { "DataBarLimited", BARCODE_DBAR_LTD, 30, }, { "DataBarExpanded", BARCODE_DBAR_EXP, 31, }, { "", BARCODE_TELEPEN, 32, }, { "", -1, 33, }, @@ -3719,7 +3738,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym { "", BARCODE_ULTRA, 144, }, { "RMQRCode", BARCODE_RMQR, 145, }, }; - static const int data_size = ARRAY_SIZE(data); + const int data_size = ARRAY_SIZE(data); const int symbology = symbol->symbology; @@ -4011,8 +4030,8 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in hibc[0] = '+'; memcpy(hibc + 1, expected, expected_len); to_upper((unsigned char *) (hibc + 1), expected_len); - if (!is_sane_lookup(TECHNETIUM, sizeof(TECHNETIUM) - 1, (unsigned char *) (hibc + 1), expected_len, posns)) { - sprintf(msg, "HIBC is_sane_lookup(TECHNETIUM) failed"); + if (not_sane_lookup(TECHNETIUM, sizeof(TECHNETIUM) - 1, (unsigned char *) (hibc + 1), expected_len, posns)) { + sprintf(msg, "HIBC not_sane_lookup(TECHNETIUM) failed"); return 5; } counter = 41; @@ -4122,10 +4141,15 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in c25inter[++expected_len] = '\0'; expected = c25inter; } - } else if (symbology == BARCODE_DBAR_OMN || symbology == BARCODE_DBAR_OMNSTK || symbology == BARCODE_DBAR_STK) { + } else if (symbology == BARCODE_DBAR_OMN || symbology == BARCODE_DBAR_LTD || symbology == BARCODE_DBAR_OMNSTK + || symbology == BARCODE_DBAR_STK) { if (expected_len == 13) { cmp_len--; /* Too messy to calc the check digit so ignore */ } + if (symbology == BARCODE_DBAR_LTD) { + cmp_buf += 2; /* Ignore prefixed "01" */ + cmp_len -= 2; + } } else if (is_upcean) { if (symbology == BARCODE_UPCA && (expected_len == 11 || expected_len == 14 || expected_len == 17)) { memcpy(upcean, expected, 11); diff --git a/backend/tif.c b/backend/tif.c index 14e82fd9..429a5b5f 100644 --- a/backend/tif.c +++ b/backend/tif.c @@ -305,14 +305,13 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix } if (free_memory > 0xffff0000) { - strcpy(symbol->errtxt, "670: Output file size too big"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 670, "TIF output file size too big"); } /* Open output file in binary mode */ if (!fm_open(fmp, symbol, "wb")) { - sprintf(symbol->errtxt, "672: Could not open output file (%d: %.30s)", fmp->err, strerror(fmp->err)); - return ZINT_ERROR_FILE_ACCESS; + return errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 672, "Could not open TIF output file (%1$d: %2$s)", fmp->err, + strerror(fmp->err)); } if (!output_to_stdout) { compression = TIF_LZW; @@ -374,8 +373,7 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix if (!tif_lzw_encode(&lzw_state, fmp, strip_buf, bytes_put)) { /* Only fails if can't malloc */ tif_lzw_cleanup(&lzw_state); (void) fm_close(fmp, symbol); - strcpy(symbol->errtxt, "673: Failed to malloc LZW hash table"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 673, "Insufficient memory for TIF LZW hash table"); } bytes_put = fm_tell(fmp) - file_pos; if (bytes_put != strip_bytes[strip]) { @@ -411,9 +409,8 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix temp32 = (uint32_t) free_memory; /* Shouldn't happen as `free_memory` checked above to be <= 0xffff0000 & should only decrease */ if (free_memory != temp32 || (long) free_memory != file_pos) { - strcpy(symbol->errtxt, "982: Output file size too big"); (void) fm_close(fmp, symbol); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 982, "TIF output file size too big"); } out_le_u32(temp32, temp32); fm_write(&temp32, 4, 1, fmp); @@ -592,7 +589,7 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix } if (fm_error(fmp)) { - sprintf(symbol->errtxt, "679: Incomplete write to output (%d: %.30s)", fmp->err, strerror(fmp->err)); + errtxtf(0, symbol, 679, "Incomplete write of TIF output (%1$d: %2$s)", fmp->err, strerror(fmp->err)); (void) fm_close(fmp, symbol); return ZINT_ERROR_FILE_WRITE; } @@ -600,13 +597,12 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix if (!output_to_stdout) { if (fm_tell(fmp) != total_bytes_put) { (void) fm_close(fmp, symbol); - strcpy(symbol->errtxt, "674: Failed to write all output"); - return ZINT_ERROR_FILE_WRITE; + return errtxt(ZINT_ERROR_FILE_WRITE, symbol, 674, "Failed to write all TIF output"); } } if (!fm_close(fmp, symbol)) { - sprintf(symbol->errtxt, "981: Failure on closing output file (%d: %.30s)", fmp->err, strerror(fmp->err)); - return ZINT_ERROR_FILE_WRITE; + return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 981, "Failure on closing TIF output file (%1$d: %2$s)", + fmp->err, strerror(fmp->err)); } return 0; diff --git a/backend/ultra.c b/backend/ultra.c index 46949077..30e39dab 100644 --- a/backend/ultra.c +++ b/backend/ultra.c @@ -937,20 +937,21 @@ INTERNAL int ultra(struct zint_symbol *symbol, struct zint_seg segs[], const int (void)seg_count; if (symbol->eci > 811799) { - strcpy(symbol->errtxt, "590: ECI value not supported by Ultracode"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 590, "ECI code '%d' out of range (0 to 811799)", + symbol->eci); } if (symbol->structapp.count) { int link2 = 2; /* Draft Table 7, Structured Append Group (SAG) with no File Number */ if (symbol->structapp.count < 2 || symbol->structapp.count > 8) { - strcpy(symbol->errtxt, "596: Structured Append count out of range (2-8)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 596, + "Structured Append count '%d' out of range (2 to 8)", symbol->structapp.count); } if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) { - sprintf(symbol->errtxt, "597: Structured Append index out of range (1-%d)", symbol->structapp.count); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 597, + "Structured Append index '%1$d' out of range (1 to count %2$d)", + symbol->structapp.index, symbol->structapp.count); } scr_cw_count = 1; @@ -960,18 +961,17 @@ INTERNAL int ultra(struct zint_symbol *symbol, struct zint_seg segs[], const int for (id_len = 1; id_len < 6 && symbol->structapp.id[id_len]; id_len++); if (id_len > 5) { /* 282 * 283 + 282 = 80088 */ - strcpy(symbol->errtxt, "593: Structured Append ID too long (5 digit maximum)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 593, + "Structured Append ID length %d too long (5 digit maximum)", id_len); } id = to_int((const unsigned char *) symbol->structapp.id, id_len); if (id == -1) { - strcpy(symbol->errtxt, "594: Invalid Structured Append ID (digits only)"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 594, "Invalid Structured Append ID (digits only)"); } if (id > 80088) { - sprintf(symbol->errtxt, "595: Structured Append ID '%d' out of range (1-80088)", id); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 595, + "Structured Append ID value '%d' out of range (1 to 80088)", id); } if (id) { link2 = 3; /* Missing from draft Table 7 but mentioned 7.4.3 - SAG with File Number */ @@ -1010,8 +1010,8 @@ INTERNAL int ultra(struct zint_symbol *symbol, struct zint_seg segs[], const int if (symbol->option_2 > 0) { if (symbol->option_2 > 2) { - strcpy(symbol->errtxt, "592: Revision must be 1 or 2"); - return ZINT_ERROR_INVALID_OPTION; + return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 592, "Revision '%d' out of range (1 or 2 only)", + symbol->option_2); } if (symbol->option_2 == 2) { /* Revision 2, swop and inversion of DCCU/DCCL tiles */ revision_idx = 1; @@ -1030,9 +1030,9 @@ INTERNAL int ultra(struct zint_symbol *symbol, struct zint_seg segs[], const int qcc = 3; } else { if ((data_cw_count % 25) == 0) { - qcc = (ult_kec[ecc_level] * (data_cw_count / 25)) + 3 + 2; + qcc = ult_kec[ecc_level] * (data_cw_count / 25) + 3 + 2; } else { - qcc = (ult_kec[ecc_level] * ((data_cw_count / 25) + 1)) + 3 + 2; + qcc = ult_kec[ecc_level] * ((data_cw_count / 25) + 1) + 3 + 2; } } @@ -1058,8 +1058,10 @@ INTERNAL int ultra(struct zint_symbol *symbol, struct zint_seg segs[], const int /* Maximum capacity is 282 codewords */ total_cws = data_cw_count + qcc + 3; /* 3 == TCC pattern + RSEC pattern + QCC pattern */ if (total_cws - 3 > 282) { - strcpy(symbol->errtxt, "591: Data too long for selected error correction capacity"); - return ZINT_ERROR_TOO_LONG; + static const int max_data_cws_by_ecc[6] = { 279, 266, 255, 237, 223, 205 }; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 591, + "Input too long for ECC level EC%1$d, requires %2$d codewords (maximum %3$d)", + ecc_level, data_cw_count, max_data_cws_by_ecc[ecc_level]); } rows = 5; diff --git a/backend/upcean.c b/backend/upcean.c index 627d66c4..9f4e60c2 100644 --- a/backend/upcean.c +++ b/backend/upcean.c @@ -34,6 +34,7 @@ #define ISBNX_SANE_F (IS_NUM_F | IS_UX__F) /* ISBNX_SANE "0123456789X" */ #define ISBNX_ADDON_SANE_F (IS_NUM_F | IS_UX__F | IS_LX__F | IS_PLS_F) /* ISBNX_ADDON_SANE "0123456789Xx+" */ +#include #include #include "common.h" #include "gs1.h" @@ -120,9 +121,8 @@ static int upca_cc(struct zint_symbol *symbol, const unsigned char source[], int gtin[length] = '\0'; } else { if (source[length - 1] != gs1_check_digit(gtin, 11)) { - sprintf(symbol->errtxt, "270: Invalid check digit '%c', expecting '%c'", - source[length - 1], gs1_check_digit(gtin, 11)); - return ZINT_ERROR_INVALID_CHECK; + return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 270, "Invalid check digit '%1$c', expecting '%2$c'", + source[length - 1], gs1_check_digit(gtin, 11)); } } if (symbol->debug & ZINT_DEBUG_PRINT) { @@ -177,13 +177,16 @@ static int upce_cc(struct zint_symbol *symbol, unsigned char source[], int lengt hrt[0] = '\0'; if (length == 7) { switch (source[0]) { - case '0': num_system = 0; + case '0': + num_system = 0; ustrncat(hrt, source, length); break; - case '1': num_system = 1; + case '1': + num_system = 1; ustrncat(hrt, source, length); break; - default: num_system = 0; + default: + num_system = 0; /* First source char ignored */ ustrncat(hrt, source, length); hrt[0] = '0'; /* Overwrite HRT first char with '0' to correct TODO: error/warn in future */ @@ -228,10 +231,9 @@ static int upce_cc(struct zint_symbol *symbol, unsigned char source[], int lengt equivalent[10] = source[4]; if (((source[2] == '0') || (source[2] == '1')) || (source[2] == '2')) { /* Note 1 - "X3 shall not be equal to 0, 1 or 2" */ - sprintf(symbol->errtxt, - "271: For this UPC-E zero suppression, 3rd character cannot be \"0\", \"1\" or \"2\" (%.*s)", - length, source); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 271, + "For this UPC-E zero suppression, 3rd character cannot be \"0\", \"1\" or \"2\" (%.*s)", + length, source); } break; case '4': @@ -240,9 +242,9 @@ static int upce_cc(struct zint_symbol *symbol, unsigned char source[], int lengt equivalent[10] = source[4]; if (source[3] == '0') { /* Note 2 - "X4 shall not be equal to 0" */ - sprintf(symbol->errtxt, "272: For this UPC-E zero suppression, 4th character cannot be \"0\" (%.*s)", - length, source); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 272, + "For this UPC-E zero suppression, 4th character cannot be \"0\" (%.*s)", + length, source); } break; case '5': @@ -256,9 +258,9 @@ static int upce_cc(struct zint_symbol *symbol, unsigned char source[], int lengt equivalent[10] = emode; if (source[4] == '0') { /* Note 3 - "X5 shall not be equal to 0" */ - sprintf(symbol->errtxt, "273: For this UPC-E zero suppression, 5th character cannot be \"0\" (%.*s)", - length, source); - return ZINT_ERROR_INVALID_DATA; + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 273, + "For this UPC-E zero suppression, 5th character cannot be \"0\" (%.*s)", + length, source); } break; } @@ -268,8 +270,8 @@ static int upce_cc(struct zint_symbol *symbol, unsigned char source[], int lengt check_digit = gs1_check_digit(equivalent, 11); if (src_check_digit && src_check_digit != check_digit) { - sprintf(symbol->errtxt, "274: Invalid check digit '%c', expecting '%c'", src_check_digit, check_digit); - return ZINT_ERROR_INVALID_CHECK; + return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 274, "Invalid check digit '%1$c', expecting '%2$c'", + src_check_digit, check_digit); } /* Use the number system and check digit information to choose a parity scheme */ @@ -287,9 +289,11 @@ static int upce_cc(struct zint_symbol *symbol, unsigned char source[], int lengt for (i = 0; i < length; i++, d += 4) { switch (parity[i]) { - case 'A': memcpy(d, EANsetA[source[i] - '0'], 4); + case 'A': + memcpy(d, EANsetA[source[i] - '0'], 4); break; - case 'B': memcpy(d, EANsetB[source[i] - '0'], 4); + case 'B': + memcpy(d, EANsetB[source[i] - '0'], 4); break; } } @@ -368,10 +372,12 @@ static void ean_add_on(const unsigned char source[], const int length, char dest for (i = 0; i < length; i++) { switch (parity[i]) { - case 'A': memcpy(d, EANsetA[source[i] - '0'], 4); + case 'A': + memcpy(d, EANsetA[source[i] - '0'], 4); d += 4; break; - case 'B': memcpy(d, EANsetB[source[i] - '0'], 4); + case 'B': + memcpy(d, EANsetB[source[i] - '0'], 4); d += 4; break; } @@ -403,9 +409,8 @@ static int ean13_cc(struct zint_symbol *symbol, const unsigned char source[], in gtin[length] = '\0'; } else { if (source[length - 1] != gs1_check_digit(gtin, 12)) { - sprintf(symbol->errtxt, "275: Invalid check digit '%c', expecting '%c'", - source[length - 1], gs1_check_digit(gtin, 12)); - return ZINT_ERROR_INVALID_CHECK; + return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 275, "Invalid check digit '%1$c', expecting '%2$c'", + source[length - 1], gs1_check_digit(gtin, 12)); } } if (symbol->debug & ZINT_DEBUG_PRINT) { @@ -477,9 +482,8 @@ static int ean8_cc(struct zint_symbol *symbol, const unsigned char source[], int gtin[length] = '\0'; } else { if (source[length - 1] != gs1_check_digit(gtin, 7)) { - sprintf(symbol->errtxt, "276: Invalid check digit '%c', expecting '%c'", - source[length - 1], gs1_check_digit(gtin, 7)); - return ZINT_ERROR_INVALID_CHECK; + return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 276, "Invalid check digit '%1$c', expecting '%2$c'", + source[length - 1], gs1_check_digit(gtin, 7)); } } if (symbol->debug & ZINT_DEBUG_PRINT) { @@ -537,44 +541,41 @@ static char isbnx_check(const unsigned char source[], const int length) { } /* Make an EAN-13 barcode from an SBN or ISBN */ -static int isbnx(struct zint_symbol *symbol, unsigned char source[], const int src_len, char dest[]) { +static int isbnx(struct zint_symbol *symbol, unsigned char source[], const int length, char dest[]) { int i; char check_digit; - to_upper(source, src_len); - if (!is_sane(ISBNX_SANE_F, source, src_len)) { - strcpy(symbol->errtxt, "277: Invalid character in data (digits and \"X\" only)"); - return ZINT_ERROR_INVALID_DATA; + to_upper(source, length); + if (not_sane(ISBNX_SANE_F, source, length)) { /* As source has been zero-padded, don't report position */ + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 277, "Invalid character in input (digits and \"X\" only)"); } /* Input must be 9, 10 or 13 characters */ - if (src_len != 9 && src_len != 10 && src_len != 13) { - strcpy(symbol->errtxt, "278: Input wrong length (9, 10, or 13 characters only)"); - return ZINT_ERROR_TOO_LONG; + if (length != 9 && length != 10 && length != 13) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 278, "Input length %d wrong (9, 10, or 13 only)", length); } - if (src_len == 13) /* Using 13 character ISBN */ { + if (length == 13) /* Using 13 character ISBN */ { if (!(((source[0] == '9') && (source[1] == '7')) && ((source[2] == '8') || (source[2] == '9')))) { - strcpy(symbol->errtxt, "279: Invalid ISBN (must begin with \"978\" or \"979\")"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 279, "Invalid ISBN (must begin with \"978\" or \"979\")"); } /* "X" cannot occur */ - if (!is_sane(NEON_F, source, 13)) { - strcpy(symbol->errtxt, "282: Invalid character in data, \"X\" not allowed in ISBN-13"); - return ZINT_ERROR_INVALID_DATA; + if (not_sane(NEON_F, source, 13)) { + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 282, + "Invalid character in input, \"X\" not allowed in ISBN-13"); } check_digit = gs1_check_digit(source, 12); if (source[12] != check_digit) { - sprintf(symbol->errtxt, "280: Invalid ISBN check digit '%c', expecting '%c'", source[12], check_digit); - return ZINT_ERROR_INVALID_CHECK; + return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 280, "Invalid ISBN check digit '%1$c', expecting '%2$c'", + source[12], check_digit); } source[12] = '\0'; } else { /* Using 10 digit ISBN or 9 digit SBN padded with leading zero */ - if (src_len == 9) /* Using 9 digit SBN */ { + if (length == 9) /* Using 9 digit SBN */ { /* Add leading zero */ for (i = 10; i > 0; i--) { source[i] = source[i - 1]; @@ -583,16 +584,16 @@ static int isbnx(struct zint_symbol *symbol, unsigned char source[], const int s } /* "X" can only occur in last position */ - if (!is_sane(NEON_F, source, 9)) { - strcpy(symbol->errtxt, "296: Invalid character in data, \"X\" allowed in last position only"); - return ZINT_ERROR_INVALID_DATA; + if (not_sane(NEON_F, source, 9)) { + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 296, + "Invalid character in input, \"X\" allowed in last position only"); } check_digit = isbnx_check(source, 9); if (check_digit != source[9]) { - sprintf(symbol->errtxt, "281: Invalid %s check digit '%c', expecting '%c'", src_len == 9 ? "SBN" : "ISBN", - source[9], check_digit); - return ZINT_ERROR_INVALID_CHECK; + return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 281, + "Invalid %1$s check digit '%2$c', expecting '%3$c'", length == 9 ? "SBN" : "ISBN", + source[9], check_digit); } for (i = 11; i > 2; i--) { /* This drops the check digit */ source[i] = source[i - 3]; @@ -627,8 +628,17 @@ INTERNAL int ean_leading_zeroes(struct zint_symbol *symbol, const unsigned char } } if (first_len > 13 || second_len > 5) { + if (first_len > 13) { + if (!second_len) { + errtxtf(0, symbol, 294, "Input length %d too long (maximum 13)", first_len); + } else { + errtxtf(0, symbol, 298, "Input EAN length %d too long (maximum 13)", first_len); + } + } else { + errtxtf(0, symbol, 297, "Input add-on length %d too long (maximum 5)", second_len); + } if (p_with_addon) { - *p_with_addon = second_len > 5 ? with_addon : 0; + *p_with_addon = with_addon; } return 0; } @@ -751,7 +761,7 @@ INTERNAL int ean_leading_zeroes(struct zint_symbol *symbol, const unsigned char return 1; /* Success */ } -INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int src_len, int cc_rows) { +INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int length, int cc_rows) { unsigned char first_part[14], second_part[6]; unsigned char local_source[20]; /* Allow 13 + "+" + 5 + 1 */ char dest[1000] = {0}; @@ -760,41 +770,37 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int src int addon_gap = 0; int first_part_len, second_part_len; - if (src_len > 19) { - strcpy(symbol->errtxt, "283: Input too long (19 character maximum)"); - return ZINT_ERROR_TOO_LONG; + if (length > 19) { + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 283, "Input length %d too long (maximum 19)", length); } if (symbol->symbology != BARCODE_ISBNX) { /* ISBN has its own sanity routine */ - if (!is_sane(SODIUM_PLS_F, source, src_len)) { - strcpy(symbol->errtxt, "284: Invalid character in data (digits and \"+\" only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(SODIUM_PLS_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 284, + "Invalid character at position %d in input (digits and \"+\" only)", i); } } else { - if (!is_sane(ISBNX_ADDON_SANE_F, source, src_len)) { - strcpy(symbol->errtxt, "285: Invalid character in data (digits, \"X\" and \"+\" only)"); - return ZINT_ERROR_INVALID_DATA; + if ((i = not_sane(ISBNX_ADDON_SANE_F, source, length))) { + return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 285, + "Invalid character at position %d in input (digits, \"X\" and \"+\" only)", i); } /* Add-on will be checked separately to be numeric only below */ } /* Check for multiple '+' characters */ plus_count = 0; - for (i = 0; i < src_len; i++) { + for (i = 0; i < length; i++) { if (source[i] == '+') { plus_count++; if (plus_count > 1) { - strcpy(symbol->errtxt, "293: Invalid add-on data (one \"+\" only)"); - return ZINT_ERROR_INVALID_DATA; + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 293, "Invalid add-on data (one \"+\" only)"); } } } /* Add leading zeroes, checking max lengths of parts */ if (!ean_leading_zeroes(symbol, source, local_source, &with_addon, first_part, second_part)) { - sprintf(symbol->errtxt, "294: Input too long (%s)", - with_addon ? "5 character maximum for add-on" : "13 character maximum"); - return ZINT_ERROR_TOO_LONG; + return ZINT_ERROR_TOO_LONG; /* `ean_leading_zeroes()` sets `errtxt` */ } if (with_addon) { @@ -813,7 +819,8 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int src case BARCODE_EANX_CHK: switch (first_part_len) { case 2: - case 5: ean_add_on(first_part, first_part_len, dest, 0); + case 5: + ean_add_on(first_part, first_part_len, dest, 0); ustrcpy(symbol->text, first_part); if (symbol->output_options & COMPLIANT_HEIGHT) { /* 21.9mm from GS1 General Specifications 5.2.6.6, Figure 5.2.6.6-6 */ @@ -824,18 +831,23 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int src } break; case 7: - case 8: error_number = ean8(symbol, first_part, first_part_len, dest); + case 8: + error_number = ean8(symbol, first_part, first_part_len, dest); break; case 12: - case 13: error_number = ean13(symbol, first_part, first_part_len, dest); + case 13: + error_number = ean13(symbol, first_part, first_part_len, dest); + break; + default: + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 286, + "Input length %d wrong (2, 5, 7, 8, 12 or 13 only)", first_part_len); break; - default: strcpy(symbol->errtxt, "286: Input wrong length (2, 5, 7, 8, 12 or 13 characters only)"); - return ZINT_ERROR_TOO_LONG; } break; case BARCODE_EANX_CC: switch (first_part_len) { /* Adds vertical separator bars according to ISO/IEC 24723 section 11.4 */ - case 7: set_module(symbol, symbol->rows, 1); + case 7: + set_module(symbol, symbol->rows, 1); set_module(symbol, symbol->rows, 67); set_module(symbol, symbol->rows + 1, 0); set_module(symbol, symbol->rows + 1, 68); @@ -848,7 +860,8 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int src error_number = ean8_cc(symbol, first_part, first_part_len, dest, cc_rows); break; case 12: - case 13:set_module(symbol, symbol->rows, 1); + case 13: + set_module(symbol, symbol->rows, 1); set_module(symbol, symbol->rows, 95); set_module(symbol, symbol->rows + 1, 0); set_module(symbol, symbol->rows + 1, 96); @@ -860,8 +873,10 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int src symbol->rows += 3; error_number = ean13_cc(symbol, first_part, first_part_len, dest, cc_rows); break; - default: strcpy(symbol->errtxt, "287: Input wrong length (7, 12 or 13 characters only)"); - return ZINT_ERROR_TOO_LONG; + default: + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 287, "Input length %d wrong (7, 12 or 13 only)", + first_part_len); + break; } break; case BARCODE_UPCA: @@ -869,8 +884,8 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int src if ((first_part_len == 11) || (first_part_len == 12)) { error_number = upca(symbol, first_part, first_part_len, dest); } else { - strcpy(symbol->errtxt, "288: Input wrong length (12 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 288, "Input length %d wrong (11 or 12 only)", + first_part_len); } break; case BARCODE_UPCA_CC: @@ -887,8 +902,8 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int src symbol->rows += 3; error_number = upca_cc(symbol, first_part, first_part_len, dest, cc_rows); } else { - strcpy(symbol->errtxt, "289: Input wrong length (12 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 289, "Input length %d wrong (11 or 12 only)", + first_part_len); } break; case BARCODE_UPCE: @@ -896,8 +911,8 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int src if ((first_part_len >= 6) && (first_part_len <= 8)) { error_number = upce(symbol, first_part, first_part_len, dest); } else { - strcpy(symbol->errtxt, "290: Input wrong length (8 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 290, "Input length %d wrong (6, 7 or 8 only)", + first_part_len); } break; case BARCODE_UPCE_CC: @@ -914,8 +929,8 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int src symbol->rows += 3; error_number = upce_cc(symbol, first_part, first_part_len, dest, cc_rows); } else { - strcpy(symbol->errtxt, "291: Input wrong length (8 character maximum)"); - return ZINT_ERROR_TOO_LONG; + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 291, "Input length %d wrong (6, 7 or 8 only)", + first_part_len); } break; case BARCODE_ISBNX: @@ -930,27 +945,15 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int src second_part_len = (int) ustrlen(second_part); if (symbol->symbology == BARCODE_ISBNX) { /* Need to further check that add-on numeric only */ - if (!is_sane(NEON_F, second_part, second_part_len)) { - strcpy(symbol->errtxt, "295: Invalid add-on data (digits only)"); - return ZINT_ERROR_INVALID_DATA; + if (not_sane(NEON_F, second_part, second_part_len)) { + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 295, "Invalid add-on data (digits only)"); } } - switch (second_part_len) { - case 0: break; - case 2: - ean_add_on(second_part, second_part_len, dest, addon_gap); - ustrcat(symbol->text, "+"); - ustrcat(symbol->text, second_part); - break; - case 5: - ean_add_on(second_part, second_part_len, dest, addon_gap); - ustrcat(symbol->text, "+"); - ustrcat(symbol->text, second_part); - break; - default: - strcpy(symbol->errtxt, "292: Add-on data wrong length (2 or 5 characters only)"); - return ZINT_ERROR_TOO_LONG; + if (second_part_len) { + ean_add_on(second_part, second_part_len, dest, addon_gap); + ustrcat(symbol->text, "+"); + ustrcat(symbol->text, second_part); } expand(symbol, dest, (int) strlen(dest)); @@ -976,8 +979,8 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int src } /* Handle UPC, EAN, ISBN */ -INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) { - return eanx_cc(symbol, source, src_len, 0 /*cc_rows*/); +INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int length) { + return eanx_cc(symbol, source, length, 0 /*cc_rows*/); } /* vim: set ts=4 sw=4 et : */ diff --git a/backend/vector.c b/backend/vector.c index 2ac51cf2..eb5f7d74 100644 --- a/backend/vector.c +++ b/backend/vector.c @@ -43,7 +43,9 @@ static int vector_add_rect(struct zint_symbol *symbol, const float x, const floa struct zint_vector_rect *rect; if (!(rect = (struct zint_vector_rect *) malloc(sizeof(struct zint_vector_rect)))) { - strcpy(symbol->errtxt, "691: Insufficient memory for vector rectangle"); + /* NOTE: clang-tidy-20 gets confused about return value of function returning a function unfortunately, + so put on 2 lines (see also "postal.c" `postnet_enc()` & `planet_enc()`, same issue) */ + errtxt(0, symbol, 691, "Insufficient memory for vector rectangle"); return 0; } @@ -69,8 +71,7 @@ static int vector_add_hexagon(struct zint_symbol *symbol, const float x, const f struct zint_vector_hexagon *hexagon; if (!(hexagon = (struct zint_vector_hexagon *) malloc(sizeof(struct zint_vector_hexagon)))) { - strcpy(symbol->errtxt, "692: Insufficient memory for vector hexagon"); - return 0; + return errtxt(0, symbol, 692, "Insufficient memory for vector hexagon"); } hexagon->next = NULL; hexagon->x = x; @@ -93,8 +94,7 @@ static int vector_add_circle(struct zint_symbol *symbol, const float x, const fl struct zint_vector_circle *circle; if (!(circle = (struct zint_vector_circle *) malloc(sizeof(struct zint_vector_circle)))) { - strcpy(symbol->errtxt, "693: Insufficient memory for vector circle"); - return 0; + return errtxt(0, symbol, 693, "Insufficient memory for vector circle"); } circle->next = NULL; circle->x = x; @@ -119,8 +119,7 @@ static int vector_add_string(struct zint_symbol *symbol, const unsigned char *te struct zint_vector_string *string; if (!(string = (struct zint_vector_string *) malloc(sizeof(struct zint_vector_string)))) { - strcpy(symbol->errtxt, "694: Insufficient memory for vector string"); - return 0; + return errtxt(0, symbol, 694, "Insufficient memory for vector string"); } string->next = NULL; string->x = x; @@ -132,8 +131,7 @@ static int vector_add_string(struct zint_symbol *symbol, const unsigned char *te string->halign = halign; if (!(string->text = (unsigned char *) malloc(string->length + 1))) { free(string); - strcpy(symbol->errtxt, "695: Insufficient memory for vector string text"); - return 0; + return errtxt(0, symbol, 695, "Insufficient memory for vector string text"); } memcpy(string->text, text, string->length); string->text[string->length] = '\0'; @@ -439,14 +437,12 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ return error_number; } if (symbol->rows <= 0) { - strcpy(symbol->errtxt, "697: No rows"); - return ZINT_ERROR_INVALID_OPTION; + return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 697, "No rows"); } /* Allocate memory */ if (!(vector = symbol->vector = (struct zint_vector *) malloc(sizeof(struct zint_vector)))) { - strcpy(symbol->errtxt, "696: Insufficient memory for vector header"); - return ZINT_ERROR_MEMORY; + return errtxt(ZINT_ERROR_MEMORY, symbol, 696, "Insufficient memory for vector header"); } vector->rectangles = NULL; vector->hexagons = NULL; diff --git a/backend_qt/tests/test_qzint.cpp b/backend_qt/tests/test_qzint.cpp index b1766c16..88e51bb3 100644 --- a/backend_qt/tests/test_qzint.cpp +++ b/backend_qt/tests/test_qzint.cpp @@ -437,7 +437,7 @@ private slots: QTest::newRow("BARCODE_QRCODE") << BARCODE_QRCODE << "1234" << 0.0f << 0 << "" << 21 << 21 << 21.0f << 42.0f << 42.0f; QTest::newRow("BARCODE_QRCODE Scale 1.5") << BARCODE_QRCODE << "1234" << 1.5f << 0 << "" << 21 << 21 << 21.0f << 63.0f << 63.0f; if (!m_skipIfFontUsed) { - QTest::newRow("BARCODE_QRCODE no text") << BARCODE_QRCODE << "" << 0.0f << ZINT_ERROR_INVALID_DATA << "Error 778: No input data (segment 0 empty)" << 0 << 0 << 0.0f << 0.0f << 0.0f; + QTest::newRow("BARCODE_QRCODE no text") << BARCODE_QRCODE << "" << 0.0f << ZINT_ERROR_INVALID_DATA << "Error 228: No input data (segment 0 empty)" << 0 << 0 << 0.0f << 0.0f << 0.0f; } QTest::newRow("BARCODE_MAXICODE") << BARCODE_MAXICODE << "1234" << 0.0f << 0 << "" << 30 << 33 << 28.578f << 60.0f << 57.7334f; QTest::newRow("BARCODE_MAXICODE Scale 2") << BARCODE_MAXICODE << "1234" << 2.0f << 0 << "" << 30 << 33 << 28.578f << 120.0f << 115.467f; diff --git a/docs/README b/docs/README index e1bdce41..aafad60b 100644 --- a/docs/README +++ b/docs/README @@ -1,13 +1,20 @@ -% docs/README 2024-09-29 +% docs/README 2024-10-27 For generation of "docs/manual.pdf" and "docs/manual.txt" from "manual.pmd" using a recent version of pandoc -On Ubuntu/Debian (tested on Ubuntu 22.04) +On Ubuntu/Debian (tested on Ubuntu 22.04 and Ubuntu 24.04) - wget https://github.com/jgm/pandoc/releases/download/3.4/pandoc-3.4-1-amd64.deb - sudo dpkg -i pandoc-3.4-1-amd64.deb + wget https://github.com/jgm/pandoc/releases/download/3.5/pandoc-3.5-1-amd64.deb + sudo dpkg -i pandoc-3.5-1-amd64.deb +For Ubuntu 22.04 (python < 3.12) sudo apt install python3-pip pip install pandoc-tablenos --user +Else for Ubuntu 24.04 (one way around "externally-managed-environment" error, PEP 668) + sudo apt install python3-full + python3 -m venv ~/py_envs + source ~/py_envs/bin/activate + pip install pandoc-tablenos +Then export PATH=~/.local/bin:"$PATH" # Temporary fix for version regex - see https://github.com/tomduck/pandoc-xnos/pull/29 python -m pip install --force-reinstall \ @@ -18,11 +25,11 @@ On Ubuntu/Debian (tested on Ubuntu 22.04) sudo apt install fonts-wqy-microhei make -On Fedora (tested on Fedora Linux 38 (Workstation Edition)) +On Fedora (tested on Fedora Linux 38 (Workstation Edition) and Fedora Linux 40 (Workstation Edition)) - wget https://github.com/jgm/pandoc/releases/download/3.4/pandoc-3.4-linux-amd64.tar.gz - tar xf pandoc-3.4-linux-amd64.tar.gz - sudo mv -i pandoc-3.4/bin/pandoc /usr/local/bin + wget https://github.com/jgm/pandoc/releases/download/3.5/pandoc-3.5-linux-amd64.tar.gz + tar xf pandoc-3.5-linux-amd64.tar.gz + sudo mv -i pandoc-3.5/bin/pandoc /usr/local/bin sudo dnf install python3-pip pip install pandoc-tablenos --user export PATH=~/.local/bin:"$PATH" diff --git a/docs/manual.html b/docs/manual.html index 34479412..17669edd 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -332,7 +332,7 @@

Zint Barcode Generator and Zint Barcode Studio User Manual

Version 2.13.0.9

-

September 2024

+

October 2024