diff --git a/ChangeLog b/ChangeLog index 73d60fe9..51f61dbd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,8 @@ Version 2.10.0.9 (dev) not released yet NOTE: may cause single-pixel changes to height depending on height/scale used - JAPANPOST: return error if input data would be truncated NOTE: previously was silently truncated +- PDF417: return warning if specified cols increased + NOTE: previously no warning was returned Changes ------- @@ -35,6 +37,7 @@ Changes - CODABAR: add show check digit option - DAFT: max chars 50 -> 100 - CMake: separate no-optimize from ZINT_DEBUG into new ZINT_NOOPT option +- PDF417: add specify rows option Bugs ---- @@ -52,6 +55,7 @@ Bugs - raster.c: Don't add height offset for text if scale < 1.0 (as won't print) - ISBNX: fix not returning error number (warning) correctly - *.rc: fix VER_FILEVERSION_STR format (, -> .), props Jeff Skaistis +- PDF417: fix cols/rows calculation to require multiple <= 928 codewords Version 2.10.0 2021-08-14 diff --git a/backend/aztec.c b/backend/aztec.c index 7161864f..6729b2fb 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -830,9 +830,10 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt unsigned char desc_data[4], desc_ecc[6]; int error_number, compact, data_length, data_maxsize, codeword_size, adjusted_length; int remainder, padbits, count, gs1, adjustment_size; - int debug_print = (symbol->debug & ZINT_DEBUG_PRINT), reader = 0; + int reader = 0; int comp_loop = 4; int bp = 0; + const int debug_print = (symbol->debug & ZINT_DEBUG_PRINT); rs_t rs; rs_uint_t rs_uint; @@ -1451,7 +1452,7 @@ INTERNAL int azrune(struct zint_symbol *symbol, unsigned char source[], int leng char binary_string[28]; unsigned char data_codewords[3], ecc_codewords[6]; int bp = 0; - int debug_print = symbol->debug & ZINT_DEBUG_PRINT; + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; rs_t rs; input_value = 0; diff --git a/backend/code.c b/backend/code.c index 26157419..4bee0b73 100644 --- a/backend/code.c +++ b/backend/code.c @@ -138,7 +138,7 @@ INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int leng char *d = dest; int num_check_digits; char checkstr[3] = {0}; - static char checkchrs[11] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-' }; + static const char checkchrs[11] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-' }; /* Suppresses clang-tidy clang-analyzer-core.UndefinedBinaryOperatorResult warning */ assert(length > 0); @@ -701,7 +701,7 @@ nb0: if (++B[0] <= bmax[0]) goto lb0; /* Channel Code - According to ANSI/AIM BC12-1998 */ INTERNAL int channel(struct zint_symbol *symbol, unsigned char source[], int length) { - static int max_ranges[] = { -1, -1, -1, 26, 292, 3493, 44072, 576688, 7742862 }; + 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; char dest[30]; @@ -799,9 +799,9 @@ INTERNAL int vin(struct zint_symbol *symbol, unsigned char source[], int length) char *d = dest; char input_check; char output_check; - int weight[17] = {8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2}; int sum; int i; + static const int weight[17] = {8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2}; // Check length if (length != 17) { @@ -811,7 +811,8 @@ INTERNAL int vin(struct zint_symbol *symbol, unsigned char source[], int 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\")"); + strcpy(symbol->errtxt, + "337: Invalid character in data (alphanumerics only, excluding \"I\", \"O\" and \"Q\")"); return ZINT_ERROR_INVALID_DATA; } diff --git a/backend/code1.c b/backend/code1.c index 0bf3882b..6e36c067 100644 --- a/backend/code1.c +++ b/backend/code1.c @@ -483,8 +483,8 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigne char decimal_binary[24]; /* C1_DECIMAL buffer */ int db_p = 0; int byte_start = 0; - int debug_print = symbol->debug & ZINT_DEBUG_PRINT; - int eci_length = length + 7 + chr_cnt(source, length, '\\'); + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; + const int eci_length = length + 7 + chr_cnt(source, length, '\\'); #ifndef _MSC_VER unsigned char eci_buf[eci_length + 1]; int num_digits[eci_length + 1]; @@ -965,6 +965,7 @@ INTERNAL int codeone(struct zint_symbol *symbol, unsigned char source[], int len int sub_version = 0; rs_t rs; int error_number = 0; + 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"); @@ -1028,7 +1029,7 @@ INTERNAL int codeone(struct zint_symbol *symbol, unsigned char source[], int len block_width = 6; } - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Subversion: %d\n", sub_version); } @@ -1045,7 +1046,7 @@ INTERNAL int codeone(struct zint_symbol *symbol, unsigned char source[], int len data[i + codewords] = ecc[codewords - i - 1]; } - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Codewords (%d): ", codewords); for (i = 0; i < codewords * 2; i++) printf(" %d", (int) data[i]); printf("\n"); @@ -1109,7 +1110,7 @@ INTERNAL int codeone(struct zint_symbol *symbol, unsigned char source[], int len block_width = 12; } - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Padding: %d, Subversion: %d\n", data_cw - data_length, sub_version); } @@ -1133,7 +1134,7 @@ INTERNAL int codeone(struct zint_symbol *symbol, unsigned char source[], int len data[data_cw + i] = ecc[ecc_cw - i - 1]; } - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Codewords (%d):", data_cw + ecc_cw); for (i = 0; i < data_cw + ecc_cw; i++) printf(" %d", (int) data[i]); printf("\n"); @@ -1195,13 +1196,13 @@ INTERNAL int codeone(struct zint_symbol *symbol, unsigned char source[], int len if (last_mode != C1_ASCII && last_mode != C1_BYTE) { data[data_length++] = 255; /* Unlatch */ } - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Padding: %d\n", data_cw - data_length); } for (i = data_length; i < data_cw; i++) { data[i] = 129; /* Pad */ } - } else if (symbol->debug & ZINT_DEBUG_PRINT) { + } else if (debug_print) { printf("No padding\n"); } @@ -1223,7 +1224,7 @@ INTERNAL int codeone(struct zint_symbol *symbol, unsigned char source[], int len } } - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Codewords (%d):", data_cw + ecc_length); for (i = 0; i < data_cw + ecc_length; i++) printf(" %d", (int) data[i]); printf("\n"); @@ -1248,7 +1249,7 @@ INTERNAL int codeone(struct zint_symbol *symbol, unsigned char source[], int len symbol->width = c1_width[size - 1]; } - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Version: %d\n", size); } diff --git a/backend/code49.c b/backend/code49.c index 64bcf80c..506a0c34 100644 --- a/backend/code49.c +++ b/backend/code49.c @@ -48,7 +48,7 @@ INTERNAL int code49(struct zint_symbol *symbol, unsigned char source[], int leng int w_grid[8][4]; /* Refets to table 2 */ int pad_count = 0; char pattern[80]; - int bp; + int bp = 0; /* Initialize to suppress gcc -Wmaybe-uninitialized warning */ int gs1; int h; int error_number = 0; diff --git a/backend/common.c b/backend/common.c index 7b4bbf8d..6ef09dda 100644 --- a/backend/common.c +++ b/backend/common.c @@ -100,7 +100,7 @@ INTERNAL int chr_cnt(const unsigned char string[], const int length, const unsig /* Verifies that a string only uses valid characters */ INTERNAL int is_sane(const unsigned int flg, const unsigned char source[], const int length) { #define IS_CLS_F (IS_CLI_F | IS_SIL_F) - static unsigned short flgs[256] = { + 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*/ IS_SPC_F, IS_C82_F, IS_C82_F, IS_HSH_F, /*20-23*/ /* !"# */ IS_CLS_F, IS_SIL_F | IS_C82_F, IS_C82_F, IS_C82_F, /*24-27*/ /* $%&' */ @@ -221,7 +221,7 @@ INTERNAL void expand(struct zint_symbol *symbol, const char data[], const int le int reader; int writer, i; int latch, num; - int row = symbol->rows; + const int row = symbol->rows; symbol->rows++; @@ -344,7 +344,7 @@ INTERNAL unsigned int decode_utf8(unsigned int *state, unsigned int *codep, cons 12,36,12,12,12,12,12,12,12,12,12,12, }; - unsigned int type = utf8d[byte]; + const unsigned int type = utf8d[byte]; *codep = *state != 0 ? (byte & 0x3fu) | (*codep << 6) : (0xff >> type) & byte; @@ -410,7 +410,7 @@ INTERNAL int set_height(struct zint_symbol *symbol, const float min_row_height, int zero_count = 0; float row_height; int i; - int rows = symbol->rows ? symbol->rows : 1; /* Sometimes called before expand() */ + const int rows = symbol->rows ? symbol->rows : 1; /* Sometimes called before expand() */ for (i = 0; i < rows; i++) { if (symbol->row_height[i]) { diff --git a/backend/composite.c b/backend/composite.c index 980b9d2f..394f9fb7 100644 --- a/backend/composite.c +++ b/backend/composite.c @@ -94,7 +94,7 @@ static int getBit(const UINT *bitStr, const int bitPos) { static int encode928(const UINT bitString[], UINT codeWords[], const int bitLng) { int i, j, b, cwNdx, cwLng; for (cwNdx = cwLng = b = 0; b < bitLng; b += 69, cwNdx += 7) { - int bitCnt = _min(bitLng - b, 69); + const int bitCnt = _min(bitLng - b, 69); int cwCnt; cwLng += cwCnt = bitCnt / 10 + 1; for (i = 0; i < cwCnt; i++) @@ -125,13 +125,14 @@ static void cc_a(struct zint_symbol *symbol, const char source[], const int cc_w UINT bitStr[13] = {0}; char pattern[580]; int bp = 0; + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; variant = 0; bitlen = (int) strlen(source); for (segment = 0; segment < 13; segment++) { - int strpos = segment * 16; + const int strpos = segment * 16; if (strpos >= bitlen) { break; } @@ -239,19 +240,19 @@ static void cc_a(struct zint_symbol *symbol, const char source[], const int cc_w k = i * cc_width; /* Copy the data into codebarre */ if (cc_width != 3) { - bp = bin_append_posn(rap_side[LeftRAP - 1], 10, pattern, bp); + bp = bin_append_posn(pdf_rap_side[LeftRAP - 1], 10, pattern, bp); } bp = bin_append_posn(pdf_bitpattern[offset + codeWords[k]], 16, pattern, bp); pattern[bp++] = '0'; if (cc_width >= 2) { if (cc_width == 3) { - bp = bin_append_posn(rap_centre[CentreRAP - 1], 10, pattern, bp); + bp = bin_append_posn(pdf_rap_centre[CentreRAP - 1], 10, pattern, bp); } bp = bin_append_posn(pdf_bitpattern[offset + codeWords[k + 1]], 16, pattern, bp); pattern[bp++] = '0'; if (cc_width >= 3) { if (cc_width == 4) { - bp = bin_append_posn(rap_centre[CentreRAP - 1], 10, pattern, bp); + bp = bin_append_posn(pdf_rap_centre[CentreRAP - 1], 10, pattern, bp); } bp = bin_append_posn(pdf_bitpattern[offset + codeWords[k + 2]], 16, pattern, bp); pattern[bp++] = '0'; @@ -261,7 +262,7 @@ static void cc_a(struct zint_symbol *symbol, const char source[], const int cc_w } } } - bp = bin_append_posn(rap_side[RightRAP - 1], 10, pattern, bp); + bp = bin_append_posn(pdf_rap_side[RightRAP - 1], 10, pattern, bp); pattern[bp++] = '1'; /* stop */ /* so now pattern[] holds the string of '1's and '0's. - copy this to the symbol */ @@ -294,14 +295,14 @@ static void cc_a(struct zint_symbol *symbol, const char source[], const int cc_w } symbol->width = bp; - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("CC-A Columns: %d, Rows: %d, Variant: %d, CodeWords: %d\n", cc_width, symbol->rows, variant, cwCnt); } } /* CC-B 2D component */ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_width) { - int length = (int) strlen(source) / 8; + const int length = (int) strlen(source) / 8; int i; #ifndef _MSC_VER unsigned char data_string[length + 3]; @@ -316,9 +317,10 @@ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_w int LeftRAP, CentreRAP, RightRAP, Cluster, loop; int columns; int bp = 0; + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; for (i = 0; i < length; i++) { - int binloc = i * 8; + const int binloc = i * 8; data_string[i] = 0; for (p = 0; p < 8; p++) { @@ -334,7 +336,7 @@ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_w chainemc[mclength] = 920; mclength++; - byteprocess(chainemc, &mclength, data_string, 0, length, symbol->debug & ZINT_DEBUG_PRINT); + pdf_byteprocess(chainemc, &mclength, data_string, 0, length, debug_print); /* Now figure out which variant of the symbol to use and load values accordingly */ @@ -407,12 +409,12 @@ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_w /* Now we have the variant we can load the data - from here on the same as MicroPDF417 code */ variant--; assert(variant >= 0); - columns = MicroVariants[variant]; /* columns */ - symbol->rows = MicroVariants[variant + 34]; /* rows */ - k = MicroVariants[variant + 68]; /* number of EC CWs */ + columns = pdf_MicroVariants[variant]; /* columns */ + symbol->rows = pdf_MicroVariants[variant + 34]; /* rows */ + k = pdf_MicroVariants[variant + 68]; /* number of EC CWs */ longueur = (columns * symbol->rows) - k; /* number of non-EC CWs */ i = longueur - mclength; /* amount of padding required */ - offset = MicroVariants[variant + 102]; /* coefficient offset */ + offset = pdf_MicroVariants[variant + 102]; /* coefficient offset */ /* Binary input padded to target length so no padding should be necessary */ while (i > 0) { @@ -427,9 +429,9 @@ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_w total = (chainemc[i] + mccorrection[k - 1]) % 929; for (j = k - 1; j >= 0; j--) { if (j == 0) { - mccorrection[j] = (929 - (total * Microcoeffs[offset + j]) % 929) % 929; + mccorrection[j] = (929 - (total * pdf_Microcoeffs[offset + j]) % 929) % 929; } else { - mccorrection[j] = (mccorrection[j - 1] + 929 - (total * Microcoeffs[offset + j]) % 929) % 929; + mccorrection[j] = (mccorrection[j - 1] + 929 - (total * pdf_Microcoeffs[offset + j]) % 929) % 929; } } } @@ -446,10 +448,10 @@ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_w } /* Now get the RAP (Row Address Pattern) start values */ - LeftRAPStart = RAPTable[variant]; - CentreRAPStart = RAPTable[variant + 34]; - RightRAPStart = RAPTable[variant + 68]; - StartCluster = RAPTable[variant + 102] / 3; + LeftRAPStart = pdf_RAPTable[variant]; + CentreRAPStart = pdf_RAPTable[variant + 34]; + RightRAPStart = pdf_RAPTable[variant + 68]; + StartCluster = pdf_RAPTable[variant + 102] / 3; /* That's all values loaded, get on with the encoding */ @@ -464,18 +466,18 @@ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_w offset = 929 * Cluster; k = i * columns; /* Copy the data into codebarre */ - bp = bin_append_posn(rap_side[LeftRAP - 1], 10, pattern, bp); + bp = bin_append_posn(pdf_rap_side[LeftRAP - 1], 10, pattern, bp); bp = bin_append_posn(pdf_bitpattern[offset + chainemc[k]], 16, pattern, bp); pattern[bp++] = '0'; if (cc_width >= 2) { if (cc_width == 3) { - bp = bin_append_posn(rap_centre[CentreRAP - 1], 10, pattern, bp); + bp = bin_append_posn(pdf_rap_centre[CentreRAP - 1], 10, pattern, bp); } bp = bin_append_posn(pdf_bitpattern[offset + chainemc[k + 1]], 16, pattern, bp); pattern[bp++] = '0'; if (cc_width >= 3) { if (cc_width == 4) { - bp = bin_append_posn(rap_centre[CentreRAP - 1], 10, pattern, bp); + bp = bin_append_posn(pdf_rap_centre[CentreRAP - 1], 10, pattern, bp); } bp = bin_append_posn(pdf_bitpattern[offset + chainemc[k + 2]], 16, pattern, bp); pattern[bp++] = '0'; @@ -485,7 +487,7 @@ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_w } } } - bp = bin_append_posn(rap_side[RightRAP - 1], 10, pattern, bp); + bp = bin_append_posn(pdf_rap_side[RightRAP - 1], 10, pattern, bp); pattern[bp++] = '1'; /* stop */ /* so now pattern[] holds the string of '1's and '0's. - copy this to the symbol */ @@ -517,7 +519,7 @@ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_w } symbol->width = bp; - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("CC-B Columns: %d, Rows: %d, Variant: %d, CodeWords: %d\n", cc_width, symbol->rows, variant + 1, mclength); } @@ -525,7 +527,7 @@ static void cc_b(struct zint_symbol *symbol, const char source[], const int cc_w /* CC-C 2D component - byte compressed PDF417 */ static void cc_c(struct zint_symbol *symbol, const char source[], const int cc_width, const int ecc_level) { - int length = (int) strlen(source) / 8; + const int length = (int) strlen(source) / 8; int i, p; #ifndef _MSC_VER unsigned char data_string[length + 4]; @@ -537,9 +539,10 @@ static void cc_c(struct zint_symbol *symbol, const char source[], const int cc_w int c1, c2, c3, dummy[35]; char pattern[580]; int bp = 0; + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; for (i = 0; i < length; i++) { - int binloc = i * 8; + const int binloc = i * 8; data_string[i] = 0; for (p = 0; p < 8; p++) { @@ -556,11 +559,11 @@ static void cc_c(struct zint_symbol *symbol, const char source[], const int cc_w chainemc[mclength] = 920; /* CC-C identifier */ mclength++; - byteprocess(chainemc, &mclength, data_string, 0, length, symbol->debug & ZINT_DEBUG_PRINT); + pdf_byteprocess(chainemc, &mclength, data_string, 0, length, debug_print); chainemc[0] = mclength; - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("CC-C Codewords (%d):", mclength); for (i = 0; i < mclength; i++) printf(" %d", chainemc[i]); printf("\n"); @@ -598,9 +601,9 @@ static void cc_c(struct zint_symbol *symbol, const char source[], const int cc_w total = (chainemc[i] + mccorrection[k - 1]) % 929; for (j = k - 1; j >= 0; j--) { if (j == 0) { - mccorrection[j] = (929 - (total * coefrs[offset + j]) % 929) % 929; + mccorrection[j] = (929 - (total * pdf_coefrs[offset + j]) % 929) % 929; } else { - mccorrection[j] = (mccorrection[j - 1] + 929 - (total * coefrs[offset + j]) % 929) % 929; + mccorrection[j] = (mccorrection[j - 1] + 929 - (total * pdf_coefrs[offset + j]) % 929) % 929; } } } @@ -663,7 +666,7 @@ static void cc_c(struct zint_symbol *symbol, const char source[], const int cc_w } symbol->width = bp; - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("CC-C Columns: %d, Rows: %d, CodeWords: %d, ECC Level: %d\n", cc_width, symbol->rows, mclength, ecc_level); } @@ -876,7 +879,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour #endif int target_bitsize; int bp = 0; - int debug = symbol->debug & ZINT_DEBUG_PRINT; + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; encoding_method = 1; read_posn = 0; @@ -900,7 +903,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour if (encoding_method == 1) { binary_string[bp++] = '0'; - if (debug) printf("CC-%c Encodation Method: 0\n", 'A' + (cc_mode - 1)); + if (debug_print) printf("CC-%c Encodation Method: 0\n", 'A' + (cc_mode - 1)); } else if (encoding_method == 2) { /* Encoding Method field "10" - date and lot number */ @@ -942,7 +945,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour } } - if (debug) { + if (debug_print) { printf("CC-%c Encodation Method: 10, Compaction Field: %.*s\n", 'A' + (cc_mode - 1), read_posn, source); } @@ -1121,7 +1124,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour alpha_pad = 1; /* This is overwritten if a general field is encoded */ } - if (debug) { + if (debug_print) { printf("CC-%c Encodation Method: 11, Compaction Field: %.*s, Binary: %.*s (%d)\n", 'A' + (cc_mode - 1), read_posn, source, bp, binary_string, bp); } @@ -1129,7 +1132,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour /* Use general field encodation instead */ binary_string[bp++] = '0'; read_posn = 0; - if (debug) printf("CC-%c Encodation Method: 0\n", 'A' + (cc_mode - 1)); + if (debug_print) printf("CC-%c Encodation Method: 0\n", 'A' + (cc_mode - 1)); } } @@ -1155,7 +1158,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour } general_field[j] = '\0'; - if (debug) { + if (debug_print) { printf("Mode %s, General Field: %.40s%s\n", mode == NUMERIC ? "NUMERIC" : mode == ALPHANUMERIC ? "ALPHANUMERIC" : "ISO646", general_field, j > 40 ? "..." : ""); @@ -1242,7 +1245,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour } binary_string[target_bitsize] = '\0'; - if (debug) { + if (debug_print) { printf("ECC: %d, CC width %d\n", *ecc, *cc_width); printf("Binary: %s (%d)\n", binary_string, target_bitsize); } @@ -1277,7 +1280,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l int error_number, warn_number = 0, 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 */ - unsigned int bs = 13 * length + 1000 + 1; + const unsigned int bs = 13 * length + 1000 + 1; #ifndef _MSC_VER char binary_string[bs]; #else @@ -1287,8 +1290,9 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l struct zint_symbol *linear; int top_shift, bottom_shift; int linear_width = 0; + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; - if (symbol->debug & ZINT_DEBUG_PRINT) printf("Reduced length: %d\n", length); + if (debug_print) printf("Reduced length: %d\n", length); /* Perform sanity checks on input options first */ error_number = 0; @@ -1320,7 +1324,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l } return ZINT_ERROR_INVALID_DATA; } - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("GS1-128 linear width: %d\n", linear_width); } } @@ -1525,8 +1529,8 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l alignment, number the positions from right to left (0 is the Stop character, 1 is the Check character, etc.), and then Position = (total number of Code 128 symbol characters – 9) div 2" */ - int num_symbols = (linear_width - 2) / 11; - int position = (num_symbols - 9) / 2; + const int num_symbols = (linear_width - 2) / 11; + const int position = (num_symbols - 9) / 2; /* Less 1 to align with last space module */ int calc_shift = linear->width - position * 11 - 1 - symbol->width; if (position) { @@ -1570,7 +1574,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l break; } - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Top shift: %d, Bottom shift: %d\n", top_shift, bottom_shift); } diff --git a/backend/dmatrix.c b/backend/dmatrix.c index 927cbb10..4d8831d2 100644 --- a/backend/dmatrix.c +++ b/backend/dmatrix.c @@ -290,7 +290,7 @@ static int p_r_6_2_1(const unsigned char inputData[], const int position, const /* 'look ahead test' from Annex P */ static int look_ahead_test(const unsigned char inputData[], const int sourcelen, const int position, - const int current_mode, const int gs1, const int debug) { + const int current_mode, const int gs1, const int debug_print) { int ascii_count, c40_count, text_count, x12_count, edf_count, b256_count; int ascii_rnded, c40_rnded, text_rnded, x12_rnded, edf_rnded, b256_rnded; int cnt_1; @@ -397,7 +397,7 @@ static int look_ahead_test(const unsigned char inputData[], const int sourcelen, /* At least 5 data characters processed ... step (r) */ /* NOTE: different than spec, where it's at least 4. Following previous behaviour here (and BWIPP) */ - if (debug) { + if (debug_print) { printf("\n(%d, %d, %d): ascii_count %d, b256_count %d, edf_count %d, text_count %d" ", x12_count %d, c40_count %d ", current_mode, position, sp, ascii_count, b256_count, edf_count, text_count, @@ -452,7 +452,7 @@ static int look_ahead_test(const unsigned char inputData[], const int sourcelen, text_rnded = DM_MULT_CEIL(text_count); x12_rnded = DM_MULT_CEIL(x12_count); c40_rnded = DM_MULT_CEIL(c40_count); - if (debug) { + if (debug_print) { printf("\nEOD(%d, %d): ascii_rnded %d, b256_rnded %d, edf_rnded %d, text_rnded %d, x12_rnded %d (%d)" ", c40_rnded %d (%d) ", current_mode, position, ascii_rnded, b256_rnded, edf_rnded, text_rnded, x12_rnded, x12_count, @@ -487,7 +487,7 @@ static int look_ahead_test(const unsigned char inputData[], const int sourcelen, /* Copy C40/TEXT/X12 triplets from buffer to target. Returns elements left in buffer (< 3) */ static int ctx_process_buffer_transfer(int process_buffer[8], int process_p, unsigned char target[], int *p_tp, - int debug) { + const int debug_print) { int i, process_e; int tp = *p_tp; @@ -497,7 +497,7 @@ static int ctx_process_buffer_transfer(int process_buffer[8], int process_p, uns int iv = (1600 * process_buffer[i]) + (40 * process_buffer[i + 1]) + (process_buffer[i + 2]) + 1; target[tp++] = (unsigned char) (iv >> 8); target[tp++] = (unsigned char) (iv & 0xFF); - if (debug) { + if (debug_print) { printf("[%d %d %d (%d %d)] ", process_buffer[i], process_buffer[i + 1], process_buffer[i + 2], target[tp - 2], target[tp - 1]); } @@ -516,7 +516,7 @@ static int ctx_process_buffer_transfer(int process_buffer[8], int process_p, uns /* Copy EDIFACT quadruplets from buffer to target. Returns elements left in buffer (< 4) */ static int edi_process_buffer_transfer(int process_buffer[8], int process_p, unsigned char target[], int *p_tp, - int debug) { + const int debug_print) { int i, process_e; int tp = *p_tp; @@ -526,7 +526,7 @@ static int edi_process_buffer_transfer(int process_buffer[8], int process_p, uns target[tp++] = (unsigned char) (process_buffer[i] << 2 | (process_buffer[i + 1] & 0x30) >> 4); target[tp++] = (unsigned char) ((process_buffer[i + 1] & 0x0f) << 4 | (process_buffer[i + 2] & 0x3c) >> 2); target[tp++] = (unsigned char) ((process_buffer[i + 2] & 0x03) << 6 | process_buffer[i + 3]); - if (debug) { + if (debug_print) { printf("[%d %d %d %d (%d %d %d)] ", process_buffer[i], process_buffer[i + 1], process_buffer[i + 2], process_buffer[i + 3], target[tp - 3], target[tp - 2], target[tp - 1]); } @@ -627,7 +627,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], int process_p = 0; /* number of characters left to finalise */ int b256_start = 0; int symbols_left; - int debug = symbol->debug & ZINT_DEBUG_PRINT; + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; sp = 0; tp = 0; @@ -700,9 +700,8 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], } if (gs1) { - target[tp] = 232; - tp++; - if (debug) printf("FN1 "); + target[tp++] = 232; + if (debug_print) printf("FN1 "); } /* FNC1 */ if (symbol->output_options & READER_INIT) { @@ -714,32 +713,24 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], strcpy(symbol->errtxt, "727: Cannot have Structured Append and Reader Initialisation at the same time"); return ZINT_ERROR_INVALID_OPTION; } - target[tp] = 234; - tp++; /* Reader Programming */ - if (debug) printf("RP "); + target[tp++] = 234; /* Reader Programming */ + if (debug_print) printf("RP "); } if (symbol->eci > 0) { /* Encode ECI numbers according to Table 6 */ - target[tp] = 241; /* ECI Character */ - tp++; + target[tp++] = 241; /* ECI Character */ if (symbol->eci <= 126) { - target[tp] = (unsigned char) (symbol->eci + 1); - tp++; + target[tp++] = (unsigned char) (symbol->eci + 1); } else if (symbol->eci <= 16382) { - target[tp] = (unsigned char) ((symbol->eci - 127) / 254 + 128); - tp++; - target[tp] = (unsigned char) ((symbol->eci - 127) % 254 + 1); - tp++; + target[tp++] = (unsigned char) ((symbol->eci - 127) / 254 + 128); + target[tp++] = (unsigned char) ((symbol->eci - 127) % 254 + 1); } else { - target[tp] = (unsigned char) ((symbol->eci - 16383) / 64516 + 192); - tp++; - target[tp] = (unsigned char) (((symbol->eci - 16383) / 254) % 254 + 1); - tp++; - target[tp] = (unsigned char) ((symbol->eci - 16383) % 254 + 1); - tp++; + target[tp++] = (unsigned char) ((symbol->eci - 16383) / 64516 + 192); + target[tp++] = (unsigned char) (((symbol->eci - 16383) / 254) % 254 + 1); + target[tp++] = (unsigned char) ((symbol->eci - 16383) % 254 + 1); } - if (debug) printf("ECI %d ", symbol->eci + 1); + if (debug_print) printf("ECI %d ", symbol->eci + 1); } /* Check for Macro05/Macro06 */ @@ -754,13 +745,12 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], /* Output macro Codeword */ if (source[5] == '5') { - target[tp] = 236; - if (debug) printf("Macro05 "); + target[tp++] = 236; + if (debug_print) printf("Macro05 "); } else { - target[tp] = 237; - if (debug) printf("Macro06 "); + target[tp++] = 237; + if (debug_print) printf("Macro06 "); } - tp++; /* Remove macro characters from input string */ sp = 7; inputlen -= 2; @@ -780,59 +770,50 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], next_mode = DM_ASCII; if (is_twodigits(source, inputlen, sp)) { - target[tp] = (unsigned char) ((10 * ctoi(source[sp])) + ctoi(source[sp + 1]) + 130); - if (debug) printf("N%02d ", target[tp] - 130); - tp++; + target[tp++] = (unsigned char) ((10 * ctoi(source[sp])) + ctoi(source[sp + 1]) + 130); + if (debug_print) printf("N%02d ", target[tp - 1] - 130); sp += 2; } else { - next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1, debug); + next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1, debug_print); if (next_mode != DM_ASCII) { switch (next_mode) { - case DM_C40: target[tp] = 230; - tp++; - if (debug) printf("C40 "); + case DM_C40: target[tp++] = 230; + if (debug_print) printf("C40 "); break; - case DM_TEXT: target[tp] = 239; - tp++; - if (debug) printf("TEX "); + case DM_TEXT: target[tp++] = 239; + if (debug_print) printf("TEX "); break; - case DM_X12: target[tp] = 238; - tp++; - if (debug) printf("X12 "); + case DM_X12: target[tp++] = 238; + if (debug_print) printf("X12 "); break; - case DM_EDIFACT: target[tp] = 240; - tp++; - if (debug) printf("EDI "); + case DM_EDIFACT: target[tp++] = 240; + if (debug_print) printf("EDI "); break; - case DM_BASE256: target[tp] = 231; - tp++; + case DM_BASE256: target[tp++] = 231; b256_start = tp; target[tp++] = 0; /* Byte count holder (may be expanded to 2 codewords) */ - if (debug) printf("BAS "); + if (debug_print) printf("BAS "); break; } } else { if (source[sp] & 0x80) { - target[tp] = 235; /* FNC4 */ - tp++; - target[tp] = (source[sp] - 128) + 1; - tp++; - if (debug) printf("FN4 A%02X ", target[tp - 1] - 1); + target[tp++] = 235; /* FNC4 */ + target[tp++] = (source[sp] - 128) + 1; + if (debug_print) printf("FN4 A%02X ", target[tp - 1] - 1); } else { if (gs1 && (source[sp] == '[')) { if (gs1 == 2) { - target[tp] = 29 + 1; /* GS */ - if (debug) printf("GS "); + target[tp++] = 29 + 1; /* GS */ + if (debug_print) printf("GS "); } else { - target[tp] = 232; /* FNC1 */ - if (debug) printf("FN1 "); + target[tp++] = 232; /* FNC1 */ + if (debug_print) printf("FN1 "); } } else { - target[tp] = source[sp] + 1; - if (debug) printf("A%02X ", target[tp] - 1); + target[tp++] = source[sp] + 1; + if (debug_print) printf("A%02X ", target[tp - 1] - 1); } - tp++; } sp++; } @@ -843,14 +824,13 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], next_mode = current_mode; if (process_p == 0) { - next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1, debug); + next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1, debug_print); } if (next_mode != current_mode) { - target[tp] = 254; /* Unlatch */ - tp++; + target[tp++] = 254; /* Unlatch */ next_mode = DM_ASCII; - if (debug) printf("ASC "); + if (debug_print) printf("ASC "); } else { int shift_set, value; const char *ct_shift, *ct_value; @@ -889,7 +869,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], process_buffer[process_p++] = value; if (process_p >= 3) { - process_p = ctx_process_buffer_transfer(process_buffer, process_p, target, &tp, debug); + process_p = ctx_process_buffer_transfer(process_buffer, process_p, target, &tp, debug_print); } sp++; } @@ -899,14 +879,13 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], next_mode = DM_X12; if (process_p == 0) { - next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1, debug); + next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1, debug_print); } if (next_mode != DM_X12) { - target[tp] = 254; /* Unlatch */ - tp++; + target[tp++] = 254; /* Unlatch */ next_mode = DM_ASCII; - if (debug) printf("ASC "); + if (debug_print) printf("ASC "); } else { static const char x12_nonalphanum_chars[] = "\015*> "; int value = 0; @@ -922,7 +901,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], process_buffer[process_p++] = value; if (process_p >= 3) { - process_p = ctx_process_buffer_transfer(process_buffer, process_p, target, &tp, debug); + process_p = ctx_process_buffer_transfer(process_buffer, process_p, target, &tp, debug_print); } sp++; } @@ -934,7 +913,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], if (process_p == 3) { /* Note different then spec Step (f)(1), which suggests checking when 0, but this seems to work better in many cases. */ - next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1, debug); + next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1, debug_print); } if (next_mode != DM_EDIFACT) { @@ -952,19 +931,18 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], } if (process_p >= 4) { - process_p = edi_process_buffer_transfer(process_buffer, process_p, target, &tp, debug); + process_p = edi_process_buffer_transfer(process_buffer, process_p, target, &tp, debug_print); } - if (debug && next_mode == DM_ASCII) printf("ASC "); + if (debug_print && next_mode == DM_ASCII) printf("ASC "); /* step (g) Base 256 encodation */ } else if (current_mode == DM_BASE256) { - next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1, debug); + next_mode = look_ahead_test(source, inputlen, sp, current_mode, gs1, debug_print); if (next_mode == DM_BASE256) { - target[tp] = source[sp]; - tp++; + target[tp++] = source[sp]; sp++; - if (debug) printf("B%02X ", target[tp - 1]); + if (debug_print) printf("B%02X ", target[tp - 1]); } else { tp = update_b256_field_length(target, tp, b256_start); /* B.2.1 255-state randomising algorithm */ @@ -973,7 +951,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], target[i] = (unsigned char) ((target[i] + prn) & 0xFF); } next_mode = DM_ASCII; - if (debug) printf("ASC "); + if (debug_print) printf("ASC "); } } @@ -986,34 +964,34 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], symbols_left = codewords_remaining(symbol, tp, process_p); - if (debug) printf("\nsymbols_left %d, process_p %d ", symbols_left, process_p); + if (debug_print) printf("\nsymbols_left %d, process_p %d ", symbols_left, process_p); if (current_mode == DM_C40 || current_mode == DM_TEXT) { /* NOTE: changed to follow spec exactly here, only using Shift 1 padded triplets when 2 symbol chars remain. This matches the behaviour of BWIPP but not tec-it, nor figures 4.15.1-1 and 4.15-1-2 in GS1 General Specifications 21.0.1. */ - if (debug) printf("%s ", current_mode == DM_C40 ? "C40" : "TEX"); + if (debug_print) printf("%s ", current_mode == DM_C40 ? "C40" : "TEX"); if (process_p == 0) { if (symbols_left > 0) { target[tp++] = 254; // Unlatch - if (debug) printf("ASC "); + if (debug_print) printf("ASC "); } } else { if (process_p == 2 && symbols_left == 2) { /* 5.2.5.2 (b) */ process_buffer[process_p++] = 0; // Shift 1 - (void) ctx_process_buffer_transfer(process_buffer, process_p, target, &tp, debug); + (void) ctx_process_buffer_transfer(process_buffer, process_p, target, &tp, debug_print); } else if (process_p == 1 && symbols_left <= 2 && isc40text(current_mode, source[inputlen - 1])) { /* 5.2.5.2 (c)/(d) */ if (symbols_left > 1) { /* 5.2.5.2 (c) */ target[tp++] = 254; // Unlatch and encode remaining data in ascii. - if (debug) printf("ASC "); + if (debug_print) printf("ASC "); } target[tp++] = source[inputlen - 1] + 1; - if (debug) printf("A%02X ", target[tp - 1] - 1); + if (debug_print) printf("A%02X ", target[tp - 1] - 1); } else { int cnt, total_cnt = 0; @@ -1027,64 +1005,64 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], tp -= (total_cnt / 3) * 2; target[tp++] = 254; // Unlatch - if (debug) printf("ASC "); + if (debug_print) printf("ASC "); for (; sp < inputlen; sp++) { if (is_twodigits(source, inputlen, sp)) { target[tp++] = (unsigned char) ((10 * ctoi(source[sp])) + ctoi(source[sp + 1]) + 130); - if (debug) printf("N%02d ", target[tp - 1] - 130); + if (debug_print) printf("N%02d ", target[tp - 1] - 130); sp++; } else if (source[sp] & 0x80) { target[tp++] = 235; /* FNC4 */ target[tp++] = (source[sp] - 128) + 1; - if (debug) printf("FN4 A%02X ", target[tp - 1] - 1); + if (debug_print) printf("FN4 A%02X ", target[tp - 1] - 1); } else if (gs1 && source[sp] == '[') { if (gs1 == 2) { - target[tp] = 29 + 1; /* GS */ - if (debug) printf("GS "); + target[tp++] = 29 + 1; /* GS */ + if (debug_print) printf("GS "); } else { - target[tp] = 232; /* FNC1 */ - if (debug) printf("FN1 "); + target[tp++] = 232; /* FNC1 */ + if (debug_print) printf("FN1 "); } } else { target[tp++] = source[sp] + 1; - if (debug) printf("A%02X ", target[tp - 1] - 1); + if (debug_print) printf("A%02X ", target[tp - 1] - 1); } } } } } else if (current_mode == DM_X12) { - if (debug) printf("X12 "); + if (debug_print) printf("X12 "); if ((symbols_left == 1) && (process_p == 1)) { // Unlatch not required! target[tp++] = source[inputlen - 1] + 1; - if (debug) printf("A%02X ", target[tp - 1] - 1); + if (debug_print) printf("A%02X ", target[tp - 1] - 1); } else { if (symbols_left > 0) { target[tp++] = (254); // Unlatch. - if (debug) printf("ASC "); + if (debug_print) printf("ASC "); } if (process_p == 1) { target[tp++] = source[inputlen - 1] + 1; - if (debug) printf("A%02X ", target[tp - 1] - 1); + if (debug_print) printf("A%02X ", target[tp - 1] - 1); } else if (process_p == 2) { target[tp++] = source[inputlen - 2] + 1; target[tp++] = source[inputlen - 1] + 1; - if (debug) printf("A%02X A%02X ", target[tp - 2] - 1, target[tp - 1] - 1); + if (debug_print) printf("A%02X A%02X ", target[tp - 2] - 1, target[tp - 1] - 1); } } } else if (current_mode == DM_EDIFACT) { - if (debug) printf("EDI "); + if (debug_print) printf("EDI "); if (symbols_left <= 2 && process_p <= symbols_left) { // Unlatch not required! if (process_p == 1) { target[tp++] = source[inputlen - 1] + 1; - if (debug) printf("A%02X ", target[tp - 1] - 1); + if (debug_print) printf("A%02X ", target[tp - 1] - 1); } else if (process_p == 2) { target[tp++] = source[inputlen - 2] + 1; target[tp++] = source[inputlen - 1] + 1; - if (debug) printf("A%02X A%02X ", target[tp - 2] - 1, target[tp - 1] - 1); + if (debug_print) printf("A%02X A%02X ", target[tp - 2] - 1, target[tp - 1] - 1); } } else { // Append edifact unlatch value (31) and empty buffer @@ -1094,7 +1072,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], memset(process_buffer + process_p, 0, sizeof(int) * (4 - process_p)); } } - (void) edi_process_buffer_transfer(process_buffer, 4, target, &tp, debug); + (void) edi_process_buffer_transfer(process_buffer, 4, target, &tp, debug_print); } } else if (current_mode == DM_BASE256) { @@ -1108,7 +1086,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], } } - if (debug) { + if (debug_print) { printf("\nData (%d): ", tp); for (i = 0; i < tp; i++) printf("%d ", target[i]); @@ -1127,18 +1105,15 @@ static void add_tail(unsigned char target[], int tp, const int tail_length) { for (i = tail_length; i > 0; i--) { if (i == tail_length) { - target[tp] = 129; - tp++; /* Pad */ + target[tp++] = 129; /* Pad */ } else { /* B.1.1 253-state randomising algorithm */ prn = ((149 * (tp + 1)) % 253) + 1; temp = 129 + prn; if (temp <= 254) { - target[tp] = (unsigned char) (temp); - tp++; + target[tp++] = (unsigned char) (temp); } else { - target[tp] = (unsigned char) (temp - 254); - tp++; + target[tp++] = (unsigned char) (temp - 254); } } } @@ -1151,7 +1126,7 @@ static int datamatrix_200(struct zint_symbol *symbol, const unsigned char source int symbolsize; int taillength, error_number; int H, W, FH, FW, datablock, bytes, rsblock; - int debug = symbol->debug & ZINT_DEBUG_PRINT; + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; /* inputlen may be decremented by 2 if macro character is used */ error_number = dm200encode(symbol, source, binary, &inputlen, &binlen); @@ -1184,7 +1159,7 @@ static int datamatrix_200(struct zint_symbol *symbol, const unsigned char source if (taillength != 0) { add_tail(binary, binlen, taillength); } - if (debug) { + if (debug_print) { printf("Pads (%d): ", taillength); for (i = binlen; i < binlen + taillength; i++) printf("%d ", binary[i]); printf("\n"); @@ -1195,7 +1170,7 @@ static int datamatrix_200(struct zint_symbol *symbol, const unsigned char source skew = 1; } ecc200(binary, bytes, datablock, rsblock, skew); - if (debug) { + if (debug_print) { printf("ECC (%d): ", rsblock * (bytes / datablock)); for (i = bytes; i < bytes + rsblock * (bytes / datablock); i++) printf("%d ", binary[i]); printf("\n"); diff --git a/backend/dotcode.c b/backend/dotcode.c index 957367da..21d5226e 100644 --- a/backend/dotcode.c +++ b/backend/dotcode.c @@ -352,10 +352,10 @@ static void rsencode(const int nd, const int nc, unsigned char *wd) { // ...& then for each such block: for (start = 0; start < step; start++) { - int ND = (nd - start + step - 1) / step; - int NW = (nw - start + step - 1) / step; - int NC = NW - ND; - unsigned char *e = wd + start + ND * step; + const int ND = (nd - start + step - 1) / step; + const int NW = (nw - start + step - 1) / step; + const int NC = NW - ND; + unsigned char *const e = wd + start + ND * step; // first set the generator polynomial "c" of order "NC": c = coefs + cinds[NC - 3]; @@ -528,12 +528,12 @@ static int binary(const unsigned char source[], const int length, const int posi /* Analyse input data stream and encode using algorithm from Annex F */ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned char source[], const int length, unsigned char *codeword_array, int *binary_finish) { - static char lead_specials[] = "\x09\x1C\x1D\x1E"; // HT, FS, GS, RS + static const char lead_specials[] = "\x09\x1C\x1D\x1E"; // HT, FS, GS, RS int input_position, array_length, i; char encoding_mode; int inside_macro; - int debug_print = (symbol->debug & ZINT_DEBUG_PRINT); + const int debug_print = (symbol->debug & ZINT_DEBUG_PRINT); int binary_buffer_size = 0; int lawrencium[6]; // Reversed radix 103 values int nx; @@ -754,8 +754,8 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha /* Step C4 */ if ((!done) && (encoding_mode == 'C')) { - int m = ahead_a(source, input_position, length); - int n = ahead_b(source, input_position, length, &nx); + const int m = ahead_a(source, input_position, length); + const int n = ahead_b(source, input_position, length, &nx); if (m > n) { codeword_array[array_length] = 101; // Latch A array_length++; @@ -796,7 +796,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha /* Step D1 */ if ((!done) && (encoding_mode == 'B')) { - int n = try_c(source, input_position, length); + const int n = try_c(source, input_position, length); if (n >= 2) { if (n <= 4) { @@ -926,7 +926,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha /* Step E1 */ if ((!done) && (encoding_mode == 'A')) { - int n = try_c(source, input_position, length); + const int n = try_c(source, input_position, length); if (n >= 2) { if (n <= 4) { codeword_array[array_length] = 103 + (n - 2); // nx Shift C @@ -1041,7 +1041,7 @@ static int dotcode_encode_message(struct zint_symbol *symbol, const unsigned cha /* Step F1 */ if ((!done) && (encoding_mode == 'X')) { - int n = try_c(source, input_position, length); + const int n = try_c(source, input_position, length); if (n >= 2) { /* Empty binary buffer */ @@ -1382,10 +1382,10 @@ INTERNAL int dotcode(struct zint_symbol *symbol, unsigned char source[], int len int dot_stream_length; int high_score, best_mask; int binary_finish = 0; - int debug_print = (symbol->debug & ZINT_DEBUG_PRINT); + const int debug_print = (symbol->debug & ZINT_DEBUG_PRINT); int padding_dots, is_first; /* Allow 4 codewords per input + 2 (FNC) + 4 (ECI) + 2 (special char 1st position) + 4 (Structured Append) */ - int codeword_array_len = length * 4 + 2 + 4 + 2 + 4; + const int codeword_array_len = length * 4 + 2 + 4 + 2 + 4; #ifndef _MSC_VER unsigned char codeword_array[codeword_array_len]; diff --git a/backend/gb18030.c b/backend/gb18030.c index 72372f67..6efdfbd4 100644 --- a/backend/gb18030.c +++ b/backend/gb18030.c @@ -2909,7 +2909,7 @@ INTERNAL int gb18030_utf8_to_eci(const int eci, const unsigned char source[], in if (is_eci_convertible(eci)) { int error_number; - int eci_length = get_eci_length(eci, source, *p_length); + const int eci_length = get_eci_length(eci, source, *p_length); #ifndef _MSC_VER unsigned char converted[eci_length + 1]; #else diff --git a/backend/gb2312.c b/backend/gb2312.c index ac1618bc..55e9cc39 100644 --- a/backend/gb2312.c +++ b/backend/gb2312.c @@ -1577,7 +1577,7 @@ INTERNAL int gb2312_utf8_to_eci(const int eci, const unsigned char source[], int if (is_eci_convertible(eci)) { int error_number; - int eci_length = get_eci_length(eci, source, *p_length); + const int eci_length = get_eci_length(eci, source, *p_length); #ifndef _MSC_VER unsigned char converted[eci_length + 1]; #else diff --git a/backend/gridmtx.c b/backend/gridmtx.c index efc4b6f8..84d8040a 100644 --- a/backend/gridmtx.c +++ b/backend/gridmtx.c @@ -134,7 +134,7 @@ static void define_mode(char *mode, const unsigned int gbdata[], const int lengt static const char mode_types[] = { GM_CHINESE, GM_NUMBER, GM_LOWER, GM_UPPER, GM_MIXED, GM_BYTE, '\0' }; /* Initial mode costs */ - static unsigned int head_costs[GM_NUM_MODES] = { + static const unsigned int head_costs[GM_NUM_MODES] = { /* H N (+pad prefix) L U M B (+byte count) */ 4 * GM_MULT, (4 + 2) * GM_MULT, 4 * GM_MULT, 4 * GM_MULT, 4 * GM_MULT, (4 + 9) * GM_MULT }; @@ -262,7 +262,7 @@ static void define_mode(char *mode, const unsigned int gbdata[], const int lengt for (j = 0; j < GM_NUM_MODES; j++) { /* To mode */ for (k = 0; k < GM_NUM_MODES; k++) { /* From mode */ if (j != k && char_modes[cm_i + k]) { - unsigned int new_cost = cur_costs[k] + switch_costs[k][j]; + const unsigned int new_cost = cur_costs[k] + switch_costs[k][j]; if (!char_modes[cm_i + j] || new_cost < cur_costs[j]) { cur_costs[j] = new_cost; char_modes[cm_i + j] = mode_types[k]; @@ -385,7 +385,7 @@ static int gm_encode(unsigned int gbdata[], const int length, char binary[], con define_mode(mode, gbdata, length, debug); do { - int next_mode = mode[sp]; + const int next_mode = mode[sp]; if (next_mode != current_mode) { switch (current_mode) { @@ -1022,7 +1022,7 @@ INTERNAL int gridmatrix(struct zint_symbol *symbol, unsigned char source[], int const struct zint_structapp *p_structapp = NULL; int size_squared; int bin_len; - int eci_length = get_eci_length(symbol->eci, source, length); + const int eci_length = get_eci_length(symbol->eci, source, length); #ifndef _MSC_VER unsigned int gbdata[eci_length + 1]; diff --git a/backend/gs1.c b/backend/gs1.c index 3653c743..112a0bca 100644 --- a/backend/gs1.c +++ b/backend/gs1.c @@ -248,7 +248,7 @@ static int key(const unsigned char *data, int data_len, int offset, int min, int static int yymmd0(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, int *p_err_posn, char err_msg[50], const int length_only) { - static char days_in_month[] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + static const char days_in_month[] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; (void)max; @@ -277,7 +277,7 @@ static int yymmd0(const unsigned char *data, int data_len, int offset, int min, return 0; } if (month == 2 && day == 29) { /* Leap year check */ - int year = to_int(data + offset, 2); + const int year = to_int(data + offset, 2); if (year & 3) { /* Good until 2050 when 00 will mean 2100 (GS1 General Specifications 7.12) */ *p_err_no = 3; *p_err_posn = offset + 4 + 1; @@ -301,7 +301,7 @@ static int yymmdd(const unsigned char *data, int data_len, int offset, int min, data_len -= offset; if (!length_only && data_len) { - int day = to_int(data + offset + 4, 2); + const int day = to_int(data + offset + 4, 2); if (day == 0) { *p_err_no = 3; *p_err_posn = offset + 4 + 1; @@ -328,7 +328,7 @@ static int yymmddhh(const unsigned char *data, int data_len, int offset, int min data_len -= offset; if (!length_only && data_len) { - int hour = to_int(data + offset + 6, 2); + const int hour = to_int(data + offset + 6, 2); if (hour > 23) { *p_err_no = 3; *p_err_posn = offset + 6 + 1; @@ -386,7 +386,7 @@ static int mmoptss(const unsigned char *data, int data_len, int offset, int min, } if (!length_only && data_len) { - int mins = to_int(data + offset, 2); + const int mins = to_int(data + offset, 2); if (mins > 59) { *p_err_no = 3; *p_err_posn = offset + 1; @@ -394,7 +394,7 @@ static int mmoptss(const unsigned char *data, int data_len, int offset, int min, return 0; } if (data_len > 2) { - int secs = to_int(data + offset + 2, 2); + const int secs = to_int(data + offset + 2, 2); if (secs > 59) { *p_err_no = 3; *p_err_posn = offset + 2 + 1; @@ -474,7 +474,7 @@ static int iso3166999(const unsigned char *data, int data_len, int offset, int m } if (!length_only && data_len) { - int cc = to_int(data + offset, 3); + const int cc = to_int(data + offset, 3); if (cc != 999 && !iso3166_numeric(cc)) { *p_err_no = 3; *p_err_posn = offset + 1; @@ -632,7 +632,7 @@ static int nonzero(const unsigned char *data, int data_len, int offset, int min, } if (!length_only && data_len) { - int val = to_int(data + offset, data_len > max ? max : data_len); + const int val = to_int(data + offset, data_len > max ? max : data_len); if (val == 0) { *p_err_no = 3; @@ -965,7 +965,7 @@ static int couponcode(const unsigned char *data, int data_len, int offset, int m /* Optional fields */ while (d - data < data_len) { - int data_field = to_int(d, 1); + const int data_field = to_int(d, 1); d++; if (data_field == 1) { diff --git a/backend/hanxin.c b/backend/hanxin.c index c0adc0fb..0ab00a94 100644 --- a/backend/hanxin.c +++ b/backend/hanxin.c @@ -346,7 +346,7 @@ static void hx_define_mode(char *mode, const unsigned int gbdata[], const int le static const char mode_types[] = { 'n', 't', 'b', '1', '2', 'd', 'f', '\0' }; /* Initial mode costs */ - static unsigned int head_costs[HX_NUM_MODES] = { + static const unsigned int head_costs[HX_NUM_MODES] = { /* N T B 1 2 D F */ 4 * HX_MULT, 4 * HX_MULT, (4 + 13) * HX_MULT, 4 * HX_MULT, 4 * HX_MULT, 4 * HX_MULT, 0 }; @@ -450,7 +450,7 @@ static void hx_define_mode(char *mode, const unsigned int gbdata[], const int le for (j = 0; j < HX_NUM_MODES; j++) { /* To mode */ for (k = 0; k < HX_NUM_MODES; k++) { /* From mode */ if (j != k && char_modes[cm_i + k]) { - unsigned int new_cost = cur_costs[k] + switch_costs[k][j]; + const unsigned int new_cost = cur_costs[k] + switch_costs[k][j]; if (!char_modes[cm_i + j] || new_cost < cur_costs[j]) { cur_costs[j] = new_cost; char_modes[cm_i + j] = mode_types[k]; @@ -533,19 +533,17 @@ static void calculate_binary(char binary[], const char mode[], unsigned int sour i = 0; while (i < block_length) { - int first = 0; - - first = ctoi((const char) source[position + i]); + const int first = ctoi((const char) source[position + i]); count = 1; encoding_value = first; if (i + 1 < block_length && mode[position + i + 1] == 'n') { - int second = ctoi((const char) source[position + i + 1]); + const int second = ctoi((const char) source[position + i + 1]); count = 2; encoding_value = (encoding_value * 10) + second; if (i + 2 < block_length && mode[position + i + 2] == 'n') { - int third = ctoi((const char) source[position + i + 2]); + const int third = ctoi((const char) source[position + i + 2]); count = 3; encoding_value = (encoding_value * 10) + third; } @@ -846,7 +844,7 @@ static void hx_place_finder_top_left(unsigned char *grid, const int size) { /* Finder pattern for top right and bottom left of symbol */ static void hx_place_finder(unsigned char *grid, const int size, const int x, const int y) { int xp, yp; - char finder[] = {0x7F, 0x01, 0x7D, 0x05, 0x75, 0x75, 0x75}; + static const char finder[] = {0x7F, 0x01, 0x7D, 0x05, 0x75, 0x75, 0x75}; for (xp = 0; xp < 7; xp++) { for (yp = 0; yp < 7; yp++) { @@ -862,9 +860,9 @@ static void hx_place_finder(unsigned char *grid, const int size, const int x, co /* Finder pattern for bottom right of symbol */ static void hx_place_finder_bottom_right(unsigned char *grid, const int size) { int xp, yp; - int x = size - 7; - int y = x; - char finder[] = {0x75, 0x75, 0x75, 0x05, 0x7D, 0x01, 0x7F}; + const int x = size - 7; + const int y = x; + static const char finder[] = {0x75, 0x75, 0x75, 0x05, 0x7D, 0x01, 0x7F}; for (xp = 0; xp < 7; xp++) { for (yp = 0; yp < 7; yp++) { @@ -972,9 +970,9 @@ static void hx_setup_grid(unsigned char *grid, const int size, const int version } if (version > 3) { - int k = hx_module_k[version - 1]; - int r = hx_module_r[version - 1]; - int m = hx_module_m[version - 1]; + const int k = hx_module_k[version - 1]; + const int r = hx_module_r[version - 1]; + const int m = hx_module_m[version - 1]; int x, y, row_switch, column_switch; int module_height, module_width; int mod_x, mod_y; @@ -1083,15 +1081,15 @@ static void hx_add_ecc(unsigned char fullstream[], const unsigned char datastrea int i, j, block; int input_position = -1; int output_position = -1; - int table_d1_pos = ((version - 1) * 36) + ((ecc_level - 1) * 9); + const int table_d1_pos = ((version - 1) * 36) + ((ecc_level - 1) * 9); rs_t rs; rs_init_gf(&rs, 0x163); // x^8 + x^6 + x^5 + x + 1 = 0 for (i = 0; i < 3; i++) { - int batch_size = hx_table_d1[table_d1_pos + (3 * i)]; - int data_length = hx_table_d1[table_d1_pos + (3 * i) + 1]; - int ecc_length = hx_table_d1[table_d1_pos + (3 * i) + 2]; + const int batch_size = hx_table_d1[table_d1_pos + (3 * i)]; + const int data_length = hx_table_d1[table_d1_pos + (3 * i) + 1]; + const int ecc_length = hx_table_d1[table_d1_pos + (3 * i) + 2]; rs_init_code(&rs, ecc_length, 1); @@ -1352,7 +1350,7 @@ static void hx_apply_bitmask(unsigned char *grid, const int size, const int vers int pattern, penalty[4] = {0}; int best_pattern; int bit; - int size_squared = size * size; + const int size_squared = size * size; #ifndef _MSC_VER unsigned char mask[size_squared]; @@ -1458,7 +1456,7 @@ INTERNAL int hanxin(struct zint_symbol *symbol, unsigned char source[], int leng int size_squared; int codewords; int bin_len; - int eci_length = get_eci_length(symbol->eci, source, length); + const int eci_length = get_eci_length(symbol->eci, source, length); #ifndef _MSC_VER unsigned int gbdata[eci_length + 1]; @@ -1657,7 +1655,7 @@ INTERNAL int hanxin(struct zint_symbol *symbol, unsigned char source[], int leng symbol->rows = size; for (i = 0; i < size; i++) { - int r = i * size; + const int r = i * size; for (j = 0; j < size; j++) { if (grid[r + j] & 0x01) { set_module(symbol, i, j); diff --git a/backend/library.c b/backend/library.c index 5008cf67..a2ee7756 100644 --- a/backend/library.c +++ b/backend/library.c @@ -567,7 +567,7 @@ static int reduced_charset(struct zint_symbol *symbol, unsigned char *source, in int error_number = 0; unsigned char *preprocessed = source; - int eci_length = get_eci_length(symbol->eci, source, length); + const int eci_length = get_eci_length(symbol->eci, source, length); #ifndef _MSC_VER unsigned char preprocessed_buf[eci_length + 1]; #else diff --git a/backend/maxicode.c b/backend/maxicode.c index 94034278..48072c25 100644 --- a/backend/maxicode.c +++ b/backend/maxicode.c @@ -540,7 +540,7 @@ INTERNAL int maxicode(struct zint_symbol *symbol, unsigned char source[], int le unsigned char maxi_codeword[144] = {0}; int scm_vv = -1; int structapp_cw = 0; - int debug_print = symbol->debug & ZINT_DEBUG_PRINT; + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; mode = symbol->option_1; diff --git a/backend/pdf417.c b/backend/pdf417.c index 4eda92cb..97d7f5d1 100644 --- a/backend/pdf417.c +++ b/backend/pdf417.c @@ -40,7 +40,9 @@ number of check codewords) symbol->option_2 is used to adjust the width of the resulting symbol (i.e. the - number of codeword columns not including row start and end data) */ + number of codeword columns not including row start and end data) + + symbol->option_3 is used to adjust the rows of the resulting symbol */ #include #include @@ -53,6 +55,7 @@ #include #include "common.h" #include "pdf417.h" +#include "pdf417_tabs.h" #define TEX 900 #define BYT 901 @@ -65,7 +68,7 @@ /* text mode processing tables */ -static const char asciix[127] = { +static const char pdf_asciix[127] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 8, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 4, 12, 4, 4, 8, 8, 8, 12, 4, 12, 12, 12, 12, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 12, 8, 8, 4, 8, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -73,7 +76,7 @@ static const char asciix[127] = { 2, 2, 2, 2, 8, 8, 8, 8 }; -static const char asciiy[127] = { +static const char pdf_asciiy[127] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 15, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 10, 20, 15, 18, 21, 10, 28, 23, 24, 22, 20, 13, 16, 17, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 14, 0, 1, 23, 2, 25, 3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, @@ -83,25 +86,25 @@ static const char asciiy[127] = { /* Automatic sizing table */ -static const char MicroAutosize[56] = { +static const char pdf_MicroAutosize[56] = { 4, 6, 7, 8, 10, 12, 13, 14, 16, 18, 19, 20, 24, 29, 30, 33, 34, 37, 39, 46, 54, 58, 70, 72, 82, 90, 108, 126, 1, 14, 2, 7, 3, 25, 8, 16, 5, 17, 9, 6, 10, 11, 28, 12, 19, 13, 29, 20, 30, 21, 22, 31, 23, 32, 33, 34 }; /* ISO/IEC 15438:2015 5.1.1 c) 3) Max possible number of characters at error correction level 0 (Numeric Compaction mode) */ -#define PDF417_MAX_LEN 2710 +#define PDF_MAX_LEN 2710 /* ISO/IEC 24728:2006 5.1.1 c) 3) Max possible number of characters (Numeric Compaction mode) */ -#define MICRO_PDF417_MAX_LEN 366 +#define MICRO_PDF_MAX_LEN 366 /* 866 */ -static int quelmode(const unsigned char codeascii) { +static int pdf_quelmode(const unsigned char codeascii) { if ((codeascii <= '9') && (codeascii >= '0')) { return NUM; } - if (codeascii < 127 && asciix[codeascii]) { + if (codeascii < 127 && pdf_asciix[codeascii]) { return TEX; } /* 876 */ @@ -110,7 +113,7 @@ static int quelmode(const unsigned char codeascii) { } /* 844 */ -static void regroupe(int liste[2][PDF417_MAX_LEN], int *indexliste) { +static void pdf_regroupe(int liste[2][PDF_MAX_LEN], int *indexliste) { /* bring together same type blocks */ if (*(indexliste) > 1) { @@ -122,7 +125,7 @@ static void regroupe(int liste[2][PDF417_MAX_LEN], int *indexliste) { liste[0][i - 1] = liste[0][i - 1] + liste[0][i]; j = i + 1; - /* decreace the list */ + /* decrease the list */ while (j < *(indexliste)) { liste[0][j - 1] = liste[0][j]; liste[1][j - 1] = liste[1][j]; @@ -138,7 +141,7 @@ static void regroupe(int liste[2][PDF417_MAX_LEN], int *indexliste) { } /* 478 */ -static void pdfsmooth(int liste[2][PDF417_MAX_LEN], int *indexliste) { +static void pdf_smooth(int liste[2][PDF_MAX_LEN], int *indexliste) { int i, crnt, last, next, length; for (i = 0; i < *(indexliste); i++) { @@ -162,8 +165,7 @@ static void pdfsmooth(int liste[2][PDF417_MAX_LEN], int *indexliste) { /* and there are others */ if ((next == TEX) && (length < 8)) { liste[1][i] = TEX; - } - if ((next == BYT) && (length == 1)) { + } else if ((next == BYT) && (length == 1)) { liste[1][i] = BYT; } } @@ -172,29 +174,25 @@ static void pdfsmooth(int liste[2][PDF417_MAX_LEN], int *indexliste) { /* last block */ if ((last == TEX) && (length < 7)) { liste[1][i] = TEX; - } - if ((last == BYT) && (length == 1)) { + } else if ((last == BYT) && (length == 1)) { liste[1][i] = BYT; } } else { /* not first or last block */ if (((last == BYT) && (next == BYT)) && (length < 4)) { liste[1][i] = BYT; - } - if (((last == BYT) && (next == TEX)) && (length < 4)) { + } else if (((last == BYT) && (next == TEX)) && (length < 4)) { liste[1][i] = TEX; - } - if (((last == TEX) && (next == BYT)) && (length < 5)) { + } else if (((last == TEX) && (next == BYT)) && (length < 5)) { liste[1][i] = TEX; - } - if (((last == TEX) && (next == TEX)) && (length < 8)) { + } else if (((last == TEX) && (next == TEX)) && (length < 8)) { liste[1][i] = TEX; } } } } } - regroupe(liste, indexliste); + pdf_regroupe(liste, indexliste); /* 520 */ for (i = 0; i < *(indexliste); i++) { crnt = liste[1][i]; @@ -221,30 +219,28 @@ static void pdfsmooth(int liste[2][PDF417_MAX_LEN], int *indexliste) { /* not the last one */ if (((last == BYT) && (next == BYT)) && (length < 5)) { liste[1][i] = BYT; - } - if ((((last == BYT) && (next != BYT)) || ((last != BYT) - && (next == BYT))) && (length < 3)) { + } else if ((((last == BYT) && (next != BYT)) || ((last != BYT) && (next == BYT))) && (length < 3)) { liste[1][i] = BYT; } } } } /* 540 */ - regroupe(liste, indexliste); + pdf_regroupe(liste, indexliste); } /* 547 */ -static void textprocess(int *chainemc, int *mclength, const unsigned char chaine[], int start, const int length, +static void pdf_textprocess(int *chainemc, int *mclength, const unsigned char chaine[], int start, const int length, const int is_micro) { - int j, indexlistet, curtable, listet[2][PDF417_MAX_LEN] = {{0}}, chainet[PDF417_MAX_LEN], wnet; + int j, indexlistet, curtable, listet[2][PDF_MAX_LEN] = {{0}}, chainet[PDF_MAX_LEN], wnet; wnet = 0; /* listet will contain the table numbers and the value of each characters */ for (indexlistet = 0; indexlistet < length; indexlistet++) { - int codeascii = chaine[start + indexlistet]; - listet[0][indexlistet] = asciix[codeascii]; - listet[1][indexlistet] = asciiy[codeascii]; + const int codeascii = chaine[start + indexlistet]; + listet[0][indexlistet] = pdf_asciix[codeascii]; + listet[1][indexlistet] = pdf_asciiy[codeascii]; } /* 570 */ @@ -252,152 +248,111 @@ static void textprocess(int *chainemc, int *mclength, const unsigned char chaine for (j = 0; j < length; j++) { if (listet[0][j] & curtable) { /* The character is in the current table */ - chainet[wnet] = listet[1][j]; - wnet++; + chainet[wnet++] = listet[1][j]; } else { /* Obliged to change table */ - int flag = FALSE; /* True if we change table for only one character */ - if (j == (length - 1)) { - flag = TRUE; - } else { - if (!(listet[0][j] & listet[0][j + 1])) { - flag = TRUE; - } - } - - if (flag) { + int newtable; + if (j == (length - 1) || !(listet[0][j] & listet[0][j + 1])) { /* we change only one character - look for temporary switch */ if ((listet[0][j] & 1) && (curtable == 2)) { /* T_UPP */ - chainet[wnet] = 27; - chainet[wnet + 1] = listet[1][j]; - wnet += 2; - } else if (listet[0][j] & 8) { /* T_PUN (T_PUN and T_UPP not both possible) */ - chainet[wnet] = 29; - chainet[wnet + 1] = listet[1][j]; - wnet += 2; - } else { - /* No temporary switch available */ - flag = FALSE; + chainet[wnet++] = 27; + chainet[wnet++] = listet[1][j]; + continue; } + if (listet[0][j] & 8) { /* T_PUN (T_PUN and T_UPP not both possible) */ + chainet[wnet++] = 29; + chainet[wnet++] = listet[1][j]; + continue; + } + /* No temporary switch available */ + newtable = listet[0][j]; + } else { + newtable = listet[0][j] & listet[0][j + 1]; } /* 599 */ - if (!(flag)) { - int newtable; - if (j == (length - 1)) { - newtable = listet[0][j]; - } else { - if (!(listet[0][j] & listet[0][j + 1])) { - newtable = listet[0][j]; - } else { - newtable = listet[0][j] & listet[0][j + 1]; - } - } - - /* Maintain the first if several tables are possible */ - if (newtable == 7) { - newtable = 1; - } else if (newtable == 12) { - newtable = 4; - } - - /* 619 - select the switch */ - switch (curtable) { - case 1: - switch (newtable) { - case 2: chainet[wnet] = 27; - wnet++; - break; - case 4: chainet[wnet] = 28; - wnet++; - break; - case 8: chainet[wnet] = 28; - wnet++; - chainet[wnet] = 25; - wnet++; - break; - } - break; - case 2: - switch (newtable) { - case 1: chainet[wnet] = 28; - wnet++; - chainet[wnet] = 28; - wnet++; - break; - case 4: chainet[wnet] = 28; - wnet++; - break; - case 8: chainet[wnet] = 28; - wnet++; - chainet[wnet] = 25; - wnet++; - break; - } - break; - case 4: - switch (newtable) { - case 1: chainet[wnet] = 28; - wnet++; - break; - case 2: chainet[wnet] = 27; - wnet++; - break; - case 8: chainet[wnet] = 25; - wnet++; - break; - } - break; - case 8: - switch (newtable) { - case 1: chainet[wnet] = 29; - wnet++; - break; - case 2: chainet[wnet] = 29; - wnet++; - chainet[wnet] = 27; - wnet++; - break; - case 4: chainet[wnet] = 29; - wnet++; - chainet[wnet] = 28; - wnet++; - break; - } - break; - } - curtable = newtable; - /* 659 - at last we add the character */ - chainet[wnet] = listet[1][j]; - wnet++; + /* Maintain the first if several tables are possible */ + if (newtable == 7) { + newtable = 1; + } else if (newtable == 12) { + newtable = 4; } + + /* 619 - select the switch */ + switch (curtable) { + case 1: + switch (newtable) { + case 2: chainet[wnet++] = 27; + break; + case 4: chainet[wnet++] = 28; + break; + case 8: chainet[wnet++] = 28; + chainet[wnet++] = 25; + break; + } + break; + case 2: + switch (newtable) { + case 1: chainet[wnet++] = 28; + chainet[wnet++] = 28; + break; + case 4: chainet[wnet++] = 28; + break; + case 8: chainet[wnet++] = 28; + chainet[wnet++] = 25; + break; + } + break; + case 4: + switch (newtable) { + case 1: chainet[wnet++] = 28; + break; + case 2: chainet[wnet++] = 27; + break; + case 8: chainet[wnet++] = 25; + break; + } + break; + case 8: + switch (newtable) { + case 1: chainet[wnet++] = 29; + break; + case 2: chainet[wnet++] = 29; + chainet[wnet++] = 27; + break; + case 4: chainet[wnet++] = 29; + chainet[wnet++] = 28; + break; + } + break; + } + curtable = newtable; + /* 659 - at last we add the character */ + chainet[wnet++] = listet[1][j]; } } /* 663 */ if (wnet & 1) { - chainet[wnet] = 29; - wnet++; + chainet[wnet++] = 29; } /* Now translate the string chainet into codewords */ /* Default mode for PDF417 is Text Compaction Alpha (ISO/IEC 1543:2015 5.4.2.1), and for MICROPDF417 is Byte * Compaction (ISO/IEC 24728:2006 5.4.3), so only add flag if not first codeword or is MICROPDF417 */ - if (*mclength || is_micro) { + if (*mclength > 1 || is_micro) { chainemc[(*mclength)++] = 900; } for (j = 0; j < wnet; j += 2) { - int cw_number; - - cw_number = (30 * chainet[j]) + chainet[j + 1]; + const int cw_number = (30 * chainet[j]) + chainet[j + 1]; chainemc[(*mclength)++] = cw_number; } } /* 671 */ -INTERNAL void byteprocess(int *chainemc, int *mclength, const unsigned char chaine[], int start, const int length, +INTERNAL void pdf_byteprocess(int *chainemc, int *mclength, const unsigned char chaine[], int start, const int length, const int debug_print) { if (debug_print) printf("\nEntering byte mode at position %d\n", start); @@ -433,7 +388,7 @@ INTERNAL void byteprocess(int *chainemc, int *mclength, const unsigned char chai total = 0; while (chunkLen--) { - uint64_t mantisa = chaine[start++]; + const uint64_t mantisa = chaine[start++]; total |= mantisa << (chunkLen * 8); } @@ -455,9 +410,9 @@ INTERNAL void byteprocess(int *chainemc, int *mclength, const unsigned char chai } /* 712 */ -static void numbprocess(int *chainemc, int *mclength, const unsigned char chaine[], int start, const int length) { +static void pdf_numbprocess(int *chainemc, int *mclength, const unsigned char chaine[], int start, const int length) { int j, loop, dummy[50] = {0}, diviseur, nombre; - char chainemod[46], chainemult[46]; + char chainemod[45]; chainemc[(*mclength)++] = 902; @@ -465,41 +420,39 @@ static void numbprocess(int *chainemc, int *mclength, const unsigned char chaine while (j < length) { int longueur; int dumlength = 0; - int p; + int p, len; longueur = length - j; if (longueur > 44) { longueur = 44; } - chainemod[0] = '1'; - for (loop = 1; loop <= longueur; loop++) { - chainemod[loop] = chaine[start + loop + j - 1]; + len = longueur + 1; + chainemod[0] = 1; + for (loop = 1; loop < len; loop++) { + chainemod[loop] = ctoi(chaine[start + loop + j - 1]); } - chainemod[longueur + 1] = '\0'; do { diviseur = 900; /* 877 - gosub Modulo */ p = 0; - chainemult[p] = '\0'; nombre = 0; - for (loop = 0; chainemod[loop]; loop++) { + for (loop = 0; loop < len; loop++) { nombre *= 10; - nombre += ctoi(chainemod[loop]); + nombre += chainemod[loop]; if (nombre < diviseur) { if (p) { - chainemult[p++] = '0'; + chainemod[p++] = 0; } } else { - chainemult[p++] = (nombre / diviseur) + '0'; + chainemod[p++] = (nombre / diviseur); nombre = nombre % diviseur; } } - chainemult[p] = '\0'; diviseur = nombre; /* return to 723 */ dummy[dumlength++] = diviseur; - strcpy(chainemod, chainemult); + len = p; } while (p); for (loop = dumlength - 1; loop >= 0; loop--) { chainemc[(*mclength)++] = dummy[loop]; @@ -509,18 +462,18 @@ static void numbprocess(int *chainemc, int *mclength, const unsigned char chaine } /* Initial processing of data, shared by `pdf417()` and `micropdf417()` */ -static int pdf417_initial(struct zint_symbol *symbol, unsigned char chaine[], const int length, const int is_micro, - int chainemc[PDF417_MAX_LEN], int *p_mclength, int structapp_cws[18], int *p_structapp_cp) { +static int pdf_initial(struct zint_symbol *symbol, unsigned char chaine[], const int length, const int is_micro, + int chainemc[PDF_MAX_LEN], int *p_mclength, int structapp_cws[18], int *p_structapp_cp) { int i, indexchaine, indexliste, mode; - int liste[2][PDF417_MAX_LEN] = {{0}}; + int liste[2][PDF_MAX_LEN] = {{0}}; int mclength, structapp_cp = 0; - int debug_print = symbol->debug & ZINT_DEBUG_PRINT; + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; /* 456 */ indexliste = 0; indexchaine = 0; - mode = quelmode(chaine[indexchaine]); + mode = pdf_quelmode(chaine[indexchaine]); /* 463 */ do { @@ -528,13 +481,13 @@ static int pdf417_initial(struct zint_symbol *symbol, unsigned char chaine[], co while ((liste[1][indexliste] == mode) && (indexchaine < length)) { liste[0][indexliste]++; indexchaine++; - mode = quelmode(chaine[indexchaine]); + mode = pdf_quelmode(chaine[indexchaine]); } indexliste++; } while (indexchaine < length); /* 474 */ - pdfsmooth(liste, &indexliste); + pdf_smooth(liste, &indexliste); if (debug_print) { printf("Initial block pattern:\n"); @@ -555,7 +508,7 @@ static int pdf417_initial(struct zint_symbol *symbol, unsigned char chaine[], co /* 541 - now compress the data */ indexchaine = 0; - mclength = 0; + mclength = is_micro ? 0 : 1; /* Allow for length descriptor for full symbol */ if (symbol->structapp.count) { int id_cnt = 0, ids[10]; @@ -579,7 +532,7 @@ static int pdf417_initial(struct zint_symbol *symbol, unsigned char chaine[], co } for (i = 0; i < id_len; i += 3, id_cnt++) { - int triplet_len = i + 3 < id_len ? 3 : id_len - i; + 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)"); @@ -608,8 +561,7 @@ static int pdf417_initial(struct zint_symbol *symbol, unsigned char chaine[], co } if (symbol->output_options & READER_INIT) { - chainemc[mclength] = 921; /* Reader Initialisation */ - mclength++; + chainemc[mclength++] = 921; /* Reader Initialisation */ } if (symbol->eci != 0) { @@ -619,40 +571,32 @@ static int pdf417_initial(struct zint_symbol *symbol, unsigned char chaine[], co } /* Encoding ECI assignment number, according to Table 8 */ if (symbol->eci <= 899) { - chainemc[mclength] = 927; /* ECI */ - mclength++; - chainemc[mclength] = symbol->eci; - mclength++; + chainemc[mclength++] = 927; /* ECI */ + chainemc[mclength++] = symbol->eci; } else if (symbol->eci <= 810899) { - chainemc[mclength] = 926; /* ECI */ - mclength++; - chainemc[mclength] = (symbol->eci / 900) - 1; - mclength++; - chainemc[mclength] = symbol->eci % 900; - mclength++; + chainemc[mclength++] = 926; /* ECI */ + chainemc[mclength++] = (symbol->eci / 900) - 1; + chainemc[mclength++] = symbol->eci % 900; } else { - chainemc[mclength] = 925; /* ECI */ - mclength++; - chainemc[mclength] = symbol->eci - 810900; - mclength++; + chainemc[mclength++] = 925; /* ECI */ + chainemc[mclength++] = symbol->eci - 810900; } } for (i = 0; i < indexliste; i++) { switch (liste[1][i]) { case TEX: /* 547 - text mode */ - textprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], is_micro); + pdf_textprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], is_micro); break; case BYT: /* 670 - octet stream mode */ - byteprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], debug_print); + pdf_byteprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i], debug_print); break; case NUM: /* 712 - numeric mode */ - numbprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i]); + pdf_numbprocess(chainemc, &mclength, chaine, indexchaine, liste[0][i]); break; } indexchaine = indexchaine + liste[0][i]; } - assert(mclength > 0); /* Suppress clang-analyzer-core.uninitialized.Assign warning */ *p_mclength = mclength; *p_structapp_cp = structapp_cp; @@ -661,88 +605,132 @@ static int pdf417_initial(struct zint_symbol *symbol, unsigned char chaine[], co } /* 366 */ -static int pdf417_enc(struct zint_symbol *symbol, unsigned char chaine[], const int length) { - int i, k, j, longueur, loop, mccorrection[520] = {0}, offset; - int total, chainemc[PDF417_MAX_LEN], mclength, c1, c2, c3, dummy[35]; +static int pdf_enc(struct zint_symbol *symbol, unsigned char chaine[], const int length) { + int i, j, longueur, loop, mccorrection[520] = {0}, offset; + int total, chainemc[PDF_MAX_LEN], mclength, c1, c2, c3, dummy[35]; + int rows, cols, ecc, ecc_cws, padding; char pattern[580]; int bp = 0; int structapp_cws[18] = {0}; /* 3 (Index) + 10 (ID) + 4 (Count) + 1 (Last) */ int structapp_cp = 0; int error_number; - int debug_print = symbol->debug & ZINT_DEBUG_PRINT; - static int ecc_num_cws[] = { 2, 4, 8, 16, 32, 64, 128, 256, 512 }; + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; + static const int ecc_num_cws[] = { 2, 4, 8, 16, 32, 64, 128, 256, 512 }; - if (length > PDF417_MAX_LEN) { + if (length > PDF_MAX_LEN) { strcpy(symbol->errtxt, "463: Input string too long"); return ZINT_ERROR_TOO_LONG; } - error_number = pdf417_initial(symbol, chaine, length, 0 /*is_micro*/, chainemc, &mclength, structapp_cws, + error_number = pdf_initial(symbol, chaine, length, 0 /*is_micro*/, chainemc, &mclength, structapp_cws, &structapp_cp); - if (error_number >= ZINT_ERROR) { + if (error_number) { /* Only errors return >= ZINT_ERROR */ return error_number; } if (debug_print) { - printf("\nCompressed data stream (%d):\n", mclength); - for (i = 0; i < mclength; i++) { + printf("\nCompressed data stream (%d):\n", mclength - 1); + for (i = 1; i < mclength; i++) { /* Skip unset length descriptor */ printf("%d ", chainemc[i]); } printf("\n\n"); } /* 752 - Now take care of the number of CWs per row */ - if (symbol->option_1 < 0) { - if (mclength + structapp_cp <= 40) { - symbol->option_1 = 2; - } else if (mclength + structapp_cp <= 160) { - symbol->option_1 = 3; - } else if (mclength + structapp_cp <= 320) { - symbol->option_1 = 4; - } else if (mclength + structapp_cp <= 863) { - symbol->option_1 = 5; + + /* ECC */ + ecc = symbol->option_1; + if (ecc < 0) { /* If not specified, set ECC depending on no. of codewords */ + const int data_cws = mclength - 1 + structapp_cp; /* -1 for length descriptor */ + /* ISO/IEC 15438:2015 Annex E Table E.1 Recommended minima */ + if (data_cws <= 40) { + ecc = 2; + } else if (data_cws <= 160) { + ecc = 3; + } else if (data_cws <= 320) { + ecc = 4; + } else if (data_cws <= 863) { + ecc = 5; } else { - symbol->option_1 = 6; + ecc = 6; /* Not mentioned in Table E.1 */ } } - k = ecc_num_cws[symbol->option_1]; - longueur = mclength + structapp_cp + k; + ecc_cws = ecc_num_cws[ecc]; + + longueur = mclength + structapp_cp + ecc_cws; + + if (debug_print) printf("Total No. of Codewords: %d, ECC %d, No. of ECC Codewords: %d\n", longueur, ecc, ecc_cws); + if (longueur > 928) { /* Enforce maximum codeword limit */ strcpy(symbol->errtxt, "464: Input string too long"); return ZINT_ERROR_TOO_LONG; } - if (symbol->option_2 < 1) { - symbol->option_2 = (int) (0.5 + sqrt(longueur / 3.0)); - } - if ((longueur / symbol->option_2) > 90) { - /* stop the symbol from becoming too high */ - symbol->option_2 = symbol->option_2 + 1; - - if ((longueur / symbol->option_2) > 90) { - strcpy(symbol->errtxt, "465: Data too long for specified number of columns"); - return ZINT_ERROR_TOO_LONG; + cols = symbol->option_2; + rows = symbol->option_3; + if (rows) { /* Rows given */ + if (cols < 1) { /* Cols automatic */ + cols = (longueur + rows - 1) / rows; + if (cols <= 1) { + cols = 1; + } else { + /* Increase rows if would need > 30 columns */ + for (; cols > 30 && rows < 90; rows++, cols = (longueur + rows - 1) / rows); + assert(cols <= 30); + /* 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; + } + } + } 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; + } + } + 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; + } + } else { /* Rows automatic, cols automatic or given */ + if (cols < 1) { /* Cols automatic */ + cols = (int) round(sqrt((longueur - 1) / 3.0)); /* -1 (length descriptor) for back-compatibility */ + } + rows = (longueur + cols - 1) / cols; + if (rows <= 3) { + rows = 3; + } else { + /* Increase cols if would need > 90 rows - do this even if cols specified for better back-compatibility + (though previously only increased once) */ + for (; rows > 90 && cols < 30; cols++, rows = (longueur + cols - 1) / cols); + assert(rows <= 90); + /* 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; + } + 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; + } } } - assert(symbol->option_2 >= 1); /* Suppress clang-analyzer-core.CallAndMessage */ + assert(rows * cols >= longueur); /* 781 - Padding calculation */ - longueur = mclength + structapp_cp + 1 + k; - i = 0; - if ((longueur / symbol->option_2) < 3) { - i = (symbol->option_2 * 3) - longueur; /* A bar code must have at least three rows */ - } else { - if ((longueur % symbol->option_2) > 0) { - i = symbol->option_2 - (longueur % symbol->option_2); - } - } + padding = rows * cols - longueur; + /* We add the padding */ - while (i > 0) { - chainemc[mclength] = 900; - mclength++; - i--; + for (i = 0; i < padding; i++) { + chainemc[mclength++] = 900; } + if (debug_print) printf("Padding: %d\n", padding); /* We add the Structured Append Macro Control Block if any */ if (structapp_cp) { @@ -751,15 +739,11 @@ static int pdf417_enc(struct zint_symbol *symbol, unsigned char chaine[], const } } - /* we add the length descriptor */ - for (i = mclength; i > 0; i--) { - chainemc[i] = chainemc[i - 1]; - } - chainemc[0] = mclength + 1; - mclength++; + /* Set the length descriptor */ + chainemc[0] = mclength; /* 796 - we now take care of the Reed Solomon codes */ - switch (symbol->option_1) { + switch (ecc) { case 1: offset = 2; break; case 2: offset = 6; @@ -780,17 +764,16 @@ static int pdf417_enc(struct zint_symbol *symbol, unsigned char chaine[], const break; } - longueur = mclength; - for (i = 0; i < longueur; i++) { - total = (chainemc[i] + mccorrection[k - 1]) % 929; - for (j = k - 1; j > 0; j--) { - mccorrection[j] = (mccorrection[j - 1] + 929 - (total * coefrs[offset + j]) % 929) % 929; + for (i = 0; i < mclength; i++) { + total = (chainemc[i] + mccorrection[ecc_cws - 1]) % 929; + for (j = ecc_cws - 1; j > 0; j--) { + mccorrection[j] = (mccorrection[j - 1] + 929 - (total * pdf_coefrs[offset + j]) % 929) % 929; } - mccorrection[0] = (929 - (total * coefrs[offset]) % 929) % 929; + mccorrection[0] = (929 - (total * pdf_coefrs[offset]) % 929) % 929; } /* we add these codes to the string */ - for (i = k - 1; i >= 0; i--) { + for (i = ecc_cws - 1; i >= 0; i--) { chainemc[mclength++] = mccorrection[i] ? 929 - mccorrection[i] : 0; } @@ -807,43 +790,40 @@ static int pdf417_enc(struct zint_symbol *symbol, unsigned char chaine[], const } #endif - symbol->rows = mclength / symbol->option_2; - assert(symbol->rows > 0); /* Suppress clang-analyzer-core.DivideZero warning */ - - if (debug_print) printf("\nSymbol size:\n%d columns x %d rows\n", symbol->option_2, symbol->rows); + if (debug_print) printf("\nSymbol size:\n%d columns x %d rows\n", cols, rows); /* 818 - The CW string is finished */ - c1 = (symbol->rows - 1) / 3; - c2 = symbol->option_1 * 3 + (symbol->rows - 1) % 3; - c3 = symbol->option_2 - 1; + c1 = (rows - 1) / 3; + c2 = ecc * 3 + (rows - 1) % 3; + c3 = cols - 1; /* we now encode each row */ - for (i = 0; i < symbol->rows; i++) { + for (i = 0; i < rows; i++) { + const int k = (i / 3) * 30; bp = 0; - for (j = 0; j < symbol->option_2; j++) { - dummy[j + 1] = chainemc[i * symbol->option_2 + j]; + for (j = 0; j < cols; j++) { + dummy[j + 1] = chainemc[i * cols + j]; } - k = (i / 3) * 30; switch (i % 3) { case 0: dummy[0] = k + c1; - dummy[symbol->option_2 + 1] = k + c3; + dummy[cols + 1] = k + c3; offset = 0; /* cluster(0) */ break; case 1: dummy[0] = k + c2; - dummy[symbol->option_2 + 1] = k + c1; + dummy[cols + 1] = k + c1; offset = 929; /* cluster(3) */ break; case 2: dummy[0] = k + c3; - dummy[symbol->option_2 + 1] = k + c2; + dummy[cols + 1] = k + c2; offset = 1858; /* cluster(6) */ break; } bp = bin_append_posn(0x1FEA8, 17, pattern, bp); /* Row start */ - for (j = 0; j <= symbol->option_2; j++) { + for (j = 0; j <= cols; j++) { bp = bin_append_posn(pdf_bitpattern[offset + dummy[j]], 16, pattern, bp); pattern[bp++] = '0'; } @@ -863,9 +843,14 @@ static int pdf417_enc(struct zint_symbol *symbol, unsigned char chaine[], const } } symbol->width = bp; + symbol->rows = rows; /* ISO/IEC 15438:2015 Section 5.8.2 3X minimum row height */ - error_number = set_height(symbol, 3.0f, 0.0f, 0.0f, 0 /*no_errtxt*/); + if (error_number) { + (void) set_height(symbol, 3.0f, 0.0f, 0.0f, 1 /*no_errtxt*/); + } else { + error_number = set_height(symbol, 3.0f, 0.0f, 0.0f, 0 /*no_errtxt*/); + } /* 843 */ return error_number; @@ -886,16 +871,24 @@ INTERNAL int pdf417(struct zint_symbol *symbol, unsigned char source[], int leng error_number = ZINT_WARN_INVALID_OPTION; } if ((symbol->option_2 < 0) || (symbol->option_2 > 30)) { - strcpy(symbol->errtxt, "461: Number of columns out of range"); + strcpy(symbol->errtxt, "461: Number of columns out of range (1 to 30)"); 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_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; + } + 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; + } /* 349 */ - codeerr = pdf417_enc(symbol, source, length); + codeerr = pdf_enc(symbol, source, length); /* 352 */ if (codeerr != 0) { @@ -909,25 +902,29 @@ INTERNAL int pdf417(struct zint_symbol *symbol, unsigned char source[], int leng /* like PDF417 only much smaller! */ INTERNAL int micropdf417(struct zint_symbol *symbol, unsigned char chaine[], int length) { int i, k, j, longueur, mccorrection[50] = {0}, offset; - int total, chainemc[PDF417_MAX_LEN], mclength, error_number = 0; + int total, chainemc[PDF_MAX_LEN], mclength, error_number = 0; char pattern[580]; int bp = 0; int structapp_cws[18] = {0}; /* 3 (Index) + 10 (ID) + 4 (Count) + 1 (Last) */ int structapp_cp = 0; int variant, LeftRAPStart, CentreRAPStart, RightRAPStart, StartCluster; int LeftRAP, CentreRAP, RightRAP, Cluster, loop; - int debug_print = symbol->debug & ZINT_DEBUG_PRINT; + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; - if (length > MICRO_PDF417_MAX_LEN) { + if (length > MICRO_PDF_MAX_LEN) { strcpy(symbol->errtxt, "474: Input data too long"); return ZINT_ERROR_TOO_LONG; } + if (symbol->option_3) { + strcpy(symbol->errtxt, "476: Cannot specify rows for MicroPDF417"); + return ZINT_ERROR_INVALID_OPTION; + } /* Encoding starts out the same as PDF417, so use the same code */ - error_number = pdf417_initial(symbol, chaine, length, 1 /*is_micro*/, chainemc, &mclength, structapp_cws, + error_number = pdf_initial(symbol, chaine, length, 1 /*is_micro*/, chainemc, &mclength, structapp_cws, &structapp_cp); - if (error_number >= ZINT_ERROR) { + if (error_number) { /* Only errors return >= ZINT_ERROR */ return error_number; } @@ -1071,24 +1068,24 @@ INTERNAL int micropdf417(struct zint_symbol *symbol, unsigned char chaine[], int } else { /* Zint can choose automatically from all available variations */ for (i = 27; i >= 0; i--) { - /* Note mclength + structapp_cp <= 126 and MicroAutosize[27] == 126 so variant will be set */ - if (MicroAutosize[i] >= mclength + structapp_cp) { - variant = MicroAutosize[i + 28]; + /* Note mclength + structapp_cp <= 126 and pdf_MicroAutosize[27] == 126 so variant will be set */ + if (pdf_MicroAutosize[i] >= mclength + structapp_cp) { + variant = pdf_MicroAutosize[i + 28]; } else { - assert(variant > 0); /* Suppress clang-tidy clang-analyzer-core.uninitialized.Assign */ break; } } } + assert(variant > 0); /* Suppress clang-tidy clang-analyzer-core.uninitialized.Assign */ /* Now we have the variant we can load the data */ variant--; - symbol->option_2 = MicroVariants[variant]; /* columns */ - symbol->rows = MicroVariants[variant + 34]; /* rows */ - k = MicroVariants[variant + 68]; /* number of EC CWs */ + symbol->option_2 = pdf_MicroVariants[variant]; /* columns */ + symbol->rows = pdf_MicroVariants[variant + 34]; /* rows */ + k = pdf_MicroVariants[variant + 68]; /* number of EC CWs */ longueur = (symbol->option_2 * symbol->rows) - k; /* number of non-EC CWs */ i = longueur - (mclength + structapp_cp); /* amount of padding required */ - offset = MicroVariants[variant + 102]; /* coefficient offset */ + offset = pdf_MicroVariants[variant + 102]; /* coefficient offset */ if (debug_print) { printf("\nChoose symbol size:\n"); @@ -1099,8 +1096,7 @@ INTERNAL int micropdf417(struct zint_symbol *symbol, unsigned char chaine[], int /* We add the padding */ while (i > 0) { - chainemc[mclength] = 900; - mclength++; + chainemc[mclength++] = 900; i--; } @@ -1117,9 +1113,9 @@ INTERNAL int micropdf417(struct zint_symbol *symbol, unsigned char chaine[], int total = (chainemc[i] + mccorrection[k - 1]) % 929; for (j = k - 1; j >= 0; j--) { if (j == 0) { - mccorrection[j] = (929 - (total * Microcoeffs[offset + j]) % 929) % 929; + mccorrection[j] = (929 - (total * pdf_Microcoeffs[offset + j]) % 929) % 929; } else { - mccorrection[j] = (mccorrection[j - 1] + 929 - (total * Microcoeffs[offset + j]) % 929) % 929; + mccorrection[j] = (mccorrection[j - 1] + 929 - (total * pdf_Microcoeffs[offset + j]) % 929) % 929; } } } @@ -1131,8 +1127,7 @@ INTERNAL int micropdf417(struct zint_symbol *symbol, unsigned char chaine[], int } /* we add these codes to the string */ for (i = k - 1; i >= 0; i--) { - chainemc[mclength] = mccorrection[i]; - mclength++; + chainemc[mclength++] = mccorrection[i]; } if (debug_print) { @@ -1149,10 +1144,10 @@ INTERNAL int micropdf417(struct zint_symbol *symbol, unsigned char chaine[], int #endif /* Now get the RAP (Row Address Pattern) start values */ - LeftRAPStart = RAPTable[variant]; - CentreRAPStart = RAPTable[variant + 34]; - RightRAPStart = RAPTable[variant + 68]; - StartCluster = RAPTable[variant + 102] / 3; + LeftRAPStart = pdf_RAPTable[variant]; + CentreRAPStart = pdf_RAPTable[variant + 34]; + RightRAPStart = pdf_RAPTable[variant + 68]; + StartCluster = pdf_RAPTable[variant + 102] / 3; /* That's all values loaded, get on with the encoding */ @@ -1170,18 +1165,18 @@ INTERNAL int micropdf417(struct zint_symbol *symbol, unsigned char chaine[], int k = i * symbol->option_2; /* Copy the data into codebarre */ - bp = bin_append_posn(rap_side[LeftRAP - 1], 10, pattern, bp); + bp = bin_append_posn(pdf_rap_side[LeftRAP - 1], 10, pattern, bp); bp = bin_append_posn(pdf_bitpattern[offset + chainemc[k]], 16, pattern, bp); pattern[bp++] = '0'; if (symbol->option_2 >= 2) { if (symbol->option_2 == 3) { - bp = bin_append_posn(rap_centre[CentreRAP - 1], 10, pattern, bp); + bp = bin_append_posn(pdf_rap_centre[CentreRAP - 1], 10, pattern, bp); } bp = bin_append_posn(pdf_bitpattern[offset + chainemc[k + 1]], 16, pattern, bp); pattern[bp++] = '0'; if (symbol->option_2 >= 3) { if (symbol->option_2 == 4) { - bp = bin_append_posn(rap_centre[CentreRAP - 1], 10, pattern, bp); + bp = bin_append_posn(pdf_rap_centre[CentreRAP - 1], 10, pattern, bp); } bp = bin_append_posn(pdf_bitpattern[offset + chainemc[k + 2]], 16, pattern, bp); pattern[bp++] = '0'; @@ -1191,7 +1186,7 @@ INTERNAL int micropdf417(struct zint_symbol *symbol, unsigned char chaine[], int } } } - bp = bin_append_posn(rap_side[RightRAP - 1], 10, pattern, bp); + bp = bin_append_posn(pdf_rap_side[RightRAP - 1], 10, pattern, bp); pattern[bp++] = '1'; /* stop */ if (debug_print) printf("%.*s\n", bp, pattern); @@ -1232,3 +1227,7 @@ INTERNAL int micropdf417(struct zint_symbol *symbol, unsigned char chaine[], int return error_number; } + +#undef TEX +#undef BYT +#undef NUM diff --git a/backend/pdf417.h b/backend/pdf417.h index accde93a..19b8e650 100644 --- a/backend/pdf417.h +++ b/backend/pdf417.h @@ -1,4 +1,4 @@ -/* pdf417.h - PDF417 tables and coefficients */ +/* pdf417.h - PDF417 tables and coefficients declarations */ /* libzint - the open source barcode library @@ -30,485 +30,34 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* vim: set ts=4 sw=4 et : */ -/* this file contains the character table, the pre-calculated coefficients and the - codeword patterns taken from lines 416 to 454 of pdf417.frm */ +/* See "pdf417_tabs.h" for table definitions */ #ifndef __PDF417_H #define __PDF417_H /* PDF417 error correction coefficients from Grand Zebu */ -static const unsigned short int coefrs[1022] = { - /* k = 2 */ - 27, 917, +INTERNAL_DATA_EXTERN const unsigned short pdf_coefrs[1022]; - /* k = 4 */ - 522, 568, 723, 809, - - /* k = 8 */ - 237, 308, 436, 284, 646, 653, 428, 379, - - /* k = 16 */ - 274, 562, 232, 755, 599, 524, 801, 132, 295, 116, 442, 428, 295, 42, 176, 65, - - /* k = 32 */ - 361, 575, 922, 525, 176, 586, 640, 321, 536, 742, 677, 742, 687, 284, 193, 517, - 273, 494, 263, 147, 593, 800, 571, 320, 803, 133, 231, 390, 685, 330, 63, 410, - - /* k = 64 */ - 539, 422, 6, 93, 862, 771, 453, 106, 610, 287, 107, 505, 733, 877, 381, 612, - 723, 476, 462, 172, 430, 609, 858, 822, 543, 376, 511, 400, 672, 762, 283, 184, - 440, 35, 519, 31, 460, 594, 225, 535, 517, 352, 605, 158, 651, 201, 488, 502, - 648, 733, 717, 83, 404, 97, 280, 771, 840, 629, 4, 381, 843, 623, 264, 543, - - /* k = 128 */ - 521, 310, 864, 547, 858, 580, 296, 379, 53, 779, 897, 444, 400, 925, 749, 415, - 822, 93, 217, 208, 928, 244, 583, 620, 246, 148, 447, 631, 292, 908, 490, 704, - 516, 258, 457, 907, 594, 723, 674, 292, 272, 96, 684, 432, 686, 606, 860, 569, - 193, 219, 129, 186, 236, 287, 192, 775, 278, 173, 40, 379, 712, 463, 646, 776, - 171, 491, 297, 763, 156, 732, 95, 270, 447, 90, 507, 48, 228, 821, 808, 898, - 784, 663, 627, 378, 382, 262, 380, 602, 754, 336, 89, 614, 87, 432, 670, 616, - 157, 374, 242, 726, 600, 269, 375, 898, 845, 454, 354, 130, 814, 587, 804, 34, - 211, 330, 539, 297, 827, 865, 37, 517, 834, 315, 550, 86, 801, 4, 108, 539, - - /* k = 256 */ - 524, 894, 75, 766, 882, 857, 74, 204, 82, 586, 708, 250, 905, 786, 138, 720, - 858, 194, 311, 913, 275, 190, 375, 850, 438, 733, 194, 280, 201, 280, 828, 757, - 710, 814, 919, 89, 68, 569, 11, 204, 796, 605, 540, 913, 801, 700, 799, 137, - 439, 418, 592, 668, 353, 859, 370, 694, 325, 240, 216, 257, 284, 549, 209, 884, - 315, 70, 329, 793, 490, 274, 877, 162, 749, 812, 684, 461, 334, 376, 849, 521, - 307, 291, 803, 712, 19, 358, 399, 908, 103, 511, 51, 8, 517, 225, 289, 470, - 637, 731, 66, 255, 917, 269, 463, 830, 730, 433, 848, 585, 136, 538, 906, 90, - 2, 290, 743, 199, 655, 903, 329, 49, 802, 580, 355, 588, 188, 462, 10, 134, - 628, 320, 479, 130, 739, 71, 263, 318, 374, 601, 192, 605, 142, 673, 687, 234, - 722, 384, 177, 752, 607, 640, 455, 193, 689, 707, 805, 641, 48, 60, 732, 621, - 895, 544, 261, 852, 655, 309, 697, 755, 756, 60, 231, 773, 434, 421, 726, 528, - 503, 118, 49, 795, 32, 144, 500, 238, 836, 394, 280, 566, 319, 9, 647, 550, - 73, 914, 342, 126, 32, 681, 331, 792, 620, 60, 609, 441, 180, 791, 893, 754, - 605, 383, 228, 749, 760, 213, 54, 297, 134, 54, 834, 299, 922, 191, 910, 532, - 609, 829, 189, 20, 167, 29, 872, 449, 83, 402, 41, 656, 505, 579, 481, 173, - 404, 251, 688, 95, 497, 555, 642, 543, 307, 159, 924, 558, 648, 55, 497, 10, - - /* k = 512 */ - 352, 77, 373, 504, 35, 599, 428, 207, 409, 574, 118, 498, 285, 380, 350, 492, - 197, 265, 920, 155, 914, 299, 229, 643, 294, 871, 306, 88, 87, 193, 352, 781, - 846, 75, 327, 520, 435, 543, 203, 666, 249, 346, 781, 621, 640, 268, 794, 534, - 539, 781, 408, 390, 644, 102, 476, 499, 290, 632, 545, 37, 858, 916, 552, 41, - 542, 289, 122, 272, 383, 800, 485, 98, 752, 472, 761, 107, 784, 860, 658, 741, - 290, 204, 681, 407, 855, 85, 99, 62, 482, 180, 20, 297, 451, 593, 913, 142, - 808, 684, 287, 536, 561, 76, 653, 899, 729, 567, 744, 390, 513, 192, 516, 258, - 240, 518, 794, 395, 768, 848, 51, 610, 384, 168, 190, 826, 328, 596, 786, 303, - 570, 381, 415, 641, 156, 237, 151, 429, 531, 207, 676, 710, 89, 168, 304, 402, - 40, 708, 575, 162, 864, 229, 65, 861, 841, 512, 164, 477, 221, 92, 358, 785, - 288, 357, 850, 836, 827, 736, 707, 94, 8, 494, 114, 521, 2, 499, 851, 543, - 152, 729, 771, 95, 248, 361, 578, 323, 856, 797, 289, 51, 684, 466, 533, 820, - 669, 45, 902, 452, 167, 342, 244, 173, 35, 463, 651, 51, 699, 591, 452, 578, - 37, 124, 298, 332, 552, 43, 427, 119, 662, 777, 475, 850, 764, 364, 578, 911, - 283, 711, 472, 420, 245, 288, 594, 394, 511, 327, 589, 777, 699, 688, 43, 408, - 842, 383, 721, 521, 560, 644, 714, 559, 62, 145, 873, 663, 713, 159, 672, 729, - 624, 59, 193, 417, 158, 209, 563, 564, 343, 693, 109, 608, 563, 365, 181, 772, - 677, 310, 248, 353, 708, 410, 579, 870, 617, 841, 632, 860, 289, 536, 35, 777, - 618, 586, 424, 833, 77, 597, 346, 269, 757, 632, 695, 751, 331, 247, 184, 45, - 787, 680, 18, 66, 407, 369, 54, 492, 228, 613, 830, 922, 437, 519, 644, 905, - 789, 420, 305, 441, 207, 300, 892, 827, 141, 537, 381, 662, 513, 56, 252, 341, - 242, 797, 838, 837, 720, 224, 307, 631, 61, 87, 560, 310, 756, 665, 397, 808, - 851, 309, 473, 795, 378, 31, 647, 915, 459, 806, 590, 731, 425, 216, 548, 249, - 321, 881, 699, 535, 673, 782, 210, 815, 905, 303, 843, 922, 281, 73, 469, 791, - 660, 162, 498, 308, 155, 422, 907, 817, 187, 62, 16, 425, 535, 336, 286, 437, - 375, 273, 610, 296, 183, 923, 116, 667, 751, 353, 62, 366, 691, 379, 687, 842, - 37, 357, 720, 742, 330, 5, 39, 923, 311, 424, 242, 749, 321, 54, 669, 316, - 342, 299, 534, 105, 667, 488, 640, 672, 576, 540, 316, 486, 721, 610, 46, 656, - 447, 171, 616, 464, 190, 531, 297, 321, 762, 752, 533, 175, 134, 14, 381, 433, - 717, 45, 111, 20, 596, 284, 736, 138, 646, 411, 877, 669, 141, 919, 45, 780, - 407, 164, 332, 899, 165, 726, 600, 325, 498, 655, 357, 752, 768, 223, 849, 647, - 63, 310, 863, 251, 366, 304, 282, 738, 675, 410, 389, 244, 31, 121, 303, 263 -}; - -static const unsigned short int pdf_bitpattern[2787] = { - 0xEAE0, 0xF578, 0xFABE, 0xEA70, 0xF53C, 0xFA9F, 0xD460, 0xEA38, 0xD430, 0xA820, - 0xD418, 0xA810, 0xD6E0, 0xEB78, 0xF5BE, 0xD670, 0xEB3C, 0xF59F, 0xAC60, 0xD638, - 0xAC30, 0xAEE0, 0xD778, 0xEBBE, 0xAE70, 0xD73C, 0xEB9F, 0xAE38, 0xD71E, 0xAF78, - 0xD7BE, 0xAF3C, 0xD79F, 0xAFBE, 0xFAFD, 0xE970, 0xF4BC, 0xFA5F, 0xD260, 0xE938, - 0xF49E, 0xD230, 0xE91C, 0xA420, 0xD218, 0xE90E, 0xA410, 0xD20C, 0xA408, 0xD370, - 0xE9BC, 0xF4DF, 0xA660, 0xD338, 0xE99E, 0xA630, 0xD31C, 0xE98F, 0xA618, 0xD30E, - 0xA770, 0xD3BC, 0xE9DF, 0xA738, 0xD39E, 0xA71C, 0xD38F, 0xA7BC, 0xD3DF, 0xA79E, - 0xA78F, 0xD160, 0xE8B8, 0xF45E, 0xD130, 0xE89C, 0xF44F, 0xA220, 0xD118, 0xE88E, - 0xA210, 0xD10C, 0xA208, 0xA204, 0xA360, 0xD1B8, 0xE8DE, 0xA330, 0xD19C, 0xE8CF, - 0xA318, 0xD18E, 0xA30C, 0xA306, 0xA3B8, 0xD1DE, 0xA39C, 0xD1CF, 0xA38E, 0xA3DE, - 0xD0B0, 0xE85C, 0xF42F, 0xA120, 0xD098, 0xE84E, 0xA110, 0xD08C, 0xE847, 0xA108, - 0xD086, 0xA104, 0xD083, 0xA1B0, 0xD0DC, 0xE86F, 0xA198, 0xD0CE, 0xA18C, 0xD0C7, - 0xA186, 0xA183, 0xD0EF, 0xA1C7, 0xA0A0, 0xD058, 0xE82E, 0xA090, 0xD04C, 0xE827, - 0xA088, 0xD046, 0xA084, 0xD043, 0xA082, 0xA0D8, 0xA0CC, 0xA0C6, 0xA050, 0xE817, - 0xD026, 0xD023, 0xA041, 0xE570, 0xF2BC, 0xF95F, 0xCA60, 0xE538, 0xF29E, 0xCA30, - 0xE51C, 0xF28F, 0x9420, 0xCA18, 0x9410, 0xCB70, 0xE5BC, 0xF2DF, 0x9660, 0xCB38, - 0xE59E, 0x9630, 0xCB1C, 0x9618, 0x960C, 0x9770, 0xCBBC, 0xE5DF, 0x9738, 0xCB9E, - 0x971C, 0x970E, 0x97BC, 0xCBDF, 0x979E, 0x97DF, 0xED60, 0xF6B8, 0xFB5E, 0xED30, - 0xF69C, 0xFB4F, 0xDA20, 0xED18, 0xF68E, 0xDA10, 0xED0C, 0xF687, 0xDA08, 0xED06, - 0xC960, 0xE4B8, 0xF25E, 0xDB60, 0xC930, 0xE49C, 0xF24F, 0xDB30, 0xED9C, 0xF6CF, - 0xB620, 0x9210, 0xC90C, 0xE487, 0xB610, 0xDB0C, 0xB608, 0x9360, 0xC9B8, 0xE4DE, - 0xB760, 0x9330, 0xC99C, 0xE4CF, 0xB730, 0xDB9C, 0xEDCF, 0xB718, 0x930C, 0xB70C, - 0x93B8, 0xC9DE, 0xB7B8, 0x939C, 0xC9CF, 0xB79C, 0xDBCF, 0xB78E, 0x93DE, 0xB7DE, - 0x93CF, 0xB7CF, 0xECB0, 0xF65C, 0xFB2F, 0xD920, 0xEC98, 0xF64E, 0xD910, 0xEC8C, - 0xF647, 0xD908, 0xEC86, 0xD904, 0xD902, 0xC8B0, 0xE45C, 0xF22F, 0xD9B0, 0xC898, - 0xE44E, 0xB320, 0x9110, 0xECCE, 0xE447, 0xB310, 0x9108, 0xC886, 0xB308, 0xD986, - 0xC883, 0x9102, 0x91B0, 0xC8DC, 0xE46F, 0xB3B0, 0x9198, 0xC8CE, 0xB398, 0xD9CE, - 0xC8C7, 0xB38C, 0x9186, 0x9183, 0x91DC, 0xC8EF, 0xB3DC, 0x91CE, 0xB3CE, 0x91C7, - 0xB3C7, 0xB3EF, 0xD8A0, 0xEC58, 0xF62E, 0xD890, 0xEC4C, 0xF627, 0xD888, 0xEC46, - 0xD884, 0xEC43, 0xD882, 0xD881, 0x90A0, 0xC858, 0xE42E, 0xB1A0, 0x9090, 0xC84C, - 0xE427, 0xB190, 0xD8CC, 0xEC67, 0xB188, 0x9084, 0xC843, 0xB184, 0xD8C3, 0xB182, - 0x90D8, 0xC86E, 0xB1D8, 0x90CC, 0xC867, 0xB1CC, 0xD8E7, 0xB1C6, 0x90C3, 0xB1C3, - 0xB1EE, 0xB1E7, 0xD850, 0xEC2C, 0xF617, 0xD848, 0xEC26, 0xD844, 0xEC23, 0xD842, - 0xD841, 0x9050, 0xC82C, 0xE417, 0xB0D0, 0x9048, 0xC826, 0xB0C8, 0xD866, 0xC823, - 0xB0C4, 0x9042, 0xB0C2, 0x9041, 0x906C, 0xB0EC, 0xB0E6, 0xB0E3, 0xEC16, 0xEC13, - 0xD821, 0xC816, 0x9024, 0xB064, 0xB062, 0xB061, 0xC560, 0xE2B8, 0xF15E, 0xC530, - 0xE29C, 0x8A20, 0xC518, 0xE28E, 0x8A10, 0xC50C, 0x8A08, 0x8A04, 0x8B60, 0xC5B8, - 0xE2DE, 0x8B30, 0xC59C, 0xE2CF, 0x8B18, 0xC58E, 0x8B0C, 0x8B06, 0x8BB8, 0xC5DE, - 0x8B9C, 0xC5CF, 0x8B8E, 0x8BDE, 0x8BCF, 0xE6B0, 0xF35C, 0xF9AF, 0xCD20, 0xE698, - 0xF34E, 0xCD10, 0xE68C, 0xF347, 0xCD08, 0xE686, 0xCD04, 0xE683, 0xC4B0, 0xE25C, - 0xF12F, 0xCDB0, 0xC498, 0xE24E, 0x9B20, 0x8910, 0xE6CE, 0xE247, 0x9B10, 0xCD8C, - 0xC486, 0x9B08, 0x8904, 0x9B04, 0x89B0, 0xC4DC, 0xE26F, 0x9BB0, 0x8998, 0xE6EF, - 0x9B98, 0xCDCE, 0xC4C7, 0x9B8C, 0x8986, 0x9B86, 0x89DC, 0xC4EF, 0x9BDC, 0x89CE, - 0x9BCE, 0x89C7, 0x89EF, 0x9BEF, 0xEEA0, 0xF758, 0xFBAE, 0xEE90, 0xF74C, 0xFBA7, - 0xEE88, 0xF746, 0xEE84, 0xF743, 0xEE82, 0xCCA0, 0xE658, 0xF32E, 0xDDA0, 0xCC90, - 0xF76E, 0xF327, 0xDD90, 0xEECC, 0xF767, 0xDD88, 0xCC84, 0xE643, 0xDD84, 0xEEC3, - 0xCC81, 0x88A0, 0xC458, 0xE22E, 0x99A0, 0x8890, 0xC44C, 0xE227, 0xBBA0, 0x9990, - 0xCCCC, 0xE667, 0xBB90, 0xDDCC, 0xEEE7, 0xC443, 0xBB88, 0x9984, 0xCCC3, 0xBB84, - 0x8881, 0x88D8, 0xC46E, 0x99D8, 0x88CC, 0xC467, 0xBBD8, 0x99CC, 0xCCE7, 0xBBCC, - 0xDDE7, 0x88C3, 0x99C3, 0x88EE, 0x99EE, 0x88E7, 0xBBEE, 0x99E7, 0xEE50, 0xF72C, - 0xFB97, 0xEE48, 0xF726, 0xEE44, 0xF723, 0xEE42, 0xEE41, 0xCC50, 0xE62C, 0xF317, - 0xDCD0, 0xCC48, 0xF737, 0xDCC8, 0xEE66, 0xE623, 0xDCC4, 0xCC42, 0xDCC2, 0xCC41, - 0xDCC1, 0x8850, 0xC42C, 0xE217, 0x98D0, 0x8848, 0xC426, 0xB9D0, 0x98C8, 0xCC66, - 0xC423, 0xB9C8, 0xDCE6, 0x8842, 0xB9C4, 0x98C2, 0x8841, 0x98C1, 0x886C, 0xC437, - 0x98EC, 0x8866, 0xB9EC, 0x98E6, 0x8863, 0xB9E6, 0x98E3, 0x8877, 0xB9F7, 0xEE28, - 0xF716, 0xEE24, 0xF713, 0xEE22, 0xEE21, 0xCC28, 0xE616, 0xDC68, 0xCC24, 0xE613, - 0xDC64, 0xEE33, 0xDC62, 0xCC21, 0xDC61, 0x8828, 0xC416, 0x9868, 0x8824, 0xC413, - 0xB8E8, 0x9864, 0xCC33, 0xB8E4, 0xDC73, 0x8821, 0xB8E2, 0x9861, 0xB8E1, 0x9876, - 0xB8F6, 0xB8F3, 0xF70B, 0xEE11, 0xE60B, 0xCC12, 0xCC11, 0x8814, 0x9834, 0xB874, - 0x8811, 0x9831, 0xC2B0, 0x8520, 0xC298, 0x8510, 0xC28C, 0xE147, 0x8508, 0xC286, - 0x8504, 0xC283, 0x85B0, 0xC2DC, 0xE16F, 0x8598, 0xC2CE, 0x858C, 0xC2C7, 0x8586, - 0x8583, 0x85DC, 0xC2EF, 0x85CE, 0x85C7, 0x85EF, 0xC6A0, 0xE358, 0xF1AE, 0xC690, - 0xE34C, 0xC688, 0xE346, 0xC684, 0xE343, 0xC682, 0x84A0, 0xC258, 0xE12E, 0x8DA0, - 0x8490, 0xE36E, 0xE127, 0x8D90, 0xC6CC, 0xE367, 0x8D88, 0x8484, 0xC243, 0x8D84, - 0xC6C3, 0x8481, 0x84D8, 0xC26E, 0x8DD8, 0x84CC, 0xC267, 0x8DCC, 0xC6E7, 0x8DC6, - 0x84C3, 0x84EE, 0x8DEE, 0x84E7, 0x8DE7, 0xE750, 0xF3AC, 0xF9D7, 0xE748, 0xF3A6, - 0xE744, 0xF3A3, 0xE742, 0xE741, 0xC650, 0xE32C, 0xCED0, 0xC648, 0xE326, 0xCEC8, - 0xE766, 0xE323, 0xCEC4, 0xC642, 0xCEC2, 0xC641, 0xCEC1, 0x8450, 0xC22C, 0x8CD0, - 0x8448, 0xE337, 0x9DD0, 0x8CC8, 0xC666, 0xC223, 0x9DC8, 0xCEE6, 0x8442, 0x9DC4, - 0x8CC2, 0x8441, 0x8CC1, 0x846C, 0xC237, 0x8CEC, 0x8466, 0x9DEC, 0x8CE6, 0x8463, - 0x9DE6, 0x8CE3, 0x8477, 0x8CF7, 0x9DF7, 0xF7A8, 0xFBD6, 0xF7A4, 0xFBD3, 0xF7A2, - 0xF7A1, 0xE728, 0xF396, 0xEF68, 0xF7B6, 0xF393, 0xEF64, 0xF7B3, 0xEF62, 0xE721, - 0xEF61, 0xC628, 0xE316, 0xCE68, 0xC624, 0xE313, 0xDEE8, 0xCE64, 0xE733, 0xDEE4, - 0xEF73, 0xC621, 0xDEE2, 0xCE61, 0xDEE1, 0x8428, 0xC216, 0x8C68, 0x8424, 0xC213, - 0x9CE8, 0x8C64, 0xC633, 0xBDE8, 0x9CE4, 0xCE73, 0x8421, 0xBDE4, 0xDEF3, 0x8C61, - 0xBDE2, 0x8436, 0x8C76, 0x8433, 0x9CF6, 0x8C73, 0xBDF6, 0x9CF3, 0xBDF3, 0xF794, - 0xFBCB, 0xF792, 0xF791, 0xE714, 0xF38B, 0xEF34, 0xF79B, 0xEF32, 0xE711, 0xEF31, - 0xC614, 0xE30B, 0xCE34, 0xC612, 0xDE74, 0xCE32, 0xC611, 0xDE72, 0xCE31, 0xDE71, - 0x8414, 0xC20B, 0x8C34, 0xC61B, 0x9C74, 0x8C32, 0x8411, 0xBCF4, 0x9C72, 0x8C31, - 0xBCF2, 0x9C71, 0xBCF1, 0x8C3B, 0xBCFB, 0xF789, 0xEF1A, 0xEF19, 0xCE1A, 0xDE3A, - 0xDE39, 0x8C1A, 0x9C3A, 0xBC7A, 0xBC79, 0x82A0, 0x8290, 0xC14C, 0x8288, 0x8284, - 0x8282, 0x82D8, 0x82CC, 0x82C6, 0x82C3, 0x82EE, 0x82E7, 0xC350, 0xC348, 0xE1A6, - 0xC344, 0xE1A3, 0xC342, 0xC341, 0x8250, 0xC12C, 0x86D0, 0xC36C, 0xC126, 0x86C8, - 0xC366, 0x86C4, 0xC363, 0x86C2, 0x8241, 0x86C1, 0x826C, 0xC137, 0x86EC, 0xC377, - 0x86E6, 0x8263, 0x86E3, 0x8277, 0x86F7, 0xE3A8, 0xE3A4, 0xE3A2, 0xE3A1, 0xC328, - 0xC768, 0xE3B6, 0xE193, 0xC764, 0xE3B3, 0xC762, 0xC321, 0xC761, 0x8228, 0x8668, - 0x8224, 0xC113, 0x8EE8, 0x8664, 0x8222, 0x8EE4, 0x8662, 0x8221, 0x8EE2, 0x8661, - 0x8236, 0x8676, 0x8233, 0x8EF6, 0x8673, 0x8EF3, 0xF3D4, 0xF3D2, 0xF3D1, 0xE394, - 0xE7B4, 0xF3DB, 0xE7B2, 0xE391, 0xE7B1, 0xC314, 0xE18B, 0xC734, 0xE39B, 0xCF74, - 0xC732, 0xC311, 0xCF72, 0xC731, 0xCF71, 0x8214, 0xC10B, 0x8634, 0xC31B, 0x8E74, - 0x8632, 0x8211, 0x9EF4, 0x8E72, 0x8631, 0x9EF2, 0x8E71, 0x821B, 0x863B, 0x8E7B, - 0x9EFB, 0xFBEA, 0xFBE9, 0xF3CA, 0xF7DA, 0xF3C9, 0xF7D9, 0xE38A, 0xE79A, 0xE389, - 0xEFBA, 0xE799, 0xEFB9, 0xC30A, 0xC71A, 0xC309, 0xCF3A, 0xC719, 0xDF7A, 0xFAB0, - 0xFD5C, 0xF520, 0xFA98, 0xFD4E, 0xF510, 0xFA8C, 0xFD47, 0xF508, 0xFA86, 0xF504, - 0xFA83, 0xF502, 0xF5B0, 0xFADC, 0xFD6F, 0xEB20, 0xF598, 0xFACE, 0xEB10, 0xF58C, - 0xFAC7, 0xEB08, 0xF586, 0xEB04, 0xF583, 0xEB02, 0xEBB0, 0xF5DC, 0xFAEF, 0xD720, - 0xEB98, 0xF5CE, 0xD710, 0xEB8C, 0xF5C7, 0xD708, 0xEB86, 0xD704, 0xEB83, 0xD702, - 0xD7B0, 0xEBDC, 0xF5EF, 0xAF20, 0xD798, 0xEBCE, 0xAF10, 0xD78C, 0xEBC7, 0xAF08, - 0xD786, 0xAF04, 0xD783, 0xAFB0, 0xD7DC, 0xEBEF, 0xAF98, 0xD7CE, 0xAF8C, 0xD7C7, - 0xAF86, 0xAFDC, 0xD7EF, 0xAFCE, 0xAFC7, 0xF4A0, 0xFA58, 0xFD2E, 0xF490, 0xFA4C, - 0xFD27, 0xF488, 0xFA46, 0xF484, 0xFA43, 0xF482, 0xF481, 0xE9A0, 0xF4D8, 0xFA6E, - 0xE990, 0xF4CC, 0xFA67, 0xE988, 0xF4C6, 0xE984, 0xF4C3, 0xE982, 0xE981, 0xD3A0, - 0xE9D8, 0xF4EE, 0xD390, 0xE9CC, 0xF4E7, 0xD388, 0xE9C6, 0xD384, 0xE9C3, 0xD382, - 0xD381, 0xA7A0, 0xD3D8, 0xE9EE, 0xA790, 0xD3CC, 0xE9E7, 0xA788, 0xD3C6, 0xA784, - 0xD3C3, 0xA782, 0xA7D8, 0xD3EE, 0xA7CC, 0xD3E7, 0xA7C6, 0xA7C3, 0xA7EE, 0xA7E7, - 0xF450, 0xFA2C, 0xFD17, 0xF448, 0xFA26, 0xF444, 0xFA23, 0xF442, 0xF441, 0xE8D0, - 0xF46C, 0xFA37, 0xE8C8, 0xF466, 0xE8C4, 0xF463, 0xE8C2, 0xE8C1, 0xD1D0, 0xE8EC, - 0xF477, 0xD1C8, 0xE8E6, 0xD1C4, 0xE8E3, 0xD1C2, 0xD1C1, 0xA3D0, 0xD1EC, 0xE8F7, - 0xA3C8, 0xD1E6, 0xA3C4, 0xD1E3, 0xA3C2, 0xA3C1, 0xA3EC, 0xD1F7, 0xA3E6, 0xA3E3, - 0xA3F7, 0xF428, 0xFA16, 0xF424, 0xFA13, 0xF422, 0xF421, 0xE868, 0xF436, 0xE864, - 0xF433, 0xE862, 0xE861, 0xD0E8, 0xE876, 0xD0E4, 0xE873, 0xD0E2, 0xD0E1, 0xA1E8, - 0xD0F6, 0xA1E4, 0xD0F3, 0xA1E2, 0xA1E1, 0xA1F6, 0xA1F3, 0xF414, 0xFA0B, 0xF412, - 0xF411, 0xE834, 0xF41B, 0xE832, 0xE831, 0xD074, 0xE83B, 0xD072, 0xD071, 0xA0F4, - 0xD07B, 0xA0F2, 0xA0F1, 0xF40A, 0xF409, 0xE81A, 0xE819, 0xD03A, 0xD039, 0xF2A0, - 0xF958, 0xFCAE, 0xF290, 0xF94C, 0xFCA7, 0xF288, 0xF946, 0xF284, 0xF943, 0xF282, - 0xF281, 0xE5A0, 0xF2D8, 0xF96E, 0xE590, 0xF2CC, 0xF967, 0xE588, 0xF2C6, 0xE584, - 0xF2C3, 0xE582, 0xE581, 0xCBA0, 0xE5D8, 0xF2EE, 0xCB90, 0xE5CC, 0xF2E7, 0xCB88, - 0xE5C6, 0xCB84, 0xE5C3, 0xCB82, 0xCB81, 0x97A0, 0xCBD8, 0xE5EE, 0x9790, 0xCBCC, - 0xE5E7, 0x9788, 0xCBC6, 0x9784, 0xCBC3, 0x9782, 0x97D8, 0xCBEE, 0x97CC, 0xCBE7, - 0x97C6, 0x97C3, 0x97EE, 0x97E7, 0xFB50, 0xFDAC, 0xB5F8, 0xFB48, 0xFDA6, 0xB4FC, - 0xFB44, 0xFDA3, 0xB47E, 0xFB42, 0xFB41, 0xF250, 0xF92C, 0xFC97, 0xF6D0, 0xF248, - 0xFDB7, 0xF6C8, 0xFB66, 0xF923, 0xF6C4, 0xF242, 0xF6C2, 0xF241, 0xF6C1, 0xE4D0, - 0xF26C, 0xF937, 0xEDD0, 0xE4C8, 0xF266, 0xEDC8, 0xF6E6, 0xF263, 0xEDC4, 0xE4C2, - 0xEDC2, 0xE4C1, 0xEDC1, 0xC9D0, 0xE4EC, 0xF277, 0xDBD0, 0xC9C8, 0xE4E6, 0xDBC8, - 0xEDE6, 0xE4E3, 0xDBC4, 0xC9C2, 0xDBC2, 0xC9C1, 0xDBC1, 0x93D0, 0xC9EC, 0xE4F7, - 0xB7D0, 0x93C8, 0xC9E6, 0xB7C8, 0xDBE6, 0xC9E3, 0xB7C4, 0x93C2, 0xB7C2, 0x93C1, - 0x93EC, 0xC9F7, 0xB7EC, 0x93E6, 0xB7E6, 0x93E3, 0xB7E3, 0x93F7, 0xFB28, 0xFD96, - 0xB2FC, 0xFB24, 0xFD93, 0xB27E, 0xFB22, 0xB23F, 0xFB21, 0xF228, 0xF916, 0xF668, - 0xF224, 0xF913, 0xF664, 0xFB33, 0xF662, 0xF221, 0xF661, 0xE468, 0xF236, 0xECE8, - 0xE464, 0xF233, 0xECE4, 0xF673, 0xECE2, 0xE461, 0xECE1, 0xC8E8, 0xE476, 0xD9E8, - 0xC8E4, 0xE473, 0xD9E4, 0xECF3, 0xD9E2, 0xC8E1, 0xD9E1, 0x91E8, 0xC8F6, 0xB3E8, - 0x91E4, 0xC8F3, 0xB3E4, 0xD9F3, 0xB3E2, 0x91E1, 0xB3E1, 0x91F6, 0xB3F6, 0x91F3, - 0xB3F3, 0xFB14, 0xFD8B, 0xB17E, 0xFB12, 0xB13F, 0xFB11, 0xF214, 0xF90B, 0xF634, - 0xFB1B, 0xF632, 0xF211, 0xF631, 0xE434, 0xF21B, 0xEC74, 0xE432, 0xEC72, 0xE431, - 0xEC71, 0xC874, 0xE43B, 0xD8F4, 0xEC7B, 0xD8F2, 0xC871, 0xD8F1, 0x90F4, 0xC87B, - 0xB1F4, 0x90F2, 0xB1F2, 0x90F1, 0xB1F1, 0x90FB, 0xB1FB, 0xFB0A, 0xB0BF, 0xFB09, - 0xF20A, 0xF61A, 0xF209, 0xF619, 0xE41A, 0xEC3A, 0xE419, 0xEC39, 0xC83A, 0xD87A, - 0xC839, 0xD879, 0x907A, 0xB0FA, 0x9079, 0xB0F9, 0xFB05, 0xF205, 0xF60D, 0xE40D, - 0xEC1D, 0xC81D, 0xD83D, 0xF150, 0xF8AC, 0xFC57, 0xF148, 0xF8A6, 0xF144, 0xF8A3, - 0xF142, 0xF141, 0xE2D0, 0xF16C, 0xF8B7, 0xE2C8, 0xF166, 0xE2C4, 0xF163, 0xE2C2, - 0xE2C1, 0xC5D0, 0xE2EC, 0xF177, 0xC5C8, 0xE2E6, 0xC5C4, 0xE2E3, 0xC5C2, 0xC5C1, - 0x8BD0, 0xC5EC, 0xE2F7, 0x8BC8, 0xC5E6, 0x8BC4, 0xC5E3, 0x8BC2, 0x8BC1, 0x8BEC, - 0xC5F7, 0x8BE6, 0x8BE3, 0x8BF7, 0xF9A8, 0xFCD6, 0x9AFC, 0xF9A4, 0xFCD3, 0x9A7E, - 0xF9A2, 0x9A3F, 0xF9A1, 0xF128, 0xF896, 0xF368, 0xF124, 0xF893, 0xF364, 0xF9B3, - 0xF362, 0xF121, 0xF361, 0xE268, 0xF136, 0xE6E8, 0xE264, 0xF133, 0xE6E4, 0xF373, - 0xE6E2, 0xE261, 0xE6E1, 0xC4E8, 0xE276, 0xCDE8, 0xC4E4, 0xE273, 0xCDE4, 0xE6F3, - 0xCDE2, 0xC4E1, 0xCDE1, 0x89E8, 0xC4F6, 0x9BE8, 0x89E4, 0xC4F3, 0x9BE4, 0xCDF3, - 0x9BE2, 0x89E1, 0x9BE1, 0x89F6, 0x9BF6, 0x89F3, 0x9BF3, 0xFDD4, 0xBAF8, 0xDD7E, - 0xFDD2, 0xBA7C, 0xDD3F, 0xFDD1, 0xBA3E, 0xBA1F, 0xF994, 0xFCCB, 0x997E, 0xFBB4, - 0xFDDB, 0xBB7E, 0x993F, 0xFBB2, 0xF991, 0xBB3F, 0xFBB1, 0xF114, 0xF88B, 0xF334, - 0xF112, 0xF774, 0xFBBB, 0xF111, 0xF772, 0xF331, 0xF771, 0xE234, 0xF11B, 0xE674, - 0xE232, 0xEEF4, 0xE672, 0xE231, 0xEEF2, 0xE671, 0xEEF1, 0xC474, 0xE23B, 0xCCF4, - 0xC472, 0xDDF4, 0xCCF2, 0xC471, 0xDDF2, 0xCCF1, 0xDDF1, 0x88F4, 0xC47B, 0x99F4, - 0x88F2, 0xBBF4, 0x99F2, 0x88F1, 0xBBF2, 0x99F1, 0xBBF1, 0x88FB, 0x99FB, 0xFDCA, - 0xB97C, 0xDCBF, 0xFDC9, 0xB93E, 0xB91F, 0xF98A, 0x98BF, 0xFB9A, 0xF989, 0xB9BF, - 0xFB99, 0xF10A, 0xF31A, 0xF109, 0xF73A, 0xF319, 0xF739, 0xE21A, 0xE63A, 0xE219, - 0xEE7A, 0xE639, 0xEE79, 0xC43A, 0xCC7A, 0xC439, 0xDCFA, 0xCC79, 0xDCF9, 0x887A, - 0x98FA, 0x8879, 0xB9FA, 0x98F9, 0xB9F9, 0xFDC5, 0xB8BE, 0xB89F, 0xF985, 0xFB8D, - 0xF105, 0xF30D, 0xF71D, 0xE20D, 0xE61D, 0xEE3D, 0xC41D, 0xCC3D, 0xDC7D, 0x883D, - 0x987D, 0xB8FD, 0xB85F, 0xF0A8, 0xF856, 0xF0A4, 0xF853, 0xF0A2, 0xF0A1, 0xE168, - 0xF0B6, 0xE164, 0xF0B3, 0xE162, 0xE161, 0xC2E8, 0xE176, 0xC2E4, 0xE173, 0xC2E2, - 0xC2E1, 0x85E8, 0xC2F6, 0x85E4, 0xC2F3, 0x85E2, 0x85E1, 0x85F6, 0x85F3, 0xF8D4, - 0xFC6B, 0x8D7E, 0xF8D2, 0x8D3F, 0xF8D1, 0xF094, 0xF84B, 0xF1B4, 0xF092, 0xF1B2, - 0xF091, 0xF1B1, 0xE134, 0xF09B, 0xE374, 0xE132, 0xE372, 0xE131, 0xE371, 0xC274, - 0xE13B, 0xC6F4, 0xC272, 0xC6F2, 0xC271, 0xC6F1, 0x84F4, 0xC27B, 0x8DF4, 0x84F2, - 0x8DF2, 0x84F1, 0x8DF1, 0x84FB, 0x8DFB, 0xFCEA, 0x9D7C, 0xCEBF, 0xFCE9, 0x9D3E, - 0x9D1F, 0xF8CA, 0x8CBF, 0xF9DA, 0xF8C9, 0x9DBF, 0xF9D9, 0xF08A, 0xF19A, 0xF089, - 0xF3BA, 0xF199, 0xF3B9, 0xE11A, 0xE33A, 0xE119, 0xE77A, 0xE339, 0xE779, 0xC23A, - 0xC67A, 0xC239, 0xCEFA, 0xC679, 0xCEF9, 0x847A, 0x8CFA, 0x8479, 0x9DFA, 0x8CF9, - 0x9DF9, 0xBD78, 0xDEBE, 0xBD3C, 0xDE9F, 0xBD1E, 0xBD0F, 0xFCE5, 0x9CBE, 0xFDED, - 0xBDBE, 0x9C9F, 0xBD9F, 0xF8C5, 0xF9CD, 0xFBDD, 0xF085, 0xF18D, 0xF39D, 0xF7BD, - 0xE10D, 0xE31D, 0xE73D, 0xEF7D, 0xC21D, 0xC63D, 0xCE7D, 0xDEFD, 0x843D, 0x8C7D, - 0x9CFD, 0xBCBC, 0xDE5F, 0xBC9E, 0xBC8F, 0x9C5F, 0xBCDF, 0xBC5E, 0xBC4F, 0xBC2F, - 0xF054, 0xF052, 0xF051, 0xE0B4, 0xF05B, 0xE0B2, 0xE0B1, 0xC174, 0xE0BB, 0xC172, - 0xC171, 0x82F4, 0xC17B, 0x82F2, 0x82F1, 0x82FB, 0xF86A, 0x86BF, 0xF869, 0xF04A, - 0xF0DA, 0xF049, 0xF0D9, 0xE09A, 0xE1BA, 0xE099, 0xE1B9, 0xC13A, 0xC37A, 0xC139, - 0xC379, 0x827A, 0x86FA, 0x8279, 0x86F9, 0xFC75, 0x8EBE, 0x8E9F, 0xF865, 0xF8ED, - 0xF045, 0xF0CD, 0xF1DD, 0xE08D, 0xE19D, 0xE3BD, 0xC11D, 0xC33D, 0xC77D, 0x823D, - 0x867D, 0x8EFD, 0x9EBC, 0xCF5F, 0x9E9E, 0x9E8F, 0x8E5F, 0x9EDF, 0xBEB8, 0xDF5E, - 0xBE9C, 0xDF4F, 0xBE8E, 0xBE87, 0x9E5E, 0xBEDE, 0x9E4F, 0xBECF, 0xBE5C, 0xDF2F, - 0xBE4E, 0xBE47, 0x9E2F, 0xBE6F, 0xBE2E, 0xBE27, 0xBE17, 0xE05A, 0xE059, 0xC0BA, - 0xC0B9, 0x817A, 0x8179, 0xF06D, 0xE04D, 0xE0DD, 0xC09D, 0xC1BD, 0x813D, 0x837D, - 0x875F, 0x8F5E, 0x8F4F, 0x9F5C, 0xCFAF, 0x9F4E, 0x9F47, 0x8F2F, 0x9F6F, 0xBF58, - 0xDFAE, 0xBF4C, 0xDFA7, 0xBF46, 0xBF43, 0x9F2E, 0xBF6E, 0x9F27, 0xBF67, 0xBF2C, - 0xDF97, 0xBF26, 0xBF23, 0x9F17, 0xBF37, 0xBF16, 0xBF13, 0x87AF, 0x8FAE, 0x8FA7, - 0x9FAC, 0xCFD7, 0x9FA6, 0x9FA3, 0x8F97, 0x9FB7, 0x9F96, 0x9F93, 0xD5F0, 0xEAFC, - 0xA9E0, 0xD4F8, 0xEA7E, 0xA8F0, 0xD47C, 0xEA3F, 0xA878, 0xD43E, 0xA83C, 0xFD68, - 0xADF0, 0xD6FC, 0xFD64, 0xACF8, 0xD67E, 0xFD62, 0xAC7C, 0xD63F, 0xFD61, 0xAC3E, - 0xFAE8, 0xFD76, 0xAEFC, 0xFAE4, 0xFD73, 0xAE7E, 0xFAE2, 0xAE3F, 0xFAE1, 0xF5E8, - 0xFAF6, 0xF5E4, 0xFAF3, 0xF5E2, 0xF5E1, 0xEBE8, 0xF5F6, 0xEBE4, 0xF5F3, 0xEBE2, - 0xEBE1, 0xD7E8, 0xEBF6, 0xD7E4, 0xEBF3, 0xD7E2, 0xA5E0, 0xD2F8, 0xE97E, 0xA4F0, - 0xD27C, 0xE93F, 0xA478, 0xD23E, 0xA43C, 0xD21F, 0xA41E, 0xFD34, 0xA6F8, 0xD37E, - 0xFD32, 0xA67C, 0xD33F, 0xFD31, 0xA63E, 0xA61F, 0xFA74, 0xFD3B, 0xA77E, 0xFA72, - 0xA73F, 0xFA71, 0xF4F4, 0xFA7B, 0xF4F2, 0xF4F1, 0xE9F4, 0xF4FB, 0xE9F2, 0xE9F1, - 0xD3F4, 0xE9FB, 0xD3F2, 0xD3F1, 0xA2F0, 0xD17C, 0xE8BF, 0xA278, 0xD13E, 0xA23C, - 0xD11F, 0xA21E, 0xA20F, 0xFD1A, 0xA37C, 0xD1BF, 0xFD19, 0xA33E, 0xA31F, 0xFA3A, - 0xA3BF, 0xFA39, 0xF47A, 0xF479, 0xE8FA, 0xE8F9, 0xD1FA, 0xD1F9, 0xA178, 0xD0BE, - 0xA13C, 0xD09F, 0xA11E, 0xA10F, 0xFD0D, 0xA1BE, 0xA19F, 0xFA1D, 0xF43D, 0xE87D, - 0xA0BC, 0xD05F, 0xA09E, 0xA08F, 0xA0DF, 0xA05E, 0xA04F, 0x95E0, 0xCAF8, 0xE57E, - 0x94F0, 0xCA7C, 0xE53F, 0x9478, 0xCA3E, 0x943C, 0xCA1F, 0x941E, 0xFCB4, 0x96F8, - 0xCB7E, 0xFCB2, 0x967C, 0xCB3F, 0xFCB1, 0x963E, 0x961F, 0xF974, 0xFCBB, 0x977E, - 0xF972, 0x973F, 0xF971, 0xF2F4, 0xF97B, 0xF2F2, 0xF2F1, 0xE5F4, 0xF2FB, 0xE5F2, - 0xE5F1, 0xCBF4, 0xE5FB, 0xCBF2, 0xCBF1, 0xDAF0, 0xED7C, 0xF6BF, 0xB4E0, 0xDA78, - 0xED3E, 0xB470, 0xDA3C, 0xED1F, 0xB438, 0xDA1E, 0xB41C, 0xDA0F, 0xB40E, 0x92F0, - 0xC97C, 0xE4BF, 0xB6F0, 0x9278, 0xC93E, 0xB678, 0xDB3E, 0xC91F, 0xB63C, 0x921E, - 0xB61E, 0x920F, 0xB60F, 0xFC9A, 0x937C, 0xC9BF, 0xFDBA, 0xFC99, 0xB77C, 0x933E, - 0xFDB9, 0xB73E, 0x931F, 0xB71F, 0xF93A, 0x93BF, 0xFB7A, 0xF939, 0xB7BF, 0xFB79, - 0xF27A, 0xF6FA, 0xF279, 0xF6F9, 0xE4FA, 0xEDFA, 0xE4F9, 0xEDF9, 0xC9FA, 0xC9F9, - 0xB2E0, 0xD978, 0xECBE, 0xB270, 0xD93C, 0xEC9F, 0xB238, 0xD91E, 0xB21C, 0xD90F, - 0xB20E, 0xB207, 0x9178, 0xC8BE, 0xB378, 0x913C, 0xC89F, 0xB33C, 0xD99F, 0xB31E, - 0x910F, 0xB30F, 0xFC8D, 0x91BE, 0xFD9D, 0xB3BE, 0x919F, 0xB39F, 0xF91D, 0xFB3D, - 0xF23D, 0xF67D, 0xE47D, 0xECFD, 0xC8FD, 0xB170, 0xD8BC, 0xEC5F, 0xB138, 0xD89E, - 0xB11C, 0xD88F, 0xB10E, 0xB107, 0x90BC, 0xC85F, 0xB1BC, 0x909E, 0xB19E, 0x908F, - 0xB18F, 0x90DF, 0xB1DF, 0xB0B8, 0xD85E, 0xB09C, 0xD84F, 0xB08E, 0xB087, 0x905E, - 0xB0DE, 0x904F, 0xB0CF, 0xB05C, 0xD82F, 0xB04E, 0xB047, 0x902F, 0xB06F, 0xB02E, - 0xB027, 0x8AF0, 0xC57C, 0xE2BF, 0x8A78, 0xC53E, 0x8A3C, 0xC51F, 0x8A1E, 0x8A0F, - 0xFC5A, 0x8B7C, 0xC5BF, 0xFC59, 0x8B3E, 0x8B1F, 0xF8BA, 0x8BBF, 0xF8B9, 0xF17A, - 0xF179, 0xE2FA, 0xE2F9, 0xC5FA, 0xC5F9, 0x9AE0, 0xCD78, 0xE6BE, 0x9A70, 0xCD3C, - 0xE69F, 0x9A38, 0xCD1E, 0x9A1C, 0xCD0F, 0x9A0E, 0x9A07, 0x8978, 0xC4BE, 0x9B78, - 0x893C, 0xC49F, 0x9B3C, 0xCD9F, 0x9B1E, 0x890F, 0x9B0F, 0xFC4D, 0x89BE, 0xFCDD, - 0x9BBE, 0x899F, 0x9B9F, 0xF89D, 0xF9BD, 0xF13D, 0xF37D, 0xE27D, 0xE6FD, 0xC4FD, - 0xDD70, 0xEEBC, 0xF75F, 0xBA60, 0xDD38, 0xEE9E, 0xBA30, 0xDD1C, 0xEE8F, 0xBA18, - 0xDD0E, 0xBA0C, 0xDD07, 0xBA06, 0x9970, 0xCCBC, 0xE65F, 0xBB70, 0x9938, 0xCC9E, - 0xBB38, 0xDD9E, 0xCC8F, 0xBB1C, 0x990E, 0xBB0E, 0x9907, 0xBB07, 0x88BC, 0xC45F, - 0x99BC, 0x889E, 0xBBBC, 0x999E, 0x888F, 0xBB9E, 0x998F, 0xBB8F, 0x88DF, 0x99DF, - 0xBBDF, 0xB960, 0xDCB8, 0xEE5E, 0xB930, 0xDC9C, 0xEE4F, 0xB918, 0xDC8E, 0xB90C, - 0xDC87, 0xB906, 0xB903, 0x98B8, 0xCC5E, 0xB9B8, 0x989C, 0xCC4F, 0xB99C, 0xDCCF, - 0xB98E, 0x9887, 0xB987, 0x885E, 0x98DE, 0x884F, 0xB9DE, 0x98CF, 0xB9CF, 0xB8B0, - 0xDC5C, 0xEE2F, 0xB898, 0xDC4E, 0xB88C, 0xDC47, 0xB886, 0xB883, 0x985C, 0xCC2F, - 0xB8DC, 0x984E, 0xB8CE, 0x9847, 0xB8C7, 0x882F, 0x986F, 0xB8EF, 0xB858, 0xDC2E, - 0xB84C, 0xDC27, 0xB846, 0xB843, 0x982E, 0xB86E, 0x9827, 0xB867, 0xB82C, 0xDC17, - 0xB826, 0xB823, 0x9817, 0xB837, 0xB816, 0xB813, 0x8578, 0xC2BE, 0x853C, 0xC29F, - 0x851E, 0x850F, 0x85BE, 0x859F, 0xF85D, 0xF0BD, 0xE17D, 0xC2FD, 0x8D70, 0xC6BC, - 0xE35F, 0x8D38, 0xC69E, 0x8D1C, 0xC68F, 0x8D0E, 0x8D07, 0x84BC, 0xC25F, 0x8DBC, - 0x849E, 0x8D9E, 0x848F, 0x8D8F, 0x84DF, 0x8DDF, 0x9D60, 0xCEB8, 0xE75E, 0x9D30, - 0xCE9C, 0xE74F, 0x9D18, 0xCE8E, 0x9D0C, 0xCE87, 0x9D06, 0x9D03, 0x8CB8, 0xC65E, - 0x9DB8, 0x8C9C, 0xC64F, 0x9D9C, 0x8C8E, 0x9D8E, 0x8C87, 0x9D87, 0x845E, 0x8CDE, - 0x844F, 0x9DDE, 0x8CCF, 0x9DCF, 0xDEB0, 0xEF5C, 0xF7AF, 0xBD20, 0xDE98, 0xEF4E, - 0xBD10, 0xDE8C, 0xEF47, 0xBD08, 0xDE86, 0xBD04, 0xDE83, 0xBD02, 0x9CB0, 0xCE5C, - 0xE72F, 0xBDB0, 0x9C98, 0xCE4E, 0xBD98, 0xDECE, 0xCE47, 0xBD8C, 0x9C86, 0xBD86, - 0x9C83, 0xBD83, 0x8C5C, 0xC62F, 0x9CDC, 0x8C4E, 0xBDDC, 0x9CCE, 0x8C47, 0xBDCE, - 0x9CC7, 0xBDC7, 0x842F, 0x8C6F, 0x9CEF, 0xBDEF, 0xBCA0, 0xDE58, 0xEF2E, 0xBC90, - 0xDE4C, 0xEF27, 0xBC88, 0xDE46, 0xBC84, 0xDE43, 0xBC82, 0xBC81, 0x9C58, 0xCE2E, - 0xBCD8, 0x9C4C, 0xCE27, 0xBCCC, 0xDE67, 0xBCC6, 0x9C43, 0xBCC3, 0x8C2E, 0x9C6E, - 0x8C27, 0xBCEE, 0x9C67, 0xBCE7, 0xBC50, 0xDE2C, 0xEF17, 0xBC48, 0xDE26, 0xBC44, - 0xDE23, 0xBC42, 0xBC41, 0x9C2C, 0xCE17, 0xBC6C, 0x9C26, 0xBC66, 0x9C23, 0xBC63, - 0x8C17, 0x9C37, 0xBC77, 0xBC28, 0xDE16, 0xBC24, 0xDE13, 0xBC22, 0xBC21, 0x9C16, - 0xBC36, 0x9C13, 0xBC33, 0xBC14, 0xDE0B, 0xBC12, 0xBC11, 0x9C0B, 0xBC1B, 0x82BC, - 0xC15F, 0x829E, 0x828F, 0x82DF, 0x86B8, 0xC35E, 0x869C, 0xC34F, 0x868E, 0x8687, - 0x825E, 0x86DE, 0x824F, 0x86CF, 0x8EB0, 0xC75C, 0xE3AF, 0x8E98, 0xC74E, 0x8E8C, - 0xC747, 0x8E86, 0x8E83, 0x865C, 0xC32F, 0x8EDC, 0x864E, 0x8ECE, 0x8647, 0x8EC7, - 0x822F, 0x866F, 0x8EEF, 0x9EA0, 0xCF58, 0xE7AE, 0x9E90, 0xCF4C, 0xE7A7, 0x9E88, - 0xCF46, 0x9E84, 0xCF43, 0x9E82, 0x9E81, 0x8E58, 0xC72E, 0x9ED8, 0x8E4C, 0xC727, - 0x9ECC, 0xCF67, 0x9EC6, 0x8E43, 0x9EC3, 0x862E, 0x8E6E, 0x8627, 0x9EEE, 0x8E67, - 0x9EE7, 0xDF50, 0xEFAC, 0xF7D7, 0xDF48, 0xEFA6, 0xDF44, 0xEFA3, 0xDF42, 0xDF41, - 0x9E50, 0xCF2C, 0xE797, 0xBED0, 0x9E48, 0xCF26, 0xBEC8, 0xDF66, 0xCF23, 0xBEC4, - 0x9E42, 0xBEC2, 0x9E41, 0xBEC1, 0x8E2C, 0xC717, 0x9E6C, 0x8E26, 0xBEEC, 0x9E66, - 0x8E23, 0xBEE6, 0x9E63, 0xBEE3, 0x8617, 0x8E37, 0x9E77, 0xBEF7, 0xDF28, 0xEF96, - 0xDF24, 0xEF93, 0xDF22, 0xDF21, 0x9E28, 0xCF16, 0xBE68, 0x9E24, 0xCF13, 0xBE64, - 0xDF33, 0xBE62, 0x9E21, 0xBE61, 0x8E16, 0x9E36, 0x8E13, 0xBE76, 0x9E33, 0xBE73, - 0xDF14, 0xEF8B, 0xDF12, 0xDF11, 0x9E14, 0xCF0B, 0xBE34, 0x9E12, 0xBE32, 0x9E11, - 0xBE31, 0x8E0B, 0x9E1B, 0xBE3B, 0xDF0A, 0xDF09, 0x9E0A, 0xBE1A, 0x9E09, 0xBE19, - 0x815E, 0x814F, 0x835C, 0xC1AF, 0x834E, 0x8347, 0x812F, 0x836F, 0x8758, 0xC3AE, - 0x874C, 0xC3A7, 0x8746, 0x8743, 0x832E, 0x876E, 0x8327, 0x8767, 0x8F50, 0xC7AC, - 0xE3D7, 0x8F48, 0xC7A6, 0x8F44, 0xC7A3, 0x8F42, 0x8F41, 0x872C, 0xC397, 0x8F6C, - 0xC7B7, 0x8F66, 0x8723, 0x8F63, 0x8317, 0x8737, 0x8F77, 0xCFA8, 0xE7D6, 0xCFA4, - 0xE7D3, 0xCFA2, 0xCFA1, 0x8F28, 0xC796, 0x9F68, 0xCFB6, 0xC793, 0x9F64, 0x8F22, - 0x9F62, 0x8F21, 0x9F61, 0x8716, 0x8F36, 0x8713, 0x9F76, 0x8F33, 0x9F73, 0xEFD4, - 0xF7EB, 0xEFD2, 0xEFD1, 0xCF94, 0xE7CB, 0xDFB4, 0xCF92, 0xDFB2, 0xCF91, 0xDFB1, - 0x8F14, 0xC78B, 0x9F34, 0x8F12, 0xBF74, 0x9F32, 0x8F11, 0xBF72, 0x9F31, 0xBF71, - 0x870B, 0x8F1B, 0x9F3B, 0xBF7B, 0xEFCA, 0xEFC9, 0xCF8A, 0xDF9A, 0xCF89, 0xDF99, - 0x8F0A, 0x9F1A, 0x8F09, 0xBF3A, 0x9F19, 0xBF39, 0xEFC5, 0xCF85, 0xDF8D, 0x8F05, - 0x9F0D, 0xBF1D, 0x81AE, 0x81A7, 0x83AC, 0xC1D7, 0x83A6, 0x83A3, 0x8197, 0x83B7, - 0x87A8, 0xC3D6, 0x87A4, 0xC3D3, 0x87A2, 0x87A1, 0x8396, 0x87B6, 0x8393, 0x87B3, - 0xC7D4, 0xE3EB, 0xC7D2, 0xC7D1, 0x8794, 0xC3CB, 0x8FB4, 0xC7DB, 0x8FB2, 0x8791, - 0x8FB1, 0x838B, 0x879B, 0x8FBB, 0xE7EA, 0xE7E9, 0xC7CA, 0xCFDA, 0xC7C9, 0xCFD9, - 0x878A, 0x8F9A, 0x8789, 0x9FBA, 0x8F99, 0x9FB9, 0xE7E5, 0xC7C5, 0xCFCD, 0x8785, - 0x8F8D, 0x9F9D, 0x81D6, 0x81D3, 0x83D4, 0xC1EB, 0x83D2, 0x83D1, 0x81CB, 0x83DB, - 0xC3EA, 0xC3E9, 0x83CA, 0x87DA, 0x83C9, 0x87D9, 0xE3F5 -}; +INTERNAL_DATA_EXTERN const unsigned short pdf_bitpattern[2787]; /* MicroPDF417 coefficients from ISO/IEC 24728:2006 Annex F */ -static const unsigned short int Microcoeffs[344] = { - /* k = 7 */ - 76, 925, 537, 597, 784, 691, 437, - - /* k = 8 */ - 237, 308, 436, 284, 646, 653, 428, 379, - - /* k = 9 */ - 567, 527, 622, 257, 289, 362, 501, 441, 205, - - /* k = 10 */ - 377, 457, 64, 244, 826, 841, 818, 691, 266, 612, - - /* k = 11 */ - 462, 45, 565, 708, 825, 213, 15, 68, 327, 602, 904, - - /* k = 12 */ - 597, 864, 757, 201, 646, 684, 347, 127, 388, 7, 69, 851, - - /* k = 13 */ - 764, 713, 342, 384, 606, 583, 322, 592, 678, 204, 184, 394, 692, - - /* k = 14 */ - 669, 677, 154, 187, 241, 286, 274, 354, 478, 915, 691, 833, 105, 215, - - /* k = 15 */ - 460, 829, 476, 109, 904, 664, 230, 5, 80, 74, 550, 575, 147, 868, 642, - - /* k = 16 */ - 274, 562, 232, 755, 599, 524, 801, 132, 295, 116, 442, 428, 295, 42, 176, 65, - - /* k = 18 */ - 279, 577, 315, 624, 37, 855, 275, 739, 120, 297, 312, 202, 560, 321, 233, 756, - 760, 573, - - /* k = 21 */ - 108, 519, 781, 534, 129, 425, 681, 553, 422, 716, 763, 693, 624, 610, 310, 691, - 347, 165, 193, 259, 568, - - /* k = 26 */ - 443, 284, 887, 544, 788, 93, 477, 760, 331, 608, 269, 121, 159, 830, 446, 893, - 699, 245, 441, 454, 325, 858, 131, 847, 764, 169, - - /* k = 32 */ - 361, 575, 922, 525, 176, 586, 640, 321, 536, 742, 677, 742, 687, 284, 193, 517, - 273, 494, 263, 147, 593, 800, 571, 320, 803, 133, 231, 390, 685, 330, 63, 410, - - /* k = 38 */ - 234, 228, 438, 848, 133, 703, 529, 721, 788, 322, 280, 159, 738, 586, 388, 684, - 445, 680, 245, 595, 614, 233, 812, 32, 284, 658, 745, 229, 95, 689, 920, 771, - 554, 289, 231, 125, 117, 518, - - /* k = 44 */ - 476, 36, 659, 848, 678, 64, 764, 840, 157, 915, 470, 876, 109, 25, 632, 405, - 417, 436, 714, 60, 376, 97, 413, 706, 446, 21, 3, 773, 569, 267, 272, 213, - 31, 560, 231, 758, 103, 271, 572, 436, 339, 730, 82, 285, - - /* k = 50 */ - 923, 797, 576, 875, 156, 706, 63, 81, 257, 874, 411, 416, 778, 50, 205, 303, - 188, 535, 909, 155, 637, 230, 534, 96, 575, 102, 264, 233, 919, 593, 865, 26, - 579, 623, 766, 146, 10, 739, 246, 127, 71, 244, 211, 477, 920, 876, 427, 820, - 718, 435 -}; +INTERNAL_DATA_EXTERN const unsigned short pdf_Microcoeffs[344]; /* rows, columns, error codewords, k-offset of valid MicroPDF417 sizes from ISO/IEC 24728:2006 */ -static const unsigned short int MicroVariants[170] = { - 1, 1, 1, 1, 1, 1, 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, 4, 4, - 11, 14, 17, 20, 24, 28, 8, 11, 14, 17, 20, 23, 26, 6, 8, 10, 12, 15, 20, 26, 32, 38, 44, 4, 6, 8, 10, 12, 15, 20, 26, 32, 38, 44, - 7, 7, 7, 8, 8, 8, 8, 9, 9, 10, 11, 13, 15, 12, 14, 16, 18, 21, 26, 32, 38, 44, 50, 8, 12, 14, 16, 18, 21, 26, 32, 38, 44, 50, - 0, 0, 0, 7, 7, 7, 7, 15, 15, 24, 34, 57, 84, 45, 70, 99, 115, 133, 154, 180, 212, 250, 294, 7, 45, 70, 99, 115, 133, 154, 180, 212, 250, 294 -}; -/* rows, columns, error codewords, k-offset */ +INTERNAL_DATA_EXTERN const unsigned short pdf_MicroVariants[170]; /* following is Left RAP, Centre RAP, Right RAP and Start Cluster from ISO/IEC 24728:2006 tables 10, 11 and 12 */ -static const char RAPTable[136] = { - 1, 8, 36, 19, 9, 25, 1, 1, 8, 36, 19, 9, 27, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1, 47, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 25, 37, 17, 9, 29, 31, 25, 19, 1, 7, 15, 25, 37, 17, 9, 29, 31, 25, - 9, 8, 36, 19, 17, 33, 1, 9, 8, 36, 19, 17, 35, 1, 7, 15, 25, 37, 33, 17, 37, 47, 49, 43, 1, 7, 15, 25, 37, 33, 17, 37, 47, 49, - 0, 3, 6, 0, 6, 0, 0, 0, 3, 6, 0, 6, 6, 0, 0, 6, 0, 0, 0, 0, 6, 6, 0, 3, 0, 0, 6, 0, 0, 0, 0, 6, 6, 0 -}; +INTERNAL_DATA_EXTERN const char pdf_RAPTable[136]; /* Left and Right Row Address Pattern from Table 2 */ -static const unsigned short int rap_side[52] = { - 0x322, 0x3A2, 0x3B2, 0x332, 0x372, 0x37A, 0x33A, 0x3BA, 0x39A, 0x3DA, - 0x3CA, 0x38A, 0x30A, 0x31A, 0x312, 0x392, 0x3D2, 0x3D6, 0x3D4, 0x394, - 0x3B4, 0x3A4, 0x3A6, 0x3AE, 0x3AC, 0x3A8, 0x328, 0x32C, 0x32E, 0x326, - 0x336, 0x3B6, 0x396, 0x316, 0x314, 0x334, 0x374, 0x364, 0x366, 0x36E, - 0x36C, 0x368, 0x348, 0x358, 0x35C, 0x35E, 0x34E, 0x34C, 0x344, 0x346, - 0x342, 0x362 -}; +INTERNAL_DATA_EXTERN const unsigned short pdf_rap_side[52]; /* Centre Row Address Pattern from Table 2 */ -static const unsigned short int rap_centre[52] = { - 0x2CE, 0x24E, 0x26E, 0x22E, 0x226, 0x236, 0x216, 0x212, 0x21A, 0x23A, - 0x232, 0x222, 0x262, 0x272, 0x27A, 0x2FA, 0x2F2, 0x2F6, 0x276, 0x274, - 0x264, 0x266, 0x246, 0x242, 0x2C2, 0x2E2, 0x2E6, 0x2E4, 0x2EC, 0x26C, - 0x22C, 0x228, 0x268, 0x2E8, 0x2C8, 0x2CC, 0x2C4, 0x2C6, 0x286, 0x28E, - 0x28C, 0x29C, 0x298, 0x2B8, 0x2B0, 0x290, 0x2D0, 0x250, 0x258, 0x25C, - 0x2DC, 0x2DE -}; +INTERNAL_DATA_EXTERN const unsigned short pdf_rap_centre[52]; -INTERNAL void byteprocess(int *chainemc, int *mclength, const unsigned char chaine[], int start, const int length, +INTERNAL void pdf_byteprocess(int *chainemc, int *mclength, const unsigned char chaine[], int start, const int length, const int debug); #endif /* __PDF417_H */ diff --git a/backend/pdf417_tabs.h b/backend/pdf417_tabs.h new file mode 100644 index 00000000..362568cc --- /dev/null +++ b/backend/pdf417_tabs.h @@ -0,0 +1,514 @@ +/* pdf417_tabs.h - PDF417 tables and coefficients */ + +/* + libzint - the open source barcode library + Copyright (C) 2008-2021 Robin Stuart + Portions Copyright (C) 2004 Grandzebu + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the project nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + */ +/* vim: set ts=4 sw=4 et : */ + +/* this file contains the character table, the pre-calculated coefficients and the + codeword patterns taken from lines 416 to 454 of pdf417.frm */ + +/* See "pdf417.h" for declarations */ + +#ifndef __PDF417_TABS_H +#define __PDF417_TABS_H + +/* PDF417 error correction coefficients from Grand Zebu */ +INTERNAL_DATA const unsigned short pdf_coefrs[1022] = { + /* k = 2 */ + 27, 917, + + /* k = 4 */ + 522, 568, 723, 809, + + /* k = 8 */ + 237, 308, 436, 284, 646, 653, 428, 379, + + /* k = 16 */ + 274, 562, 232, 755, 599, 524, 801, 132, 295, 116, 442, 428, 295, 42, 176, 65, + + /* k = 32 */ + 361, 575, 922, 525, 176, 586, 640, 321, 536, 742, 677, 742, 687, 284, 193, 517, + 273, 494, 263, 147, 593, 800, 571, 320, 803, 133, 231, 390, 685, 330, 63, 410, + + /* k = 64 */ + 539, 422, 6, 93, 862, 771, 453, 106, 610, 287, 107, 505, 733, 877, 381, 612, + 723, 476, 462, 172, 430, 609, 858, 822, 543, 376, 511, 400, 672, 762, 283, 184, + 440, 35, 519, 31, 460, 594, 225, 535, 517, 352, 605, 158, 651, 201, 488, 502, + 648, 733, 717, 83, 404, 97, 280, 771, 840, 629, 4, 381, 843, 623, 264, 543, + + /* k = 128 */ + 521, 310, 864, 547, 858, 580, 296, 379, 53, 779, 897, 444, 400, 925, 749, 415, + 822, 93, 217, 208, 928, 244, 583, 620, 246, 148, 447, 631, 292, 908, 490, 704, + 516, 258, 457, 907, 594, 723, 674, 292, 272, 96, 684, 432, 686, 606, 860, 569, + 193, 219, 129, 186, 236, 287, 192, 775, 278, 173, 40, 379, 712, 463, 646, 776, + 171, 491, 297, 763, 156, 732, 95, 270, 447, 90, 507, 48, 228, 821, 808, 898, + 784, 663, 627, 378, 382, 262, 380, 602, 754, 336, 89, 614, 87, 432, 670, 616, + 157, 374, 242, 726, 600, 269, 375, 898, 845, 454, 354, 130, 814, 587, 804, 34, + 211, 330, 539, 297, 827, 865, 37, 517, 834, 315, 550, 86, 801, 4, 108, 539, + + /* k = 256 */ + 524, 894, 75, 766, 882, 857, 74, 204, 82, 586, 708, 250, 905, 786, 138, 720, + 858, 194, 311, 913, 275, 190, 375, 850, 438, 733, 194, 280, 201, 280, 828, 757, + 710, 814, 919, 89, 68, 569, 11, 204, 796, 605, 540, 913, 801, 700, 799, 137, + 439, 418, 592, 668, 353, 859, 370, 694, 325, 240, 216, 257, 284, 549, 209, 884, + 315, 70, 329, 793, 490, 274, 877, 162, 749, 812, 684, 461, 334, 376, 849, 521, + 307, 291, 803, 712, 19, 358, 399, 908, 103, 511, 51, 8, 517, 225, 289, 470, + 637, 731, 66, 255, 917, 269, 463, 830, 730, 433, 848, 585, 136, 538, 906, 90, + 2, 290, 743, 199, 655, 903, 329, 49, 802, 580, 355, 588, 188, 462, 10, 134, + 628, 320, 479, 130, 739, 71, 263, 318, 374, 601, 192, 605, 142, 673, 687, 234, + 722, 384, 177, 752, 607, 640, 455, 193, 689, 707, 805, 641, 48, 60, 732, 621, + 895, 544, 261, 852, 655, 309, 697, 755, 756, 60, 231, 773, 434, 421, 726, 528, + 503, 118, 49, 795, 32, 144, 500, 238, 836, 394, 280, 566, 319, 9, 647, 550, + 73, 914, 342, 126, 32, 681, 331, 792, 620, 60, 609, 441, 180, 791, 893, 754, + 605, 383, 228, 749, 760, 213, 54, 297, 134, 54, 834, 299, 922, 191, 910, 532, + 609, 829, 189, 20, 167, 29, 872, 449, 83, 402, 41, 656, 505, 579, 481, 173, + 404, 251, 688, 95, 497, 555, 642, 543, 307, 159, 924, 558, 648, 55, 497, 10, + + /* k = 512 */ + 352, 77, 373, 504, 35, 599, 428, 207, 409, 574, 118, 498, 285, 380, 350, 492, + 197, 265, 920, 155, 914, 299, 229, 643, 294, 871, 306, 88, 87, 193, 352, 781, + 846, 75, 327, 520, 435, 543, 203, 666, 249, 346, 781, 621, 640, 268, 794, 534, + 539, 781, 408, 390, 644, 102, 476, 499, 290, 632, 545, 37, 858, 916, 552, 41, + 542, 289, 122, 272, 383, 800, 485, 98, 752, 472, 761, 107, 784, 860, 658, 741, + 290, 204, 681, 407, 855, 85, 99, 62, 482, 180, 20, 297, 451, 593, 913, 142, + 808, 684, 287, 536, 561, 76, 653, 899, 729, 567, 744, 390, 513, 192, 516, 258, + 240, 518, 794, 395, 768, 848, 51, 610, 384, 168, 190, 826, 328, 596, 786, 303, + 570, 381, 415, 641, 156, 237, 151, 429, 531, 207, 676, 710, 89, 168, 304, 402, + 40, 708, 575, 162, 864, 229, 65, 861, 841, 512, 164, 477, 221, 92, 358, 785, + 288, 357, 850, 836, 827, 736, 707, 94, 8, 494, 114, 521, 2, 499, 851, 543, + 152, 729, 771, 95, 248, 361, 578, 323, 856, 797, 289, 51, 684, 466, 533, 820, + 669, 45, 902, 452, 167, 342, 244, 173, 35, 463, 651, 51, 699, 591, 452, 578, + 37, 124, 298, 332, 552, 43, 427, 119, 662, 777, 475, 850, 764, 364, 578, 911, + 283, 711, 472, 420, 245, 288, 594, 394, 511, 327, 589, 777, 699, 688, 43, 408, + 842, 383, 721, 521, 560, 644, 714, 559, 62, 145, 873, 663, 713, 159, 672, 729, + 624, 59, 193, 417, 158, 209, 563, 564, 343, 693, 109, 608, 563, 365, 181, 772, + 677, 310, 248, 353, 708, 410, 579, 870, 617, 841, 632, 860, 289, 536, 35, 777, + 618, 586, 424, 833, 77, 597, 346, 269, 757, 632, 695, 751, 331, 247, 184, 45, + 787, 680, 18, 66, 407, 369, 54, 492, 228, 613, 830, 922, 437, 519, 644, 905, + 789, 420, 305, 441, 207, 300, 892, 827, 141, 537, 381, 662, 513, 56, 252, 341, + 242, 797, 838, 837, 720, 224, 307, 631, 61, 87, 560, 310, 756, 665, 397, 808, + 851, 309, 473, 795, 378, 31, 647, 915, 459, 806, 590, 731, 425, 216, 548, 249, + 321, 881, 699, 535, 673, 782, 210, 815, 905, 303, 843, 922, 281, 73, 469, 791, + 660, 162, 498, 308, 155, 422, 907, 817, 187, 62, 16, 425, 535, 336, 286, 437, + 375, 273, 610, 296, 183, 923, 116, 667, 751, 353, 62, 366, 691, 379, 687, 842, + 37, 357, 720, 742, 330, 5, 39, 923, 311, 424, 242, 749, 321, 54, 669, 316, + 342, 299, 534, 105, 667, 488, 640, 672, 576, 540, 316, 486, 721, 610, 46, 656, + 447, 171, 616, 464, 190, 531, 297, 321, 762, 752, 533, 175, 134, 14, 381, 433, + 717, 45, 111, 20, 596, 284, 736, 138, 646, 411, 877, 669, 141, 919, 45, 780, + 407, 164, 332, 899, 165, 726, 600, 325, 498, 655, 357, 752, 768, 223, 849, 647, + 63, 310, 863, 251, 366, 304, 282, 738, 675, 410, 389, 244, 31, 121, 303, 263 +}; + +INTERNAL_DATA const unsigned short pdf_bitpattern[2787] = { + 0xEAE0, 0xF578, 0xFABE, 0xEA70, 0xF53C, 0xFA9F, 0xD460, 0xEA38, 0xD430, 0xA820, + 0xD418, 0xA810, 0xD6E0, 0xEB78, 0xF5BE, 0xD670, 0xEB3C, 0xF59F, 0xAC60, 0xD638, + 0xAC30, 0xAEE0, 0xD778, 0xEBBE, 0xAE70, 0xD73C, 0xEB9F, 0xAE38, 0xD71E, 0xAF78, + 0xD7BE, 0xAF3C, 0xD79F, 0xAFBE, 0xFAFD, 0xE970, 0xF4BC, 0xFA5F, 0xD260, 0xE938, + 0xF49E, 0xD230, 0xE91C, 0xA420, 0xD218, 0xE90E, 0xA410, 0xD20C, 0xA408, 0xD370, + 0xE9BC, 0xF4DF, 0xA660, 0xD338, 0xE99E, 0xA630, 0xD31C, 0xE98F, 0xA618, 0xD30E, + 0xA770, 0xD3BC, 0xE9DF, 0xA738, 0xD39E, 0xA71C, 0xD38F, 0xA7BC, 0xD3DF, 0xA79E, + 0xA78F, 0xD160, 0xE8B8, 0xF45E, 0xD130, 0xE89C, 0xF44F, 0xA220, 0xD118, 0xE88E, + 0xA210, 0xD10C, 0xA208, 0xA204, 0xA360, 0xD1B8, 0xE8DE, 0xA330, 0xD19C, 0xE8CF, + 0xA318, 0xD18E, 0xA30C, 0xA306, 0xA3B8, 0xD1DE, 0xA39C, 0xD1CF, 0xA38E, 0xA3DE, + 0xD0B0, 0xE85C, 0xF42F, 0xA120, 0xD098, 0xE84E, 0xA110, 0xD08C, 0xE847, 0xA108, + 0xD086, 0xA104, 0xD083, 0xA1B0, 0xD0DC, 0xE86F, 0xA198, 0xD0CE, 0xA18C, 0xD0C7, + 0xA186, 0xA183, 0xD0EF, 0xA1C7, 0xA0A0, 0xD058, 0xE82E, 0xA090, 0xD04C, 0xE827, + 0xA088, 0xD046, 0xA084, 0xD043, 0xA082, 0xA0D8, 0xA0CC, 0xA0C6, 0xA050, 0xE817, + 0xD026, 0xD023, 0xA041, 0xE570, 0xF2BC, 0xF95F, 0xCA60, 0xE538, 0xF29E, 0xCA30, + 0xE51C, 0xF28F, 0x9420, 0xCA18, 0x9410, 0xCB70, 0xE5BC, 0xF2DF, 0x9660, 0xCB38, + 0xE59E, 0x9630, 0xCB1C, 0x9618, 0x960C, 0x9770, 0xCBBC, 0xE5DF, 0x9738, 0xCB9E, + 0x971C, 0x970E, 0x97BC, 0xCBDF, 0x979E, 0x97DF, 0xED60, 0xF6B8, 0xFB5E, 0xED30, + 0xF69C, 0xFB4F, 0xDA20, 0xED18, 0xF68E, 0xDA10, 0xED0C, 0xF687, 0xDA08, 0xED06, + 0xC960, 0xE4B8, 0xF25E, 0xDB60, 0xC930, 0xE49C, 0xF24F, 0xDB30, 0xED9C, 0xF6CF, + 0xB620, 0x9210, 0xC90C, 0xE487, 0xB610, 0xDB0C, 0xB608, 0x9360, 0xC9B8, 0xE4DE, + 0xB760, 0x9330, 0xC99C, 0xE4CF, 0xB730, 0xDB9C, 0xEDCF, 0xB718, 0x930C, 0xB70C, + 0x93B8, 0xC9DE, 0xB7B8, 0x939C, 0xC9CF, 0xB79C, 0xDBCF, 0xB78E, 0x93DE, 0xB7DE, + 0x93CF, 0xB7CF, 0xECB0, 0xF65C, 0xFB2F, 0xD920, 0xEC98, 0xF64E, 0xD910, 0xEC8C, + 0xF647, 0xD908, 0xEC86, 0xD904, 0xD902, 0xC8B0, 0xE45C, 0xF22F, 0xD9B0, 0xC898, + 0xE44E, 0xB320, 0x9110, 0xECCE, 0xE447, 0xB310, 0x9108, 0xC886, 0xB308, 0xD986, + 0xC883, 0x9102, 0x91B0, 0xC8DC, 0xE46F, 0xB3B0, 0x9198, 0xC8CE, 0xB398, 0xD9CE, + 0xC8C7, 0xB38C, 0x9186, 0x9183, 0x91DC, 0xC8EF, 0xB3DC, 0x91CE, 0xB3CE, 0x91C7, + 0xB3C7, 0xB3EF, 0xD8A0, 0xEC58, 0xF62E, 0xD890, 0xEC4C, 0xF627, 0xD888, 0xEC46, + 0xD884, 0xEC43, 0xD882, 0xD881, 0x90A0, 0xC858, 0xE42E, 0xB1A0, 0x9090, 0xC84C, + 0xE427, 0xB190, 0xD8CC, 0xEC67, 0xB188, 0x9084, 0xC843, 0xB184, 0xD8C3, 0xB182, + 0x90D8, 0xC86E, 0xB1D8, 0x90CC, 0xC867, 0xB1CC, 0xD8E7, 0xB1C6, 0x90C3, 0xB1C3, + 0xB1EE, 0xB1E7, 0xD850, 0xEC2C, 0xF617, 0xD848, 0xEC26, 0xD844, 0xEC23, 0xD842, + 0xD841, 0x9050, 0xC82C, 0xE417, 0xB0D0, 0x9048, 0xC826, 0xB0C8, 0xD866, 0xC823, + 0xB0C4, 0x9042, 0xB0C2, 0x9041, 0x906C, 0xB0EC, 0xB0E6, 0xB0E3, 0xEC16, 0xEC13, + 0xD821, 0xC816, 0x9024, 0xB064, 0xB062, 0xB061, 0xC560, 0xE2B8, 0xF15E, 0xC530, + 0xE29C, 0x8A20, 0xC518, 0xE28E, 0x8A10, 0xC50C, 0x8A08, 0x8A04, 0x8B60, 0xC5B8, + 0xE2DE, 0x8B30, 0xC59C, 0xE2CF, 0x8B18, 0xC58E, 0x8B0C, 0x8B06, 0x8BB8, 0xC5DE, + 0x8B9C, 0xC5CF, 0x8B8E, 0x8BDE, 0x8BCF, 0xE6B0, 0xF35C, 0xF9AF, 0xCD20, 0xE698, + 0xF34E, 0xCD10, 0xE68C, 0xF347, 0xCD08, 0xE686, 0xCD04, 0xE683, 0xC4B0, 0xE25C, + 0xF12F, 0xCDB0, 0xC498, 0xE24E, 0x9B20, 0x8910, 0xE6CE, 0xE247, 0x9B10, 0xCD8C, + 0xC486, 0x9B08, 0x8904, 0x9B04, 0x89B0, 0xC4DC, 0xE26F, 0x9BB0, 0x8998, 0xE6EF, + 0x9B98, 0xCDCE, 0xC4C7, 0x9B8C, 0x8986, 0x9B86, 0x89DC, 0xC4EF, 0x9BDC, 0x89CE, + 0x9BCE, 0x89C7, 0x89EF, 0x9BEF, 0xEEA0, 0xF758, 0xFBAE, 0xEE90, 0xF74C, 0xFBA7, + 0xEE88, 0xF746, 0xEE84, 0xF743, 0xEE82, 0xCCA0, 0xE658, 0xF32E, 0xDDA0, 0xCC90, + 0xF76E, 0xF327, 0xDD90, 0xEECC, 0xF767, 0xDD88, 0xCC84, 0xE643, 0xDD84, 0xEEC3, + 0xCC81, 0x88A0, 0xC458, 0xE22E, 0x99A0, 0x8890, 0xC44C, 0xE227, 0xBBA0, 0x9990, + 0xCCCC, 0xE667, 0xBB90, 0xDDCC, 0xEEE7, 0xC443, 0xBB88, 0x9984, 0xCCC3, 0xBB84, + 0x8881, 0x88D8, 0xC46E, 0x99D8, 0x88CC, 0xC467, 0xBBD8, 0x99CC, 0xCCE7, 0xBBCC, + 0xDDE7, 0x88C3, 0x99C3, 0x88EE, 0x99EE, 0x88E7, 0xBBEE, 0x99E7, 0xEE50, 0xF72C, + 0xFB97, 0xEE48, 0xF726, 0xEE44, 0xF723, 0xEE42, 0xEE41, 0xCC50, 0xE62C, 0xF317, + 0xDCD0, 0xCC48, 0xF737, 0xDCC8, 0xEE66, 0xE623, 0xDCC4, 0xCC42, 0xDCC2, 0xCC41, + 0xDCC1, 0x8850, 0xC42C, 0xE217, 0x98D0, 0x8848, 0xC426, 0xB9D0, 0x98C8, 0xCC66, + 0xC423, 0xB9C8, 0xDCE6, 0x8842, 0xB9C4, 0x98C2, 0x8841, 0x98C1, 0x886C, 0xC437, + 0x98EC, 0x8866, 0xB9EC, 0x98E6, 0x8863, 0xB9E6, 0x98E3, 0x8877, 0xB9F7, 0xEE28, + 0xF716, 0xEE24, 0xF713, 0xEE22, 0xEE21, 0xCC28, 0xE616, 0xDC68, 0xCC24, 0xE613, + 0xDC64, 0xEE33, 0xDC62, 0xCC21, 0xDC61, 0x8828, 0xC416, 0x9868, 0x8824, 0xC413, + 0xB8E8, 0x9864, 0xCC33, 0xB8E4, 0xDC73, 0x8821, 0xB8E2, 0x9861, 0xB8E1, 0x9876, + 0xB8F6, 0xB8F3, 0xF70B, 0xEE11, 0xE60B, 0xCC12, 0xCC11, 0x8814, 0x9834, 0xB874, + 0x8811, 0x9831, 0xC2B0, 0x8520, 0xC298, 0x8510, 0xC28C, 0xE147, 0x8508, 0xC286, + 0x8504, 0xC283, 0x85B0, 0xC2DC, 0xE16F, 0x8598, 0xC2CE, 0x858C, 0xC2C7, 0x8586, + 0x8583, 0x85DC, 0xC2EF, 0x85CE, 0x85C7, 0x85EF, 0xC6A0, 0xE358, 0xF1AE, 0xC690, + 0xE34C, 0xC688, 0xE346, 0xC684, 0xE343, 0xC682, 0x84A0, 0xC258, 0xE12E, 0x8DA0, + 0x8490, 0xE36E, 0xE127, 0x8D90, 0xC6CC, 0xE367, 0x8D88, 0x8484, 0xC243, 0x8D84, + 0xC6C3, 0x8481, 0x84D8, 0xC26E, 0x8DD8, 0x84CC, 0xC267, 0x8DCC, 0xC6E7, 0x8DC6, + 0x84C3, 0x84EE, 0x8DEE, 0x84E7, 0x8DE7, 0xE750, 0xF3AC, 0xF9D7, 0xE748, 0xF3A6, + 0xE744, 0xF3A3, 0xE742, 0xE741, 0xC650, 0xE32C, 0xCED0, 0xC648, 0xE326, 0xCEC8, + 0xE766, 0xE323, 0xCEC4, 0xC642, 0xCEC2, 0xC641, 0xCEC1, 0x8450, 0xC22C, 0x8CD0, + 0x8448, 0xE337, 0x9DD0, 0x8CC8, 0xC666, 0xC223, 0x9DC8, 0xCEE6, 0x8442, 0x9DC4, + 0x8CC2, 0x8441, 0x8CC1, 0x846C, 0xC237, 0x8CEC, 0x8466, 0x9DEC, 0x8CE6, 0x8463, + 0x9DE6, 0x8CE3, 0x8477, 0x8CF7, 0x9DF7, 0xF7A8, 0xFBD6, 0xF7A4, 0xFBD3, 0xF7A2, + 0xF7A1, 0xE728, 0xF396, 0xEF68, 0xF7B6, 0xF393, 0xEF64, 0xF7B3, 0xEF62, 0xE721, + 0xEF61, 0xC628, 0xE316, 0xCE68, 0xC624, 0xE313, 0xDEE8, 0xCE64, 0xE733, 0xDEE4, + 0xEF73, 0xC621, 0xDEE2, 0xCE61, 0xDEE1, 0x8428, 0xC216, 0x8C68, 0x8424, 0xC213, + 0x9CE8, 0x8C64, 0xC633, 0xBDE8, 0x9CE4, 0xCE73, 0x8421, 0xBDE4, 0xDEF3, 0x8C61, + 0xBDE2, 0x8436, 0x8C76, 0x8433, 0x9CF6, 0x8C73, 0xBDF6, 0x9CF3, 0xBDF3, 0xF794, + 0xFBCB, 0xF792, 0xF791, 0xE714, 0xF38B, 0xEF34, 0xF79B, 0xEF32, 0xE711, 0xEF31, + 0xC614, 0xE30B, 0xCE34, 0xC612, 0xDE74, 0xCE32, 0xC611, 0xDE72, 0xCE31, 0xDE71, + 0x8414, 0xC20B, 0x8C34, 0xC61B, 0x9C74, 0x8C32, 0x8411, 0xBCF4, 0x9C72, 0x8C31, + 0xBCF2, 0x9C71, 0xBCF1, 0x8C3B, 0xBCFB, 0xF789, 0xEF1A, 0xEF19, 0xCE1A, 0xDE3A, + 0xDE39, 0x8C1A, 0x9C3A, 0xBC7A, 0xBC79, 0x82A0, 0x8290, 0xC14C, 0x8288, 0x8284, + 0x8282, 0x82D8, 0x82CC, 0x82C6, 0x82C3, 0x82EE, 0x82E7, 0xC350, 0xC348, 0xE1A6, + 0xC344, 0xE1A3, 0xC342, 0xC341, 0x8250, 0xC12C, 0x86D0, 0xC36C, 0xC126, 0x86C8, + 0xC366, 0x86C4, 0xC363, 0x86C2, 0x8241, 0x86C1, 0x826C, 0xC137, 0x86EC, 0xC377, + 0x86E6, 0x8263, 0x86E3, 0x8277, 0x86F7, 0xE3A8, 0xE3A4, 0xE3A2, 0xE3A1, 0xC328, + 0xC768, 0xE3B6, 0xE193, 0xC764, 0xE3B3, 0xC762, 0xC321, 0xC761, 0x8228, 0x8668, + 0x8224, 0xC113, 0x8EE8, 0x8664, 0x8222, 0x8EE4, 0x8662, 0x8221, 0x8EE2, 0x8661, + 0x8236, 0x8676, 0x8233, 0x8EF6, 0x8673, 0x8EF3, 0xF3D4, 0xF3D2, 0xF3D1, 0xE394, + 0xE7B4, 0xF3DB, 0xE7B2, 0xE391, 0xE7B1, 0xC314, 0xE18B, 0xC734, 0xE39B, 0xCF74, + 0xC732, 0xC311, 0xCF72, 0xC731, 0xCF71, 0x8214, 0xC10B, 0x8634, 0xC31B, 0x8E74, + 0x8632, 0x8211, 0x9EF4, 0x8E72, 0x8631, 0x9EF2, 0x8E71, 0x821B, 0x863B, 0x8E7B, + 0x9EFB, 0xFBEA, 0xFBE9, 0xF3CA, 0xF7DA, 0xF3C9, 0xF7D9, 0xE38A, 0xE79A, 0xE389, + 0xEFBA, 0xE799, 0xEFB9, 0xC30A, 0xC71A, 0xC309, 0xCF3A, 0xC719, 0xDF7A, 0xFAB0, + 0xFD5C, 0xF520, 0xFA98, 0xFD4E, 0xF510, 0xFA8C, 0xFD47, 0xF508, 0xFA86, 0xF504, + 0xFA83, 0xF502, 0xF5B0, 0xFADC, 0xFD6F, 0xEB20, 0xF598, 0xFACE, 0xEB10, 0xF58C, + 0xFAC7, 0xEB08, 0xF586, 0xEB04, 0xF583, 0xEB02, 0xEBB0, 0xF5DC, 0xFAEF, 0xD720, + 0xEB98, 0xF5CE, 0xD710, 0xEB8C, 0xF5C7, 0xD708, 0xEB86, 0xD704, 0xEB83, 0xD702, + 0xD7B0, 0xEBDC, 0xF5EF, 0xAF20, 0xD798, 0xEBCE, 0xAF10, 0xD78C, 0xEBC7, 0xAF08, + 0xD786, 0xAF04, 0xD783, 0xAFB0, 0xD7DC, 0xEBEF, 0xAF98, 0xD7CE, 0xAF8C, 0xD7C7, + 0xAF86, 0xAFDC, 0xD7EF, 0xAFCE, 0xAFC7, 0xF4A0, 0xFA58, 0xFD2E, 0xF490, 0xFA4C, + 0xFD27, 0xF488, 0xFA46, 0xF484, 0xFA43, 0xF482, 0xF481, 0xE9A0, 0xF4D8, 0xFA6E, + 0xE990, 0xF4CC, 0xFA67, 0xE988, 0xF4C6, 0xE984, 0xF4C3, 0xE982, 0xE981, 0xD3A0, + 0xE9D8, 0xF4EE, 0xD390, 0xE9CC, 0xF4E7, 0xD388, 0xE9C6, 0xD384, 0xE9C3, 0xD382, + 0xD381, 0xA7A0, 0xD3D8, 0xE9EE, 0xA790, 0xD3CC, 0xE9E7, 0xA788, 0xD3C6, 0xA784, + 0xD3C3, 0xA782, 0xA7D8, 0xD3EE, 0xA7CC, 0xD3E7, 0xA7C6, 0xA7C3, 0xA7EE, 0xA7E7, + 0xF450, 0xFA2C, 0xFD17, 0xF448, 0xFA26, 0xF444, 0xFA23, 0xF442, 0xF441, 0xE8D0, + 0xF46C, 0xFA37, 0xE8C8, 0xF466, 0xE8C4, 0xF463, 0xE8C2, 0xE8C1, 0xD1D0, 0xE8EC, + 0xF477, 0xD1C8, 0xE8E6, 0xD1C4, 0xE8E3, 0xD1C2, 0xD1C1, 0xA3D0, 0xD1EC, 0xE8F7, + 0xA3C8, 0xD1E6, 0xA3C4, 0xD1E3, 0xA3C2, 0xA3C1, 0xA3EC, 0xD1F7, 0xA3E6, 0xA3E3, + 0xA3F7, 0xF428, 0xFA16, 0xF424, 0xFA13, 0xF422, 0xF421, 0xE868, 0xF436, 0xE864, + 0xF433, 0xE862, 0xE861, 0xD0E8, 0xE876, 0xD0E4, 0xE873, 0xD0E2, 0xD0E1, 0xA1E8, + 0xD0F6, 0xA1E4, 0xD0F3, 0xA1E2, 0xA1E1, 0xA1F6, 0xA1F3, 0xF414, 0xFA0B, 0xF412, + 0xF411, 0xE834, 0xF41B, 0xE832, 0xE831, 0xD074, 0xE83B, 0xD072, 0xD071, 0xA0F4, + 0xD07B, 0xA0F2, 0xA0F1, 0xF40A, 0xF409, 0xE81A, 0xE819, 0xD03A, 0xD039, 0xF2A0, + 0xF958, 0xFCAE, 0xF290, 0xF94C, 0xFCA7, 0xF288, 0xF946, 0xF284, 0xF943, 0xF282, + 0xF281, 0xE5A0, 0xF2D8, 0xF96E, 0xE590, 0xF2CC, 0xF967, 0xE588, 0xF2C6, 0xE584, + 0xF2C3, 0xE582, 0xE581, 0xCBA0, 0xE5D8, 0xF2EE, 0xCB90, 0xE5CC, 0xF2E7, 0xCB88, + 0xE5C6, 0xCB84, 0xE5C3, 0xCB82, 0xCB81, 0x97A0, 0xCBD8, 0xE5EE, 0x9790, 0xCBCC, + 0xE5E7, 0x9788, 0xCBC6, 0x9784, 0xCBC3, 0x9782, 0x97D8, 0xCBEE, 0x97CC, 0xCBE7, + 0x97C6, 0x97C3, 0x97EE, 0x97E7, 0xFB50, 0xFDAC, 0xB5F8, 0xFB48, 0xFDA6, 0xB4FC, + 0xFB44, 0xFDA3, 0xB47E, 0xFB42, 0xFB41, 0xF250, 0xF92C, 0xFC97, 0xF6D0, 0xF248, + 0xFDB7, 0xF6C8, 0xFB66, 0xF923, 0xF6C4, 0xF242, 0xF6C2, 0xF241, 0xF6C1, 0xE4D0, + 0xF26C, 0xF937, 0xEDD0, 0xE4C8, 0xF266, 0xEDC8, 0xF6E6, 0xF263, 0xEDC4, 0xE4C2, + 0xEDC2, 0xE4C1, 0xEDC1, 0xC9D0, 0xE4EC, 0xF277, 0xDBD0, 0xC9C8, 0xE4E6, 0xDBC8, + 0xEDE6, 0xE4E3, 0xDBC4, 0xC9C2, 0xDBC2, 0xC9C1, 0xDBC1, 0x93D0, 0xC9EC, 0xE4F7, + 0xB7D0, 0x93C8, 0xC9E6, 0xB7C8, 0xDBE6, 0xC9E3, 0xB7C4, 0x93C2, 0xB7C2, 0x93C1, + 0x93EC, 0xC9F7, 0xB7EC, 0x93E6, 0xB7E6, 0x93E3, 0xB7E3, 0x93F7, 0xFB28, 0xFD96, + 0xB2FC, 0xFB24, 0xFD93, 0xB27E, 0xFB22, 0xB23F, 0xFB21, 0xF228, 0xF916, 0xF668, + 0xF224, 0xF913, 0xF664, 0xFB33, 0xF662, 0xF221, 0xF661, 0xE468, 0xF236, 0xECE8, + 0xE464, 0xF233, 0xECE4, 0xF673, 0xECE2, 0xE461, 0xECE1, 0xC8E8, 0xE476, 0xD9E8, + 0xC8E4, 0xE473, 0xD9E4, 0xECF3, 0xD9E2, 0xC8E1, 0xD9E1, 0x91E8, 0xC8F6, 0xB3E8, + 0x91E4, 0xC8F3, 0xB3E4, 0xD9F3, 0xB3E2, 0x91E1, 0xB3E1, 0x91F6, 0xB3F6, 0x91F3, + 0xB3F3, 0xFB14, 0xFD8B, 0xB17E, 0xFB12, 0xB13F, 0xFB11, 0xF214, 0xF90B, 0xF634, + 0xFB1B, 0xF632, 0xF211, 0xF631, 0xE434, 0xF21B, 0xEC74, 0xE432, 0xEC72, 0xE431, + 0xEC71, 0xC874, 0xE43B, 0xD8F4, 0xEC7B, 0xD8F2, 0xC871, 0xD8F1, 0x90F4, 0xC87B, + 0xB1F4, 0x90F2, 0xB1F2, 0x90F1, 0xB1F1, 0x90FB, 0xB1FB, 0xFB0A, 0xB0BF, 0xFB09, + 0xF20A, 0xF61A, 0xF209, 0xF619, 0xE41A, 0xEC3A, 0xE419, 0xEC39, 0xC83A, 0xD87A, + 0xC839, 0xD879, 0x907A, 0xB0FA, 0x9079, 0xB0F9, 0xFB05, 0xF205, 0xF60D, 0xE40D, + 0xEC1D, 0xC81D, 0xD83D, 0xF150, 0xF8AC, 0xFC57, 0xF148, 0xF8A6, 0xF144, 0xF8A3, + 0xF142, 0xF141, 0xE2D0, 0xF16C, 0xF8B7, 0xE2C8, 0xF166, 0xE2C4, 0xF163, 0xE2C2, + 0xE2C1, 0xC5D0, 0xE2EC, 0xF177, 0xC5C8, 0xE2E6, 0xC5C4, 0xE2E3, 0xC5C2, 0xC5C1, + 0x8BD0, 0xC5EC, 0xE2F7, 0x8BC8, 0xC5E6, 0x8BC4, 0xC5E3, 0x8BC2, 0x8BC1, 0x8BEC, + 0xC5F7, 0x8BE6, 0x8BE3, 0x8BF7, 0xF9A8, 0xFCD6, 0x9AFC, 0xF9A4, 0xFCD3, 0x9A7E, + 0xF9A2, 0x9A3F, 0xF9A1, 0xF128, 0xF896, 0xF368, 0xF124, 0xF893, 0xF364, 0xF9B3, + 0xF362, 0xF121, 0xF361, 0xE268, 0xF136, 0xE6E8, 0xE264, 0xF133, 0xE6E4, 0xF373, + 0xE6E2, 0xE261, 0xE6E1, 0xC4E8, 0xE276, 0xCDE8, 0xC4E4, 0xE273, 0xCDE4, 0xE6F3, + 0xCDE2, 0xC4E1, 0xCDE1, 0x89E8, 0xC4F6, 0x9BE8, 0x89E4, 0xC4F3, 0x9BE4, 0xCDF3, + 0x9BE2, 0x89E1, 0x9BE1, 0x89F6, 0x9BF6, 0x89F3, 0x9BF3, 0xFDD4, 0xBAF8, 0xDD7E, + 0xFDD2, 0xBA7C, 0xDD3F, 0xFDD1, 0xBA3E, 0xBA1F, 0xF994, 0xFCCB, 0x997E, 0xFBB4, + 0xFDDB, 0xBB7E, 0x993F, 0xFBB2, 0xF991, 0xBB3F, 0xFBB1, 0xF114, 0xF88B, 0xF334, + 0xF112, 0xF774, 0xFBBB, 0xF111, 0xF772, 0xF331, 0xF771, 0xE234, 0xF11B, 0xE674, + 0xE232, 0xEEF4, 0xE672, 0xE231, 0xEEF2, 0xE671, 0xEEF1, 0xC474, 0xE23B, 0xCCF4, + 0xC472, 0xDDF4, 0xCCF2, 0xC471, 0xDDF2, 0xCCF1, 0xDDF1, 0x88F4, 0xC47B, 0x99F4, + 0x88F2, 0xBBF4, 0x99F2, 0x88F1, 0xBBF2, 0x99F1, 0xBBF1, 0x88FB, 0x99FB, 0xFDCA, + 0xB97C, 0xDCBF, 0xFDC9, 0xB93E, 0xB91F, 0xF98A, 0x98BF, 0xFB9A, 0xF989, 0xB9BF, + 0xFB99, 0xF10A, 0xF31A, 0xF109, 0xF73A, 0xF319, 0xF739, 0xE21A, 0xE63A, 0xE219, + 0xEE7A, 0xE639, 0xEE79, 0xC43A, 0xCC7A, 0xC439, 0xDCFA, 0xCC79, 0xDCF9, 0x887A, + 0x98FA, 0x8879, 0xB9FA, 0x98F9, 0xB9F9, 0xFDC5, 0xB8BE, 0xB89F, 0xF985, 0xFB8D, + 0xF105, 0xF30D, 0xF71D, 0xE20D, 0xE61D, 0xEE3D, 0xC41D, 0xCC3D, 0xDC7D, 0x883D, + 0x987D, 0xB8FD, 0xB85F, 0xF0A8, 0xF856, 0xF0A4, 0xF853, 0xF0A2, 0xF0A1, 0xE168, + 0xF0B6, 0xE164, 0xF0B3, 0xE162, 0xE161, 0xC2E8, 0xE176, 0xC2E4, 0xE173, 0xC2E2, + 0xC2E1, 0x85E8, 0xC2F6, 0x85E4, 0xC2F3, 0x85E2, 0x85E1, 0x85F6, 0x85F3, 0xF8D4, + 0xFC6B, 0x8D7E, 0xF8D2, 0x8D3F, 0xF8D1, 0xF094, 0xF84B, 0xF1B4, 0xF092, 0xF1B2, + 0xF091, 0xF1B1, 0xE134, 0xF09B, 0xE374, 0xE132, 0xE372, 0xE131, 0xE371, 0xC274, + 0xE13B, 0xC6F4, 0xC272, 0xC6F2, 0xC271, 0xC6F1, 0x84F4, 0xC27B, 0x8DF4, 0x84F2, + 0x8DF2, 0x84F1, 0x8DF1, 0x84FB, 0x8DFB, 0xFCEA, 0x9D7C, 0xCEBF, 0xFCE9, 0x9D3E, + 0x9D1F, 0xF8CA, 0x8CBF, 0xF9DA, 0xF8C9, 0x9DBF, 0xF9D9, 0xF08A, 0xF19A, 0xF089, + 0xF3BA, 0xF199, 0xF3B9, 0xE11A, 0xE33A, 0xE119, 0xE77A, 0xE339, 0xE779, 0xC23A, + 0xC67A, 0xC239, 0xCEFA, 0xC679, 0xCEF9, 0x847A, 0x8CFA, 0x8479, 0x9DFA, 0x8CF9, + 0x9DF9, 0xBD78, 0xDEBE, 0xBD3C, 0xDE9F, 0xBD1E, 0xBD0F, 0xFCE5, 0x9CBE, 0xFDED, + 0xBDBE, 0x9C9F, 0xBD9F, 0xF8C5, 0xF9CD, 0xFBDD, 0xF085, 0xF18D, 0xF39D, 0xF7BD, + 0xE10D, 0xE31D, 0xE73D, 0xEF7D, 0xC21D, 0xC63D, 0xCE7D, 0xDEFD, 0x843D, 0x8C7D, + 0x9CFD, 0xBCBC, 0xDE5F, 0xBC9E, 0xBC8F, 0x9C5F, 0xBCDF, 0xBC5E, 0xBC4F, 0xBC2F, + 0xF054, 0xF052, 0xF051, 0xE0B4, 0xF05B, 0xE0B2, 0xE0B1, 0xC174, 0xE0BB, 0xC172, + 0xC171, 0x82F4, 0xC17B, 0x82F2, 0x82F1, 0x82FB, 0xF86A, 0x86BF, 0xF869, 0xF04A, + 0xF0DA, 0xF049, 0xF0D9, 0xE09A, 0xE1BA, 0xE099, 0xE1B9, 0xC13A, 0xC37A, 0xC139, + 0xC379, 0x827A, 0x86FA, 0x8279, 0x86F9, 0xFC75, 0x8EBE, 0x8E9F, 0xF865, 0xF8ED, + 0xF045, 0xF0CD, 0xF1DD, 0xE08D, 0xE19D, 0xE3BD, 0xC11D, 0xC33D, 0xC77D, 0x823D, + 0x867D, 0x8EFD, 0x9EBC, 0xCF5F, 0x9E9E, 0x9E8F, 0x8E5F, 0x9EDF, 0xBEB8, 0xDF5E, + 0xBE9C, 0xDF4F, 0xBE8E, 0xBE87, 0x9E5E, 0xBEDE, 0x9E4F, 0xBECF, 0xBE5C, 0xDF2F, + 0xBE4E, 0xBE47, 0x9E2F, 0xBE6F, 0xBE2E, 0xBE27, 0xBE17, 0xE05A, 0xE059, 0xC0BA, + 0xC0B9, 0x817A, 0x8179, 0xF06D, 0xE04D, 0xE0DD, 0xC09D, 0xC1BD, 0x813D, 0x837D, + 0x875F, 0x8F5E, 0x8F4F, 0x9F5C, 0xCFAF, 0x9F4E, 0x9F47, 0x8F2F, 0x9F6F, 0xBF58, + 0xDFAE, 0xBF4C, 0xDFA7, 0xBF46, 0xBF43, 0x9F2E, 0xBF6E, 0x9F27, 0xBF67, 0xBF2C, + 0xDF97, 0xBF26, 0xBF23, 0x9F17, 0xBF37, 0xBF16, 0xBF13, 0x87AF, 0x8FAE, 0x8FA7, + 0x9FAC, 0xCFD7, 0x9FA6, 0x9FA3, 0x8F97, 0x9FB7, 0x9F96, 0x9F93, 0xD5F0, 0xEAFC, + 0xA9E0, 0xD4F8, 0xEA7E, 0xA8F0, 0xD47C, 0xEA3F, 0xA878, 0xD43E, 0xA83C, 0xFD68, + 0xADF0, 0xD6FC, 0xFD64, 0xACF8, 0xD67E, 0xFD62, 0xAC7C, 0xD63F, 0xFD61, 0xAC3E, + 0xFAE8, 0xFD76, 0xAEFC, 0xFAE4, 0xFD73, 0xAE7E, 0xFAE2, 0xAE3F, 0xFAE1, 0xF5E8, + 0xFAF6, 0xF5E4, 0xFAF3, 0xF5E2, 0xF5E1, 0xEBE8, 0xF5F6, 0xEBE4, 0xF5F3, 0xEBE2, + 0xEBE1, 0xD7E8, 0xEBF6, 0xD7E4, 0xEBF3, 0xD7E2, 0xA5E0, 0xD2F8, 0xE97E, 0xA4F0, + 0xD27C, 0xE93F, 0xA478, 0xD23E, 0xA43C, 0xD21F, 0xA41E, 0xFD34, 0xA6F8, 0xD37E, + 0xFD32, 0xA67C, 0xD33F, 0xFD31, 0xA63E, 0xA61F, 0xFA74, 0xFD3B, 0xA77E, 0xFA72, + 0xA73F, 0xFA71, 0xF4F4, 0xFA7B, 0xF4F2, 0xF4F1, 0xE9F4, 0xF4FB, 0xE9F2, 0xE9F1, + 0xD3F4, 0xE9FB, 0xD3F2, 0xD3F1, 0xA2F0, 0xD17C, 0xE8BF, 0xA278, 0xD13E, 0xA23C, + 0xD11F, 0xA21E, 0xA20F, 0xFD1A, 0xA37C, 0xD1BF, 0xFD19, 0xA33E, 0xA31F, 0xFA3A, + 0xA3BF, 0xFA39, 0xF47A, 0xF479, 0xE8FA, 0xE8F9, 0xD1FA, 0xD1F9, 0xA178, 0xD0BE, + 0xA13C, 0xD09F, 0xA11E, 0xA10F, 0xFD0D, 0xA1BE, 0xA19F, 0xFA1D, 0xF43D, 0xE87D, + 0xA0BC, 0xD05F, 0xA09E, 0xA08F, 0xA0DF, 0xA05E, 0xA04F, 0x95E0, 0xCAF8, 0xE57E, + 0x94F0, 0xCA7C, 0xE53F, 0x9478, 0xCA3E, 0x943C, 0xCA1F, 0x941E, 0xFCB4, 0x96F8, + 0xCB7E, 0xFCB2, 0x967C, 0xCB3F, 0xFCB1, 0x963E, 0x961F, 0xF974, 0xFCBB, 0x977E, + 0xF972, 0x973F, 0xF971, 0xF2F4, 0xF97B, 0xF2F2, 0xF2F1, 0xE5F4, 0xF2FB, 0xE5F2, + 0xE5F1, 0xCBF4, 0xE5FB, 0xCBF2, 0xCBF1, 0xDAF0, 0xED7C, 0xF6BF, 0xB4E0, 0xDA78, + 0xED3E, 0xB470, 0xDA3C, 0xED1F, 0xB438, 0xDA1E, 0xB41C, 0xDA0F, 0xB40E, 0x92F0, + 0xC97C, 0xE4BF, 0xB6F0, 0x9278, 0xC93E, 0xB678, 0xDB3E, 0xC91F, 0xB63C, 0x921E, + 0xB61E, 0x920F, 0xB60F, 0xFC9A, 0x937C, 0xC9BF, 0xFDBA, 0xFC99, 0xB77C, 0x933E, + 0xFDB9, 0xB73E, 0x931F, 0xB71F, 0xF93A, 0x93BF, 0xFB7A, 0xF939, 0xB7BF, 0xFB79, + 0xF27A, 0xF6FA, 0xF279, 0xF6F9, 0xE4FA, 0xEDFA, 0xE4F9, 0xEDF9, 0xC9FA, 0xC9F9, + 0xB2E0, 0xD978, 0xECBE, 0xB270, 0xD93C, 0xEC9F, 0xB238, 0xD91E, 0xB21C, 0xD90F, + 0xB20E, 0xB207, 0x9178, 0xC8BE, 0xB378, 0x913C, 0xC89F, 0xB33C, 0xD99F, 0xB31E, + 0x910F, 0xB30F, 0xFC8D, 0x91BE, 0xFD9D, 0xB3BE, 0x919F, 0xB39F, 0xF91D, 0xFB3D, + 0xF23D, 0xF67D, 0xE47D, 0xECFD, 0xC8FD, 0xB170, 0xD8BC, 0xEC5F, 0xB138, 0xD89E, + 0xB11C, 0xD88F, 0xB10E, 0xB107, 0x90BC, 0xC85F, 0xB1BC, 0x909E, 0xB19E, 0x908F, + 0xB18F, 0x90DF, 0xB1DF, 0xB0B8, 0xD85E, 0xB09C, 0xD84F, 0xB08E, 0xB087, 0x905E, + 0xB0DE, 0x904F, 0xB0CF, 0xB05C, 0xD82F, 0xB04E, 0xB047, 0x902F, 0xB06F, 0xB02E, + 0xB027, 0x8AF0, 0xC57C, 0xE2BF, 0x8A78, 0xC53E, 0x8A3C, 0xC51F, 0x8A1E, 0x8A0F, + 0xFC5A, 0x8B7C, 0xC5BF, 0xFC59, 0x8B3E, 0x8B1F, 0xF8BA, 0x8BBF, 0xF8B9, 0xF17A, + 0xF179, 0xE2FA, 0xE2F9, 0xC5FA, 0xC5F9, 0x9AE0, 0xCD78, 0xE6BE, 0x9A70, 0xCD3C, + 0xE69F, 0x9A38, 0xCD1E, 0x9A1C, 0xCD0F, 0x9A0E, 0x9A07, 0x8978, 0xC4BE, 0x9B78, + 0x893C, 0xC49F, 0x9B3C, 0xCD9F, 0x9B1E, 0x890F, 0x9B0F, 0xFC4D, 0x89BE, 0xFCDD, + 0x9BBE, 0x899F, 0x9B9F, 0xF89D, 0xF9BD, 0xF13D, 0xF37D, 0xE27D, 0xE6FD, 0xC4FD, + 0xDD70, 0xEEBC, 0xF75F, 0xBA60, 0xDD38, 0xEE9E, 0xBA30, 0xDD1C, 0xEE8F, 0xBA18, + 0xDD0E, 0xBA0C, 0xDD07, 0xBA06, 0x9970, 0xCCBC, 0xE65F, 0xBB70, 0x9938, 0xCC9E, + 0xBB38, 0xDD9E, 0xCC8F, 0xBB1C, 0x990E, 0xBB0E, 0x9907, 0xBB07, 0x88BC, 0xC45F, + 0x99BC, 0x889E, 0xBBBC, 0x999E, 0x888F, 0xBB9E, 0x998F, 0xBB8F, 0x88DF, 0x99DF, + 0xBBDF, 0xB960, 0xDCB8, 0xEE5E, 0xB930, 0xDC9C, 0xEE4F, 0xB918, 0xDC8E, 0xB90C, + 0xDC87, 0xB906, 0xB903, 0x98B8, 0xCC5E, 0xB9B8, 0x989C, 0xCC4F, 0xB99C, 0xDCCF, + 0xB98E, 0x9887, 0xB987, 0x885E, 0x98DE, 0x884F, 0xB9DE, 0x98CF, 0xB9CF, 0xB8B0, + 0xDC5C, 0xEE2F, 0xB898, 0xDC4E, 0xB88C, 0xDC47, 0xB886, 0xB883, 0x985C, 0xCC2F, + 0xB8DC, 0x984E, 0xB8CE, 0x9847, 0xB8C7, 0x882F, 0x986F, 0xB8EF, 0xB858, 0xDC2E, + 0xB84C, 0xDC27, 0xB846, 0xB843, 0x982E, 0xB86E, 0x9827, 0xB867, 0xB82C, 0xDC17, + 0xB826, 0xB823, 0x9817, 0xB837, 0xB816, 0xB813, 0x8578, 0xC2BE, 0x853C, 0xC29F, + 0x851E, 0x850F, 0x85BE, 0x859F, 0xF85D, 0xF0BD, 0xE17D, 0xC2FD, 0x8D70, 0xC6BC, + 0xE35F, 0x8D38, 0xC69E, 0x8D1C, 0xC68F, 0x8D0E, 0x8D07, 0x84BC, 0xC25F, 0x8DBC, + 0x849E, 0x8D9E, 0x848F, 0x8D8F, 0x84DF, 0x8DDF, 0x9D60, 0xCEB8, 0xE75E, 0x9D30, + 0xCE9C, 0xE74F, 0x9D18, 0xCE8E, 0x9D0C, 0xCE87, 0x9D06, 0x9D03, 0x8CB8, 0xC65E, + 0x9DB8, 0x8C9C, 0xC64F, 0x9D9C, 0x8C8E, 0x9D8E, 0x8C87, 0x9D87, 0x845E, 0x8CDE, + 0x844F, 0x9DDE, 0x8CCF, 0x9DCF, 0xDEB0, 0xEF5C, 0xF7AF, 0xBD20, 0xDE98, 0xEF4E, + 0xBD10, 0xDE8C, 0xEF47, 0xBD08, 0xDE86, 0xBD04, 0xDE83, 0xBD02, 0x9CB0, 0xCE5C, + 0xE72F, 0xBDB0, 0x9C98, 0xCE4E, 0xBD98, 0xDECE, 0xCE47, 0xBD8C, 0x9C86, 0xBD86, + 0x9C83, 0xBD83, 0x8C5C, 0xC62F, 0x9CDC, 0x8C4E, 0xBDDC, 0x9CCE, 0x8C47, 0xBDCE, + 0x9CC7, 0xBDC7, 0x842F, 0x8C6F, 0x9CEF, 0xBDEF, 0xBCA0, 0xDE58, 0xEF2E, 0xBC90, + 0xDE4C, 0xEF27, 0xBC88, 0xDE46, 0xBC84, 0xDE43, 0xBC82, 0xBC81, 0x9C58, 0xCE2E, + 0xBCD8, 0x9C4C, 0xCE27, 0xBCCC, 0xDE67, 0xBCC6, 0x9C43, 0xBCC3, 0x8C2E, 0x9C6E, + 0x8C27, 0xBCEE, 0x9C67, 0xBCE7, 0xBC50, 0xDE2C, 0xEF17, 0xBC48, 0xDE26, 0xBC44, + 0xDE23, 0xBC42, 0xBC41, 0x9C2C, 0xCE17, 0xBC6C, 0x9C26, 0xBC66, 0x9C23, 0xBC63, + 0x8C17, 0x9C37, 0xBC77, 0xBC28, 0xDE16, 0xBC24, 0xDE13, 0xBC22, 0xBC21, 0x9C16, + 0xBC36, 0x9C13, 0xBC33, 0xBC14, 0xDE0B, 0xBC12, 0xBC11, 0x9C0B, 0xBC1B, 0x82BC, + 0xC15F, 0x829E, 0x828F, 0x82DF, 0x86B8, 0xC35E, 0x869C, 0xC34F, 0x868E, 0x8687, + 0x825E, 0x86DE, 0x824F, 0x86CF, 0x8EB0, 0xC75C, 0xE3AF, 0x8E98, 0xC74E, 0x8E8C, + 0xC747, 0x8E86, 0x8E83, 0x865C, 0xC32F, 0x8EDC, 0x864E, 0x8ECE, 0x8647, 0x8EC7, + 0x822F, 0x866F, 0x8EEF, 0x9EA0, 0xCF58, 0xE7AE, 0x9E90, 0xCF4C, 0xE7A7, 0x9E88, + 0xCF46, 0x9E84, 0xCF43, 0x9E82, 0x9E81, 0x8E58, 0xC72E, 0x9ED8, 0x8E4C, 0xC727, + 0x9ECC, 0xCF67, 0x9EC6, 0x8E43, 0x9EC3, 0x862E, 0x8E6E, 0x8627, 0x9EEE, 0x8E67, + 0x9EE7, 0xDF50, 0xEFAC, 0xF7D7, 0xDF48, 0xEFA6, 0xDF44, 0xEFA3, 0xDF42, 0xDF41, + 0x9E50, 0xCF2C, 0xE797, 0xBED0, 0x9E48, 0xCF26, 0xBEC8, 0xDF66, 0xCF23, 0xBEC4, + 0x9E42, 0xBEC2, 0x9E41, 0xBEC1, 0x8E2C, 0xC717, 0x9E6C, 0x8E26, 0xBEEC, 0x9E66, + 0x8E23, 0xBEE6, 0x9E63, 0xBEE3, 0x8617, 0x8E37, 0x9E77, 0xBEF7, 0xDF28, 0xEF96, + 0xDF24, 0xEF93, 0xDF22, 0xDF21, 0x9E28, 0xCF16, 0xBE68, 0x9E24, 0xCF13, 0xBE64, + 0xDF33, 0xBE62, 0x9E21, 0xBE61, 0x8E16, 0x9E36, 0x8E13, 0xBE76, 0x9E33, 0xBE73, + 0xDF14, 0xEF8B, 0xDF12, 0xDF11, 0x9E14, 0xCF0B, 0xBE34, 0x9E12, 0xBE32, 0x9E11, + 0xBE31, 0x8E0B, 0x9E1B, 0xBE3B, 0xDF0A, 0xDF09, 0x9E0A, 0xBE1A, 0x9E09, 0xBE19, + 0x815E, 0x814F, 0x835C, 0xC1AF, 0x834E, 0x8347, 0x812F, 0x836F, 0x8758, 0xC3AE, + 0x874C, 0xC3A7, 0x8746, 0x8743, 0x832E, 0x876E, 0x8327, 0x8767, 0x8F50, 0xC7AC, + 0xE3D7, 0x8F48, 0xC7A6, 0x8F44, 0xC7A3, 0x8F42, 0x8F41, 0x872C, 0xC397, 0x8F6C, + 0xC7B7, 0x8F66, 0x8723, 0x8F63, 0x8317, 0x8737, 0x8F77, 0xCFA8, 0xE7D6, 0xCFA4, + 0xE7D3, 0xCFA2, 0xCFA1, 0x8F28, 0xC796, 0x9F68, 0xCFB6, 0xC793, 0x9F64, 0x8F22, + 0x9F62, 0x8F21, 0x9F61, 0x8716, 0x8F36, 0x8713, 0x9F76, 0x8F33, 0x9F73, 0xEFD4, + 0xF7EB, 0xEFD2, 0xEFD1, 0xCF94, 0xE7CB, 0xDFB4, 0xCF92, 0xDFB2, 0xCF91, 0xDFB1, + 0x8F14, 0xC78B, 0x9F34, 0x8F12, 0xBF74, 0x9F32, 0x8F11, 0xBF72, 0x9F31, 0xBF71, + 0x870B, 0x8F1B, 0x9F3B, 0xBF7B, 0xEFCA, 0xEFC9, 0xCF8A, 0xDF9A, 0xCF89, 0xDF99, + 0x8F0A, 0x9F1A, 0x8F09, 0xBF3A, 0x9F19, 0xBF39, 0xEFC5, 0xCF85, 0xDF8D, 0x8F05, + 0x9F0D, 0xBF1D, 0x81AE, 0x81A7, 0x83AC, 0xC1D7, 0x83A6, 0x83A3, 0x8197, 0x83B7, + 0x87A8, 0xC3D6, 0x87A4, 0xC3D3, 0x87A2, 0x87A1, 0x8396, 0x87B6, 0x8393, 0x87B3, + 0xC7D4, 0xE3EB, 0xC7D2, 0xC7D1, 0x8794, 0xC3CB, 0x8FB4, 0xC7DB, 0x8FB2, 0x8791, + 0x8FB1, 0x838B, 0x879B, 0x8FBB, 0xE7EA, 0xE7E9, 0xC7CA, 0xCFDA, 0xC7C9, 0xCFD9, + 0x878A, 0x8F9A, 0x8789, 0x9FBA, 0x8F99, 0x9FB9, 0xE7E5, 0xC7C5, 0xCFCD, 0x8785, + 0x8F8D, 0x9F9D, 0x81D6, 0x81D3, 0x83D4, 0xC1EB, 0x83D2, 0x83D1, 0x81CB, 0x83DB, + 0xC3EA, 0xC3E9, 0x83CA, 0x87DA, 0x83C9, 0x87D9, 0xE3F5 +}; + +/* MicroPDF417 coefficients from ISO/IEC 24728:2006 Annex F */ +INTERNAL_DATA const unsigned short pdf_Microcoeffs[344] = { + /* k = 7 */ + 76, 925, 537, 597, 784, 691, 437, + + /* k = 8 */ + 237, 308, 436, 284, 646, 653, 428, 379, + + /* k = 9 */ + 567, 527, 622, 257, 289, 362, 501, 441, 205, + + /* k = 10 */ + 377, 457, 64, 244, 826, 841, 818, 691, 266, 612, + + /* k = 11 */ + 462, 45, 565, 708, 825, 213, 15, 68, 327, 602, 904, + + /* k = 12 */ + 597, 864, 757, 201, 646, 684, 347, 127, 388, 7, 69, 851, + + /* k = 13 */ + 764, 713, 342, 384, 606, 583, 322, 592, 678, 204, 184, 394, 692, + + /* k = 14 */ + 669, 677, 154, 187, 241, 286, 274, 354, 478, 915, 691, 833, 105, 215, + + /* k = 15 */ + 460, 829, 476, 109, 904, 664, 230, 5, 80, 74, 550, 575, 147, 868, 642, + + /* k = 16 */ + 274, 562, 232, 755, 599, 524, 801, 132, 295, 116, 442, 428, 295, 42, 176, 65, + + /* k = 18 */ + 279, 577, 315, 624, 37, 855, 275, 739, 120, 297, 312, 202, 560, 321, 233, 756, + 760, 573, + + /* k = 21 */ + 108, 519, 781, 534, 129, 425, 681, 553, 422, 716, 763, 693, 624, 610, 310, 691, + 347, 165, 193, 259, 568, + + /* k = 26 */ + 443, 284, 887, 544, 788, 93, 477, 760, 331, 608, 269, 121, 159, 830, 446, 893, + 699, 245, 441, 454, 325, 858, 131, 847, 764, 169, + + /* k = 32 */ + 361, 575, 922, 525, 176, 586, 640, 321, 536, 742, 677, 742, 687, 284, 193, 517, + 273, 494, 263, 147, 593, 800, 571, 320, 803, 133, 231, 390, 685, 330, 63, 410, + + /* k = 38 */ + 234, 228, 438, 848, 133, 703, 529, 721, 788, 322, 280, 159, 738, 586, 388, 684, + 445, 680, 245, 595, 614, 233, 812, 32, 284, 658, 745, 229, 95, 689, 920, 771, + 554, 289, 231, 125, 117, 518, + + /* k = 44 */ + 476, 36, 659, 848, 678, 64, 764, 840, 157, 915, 470, 876, 109, 25, 632, 405, + 417, 436, 714, 60, 376, 97, 413, 706, 446, 21, 3, 773, 569, 267, 272, 213, + 31, 560, 231, 758, 103, 271, 572, 436, 339, 730, 82, 285, + + /* k = 50 */ + 923, 797, 576, 875, 156, 706, 63, 81, 257, 874, 411, 416, 778, 50, 205, 303, + 188, 535, 909, 155, 637, 230, 534, 96, 575, 102, 264, 233, 919, 593, 865, 26, + 579, 623, 766, 146, 10, 739, 246, 127, 71, 244, 211, 477, 920, 876, 427, 820, + 718, 435 +}; + +/* rows, columns, error codewords, k-offset of valid MicroPDF417 sizes from ISO/IEC 24728:2006 */ +INTERNAL_DATA const unsigned short pdf_MicroVariants[170] = { + 1, 1, 1, 1, 1, 1, 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, 4, 4, + 11, 14, 17, 20, 24, 28, 8, 11, 14, 17, 20, 23, 26, 6, 8, 10, 12, 15, 20, 26, 32, 38, 44, 4, 6, 8, 10, 12, 15, 20, 26, 32, 38, 44, + 7, 7, 7, 8, 8, 8, 8, 9, 9, 10, 11, 13, 15, 12, 14, 16, 18, 21, 26, 32, 38, 44, 50, 8, 12, 14, 16, 18, 21, 26, 32, 38, 44, 50, + 0, 0, 0, 7, 7, 7, 7, 15, 15, 24, 34, 57, 84, 45, 70, 99, 115, 133, 154, 180, 212, 250, 294, 7, 45, 70, 99, 115, 133, 154, 180, 212, 250, 294 +}; +/* rows, columns, error codewords, k-offset */ + +/* following is Left RAP, Centre RAP, Right RAP and Start Cluster from ISO/IEC 24728:2006 tables 10, 11 and 12 */ +INTERNAL_DATA const char pdf_RAPTable[136] = { + 1, 8, 36, 19, 9, 25, 1, 1, 8, 36, 19, 9, 27, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1, 47, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 25, 37, 17, 9, 29, 31, 25, 19, 1, 7, 15, 25, 37, 17, 9, 29, 31, 25, + 9, 8, 36, 19, 17, 33, 1, 9, 8, 36, 19, 17, 35, 1, 7, 15, 25, 37, 33, 17, 37, 47, 49, 43, 1, 7, 15, 25, 37, 33, 17, 37, 47, 49, + 0, 3, 6, 0, 6, 0, 0, 0, 3, 6, 0, 6, 6, 0, 0, 6, 0, 0, 0, 0, 6, 6, 0, 3, 0, 0, 6, 0, 0, 0, 0, 6, 6, 0 +}; + +/* Left and Right Row Address Pattern from Table 2 */ +INTERNAL_DATA const unsigned short pdf_rap_side[52] = { + 0x322, 0x3A2, 0x3B2, 0x332, 0x372, 0x37A, 0x33A, 0x3BA, 0x39A, 0x3DA, + 0x3CA, 0x38A, 0x30A, 0x31A, 0x312, 0x392, 0x3D2, 0x3D6, 0x3D4, 0x394, + 0x3B4, 0x3A4, 0x3A6, 0x3AE, 0x3AC, 0x3A8, 0x328, 0x32C, 0x32E, 0x326, + 0x336, 0x3B6, 0x396, 0x316, 0x314, 0x334, 0x374, 0x364, 0x366, 0x36E, + 0x36C, 0x368, 0x348, 0x358, 0x35C, 0x35E, 0x34E, 0x34C, 0x344, 0x346, + 0x342, 0x362 +}; + +/* Centre Row Address Pattern from Table 2 */ +INTERNAL_DATA const unsigned short pdf_rap_centre[52] = { + 0x2CE, 0x24E, 0x26E, 0x22E, 0x226, 0x236, 0x216, 0x212, 0x21A, 0x23A, + 0x232, 0x222, 0x262, 0x272, 0x27A, 0x2FA, 0x2F2, 0x2F6, 0x276, 0x274, + 0x264, 0x266, 0x246, 0x242, 0x2C2, 0x2E2, 0x2E6, 0x2E4, 0x2EC, 0x26C, + 0x22C, 0x228, 0x268, 0x2E8, 0x2C8, 0x2CC, 0x2C4, 0x2C6, 0x286, 0x28E, + 0x28C, 0x29C, 0x298, 0x2B8, 0x2B0, 0x290, 0x2D0, 0x250, 0x258, 0x25C, + 0x2DC, 0x2DE +}; + +#endif /* __PDF417_TABS_H */ diff --git a/backend/qr.c b/backend/qr.c index 4af59b72..f9058721 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -281,7 +281,7 @@ static void qr_define_mode(char mode[], const unsigned int jisdata[], const int for (j = 0; j < QR_NUM_MODES; j++) { /* To mode */ for (k = 0; k < QR_NUM_MODES; k++) { /* From mode */ if (j != k && char_modes[cm_i + k]) { - unsigned int new_cost = cur_costs[k] + state[j]; /* Switch costs same as head costs */ + const unsigned int new_cost = cur_costs[k] + state[j]; /* Switch costs same as head costs */ if (!char_modes[cm_i + j] || new_cost < cur_costs[j]) { cur_costs[j] = new_cost; char_modes[cm_i + j] = mode_types[k]; @@ -1548,8 +1548,8 @@ INTERNAL int qrcode(struct zint_symbol *symbol, unsigned char source[], int leng int canShrink; int size_squared; const struct zint_structapp *p_structapp = NULL; - int debug_print = symbol->debug & ZINT_DEBUG_PRINT; - int eci_length = get_eci_length(symbol->eci, source, length); + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; + const int eci_length = get_eci_length(symbol->eci, source, length); #ifndef _MSC_VER unsigned int jisdata[eci_length + 1]; @@ -1856,7 +1856,7 @@ static int micro_qr_m1(struct zint_symbol *symbol, char binary_data[], int bp) { } if (symbol->debug & ZINT_DEBUG_PRINT) { - printf("M1 Terminated binary (%d): %s (bits_left %d)\n", bp, binary_data, bits_left); + printf("M1 Terminated binary (%d): %.*s (bits_left %d)\n", bp, bp, binary_data, bits_left); } if (latch == 0) { @@ -1952,7 +1952,7 @@ static int micro_qr_m2(struct zint_symbol *symbol, char binary_data[], int bp, c } if (symbol->debug & ZINT_DEBUG_PRINT) { - printf("M2 Terminated binary (%d): %s (bits_left %d)\n", bp, binary_data, bits_left); + printf("M2 Terminated binary (%d): %.*s (bits_left %d)\n", bp, bp, binary_data, bits_left); } if (latch == 0) { @@ -2036,7 +2036,7 @@ static int micro_qr_m3(struct zint_symbol *symbol, char binary_data[], int bp, c } if (symbol->debug & ZINT_DEBUG_PRINT) { - printf("M3 Terminated binary (%d): %s (bits_left %d)\n", bp, binary_data, bits_left); + printf("M3 Terminated binary (%d): %.*s (bits_left %d)\n", bp, bp, binary_data, bits_left); } if (latch == 0) { @@ -2155,7 +2155,7 @@ static int micro_qr_m4(struct zint_symbol *symbol, char binary_data[], int bp, c } if (symbol->debug & ZINT_DEBUG_PRINT) { - printf("M4 Terminated binary (%d): %s (bits_left %d)\n", (int) strlen(binary_data), binary_data, bits_left); + printf("M4 Terminated binary (%d): %.*s (bits_left %d)\n", bp, bp, binary_data, bits_left); } if (latch == 0) { @@ -2436,7 +2436,7 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len int ecc_level, autoversion, version; int bitmask, format, format_full; int size_squared; - int debug_print = symbol->debug & ZINT_DEBUG_PRINT; + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; #ifdef _MSC_VER unsigned char *grid; #endif @@ -2610,7 +2610,7 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len bp = qr_binary((unsigned char *) full_stream, MICROQR_VERSION + version, 0 /*target_codewords*/, mode, jisdata, length, NULL /*p_structapp*/, 0 /*gs1*/, 0 /*eci*/, binary_count[version], debug_print); - if (debug_print) printf("Binary (%d): %s\n", bp, full_stream); + if (debug_print) printf("Binary (%d): %.*s\n", bp, bp, full_stream); switch (version) { case 0: bp = micro_qr_m1(symbol, full_stream, bp); @@ -2740,7 +2740,7 @@ INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int lengt int ecc_level, version, target_codewords, blocks, size; int bitmask, error_number; int size_squared; - int debug_print = symbol->debug & ZINT_DEBUG_PRINT; + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; #ifndef _MSC_VER unsigned int jisdata[length + 1]; @@ -2972,8 +2972,8 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length int full_multibyte; int footprint, best_footprint, format_data; unsigned int left_format_info, right_format_info; - int debug_print = symbol->debug & ZINT_DEBUG_PRINT; - int eci_length = get_eci_length(symbol->eci, source, length); + const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; + const int eci_length = get_eci_length(symbol->eci, source, length); #ifndef _MSC_VER unsigned int jisdata[eci_length + 1]; diff --git a/backend/rss.c b/backend/rss.c index 3199727c..63a6ec8c 100644 --- a/backend/rss.c +++ b/backend/rss.c @@ -833,10 +833,11 @@ INTERNAL int dbar_date(const unsigned char source[], const int src_posn) { /* Handles all data encodation from section 7.2.5 of ISO/IEC 24724 */ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned char source[], char binary_string[], int cols_per_row, int *p_bp) { - int encoding_method, i, j, read_posn, debug = (symbol->debug & ZINT_DEBUG_PRINT), mode = NUMERIC; + int encoding_method, i, j, read_posn, mode = NUMERIC; char last_digit = '\0'; int symbol_characters, characters_per_row = cols_per_row * 2; int length = (int) ustrlen(source); + const int debug_print = (symbol->debug & ZINT_DEBUG_PRINT); #ifndef _MSC_VER char general_field[length + 1]; #else @@ -852,17 +853,17 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha if ((length >= 16) && ((source[0] == '0') && (source[1] == '1'))) { /* (01) and other AIs */ encoding_method = 1; - if (debug) printf("Choosing Method 1\n"); + if (debug_print) printf("Choosing Method 1\n"); } else { /* any AIs */ encoding_method = 2; - if (debug) printf("Choosing Method 2\n"); + if (debug_print) printf("Choosing Method 2\n"); } if (((length >= 20) && (encoding_method == 1)) && ((source[2] == '9') && (source[16] == '3'))) { /* Possibly encoding method > 2 */ - if (debug) printf("Checking for other methods\n"); + if (debug_print) printf("Checking for other methods\n"); if ((length >= 26) && (source[17] == '1') && (source[18] == '0')) { /* Methods 3, 7, 9, 11 and 13 */ @@ -936,7 +937,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha } } - if (debug && encoding_method != 1) printf("Now using method %d\n", encoding_method); + if (debug_print && encoding_method != 1) printf("Now using method %d\n", encoding_method); } switch (encoding_method) { /* Encoding method - Table 10 */ @@ -962,7 +963,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha read_posn = length; /* 34 or 26 */ break; } - if (debug) printf("Setting binary = %.*s\n", bp, binary_string); + if (debug_print) printf("Setting binary = %.*s\n", bp, binary_string); /* Variable length symbol bit field is just given a place holder (XX) for the time being */ @@ -981,7 +982,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha /* Now encode the compressed data field */ - if (debug) printf("Proceeding to encode data\n"); + if (debug_print) printf("Proceeding to encode data\n"); cdf_bp_start = bp; /* Debug use only */ if (encoding_method == 1) { @@ -1053,7 +1054,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha bp = bin_append_posn((int) group_val, 16, binary_string, bp); } - if (debug && bp > cdf_bp_start) { + if (debug_print && bp > cdf_bp_start) { printf("Compressed data field (%d) = %.*s\n", bp - cdf_bp_start, bp - cdf_bp_start, binary_string + cdf_bp_start); } @@ -1068,7 +1069,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha } general_field[j] = '\0'; - if (debug) printf("General field data = %s\n", general_field); + if (debug_print) printf("General field data = %s\n", general_field); if (j != 0) { /* If general field not empty */ if (!general_field_encode(general_field, j, &mode, &last_digit, binary_string, &bp)) { /* Should not happen */ @@ -1078,7 +1079,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha } } - if (debug) printf("Resultant binary = %.*s\n\tLength: %d\n", bp, binary_string, bp); + if (debug_print) printf("Resultant binary = %.*s\n\tLength: %d\n", bp, binary_string, bp); remainder = 12 - (bp % 12); if (remainder == 12) { @@ -1098,7 +1099,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha if (last_digit) { /* There is still one more numeric digit to encode */ - if (debug) printf("Adding extra (odd) numeric digit\n"); + if (debug_print) printf("Adding extra (odd) numeric digit\n"); if ((remainder >= 4) && (remainder <= 6)) { bp = bin_append_posn(ctoi(last_digit) + 1, 4, binary_string, bp); @@ -1125,7 +1126,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha remainder = (12 * (symbol_characters - 1)) - bp; - if (debug) printf("Resultant binary = %.*s\n\tLength: %d\n", bp, binary_string, bp); + if (debug_print) printf("Resultant binary = %.*s\n\tLength: %d\n", bp, binary_string, bp); } if (bp > 252) { /* 252 = (21 * 12) */ @@ -1162,7 +1163,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha binary_string[6] = d1 ? '1' : '0'; binary_string[7] = d2 ? '1' : '0'; } - if (debug) { + if (debug_print) { printf("Resultant binary = %.*s\n\tLength: %d, Symbol chars: %d\n", bp, binary_string, bp, symbol_characters); } @@ -1252,6 +1253,7 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int int bp = 0; int cols_per_row = 0; int stack_rows = 1; + const int debug_print = (symbol->debug & ZINT_DEBUG_PRINT); #ifndef _MSC_VER unsigned char reduced[src_len + 1]; char binary_string[bin_len]; @@ -1268,7 +1270,7 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int } warn_number = error_number; - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Reduced (%d): %s\n", (int) ustrlen(reduced), reduced); } @@ -1354,7 +1356,7 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int check_char = (211 * ((data_chars + 1) - 4)) + (checksum % 211); - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { printf("Data chars: %d, Check char: %d\n", data_chars, check_char); } @@ -1500,7 +1502,7 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int left_to_right = 0; } - if (symbol->debug & ZINT_DEBUG_PRINT) { + if (debug_print) { if (current_row == stack_rows) { printf("Last row: number of columns: %d / %d, left to right: %d, special case: %d\n", num_columns, cols_per_row, left_to_right, special_case_row); diff --git a/backend/sjis.c b/backend/sjis.c index 77d3761b..1b0effe6 100644 --- a/backend/sjis.c +++ b/backend/sjis.c @@ -1546,7 +1546,7 @@ INTERNAL int sjis_utf8_to_eci(const int eci, const unsigned char source[], int * if (is_eci_convertible(eci)) { int error_number; - int eci_length = get_eci_length(eci, source, *p_length); + const int eci_length = get_eci_length(eci, source, *p_length); #ifndef _MSC_VER unsigned char converted[eci_length + 1]; #else diff --git a/backend/telepen.c b/backend/telepen.c index 24c8f3f4..710a35d7 100644 --- a/backend/telepen.c +++ b/backend/telepen.c @@ -39,7 +39,7 @@ #include #include "common.h" -static char TeleTable[128][16] = { +static const char TeleTable[128][16] = { { "31313131" }, { "1131313111" }, { "33313111" }, { "1111313131" }, { "3111313111" }, { "11333131" }, { "13133131" }, { "111111313111" }, { "31333111" }, { "1131113131" }, { "33113131" }, { "1111333111" }, diff --git a/backend/tests/test_dotcode.c b/backend/tests/test_dotcode.c index 4ccd4aca..e50f5f31 100644 --- a/backend/tests/test_dotcode.c +++ b/backend/tests/test_dotcode.c @@ -1087,7 +1087,7 @@ static void test_fuzz(int index, int debug) { static void test_generate(int generate) { // roots (antilogs): root[0] = 1; for (i = 1; i < GF - 1; i++) root[i] = (PM * root[i - 1]) % GF; - static int root[GF - 1] = { + static const int root[GF - 1] = { 1, 3, 9, 27, 81, 17, 51, 40, 7, 21, 63, 76, 2, 6, 18, 54, 49, 34, 102, 80, 14, 42, 13, 39, 4, 12, 36, 108, 98, 68, diff --git a/backend/tests/test_gb18030.c b/backend/tests/test_gb18030.c index 1a5e7109..4c3dcb33 100644 --- a/backend/tests/test_gb18030.c +++ b/backend/tests/test_gb18030.c @@ -135,10 +135,10 @@ static void test_gb18030_wctomb_zint(void) { unsigned int val1_1, val1_2, val2_1, val2_2; unsigned int i; /* See: https://file.allitebooks.com/20160708/CJKV%20Information%20Processing.pdf (table 3-37, p.109, 2nd ed.) */ - static int nonpua_nonbmp[] = { + static const int nonpua_nonbmp[] = { 0x20087, 0x20089, 0x200CC, 0x215D7, 0x2298F, 0x241FE }; - static unsigned int nonpua_nonbmp_vals[] = { + static const unsigned int nonpua_nonbmp_vals[] = { 0xFE51, 0xFE52, 0xFE53, 0xFE6C, 0xFE76, 0xFE91 }; diff --git a/backend/tests/test_library.c b/backend/tests/test_library.c index ea4e9de4..23bd9cef 100644 --- a/backend/tests/test_library.c +++ b/backend/tests/test_library.c @@ -495,7 +495,7 @@ static void test_cap(int index) { testFinish(); } -static void test_cap_compliant_height() { +static void test_cap_compliant_height(void) { int symbol_id; int ret; diff --git a/backend/tests/test_pdf417.c b/backend/tests/test_pdf417.c index 74415896..ef58ccab 100644 --- a/backend/tests/test_pdf417.c +++ b/backend/tests/test_pdf417.c @@ -31,6 +31,72 @@ #include "testcommon.h" +static void test_large(int index, int debug) { + + struct item { + int symbology; + int option_1; + int option_2; + int option_3; + char *pattern; + 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_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" }, + /* 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" }, + /* 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" }, + }; + int data_size = ARRAY_SIZE(data); + int i, length, ret; + struct zint_symbol *symbol; + + char data_buf[4096]; + + testStart("test_large"); + + for (i = 0; i < data_size; i++) { + + if (index != -1 && i != index) continue; + + symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + if (data[i].length != -1) { + testUtilStrCpyRepeat(data_buf, data[i].pattern, data[i].length); + assert_equal(data[i].length, (int) strlen(data_buf), "i:%d length %d != strlen(data_buf) %d\n", i, data[i].length, (int) strlen(data_buf)); + } else { + strcpy(data_buf, data[i].pattern); + } + + length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data_buf, data[i].length, debug); + + 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 (%s)\n", i, symbol->rows, data[i].expected_rows, symbol->errtxt); + assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); + } + 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); + } + + testFinish(); +} + static void test_options(int index, int debug) { struct item { @@ -44,8 +110,6 @@ static void test_options(int index, int debug) { int ret_encode; int ret_vector; - int expected_option_1; - int expected_option_2; int expected_rows; int expected_width; const char *expected_errtxt; @@ -53,45 +117,57 @@ static void test_options(int index, int debug) { }; // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) struct item data[] = { - /* 0*/ { BARCODE_PDF417, -1, -1, -1, 0, { 0, 0, "" }, "12345", 0, 0, 2, 2, 6, 103, "", -1 }, // ECC auto-set to 2, cols auto-set to 2 - /* 1*/ { BARCODE_PDF417, -1, -1, 928, 0, { 0, 0, "" }, "12345", 0, 0, 2, 2, 6, 103, "", 0 }, // Option 3 ignored - /* 2*/ { BARCODE_PDF417, -1, -1, 300, 0, { 0, 0, "" }, "12345", 0, 0, 2, 2, 6, 103, "", 0 }, // Option 3 ignored - /* 3*/ { BARCODE_PDF417, 3, -1, -1, 0, { 0, 0, "" }, "12345", 0, 0, 3, 3, 7, 120, "", -1 }, // ECC 3, cols auto-set to 3 - /* 4*/ { BARCODE_PDF417, 3, 2, -1, 0, { 0, 0, "" }, "12345", 0, 0, 3, 2, 10, 103, "", -1 }, // ECC 3, cols 2 - /* 5*/ { BARCODE_PDF417, 8, 2, -1, 0, { 0, 0, "" }, "12345", ZINT_ERROR_TOO_LONG, -1, 8, 3, 0, 0, "Error 465: Data too long for specified number of columns", -1 }, // ECC 8, cols 2, fails - /* 6*/ { BARCODE_PDF417, 7, 2, -1, 0, { 0, 0, "" }, "12345", 0, 0, 7, 3, 87, 120, "", -1 }, // ECC 7, cols 2 auto-upped to 3 (no warning, unlike MICROPDF417) - /* 7*/ { BARCODE_PDF417, -1, 10, -1, 0, { 0, 0, "" }, "12345", 0, 0, 2, 10, 3, 239, "", -1 }, // ECC auto-set to 2, cols 10 - /* 8*/ { BARCODE_PDF417, 9, -1, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, 2, 2, 6, 103, "Warning 460: Security value out of range", -1 }, // Invalid ECC, auto-set - /* 9*/ { BARCODE_PDF417, -1, 31, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, 2, 2, 6, 103, "Warning 461: Number of columns out of range", 0 }, // Invalid cols, auto-set - /* 10*/ { BARCODE_PDF417, 9, -1, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, 9, 0, 0, 0, "Error 460: Security value out of range", -1 }, // Invalid ECC - /* 11*/ { BARCODE_PDF417, -1, 31, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, 31, 0, 0, "Error 461: Number of columns out of range", -1 }, // Invalid cols - /* 12*/ { BARCODE_PDF417, -1, 1, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI", ZINT_ERROR_TOO_LONG, -1, 4, 2, 0, 0, "Error 465: Data too long for specified number of columns", -1 }, // Cols 1 too small - /* 13*/ { BARCODE_MICROPDF417, -1, 5, -1, 0, { 0, 0, "" }, "12345", ZINT_WARN_INVALID_OPTION, 0, -1, 1, 11, 38, "Warning 468: Specified width out of range", -1 }, // Invalid cols, auto-set to 1 - /* 14*/ { BARCODE_MICROPDF417, -1, 5, -1, WARN_FAIL_ALL, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, -1, -1, 5, 0, 0, "Error 468: Specified width out of range", -1 }, // Invalid cols - /* 15*/ { BARCODE_MICROPDF417, -1, 1, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM", ZINT_WARN_INVALID_OPTION, 0, -1, 2, 17, 55, "Warning 469: Specified symbol size too small for data", -1 }, // Cols 1 too small, auto-upped to 2 with warning - /* 16*/ { BARCODE_MICROPDF417, -1, 1, -1, WARN_FAIL_ALL, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM", ZINT_ERROR_INVALID_OPTION, 0, -1, 1, 0, 0, "Error 469: Specified symbol size too small for data", -1 }, // Cols 1 too small - /* 17*/ { BARCODE_MICROPDF417, -1, 2, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWX", ZINT_WARN_INVALID_OPTION, 0, -1, 4, 15, 99, "Warning 470: Specified symbol size too small for data", -1 }, // Cols 2 too small, auto-upped to 4 with warning - /* 18*/ { BARCODE_MICROPDF417, -1, 2, -1, WARN_FAIL_ALL, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWX", ZINT_ERROR_INVALID_OPTION, 0, -1, 2, 0, 0, "Error 470: Specified symbol size too small for data", -1 }, // Cols 2 too small - /* 19*/ { BARCODE_MICROPDF417, -1, 3, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKL", ZINT_WARN_INVALID_OPTION, 0, -1, 4, 32, 99, "Warning 471: Specified symbol size too small for data", -1 }, // Cols 3 too small, auto-upped to 4 with warning - /* 20*/ { BARCODE_MICROPDF417, -1, 3, -1, WARN_FAIL_ALL, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKL", ZINT_ERROR_INVALID_OPTION, 0, -1, 3, 0, 0, "Error 471: Specified symbol size too small for data", -1 }, // Cols 3 too small - /* 21*/ { BARCODE_PDF417, -1, 1, -1, 0, { 0, 0, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH", 0, 0, 3, 2, 89, 103, "", -1 }, // Cols 1 just fits - /* 22*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH", ZINT_ERROR_TOO_LONG, -1, 4, 2, 0, 0, "Error 465: Data too long for specified number of columns", -1 }, // Cols 1 too small with Structured Append - /* 23*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", 0, 0, 3, 2, 89, 103, "", -1 }, // Cols 1 with Structured Append just fits - /* 24*/ { BARCODE_PDF417, -1, 1, -1, 0, { 2, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTU", ZINT_ERROR_TOO_LONG, -1, 4, 2, 0, 0, "Error 465: Data too long for specified number of columns", -1 }, // Cols 1 too small with Structured Append as last symbol (uses extra terminating codeword) - /* 25*/ { BARCODE_PDF417, -1, 1, -1, 0, { 2, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", 0, 0, 3, 2, 89, 103, "", -1 }, // Cols 1 with Structured Append as last symbol just fits with 1 less character pair - /* 26*/ { BARCODE_PDF417, -1, 1, -1, 0, { 3, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 741: Structured Append index out of range (1-2)", -1 }, - /* 27*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 1, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 740: Structured Append count out of range (2-99999)", -1 }, - /* 28*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 100000, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 740: Structured Append count out of range (2-99999)", -1 }, - /* 29*/ { BARCODE_PDF417, -1, 1, -1, 0, { 0, 2, "" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 741: Structured Append index out of range (1-2)", -1 }, - /* 30*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "1" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", 0, 0, 3, 2, 89, 103, "", -1 }, - /* 31*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "123123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP", 0, 0, 3, 2, 89, 103, "", -1 }, - /* 32*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "123123123123123123123123123123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 0, 3, 2, 89, 103, "", -1 }, - /* 33*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "1231231231231231231231231231231" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 742: Structured Append ID too long (30 digit maximum)", -1 }, - /* 34*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "23123123123123123123123123123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 0, 3, 2, 89, 103, "", -1 }, - /* 35*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "A" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 743: Invalid Structured Append ID (digits only)", -1 }, - /* 36*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "900" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 744: Structured Append ID triplet 1 '900' out of range (000-899)", -1 }, - /* 37*/ { BARCODE_PDF417, -1, 1, -1, 0, { 1, 2, "123123123123123123123123901123" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 0, 0, "Error 744: Structured Append ID triplet 9 '901' out of range (000-899)", -1 }, - /* 38*/ { BARCODE_MICROPDF417, -1, -1, -1, 0, { 1, 2, "1231231231231231231231231231231" }, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGH", ZINT_ERROR_INVALID_OPTION, -1, -1, 0, 0, 0, "Error 742: Structured Append ID too long (30 digit maximum)", -1 }, // Micro PDF417 same error checking code + /* 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 + /* 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 }, + /* 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", -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)", 0 }, // Invalid cols, auto-set + /* 12*/ { BARCODE_PDF417, -1, -1, 2, 0, { 0, 0, "" }, "12345", ZINT_ERROR_INVALID_OPTION, 0, 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, 0, 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 460: Security value out of range", -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 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 + /* 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 + /* 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, 0, 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, 0, 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, 0, 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 + /* 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 }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -119,8 +195,6 @@ static void test_options(int index, int debug) { 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->option_1, data[i].expected_option_1, "i:%d symbol->option_1 %d != %d (%d) (%s)\n", i, symbol->option_1, data[i].expected_option_1, data[i].option_1, symbol->errtxt); - assert_equal(symbol->option_2, data[i].expected_option_2, "i:%d symbol->option_2 %d != %d (%d) (%s)\n", i, symbol->option_2, data[i].expected_option_2, data[i].option_2, symbol->errtxt); if (data[i].option_3 != -1) { assert_equal(symbol->option_3, data[i].option_3, "i:%d symbol->option_3 %d != %d\n", i, symbol->option_3, data[i].option_3); // Unchanged } else { @@ -271,6 +345,9 @@ static void test_input(int index, int generate, int debug) { /* 42*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 4, 4, "017053" }, "A", 0, 0, 6, 99, "(24) 900 29 928 111 103 17 53 923 1 111 104 922 837 837 774 835 701 445 926 428 285 851 334", "H.4 example last segment" }, /* 43*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 3, 4, "" }, "A", 0, 0, 17, 38, "(17) 900 29 900 928 111 102 923 1 111 104 343 717 634 693 618 860 618", "No ID" }, /* 44*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 99999, 99999, "100200300" }, "A", 0, 0, 11, 55, "(22) 900 29 928 222 198 100 200 300 923 1 222 199 922 693 699 895 719 637 154 478 399 638", "IDs '100', '200', '300'" }, + /* 45*/ { BARCODE_PDF417, DATA_MODE, -1, -1, -1, { 0, 0, "" }, "123456", 0, 0, 7, 103, "(14) 6 902 1 348 256 900 759 577 359 263 64 409 852 154", "" }, + /* 46*/ { BARCODE_PDF417, DATA_MODE, -1, -1, -1, { 0, 0, "" }, "12345678901234567890", 0, 0, 9, 103, "(18) 10 902 211 358 354 304 269 753 190 900 327 902 163 367 231 586 808 731", "" }, + /* 47*/ { 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", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -326,6 +403,7 @@ static void test_encode(int index, int generate, int debug) { int input_mode; int option_1; int option_2; + int option_3; char *data; int ret; @@ -336,7 +414,7 @@ static void test_encode(int index, int generate, int debug) { char *expected; }; struct item data[] = { - /* 0*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 2, "PDF417 Symbology Standard", 0, 10, 103, 0, "ISO 15438:2015 Figure 1, same, BWIPP uses different encodation, same codeword count", + /* 0*/ { BARCODE_PDF417, -1, UNICODE_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" "1111111101010100011101010111111000101100110111100001110111111000101011010100111110000111111101000101001" @@ -348,14 +426,14 @@ static void test_encode(int index, int generate, int debug) { "1111111101010100011010011011111100110000101001111101101111100010001010100110011111000111111101000101001" "1111111101010100010100011000001100100010111101111001100011100011001011010001100011100111111101000101001" }, - /* 1*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 2, "PDF417", 0, 5, 103, 1, "ISO 15438:2015 Annex Q example for generating ECC", + /* 1*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 2, -1, "PDF417", 0, 5, 103, 1, "ISO 15438:2015 Annex Q example for generating ECC", "1111111101010100011110101011110000110101000110000001110111011001100011110101011110000111111101000101001" "1111111101010100011111101010011100110100001110001001111010001010000011111101010111000111111101000101001" "1111111101010100011101010111111000101100110011110001100011111001001011101010011111100111111101000101001" "1111111101010100010101111001111000101011101110000001100001101000100010101111001111000111111101000101001" "1111111101010100011101011100011000100001101011111101111110110001011011101011100110000111111101000101001" }, - /* 2*/ { BARCODE_PDF417, -1, UNICODE_MODE, 0, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ ", 0, 17, 86, 1, "Text Compaction Alpha", + /* 2*/ { BARCODE_PDF417, -1, UNICODE_MODE, 0, 1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ ", 0, 17, 86, 1, "Text Compaction Alpha", "11111111010101000111110101001111101101011001110000011101010111000000111111101000101001" "11111111010101000111111010101110001111110101011100011110101000100000111111101000101001" "11111111010101000110101011111000001010011001111100011101010111111000111111101000101001" @@ -374,7 +452,7 @@ static void test_encode(int index, int generate, int debug) { "11111111010101000110010110111000001100011000100001011100101000111000111111101000101001" "11111111010101000101000111100100001110000101100010010100011110000100111111101000101001" }, - /* 3*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 1, "abcdefghijklmnopqrstuvwxyz ", 0, 19, 86, 1, "Text Compaction Lower", + /* 3*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 1, -1, "abcdefghijklmnopqrstuvwxyz ", 0, 19, 86, 1, "Text Compaction Lower", "11111111010101000110101000110000001101011001110000011101010111000000111111101000101001" "11111111010101000111110101001100001100000101110010011111010100011000111111101000101001" "11111111010101000110101011111000001111101011110110011010100111110000111111101000101001" @@ -395,7 +473,7 @@ static void test_encode(int index, int generate, int debug) { "11111111010101000111111001011101101010000001001111010010111001111110111111101000101001" "11111111010101000111011010000110001000100111001110011110110100111000111111101000101001" }, - /* 4*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 2, "abcdefgABCDEFG", 0, 9, 103, 1, "Text Compaction Lower Alpha", + /* 4*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 2, -1, "abcdefgABCDEFG", 0, 9, 103, 1, "Text Compaction Lower Alpha", "1111111101010100011111010101111100110101000001100001000001010000010011110101011110000111111101000101001" "1111111101010100011110101000010000111101011100111001110100111001100011110101001000000111111101000101001" "1111111101010100011101010111111000111110010111101101000001110100110010101000011110000111111101000101001" @@ -406,14 +484,14 @@ static void test_encode(int index, int generate, int debug) { "1111111101010100011111101001011100111111011010110001011100111111010010101111110111000111111101000101001" "1111111101010100011010011011111100100011101100011101010111011111100011111010011101000111111101000101001" }, - /* 5*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, "0123456&\015\011,:#-.$/+%*=^ 789", 0, 5, 137, 1, "Text Compaction Mixed", + /* 5*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, -1, "0123456&\015\011,:#-.$/+%*=^ 789", 0, 5, 137, 1, "Text Compaction Mixed", "11111111010101000111101010111100001110101100111100010000110111001100110101111001111101010001110111000011101010011100000111111101000101001" "11111111010101000111111010100111001010001111000001011101101111001100110110011110010001110010000011010011111101010111000111111101000101001" "11111111010101000110101001111100001100111010000111011011110010110000100000101011110001101111101010000011101010011111100111111101000101001" "11111111010101000101011110011110001000010000100001010010011000011000110010000100110001000011000110010010101111101111100111111101000101001" "11111111010101000111010111000110001001111001001111010000101111101100100011110010111101001111110110111011101011100110000111111101000101001" }, - /* 6*/ { BARCODE_PDF417, -1, UNICODE_MODE, 3, 2, ";<>@[\\]_'~!\015\011,:\012-.$/\"|*()?{", 0, 16, 103, 1, "Text Compaction Punctuation", + /* 6*/ { BARCODE_PDF417, -1, UNICODE_MODE, 3, 2, -1, ";<>@[\\]_'~!\015\011,:\012-.$/\"|*()?{", 0, 16, 103, 1, "Text Compaction Punctuation", "1111111101010100011111010100111110111010110011110001000111011100100011110101011110000111111101000101001" "1111111101010100011111010100001100111111010101110001101011111101111011110101000100000111111101000101001" "1111111101010100011101010111111000101000001000111101011011001111000011010100001111100111111101000101001" @@ -431,7 +509,7 @@ static void test_encode(int index, int generate, int debug) { "1111111101010100011101000011111010111111010001101001011000010011100010010101111000000111111101000101001" "1111111101010100011001011011100000110011001100001101100100101100000011110010100011110111111101000101001" }, - /* 7*/ { BARCODE_PDF417, -1, UNICODE_MODE, 4, 2, "\015\015\015\015\010\015", 0, 20, 103, 0, "Text Compaction Punctuation 1 Mixed -> Text Byte; BWIPP uses Byte only", + /* 7*/ { BARCODE_PDF417, -1, UNICODE_MODE, 4, 2, -1, "\015\015\015\015\010\015", 0, 20, 103, 0, "Text Compaction Punctuation 1 Mixed -> Text Byte; BWIPP uses Byte only", "1111111101010100011010100011000000110101000011000001110001110110110011110101011110000111111101000101001" "1111111101010100011110101101100000101100101111110001111001000110110011111010100011000111111101000101001" "1111111101010100011101010111111000110011111101100101010100001111000011010110111111000111111101000101001" @@ -453,7 +531,7 @@ static void test_encode(int index, int generate, int debug) { "1111111101010100011101101000011000100000100011001101011001111101111011111011010011110111111101000101001" "1111111101010100011110100000110110111110111011001001111100001010011010100001111101100111111101000101001" }, - /* 8*/ { BARCODE_PDF417, -1, UNICODE_MODE, 4, 3, "??????ABCDEFG??????abcdef??????%%%%%%", 0, 19, 120, 1, "Text Compaction Punctuation Alpha Punctuation Lower Punctuation Mixed", + /* 8*/ { BARCODE_PDF417, -1, UNICODE_MODE, 4, 3, -1, "??????ABCDEFG??????abcdef??????%%%%%%", 0, 19, 120, 1, "Text Compaction Punctuation Alpha Punctuation Lower Punctuation Mixed", "111111110101010001101010001100000011010111001111000100011101110010001100111000110010011111010101111100111111101000101001" "111111110101010001111010100000010011111001110011010111110011100110101101111100101111011111010100011000111111101000101001" "111111110101010001010100111100000011111010111101100101000100000111101111100101111011010101101111100000111111101000101001" @@ -474,7 +552,7 @@ static void test_encode(int index, int generate, int debug) { "111111110101010001111100101110010010011100000100110100111010000110001100110100001111011100101111100010111111101000101001" "111111110101010001110110100001100010011001111001110101111011110001001011011100011000011011010001000000111111101000101001" }, - /* 9*/ { BARCODE_PDF417, -1, UNICODE_MODE, -1, -1, ";;;;;é;;;;;", 0, 7, 120, 0, "BWIPP different encodation", + /* 9*/ { BARCODE_PDF417, -1, UNICODE_MODE, -1, -1, -1, ";;;;;é;;;;;", 0, 7, 120, 0, "BWIPP different encodation", "111111110101010001111101010111110011101011011110000100011101110010001110101011100000011111010101111100111111101000101001" "111111110101010001111101010001100011111010101100000111110101110111101011111100100011011110101001000000111111101000101001" "111111110101010001010100111100000010110010000001110110001111100100101000000110100111011010100011111000111111101000101001" @@ -483,14 +561,14 @@ static void test_encode(int index, int generate, int debug) { "111111110101010001111101011110110010111000110001110111011111100100101111101001111011011110101111000010111111101000101001" "111111110101010001110100111011111010110011001000000100001100110001001001110011100100011101001110111110111111101000101001" }, - /* 10*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, "12345678901234", 0, 5, 120, 1, "Numeric Compaction", + /* 10*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, -1, "12345678901234", 0, 5, 120, 1, "Numeric Compaction", "111111110101010001111010101111000011101010001110000100111101111010001001011100001110011111010101111100111111101000101001" "111111110101010001111110101000111011010000001110010111111011010011001111010100000010011111101010111000111111101000101001" "111111110101010001010100111100000010111000110011100101110011000011101110001111110101011101010001111110111111101000101001" "111111110101010001010111100111100010001100001100010100001100011101101110101100111100011010111100111110111111101000101001" "111111110101010001110101110000110011000000101110010110001001110000101011001000111111011101011100110000111111101000101001" }, - /* 11*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, "1234567890123456789012345678901234567890123", 0, 9, 120, 1, "Numeric Compaction 43 consecutive", + /* 11*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, -1, "1234567890123456789012345678901234567890123", 0, 9, 120, 1, "Numeric Compaction 43 consecutive", "111111110101010001111101010111110011010110001110000100111101111010001101001101110000011111010101111100111111101000101001" "111111110101010001111010100001000011010011100001000110100111101100001110000101100001011110101001000000111111101000101001" "111111110101010001010100111100000011111010111000010110010010011111001000011010000111010101000011110000111111101000101001" @@ -501,7 +579,7 @@ static void test_encode(int index, int generate, int debug) { "111111110101010001111110100101110010100111100001000110000101111001101110010110000100010101111110111000111111101000101001" "111111110101010001111110100110010011100100111110100100111110011000101001111000010001011111010011101000111111101000101001" }, - /* 12*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, "12345678901234567890123456789012345678901234", 0, 9, 120, 1, "Numeric Compaction 44 consecutive", + /* 12*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, -1, "12345678901234567890123456789012345678901234", 0, 9, 120, 1, "Numeric Compaction 44 consecutive", "111111110101010001111101010111110011010110001110000100111101111010001000100011000011011111010101111100111111101000101001" "111111110101010001111010100001000011101001100100000111010001100001001110010000001101011110101001000000111111101000101001" "111111110101010001010100111100000011111100010110100101001100001111101010110011111000010101000011110000111111101000101001" @@ -512,7 +590,7 @@ static void test_encode(int index, int generate, int debug) { "111111110101010001111110100101110011100110011101000100110001011111101101001110000001010101111110111000111111101000101001" "111111110101010001111110100110010010111001100011100101000110111110001001100001000111011111010011101000111111101000101001" }, - /* 13*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, "123456789012345678901234567890123456789012345", 0, 9, 120, 1, "Numeric Compaction 45 consecutive", + /* 13*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, -1, "123456789012345678901234567890123456789012345", 0, 9, 120, 1, "Numeric Compaction 45 consecutive", "111111110101010001111101010111110011010110001110000100111101111010001000100011000011011111010101111100111111101000101001" "111111110101010001111010100001000011101001100100000111010001100001001110010000001101011110101001000000111111101000101001" "111111110101010001010100111100000011111100010110100101001100001111101010110011111000010101000011110000111111101000101001" @@ -523,7 +601,7 @@ static void test_encode(int index, int generate, int debug) { "111111110101010001111110100101110011110001001101100111101001110011101101111010111110010101111110111000111111101000101001" "111111110101010001111110100110010011011110011001110110011100100011101100100100011111011111010011101000111111101000101001" }, - /* 14*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567", 0, 14, 120, 1, "Numeric Compaction 87 consecutive", + /* 14*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567", 0, 14, 120, 1, "Numeric Compaction 87 consecutive", "111111110101010001111010100111100011111010111111010100111101111010001000100011000011011111010101111100111111101000101001" "111111110101010001111110101000111011101001100100000111010001100001001110010000001101011111101010011100111111101000101001" "111111110101010001010100111100000011111100010110100101001100001111101010110011111000011101010001111110111111101000101001" @@ -539,7 +617,7 @@ static void test_encode(int index, int generate, int debug) { "111111110101010001010000010100000011110111001001100110100000100110001110111100011010011010000111011110111111101000101001" "111111110101010001111101000100011011100101110011000111100011001101001000001011110001011110100010010000111111101000101001" }, - /* 15*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", 0, 14, 120, 1, "Numeric Compaction 88 consecutive", + /* 15*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", 0, 14, 120, 1, "Numeric Compaction 88 consecutive", "111111110101010001111010100111100011111010111111010100111101111010001000100011000011011111010101111100111111101000101001" "111111110101010001111110101000111011101001100100000111010001100001001110010000001101011111101010011100111111101000101001" "111111110101010001010100111100000011111100010110100101001100001111101010110011111000011101010001111110111111101000101001" @@ -555,7 +633,7 @@ static void test_encode(int index, int generate, int debug) { "111111110101010001010000010100000011100010110011110111011001100111001110011010000110011010000111011110111111101000101001" "111111110101010001111101000100011011110010110000110111011100111100101111010000110011011110100010010000111111101000101001" }, - /* 16*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 0, 14, 120, 1, "Numeric Compaction 89 consecutive", + /* 16*/ { BARCODE_PDF417, -1, UNICODE_MODE, 2, 3, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", 0, 14, 120, 1, "Numeric Compaction 89 consecutive", "111111110101010001111010100111100011111010111111010100111101111010001000100011000011011111010101111100111111101000101001" "111111110101010001111110101000111011101001100100000111010001100001001110010000001101011111101010011100111111101000101001" "111111110101010001010100111100000011111100010110100101001100001111101010110011111000011101010001111110111111101000101001" @@ -571,7 +649,7 @@ static void test_encode(int index, int generate, int debug) { "111111110101010001010000010100000011100110011001110100111011110110001100010000100110011010000111011110111111101000101001" "111111110101010001111101000100011011100101110001100110001001110100001010001111000001011110100010010000111111101000101001" }, - /* 17*/ { BARCODE_PDF417, -1, UNICODE_MODE, 0, 3, "AB{} C#+ de{} {}F 12{} G{} H", 0, 10, 120, 0, "Text Compaction newtable, BWIPP uses PUNCT_SHIFT better for less codewords", + /* 17*/ { BARCODE_PDF417, -1, UNICODE_MODE, 0, 3, -1, "AB{} C#+ de{} {}F 12{} G{} H", 0, 10, 120, 0, "Text Compaction newtable, BWIPP uses PUNCT_SHIFT better for less codewords", "111111110101010001110101001110000011010111000111100111101010111100001000111011100100011111010101111100111111101000101001" "111111110101010001111101010110000011100000101100010100111110100111001110001100011101011111010100110000111111101000101001" "111111110101010001010100111100000010111111001110100100001101011100001001111101101000011010101111100000111111101000101001" @@ -583,39 +661,39 @@ static void test_encode(int index, int generate, int debug) { "111111110101010001111110100110010010111111011100100110001111001011001011001100111100010100110111110000111111101000101001" "111111110101010001010001100000110010000110001100100110011100110100001100100100110000010100011000011000111111101000101001" }, - /* 18*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, "\177\177\177\177\177", 0, 3, 137, 1, "Byte Compaction", + /* 18*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, -1, "\177\177\177\177\177", 0, 3, 137, 1, "Byte Compaction", "11111111010101000111010101110000001101010000110000010000010000100010101000001001000001010000010010000011101010011100000111111101000101001" "11111111010101000111101010001000001111101000100011011111010001000110111110100010001101011111101011000011111010101100000111111101000101001" "11111111010101000110101001111100001100011110101100011001101011110000100000111010110001011110011100111010101000111100000111111101000101001" }, - /* 19*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, "\177\177\177\177\177\177", 0, 3, 137, 1, "Byte Compaction, mod 6 == 0 (924 emitted)", + /* 19*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, -1, "\177\177\177\177\177\177", 0, 3, 137, 1, "Byte Compaction, mod 6 == 0 (924 emitted)", "11111111010101000111010101110000001101010000110000011000111000110100111001001100111101000010100001000011101010011100000111111101000101001" "11111111010101000111101010001000001110010000111011010100111110000110111101001100001101011111101011000011111010101100000111111101000101001" "11111111010101000110101001111100001011111011101100010000001110100110110000011010111101111010111100001010101000111100000111111101000101001" }, - /* 20*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, "\177\177\177\177\177\177\177", 0, 3, 137, 1, "Byte Compaction", + /* 20*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, -1, "\177\177\177\177\177\177\177", 0, 3, 137, 1, "Byte Compaction", "11111111010101000111010101110000001101010000110000010000010000100010111001001100111101000010100001000011101010011100000111111101000101001" "11111111010101000111101010001000001110010000111011010100111110000110111101001100001101111101000100011011111010101100000111111101000101001" "11111111010101000110101001111100001011000110011110010110001000111000100011010000111001001100100001110010101000111100000111111101000101001" }, - /* 21*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, "\177\177\177\177\177\177\177\177\177\177\177", 0, 4, 137, 1, "Byte Compaction", + /* 21*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, -1, "\177\177\177\177\177\177\177\177\177\177\177", 0, 4, 137, 1, "Byte Compaction", "11111111010101000111101010111100001101011011100000010000010000100010111001001100111101000010100001000011101010011100000111111101000101001" "11111111010101000111110101001100001110010000111011010100111110000110111101001100001101111101000100011011111101010111000111111101000101001" "11111111010101000110101001111100001010000001011110010100000010111100101000000101111001010000001011110011010100111110000111111101000101001" "11111111010101000101011110011110001010001000001000011011000010100000111000110001001101100111000110010010101111101111100111111101000101001" }, - /* 22*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, "\177\177\177\177\177\177\177\177\177\177\177\177", 0, 4, 137, 1, "Byte Compaction, mod 6 == 0 (924 emitted)", + /* 22*/ { BARCODE_PDF417, -1, UNICODE_MODE, 1, 4, -1, "\177\177\177\177\177\177\177\177\177\177\177\177", 0, 4, 137, 1, "Byte Compaction, mod 6 == 0 (924 emitted)", "11111111010101000111101010111100001101011011100000011000111000110100111001001100111101000010100001000011101010011100000111111101000101001" "11111111010101000111110101001100001110010000111011010100111110000110111101001100001101111001010010000011111101010111000111111101000101001" "11111111010101000110101001111100001001110000100110010011000100001110101000011001111101101000101111100011010100111110000111111101000101001" "11111111010101000101011110011110001101000100011000010011000111001100110001100001000101110100010111000010101111101111100111111101000101001" }, - /* 23*/ { BARCODE_PDF417, -1, UNICODE_MODE, -1, 5, "1\177", 0, 3, 154, 1, "Byte Compaction, 1 Numeric, 1 Byte", + /* 23*/ { BARCODE_PDF417, -1, UNICODE_MODE, -1, 5, -1, "1\177", 0, 3, 154, 1, "Byte Compaction, 1 Numeric, 1 Byte", "1111111101010100011101010111000000111010100011100001000001000010001011010011011100000101000001001000001000011000110010011110101001111000111111101000101001" "1111111101010100011110101000010000101111110101100001011111101011000011101001110110000111000010110100001110000110011101011111010101100000111111101000101001" "1111111101010100011101010011111100100111100000100101101100010011110010111100000110110101101110111110001001101011100000010101000011110000111111101000101001" }, - /* 24*/ { BARCODE_PDF417, -1, UNICODE_MODE, -1, 5, "ABCDEF1234567890123\177\177\177\177VWXYZ", 0, 6, 154, 1, "Text, Numeric, Byte, Text", + /* 24*/ { BARCODE_PDF417, -1, UNICODE_MODE, -1, 5, -1, "ABCDEF1234567890123\177\177\177\177VWXYZ", 0, 6, 154, 1, "Text, Numeric, Byte, Text", "1111111101010100011110101011110000110101110111100001111010101111000010100111001110000110100000101100001001111011110100011110101001111000111111101000101001" "1111111101010100011110101000010000111101011001100001010011110000100011111100011101010110000010111000101111001011011000011111101010111000111111101000101001" "1111111101010100011101010011111100110011111101100101010000001011110010100000010111100101000000101111001010000001011110010101000011110000111111101000101001" @@ -623,7 +701,7 @@ static void test_encode(int index, int generate, int debug) { "1111111101010100011010111000001000101111110101100001011111101011000011001011111001110111100100100100001011111101011000011101011100110000111111101000101001" "1111111101010100011111010111100110110111110110011001101001011111000010101110011111100100100001000111101011000000101110011110101111101100111111101000101001" }, - /* 25*/ { BARCODE_PDF417, -1, UNICODE_MODE, 6, 5, "ABCDEF1234567890123\177\177\177\177VWXYZ", 0, 30, 154, 1, "ECC 6: Text, Numeric, Byte, Text", + /* 25*/ { BARCODE_PDF417, -1, UNICODE_MODE, 6, 5, -1, "ABCDEF1234567890123\177\177\177\177VWXYZ", 0, 30, 154, 1, "ECC 6: Text, Numeric, Byte, Text", "1111111101010100010101000001000000110101110111100001111010101111000010100111001110000110100000101100001001111011110100011110101001111000111111101000101001" "1111111101010100011110101100011000111101011001100001010011110000100011111100011101010110000010111000101111001011011000011111010100001100111111101000101001" "1111111101010100011101010011111100110011111101100101010000001011110010100000010111100101000000101111001010000001011110011111101011000010111111101000101001" @@ -655,7 +733,7 @@ static void test_encode(int index, int generate, int debug) { "1111111101010100011100100110100000110101111011000001100110011110100010000010001111010111001011001000001001000011110100011110110110100000111111101000101001" "1111111101010100010110001110111110111110001011100101111101100111101010000111010110000110110010111100001111101011100100010110000011011110111111101000101001" }, - /* 26*/ { BARCODE_PDF417, -1, UNICODE_MODE, -1, 5, "ABCDEF1234567890123\177\177\177\177YZ1234567890123", 0, 6, 154, 1, "Text, Numeric, Byte, 2 Text, Numeric", + /* 26*/ { BARCODE_PDF417, -1, UNICODE_MODE, -1, 5, -1, "ABCDEF1234567890123\177\177\177\177YZ1234567890123", 0, 6, 154, 1, "Text, Numeric, Byte, 2 Text, Numeric", "1111111101010100011110101011110000110101110111100001111010101111000010100111001110000110100000101100001001111011110100011110101001111000111111101000101001" "1111111101010100011110101000010000111101011001100001010011110000100011111100011101010110000010111000101111001011011000011111101010111000111111101000101001" "1111111101010100011101010011111100100000111100101001111011011111010010011100001001100100110001000011101110100011111001010101000011110000111111101000101001" @@ -663,7 +741,7 @@ static void test_encode(int index, int generate, int debug) { "1111111101010100011010111000001000110000010111000101111001011011000010110001111101000111010011100011001110110111010000011101011100110000111111101000101001" "1111111101010100011111010111100110100001100110111101100110101111000010110011011110000111011100010111101001001001111000011110101111101100111111101000101001" }, - /* 27*/ { BARCODE_PDF417, -1, UNICODE_MODE, -1, -1, "ABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZ", 0, 14, 154, 1, "ECC 3", + /* 27*/ { BARCODE_PDF417, -1, UNICODE_MODE, -1, -1, -1, "ABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZABCDEFGHIJKLMOPQRSTUVWXYZ", 0, 14, 154, 1, "ECC 3", "1111111101010100011110101001111000111010011001111001111010101111000010100111001110000110100000101100001111011010000111011110101001111000111111101000101001" "1111111101010100011110101000001000100101111001000001110110111100110011101100111100110111000101100100001110001001110011011111101010011100111111101000101001" "1111111101010100011101010011111100110111100010011001000001000101111010011110011000110101111100011001001111101011110110010101000001111000111111101000101001" @@ -679,7 +757,41 @@ static void test_encode(int index, int generate, int debug) { "1111111101010100010100000101000000111101100100011101000011011010000011001000000101100110100000010011001010000110000011010100000101000000111111101000101001" "1111111101010100011101000110100000100111101001111001111100100101100011110101101100000111100010011001101111000100000101011110100010010000111111101000101001" }, - /* 28*/ { BARCODE_PDF417COMP, -1, UNICODE_MODE, 1, 2, "PDF417 APK", 0, 6, 69, 0, "ISO 15438:2015 Figure G.1, same, BWIPP uses different encodation, same codeword count", + /* 28*/ { BARCODE_PDF417, -1, UNICODE_MODE, 8, 29, 32, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 32, 562, 1, "Max codewords (with padding)", + "1111111101010100011010100000110000111000100110111101111010101111000010100111001110000110100000101100001111011010000111011001000100110000110010000110111001110001011001111011110111010110000100110011110011101110011000010011011000110100010000100011001100100001100111001110011010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010011010111000111100111111101000101001" + "1111111101010100011110101100000110101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000011110101000001000111111101000101001" + "1111111101010100011111010111000100110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011111010111001000111111101000101001" + "1111111101010100011110100100111100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010100110000110000111111101000101001" + "1111111101010100011010111110111000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000011010111000000100111111101000101001" + "1111111101010100010100100000111100110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011010010001111100111111101000101001" + "1111111101010100010100111100011110100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010011010001100111000111111101000101001" + "1111111101010100011110100110001100101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000011111010010011000111111101000101001" + "1111111101010100011101000101111110110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011010011111100010111111101000101001" + "1111111101010100011010000101100000100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010100001100011000111111101000101001" + "1111111101010100010100111110011000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000011010011100000100111111101000101001" + "1111111101010100010100001100111110110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001010100001000011110111111101000101001" + "1111111101010100010100000100010000100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010010000110001100100100001100011001001000011000110010011110010100111100111111101000101001" + "1111111101010100011101000111000110101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000010111111010110000101111110101100001011111101011000011101000110100000111111101000101001" + "1111111101010100010010110000111110110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100011111001001011000111110010010110001111100100101100001010111110010011000000101110110001111101001001100111111011001010000011100010110101100001101111001011110001100011011010110111111000100111110011000101111100101110100010001111000101000100010001101111101011110000011011011011110101100000111001110100111101011110001100110011001001011111000110010100001111101000110100001110011001011001111110111111101000101001" + "1111111101010100011100101100111100100110011010000001001011000011000010110001110110000101000110000110001000110111000110010110001111001110111010010000111001000001010100000011010000100011000101110011100010001010000010000010010100011000110000110000110100010001101101101100000011001001000011000110000100001011001100001100101000010000101000100000101110011111011101001000110000110010000010100000100100111011100100001101100010000001011110011110010010100110000111011001000110011110111011111001010111110100111001110010001101000111011110011111011010111100111111101000101001" + "1111111101010100011101000011101100110000001011101001011111010011100011111000110001010100010001111010001000110111110100010001101111100010111001011001000001101101111100110011111011001010000100100111111011101101110101111110011101000011010000110111101111110101111101101001000011100100111101110111110110001001001111110110101100011010111100110000101111100010011101111001101110011011100100110010000101011110000100001100001000011101011100100011100110110110011110001001110101100010000010011111011011110110001011111011101011111101101110010100011111000110111111101000101001" + "1111111101010100010110100000111000101111010000100001000001110100011010001111000010100110111110000101001000101011110000010100001100111110111111011001110101110100011111001011101111010011100111101011111001101001000010011110011111100101101000111011110100011101100111110100100010111000110011100110001111001011001000011110100100010000111101001000110100111111010001011110000100100010001111101100100100101100001111101011110000101000010111111011101000111001011111000101110100111110001010110011100111110111110010111001001011110000100010011101101000111110111111101000101001" + "1111111101010100011001001011000000111110101011111001110011110011001010001000110000110110011011100111001011100011100010010110111110111100100011000011101101100010000100011010001000010010000110110000100010001100010001001100011100111000100010110010000110111001101000011001110010111011100100000101000000101000001100001000110111011001101001000000110110010010000001110100001101111011100110010000110110010111101111101101000100001100010111000011101000110011001001000001101111001110010011101011100111110111110110010111101111101100101111011001001101110000111111101000101001" + "1111111101010100011110100000010010110001100111100101011111010001110011100000100011010101110111111001001111010001000010011101101110010000110101110010000001101000111010000010110101111110000101111100101110001100101110000001010111101100111110111001001110110001010001111110111011100011011101000110000100111101101110010011000010011100001101110100111101000010100001011000111111011010111011111100010110101111100011101111101110111011011111100101001110101110011011111101010001111101100010001111101011100110100011100100001101000011100010011110100000100100111111101000101001" + "1111111101010100011111011011110100100011110101000001010010111100000010001010000011110110111110001000101110110010011111011001111011001110110000011101011101011101110111100011111000101110100101100000101110001000110100001110011011110100000110101111101100001001000111000001011011000111100010110101110011000111001111000101111010010010111011111100110111100010001101101111000101100010000010101111000111111001011010001000111110011010010000111100101000101100111001111101001111001000010011111101001100100101111011100011101011100100000110010110111000111110111111101000101001" + "1111111101010100010010011101110000111001000100011101011000111100111011010000111011110111001100010110001100111001101000011010000010001100110110010000100001001000110110000011011011100111000110111000110001001000010000100100010001100110000100100100111100111101001111011110010011001101110011100110011000010100001011000110000010011110001101011100110001101100001101111101101001111010110000111011000111110101111110101001110000111010011000100010000110110000010010011001110100000100111011000110100000100100110011110111001100001100001001011011001000100000111111101000101001" + "1111111101010100011100101110110000110011011110100001111110111010100010111011001111110100110001111101001100001001110001011111010100110000111001100111001001001111101011100011110010001101100111110010101100001111000100100001011111010100011000111000001001100101111100110100010010110001111110110111110110110011001111101000100110010001100101111110101001111101100001111101000010011011111001000010110101110111111001001111101100110011010011110101111000111011001110000101110010110000001010111101000111100110001000111000101001011110001000011110010100000100111111101000101001" + "1111111101010100011001000100111110100111010001100001001101000001110010100110011111000110100001001111101100011010011110010011000010011100110111100001011001111010011110001011001111000010110101101001110000001000111100010100011101110100011110110011111001000101111001001111001010111100000100100100111001011000001110011010111110010110000110111100111111010011001001100111101000110011011101000111000101111000100010001101110000010111010000111011001110100111100001010001101000111111010010000001001011110100010010000111101101110110011110011001000101111100111111101000101001" + "1111111101010100011100100010011100110001110011000101100001100010100011000010001101110111010101110000001001000011011000010110111100011100110100001000110001010000110000110010111001110100000110110010001000001000101000100000010001101100001000111000110010001101101000010110000010011100111101100110101000001100001110110000101100011011001000000100111011100001000101000011011000010011000110100010000110010111001111001110110001001100011000010101100000111010001100111101000001000011011010110111011000000111011000001001101100010100110000010110011100110000111111101000101001" + "1111111101010100011111011010100000101101111110011001111001010001000011000100111101100111100101100011001111000101101100010001101111101000111101011000011001111000010110011011110000010010010111100101101100001110100011000010010111110100001110110001001110000101110100111100111011110101101100000111010011100011001101011110000110010011110110111110111100101110111001001111010011110011100101111011100111101110001110101111101000100110011000100111010000111101110111000101101000111000010010011111100101100111000101100000101100010001110010011001011110011000111111101000101001" + "1111111101010100010110001101111000111011110101110001100101111110010011000001101011110110111001000011101000010100011110010111000001001100110011110001011001011010000111000011111000100111010100110101110000001100110010011110011111010011101000111111010110000101101111100100100010000011110101000100100010000111101100011111010010010110000001011100110001101001111001000011100110111010110110111100000100111011101111001010000100011110011110010011110100111100010111101001100111101001100011100100101111110101100100000111001000111110011010010110001000001110111111101000101001" + "1111111101010100010110011110001110100111001111011001100011011100111010000101000010000110100001110111101111011110100100010000110111101110110110110110000001111011000100111010001000011101110100011000011001001110001100001011011110110000101110101110111001000001101100110110000011110011110010010110100010001100001100100000100011010110001110011000111000101000111001100111000110100010010111100111100100001001100001101010000100010000010111100011110100111000111011011001001000011000011011000110010100000111001100000101101101110011001000010010000100100000111111101000101001" + "1111111101010100011110010011001100101100010111111001111001001100011011101001100010000100111101101111101110100001110011011010000111010000111111011101101101001100011111001010100111111001110100010111100100001011000100111111011011111010011110110011011110100001110110000011101011001101111001000101100011111010001110110111001000011111000101001100101000111100100001100100011100100011101001101000000101000111100100001101111110100111010001111100101110100101111100001101000101111101100011011100011111010101110000101111101011010001111110011110010010010000111111101000101001" + "1111111101010100010001010001111000110101100111111001110100011111010010111100011000110110001110010011101000110101110000011111100100011010101100111011111001011001101111000011000111110100100101111011011000001010111011111100010011100011011100110111000101110001100011111001001010011010011100000100111001000001101111010111100010010111100010001000100111001000001101101000001011111010111001000110000110111101011000001011100110111000011101010111111000110011110001011001001110000010011010011100110111000100111000010001101111110101100100011100010101111110111111101000101001" + "1111111101010100010010000110110000110011010000010001010000100001000011010110111000000111011000001001101100010001001100011001100001010000111100010010111101101111011110011010001000110000110110110001000001001110110101100000011000110001001000110010001101110001010010000010000011111011110101100100010000010100001000010110001100011100010110111100110110010000001001111101100101111010000100001010000110010001100111001101110001101000011101000010111000111001000101110001000001000100100010101110001110000101000110000110001110011010000110011101100001000110111111101000101001" + "1111111101010100011011011111001100101111001001111001101110011111010011100110011100100110000100011101001111010011000110011110101110001110100010011110000101100101110000010010111101000111100111010011010000001101011111000111011110101101100000110001001111001101110100000011010010001000111101000111100010010100001111010110011000011001011111011100101000111101000001111001000001010011111001010001100111011100011110101110010000001101011011000011110010110000101110010001001001111001000010100001111100110110100111000010001011010011111100011011011110010000111111101000101001" + }, + /* 29*/ { BARCODE_PDF417COMP, -1, UNICODE_MODE, 1, 2, -1, "PDF417 APK", 0, 6, 69, 0, "ISO 15438:2015 Figure G.1, same, BWIPP uses different encodation, same codeword count", "111111110101010001111010101111000011010100001100000111011101100110001" "111111110101010001111010100010000011010000111000100111101000101000001" "111111110101010001110101011111100010110011011110000100111110011000101" @@ -687,7 +799,7 @@ static void test_encode(int index, int generate, int debug) { "111111110101010001111010111000111011011000001111010110010011101000001" "111111110101010001111010111101000011110100111101000110010010011111001" }, - /* 29*/ { BARCODE_PDF417COMP, -1, UNICODE_MODE, 4, 4, "ABCDEFG", 0, 10, 103, 1, "", + /* 30*/ { BARCODE_PDF417COMP, -1, UNICODE_MODE, 4, 4, -1, "ABCDEFG", 0, 10, 103, 1, "", "1111111101010100011101010011100000110101000011000001111010101111000010100111001110000110100000101100001" "1111111101010100011110101000000100110100000011100101011111101011000010111111010110000101111110101100001" "1111111101010100011010100111110000101111001100011001000001111010100010011111001100100111001011111001001" @@ -699,7 +811,7 @@ static void test_encode(int index, int generate, int debug) { "1111111101010100010100110011111000100110000110111101100111000010111010010001011110000110011111010001001" "1111111101010100010100011000001100110001101010000001100011000110011011001001101110000111110111110101001" }, - /* 30*/ { BARCODE_HIBC_PDF, -1, UNICODE_MODE, -1, 3, "H123ABC01234567890D", 0, 8, 120, 0, "BWIPP uses different encodation, same codeword count but zint half-pad shorter", + /* 31*/ { BARCODE_HIBC_PDF, -1, UNICODE_MODE, -1, 3, -1, "H123ABC01234567890D", 0, 8, 120, 0, "BWIPP uses different encodation, same codeword count but zint half-pad shorter", "111111110101010001111101010111110011101011001111000100000100010010001110001110100010011111010101111100111111101000101001" "111111110101010001111110101000111011110000010001010110101111110111101111100011101101011110101001000000111111101000101001" "111111110101010001010100111100000011111010111101100100001111000101001100101000011111011101010001111110111111101000101001" @@ -709,7 +821,7 @@ static void test_encode(int index, int generate, int debug) { "111111110101010001110100111011111010100110001100000110100011100111101111010010111100011101001110111110111111101000101001" "111111110101010001111101001011000011100001001100100111010000011001001111011000110100010101111110111000111111101000101001" }, - /* 31*/ { BARCODE_HIBC_PDF, -1, UNICODE_MODE, 1, 3, "A123BJC5D6E71", 0, 6, 120, 1, "BWIPP example", + /* 32*/ { BARCODE_HIBC_PDF, -1, UNICODE_MODE, 1, 3, -1, "A123BJC5D6E71", 0, 6, 120, 1, "BWIPP example", "111111110101010001111010101111000011110101101111100100000100010010001000011011100110011111010101111100111111101000101001" "111111110101010001111010100010000011110000010001010110101111110111101111000001000101011111101010111000111111101000101001" "111111110101010001010100111100000010110001100011110101111110111101101000111100011011010101000111100000111111101000101001" @@ -717,7 +829,7 @@ static void test_encode(int index, int generate, int debug) { "111111110101010001111010111000111011010111110011100110100000011100101111110101000111011101011100110000111111101000101001" "111111110101010001111101011110110010011100110011100100011110110011001011001011100000011110101111000100111111101000101001" }, - /* 32*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, "ABCDEFGHIJKLMNOPQRSTUV", 0, 20, 38, 1, "ISO 24728:2006 Figure 1 1st 1x20, same", + /* 33*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, -1, "ABCDEFGHIJKLMNOPQRSTUV", 0, 20, 38, 1, "ISO 24728:2006 Figure 1 1st 1x20, same", "11110101001000011000110010011110101001" "11100101001111110101011100011100101001" "11101101001010011001111100011101101001" @@ -739,7 +851,7 @@ static void test_encode(int index, int generate, int debug) { "11011101001111011111011010011011101001" "11011001001100010001110100011011001001" }, - /* 33*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD", 0, 20, 55, 1, "ISO 24728:2006 Figure 1 2nd 2x20, same", + /* 34*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD", 0, 20, 55, 1, "ISO 24728:2006 Figure 1 2nd 2x20, same", "1111010100100001100011001001111010101111000011110101001" "1110010100110101111110111101111101000100110011100101001" "1110110100101101100111100001011001110011111011101101001" @@ -761,7 +873,7 @@ static void test_encode(int index, int generate, int debug) { "1101110100111010110011110001000001001101100011011101001" "1101100100111100110110100001001001111001000011011001001" }, - /* 34*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN", 0, 20, 82, 1, "ISO 24728:2006 Figure 1 3rd 3x20", + /* 35*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMN", 0, 20, 82, 1, "ISO 24728:2006 Figure 1 3rd 3x20", "1100100010100001100011001001011110010111101010111100001010011100111000011100101101" "1110100010111110100010011001011110110101000011111001101001011110010000011000101101" "1110110010111100010111101001001110110110111011001111001001100001000111011000101001" @@ -783,7 +895,7 @@ static void test_encode(int index, int generate, int debug) { "1111010100101111011110100001011001000111110011010111101011110111110110011010000101" "1110010100110010001111011001011001100111000010111011001110001011100110011011000101" }, - /* 35*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZAB", 0, 20, 99, 1, "ISO 24728:2006 Figure 1 4th 4x20, same", + /* 36*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZAB", 0, 20, 99, 1, "ISO 24728:2006 Figure 1 4th 4x20, same", "110010001010000110001100100111101010111100001011110010101001110011100001101000001011000011100101101" "111010001010100001111100110100101111001000001011110110111011011110011001101100111100100011000101101" "111011001010011000010001110110011101000011101001110110110111100101100001000001010111100011000101001" @@ -805,7 +917,7 @@ static void test_encode(int index, int generate, int debug) { "111101010011100011101010000110001011101111001011001000111110111101011001100101110111100011010000101" "111001010010001000001111010111100010100001001011001100100111101101111101001110100111110011011000101" }, - /* 36*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, "123456789012345", 0, 14, 38, 1, "Number Compaction", + /* 37*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, -1, "123456789012345", 0, 14, 38, 1, "Number Compaction", "11101110101011111101001100011101110101" "11100110101110101011111100011100110101" "11110110101000001011001100011110110101" @@ -821,7 +933,7 @@ static void test_encode(int index, int generate, int debug) { "11100101001101011110000110011100101001" "11101101001101000111111001011101101001" }, - /* 37*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "\177\177\177", 0, 8, 55, 1, "Byte Compaction", + /* 38*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, -1, "\177\177\177", 0, 8, 55, 1, "Byte Compaction", "1100100010100000100001000101010000010010000011001000101" "1110100010111110100010001101111101000100011011101000101" "1110110010110001111100100101100011111001001011101100101" @@ -831,7 +943,7 @@ static void test_encode(int index, int generate, int debug) { "1100111010111001111001100101000001001101100011001110101" "1110111010111000101111011101110001000011010011101110101" }, - /* 38*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "\177\177\177\177\177\177", 0, 8, 55, 1, "Byte Compaction, mod 6 == 0 (924 emitted)", + /* 39*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, -1, "\177\177\177\177\177\177", 0, 8, 55, 1, "Byte Compaction, mod 6 == 0 (924 emitted)", "1100100010110001110001101001110010011001111011001000101" "1110100010100010001111010001110010000111011011101000101" "1110110010101000011001111101101000101111100011101100101" @@ -841,7 +953,7 @@ static void test_encode(int index, int generate, int debug) { "1100111010100100010000100001110111101100001011001110101" "1110111010111110011010100001101100001111010011101110101" }, - /* 39*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFG\177\177\177", 0, 8, 82, 1, "Text & Byte Compaction", + /* 40*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, -1, "ABCDEFG\177\177\177", 0, 8, 82, 1, "Text & Byte Compaction", "1100111010100001100011001001000010110111101010111100001010011100111000011001110101" "1110111010111110100010011001000010010110100000011100101101111110101110011101110101" "1110011010101000000101111001000011010101000000101111001010000001011110011100110101" @@ -851,7 +963,7 @@ static void test_encode(int index, int generate, int debug) { "1100001010111110111010111001001100010110011100011000101101100001100110011000010101" "1100011010110100011100001001001110010110110000111101001100011011110010011000110101" }, - /* 40*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "\177\177\177abcdefgh1234567890123", 0, 8, 99, 1, "Byte & Text & Numeric Compaction", + /* 41*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, -1, "\177\177\177abcdefgh1234567890123", 0, 8, 99, 1, "Byte & Text & Numeric Compaction", "110011101010000010000100010101000001001000001000010110101000001001000001010000010010000011001110101" "111011101010111111010110000110000010111001001000010010111101011100111001110100111001100011101110101" "111001101011111001011110110101100110011110001000011010100001111000101001111110101100010011100110101" @@ -861,7 +973,7 @@ static void test_encode(int index, int generate, int debug) { "110000101011000011010000100100000101101100001001100010101110111110111001111001110010110011000010101" "110001101011101110111100010100100011110100001001110010100000101111000101111001010010000011000110101" }, - /* 41*/ { BARCODE_HIBC_MICPDF, -1, UNICODE_MODE, -1, 4, "H123ABC01234567890D", 0, 8, 99, 0, "BWIPP uses different encodation, same codeword count but zint full-pad shorter", + /* 42*/ { BARCODE_HIBC_MICPDF, -1, UNICODE_MODE, -1, 4, -1, "H123ABC01234567890D", 0, 8, 99, 0, "BWIPP uses different encodation, same codeword count but zint full-pad shorter", "110011101010000110001100100100000100010010001000010110111000111010001001000001001100011011001110101" "111011101011010111111011110111110001110110101000010010111101011100111001011111101001100011101110101" "111001101011001010000111110100011110101000001000011010100111110001101001011011000111100011100110101" @@ -871,7 +983,7 @@ static void test_encode(int index, int generate, int debug) { "110000101010110110001000000111000101100111101001100010110111101110000101100010101100000011000010101" "110001101011110110000011010111100100001101101001110010101101011111100001111001000110011011000110101" }, - /* 42*/ { BARCODE_HIBC_MICPDF, -1, UNICODE_MODE, -1, 1, "/EAH783", 0, 17, 38, 1, "HIBC Provider Applications Standard (PAS) example", + /* 43*/ { BARCODE_HIBC_MICPDF, -1, UNICODE_MODE, -1, 1, -1, "/EAH783", 0, 17, 38, 1, "HIBC Provider Applications Standard (PAS) example", "11001101001100011111001001011001101001" "11011101001000001000100100011011101001" "11011001001000100011110100011011001001" @@ -890,7 +1002,7 @@ static void test_encode(int index, int generate, int debug) { "11010000101101100100001111011010000101" "11011000101110111000100010011011000101" }, - /* 43*/ { BARCODE_PDF417, 9, DATA_MODE, -1, -1, "\342", 0, 7, 103, 1, "β", + /* 44*/ { BARCODE_PDF417, 9, DATA_MODE, -1, -1, -1, "\342", 0, 7, 103, 1, "β", "1111111101010100011111010101111100110101000110000001100011100011001011110101011110000111111101000101001" "1111111101010100011111010100011000111110101000011001011111100100011011110101001000000111111101000101001" "1111111101010100011101010111111000110110010011110001100011111001001011010100011111000111111101000101001" @@ -899,7 +1011,7 @@ static void test_encode(int index, int generate, int debug) { "1111111101010100011110101111010000100011110001000101000110010111000011110101111000010111111101000101001" "1111111101010100011101001110111110101110001110001001010001101100000011010011101111000111111101000101001" }, - /* 44*/ { BARCODE_MICROPDF417, 9, DATA_MODE, -1, 1, "\342\343", 0, 14, 38, 1, "βγ", + /* 45*/ { BARCODE_MICROPDF417, 9, DATA_MODE, -1, 1, -1, "\342\343", 0, 14, 38, 1, "βγ", "11101110101001111110010110011101110101" "11100110101101010000111110011100110101" "11110110101000001000010001011110110101" @@ -915,7 +1027,7 @@ static void test_encode(int index, int generate, int debug) { "11100101001011100101111100011100101001" "11101101001101001001111100011101101001" }, - /* 45*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, "12345678", 0, 11, 38, 0, "1 columns x 11 rows, variant 1; BWIPP uses byte compaction TODO: investigate", + /* 46*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, -1, "12345678", 0, 11, 38, 0, "1 columns x 11 rows, variant 1; BWIPP uses byte compaction TODO: investigate", "11001000101001111011110100011100110101" "11101000101110100011000001011110110101" "11101100101000011010011100011110010101" @@ -928,7 +1040,7 @@ static void test_encode(int index, int generate, int debug) { "11110110101001000001000010011110101101" "11110010101110001001110110011110101001" }, - /* 46*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, "123456789012345678901234567890", 0, 20, 38, 1, "1 columns x 20 rows, variant 4", + /* 47*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, -1, "123456789012345678901234567890", 0, 20, 38, 1, "1 columns x 20 rows, variant 4", "11110101001001111011110100011110101001" "11100101001111101010011000011100101001" "11101101001111110010011001011101101001" @@ -950,7 +1062,7 @@ static void test_encode(int index, int generate, int debug) { "11011101001011110111101000011011101001" "11011001001010001111000010011011001001" }, - /* 47*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, "1234567890123456789012345678901234567890", 0, 24, 38, 1, "1 columns x 24 rows, variant 5", + /* 48*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, -1, "1234567890123456789012345678901234567890", 0, 24, 38, 1, "1 columns x 24 rows, variant 5", "11100110101000011110001010011110100101" "11110110101101001000011000011110101101" "11110010101101000011100010011110101001" @@ -976,7 +1088,7 @@ static void test_encode(int index, int generate, int debug) { "11001101101000101101100000011011001101" "11101101101111000010010010011011011101" }, - /* 48*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, "12345678901234567890123456789012345678901234567890", 0, 28, 38, 1, "1 columns x 28 rows, variant 6", + /* 49*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 1, -1, "12345678901234567890123456789012345678901234567890", 0, 28, 38, 1, "1 columns x 28 rows, variant 6", "11101011001001111011110100011100101101" "11101010001100010111110111011000101101" "11001010001110100111110001011000101001" @@ -1006,7 +1118,7 @@ static void test_encode(int index, int generate, int debug) { "11010000101001111001100110011001110101" "11011000101110101011100000011101110101" }, - /* 49*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "ABCDEFGHIJKLMNOPQRSTU", 0, 11, 55, 1, "2 columns x 11 rows, variant 8", + /* 50*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, -1, "ABCDEFGHIJKLMNOPQRSTU", 0, 11, 55, 1, "2 columns x 11 rows, variant 8", "1100100010100001100011001001111010101111000011100110101" "1110100010110101111110111101111101000100110011110110101" "1110110010101101100111100001011001110011111011110010101" @@ -1019,7 +1131,7 @@ static void test_encode(int index, int generate, int debug) { "1111011010111000110100001101000101110111000011110101101" "1111001010110001011100000101000100011110001011110101001" }, - /* 50*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "ABCDEFGHIJKLMNOPQRSTUVWXYZA", 0, 14, 55, 1, "2 columns x 14 rows, variant 9", + /* 51*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZA", 0, 14, 55, 1, "2 columns x 14 rows, variant 9", "1110111010101111110101100001111110101011100011101110101" "1110011010101001100111110001010000010001111011100110101" "1111011010111101101000011101100100010011000011110110101" @@ -1035,7 +1147,7 @@ static void test_encode(int index, int generate, int debug) { "1110010100101111100110111101110110011110011011100101001" "1110110100100000011010111001100111101000011011101101001" }, - /* 51*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL", 0, 17, 55, 1, "2 columns x 17 rows, variant 10", + /* 52*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL", 0, 17, 55, 1, "2 columns x 17 rows, variant 10", "1100110100110001111100100101110101011111100011001101001" "1101110100101001110011100001101000001011000011011101001" "1101100100101000011111001101001011110010000011011001001" @@ -1054,7 +1166,7 @@ static void test_encode(int index, int generate, int debug) { "1101000010101110011101111001010010011110000011010000101" "1101100010100101111101111101000110000011010011011000101" }, - /* 52*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", 0, 23, 55, 1, "2 columns x 23 rows, variant 12", + /* 53*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", 0, 23, 55, 1, "2 columns x 23 rows, variant 12", "1110011010110001111100100101110101011111100011110100101" "1111011010101001110011100001101000001011000011110101101" "1111001010101000011111001101001011110010000011110101001" @@ -1079,7 +1191,7 @@ static void test_encode(int index, int generate, int debug) { "1100100110101100011011110001111101101111010011011001001" "1100110110100001000010000101100010001000011011011001101" }, - /* 53*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQ", 0, 26, 55, 1, "2 columns x 26 rows, variant 13", + /* 54*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 2, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQ", 0, 26, 55, 1, "2 columns x 26 rows, variant 13", "1100101000110001111100100101110101011111100011000101001" "1100101100101001110011100001101000001011000011001101001" "1100101110101000011111001101001011110010000011011101001" @@ -1107,7 +1219,7 @@ static void test_encode(int index, int generate, int debug) { "1101000010100010111011111101010100011110000011001110101" "1101100010110001000001011001110101000111000011101110101" }, - /* 54*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFGHIJ", 0, 6, 82, 1, "3 columns x 6 rows, variant 14", + /* 55*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, -1, "ABCDEFGHIJ", 0, 6, 82, 1, "3 columns x 6 rows, variant 14", "1100100010100001100011001001011001110111101010111100001010011100111000011001000101" "1110100010111110100010011001001001110101000011111001101001011110010000011101000101" "1110110010110100010001111101001101110110000101001111101001000100111100011101100101" @@ -1115,7 +1227,7 @@ static void test_encode(int index, int generate, int debug) { "1101110010111010011110011101000100110111011100111100101110100111001100011011100101" "1101111010100001111010000101000110110100110100000011101100100111111001011011110101" }, - /* 55*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFGHIJKLMNOPQRSTU", 0, 10, 82, 1, "3 columns x 10 rows, variant 16", + /* 56*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, -1, "ABCDEFGHIJKLMNOPQRSTU", 0, 10, 82, 1, "3 columns x 10 rows, variant 16", "1100010010110001111100100101001111010111010101111110001010011001111100011000100101" "1110010010110100000101100001011111010111101101000011101100100010011000011100100101" "1111010010111011011110011001011110010110110011110010001110010000011010011110100101" @@ -1127,7 +1239,7 @@ static void test_encode(int index, int generate, int debug) { "1110100110101011111001100001001000110101110010011111001111101100101000011101001101" "1110101110110111101100111001001000010110111110000101001001110001101110011101011101" }, - /* 56*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCD", 0, 12, 82, 1, "3 columns x 12 rows, variant 17", + /* 57*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCD", 0, 12, 82, 1, "3 columns x 12 rows, variant 17", "1110101100100001100011001001011000010111101010111100001010011100111000011101011001" "1110101000111110100010011001011100010101000011111001101001011110010000011101010001" "1100101000111100010111101001011100110110111011001111001001100001000111011001010001" @@ -1141,7 +1253,7 @@ static void test_encode(int index, int generate, int debug) { "1100010100111101100011000101011001000110110001111000101100011001111001011000101001" "1100110100101010000011110001011001100111001111101011001111010111100010011001101001" }, - /* 57*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI", 0, 15, 82, 1, "3 columns x 15 rows, variant 18", + /* 58*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI", 0, 15, 82, 1, "3 columns x 15 rows, variant 18", "1101110100100001100011001001011000100111101010111100001010011100111000011011101001" "1101100100111110100010011001011000110101000011111001101001011110010000011011001001" "1101100110111100010111101001010000110110111011001111001001100001000111011011001101" @@ -1158,7 +1270,7 @@ static void test_encode(int index, int generate, int debug) { "1101000110111110101101110001001011100101111110101100001111100110100001011010001101" "1101000010111011101011110001011011100100011100000101101011000110001111011010000101" }, - /* 58*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", 0, 26, 82, 1, "3 columns x 26 rows, variant 20", + /* 59*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST", 0, 26, 82, 1, "3 columns x 26 rows, variant 20", "1100100010100001100011001001000011010111101010111100001010011100111000011110100101" "1110100010111110100010011001000111010101000011111001101001011110010000011110101101" "1110110010111100010111101001000110010110111011001111001001100001000111011110101001" @@ -1186,7 +1298,7 @@ static void test_encode(int index, int generate, int debug) { "1110101100100110011010000001001101000111011110001100101100110000100100011011011001" "1110101000111100010100100001011101000101111101001110001111100100010011011011010001" }, - /* 59*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 32, 82, 1, "3 columns x 26 rows, variant 20", + /* 60*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 32, 82, 1, "3 columns x 26 rows, variant 20", "1110110100110001111100100101011101100111010101111110001010011001111100011011101001" "1110100100110100000101100001001101100111101101000011101100100010011000011011001001" "1110100110111011011110011001000101100110110011110010001110010000011010011011001101" @@ -1220,7 +1332,7 @@ static void test_encode(int index, int generate, int debug) { "1101000010110010100001111101000010110100111100110011001111010000111101011000100101" "1101100010101110011101000001000010010110000100010001101110001101000011011100100101" }, - /* 60*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 38, 82, 1, "3 columns x 38 rows, variant 22", + /* 61*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 38, 82, 1, "3 columns x 38 rows, variant 22", "1100010010110001111100100101000101100111010101111110001010011001111100011010011101" "1110010010110100000101100001000101000111101101000011101100100010011000011010011001" "1111010010111011011110011001001101000110110011110010001110010000011010011010001001" @@ -1260,7 +1372,7 @@ static void test_encode(int index, int generate, int debug) { "1101000010110100101111100001001111010101000000100111101011101111011111011001101101" "1101100010111011101100001101011111010100000101000010001011110111100010011101101101" }, - /* 61*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 44, 82, 1, "3 columns x 44 rows, variant 23", + /* 62*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 3, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 44, 82, 1, "3 columns x 44 rows, variant 23", "1100100010100001100011001001011000010111101010111100001010011100111000011010001001" "1110100010111110100010011001011100010101000011111001101001011110010000011010001101" "1110110010111100010111101001011100110110111011001111001001100001000111011010000101" @@ -1306,13 +1418,13 @@ static void test_encode(int index, int generate, int debug) { "1101001000111000100010011101001111010110000010010011001111011101000110011011001101" "1101011000100100011111011001011111010111011100111100101001011110100000011011011101" }, - /* 62*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "ABCDEFG", 0, 4, 99, 1, "4 columns x 4 rows, variant 24", + /* 63*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, -1, "ABCDEFG", 0, 4, 99, 1, "4 columns x 4 rows, variant 24", "110100111010111111010110000111111010101110001001110110110101111110111101111101000100110011010010001" "110100110011111001001110010110001111100100101001110100110001111100100101100011111001001011010110001" "110100010011000110100010000101101111101111001001100100110100110000111001110011100101000011010111001" "110100011011111011001001000110100111000010001001100110101011111101110001110110111100110011010111101" }, - /* 63*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "ABCDEFGHIJKLMNOPQRS", 0, 6, 99, 1, "4 columns x 6 rows, variant 25", + /* 64*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, -1, "ABCDEFGHIJKLMNOPQRS", 0, 6, 99, 1, "4 columns x 6 rows, variant 25", "110010001010000110001100100111101010111100001011001110101001110011100001101000001011000011001000101" "111010001010100001111100110100101111001000001001001110111011011110011001101100111100100011101000101" "111011001010011000010001110110011101000011101001101110101111001000000101100011111001001011101100101" @@ -1320,7 +1432,7 @@ static void test_encode(int index, int generate, int debug) { "110111001011000110011110010101101111100001001000100110111110001010110001111101100010001011011100101" "110111101010001110110001110100000100101111001000110110110111100000101101111000101111001011011110101" }, - /* 64*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJK", 0, 10, 99, 1, "4 columns x 10 rows, variant 27", + /* 65*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJK", 0, 10, 99, 1, "4 columns x 10 rows, variant 27", "110001001011000111110010010111010101111110001001111010101001100111110001010000010001111011000100101" "111001001011110110100001110110010001001100001011111010110010000110111001110001011001111011100100101" "111101001011100100000110100100110101111110001011110010100110010111111001111101110011001011110100101" @@ -1332,7 +1444,7 @@ static void test_encode(int index, int generate, int debug) { "111010011011101100000111010110111111010111001001000110100010011111011001111010110000110011101001101" "111010111011001111110110010100011101000011001001000010101111100110010001011100001100111011101011101" }, - /* 65*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD", 0, 12, 99, 1, "4 columns x 12 rows, variant 28", + /* 66*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD", 0, 12, 99, 1, "4 columns x 12 rows, variant 28", "111010110010000110001100100111101010111100001011000010101001110011100001101000001011000011101011001" "111010100010100001111100110100101111001000001011100010111011011110011001101100111100100011101010001" "110010100010011000010001110110011101000011101011100110110111100101100001000001010111100011001010001" @@ -1346,7 +1458,7 @@ static void test_encode(int index, int generate, int debug) { "110001010010001111001011110111101101100010001011001000111100111011101001111001100011001011000101001" "110011010011101111110100100101011100111111001011001100100001111000101001001111101110110011001101001" }, - /* 66*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI", 0, 15, 99, 1, "4 columns x 15 rows, variant 29", + /* 67*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI", 0, 15, 99, 1, "4 columns x 15 rows, variant 29", "110111010010000110001100100111101010111100001011000100101001110011100001101000001011000011011101001" "110110010010100001111100110100101111001000001011000110111011011110011001101100111100100011011001001" "110110011010011000010001110110011101000011101010000110110111100101100001000001010111100011011001101" @@ -1363,7 +1475,7 @@ static void test_encode(int index, int generate, int debug) { "110100011010111010000111110110001000111001001001011100111101100000110101100100011101000011010001101" "110100001010011110100100000100111110011010001011011100111011111101001001011101100011100011010000101" }, - /* 67*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 20, 99, 1, "4 columns x 20 rows, variant 30", + /* 68*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 20, 99, 1, "4 columns x 20 rows, variant 30", "110010001010000110001100100111101010111100001011110010101001110011100001101000001011000011100101101" "111010001010100001111100110100101111001000001011110110111011011110011001101100111100100011000101101" "111011001010011000010001110110011101000011101001110110110111100101100001000001010111100011000101001" @@ -1385,7 +1497,7 @@ static void test_encode(int index, int generate, int debug) { "111101010011001100001010000100010001000000101011001000100001100110100001110111001000100011010000101" "111001010011100101100100000111000110111000101011001100111110010010001101110001011101100011011000101" }, - /* 68*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 26, 99, 1, "4 columns x 26 rows, variant 31", + /* 69*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 26, 99, 1, "4 columns x 26 rows, variant 31", "110010001010000110001100100111101010111100001000011010101001110011100001101000001011000011110100101" "111010001010100001111100110100101111001000001000111010111011011110011001101100111100100011110101101" "111011001010011000010001110110011101000011101000110010110111100101100001000001010111100011110101001" @@ -1413,7 +1525,7 @@ static void test_encode(int index, int generate, int debug) { "111010110011000110000100100100100001001000001001101000100000100011001101000011001100001011011011001" "111010100011110100010010000111000001101110101011101000111001001110011001101111101001111011011010001" }, - /* 69*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 32, 99, 1, "4 columns x 32 rows, variant 32", + /* 70*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 32, 99, 1, "4 columns x 32 rows, variant 32", "111011010011000111110010010111010101111110001011101100101001100111110001010000010001111011011101001" "111010010011110110100001110110010001001100001001101100110010000110111001110001011001111011011001001" "111010011011100100000110100100110101111110001000101100100110010111111001111101110011001011011001101" @@ -1447,7 +1559,7 @@ static void test_encode(int index, int generate, int debug) { "110100001010110000100001110101110000011011101000010110101110000010110001101111110011010011000100101" "110110001010010000001001000110011101100001001000010010111110010101111101110001000100111011100100101" }, - /* 70*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 38, 99, 1, "4 columns x 38 rows, variant 33", + /* 71*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 38, 99, 1, "4 columns x 38 rows, variant 33", "110001001011000111110010010111010101111110001000101100101001100111110001010000010001111011010011101" "111001001011110110100001110110010001001100001000101000110010000110111001110001011001111011010011001" "111101001011100100000110100100110101111110001001101000100110010111111001111101110011001011010001001" @@ -1487,7 +1599,7 @@ static void test_encode(int index, int generate, int debug) { "110100001011001111001011000110011111010001001001111010100100101111000001011100000100011011001101101" "110110001011011101111001110111101101100111101011111010110100011001110001100110100001000011101101101" }, - /* 71*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 44, 99, 1, "4 columns x 44 rows, variant 34", + /* 72*/ { BARCODE_MICROPDF417, -1, UNICODE_MODE, -1, 4, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 44, 99, 1, "4 columns x 44 rows, variant 34", "110010001010000110001100100111101010111100001011000010101001110011100001101000001011000011010001001" "111010001010100001111100110100101111001000001011100010111011011110011001101100111100100011010001101" "111011001010011000010001110110011101000011101011100110110111100101100001000001010111100011010000101" @@ -1539,7 +1651,7 @@ static void test_encode(int index, int generate, int debug) { struct zint_symbol *symbol; char escaped[1024]; - char bwipp_buf[8192]; + char bwipp_buf[32768]; char bwipp_msg[1024]; int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise @@ -1553,14 +1665,15 @@ static void test_encode(int index, int generate, int debug) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); + length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, data[i].option_3, -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); if (generate) { - printf(" /*%3d*/ { %s, %d, %s, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\",\n", - i, testUtilBarcodeName(data[i].symbology), data[i].eci, testUtilInputModeName(data[i].input_mode), data[i].option_1, data[i].option_2, + printf(" /*%3d*/ { %s, %d, %s, %d, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\",\n", + i, testUtilBarcodeName(data[i].symbology), data[i].eci, testUtilInputModeName(data[i].input_mode), + data[i].option_1, data[i].option_2, data[i].option_3, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment); testUtilModulesPrint(symbol, " ", "\n"); @@ -1575,11 +1688,11 @@ static void test_encode(int index, int generate, int debug) { ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); - if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, debug)) { + if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, data[i].option_2, 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 { - ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); + ret = testUtilBwipp(i, symbol, data[i].option_1, data[i].option_2, data[i].option_3, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret); ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); @@ -1764,8 +1877,8 @@ static void test_fuzz(int index, int debug) { "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" - "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEF", - 1852, 0, 0 }, // Max text with ECC 0 Note: before default Text mode change the max was 1850 as given in ISO 15438:2015 + "ABCDEFGHIJKLMNOPQRSTUVWXYZABCD", + 1850, 0, 0 }, // Max text with ECC 0 /* 7*/ { BARCODE_PDF417, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -1811,8 +1924,8 @@ static void test_fuzz(int index, int debug) { "\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\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", - 1110, 0, 0 }, // Max bytes with ECC 0 should be 1108 according to ISO 15438:2015 TODO: investigate + "\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", + 1108, 0, 0 }, // Max bytes with ECC 0 /* 9*/ { BARCODE_PDF417, "\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" @@ -1842,7 +1955,7 @@ static void test_fuzz(int index, int debug) { "\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", - 1111, 0, ZINT_ERROR_TOO_LONG }, // See above + 1111, 0, ZINT_ERROR_TOO_LONG }, /*10*/ { BARCODE_MICROPDF417, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" @@ -1897,7 +2010,10 @@ static void test_fuzz(int index, int debug) { #include -#define TEST_PERF_ITERATIONS 1000 +#define TEST_PERF_ITER_MILLES 5 +#define TEST_PERF_ITERATIONS (TEST_PERF_ITER_MILLES * 1000) +#define TEST_PERF_TIME(arg) (((arg) * 1000.0) / CLOCKS_PER_SEC) + // Not a real test, just performance indicator static void test_perf(int index, int debug) { @@ -1915,7 +2031,8 @@ static void test_perf(int index, int debug) { char *comment; }; struct item data[] = { - /* 0*/ { BARCODE_PDF417, -1, -1, -1, + /* 0*/ { BARCODE_PDF417, -1, -1, -1, "1234567890", 0, 7, 103, "10 numerics" }, + /* 1*/ { BARCODE_PDF417, -1, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz&,:#-.$/+%*=^ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLM" "NOPQRSTUVWXYZ;<>@[]_`~!||()?{}'123456789012345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJK" "LMNOPQRSTUVWXYZ12345678912345678912345678912345678900001234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFG" @@ -1923,7 +2040,7 @@ static void test_perf(int index, int debug) { "890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcde" "fghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO", 0, 40, 307, "960 chars, text/numeric" }, - /* 1*/ { BARCODE_PDF417, DATA_MODE, -1, -1, + /* 2*/ { BARCODE_PDF417, DATA_MODE, -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" "\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" @@ -1952,22 +2069,32 @@ static void test_perf(int index, int debug) { }; int data_size = ARRAY_SIZE(data); int i, length, ret; + struct zint_symbol *symbol; - clock_t start, total_encode = 0, total_buffer = 0, diff_encode, diff_buffer; + clock_t start; + clock_t total_create = 0, total_encode = 0, total_buffer = 0, total_buf_inter = 0, total_print = 0; + clock_t diff_create, diff_encode, diff_buffer, diff_buf_inter, diff_print; + int comment_max = 0; if (!(debug & ZINT_DEBUG_TEST_PERFORMANCE)) { /* -d 256 */ return; } + for (i = 0; i < data_size; i++) if ((int) strlen(data[i].comment) > comment_max) comment_max = (int) strlen(data[i].comment); + + printf("Iterations %d\n", TEST_PERF_ITERATIONS); + for (i = 0; i < data_size; i++) { int j; if (index != -1 && i != index) continue; - diff_encode = diff_buffer = 0; + diff_create = diff_encode = diff_buffer = diff_buf_inter = diff_print = 0; for (j = 0; j < TEST_PERF_ITERATIONS; j++) { - struct zint_symbol *symbol = ZBarcode_Create(); + start = clock(); + symbol = ZBarcode_Create(); + diff_create += clock() - start; assert_nonnull(symbol, "Symbol not created\n"); length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug); @@ -1985,22 +2112,41 @@ static void test_perf(int index, int debug) { diff_buffer += clock() - start; assert_zero(ret, "i:%d ZBarcode_Buffer ret %d != 0 (%s)\n", i, ret, symbol->errtxt); + symbol->output_options |= OUT_BUFFER_INTERMEDIATE; + start = clock(); + ret = ZBarcode_Buffer(symbol, 0 /*rotate_angle*/); + diff_buf_inter += clock() - start; + assert_zero(ret, "i:%d ZBarcode_Buffer OUT_BUFFER_INTERMEDIATE ret %d != 0 (%s)\n", i, ret, symbol->errtxt); + symbol->output_options &= ~OUT_BUFFER_INTERMEDIATE; // Undo + + start = clock(); + ret = ZBarcode_Print(symbol, 0 /*rotate_angle*/); + diff_print += clock() - start; + assert_zero(ret, "i:%d ZBarcode_Print ret %d != 0 (%s)\n", i, ret, symbol->errtxt); + assert_zero(remove(symbol->outfile), "i:%d remove(%s) != 0\n", i, symbol->outfile); + ZBarcode_Delete(symbol); } - printf("%s: diff_encode %gms, diff_buffer %gms\n", data[i].comment, diff_encode * 1000.0 / CLOCKS_PER_SEC, diff_buffer * 1000.0 / CLOCKS_PER_SEC); + printf("%*s: encode % 8gms, buffer % 8gms, buf_inter % 8gms, print % 8gms, create % 8gms\n", comment_max, data[i].comment, + TEST_PERF_TIME(diff_encode), TEST_PERF_TIME(diff_buffer), TEST_PERF_TIME(diff_buf_inter), TEST_PERF_TIME(diff_print), TEST_PERF_TIME(diff_create)); + total_create += diff_create; total_encode += diff_encode; total_buffer += diff_buffer; + total_buf_inter += diff_buf_inter; + total_print += diff_print; } - if (index != -1) { - printf("totals: encode %gms, buffer %gms\n", total_encode * 1000.0 / CLOCKS_PER_SEC, total_buffer * 1000.0 / CLOCKS_PER_SEC); + if (index == -1) { + printf("%*s: encode % 8gms, buffer % 8gms, buf_inter % 8gms, print % 8gms, create % 8gms\n", comment_max, "totals", + TEST_PERF_TIME(total_encode), TEST_PERF_TIME(total_buffer), TEST_PERF_TIME(total_buf_inter), TEST_PERF_TIME(total_print), TEST_PERF_TIME(total_create)); } } int main(int argc, char *argv[]) { testFunction funcs[] = { /* name, func, has_index, has_generate, has_debug */ + { "test_large", test_large, 1, 0, 1 }, { "test_options", test_options, 1, 0, 1 }, { "test_reader_init", test_reader_init, 1, 1, 1 }, { "test_input", test_input, 1, 1, 1 }, diff --git a/backend/tests/test_png.c b/backend/tests/test_png.c index 1fbd58b0..befe708d 100644 --- a/backend/tests/test_png.c +++ b/backend/tests/test_png.c @@ -276,10 +276,10 @@ static void test_print(int index, int generate, int debug) { assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); if (generate) { - printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %.5g, %.5g, \"%s\", \"%s\", \"%s\", \"%s\", %d, \"%s\", \"%s\" },\n", + printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %.5g, %.5g, \"%s\", \"%s\", \"%s\", \"%s\", %s, \"%s\", \"%s\" },\n", i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].border_width, testUtilOutputOptionsName(data[i].output_options), data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt, data[i].option_1, data[i].option_2, data[i].height, data[i].scale, data[i].fgcolour, data[i].bgcolour, - testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, data[i].ret, data[i].expected_file, data[i].comment); + testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, testUtilErrorName(data[i].ret), data[i].expected_file, data[i].comment); ret = testUtilRename(symbol->outfile, expected_file); assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret); if (have_identify) { diff --git a/backend/tests/test_raster.c b/backend/tests/test_raster.c index 29298903..03e47d6a 100644 --- a/backend/tests/test_raster.c +++ b/backend/tests/test_raster.c @@ -1594,8 +1594,8 @@ static void test_quiet_zones(int index, int debug) { int i, length, ret; struct zint_symbol *symbol; - char *text; - static char composite[] = "[20]12"; + const char *text; + static const char composite[] = "[20]12"; testStart("test_quiet_zones"); diff --git a/backend/tests/test_telepen.c b/backend/tests/test_telepen.c index dea2c358..655318f1 100644 --- a/backend/tests/test_telepen.c +++ b/backend/tests/test_telepen.c @@ -330,7 +330,7 @@ static void test_fuzz(int index, int debug) { testFinish(); } -static char TeleTable[128][16] = { +static const char TeleTable[128][16] = { { "31313131" }, { "1131313111" }, { "33313111" }, { "1111313131" }, { "3111313111" }, { "11333131" }, { "13133131" }, { "111111313111" }, { "31333111" }, { "1131113131" }, { "33113131" }, { "1111333111" }, diff --git a/backend/tests/test_vector.c b/backend/tests/test_vector.c index ea56a9d2..41bf41bd 100644 --- a/backend/tests/test_vector.c +++ b/backend/tests/test_vector.c @@ -1277,8 +1277,8 @@ static void test_quiet_zones(int index, int debug) { int i, length, ret; struct zint_symbol *symbol; - char *text; - static char composite[] = "[20]12"; + const char *text; + static const char composite[] = "[20]12"; struct zint_vector_rect *rect; struct zint_vector_circle *circle; diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index 6b630db7..686fbd1d 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -2076,8 +2076,8 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol { "pzn", BARCODE_PZN, 52, 0, 0, 0, 0, 0, }, { "pharmacode2", BARCODE_PHARMA_TWO, 53, 0, 0, 0, 0, 0, }, { "", -1, 54, 0, 0, 0, 0, 0, }, - { "pdf417", BARCODE_PDF417, 55, 1, 1, 0, 0, 0, }, - { "pdf417compact", BARCODE_PDF417COMP, 56, 1, 1, 0, 0, 0, }, + { "pdf417", BARCODE_PDF417, 55, 1, 1, 1, 0, 0, }, + { "pdf417compact", BARCODE_PDF417COMP, 56, 1, 1, 1, 0, 0, }, { "maxicode", BARCODE_MAXICODE, 57, 1, 1, 0, 0, 0, }, { "qrcode", BARCODE_QRCODE, 58, 1, 1, 1, 0, 0, }, { "", -1, 59, 0, 0, 0, 0, 0, }, @@ -2127,7 +2127,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol { "", -1, 103, 0, 0, 0, 0, 0, }, { "hibcqrcode", BARCODE_HIBC_QR, 104, 1, 1, 1, 0, 0, }, { "", -1, 105, 0, 0, 0, 0, 0, }, - { "hibcpdf417", BARCODE_HIBC_PDF, 106, 1, 1, 0, 0, 0, }, + { "hibcpdf417", BARCODE_HIBC_PDF, 106, 1, 1, 1, 0, 0, }, { "", -1, 107, 0, 0, 0, 0, 0, }, { "hibcmicropdf417", BARCODE_HIBC_MICPDF, 108, 0, 1, 0, 0, 0, }, { "", -1, 109, 0, 0, 0, 0, 0, }, @@ -2672,6 +2672,11 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int strlen(bwipp_opts_buf) ? " " : "", option_2); bwipp_opts = bwipp_opts_buf; } + if (option_3 > 0) { + sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%srows=%d", + strlen(bwipp_opts_buf) ? " " : "", option_3); + bwipp_opts = bwipp_opts_buf; + } } else if (symbology == BARCODE_POSTNET || symbology == BARCODE_PLANET || symbology == BARCODE_RM4SCC || symbology == BARCODE_JAPANPOST || symbology == BARCODE_KIX || symbology == BARCODE_DAFT || symbology == BARCODE_USPS_IMAIL || symbology == BARCODE_AUSPOST diff --git a/backend/tif.c b/backend/tif.c index 3227413b..20bd3cda 100644 --- a/backend/tif.c +++ b/backend/tif.c @@ -57,13 +57,13 @@ #define TIF_NO_COMPRESSION 1 #define TIF_LZW 5 -static void to_color_map(unsigned char rgb[4], tiff_color_t *color_map_entry) { +static void to_color_map(const unsigned char rgb[4], tiff_color_t *color_map_entry) { color_map_entry->red = (rgb[0] << 8) | rgb[0]; color_map_entry->green = (rgb[1] << 8) | rgb[1]; color_map_entry->blue = (rgb[2] << 8) | rgb[2]; } -static void to_cmyk(unsigned char rgb[3], unsigned char alpha, unsigned char *cmyk) { +static void to_cmyk(const unsigned char rgb[3], const unsigned char alpha, unsigned char *cmyk) { unsigned char max = rgb[0]; if (rgb[1] > max) { max = rgb[1]; @@ -79,7 +79,7 @@ static void to_cmyk(unsigned char rgb[3], unsigned char alpha, unsigned char *cm } -static int is_big_endian() { +static int is_big_endian(void) { return (*((const uint16_t *)"\x11\x22") == 0x1122); } @@ -145,7 +145,7 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf) if (symbol->symbology == BARCODE_ULTRA) { static const int ultra_chars[8] = { 'W', 'C', 'B', 'M', 'R', 'Y', 'G', 'K' }; - static unsigned char ultra_rgbs[8][3] = { + static const unsigned char ultra_rgbs[8][3] = { { 0xff, 0xff, 0xff, }, /* White */ { 0, 0xff, 0xff, }, /* Cyan */ { 0, 0, 0xff, }, /* Blue */ @@ -388,13 +388,13 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf) } } else if (samples_per_pixel == 2) { /* PALETTE_COLOR with alpha */ for (column = 0; column < symbol->bitmap_width; column++) { - int idx = map[*pb++]; + const int idx = map[*pb++]; strip_buf[bytes_put++] = idx; strip_buf[bytes_put++] = palette[idx][3]; } } else { /* samples_per_pixel >= 4, RGB with alpha (4) or CMYK with (5) or without (4) alpha */ for (column = 0; column < symbol->bitmap_width; column++) { - int idx = map[*pb++]; + const int idx = map[*pb++]; memcpy(&strip_buf[bytes_put], &palette[idx], samples_per_pixel); bytes_put += samples_per_pixel; } @@ -414,7 +414,7 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf) } bytes_put = ftell(tif_file) - file_pos; if (bytes_put != strip_bytes[strip]) { - int diff = bytes_put - strip_bytes[strip]; + const int diff = bytes_put - strip_bytes[strip]; strip_bytes[strip] = bytes_put; for (i = strip + 1; i < strip_count; i++) { strip_offset[i] += diff; diff --git a/backend_qt/backend_qt.pro b/backend_qt/backend_qt.pro index 8d145539..792fd13b 100644 --- a/backend_qt/backend_qt.pro +++ b/backend_qt/backend_qt.pro @@ -54,6 +54,7 @@ HEADERS += ../backend/aztec.h \ ../backend/output.h \ ../backend/pcx.h \ ../backend/pdf417.h \ + ../backend/pdf417_tabs.h \ ../backend/qr.h \ ../backend/reedsol.h \ ../backend/reedsol_logs.h \ diff --git a/backend_qt/backend_vc8.pro b/backend_qt/backend_vc8.pro index 0a30eb77..9a4cb6c4 100644 --- a/backend_qt/backend_vc8.pro +++ b/backend_qt/backend_vc8.pro @@ -41,6 +41,7 @@ HEADERS += ../backend/aztec.h \ ../backend/output.h \ ../backend/pcx.h \ ../backend/pdf417.h \ + ../backend/pdf417_tabs.h \ ../backend/qr.h \ ../backend/reedsol.h \ ../backend/rss.h \ diff --git a/backend_tcl/zint.c b/backend_tcl/zint.c index 7d52ec79..a2be5c03 100644 --- a/backend_tcl/zint.c +++ b/backend_tcl/zint.c @@ -132,6 +132,8 @@ - Split up -to parsing (could seg fault if given non-int for X0 or Y0) 2021-10-05 GL - Added -compliantheight option +2021-10-30 GL +- Added PDF417 -rows */ #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) @@ -171,7 +173,7 @@ /*----------------------------------------------------------------------------*/ -/* >>>>> Hepler defines */ +/* >>>>> Helper defines */ /* Two macros are necessary to not include the define name, but the value */ #define STRING(x) #x @@ -199,7 +201,7 @@ static int Encode(Tcl_Interp *interp, int objc, /* >> List of Codes */ -static char *s_code_list[] = { +static const char *s_code_list[] = { "Code11", "Standard2of5", "Interleaved2of5", @@ -297,7 +299,7 @@ static char *s_code_list[] = { "rMQR", NULL}; -static int s_code_number[] = { +static const int s_code_number[] = { BARCODE_CODE11, BARCODE_C25STANDARD, BARCODE_C25INTER, @@ -399,7 +401,7 @@ static int s_code_number[] = { * The ECI comments are given after the name. * A ** indicates encodings where native data must be delivered and not utf-8 */ -static char *s_eci_list[] = { +static const char *s_eci_list[] = { "iso8859-1", /* 3: ISO-8859-1 - Latin alphabet No. 1 (default)*/ "iso8859-2", /* 4: ISO-8859-2 - Latin alphabet No. 2*/ "iso8859-3", /* 5: ISO-8859-3 - Latin alphabet No. 3*/ @@ -430,14 +432,14 @@ static char *s_eci_list[] = { }; /* The ECI numerical number to pass to ZINT */ -static int s_eci_number[] = { +static const int s_eci_number[] = { 3,4,5,6,7,8,9,10,11,12,13,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30 }; /* Version information */ -static char version_string[] = VERSION; +static const char version_string[] = VERSION; /* Help text */ -static char help_message[] = "zint tcl(stub,obj) dll\n" +static const char help_message[] = "zint tcl(stub,obj) dll\n" " Generate barcode in tk images\n" "Usage:\n" " zint encode data photo ?option value? ...\n" @@ -453,7 +455,7 @@ static char help_message[] = "zint tcl(stub,obj) dll\n" " -border integer: width of a border around the symbol. Use with -bind/-box 1\n" " -box bool: box around bar code, size set be -border\n" /* cli option --cmyk not supported as no corresponding output */ - " -cols integer: PDF417, Codablock F, DotCode: number of columns\n" + " -cols integer: Codablock F, DotCode, PDF417: number of columns\n" " -compliantheight bool: warn if height not compliant, and use standard default\n" /* cli option --data is standard parameter */ " -dmre bool: Allow Data Matrix Rectangular Extended\n" @@ -486,10 +488,10 @@ static char help_message[] = "zint tcl(stub,obj) dll\n" " -quietzones bool: add compliant quiet zones to whitespace\n" " -reverse bool: Reverse colours (white on black)\n" " -rotate angle: Image rotation by 0,90 or 270 degrees\n" - " -rows integer: Codablock F: number of rows\n" + " -rows integer: Codablock F, PDF417: number of rows\n" " -scale double: Scale the image to this factor\n" " -scmvv number: Prefix SCM with [)>\\R01\\Gvv (vv is NUMBER) (MaxiCode)\n" - " -secure integer: EC Level (PDF417, QR)\n" + " -secure integer: EC Level (Aztec, GridMatrix, HanXin, PDF417, QR, UltraCode)\n" " -separator 0..4 (default: 1) : Stacked symbologies: separator width\n" /* cli option --small replaced by -smalltext */ " -smalltext bool: tiny interpretation line font\n" @@ -691,6 +693,7 @@ static int Encode(Tcl_Interp *interp, int objc, int addon_gap = 0; int Separator = 1; int Mask = 0; + int rows = 0; unsigned int cap; /*------------------------------------------------------------------------*/ /* >> Check if at least data and object is given and a pair number of */ @@ -716,7 +719,7 @@ static int Encode(Tcl_Interp *interp, int objc, for (optionPos = 4; optionPos < objc; optionPos+=2) { /*--------------------------------------------------------------------*/ /* Option list and indexes */ - char *optionList[] = { + static const char *optionList[] = { "-addongap", "-barcode", "-bg", "-bind", "-bold", "-border", "-box", "-cols", "-compliantheight", "-dmre", "-dotsize", "-dotty", "-eci", "-fg", "-format", "-fullmultibyte", @@ -1070,16 +1073,16 @@ static int Encode(Tcl_Interp *interp, int objc, case iSecure: case iMode: case iRows: - /* >> Int in Option 1 */ + /* >> Int in Option 1 for Codablock, Option 3 for PDF417 */ if ( (optionIndex==iSecure && (intValue < 1 || intValue > 8)) || (optionIndex==iMode && (intValue < 0 || intValue > 6)) - || (optionIndex==iRows && (intValue < 0 || intValue > 44))) + || (optionIndex==iRows && (intValue < 0 || intValue > 90))) { Tcl_SetObjResult(interp, Tcl_NewStringObj("secure/mode/rows out of range", -1)); fError = 1; } else { - my_symbol->option_1 = intValue; + rows = intValue; } break; case iPrimary: @@ -1259,6 +1262,18 @@ static int Encode(Tcl_Interp *interp, int objc, my_symbol->option_2 = addon_gap; } /*------------------------------------------------------------------------*/ + if (rows) { + /* PDF417 uses option 3 for rows */ + if (my_symbol->symbology == BARCODE_PDF417 + || my_symbol->symbology == BARCODE_PDF417COMP + || my_symbol->symbology == BARCODE_HIBC_PDF) { + my_symbol->option_3 = rows; + } else if (my_symbol->symbology == BARCODE_CODABLOCKF + || my_symbol->symbology == BARCODE_HIBC_BLOCKF) { + my_symbol->option_1 = rows; + } + } + /*------------------------------------------------------------------------*/ /* >>> Prepare input dstring and encode it to ECI encoding*/ Tcl_DStringInit(& dsInput); /*------------------------------------------------------------------------*/ diff --git a/docs/manual.txt b/docs/manual.txt index 2b5f9e5e..00fbd312 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -2065,16 +2065,17 @@ amount of data into a small space. Zint supports encoding up to the ISO standard maximum symbol size of 925 codewords which (at error correction level 0) allows a maximum data size of 1850 text characters, or 2710 digits. The width of the generated PDF417 symbol can be specified at the command line using -the --cols switch followed by a number between 1 and 30, and the amount of +the --cols switch followed by a number between 1 and 30, the number of rows +using the --rows switch followed by a number between 3 and 90, and the amount of error correction information can be specified by using the --secure switch followed by a number between 0 and 8 where the number of codewords used for error correction is determined by 2^(value + 1). If using the API these values -are assigned to option_2 and option_1 respectively. The default level of error -correction is determined by the amount of data being encoded. This symbology -uses Latin-1 character encoding by default but also supports the ECI encoding -mechanism. A separate symbology ID can be used to encode Health Industry -Barcode (HIBC) data which adds a leading '+' character and a modulo-49 check -digit to the encoded data. +are assigned to option_2, option_3 and option_1 respectively. The default level +of error correction is determined by the amount of data being encoded. This +symbology uses Latin-1 character encoding by default but also supports the ECI +encoding mechanism. A separate symbology ID can be used to encode Health +Industry Barcode (HIBC) data which adds a leading '+' character and a modulo-49 +check digit to the encoded data. PDF417 supports Structured Append of up to a 99,999 symbols and an optional numeric ID of up to 30 digits, which can be set by using the --structapp option diff --git a/frontend/main.c b/frontend/main.c index cb22e032..1f7141a0 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -99,9 +99,9 @@ static void types(void) { /* Output usage information */ static void usage(void) { - int zint_version = ZBarcode_Version(); - int version_major = zint_version / 10000; - int version_minor = (zint_version % 10000) / 100; + const int zint_version = ZBarcode_Version(); + const int version_major = zint_version / 10000; + const int version_minor = (zint_version % 10000) / 100; int version_release = zint_version % 100; int version_build; @@ -109,10 +109,10 @@ static void usage(void) { /* This is a test release */ version_release = version_release / 10; version_build = zint_version % 10; - printf( "Zint version %d.%d.%d.%d (dev)\n", version_major, version_minor, version_release, version_build); + printf("Zint version %d.%d.%d.%d (dev)\n", version_major, version_minor, version_release, version_build); } else { /* This is a stable release */ - printf( "Zint version %d.%d.%d\n", version_major, version_minor, version_release); + printf("Zint version %d.%d.%d\n", version_major, version_minor, version_release); } printf( "Encode input data in a barcode and save as BMP/EMF/EPS/GIF/PCX/PNG/SVG/TIF/TXT\n\n" @@ -156,11 +156,11 @@ static void usage(void) { " --noquietzones Disable default quiet zones\n" " --notext Remove human readable text\n" " -o, --output=FILE Send output to FILE. Default is out.png\n" - " --primary=STRING Set structured primary message (MaxiCode/Composite)\n" + " --primary=STRING Set primary message (MaxiCode/Composite)\n" " --quietzones Add compliant quiet zones\n" " -r, --reverse Reverse colours (white on black)\n" " --rotate=NUMBER Rotate symbol by NUMBER degrees\n" - " --rows=NUMBER Set number of rows (Codablock-F)\n" + " --rows=NUMBER Set number of rows (Codablock-F/PDF417)\n" " --scale=NUMBER Adjust size of X-dimension\n" " --scmvv=NUMBER Prefix SCM with \"[)>\\R01\\Gvv\" (vv is NUMBER) (MaxiCode)\n" " --secure=NUMBER Set error correction level (ECC)\n" @@ -213,7 +213,7 @@ static void show_eci(void) { static int validate_int(const char source[], int *p_val) { int val = 0; int i; - int length = (int) strlen(source); + const int length = (int) strlen(source); if (length > 9) { /* Prevent overflow */ return 0; @@ -241,7 +241,8 @@ static char itoc(const int source) { /* Converts upper case characters to lower case in a string source[] */ static void to_lower(char source[]) { - int i, src_len = (int) strlen(source); + int i; + const int src_len = (int) strlen(source); for (i = 0; i < src_len; i++) { if ((source[i] >= 'A') && (source[i] <= 'Z')) { @@ -393,8 +394,8 @@ static int get_barcode_name(const char *barcode_name) { n[j] = '\0'; while (s <= e) { - int m = (s + e) / 2; - int cmp = strcmp(names[m].n, n); + const int m = (s + e) / 2; + const int cmp = strcmp(names[m].n, n); if (cmp < 0) { s = m + 1; } else if (cmp > 0) { @@ -750,7 +751,7 @@ static int win_argc = 0; static char **win_argv = NULL; /* Free Windows args */ -static void win_free_args() { +static void win_free_args(void) { int i; if (!win_argv) { return; @@ -775,14 +776,15 @@ static void win_args(int *p_argc, char ***p_argv) { LocalFree(szArgList); } else { for (i = 0; i < win_argc; i++) { - int len = WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, szArgList[i], -1, NULL, 0, NULL, NULL); + const int len = WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, szArgList[i], -1, NULL, 0, + NULL /*lpDefaultChar*/, NULL /*lpUsedDefaultChar*/); if (len == 0 || !(win_argv[i] = malloc(len + 1))) { win_free_args(); LocalFree(szArgList); return; } - if (WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, szArgList[i], -1, win_argv[i], len, NULL, NULL) - == 0) { + if (WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, szArgList[i], -1, win_argv[i], len, + NULL /*lpDefaultChar*/, NULL /*lpUsedDefaultChar*/) == 0) { win_free_args(); LocalFree(szArgList); return; @@ -822,6 +824,7 @@ int main(int argc, char **argv) { int mask = 0; int separator = 0; int addon_gap = 0; + int rows = 0; char filetype[4] = {0}; int no_png; int png_refused; @@ -868,7 +871,7 @@ int main(int argc, char **argv) { OPT_VERBOSE, OPT_VERS, OPT_VWHITESP, OPT_WERROR, }; int option_index = 0; - static struct option long_options[] = { + static const struct option long_options[] = { {"addongap", 1, NULL, OPT_ADDONGAP}, {"barcode", 1, NULL, 'b'}, {"batch", 0, NULL, OPT_BATCH}, @@ -930,7 +933,7 @@ int main(int argc, char **argv) { {"whitesp", 1, NULL, 'w'}, {NULL, 0, NULL, 0} }; - int c = getopt_long_only(argc, argv, "b:d:ehi:o:rtw:", long_options, &option_index); + const int c = getopt_long_only(argc, argv, "b:d:ehi:o:rtw:", long_options, &option_index); if (c == -1) break; switch (c) { @@ -1182,10 +1185,10 @@ int main(int argc, char **argv) { fprintf(stderr, "Error 132: Invalid rows value (digits only)\n"); return do_exit(1); } - if ((val >= 1) && (val <= 44)) { - my_symbol->option_1 = val; + if ((val >= 1) && (val <= 90)) { + rows = val; } else { - fprintf(stderr, "Warning 112: Number of rows out of range (1 to 44), ignoring\n"); + fprintf(stderr, "Warning 112: Number of rows out of range (1 to 90), ignoring\n"); fflush(stderr); } break; @@ -1371,8 +1374,8 @@ int main(int argc, char **argv) { } if (data_arg_num) { - unsigned int cap = ZBarcode_Cap(my_symbol->symbology, ZINT_CAP_STACKABLE | ZINT_CAP_EXTENDABLE | - ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK); + const unsigned int cap = ZBarcode_Cap(my_symbol->symbology, ZINT_CAP_STACKABLE | ZINT_CAP_EXTENDABLE | + ZINT_CAP_FULL_MULTIBYTE | ZINT_CAP_MASK); if (fullmultibyte && (cap & ZINT_CAP_FULL_MULTIBYTE)) { my_symbol->option_3 = ZINT_FULL_MULTIBYTE; } @@ -1385,6 +1388,14 @@ int main(int argc, char **argv) { if (addon_gap && (cap & ZINT_CAP_EXTENDABLE)) { my_symbol->option_2 = addon_gap; } + if (rows) { + if (my_symbol->symbology == BARCODE_PDF417 || my_symbol->symbology == BARCODE_PDF417COMP + || my_symbol->symbology == BARCODE_HIBC_PDF) { + my_symbol->option_3 = rows; + } else if (my_symbol->symbology == BARCODE_CODABLOCKF || my_symbol->symbology == BARCODE_HIBC_BLOCKF) { + my_symbol->option_1 = rows; + } + } if (batch_mode) { /* Take each line of text as a separate data set */ diff --git a/frontend/tests/test_args.c b/frontend/tests/test_args.c index e88ee8fc..4e5bd13a 100644 --- a/frontend/tests/test_args.c +++ b/frontend/tests/test_args.c @@ -277,7 +277,7 @@ static void test_dump_args(int index, int debug) { /* 14*/ { BARCODE_CODE11, NULL, NULL, "123", NULL, -1, -1, 0, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, 1, "B2 D6 96 CA B5 64" }, /* 15*/ { BARCODE_CODE11, "123", NULL, "456", NULL, -1, -1, 0, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, 2, "B2 D6 96 CA B2\nB2 B6 DA 9A B2" }, /* 16*/ { BARCODE_CODE11, "123", "456", "789", "012", -1, -1, 0, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, 2, "B2 D6 96 CA B2\nB2 B6 DA 9A B2\nB2 A6 D2 D5 64\nB2 AD AD 2D 64" }, - /* 17*/ { BARCODE_PDF417, "123", NULL, NULL, NULL, -1, -1, 0, -1, 0, -1, 0, -1, -1, NULL, 1, 0, 0, -1, "FF 54 7A BC 3D 4F 1D 5C 0F E8 A4\nFF 54 7A 90 2F D3 1F AB 8F E8 A4\nFF 54 6A F8 3A BF 15 3C 0F E8 A4\nFF 54 57 9E 24 E7 1A F7 CF E8 A4\nFF 54 7A E7 3D 0D 9D 73 0F E8 A4\nFF 54 7D 70 B9 CB DF 5E CF E8 A4" }, + /* 17*/ { BARCODE_PDF417, "123", NULL, NULL, NULL, -1, -1, 0, -1, 0, -1, 0, -1, -1, NULL, -1, 0, 0, -1, "FF 54 7A BC 3D 4F 1D 5C 0F E8 A4\nFF 54 7A 90 2F D3 1F AB 8F E8 A4\nFF 54 6A F8 3A BF 15 3C 0F E8 A4\nFF 54 57 9E 24 E7 1A F7 CF E8 A4\nFF 54 7A E7 3D 0D 9D 73 0F E8 A4\nFF 54 7D 70 B9 CB DF 5E CF E8 A4" }, /* 18*/ { BARCODE_DATAMATRIX, "ABC", NULL, NULL, NULL, -1, -1, 0, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "AA 8\nB3 4\n8F 0\nB2 C\nA6 0\nBA C\nD6 0\nEB 4\nE2 8\nFF C" }, /* 19*/ { BARCODE_DATAMATRIX, "ABC", NULL, NULL, NULL, -1, READER_INIT, 0, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "AA A\nAC 7\n8A 4\nA0 3\nC2 2\nB5 1\n82 2\nBA 7\n8C C\nA0 5\n86 A\nFF F" }, /* 20*/ { BARCODE_DATAMATRIX, "ABCDEFGHIJK", NULL, NULL, NULL, -1, -1, 0, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "AA AA AA AA\nA6 ED A9 D1\nB2 FE 92 7E\n98 E7 C3 FF\nE8 D0 90 CC\nC7 EB 8D 63\nC5 48 D3 C4\nFF FF FF FF" }, @@ -663,7 +663,7 @@ static void test_checks(int index, int debug) { /* 19*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, "Error 117: Invalid rotation value (digits only)" }, /* 20*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 137: Invalid rotation parameter (0, 90, 180 or 270 only), ignoring" }, /* 21*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, "Error 132: Invalid rows value (digits only)" }, - /* 22*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, "Warning 112: Number of rows out of range (1 to 44), ignoring" }, + /* 22*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, 91, -1, -1, -1, -1, -1, -1, -1, "Warning 112: Number of rows out of range (1 to 90), ignoring" }, /* 23*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, "Warning 105: Invalid scale value (less than 0.01), ignoring" }, /* 24*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, 0.49, -1, -1, -1, -1, -1, -1, "Warning 146: Scaling less than 0.5 will be set to 0.5 for 'gif' output" }, /* 25*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, "Error 149: Invalid Structured Carrier Message version value (digits only)" }, diff --git a/frontend_qt/grpPDF417.ui b/frontend_qt/grpPDF417.ui index fe4e326b..781cdbdc 100644 --- a/frontend_qt/grpPDF417.ui +++ b/frontend_qt/grpPDF417.ui @@ -27,7 +27,8 @@ &Number of Data Columns: - Set number of data characters in a row + Set number of data characters in a row - may +be set to more than this depending on data Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -43,7 +44,8 @@ 21 - Set number of data characters in a row + Set number of data characters in a row - may +be set to more than this depending on data @@ -203,6 +205,479 @@ + + + Number of Ro&ws: + + + Set number of rows - may be set to more than +this depending on data and columns setting + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + cmbPDFRows + + + + + + + 21 + + + Set number of rows - may be set to more than +this depending on data and columns setting + + + + Automatic + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 17 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 25 + + + + + 26 + + + + + 27 + + + + + 28 + + + + + 29 + + + + + 30 + + + + + 31 + + + + + 32 + + + + + 33 + + + + + 34 + + + + + 35 + + + + + 36 + + + + + 37 + + + + + 38 + + + + + 39 + + + + + 40 + + + + + 41 + + + + + 42 + + + + + 43 + + + + + 44 + + + + + 45 + + + + + 46 + + + + + 47 + + + + + 48 + + + + + 49 + + + + + 50 + + + + + 51 + + + + + 52 + + + + + 53 + + + + + 54 + + + + + 55 + + + + + 56 + + + + + 57 + + + + + 58 + + + + + 59 + + + + + 60 + + + + + 61 + + + + + 62 + + + + + 63 + + + + + 64 + + + + + 65 + + + + + 66 + + + + + 67 + + + + + 68 + + + + + 69 + + + + + 70 + + + + + 71 + + + + + 72 + + + + + 73 + + + + + 74 + + + + + 75 + + + + + 76 + + + + + 77 + + + + + 78 + + + + + 79 + + + + + 80 + + + + + 81 + + + + + 82 + + + + + 83 + + + + + 84 + + + + + 85 + + + + + 86 + + + + + 87 + + + + + 88 + + + + + 89 + + + + + 90 + + + + + E&rror Correction Capacity: @@ -218,7 +693,7 @@ - + Set number of error correction characters @@ -292,7 +767,7 @@ - S&tandard Mode + S&tandard Process data as normal @@ -315,7 +790,7 @@ the data with a slash "/" - + &Compact PDF417 diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index 0c9d776d..8a61628f 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -306,7 +306,7 @@ MainWindow::~MainWindow() save_sub_settings(settings, m_bc.bc.symbol()); } -QString MainWindow::get_zint_version() +QString MainWindow::get_zint_version(void) { QString zint_version; @@ -882,6 +882,7 @@ void MainWindow::change_options() tabMain->insertTab(1, m_optionWidget, tr("PDF41&7")); connect(get_widget(QSL("cmbPDFECC")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(get_widget(QSL("cmbPDFCols")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(get_widget(QSL("cmbPDFRows")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(get_widget(QSL("radPDFTruncated")), SIGNAL(toggled( bool )), SLOT(update_preview())); connect(get_widget(QSL("radPDFStand")), SIGNAL(toggled( bool )), SLOT(update_preview())); connect(get_widget(QSL("radPDFHIBC")), SIGNAL(toggled( bool )), SLOT(update_preview())); @@ -1654,6 +1655,9 @@ void MainWindow::update_preview() m_bc.bc.setSymbol(BARCODE_PDF417); m_bc.bc.setOption2(get_cmb_index(QSL("cmbPDFCols"))); + if ((item_val = get_cmb_index(QSL("cmbPDFRows"))) != 0) { + m_bc.bc.setOption3(item_val + 2); // Starts at 3 rows + } m_bc.bc.setOption1(get_cmb_index(QSL("cmbPDFECC")) - 1); if ((item_val = get_spn_val(QSL("spnPDFStructAppCount"))) > 1) { @@ -2674,6 +2678,7 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) case BARCODE_PDF417COMP: case BARCODE_HIBC_PDF: settings.setValue(QSL("studio/bc/pdf417/cols"), get_cmb_index(QSL("cmbPDFCols"))); + settings.setValue(QSL("studio/bc/pdf417/rows"), get_cmb_index(QSL("cmbPDFRows"))); settings.setValue(QSL("studio/bc/pdf417/ecc"), get_cmb_index(QSL("cmbPDFECC"))); settings.setValue(QSL("studio/bc/pdf417/encoding_mode"), get_rad_grp_index( QStringList() << QSL("radPDFStand") << QSL("radPDFTruncated") << QSL("radPDFHIBC"))); @@ -2994,7 +2999,8 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) QSL("studio/bc/%1/appearance/chk_hrt_show").arg(name), 1).toInt() ? true : false); } chkCMYK->setChecked(settings.value(QSL("studio/bc/%1/appearance/cmyk").arg(name), 0).toInt() ? true : false); - chkQuietZones->setChecked(settings.value(QSL("studio/bc/%1/appearance/chk_quietzones").arg(name), 0).toInt() ? true : false); + chkQuietZones->setChecked(settings.value( + QSL("studio/bc/%1/appearance/chk_quietzones").arg(name), 0).toInt() ? true : false); cmbRotate->setCurrentIndex(settings.value(QSL("studio/bc/%1/appearance/rotate").arg(name), 0).toInt()); if (symbology == BARCODE_DOTCODE || chkDotty->isEnabled()) { chkDotty->setChecked(settings.value( @@ -3027,6 +3033,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) case BARCODE_PDF417COMP: case BARCODE_HIBC_PDF: set_cmb_from_setting(settings, QSL("studio/bc/pdf417/cols"), QSL("cmbPDFCols")); + set_cmb_from_setting(settings, QSL("studio/bc/pdf417/rows"), QSL("cmbPDFRows")); set_cmb_from_setting(settings, QSL("studio/bc/pdf417/ecc"), QSL("cmbPDFECC")); set_rad_from_setting(settings, QSL("studio/bc/pdf417/encoding_mode"), QStringList() << QSL("radPDFStand") << QSL("radPDFTruncated") << QSL("radPDFHIBC")); diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index 73601c94..bb36fd69 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -37,7 +37,7 @@ public: MainWindow(QWidget *parent = 0, Qt::WindowFlags fl = Qt::WindowFlags()); ~MainWindow(); - static QString get_zint_version(); + static QString get_zint_version(void); public slots: void update_preview(); diff --git a/win32/libzint.vcxproj b/win32/libzint.vcxproj index adc6ec3f..1fc6d7c0 100644 --- a/win32/libzint.vcxproj +++ b/win32/libzint.vcxproj @@ -203,6 +203,7 @@ + diff --git a/win32/vs2008/libzint.vcproj b/win32/vs2008/libzint.vcproj index 78be5706..24e865b0 100644 --- a/win32/vs2008/libzint.vcproj +++ b/win32/vs2008/libzint.vcproj @@ -589,6 +589,10 @@ RelativePath="..\backend\pdf417.h" > + + diff --git a/win32/vs2015/libzint.vcxproj b/win32/vs2015/libzint.vcxproj index 169075c2..39e9f387 100644 --- a/win32/vs2015/libzint.vcxproj +++ b/win32/vs2015/libzint.vcxproj @@ -384,6 +384,7 @@ + diff --git a/win32/vs2015/vsx/libzintMD.vcxproj b/win32/vs2015/vsx/libzintMD.vcxproj index cc703499..7b641abc 100644 --- a/win32/vs2015/vsx/libzintMD.vcxproj +++ b/win32/vs2015/vsx/libzintMD.vcxproj @@ -150,6 +150,7 @@ + diff --git a/win32/vs2019/libzint.vcxproj b/win32/vs2019/libzint.vcxproj index 74d383d9..8682d477 100644 --- a/win32/vs2019/libzint.vcxproj +++ b/win32/vs2019/libzint.vcxproj @@ -203,6 +203,7 @@ +