diff --git a/ChangeLog b/ChangeLog index dc675a86..b52d4df8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -Version 2.15.0.9 (dev) not released yet (2025-04-16) +Version 2.15.0.9 (dev) not released yet (2025-04-24) ==================================================== **Incompatible changes** @@ -15,6 +15,8 @@ Version 2.15.0.9 (dev) not released yet (2025-04-16) of composite data - EAN-8 with add-on now returns warning that it's non-standard - UPC-E now returns warning if first digit of 7 digits ignored (not '0' or '1') +- For GS1 Composite, no primary (linear component) now returns + `ZINT_ERROR_INVALID_DATA` (previously returned `ZINT_ERROR_INVALID_OPTION`) Changes ------- @@ -43,6 +45,7 @@ Changes `BARCODE_EANX_CC` and use in CLI/GUI (`BARCODE_EANX` etc. marked as legacy) - For EAN/UPC accept space as alternative add-on separator to '+', and accept GTIN-13 format with & without 2-digit or 5-digit add-on (no separator) +- GS1PARENS_MODE: allow parentheses in AI data if backslashed and `ESCAPE_MODE` Bugs ---- diff --git a/backend/code128.c b/backend/code128.c index a70bbfb0..8150765a 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -531,7 +531,7 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int symbol->row_height[separator_row] = 1; } - error_number = gs1_verify(symbol, source, length, reduced, &reduced_length); + error_number = gs1_verify(symbol, source, &length, reduced, &reduced_length); if (error_number >= ZINT_ERROR) { return error_number; } diff --git a/backend/composite.c b/backend/composite.c index f06db3fb..b12bdc93 100644 --- a/backend/composite.c +++ b/backend/composite.c @@ -756,12 +756,12 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour target_bitsize = 0; mode = NUMERIC; - if (length > 1 && (source[0] == '1') && ((source[1] == '0') || (source[1] == '1') || (source[1] == '7'))) { + if (length > 1 && source[0] == '1' && (source[1] == '0' || source[1] == '1' || source[1] == '7')) { /* Source starts (10), (11) or (17) */ if (source[1] == '0' || dbar_date(source, length, 2) >= 0) { /* Check date valid if (11) or (17) */ encoding_method = 2; } - } else if (length > 1 && (source[0] == '9') && (source[1] == '0')) { + } else if (length > 1 && source[0] == '9' && source[1] == '0') { /* Source starts (90) */ encoding_method = 3; } @@ -794,7 +794,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour } read_posn = 8; - if (read_posn + 1 < length && (source[read_posn] == '1') && (source[read_posn + 1] == '0')) { + if (read_posn + 1 < length && source[read_posn] == '1' && source[read_posn + 1] == '0') { /* Followed by AI 10 - strip this from general field */ read_posn += 2; } else if (source[read_posn]) { @@ -902,13 +902,12 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour if (next_ai_posn < length && source[next_ai_posn] == '\x1D') { /* There are more AIs afterwards */ - if (next_ai_posn + 2 < length - && (source[next_ai_posn + 1] == '2') && (source[next_ai_posn + 2] == '1')) { + if (next_ai_posn + 2 < length && source[next_ai_posn + 1] == '2' && source[next_ai_posn + 2] == '1') { /* AI 21 follows */ ai_crop = 1; } else if (next_ai_posn + 4 < length - && (source[next_ai_posn + 1] == '8') && (source[next_ai_posn + 2] == '0') - && (source[next_ai_posn + 3] == '0') && (source[next_ai_posn + 4] == '4')) { + && source[next_ai_posn + 1] == '8' && source[next_ai_posn + 2] == '0' + && source[next_ai_posn + 3] == '0' && source[next_ai_posn + 4] == '4') { /* AI 8004 follows */ ai_crop = 3; } @@ -1043,7 +1042,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour if (last_digit) { /* There is still one more numeric digit to encode */ - if ((remainder >= 4) && (remainder <= 6)) { + if (remainder >= 4 && remainder <= 6) { /* ISO/IEC 24723:2010 5.4.1 c) 2) "If four to six bits remain, add 1 to the digit value and encode the result in the next four bits. ..." */ bp = bin_append_posn(ctoi(last_digit) + 1, 4, binary_string, bp); @@ -1094,7 +1093,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour } /* Calculate the width of the linear part (primary) */ -static int cc_linear_dummy_run(struct zint_symbol *symbol, unsigned char *source, const int length) { +static int cc_linear_dummy_run(struct zint_symbol *symbol, unsigned char *source, int *p_length) { struct zint_symbol dummy = {0}; int error_number; int linear_width; @@ -1103,7 +1102,7 @@ static int cc_linear_dummy_run(struct zint_symbol *symbol, unsigned char *source dummy.option_1 = -1; dummy.input_mode = symbol->input_mode; dummy.debug = symbol->debug; - error_number = gs1_128_cc(&dummy, source, length, 3 /*cc_mode*/, 0 /*cc_rows*/); + error_number = gs1_128_cc(&dummy, source, *p_length, 3 /*cc_mode*/, 0 /*cc_rows*/); linear_width = dummy.width; if (error_number >= ZINT_ERROR || (symbol->debug & ZINT_DEBUG_TEST)) { (void) errtxt(0, symbol, -1, dummy.errtxt); @@ -1112,6 +1111,7 @@ static int cc_linear_dummy_run(struct zint_symbol *symbol, unsigned char *source if (error_number >= ZINT_ERROR) { return 0; } + *p_length = (int) ustrlen(source); /* May have changed if ESCAPE_MODE & GS1PARENS_MODE and escaped parentheses */ return linear_width; } @@ -1122,37 +1122,43 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l /* Allow for 8 bits + 5-bit latch per char + 1000 bits overhead/padding */ const unsigned int bs = 13 * length + 1000 + 1; char *binary_string = (char *) z_alloca(bs); - unsigned int pri_len; + int primary_len; struct zint_symbol *linear; int top_shift, bottom_shift; int linear_width = 0; + unsigned char primary[sizeof(symbol->primary)]; const int raw_text = symbol->output_options & BARCODE_RAW_TEXT; const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; if (debug_print) printf("Reduced length: %d\n", length); /* Perform sanity checks on input options first */ - pri_len = (int) strlen(symbol->primary); - if (pri_len == 0) { - /* TODO: change to more appropiate ZINT_ERROR_INVALID_DATA */ - return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 445, "No primary (linear) message"); + primary_len = (int) strlen(symbol->primary); + if (primary_len == 0) { + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 445, "No primary (linear component)"); + } + if (primary_len >= (int) sizeof(symbol->primary)) { + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 854, + "Invalid primary (linear component), must be NUL-terminated"); } - if (length > 2990) { return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 446, "2D component input too long, requires %d characters (maximum 2990)", length); } cc_mode = symbol->option_1; - if ((cc_mode == 3) && (symbol->symbology != BARCODE_GS1_128_CC)) { + if (cc_mode == 3 && symbol->symbology != BARCODE_GS1_128_CC) { /* CC-C can only be used with a GS1-128 linear part */ return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 447, "Invalid mode (CC-C only valid with GS1-128 linear component)"); } + /* Take copy of primary so passed-in remains unchanged */ + memcpy(primary, symbol->primary, primary_len + 1); /* Include terminating NUL */ + if (symbol->symbology == BARCODE_GS1_128_CC) { /* Do a test run of encoding the linear component to establish its width */ - linear_width = cc_linear_dummy_run(symbol, (unsigned char *) symbol->primary, pri_len); + linear_width = cc_linear_dummy_run(symbol, primary, &primary_len); /* Length can change */ if (linear_width == 0) { return errtxt_adj(ZINT_ERROR_INVALID_DATA, symbol, "%1$s%2$s", " (linear component)"); } @@ -1166,19 +1172,18 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l case BARCODE_EANX_CC: case BARCODE_EAN8_CC: case BARCODE_EAN13_CC: - if (pri_len < 20) { - int padded_pri_len; + if (primary_len < 20) { + int padded_primary_len; int with_addon; - unsigned char padded_pri[21]; - if (!ean_leading_zeroes(symbol, (unsigned char *) symbol->primary, pri_len, padded_pri, &with_addon, - NULL, NULL)) { + unsigned char padded_primary[21]; + if (!ean_leading_zeroes(symbol, primary, primary_len, padded_primary, &with_addon, NULL, NULL)) { return errtxt_adj(ZINT_ERROR_TOO_LONG, symbol, "%1$s%2$s", " (linear component)"); } - padded_pri_len = (int) ustrlen(padded_pri); - if (padded_pri_len <= 7 || symbol->symbology == BARCODE_EAN8_CC) { /* EAN-8 */ + padded_primary_len = (int) ustrlen(padded_primary); + if (padded_primary_len <= 7 || symbol->symbology == BARCODE_EAN8_CC) { /* EAN-8 */ cc_width = 3; } else { - switch (padded_pri_len) { + switch (padded_primary_len) { case 10: /* EAN-8 + 2 */ cc_width = 3; break; @@ -1196,7 +1201,8 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l } } if (cc_width == 0) { - return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 449, "Input length %d wrong (linear component)", pri_len); + return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 449, "Input length %d wrong (linear component)", + primary_len); } break; case BARCODE_GS1_128_CC: cc_width = 4; break; @@ -1287,35 +1293,35 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l case BARCODE_EANX_CC: case BARCODE_EAN8_CC: case BARCODE_EAN13_CC: - error_number = eanx_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); + error_number = eanx_cc(linear, primary, primary_len, symbol->rows); break; case BARCODE_GS1_128_CC: /* GS1-128 needs to know which type of 2D component is used */ - error_number = gs1_128_cc(linear, (unsigned char *) symbol->primary, pri_len, cc_mode, symbol->rows); + error_number = gs1_128_cc(linear, primary, primary_len, cc_mode, symbol->rows); break; case BARCODE_DBAR_OMN_CC: - error_number = dbar_omn_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); + error_number = dbar_omn_cc(linear, primary, primary_len, symbol->rows); break; case BARCODE_DBAR_LTD_CC: - error_number = dbar_ltd_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); + error_number = dbar_ltd_cc(linear, primary, primary_len, symbol->rows); break; case BARCODE_DBAR_EXP_CC: - error_number = dbar_exp_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); + error_number = dbar_exp_cc(linear, primary, primary_len, symbol->rows); break; case BARCODE_UPCA_CC: - error_number = eanx_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); + error_number = eanx_cc(linear, primary, primary_len, symbol->rows); break; case BARCODE_UPCE_CC: - error_number = eanx_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); + error_number = eanx_cc(linear, primary, primary_len, symbol->rows); break; case BARCODE_DBAR_STK_CC: - error_number = dbar_omn_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); + error_number = dbar_omn_cc(linear, primary, primary_len, symbol->rows); break; case BARCODE_DBAR_OMNSTK_CC: - error_number = dbar_omn_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); + error_number = dbar_omn_cc(linear, primary, primary_len, symbol->rows); break; case BARCODE_DBAR_EXPSTK_CC: - error_number = dbar_exp_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); + error_number = dbar_exp_cc(linear, primary, primary_len, symbol->rows); break; } diff --git a/backend/gs1.c b/backend/gs1.c index b895b92d..353cec80 100644 --- a/backend/gs1.c +++ b/backend/gs1.c @@ -67,7 +67,7 @@ ZINT_FORMAT_PRINTF(2, 3) static int gs1_err_msg_printf_nochk(char err_msg[50], c } /* Validate numeric */ -static int numeric(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_numeric(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]) { data_len = data_len < offset ? 0 : data_len - offset; @@ -94,17 +94,29 @@ static int numeric(const unsigned char *data, int data_len, int offset, int min, /* GS1 General Specifications 21.0.1 Figure 7.9.5-1. GS1 AI encodable character reference values. Also used to determine if character in set 82 - a value of 82 means not in */ -static const char c82[] = { - 0, 1, 82, 82, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, /*!-0*/ - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 82, /*1-@*/ - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, /*A-P*/ - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 82, 82, 82, 82, 55, 82, /*Q-`*/ - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, /*a-p*/ - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, /*q-z*/ +static const char gs1_c82[] = { + /* ! " # $ % & ' ( ) * */ + 0, 1, 82, 82, 2, 3, 4, 5, 6, 7, + /* + , - . / 0 1 2 3 4 */ + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + /* 5 6 7 8 9 : ; < = > */ + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, + /* ? @ A B C D E F G H */ + 28, 82, 29, 30, 31, 32, 33, 34, 35, 36, + /* I J K L M N O P Q R */ + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + /* S T U V W X Y Z [ \ */ + 47, 48, 49, 50, 51, 52, 53, 54, 82, 82, + /* ] ^ _ ` a b c d e f */ + 82, 82, 55, 82, 56, 57, 58, 59, 60, 61, + /* g h i j k l m n o p */ + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + /* q r s t u v w x y z */ + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, }; /* Validate of character set 82 (GS1 General Specifications Figure 7.11-1) */ -static int cset82(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_cset82(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]) { data_len = data_len < offset ? 0 : data_len - offset; @@ -118,7 +130,7 @@ static int cset82(const unsigned char *data, int data_len, int offset, int min, const unsigned char *const de = d + (data_len > max ? max : data_len); for (; d < de; d++) { - if (*d < '!' || *d > 'z' || c82[*d - '!'] == 82) { + if (*d < '!' || *d > 'z' || gs1_c82[*d - '!'] == 82) { *p_err_no = 3; *p_err_posn = d - data + 1; return gs1_err_msg_printf_nochk(err_msg, "Invalid CSET 82 character '%c'", *d); @@ -130,7 +142,7 @@ static int cset82(const unsigned char *data, int data_len, int offset, int min, } /* Validate of character set 39 (GS1 General Specifications Figure 7.11-2) */ -static int cset39(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_cset39(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]) { data_len = data_len < offset ? 0 : data_len - offset; @@ -157,7 +169,7 @@ static int cset39(const unsigned char *data, int data_len, int offset, int min, } /* Validate of character set 64 (GSCN 21-307 Figure 7.11-3) */ -static int cset64(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_cset64(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]) { data_len = data_len < offset ? 0 : data_len - offset; @@ -189,7 +201,7 @@ static int cset64(const unsigned char *data, int data_len, int offset, int min, } /* Check a check digit (GS1 General Specifications 7.9.1) */ -static int csum(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_csum(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) { data_len = data_len < offset ? 0 : data_len - offset; @@ -223,7 +235,7 @@ static int csum(const unsigned char *data, int data_len, int offset, int min, in } /* Check alphanumeric check characters (GS1 General Specifications 7.9.5) */ -static int csumalpha(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_csumalpha(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) { data_len = data_len < offset ? 0 : data_len - offset; @@ -247,7 +259,7 @@ static int csumalpha(const unsigned char *data, int data_len, int offset, int mi int checksum = 0, c1, c2; for (; d < de; d++) { - checksum += c82[*d - '!'] * weights[de - 1 - d]; + checksum += gs1_c82[*d - '!'] * weights[de - 1 - d]; } checksum %= 1021; c1 = c32[checksum >> 5]; @@ -266,7 +278,7 @@ static int csumalpha(const unsigned char *data, int data_len, int offset, int mi #define GS1_GCP_MIN_LENGTH 4 /* Minimum length of GS1 Company Prefix */ /* Check for a GS1 Prefix (GS1 General Specifications GS1 1.4.2) */ -static int key(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_key(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) { (void)max; @@ -305,16 +317,16 @@ static int key(const unsigned char *data, int data_len, int offset, int min, int } /* Check for a GS1 Prefix at offset 1 (2nd position) */ -static int keyoff1(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_keyoff1(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) { - return key(data, data_len, offset + 1, min - 1, max - 1, p_err_no, p_err_posn, err_msg, length_only); + return gs1_key(data, data_len, offset + 1, min - 1, max - 1, p_err_no, p_err_posn, err_msg, length_only); } /* Note following date/time checkers (!length_only) assume data all digits, i.e. `numeric()` has succeeded */ /* Check for a date YYYYMMDD with zero day allowed */ -static int yyyymmd0(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_yyyymmd0(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 const char days_in_month[13] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; @@ -358,10 +370,10 @@ static int yyyymmd0(const unsigned char *data, int data_len, int offset, int min } /* Check for a date YYYYMMDD. Zero day NOT allowed */ -static int yyyymmdd(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_yyyymmdd(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) { - if (!yyyymmd0(data, data_len, offset, min, max, p_err_no, p_err_posn, err_msg, length_only)) { + if (!gs1_yyyymmd0(data, data_len, offset, min, max, p_err_no, p_err_posn, err_msg, length_only)) { return 0; } @@ -380,7 +392,7 @@ static int yyyymmdd(const unsigned char *data, int data_len, int offset, int min } /* Check for a date YYMMDD with zero day allowed */ -static int yymmd0(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_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) { data_len = data_len < offset ? 0 : data_len - offset; @@ -395,7 +407,7 @@ static int yymmd0(const unsigned char *data, int data_len, int offset, int min, unsigned char buf[8] = { '2', '0' }; memcpy(buf + 2, data + offset, 6); - if (!yyyymmd0(buf, 8, 0, min, max, p_err_no, p_err_posn, err_msg, length_only)) { + if (!gs1_yyyymmd0(buf, 8, 0, min, max, p_err_no, p_err_posn, err_msg, length_only)) { *p_err_posn += offset - 2; return 0; } @@ -405,10 +417,10 @@ static int yymmd0(const unsigned char *data, int data_len, int offset, int min, } /* Check for a date YYMMDD. Zero day NOT allowed */ -static int yymmdd(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_yymmdd(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) { - if (!yymmd0(data, data_len, offset, min, max, p_err_no, p_err_posn, err_msg, length_only)) { + if (!gs1_yymmd0(data, data_len, offset, min, max, p_err_no, p_err_posn, err_msg, length_only)) { return 0; } @@ -427,7 +439,7 @@ static int yymmdd(const unsigned char *data, int data_len, int offset, int min, } /* Check for a time HHMI */ -static int hhmi(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_hhmi(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) { (void)max; @@ -458,7 +470,7 @@ static int hhmi(const unsigned char *data, int data_len, int offset, int min, in } /* Check for a time HH (hours) */ -static int hh(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_hh(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) { (void)max; @@ -481,7 +493,7 @@ static int hh(const unsigned char *data, int data_len, int offset, int min, int } /* Check for a time MI (minutes) */ -static int mi(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_mi(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) { (void)max; @@ -504,7 +516,7 @@ static int mi(const unsigned char *data, int data_len, int offset, int min, int } /* Check for a time SS (seconds) */ -static int ss(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_ss(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) { (void)max; @@ -530,7 +542,7 @@ static int ss(const unsigned char *data, int data_len, int offset, int min, int #include "iso3166.h" /* Check for an ISO 3166-1 numeric country code */ -static int iso3166(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_iso3166(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) { (void)max; @@ -556,7 +568,7 @@ static int iso3166(const unsigned char *data, int data_len, int offset, int min, } /* Check for an ISO 3166-1 numeric country code allowing "999" */ -static int iso3166999(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_iso3166999(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) { (void)max; @@ -579,7 +591,7 @@ static int iso3166999(const unsigned char *data, int data_len, int offset, int m } /* Check for an ISO 3166-1 alpha2 country code */ -static int iso3166alpha2(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_iso3166alpha2(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) { (void)max; @@ -604,7 +616,7 @@ static int iso3166alpha2(const unsigned char *data, int data_len, int offset, in #include "iso4217.h" /* Check for an ISO 4217 currency code */ -static int iso4217(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_iso4217(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) { (void)max; @@ -626,7 +638,7 @@ static int iso4217(const unsigned char *data, int data_len, int offset, int min, } /* Check for percent encoded */ -static int pcenc(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_pcenc(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 const char hex_chars[] = "0123456789ABCDEFabcdef"; @@ -661,7 +673,7 @@ static int pcenc(const unsigned char *data, int data_len, int offset, int min, i } /* Check for yes/no (1/0) indicator */ -static int yesno(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_yesno(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) { (void)max; @@ -683,7 +695,7 @@ static int yesno(const unsigned char *data, int data_len, int offset, int min, i } /* Check for importer index (GS1 General Specifications 3.8.17) */ -static int importeridx(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_importeridx(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) { (void)max; @@ -708,7 +720,7 @@ static int importeridx(const unsigned char *data, int data_len, int offset, int } /* Check non-zero */ -static int nonzero(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_nonzero(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) { data_len = data_len < offset ? 0 : data_len - offset; @@ -731,7 +743,7 @@ static int nonzero(const unsigned char *data, int data_len, int offset, int min, } /* Check winding direction (0/1/9) (GS1 General Specifications 3.9.1) */ -static int winding(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_winding(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) { (void)max; @@ -753,7 +765,7 @@ static int winding(const unsigned char *data, int data_len, int offset, int min, } /* Check zero */ -static int zero(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_zero(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) { (void)max; @@ -775,7 +787,7 @@ static int zero(const unsigned char *data, int data_len, int offset, int min, in } /* Check piece of a trade item (GS1 General Specifications 3.9.6 and 3.9.17) */ -static int pieceoftotal(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_pieceoftotal(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) { (void)max; @@ -812,7 +824,7 @@ static int pieceoftotal(const unsigned char *data, int data_len, int offset, int } /* Check IBAN (ISO 13616) */ -static int iban(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_iban(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) { data_len = data_len < offset ? 0 : data_len - offset; @@ -888,7 +900,7 @@ static int iban(const unsigned char *data, int data_len, int offset, int min, in } /* Check CPID does not begin with zero */ -static int nozeroprefix(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_nozeroprefix(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) { (void)max; @@ -913,7 +925,7 @@ static int nozeroprefix(const unsigned char *data, int data_len, int offset, int /* Helper to parse coupon Variable Length Indicator (VLI) and associated field. If `vli_nine` set * then a VLI of '9' means no field present */ -static const unsigned char *coupon_vli(const unsigned char *data, const int data_len, const unsigned char *d, +static const unsigned char *gs1_coupon_vli(const unsigned char *data, const int data_len, const unsigned char *d, const char *name, const int vli_offset, const int vli_min, const int vli_max, const int vli_nine, int *p_err_no, int *p_err_posn, char err_msg[50]) { const unsigned char *de; @@ -959,7 +971,7 @@ static const unsigned char *coupon_vli(const unsigned char *data, const int data } /* Helper to parse coupon value field (numeric) */ -static const unsigned char *coupon_val(const unsigned char *data, const int data_len, const unsigned char *d, +static const unsigned char *gs1_coupon_val(const unsigned char *data, const int data_len, const unsigned char *d, const char *name, const int val_len, int *p_val, int *p_err_no, int *p_err_posn, char err_msg[50]) { int val; @@ -986,7 +998,7 @@ static const unsigned char *coupon_val(const unsigned char *data, const int data /* Check North American Coupon Code */ /* Note all fields including optional must be numeric so type could be N..70 */ -static int couponcode(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_couponcode(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) { /* Minimum possible required fields length = 21 @@ -1016,21 +1028,22 @@ static int couponcode(const unsigned char *data, int data_len, int offset, int m data_len += offset; /* Required fields */ - if (!(d = coupon_vli(data, data_len, d, "Primary GS1 Co. Prefix", 6, 0, 6, 0, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_vli(data, data_len, d, "Primary GS1 Co. Prefix", 6, 0, 6, 0, p_err_no, p_err_posn, + err_msg))) { return 0; } - if (!(d = coupon_val(data, data_len, d, "Offer Code", 6, NULL, p_err_no, p_err_posn, err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "Offer Code", 6, NULL, p_err_no, p_err_posn, err_msg))) { return 0; } - if (!(d = coupon_vli(data, data_len, d, "Save Value", 0, 1, 5, 0, p_err_no, p_err_posn, err_msg))) { + if (!(d = gs1_coupon_vli(data, data_len, d, "Save Value", 0, 1, 5, 0, p_err_no, p_err_posn, err_msg))) { return 0; } - if (!(d = coupon_vli(data, data_len, d, "Primary Purch. Req.", 0, 1, 5, 0, p_err_no, p_err_posn, err_msg))) { + if (!(d = gs1_coupon_vli(data, data_len, d, "Primary Purch. Req.", 0, 1, 5, 0, p_err_no, p_err_posn, + err_msg))) { return 0; } - if (!(d = coupon_val(data, data_len, d, "Primary Purch. Req. Code", 1, &val, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "Primary Purch. Req. Code", 1, &val, p_err_no, p_err_posn, + err_msg))) { return 0; } if (val > 5 && val < 9) { @@ -1038,8 +1051,8 @@ static int couponcode(const unsigned char *data, int data_len, int offset, int m *p_err_posn = d - 1 - data + 1; return gs1_err_msg_printf_nochk(err_msg, "Invalid Primary Purch. Req. Code '%c'", *(d - 1)); } - if (!(d = coupon_val(data, data_len, d, "Primary Purch. Family Code", 3, NULL, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "Primary Purch. Family Code", 3, NULL, p_err_no, p_err_posn, + err_msg))) { return 0; } @@ -1050,8 +1063,8 @@ static int couponcode(const unsigned char *data, int data_len, int offset, int m if (data_field == 1) { - if (!(d = coupon_val(data, data_len, d, "Add. Purch. Rules Code", 1, &val, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "Add. Purch. Rules Code", 1, &val, p_err_no, p_err_posn, + err_msg))) { return 0; } if (val > 3) { @@ -1059,12 +1072,12 @@ static int couponcode(const unsigned char *data, int data_len, int offset, int m *p_err_posn = d - 1 - data + 1; return gs1_err_msg_printf_nochk(err_msg, "Invalid Add. Purch. Rules Code '%c'", *(d - 1)); } - if (!(d = coupon_vli(data, data_len, d, "2nd Purch. Req.", 0, 1, 5, 0, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_vli(data, data_len, d, "2nd Purch. Req.", 0, 1, 5, 0, p_err_no, p_err_posn, + err_msg))) { return 0; } - if (!(d = coupon_val(data, data_len, d, "2nd Purch. Req. Code", 1, &val, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "2nd Purch. Req. Code", 1, &val, p_err_no, p_err_posn, + err_msg))) { return 0; } if (val > 4 && val < 9) { @@ -1072,23 +1085,23 @@ static int couponcode(const unsigned char *data, int data_len, int offset, int m *p_err_posn = d - 1 - data + 1; return gs1_err_msg_printf_nochk(err_msg, "Invalid 2nd Purch. Req. Code '%c'", *(d - 1)); } - if (!(d = coupon_val(data, data_len, d, "2nd Purch. Family Code", 3, NULL, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "2nd Purch. Family Code", 3, NULL, p_err_no, p_err_posn, + err_msg))) { return 0; } - if (!(d = coupon_vli(data, data_len, d, "2nd Purch. GS1 Co. Prefix", 6, 0, 6, 1, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_vli(data, data_len, d, "2nd Purch. GS1 Co. Prefix", 6, 0, 6, 1, p_err_no, + p_err_posn, err_msg))) { return 0; } } else if (data_field == 2) { - if (!(d = coupon_vli(data, data_len, d, "3rd Purch. Req.", 0, 1, 5, 0, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_vli(data, data_len, d, "3rd Purch. Req.", 0, 1, 5, 0, p_err_no, p_err_posn, + err_msg))) { return 0; } - if (!(d = coupon_val(data, data_len, d, "3rd Purch. Req. Code", 1, &val, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "3rd Purch. Req. Code", 1, &val, p_err_no, p_err_posn, + err_msg))) { return 0; } if (val > 4 && val < 9) { @@ -1096,49 +1109,52 @@ static int couponcode(const unsigned char *data, int data_len, int offset, int m *p_err_posn = d - 1 - data + 1; return gs1_err_msg_printf_nochk(err_msg, "Invalid 3rd Purch. Req. Code '%c'", *(d - 1)); } - if (!(d = coupon_val(data, data_len, d, "3rd Purch. Family Code", 3, NULL, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "3rd Purch. Family Code", 3, NULL, p_err_no, p_err_posn, + err_msg))) { return 0; } - if (!(d = coupon_vli(data, data_len, d, "3rd Purch. GS1 Co. Prefix", 6, 0, 6, 1, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_vli(data, data_len, d, "3rd Purch. GS1 Co. Prefix", 6, 0, 6, 1, p_err_no, + p_err_posn, err_msg))) { return 0; } } else if (data_field == 3) { - if (!(d = coupon_val(data, data_len, d, "Expiration Date", 6, NULL, p_err_no, p_err_posn, err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "Expiration Date", 6, NULL, p_err_no, p_err_posn, + err_msg))) { return 0; } - if (!yymmd0(data, data_len, d - 6 - data, 6, 6, p_err_no, p_err_posn, err_msg, 0)) { + if (!gs1_yymmd0(data, data_len, d - 6 - data, 6, 6, p_err_no, p_err_posn, err_msg, 0)) { return 0; } } else if (data_field == 4) { - if (!(d = coupon_val(data, data_len, d, "Start Date", 6, NULL, p_err_no, p_err_posn, err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "Start Date", 6, NULL, p_err_no, p_err_posn, err_msg))) { return 0; } - if (!yymmd0(data, data_len, d - 6 - data, 6, 6, p_err_no, p_err_posn, err_msg, 0)) { + if (!gs1_yymmd0(data, data_len, d - 6 - data, 6, 6, p_err_no, p_err_posn, err_msg, 0)) { return 0; } } else if (data_field == 5) { - if (!(d = coupon_vli(data, data_len, d, "Serial Number", 6, 0, 9, 0, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_vli(data, data_len, d, "Serial Number", 6, 0, 9, 0, p_err_no, p_err_posn, + err_msg))) { return 0; } } else if (data_field == 6) { - if (!(d = coupon_vli(data, data_len, d, "Retailer ID", 6, 1, 7, 0, p_err_no, p_err_posn, err_msg))) { + if (!(d = gs1_coupon_vli(data, data_len, d, "Retailer ID", 6, 1, 7, 0, p_err_no, p_err_posn, + err_msg))) { return 0; } } else if (data_field == 9) { - if (!(d = coupon_val(data, data_len, d, "Save Value Code", 1, &val, p_err_no, p_err_posn, err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "Save Value Code", 1, &val, p_err_no, p_err_posn, + err_msg))) { return 0; } if ((val > 2 && val < 5) || val > 6) { @@ -1146,8 +1162,8 @@ static int couponcode(const unsigned char *data, int data_len, int offset, int m *p_err_posn = d - 1 - data + 1; return gs1_err_msg_printf_nochk(err_msg, "Invalid Save Value Code '%c'", *(d - 1)); } - if (!(d = coupon_val(data, data_len, d, "Save Value Applies To", 1, &val, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "Save Value Applies To", 1, &val, p_err_no, p_err_posn, + err_msg))) { return 0; } if (val > 2) { @@ -1155,11 +1171,11 @@ static int couponcode(const unsigned char *data, int data_len, int offset, int m *p_err_posn = d - 1 - data + 1; return gs1_err_msg_printf_nochk(err_msg, "Invalid Save Value Applies To '%c'", *(d - 1)); } - if (!(d = coupon_val(data, data_len, d, "Store Coupon Flag", 1, NULL, p_err_no, p_err_posn, - err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "Store Coupon Flag", 1, NULL, p_err_no, p_err_posn, + err_msg))) { return 0; } - if (!(d = coupon_val(data, data_len, d, "Don't Multiply Flag", 1, &val, p_err_no, p_err_posn, + if (!(d = gs1_coupon_val(data, data_len, d, "Don't Multiply Flag", 1, &val, p_err_no, p_err_posn, err_msg))) { return 0; } @@ -1188,7 +1204,7 @@ static int couponcode(const unsigned char *data, int data_len, int offset, int m /* Check North American Positive Offer File */ /* Note max is currently set at 36 numeric digits with remaining 34 characters reserved */ -static int couponposoffer(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_couponposoffer(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) { /* Minimum possible length = 21 @@ -1215,7 +1231,7 @@ static int couponposoffer(const unsigned char *data, int data_len, int offset, i const unsigned char *d = data + offset; int val; - if (!(d = coupon_val(data, data_len, d, "Coupon Format", 1, &val, p_err_no, p_err_posn, err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "Coupon Format", 1, &val, p_err_no, p_err_posn, err_msg))) { return 0; } if (val != 0 && val != 1) { @@ -1223,13 +1239,13 @@ static int couponposoffer(const unsigned char *data, int data_len, int offset, i *p_err_posn = d - 1 - data + 1; return gs1_err_msg_cpy_nochk(err_msg, "Coupon Format must be 0 or 1"); } - if (!(d = coupon_vli(data, data_len, d, "Coupon Funder ID", 6, 0, 6, 0, p_err_no, p_err_posn, err_msg))) { + if (!(d = gs1_coupon_vli(data, data_len, d, "Coupon Funder ID", 6, 0, 6, 0, p_err_no, p_err_posn, err_msg))) { return 0; } - if (!(d = coupon_val(data, data_len, d, "Offer Code", 6, NULL, p_err_no, p_err_posn, err_msg))) { + if (!(d = gs1_coupon_val(data, data_len, d, "Offer Code", 6, NULL, p_err_no, p_err_posn, err_msg))) { return 0; } - if (!(d = coupon_vli(data, data_len, d, "Serial Number", 6, 0, 9, 0, p_err_no, p_err_posn, err_msg))) { + if (!(d = gs1_coupon_vli(data, data_len, d, "Serial Number", 6, 0, 9, 0, p_err_no, p_err_posn, err_msg))) { return 0; } if (d - data != data_len) { @@ -1243,7 +1259,7 @@ static int couponposoffer(const unsigned char *data, int data_len, int offset, i } /* Check WSG 84 latitude */ -static int latitude(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_latitude(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) { data_len = data_len < offset ? 0 : data_len - offset; @@ -1272,7 +1288,7 @@ static int latitude(const unsigned char *data, int data_len, int offset, int min } /* Check WSG 84 longitude */ -static int longitude(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_longitude(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) { data_len = data_len < offset ? 0 : data_len - offset; @@ -1301,7 +1317,7 @@ static int longitude(const unsigned char *data, int data_len, int offset, int mi } /* Check AIDC media type (GSCN 22-345 Figure 3.8.22-2) */ -static int mediatype(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_mediatype(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) { data_len = data_len < offset ? 0 : data_len - offset; @@ -1330,7 +1346,7 @@ static int mediatype(const unsigned char *data, int data_len, int offset, int mi } /* Check negative temperature indicator (GSCN 22-353) */ -static int hyphen(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_hyphen(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) { data_len = data_len < offset ? 0 : data_len - offset; @@ -1356,7 +1372,7 @@ static int hyphen(const unsigned char *data, int data_len, int offset, int min, } /* Check for an ISO/IEC 5128 code for the representation of human sexes (GSCN 22-246) */ -static int iso5218(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_iso5218(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) { (void)max; @@ -1379,7 +1395,7 @@ static int iso5218(const unsigned char *data, int data_len, int offset, int min, } /* Validate sequence indicator, slash-separated (GSCN 22-246) */ -static int posinseqslash(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_posinseqslash(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) { data_len = data_len < offset ? 0 : data_len - offset; @@ -1442,7 +1458,7 @@ static int posinseqslash(const unsigned char *data, int data_len, int offset, in } /* Check that input contains non-digit (GSCN 21-283) */ -static int hasnondigit(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_hasnondigit(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) { (void)max; @@ -1469,7 +1485,7 @@ static int hasnondigit(const unsigned char *data, int data_len, int offset, int } /* Check for package type (GSCN 23-272) */ -static int packagetype(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, +static int gs1_packagetype(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) { /* Package type codes https://navigator.gs1.org/edi/codelist-details?name=PackageTypeCode */ @@ -1593,9 +1609,11 @@ static int packagetype(const unsigned char *data, int data_len, int offset, int /* Generated by "php backend/tools/gen_gs1_linter.php > backend/gs1_lint.h" */ #include "gs1_lint.h" +#define GS1_PARENS_PLACEHOLDER_MASK 0x20 /* Mask `(` or `)` by this if escaped (get BS (\x08) or HT (\x09)) */ + /* Verify a GS1 input string */ -INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const int length, - unsigned char reduced[], int *p_reduced_length) { +INTERNAL int gs1_verify(struct zint_symbol *symbol, unsigned char source[], int *p_length, unsigned char reduced[], + int *p_reduced_length) { int i, j; int error_value = 0; int bracket_level = 0, max_bracket_level = 0; @@ -1604,6 +1622,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[] int max_ai_pos = 0, min_ai_pos = 0; /* Suppress gcc 14 "-Wmaybe-uninitialized" false positives */ int ai_zero_len_no_data = 0, ai_single_digit = 0, ai_nonnumeric = 0; int ai_nonnumeric_pos = 0; /* Suppress gcc 14 "-Wmaybe-uninitialized" false positive */ + int length = *p_length; const char obracket = symbol->input_mode & GS1PARENS_MODE ? '(' : '['; const char cbracket = symbol->input_mode & GS1PARENS_MODE ? ')' : ']'; const int ai_max = chr_cnt(source, length, obracket) + 1; /* Plus 1 so non-zero */ @@ -1612,6 +1631,8 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[] int *data_location = (int *) z_alloca(sizeof(int) * ai_max); int *data_length = (int *) z_alloca(sizeof(int) * ai_max); + assert(p_length != p_reduced_length); /* Make sure we don't overwrite one with the other */ + /* Detect control and extended ASCII characters */ for (i = 0; i < length; i++) { if (source[i] >= 128) { @@ -1632,6 +1653,27 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[] return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 252, "Data does not start with an AI"); } + if ((symbol->input_mode & (ESCAPE_MODE | GS1PARENS_MODE)) == (ESCAPE_MODE | GS1PARENS_MODE)) { + /* Check for escaped parentheses */ + for (i = 0; i < length; i++) { + if (source[i] == '\\' && i + 1 < length && (source[i + 1] == '(' || source[i + 1] == ')')) { + break; + } + } + if (i != length) { + /* Replace with control-char placeholders */ + for (i = 0, j = 0; i < length; i++) { + if (source[i] == '\\' && i + 1 < length && (source[i + 1] == '(' || source[i + 1] == ')')) { + source[j++] = source[++i] & ~GS1_PARENS_PLACEHOLDER_MASK; /* BS (\x08) or HT (\x09) */ + } else { + source[j++] = source[i]; + } + } + source[j] = '\0'; + length = j; + } + } + /* Check the balance of the brackets & AI lengths */ ai_length = 0; ai_latch = 0; @@ -1702,6 +1744,8 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[] } if (!(symbol->input_mode & GS1NOCHECK_MODE)) { + unsigned char *local_source = source; + unsigned char *local_source_buf = (unsigned char *) z_alloca(length + 1); int ai_count = 0; for (i = 1; i < length; i++) { if (source[i - 1] == obracket) { @@ -1732,12 +1776,24 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[] } } + if (length != *p_length) { + /* Temporarily re-instate escaped parentheses before linting */ + local_source = local_source_buf; + memcpy(local_source, source, length + 1); /* Include terminating NUL */ + for (i = 0; i < length; i++) { + if (local_source[i] < '\x1D') { + local_source[i] |= GS1_PARENS_PLACEHOLDER_MASK; + } + } + } + /* Check for valid AI values and data lengths according to GS1 General - Specifications Release 21.0.1, January 2021 */ + Specifications Release 25, January 2025 */ for (i = 0; i < ai_count; i++) { int err_no, err_posn; char err_msg[50]; - if (!gs1_lint(ai_value[i], source + data_location[i], data_length[i], &err_no, &err_posn, err_msg)) { + if (!gs1_lint(ai_value[i], local_source + data_location[i], data_length[i], &err_no, &err_posn, + err_msg)) { if (err_no == 1) { errtxtf(0, symbol, 260, "Invalid AI (%02d)", ai_value[i]); } else if (err_no == 2 || err_no == 4) { /* 4 is backward-incompatible bad length */ @@ -1767,17 +1823,13 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[] if (i + 1 != length) { int last_ai = to_int(source + i + 1, 2); ai_latch = 0; - /* The following values from "GS1 General Specifications Release 21.0.1" - Figure 7.8.4-2 "Element strings with predefined length using GS1 Application Identifiers" */ - if ( - ((last_ai >= 0) && (last_ai <= 4)) - || ((last_ai >= 11) && (last_ai <= 20)) + /* The following values from GS1 General Specifications Release 25.0 + Figure 7.8.5-2 "Element strings with predefined length using GS1 Application Identifiers" */ + if ((last_ai >= 0 && last_ai <= 4) || (last_ai >= 11 && last_ai <= 20) /* NOTE: as noted by Terry Burton the following complies with ISO/IEC 24724:2011 Table D.1, but clashes with TPX AI [235], introduced May 2019; awaiting feedback from GS1 */ - || (last_ai == 23) /* legacy support */ /* TODO: probably remove */ - || ((last_ai >= 31) && (last_ai <= 36)) - || (last_ai == 41) - ) { + || last_ai == 23 /* legacy support */ /* TODO: probably remove */ + || (last_ai >= 31 && last_ai <= 36) || last_ai == 41) { ai_latch = 1; } } @@ -1791,6 +1843,21 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[] reduced[j] = '\0'; *p_reduced_length = j; + if (length != *p_length) { + /* Re-instate escaped parentheses */ + for (i = 0; i < *p_reduced_length; i++) { + if (reduced[i] < '\x1D') { + reduced[i] |= GS1_PARENS_PLACEHOLDER_MASK; + } + } + for (i = 0; i < length; i++) { + if (source[i] < '\x1D') { + source[i] |= GS1_PARENS_PLACEHOLDER_MASK; + } + } + *p_length = length; + } + /* The character '\x1D' (GS) in the reduced string refers to the FNC1 character */ return error_value; } diff --git a/backend/gs1.h b/backend/gs1.h index 571f3eb3..872bbfec 100644 --- a/backend/gs1.h +++ b/backend/gs1.h @@ -37,8 +37,8 @@ extern "C" { #endif /* __cplusplus */ -INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const int length, - unsigned char reduced[], int *p_reduced_length); +INTERNAL int gs1_verify(struct zint_symbol *symbol, unsigned char source[], int *p_length, unsigned char reduced[], + int *p_reduced_length); INTERNAL char gs1_check_digit(const unsigned char source[], const int length); INTERNAL int gs1_iso3166_alpha2(const unsigned char *cc); diff --git a/backend/gs1_lint.h b/backend/gs1_lint.h index fdd70d33..70e9bf1a 100644 --- a/backend/gs1_lint.h +++ b/backend/gs1_lint.h @@ -37,650 +37,650 @@ #define Z_GS1_LINT_H /* N18,csum,keyoff1 (Used by SSCC) */ -static int n18_csum_keyoff1(const unsigned char *data, +static int gs1_n18_csum_keyoff1(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 18 - && csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && keyoff1(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg) - && csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 0) - && keyoff1(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 0); + && gs1_csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_keyoff1(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg) + && gs1_csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 0) + && gs1_keyoff1(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 0); } /* N14,csum,keyoff1 (Used by GTIN, CONTENT, MTO GTIN) */ -static int n14_csum_keyoff1(const unsigned char *data, +static int gs1_n14_csum_keyoff1(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 14 - && csum(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && keyoff1(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg) - && csum(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 0) - && keyoff1(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 0); + && gs1_csum(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_keyoff1(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg) + && gs1_csum(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 0) + && gs1_keyoff1(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 0); } /* X..20 (Used by BATCH/LOT, SERIAL, CPV, PCN, GLN EXTENSION COMPONENT, SHIP TO POST, RTN TO POST, REFURB LOT, ...) */ -static int x__20(const unsigned char *data, +static int gs1_x__20(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 20 - && cset82(data, data_len, 0, 1, 20, p_err_no, p_err_posn, err_msg); + && gs1_cset82(data, data_len, 0, 1, 20, p_err_no, p_err_posn, err_msg); } /* N6,yymmd0 (Used by PROD DATE, DUE DATE, PACK DATE, BEST BEFORE or BEST BY, SELL BY, USE BY or EXPIRY) */ -static int n6_yymmd0(const unsigned char *data, +static int gs1_n6_yymmd0(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 6 - && yymmd0(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) - && yymmd0(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0); + && gs1_yymmd0(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) + && gs1_yymmd0(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0); } /* N2 (Used by VARIANT) */ -static int n2(const unsigned char *data, +static int gs1_n2(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 2 - && numeric(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg); + && gs1_numeric(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg); } /* X..28 (Used by TPX) */ -static int x__28(const unsigned char *data, +static int gs1_x__28(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 28 - && cset82(data, data_len, 0, 1, 28, p_err_no, p_err_posn, err_msg); + && gs1_cset82(data, data_len, 0, 1, 28, p_err_no, p_err_posn, err_msg); } /* X..30 (Used by ADDITIONAL ID, CUST. PART No., SECONDARY SERIAL, REF. TO SOURCE, ORDER NUMBER, ROUTE, SHIP TO...) */ -static int x__30(const unsigned char *data, +static int gs1_x__30(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 30 - && cset82(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg); + && gs1_cset82(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg); } /* N..6 (Used by MTO VARIANT) */ -static int n__6(const unsigned char *data, +static int gs1_n__6(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 6 - && numeric(data, data_len, 0, 1, 6, p_err_no, p_err_posn, err_msg); + && gs1_numeric(data, data_len, 0, 1, 6, p_err_no, p_err_posn, err_msg); } /* N13,csum,key [X..17] (Used by GDTI) */ -static int n13_csum_key__x__17_(const unsigned char *data, +static int gs1_n13_csum_key__x__17_(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 13 && data_len <= 30 - && csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg) - && csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0) - && key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0) - && cset82(data, data_len, 13, 0, 17, p_err_no, p_err_posn, err_msg); + && gs1_csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg) + && gs1_csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0) + && gs1_key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0) + && gs1_cset82(data, data_len, 13, 0, 17, p_err_no, p_err_posn, err_msg); } /* N13,csum,key [N..12] (Used by GCN) */ -static int n13_csum_key__n__12_(const unsigned char *data, +static int gs1_n13_csum_key__n__12_(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 13 && data_len <= 25 - && csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg) - && csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0) - && key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 13, 0, 12, p_err_no, p_err_posn, err_msg); + && gs1_csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg) + && gs1_csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0) + && gs1_key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 13, 0, 12, p_err_no, p_err_posn, err_msg); } /* N..8 (Used by VAR. COUNT, COUNT) */ -static int n__8(const unsigned char *data, +static int gs1_n__8(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 8 - && numeric(data, data_len, 0, 1, 8, p_err_no, p_err_posn, err_msg); + && gs1_numeric(data, data_len, 0, 1, 8, p_err_no, p_err_posn, err_msg); } /* N6 (Used by NET WEIGHT (kg), LENGTH (m), WIDTH (m), HEIGHT (m), AREA (m²), NET VOLUME (l), NET VOLUME (m³)...) */ -static int n6(const unsigned char *data, +static int gs1_n6(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 6 - && numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg); + && gs1_numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg); } /* N..15 (Used by AMOUNT, PRICE) */ -static int n__15(const unsigned char *data, +static int gs1_n__15(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 15 - && numeric(data, data_len, 0, 1, 15, p_err_no, p_err_posn, err_msg); + && gs1_numeric(data, data_len, 0, 1, 15, p_err_no, p_err_posn, err_msg); } /* N3,iso4217 N..15 (Used by AMOUNT, PRICE) */ -static int n3_iso4217_n__15(const unsigned char *data, +static int gs1_n3_iso4217_n__15(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 4 && data_len <= 18 - && iso4217(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg) - && iso4217(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 3, 1, 15, p_err_no, p_err_posn, err_msg); + && gs1_iso4217(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg) + && gs1_iso4217(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 3, 1, 15, p_err_no, p_err_posn, err_msg); } /* N4 (Used by PRCNT OFF, POINTS) */ -static int n4(const unsigned char *data, +static int gs1_n4(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 4 - && numeric(data, data_len, 0, 4, 4, p_err_no, p_err_posn, err_msg); + && gs1_numeric(data, data_len, 0, 4, 4, p_err_no, p_err_posn, err_msg); } /* X..30,key (Used by GINC, GIAI - ASSEMBLY, GIAI) */ -static int x__30_key(const unsigned char *data, +static int gs1_x__30_key(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 30 - && key(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && cset82(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg) - && key(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg, 0); + && gs1_key(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_cset82(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg) + && gs1_key(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg, 0); } /* N17,csum,key (Used by GSIN) */ -static int n17_csum_key(const unsigned char *data, +static int gs1_n17_csum_key(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 17 - && csum(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && key(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg) - && csum(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg, 0) - && key(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg, 0); + && gs1_csum(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_key(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg) + && gs1_csum(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg, 0) + && gs1_key(data, data_len, 0, 17, 17, p_err_no, p_err_posn, err_msg, 0); } /* N13,csum,key (Used by SHIP TO LOC, BILL TO, PURCHASE FROM, SHIP FOR LOC, LOC No., PAY TO, PROD/SERV LOC, PARTY) */ -static int n13_csum_key(const unsigned char *data, +static int gs1_n13_csum_key(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 13 - && csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg) - && csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0) - && key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0); + && gs1_csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg) + && gs1_csum(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0) + && gs1_key(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg, 0); } /* N3,iso3166 X..9 (Used by SHIP TO POST) */ -static int n3_iso3166_x__9(const unsigned char *data, +static int gs1_n3_iso3166_x__9(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 4 && data_len <= 12 - && iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg) - && iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0) - && cset82(data, data_len, 3, 1, 9, p_err_no, p_err_posn, err_msg); + && gs1_iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg) + && gs1_iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0) + && gs1_cset82(data, data_len, 3, 1, 9, p_err_no, p_err_posn, err_msg); } /* N3,iso3166 (Used by ORIGIN, COUNTRY - PROCESS, COUNTRY - FULL PROCESS) */ -static int n3_iso3166(const unsigned char *data, +static int gs1_n3_iso3166(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 3 - && iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg) - && iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0); + && gs1_iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg) + && gs1_iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0); } /* N3,iso3166 [N3],iso3166 [N3],iso3166 [N3],iso3166 [N3],iso3166 (Used by COUNTRY - INITIAL PROCESS, COUNTRY -...) */ -static int n3_iso3166__n3__iso3166__n3__iso3166__n3__iso3166__n3__iso3166(const unsigned char *data, +static int gs1_n3_iso3166__n3__iso3166__n3__iso3166__n3__iso3166__n3__iso3166(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 3 && data_len <= 15 - && iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && iso3166(data, data_len, 3, 0, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && iso3166(data, data_len, 6, 0, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && iso3166(data, data_len, 9, 0, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && iso3166(data, data_len, 12, 0, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg) - && iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 3, 0, 3, p_err_no, p_err_posn, err_msg) - && iso3166(data, data_len, 3, 0, 3, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 6, 0, 3, p_err_no, p_err_posn, err_msg) - && iso3166(data, data_len, 6, 0, 3, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 9, 0, 3, p_err_no, p_err_posn, err_msg) - && iso3166(data, data_len, 9, 0, 3, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 12, 0, 3, p_err_no, p_err_posn, err_msg) - && iso3166(data, data_len, 12, 0, 3, p_err_no, p_err_posn, err_msg, 0); + && gs1_iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_iso3166(data, data_len, 3, 0, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_iso3166(data, data_len, 6, 0, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_iso3166(data, data_len, 9, 0, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_iso3166(data, data_len, 12, 0, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg) + && gs1_iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 3, 0, 3, p_err_no, p_err_posn, err_msg) + && gs1_iso3166(data, data_len, 3, 0, 3, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 6, 0, 3, p_err_no, p_err_posn, err_msg) + && gs1_iso3166(data, data_len, 6, 0, 3, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 9, 0, 3, p_err_no, p_err_posn, err_msg) + && gs1_iso3166(data, data_len, 9, 0, 3, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 12, 0, 3, p_err_no, p_err_posn, err_msg) + && gs1_iso3166(data, data_len, 12, 0, 3, p_err_no, p_err_posn, err_msg, 0); } /* X..3 (Used by ORIGIN SUBDIVISION, AQUATIC SPECIES) */ -static int x__3(const unsigned char *data, +static int gs1_x__3(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 3 - && cset82(data, data_len, 0, 1, 3, p_err_no, p_err_posn, err_msg); + && gs1_cset82(data, data_len, 0, 1, 3, p_err_no, p_err_posn, err_msg); } /* X..35,pcenc (Used by SHIP TO COMP, SHIP TO NAME, RTN TO COMP, RTN TO NAME, SRV DESCRIPTION) */ -static int x__35_pcenc(const unsigned char *data, +static int gs1_x__35_pcenc(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 35 - && pcenc(data, data_len, 0, 1, 35, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && cset82(data, data_len, 0, 1, 35, p_err_no, p_err_posn, err_msg) - && pcenc(data, data_len, 0, 1, 35, p_err_no, p_err_posn, err_msg, 0); + && gs1_pcenc(data, data_len, 0, 1, 35, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_cset82(data, data_len, 0, 1, 35, p_err_no, p_err_posn, err_msg) + && gs1_pcenc(data, data_len, 0, 1, 35, p_err_no, p_err_posn, err_msg, 0); } /* X..70,pcenc (Used by SHIP TO ADD1, SHIP TO ADD2, SHIP TO SUB, SHIP TO LOC, SHIP TO REG, RTN TO ADD1, RTN TO ...) */ -static int x__70_pcenc(const unsigned char *data, +static int gs1_x__70_pcenc(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 70 - && pcenc(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && cset82(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg) - && pcenc(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 0); + && gs1_pcenc(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_cset82(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg) + && gs1_pcenc(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 0); } /* X2,iso3166alpha2 (Used by SHIP TO COUNTRY, RTN TO COUNTRY) */ -static int x2_iso3166alpha2(const unsigned char *data, +static int gs1_x2_iso3166alpha2(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 2 - && iso3166alpha2(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && cset82(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg) - && iso3166alpha2(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 0); + && gs1_iso3166alpha2(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_cset82(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg) + && gs1_iso3166alpha2(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 0); } /* N10,latitude N10,longitude (Used by SHIP TO GEO) */ -static int n10_latitude_n10_longitude(const unsigned char *data, +static int gs1_n10_latitude_n10_longitude(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 20 - && latitude(data, data_len, 0, 10, 10, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && longitude(data, data_len, 10, 10, 10, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 10, 10, p_err_no, p_err_posn, err_msg) - && latitude(data, data_len, 0, 10, 10, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 10, 10, 10, p_err_no, p_err_posn, err_msg) - && longitude(data, data_len, 10, 10, 10, p_err_no, p_err_posn, err_msg, 0); + && gs1_latitude(data, data_len, 0, 10, 10, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_longitude(data, data_len, 10, 10, 10, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 10, 10, p_err_no, p_err_posn, err_msg) + && gs1_latitude(data, data_len, 0, 10, 10, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 10, 10, 10, p_err_no, p_err_posn, err_msg) + && gs1_longitude(data, data_len, 10, 10, 10, p_err_no, p_err_posn, err_msg, 0); } /* N1,yesno (Used by DANGEROUS GOODS, AUTH TO LEAVE, SIG REQUIRED) */ -static int n1_yesno(const unsigned char *data, +static int gs1_n1_yesno(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 1 - && yesno(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg) - && yesno(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 0); + && gs1_yesno(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg) + && gs1_yesno(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 0); } /* N6,yymmd0 N4,hhmi (Used by NOT BEF DEL DT, NOT AFT DEL DT) */ -static int n6_yymmd0_n4_hhmi(const unsigned char *data, +static int gs1_n6_yymmd0_n4_hhmi(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 10 - && yymmd0(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && hhmi(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) - && yymmd0(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg) - && hhmi(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg, 0); + && gs1_yymmd0(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_hhmi(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) + && gs1_yymmd0(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg) + && gs1_hhmi(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg, 0); } /* N6,yymmdd (Used by REL DATE, FIRST FREEZE DATE) */ -static int n6_yymmdd(const unsigned char *data, +static int gs1_n6_yymmdd(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 6 - && yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) - && yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0); + && gs1_yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) + && gs1_yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0); } /* N6 [X1],hyphen (Used by MAX TEMP F., MAX TEMP C., MIN TEMP F., MIN TEMP C.) */ -static int n6__x1__hyphen(const unsigned char *data, +static int gs1_n6__x1__hyphen(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 6 && data_len <= 7 - && hyphen(data, data_len, 6, 0, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) - && cset82(data, data_len, 6, 0, 1, p_err_no, p_err_posn, err_msg) - && hyphen(data, data_len, 6, 0, 1, p_err_no, p_err_posn, err_msg, 0); + && gs1_hyphen(data, data_len, 6, 0, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) + && gs1_cset82(data, data_len, 6, 0, 1, p_err_no, p_err_posn, err_msg) + && gs1_hyphen(data, data_len, 6, 0, 1, p_err_no, p_err_posn, err_msg, 0); } /* N13 (Used by NSN) */ -static int n13(const unsigned char *data, +static int gs1_n13(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 13 - && numeric(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg); + && gs1_numeric(data, data_len, 0, 13, 13, p_err_no, p_err_posn, err_msg); } /* N6,yymmdd N4,hhmi (Used by EXPIRY TIME) */ -static int n6_yymmdd_n4_hhmi(const unsigned char *data, +static int gs1_n6_yymmdd_n4_hhmi(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 10 - && yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && hhmi(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) - && yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg) - && hhmi(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg, 0); + && gs1_yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_hhmi(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) + && gs1_yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg) + && gs1_hhmi(data, data_len, 6, 4, 4, p_err_no, p_err_posn, err_msg, 0); } /* N..4 (Used by ACTIVE POTENCY) */ -static int n__4(const unsigned char *data, +static int gs1_n__4(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 4 - && numeric(data, data_len, 0, 1, 4, p_err_no, p_err_posn, err_msg); + && gs1_numeric(data, data_len, 0, 1, 4, p_err_no, p_err_posn, err_msg); } /* X..12 (Used by CATCH AREA) */ -static int x__12(const unsigned char *data, +static int gs1_x__12(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 12 - && cset82(data, data_len, 0, 1, 12, p_err_no, p_err_posn, err_msg); + && gs1_cset82(data, data_len, 0, 1, 12, p_err_no, p_err_posn, err_msg); } /* N6,yymmdd [N6],yymmdd (Used by HARVEST DATE) */ -static int n6_yymmdd__n6__yymmdd(const unsigned char *data, +static int gs1_n6_yymmdd__n6__yymmdd(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 6 && data_len <= 12 - && yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && yymmdd(data, data_len, 6, 0, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) - && yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 6, 0, 6, p_err_no, p_err_posn, err_msg) - && yymmdd(data, data_len, 6, 0, 6, p_err_no, p_err_posn, err_msg, 0); + && gs1_yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_yymmdd(data, data_len, 6, 0, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) + && gs1_yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 6, 0, 6, p_err_no, p_err_posn, err_msg) + && gs1_yymmdd(data, data_len, 6, 0, 6, p_err_no, p_err_posn, err_msg, 0); } /* X..10 (Used by FISHING GEAR TYPE, SUFFIX) */ -static int x__10(const unsigned char *data, +static int gs1_x__10(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 10 - && cset82(data, data_len, 0, 1, 10, p_err_no, p_err_posn, err_msg); + && gs1_cset82(data, data_len, 0, 1, 10, p_err_no, p_err_posn, err_msg); } /* X..2 (Used by PROD METHOD) */ -static int x__2(const unsigned char *data, +static int gs1_x__2(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 2 - && cset82(data, data_len, 0, 1, 2, p_err_no, p_err_posn, err_msg); + && gs1_cset82(data, data_len, 0, 1, 2, p_err_no, p_err_posn, err_msg); } /* N6,yymmdd [N4],hhmi (Used by TEST BY DATE) */ -static int n6_yymmdd__n4__hhmi(const unsigned char *data, +static int gs1_n6_yymmdd__n4__hhmi(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 6 && data_len <= 10 - && yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && hhmi(data, data_len, 6, 0, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) - && yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 6, 0, 4, p_err_no, p_err_posn, err_msg) - && hhmi(data, data_len, 6, 0, 4, p_err_no, p_err_posn, err_msg, 0); + && gs1_yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_hhmi(data, data_len, 6, 0, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) + && gs1_yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 6, 0, 4, p_err_no, p_err_posn, err_msg) + && gs1_hhmi(data, data_len, 6, 0, 4, p_err_no, p_err_posn, err_msg, 0); } /* N3,iso3166999 X..27 (Used by PROCESSOR # 0, PROCESSOR # 1, PROCESSOR # 2, PROCESSOR # 3, PROCESSOR # 4, PROC...) */ -static int n3_iso3166999_x__27(const unsigned char *data, +static int gs1_n3_iso3166999_x__27(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 4 && data_len <= 30 - && iso3166999(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg) - && iso3166999(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0) - && cset82(data, data_len, 3, 1, 27, p_err_no, p_err_posn, err_msg); + && gs1_iso3166999(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg) + && gs1_iso3166999(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0) + && gs1_cset82(data, data_len, 3, 1, 27, p_err_no, p_err_posn, err_msg); } /* N1 X1 X1 X1,importeridx (Used by UIC+EXT) */ -static int n1_x1_x1_x1_importeridx(const unsigned char *data, +static int gs1_n1_x1_x1_x1_importeridx(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 4 - && importeridx(data, data_len, 3, 1, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg) - && cset82(data, data_len, 1, 1, 1, p_err_no, p_err_posn, err_msg) - && cset82(data, data_len, 2, 1, 1, p_err_no, p_err_posn, err_msg) - && cset82(data, data_len, 3, 1, 1, p_err_no, p_err_posn, err_msg) - && importeridx(data, data_len, 3, 1, 1, p_err_no, p_err_posn, err_msg, 0); + && gs1_importeridx(data, data_len, 3, 1, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg) + && gs1_cset82(data, data_len, 1, 1, 1, p_err_no, p_err_posn, err_msg) + && gs1_cset82(data, data_len, 2, 1, 1, p_err_no, p_err_posn, err_msg) + && gs1_cset82(data, data_len, 3, 1, 1, p_err_no, p_err_posn, err_msg) + && gs1_importeridx(data, data_len, 3, 1, 1, p_err_no, p_err_posn, err_msg, 0); } /* X..4,packagetype (Used by UFRGT UNIT TYPE) */ -static int x__4_packagetype(const unsigned char *data, +static int gs1_x__4_packagetype(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 4 - && packagetype(data, data_len, 0, 1, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && cset82(data, data_len, 0, 1, 4, p_err_no, p_err_posn, err_msg) - && packagetype(data, data_len, 0, 1, 4, p_err_no, p_err_posn, err_msg, 0); + && gs1_packagetype(data, data_len, 0, 1, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_cset82(data, data_len, 0, 1, 4, p_err_no, p_err_posn, err_msg) + && gs1_packagetype(data, data_len, 0, 1, 4, p_err_no, p_err_posn, err_msg, 0); } /* X2 X..28 (Used by CERT # 1, CERT # 2, CERT # 3, CERT # 4, CERT # 5, CERT # 6, CERT # 7, CERT # 8, CERT # 9, ...) */ -static int x2_x__28(const unsigned char *data, +static int gs1_x2_x__28(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 3 && data_len <= 30 - && cset82(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg) - && cset82(data, data_len, 2, 1, 28, p_err_no, p_err_posn, err_msg); + && gs1_cset82(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg) + && gs1_cset82(data, data_len, 2, 1, 28, p_err_no, p_err_posn, err_msg); } /* N2,mediatype (Used by AIDC MEDIA TYPE) */ -static int n2_mediatype(const unsigned char *data, +static int gs1_n2_mediatype(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 2 - && mediatype(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg) - && mediatype(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 0); + && gs1_mediatype(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg) + && gs1_mediatype(data, data_len, 0, 2, 2, p_err_no, p_err_posn, err_msg, 0); } /* X..25 (Used by VCN, REF No.) */ -static int x__25(const unsigned char *data, +static int gs1_x__25(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 25 - && cset82(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg); + && gs1_cset82(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg); } /* N8,yyyymmdd (Used by DOB) */ -static int n8_yyyymmdd(const unsigned char *data, +static int gs1_n8_yyyymmdd(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 8 - && yyyymmdd(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg) - && yyyymmdd(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg, 0); + && gs1_yyyymmdd(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg) + && gs1_yyyymmdd(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg, 0); } /* N8,yyyymmdd N4,hhmi (Used by DOB TIME) */ -static int n8_yyyymmdd_n4_hhmi(const unsigned char *data, +static int gs1_n8_yyyymmdd_n4_hhmi(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 12 - && yyyymmdd(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && hhmi(data, data_len, 8, 4, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg) - && yyyymmdd(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 8, 4, 4, p_err_no, p_err_posn, err_msg) - && hhmi(data, data_len, 8, 4, 4, p_err_no, p_err_posn, err_msg, 0); + && gs1_yyyymmdd(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_hhmi(data, data_len, 8, 4, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg) + && gs1_yyyymmdd(data, data_len, 0, 8, 8, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 8, 4, 4, p_err_no, p_err_posn, err_msg) + && gs1_hhmi(data, data_len, 8, 4, 4, p_err_no, p_err_posn, err_msg, 0); } /* N1,iso5218 (Used by BIO SEX) */ -static int n1_iso5218(const unsigned char *data, +static int gs1_n1_iso5218(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 1 - && iso5218(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg) - && iso5218(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 0); + && gs1_iso5218(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg) + && gs1_iso5218(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 0); } /* X..40,pcenc (Used by FAMILY NAME, GIVEN NAME, BABY) */ -static int x__40_pcenc(const unsigned char *data, +static int gs1_x__40_pcenc(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 40 - && pcenc(data, data_len, 0, 1, 40, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && cset82(data, data_len, 0, 1, 40, p_err_no, p_err_posn, err_msg) - && pcenc(data, data_len, 0, 1, 40, p_err_no, p_err_posn, err_msg, 0); + && gs1_pcenc(data, data_len, 0, 1, 40, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_cset82(data, data_len, 0, 1, 40, p_err_no, p_err_posn, err_msg) + && gs1_pcenc(data, data_len, 0, 1, 40, p_err_no, p_err_posn, err_msg, 0); } /* X..90,pcenc (Used by FULL NAME) */ -static int x__90_pcenc(const unsigned char *data, +static int gs1_x__90_pcenc(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 90 - && pcenc(data, data_len, 0, 1, 90, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && cset82(data, data_len, 0, 1, 90, p_err_no, p_err_posn, err_msg) - && pcenc(data, data_len, 0, 1, 90, p_err_no, p_err_posn, err_msg, 0); + && gs1_pcenc(data, data_len, 0, 1, 90, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_cset82(data, data_len, 0, 1, 90, p_err_no, p_err_posn, err_msg) + && gs1_pcenc(data, data_len, 0, 1, 90, p_err_no, p_err_posn, err_msg, 0); } /* X3,posinseqslash (Used by BIRTH SEQUENCE) */ -static int x3_posinseqslash(const unsigned char *data, +static int gs1_x3_posinseqslash(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 3 - && posinseqslash(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && cset82(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg) - && posinseqslash(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0); + && gs1_posinseqslash(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_cset82(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg) + && gs1_posinseqslash(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0); } /* N4,nonzero N5,nonzero N3,nonzero N1,winding N1 (Used by DIMENSIONS) */ -static int n4_nonzero_n5_nonzero_n3_nonzero_n1_winding_n1(const unsigned char *data, +static int gs1_n4_nonzero_n5_nonzero_n3_nonzero_n1_winding_n1(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 14 - && nonzero(data, data_len, 0, 4, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && nonzero(data, data_len, 4, 5, 5, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && nonzero(data, data_len, 9, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && winding(data, data_len, 12, 1, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 4, 4, p_err_no, p_err_posn, err_msg) - && nonzero(data, data_len, 0, 4, 4, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 4, 5, 5, p_err_no, p_err_posn, err_msg) - && nonzero(data, data_len, 4, 5, 5, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 9, 3, 3, p_err_no, p_err_posn, err_msg) - && nonzero(data, data_len, 9, 3, 3, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 12, 1, 1, p_err_no, p_err_posn, err_msg) - && winding(data, data_len, 12, 1, 1, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 13, 1, 1, p_err_no, p_err_posn, err_msg); + && gs1_nonzero(data, data_len, 0, 4, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_nonzero(data, data_len, 4, 5, 5, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_nonzero(data, data_len, 9, 3, 3, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_winding(data, data_len, 12, 1, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 4, 4, p_err_no, p_err_posn, err_msg) + && gs1_nonzero(data, data_len, 0, 4, 4, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 4, 5, 5, p_err_no, p_err_posn, err_msg) + && gs1_nonzero(data, data_len, 4, 5, 5, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 9, 3, 3, p_err_no, p_err_posn, err_msg) + && gs1_nonzero(data, data_len, 9, 3, 3, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 12, 1, 1, p_err_no, p_err_posn, err_msg) + && gs1_winding(data, data_len, 12, 1, 1, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 13, 1, 1, p_err_no, p_err_posn, err_msg); } /* N1,zero N13,csum,key [X..16] (Used by GRAI) */ -static int n1_zero_n13_csum_key__x__16_(const unsigned char *data, +static int gs1_n1_zero_n13_csum_key__x__16_(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 14 && data_len <= 30 - && zero(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && csum(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && key(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg) - && zero(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg) - && csum(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg, 0) - && key(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg, 0) - && cset82(data, data_len, 14, 0, 16, p_err_no, p_err_posn, err_msg); + && gs1_zero(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_csum(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_key(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg) + && gs1_zero(data, data_len, 0, 1, 1, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg) + && gs1_csum(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg, 0) + && gs1_key(data, data_len, 1, 13, 13, p_err_no, p_err_posn, err_msg, 0) + && gs1_cset82(data, data_len, 14, 0, 16, p_err_no, p_err_posn, err_msg); } /* N14,csum N4,pieceoftotal (Used by ITIP, ITIP CONTENT) */ -static int n14_csum_n4_pieceoftotal(const unsigned char *data, +static int gs1_n14_csum_n4_pieceoftotal(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 18 - && csum(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && pieceoftotal(data, data_len, 14, 4, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg) - && csum(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 14, 4, 4, p_err_no, p_err_posn, err_msg) - && pieceoftotal(data, data_len, 14, 4, 4, p_err_no, p_err_posn, err_msg, 0); + && gs1_csum(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_pieceoftotal(data, data_len, 14, 4, 4, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg) + && gs1_csum(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 14, 4, 4, p_err_no, p_err_posn, err_msg) + && gs1_pieceoftotal(data, data_len, 14, 4, 4, p_err_no, p_err_posn, err_msg, 0); } /* X..34,iban (Used by IBAN) */ -static int x__34_iban(const unsigned char *data, +static int gs1_x__34_iban(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 34 - && iban(data, data_len, 0, 1, 34, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && cset82(data, data_len, 0, 1, 34, p_err_no, p_err_posn, err_msg) - && iban(data, data_len, 0, 1, 34, p_err_no, p_err_posn, err_msg, 0); + && gs1_iban(data, data_len, 0, 1, 34, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_cset82(data, data_len, 0, 1, 34, p_err_no, p_err_posn, err_msg) + && gs1_iban(data, data_len, 0, 1, 34, p_err_no, p_err_posn, err_msg, 0); } /* N6,yymmdd N2,hh [N2],mi [N2],ss (Used by PROD TIME) */ -static int n6_yymmdd_n2_hh__n2__mi__n2__ss(const unsigned char *data, +static int gs1_n6_yymmdd_n2_hh__n2__mi__n2__ss(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 8 && data_len <= 12 - && yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && hh(data, data_len, 6, 2, 2, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && mi(data, data_len, 8, 0, 2, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && ss(data, data_len, 10, 0, 2, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) - && yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 6, 2, 2, p_err_no, p_err_posn, err_msg) - && hh(data, data_len, 6, 2, 2, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 8, 0, 2, p_err_no, p_err_posn, err_msg) - && mi(data, data_len, 8, 0, 2, p_err_no, p_err_posn, err_msg, 0) - && numeric(data, data_len, 10, 0, 2, p_err_no, p_err_posn, err_msg) - && ss(data, data_len, 10, 0, 2, p_err_no, p_err_posn, err_msg, 0); + && gs1_yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_hh(data, data_len, 6, 2, 2, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_mi(data, data_len, 8, 0, 2, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_ss(data, data_len, 10, 0, 2, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg) + && gs1_yymmdd(data, data_len, 0, 6, 6, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 6, 2, 2, p_err_no, p_err_posn, err_msg) + && gs1_hh(data, data_len, 6, 2, 2, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 8, 0, 2, p_err_no, p_err_posn, err_msg) + && gs1_mi(data, data_len, 8, 0, 2, p_err_no, p_err_posn, err_msg, 0) + && gs1_numeric(data, data_len, 10, 0, 2, p_err_no, p_err_posn, err_msg) + && gs1_ss(data, data_len, 10, 0, 2, p_err_no, p_err_posn, err_msg, 0); } /* X..50 (Used by OPTSEN) */ -static int x__50(const unsigned char *data, +static int gs1_x__50(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 50 - && cset82(data, data_len, 0, 1, 50, p_err_no, p_err_posn, err_msg); + && gs1_cset82(data, data_len, 0, 1, 50, p_err_no, p_err_posn, err_msg); } /* Y..30,key (Used by CPID) */ -static int y__30_key(const unsigned char *data, +static int gs1_y__30_key(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 30 - && key(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && cset39(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg) - && key(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg, 0); + && gs1_key(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_cset39(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg) + && gs1_key(data, data_len, 0, 1, 30, p_err_no, p_err_posn, err_msg, 0); } /* N..12,nozeroprefix (Used by CPID SERIAL) */ -static int n__12_nozeroprefix(const unsigned char *data, +static int gs1_n__12_nozeroprefix(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 12 - && nozeroprefix(data, data_len, 0, 1, 12, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 1, 12, p_err_no, p_err_posn, err_msg) - && nozeroprefix(data, data_len, 0, 1, 12, p_err_no, p_err_posn, err_msg, 0); + && gs1_nozeroprefix(data, data_len, 0, 1, 12, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 1, 12, p_err_no, p_err_posn, err_msg) + && gs1_nozeroprefix(data, data_len, 0, 1, 12, p_err_no, p_err_posn, err_msg, 0); } /* X..25,csumalpha,key (Used by GMN) */ -static int x__25_csumalpha_key(const unsigned char *data, +static int gs1_x__25_csumalpha_key(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 25 - && csumalpha(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && key(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && cset82(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg) - && csumalpha(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 0) - && key(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 0); + && gs1_csumalpha(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_key(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_cset82(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg) + && gs1_csumalpha(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 0) + && gs1_key(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 0); } /* X..25,csumalpha,key,hasnondigit (Used by MUDI) */ -static int x__25_csumalpha_key_hasnondigit(const unsigned char *data, +static int gs1_x__25_csumalpha_key_hasnondigit(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 25 - && csumalpha(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && key(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && hasnondigit(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && cset82(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg) - && csumalpha(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 0) - && key(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 0) - && hasnondigit(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 0); + && gs1_csumalpha(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_key(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_hasnondigit(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_cset82(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg) + && gs1_csumalpha(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 0) + && gs1_key(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 0) + && gs1_hasnondigit(data, data_len, 0, 1, 25, p_err_no, p_err_posn, err_msg, 0); } /* N18,csum,key (Used by GSRN - PROVIDER, GSRN - RECIPIENT) */ -static int n18_csum_key(const unsigned char *data, +static int gs1_n18_csum_key(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len == 18 - && csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && key(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && numeric(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg) - && csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 0) - && key(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 0); + && gs1_csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_key(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_numeric(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg) + && gs1_csum(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 0) + && gs1_key(data, data_len, 0, 18, 18, p_err_no, p_err_posn, err_msg, 0); } /* N..10 (Used by SRIN) */ -static int n__10(const unsigned char *data, +static int gs1_n__10(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 10 - && numeric(data, data_len, 0, 1, 10, p_err_no, p_err_posn, err_msg); + && gs1_numeric(data, data_len, 0, 1, 10, p_err_no, p_err_posn, err_msg); } /* Z..90 (Used by DIGSIG) */ -static int z__90(const unsigned char *data, +static int gs1_z__90(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 90 - && cset64(data, data_len, 0, 1, 90, p_err_no, p_err_posn, err_msg); + && gs1_cset64(data, data_len, 0, 1, 90, p_err_no, p_err_posn, err_msg); } /* X..70,couponcode */ -static int x__70_couponcode(const unsigned char *data, +static int gs1_x__70_couponcode(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 70 - && couponcode(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && cset82(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg) - && couponcode(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 0); + && gs1_couponcode(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_cset82(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg) + && gs1_couponcode(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 0); } /* X..70,couponposoffer */ -static int x__70_couponposoffer(const unsigned char *data, +static int gs1_x__70_couponposoffer(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 70 - && couponposoffer(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) - && cset82(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg) - && couponposoffer(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 0); + && gs1_couponposoffer(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 1 /*length_only*/) + && gs1_cset82(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg) + && gs1_couponposoffer(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 0); } /* X..70 (Used by PRODUCT URL) */ -static int x__70(const unsigned char *data, +static int gs1_x__70(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 70 - && cset82(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg); + && gs1_cset82(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg); } /* X..90 (Used by INTERNAL) */ -static int x__90(const unsigned char *data, +static int gs1_x__90(const unsigned char *data, const int data_len, int *p_err_no, int *p_err_posn, char err_msg[50]) { return data_len >= 1 && data_len <= 90 - && cset82(data, data_len, 0, 1, 90, p_err_no, p_err_posn, err_msg); + && gs1_cset82(data, data_len, 0, 1, 90, p_err_no, p_err_posn, err_msg); } /* Entry point. Returns 1 on success, 0 on failure: `*p_err_no` set to 1 if unknown AI, 2 if bad data length */ @@ -693,86 +693,86 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len, if (ai < 100) { if (ai == 0) { - return n18_csum_keyoff1(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n18_csum_keyoff1(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai >= 1 && ai <= 3) { - return n14_csum_keyoff1(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n14_csum_keyoff1(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 10 || ai == 21 || ai == 22) { - return x__20(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__20(data, data_len, p_err_no, p_err_posn, err_msg); } if ((ai >= 11 && ai <= 13) || (ai >= 15 && ai <= 17)) { - return n6_yymmd0(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6_yymmd0(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 20) { - return n2(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n2(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 30 || ai == 37) { - return n__8(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n__8(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 90) { - return x__30(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__30(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai >= 91) { - return x__90(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__90(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 300) { if (ai == 235) { - return x__28(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__28(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 240 || ai == 241 || ai == 250 || ai == 251) { - return x__30(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__30(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 242) { - return n__6(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n__6(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 243 || ai == 254) { - return x__20(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__20(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 253) { - return n13_csum_key__x__17_(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n13_csum_key__x__17_(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 255) { - return n13_csum_key__n__12_(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n13_csum_key__n__12_(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 500) { if (ai == 400 || ai == 403) { - return x__30(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__30(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 401) { - return x__30_key(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__30_key(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 402) { - return n17_csum_key(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n17_csum_key(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai >= 410 && ai <= 417) { - return n13_csum_key(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n13_csum_key(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 420) { - return x__20(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__20(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 421) { - return n3_iso3166_x__9(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n3_iso3166_x__9(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 422 || ai == 424 || ai == 426) { - return n3_iso3166(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n3_iso3166(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 423 || ai == 425) { - return n3_iso3166__n3__iso3166__n3__iso3166__n3__iso3166__n3__iso3166(data, + return gs1_n3_iso3166__n3__iso3166__n3__iso3166__n3__iso3166__n3__iso3166(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 427) { - return x__3(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__3(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 800) { if (ai >= 710 && ai <= 716) { - return x__20(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__20(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 3200) { @@ -780,7 +780,7 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len, if ((ai >= 3100 && ai <= 3105) || (ai >= 3110 && ai <= 3115) || (ai >= 3120 && ai <= 3125) || (ai >= 3130 && ai <= 3135) || (ai >= 3140 && ai <= 3145) || (ai >= 3150 && ai <= 3155) || (ai >= 3160 && ai <= 3165)) { - return n6(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 3300) { @@ -788,7 +788,7 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len, if (ai <= 3205 || (ai >= 3210 && ai <= 3215) || (ai >= 3220 && ai <= 3225) || (ai >= 3230 && ai <= 3235) || (ai >= 3240 && ai <= 3245) || (ai >= 3250 && ai <= 3255) || (ai >= 3260 && ai <= 3265) || (ai >= 3270 && ai <= 3275) || (ai >= 3280 && ai <= 3285) || (ai >= 3290 && ai <= 3295)) { - return n6(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 3400) { @@ -796,7 +796,7 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len, if (ai <= 3305 || (ai >= 3310 && ai <= 3315) || (ai >= 3320 && ai <= 3325) || (ai >= 3330 && ai <= 3335) || (ai >= 3340 && ai <= 3345) || (ai >= 3350 && ai <= 3355) || (ai >= 3360 && ai <= 3365) || (ai >= 3370 && ai <= 3375)) { - return n6(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 3500) { @@ -804,7 +804,7 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len, if (ai <= 3405 || (ai >= 3410 && ai <= 3415) || (ai >= 3420 && ai <= 3425) || (ai >= 3430 && ai <= 3435) || (ai >= 3440 && ai <= 3445) || (ai >= 3450 && ai <= 3455) || (ai >= 3460 && ai <= 3465) || (ai >= 3470 && ai <= 3475) || (ai >= 3480 && ai <= 3485) || (ai >= 3490 && ai <= 3495)) { - return n6(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 3600) { @@ -812,7 +812,7 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len, if (ai <= 3505 || (ai >= 3510 && ai <= 3515) || (ai >= 3520 && ai <= 3525) || (ai >= 3530 && ai <= 3535) || (ai >= 3540 && ai <= 3545) || (ai >= 3550 && ai <= 3555) || (ai >= 3560 && ai <= 3565) || (ai >= 3570 && ai <= 3575)) { - return n6(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 3700) { @@ -820,217 +820,217 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len, if (ai <= 3605 || (ai >= 3610 && ai <= 3615) || (ai >= 3620 && ai <= 3625) || (ai >= 3630 && ai <= 3635) || (ai >= 3640 && ai <= 3645) || (ai >= 3650 && ai <= 3655) || (ai >= 3660 && ai <= 3665) || (ai >= 3670 && ai <= 3675) || (ai >= 3680 && ai <= 3685) || (ai >= 3690 && ai <= 3695)) { - return n6(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 4000) { if ((ai >= 3900 && ai <= 3909) || (ai >= 3920 && ai <= 3929)) { - return n__15(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n__15(data, data_len, p_err_no, p_err_posn, err_msg); } if ((ai >= 3910 && ai <= 3919) || (ai >= 3930 && ai <= 3939)) { - return n3_iso4217_n__15(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n3_iso4217_n__15(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai >= 3940 && ai <= 3943) { - return n4(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n4(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai >= 3950 && ai <= 3955) { - return n6(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 4400) { if (ai == 4300 || ai == 4301 || ai == 4310 || ai == 4311 || ai == 4320) { - return x__35_pcenc(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__35_pcenc(data, data_len, p_err_no, p_err_posn, err_msg); } if ((ai >= 4302 && ai <= 4306) || (ai >= 4312 && ai <= 4316)) { - return x__70_pcenc(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__70_pcenc(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 4307 || ai == 4317) { - return x2_iso3166alpha2(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x2_iso3166alpha2(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 4308 || ai == 4319) { - return x__30(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__30(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 4309) { - return n10_latitude_n10_longitude(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n10_latitude_n10_longitude(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 4318) { - return x__20(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__20(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai >= 4321 && ai <= 4323) { - return n1_yesno(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n1_yesno(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 4324 || ai == 4325) { - return n6_yymmd0_n4_hhmi(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6_yymmd0_n4_hhmi(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 4326) { - return n6_yymmdd(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6_yymmdd(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai >= 4330 && ai <= 4333) { - return n6__x1__hyphen(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6__x1__hyphen(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 7100) { if (ai == 7001) { - return n13(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n13(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7002) { - return x__30(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__30(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7003) { - return n6_yymmdd_n4_hhmi(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6_yymmdd_n4_hhmi(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7004) { - return n__4(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n__4(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7005) { - return x__12(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__12(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7006) { - return n6_yymmdd(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6_yymmdd(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7007) { - return n6_yymmdd__n6__yymmdd(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6_yymmdd__n6__yymmdd(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7008) { - return x__3(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__3(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7009) { - return x__10(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__10(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7010) { - return x__2(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__2(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7011) { - return n6_yymmdd__n4__hhmi(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6_yymmdd__n4__hhmi(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai >= 7020 && ai <= 7022) { - return x__20(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__20(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7023) { - return x__30_key(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__30_key(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai >= 7030 && ai <= 7039) { - return n3_iso3166999_x__27(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n3_iso3166999_x__27(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7040) { - return n1_x1_x1_x1_importeridx(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n1_x1_x1_x1_importeridx(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7041) { - return x__4_packagetype(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__4_packagetype(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 7300) { if (ai >= 7230 && ai <= 7239) { - return x2_x__28(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x2_x__28(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7240) { - return x__20(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__20(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7241) { - return n2_mediatype(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n2_mediatype(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7242) { - return x__25(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__25(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7250) { - return n8_yyyymmdd(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n8_yyyymmdd(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7251) { - return n8_yyyymmdd_n4_hhmi(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n8_yyyymmdd_n4_hhmi(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7252) { - return n1_iso5218(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n1_iso5218(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7253 || ai == 7254 || ai == 7259) { - return x__40_pcenc(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__40_pcenc(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7255) { - return x__10(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__10(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7256) { - return x__90_pcenc(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__90_pcenc(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7257) { - return x__70_pcenc(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__70_pcenc(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 7258) { - return x3_posinseqslash(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x3_posinseqslash(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 8100) { if (ai == 8001) { - return n4_nonzero_n5_nonzero_n3_nonzero_n1_winding_n1(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n4_nonzero_n5_nonzero_n3_nonzero_n1_winding_n1(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8002 || ai == 8012) { - return x__20(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__20(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8003) { - return n1_zero_n13_csum_key__x__16_(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n1_zero_n13_csum_key__x__16_(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8004) { - return x__30_key(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__30_key(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8005) { - return n6(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8006 || ai == 8026) { - return n14_csum_n4_pieceoftotal(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n14_csum_n4_pieceoftotal(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8007) { - return x__34_iban(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__34_iban(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8008) { - return n6_yymmdd_n2_hh__n2__mi__n2__ss(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n6_yymmdd_n2_hh__n2__mi__n2__ss(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8009) { - return x__50(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__50(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8010) { - return y__30_key(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_y__30_key(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8011) { - return n__12_nozeroprefix(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n__12_nozeroprefix(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8013) { - return x__25_csumalpha_key(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__25_csumalpha_key(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8014) { - return x__25_csumalpha_key_hasnondigit(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__25_csumalpha_key_hasnondigit(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8017 || ai == 8018) { - return n18_csum_key(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n18_csum_key(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8019) { - return n__10(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n__10(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8020) { - return x__25(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__25(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8030) { - return z__90(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_z__90(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 8200) { if (ai == 8110) { - return x__70_couponcode(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__70_couponcode(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8111) { - return n4(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_n4(data, data_len, p_err_no, p_err_posn, err_msg); } if (ai == 8112) { - return x__70_couponposoffer(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__70_couponposoffer(data, data_len, p_err_no, p_err_posn, err_msg); } } else if (ai < 8300) { if (ai == 8200) { - return x__70(data, data_len, p_err_no, p_err_posn, err_msg); + return gs1_x__70(data, data_len, p_err_no, p_err_posn, err_msg); } } diff --git a/backend/library.c b/backend/library.c index e438b2a6..989dbcfe 100644 --- a/backend/library.c +++ b/backend/library.c @@ -774,6 +774,8 @@ static int escape_char_process(struct zint_symbol *symbol, const unsigned char * int i; unsigned int unicode; const int extra_escape_mode = (symbol->input_mode & EXTRA_ESCAPE_MODE) && symbol->symbology == BARCODE_CODE128; + const int escape_parens = (symbol->input_mode & GS1PARENS_MODE) + && ((symbol->input_mode & 0x07) == GS1_MODE || check_force_gs1(symbol->symbology)); do { if (input_string[in_posn] == '\\') { @@ -821,6 +823,21 @@ static int escape_char_process(struct zint_symbol *symbol, const unsigned char * } } break; + case '(': + case ')': + if (!escape_parens) { + return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 853, + "Escaped parentheses only valid in GS1 mode with GS1 parentheses flag"); + } + /* Pass through unaltered */ + if (escaped_string) { + escaped_string[out_posn++] = '\\'; + escaped_string[out_posn] = ch; + } else { + out_posn++; + } + in_posn += 2; + break; case 'd': case 'o': case 'x': @@ -1086,7 +1103,7 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ char source[151], primary[151]; /* 30*5 + 1 = 151 */ (void) ZBarcode_BarcodeName(symbol->symbology, name); debug_print_escape(local_segs[0].source, len > 30 ? 30 : len, source); - debug_print_escape((const unsigned char *) symbol->primary, primary_len > 30 ? 30 : primary_len, primary); + debug_print_escape(ZCUCP(symbol->primary), primary_len > 30 ? 30 : primary_len, primary); printf("\nZBarcode_Encode_Segs: %s (%d), input_mode: 0x%X, ECI: %d, option_1/2/3: (%d, %d, %d)\n" " scale: %g, output_options: 0x%X, fg: %s, bg: %s, seg_count: %d,\n" " %ssource%s (%d): \"%s\",\n" @@ -1198,12 +1215,12 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ if (escape_mode && symbol->primary[0] && strchr(symbol->primary, '\\') != NULL) { unsigned char primary[sizeof(symbol->primary)]; - int primary_len = (int) ustrlen(symbol->primary); + int primary_len = (int) strlen(symbol->primary); if (primary_len >= (int) sizeof(symbol->primary)) { - return error_tag(ZINT_ERROR_INVALID_DATA, symbol, 799, "Invalid primary string"); + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, 799, "Invalid primary, must be NUL-terminated"); } memcpy(primary, symbol->primary, primary_len); - error_number = escape_char_process(symbol, primary, &primary_len, (unsigned char *) symbol->primary); + error_number = escape_char_process(symbol, primary, &primary_len, ZUCP(symbol->primary)); if (error_number != 0) { /* Only returns errors, not warnings */ return error_tag(error_number, symbol, -1, NULL); } @@ -1219,7 +1236,6 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ strip_bom(local_segs[0].source, &local_segs[0].length); } - if ((symbol->input_mode & 0x07) == GS1_MODE || check_force_gs1(symbol->symbology)) { if (gs1_compliant(symbol->symbology)) { /* Reduce input for composite and non-forced symbologies, others (GS1_128 and DBAR_EXP based) will @@ -1228,8 +1244,8 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ if (have_composite || !check_force_gs1(symbol->symbology)) { const int raw_text = symbol->output_options & BARCODE_RAW_TEXT; unsigned char *reduced = (unsigned char *) z_alloca(local_segs[0].length + 1); - error_number = gs1_verify(symbol, local_segs[0].source, local_segs[0].length, reduced, - &local_segs[0].length); + int source_len = local_segs[0].length; + error_number = gs1_verify(symbol, local_segs[0].source, &source_len, reduced, &local_segs[0].length); if (error_number) { if (have_composite) { errtxt_adj(0, symbol, "%1$s%2$s", " (2D component)"); @@ -1322,7 +1338,7 @@ static int filetype_idx(const char *extension) { return -1; } memcpy(uc_extension, extension, 3); - to_upper((unsigned char *) uc_extension, 3); + to_upper(ZUCP(uc_extension), 3); for (i = 0; i < ARRAY_SIZE(filetypes); i++) { if (strcmp(uc_extension, filetypes[i].extension) == 0) { @@ -1343,6 +1359,9 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) { } len = (int) strlen(symbol->outfile); + if (len >= (int) sizeof(symbol->outfile)) { + return error_tag(ZINT_ERROR_INVALID_DATA, symbol, 855, "Invalid outfile, must be NUL-terminated"); + } if (len > 3) { int i = filetype_idx(symbol->outfile + len - 3); if (i >= 0) { diff --git a/backend/output.c b/backend/output.c index 77e3ead4..e98d952d 100644 --- a/backend/output.c +++ b/backend/output.c @@ -51,11 +51,11 @@ static int out_check_colour(struct zint_symbol *symbol, const char *colour, cons if ((comma1 = strchr(colour, ',')) == NULL) { const int len = (int) strlen(colour); - if ((len != 6) && (len != 8)) { + if (len != 6 && len != 8) { return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 880, "Malformed %s RGB colour (6 or 8 characters only)", name); } - if (not_sane(OUT_SSET_F, (unsigned char *) colour, len)) { + if (not_sane(OUT_SSET_F, ZCUCP(colour), len)) { return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 881, "Malformed %1$s RGB colour '%2$s' (hexadecimal only)", name, colour); } @@ -74,19 +74,19 @@ static int out_check_colour(struct zint_symbol *symbol, const char *colour, cons "Malformed %s CMYK colour (3 digit maximum per number)", name); } - if ((val = to_int((const unsigned char *) colour, (int) (comma1 - colour))) == -1 || val > 100) { + if ((val = to_int(ZCUCP(colour), (int) (comma1 - colour))) == -1 || val > 100) { return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 884, "Malformed %s CMYK colour C (decimal 0 to 100 only)", name); } - if ((val = to_int((const unsigned char *) (comma1 + 1), (int) (comma2 - (comma1 + 1)))) == -1 || val > 100) { + if ((val = to_int(ZCUCP(comma1 + 1), (int) (comma2 - (comma1 + 1)))) == -1 || val > 100) { return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 885, "Malformed %s CMYK colour M (decimal 0 to 100 only)", name); } - if ((val = to_int((const unsigned char *) (comma2 + 1), (int) (comma3 - (comma2 + 1)))) == -1 || val > 100) { + if ((val = to_int(ZCUCP(comma2 + 1), (int) (comma3 - (comma2 + 1)))) == -1 || val > 100) { return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 886, "Malformed %s CMYK colour Y (decimal 0 to 100 only)", name); } - if ((val = to_int((const unsigned char *) (comma3 + 1), (int) strlen(comma3 + 1))) == -1 || val > 100) { + if ((val = to_int(ZCUCP(comma3 + 1), (int) strlen(comma3 + 1))) == -1 || val > 100) { return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 887, "Malformed %s CMYK colour K (decimal 0 to 100 only)", name); } @@ -126,15 +126,15 @@ INTERNAL int out_colour_get_rgb(const char *colour, unsigned char *red, unsigned comma2 = strchr(comma1 + 1, ','); comma3 = strchr(comma2 + 1, ','); - black = 100 - to_int((const unsigned char *) (comma3 + 1), (int) strlen(comma3 + 1)); + black = 100 - to_int(ZCUCP(comma3 + 1), (int) strlen(comma3 + 1)); - val = 100 - to_int((const unsigned char *) colour, (int) (comma1 - colour)); /* Cyan */ + val = 100 - to_int(ZCUCP(colour), (int) (comma1 - colour)); /* Cyan */ *red = (unsigned char) round((0xFF * val * black) / 10000.0); - val = 100 - to_int((const unsigned char *) (comma1 + 1), (int) (comma2 - (comma1 + 1))); /* Magenta */ + val = 100 - to_int(ZCUCP(comma1 + 1), (int) (comma2 - (comma1 + 1))); /* Magenta */ *green = (unsigned char) round((0xFF * val * black) / 10000.0); - val = 100 - to_int((const unsigned char *) (comma2 + 1), (int) (comma3 - (comma2 + 1))); /* Yellow */ + val = 100 - to_int(ZCUCP(comma2 + 1), (int) (comma3 - (comma2 + 1))); /* Yellow */ *blue = (unsigned char) round((0xFF * val * black) / 10000.0); if (alpha) { @@ -154,10 +154,10 @@ INTERNAL int out_colour_get_cmyk(const char *colour, int *cyan, int *magenta, in if ((comma1 = strchr(colour, ',')) != NULL) { const char *const comma2 = strchr(comma1 + 1, ','); const char *const comma3 = strchr(comma2 + 1, ','); - *cyan = to_int((const unsigned char *) colour, (int) (comma1 - colour)); - *magenta = to_int((const unsigned char *) (comma1 + 1), (int) (comma2 - (comma1 + 1))); - *yellow = to_int((const unsigned char *) (comma2 + 1), (int) (comma3 - (comma2 + 1))); - *black = to_int((const unsigned char *) (comma3 + 1), (int) strlen(comma3 + 1)); + *cyan = to_int(ZCUCP(colour), (int) (comma1 - colour)); + *magenta = to_int(ZCUCP(comma1 + 1), (int) (comma2 - (comma1 + 1))); + *yellow = to_int(ZCUCP(comma2 + 1), (int) (comma3 - (comma2 + 1))); + *black = to_int(ZCUCP(comma3 + 1), (int) strlen(comma3 + 1)); if (rgb_alpha) { *rgb_alpha = 0xFF; } diff --git a/backend/rss.c b/backend/rss.c index b4855470..7ef06bba 100644 --- a/backend/rss.c +++ b/backend/rss.c @@ -1280,7 +1280,7 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int char *binary_string = (char *) z_alloca(bin_len); const int raw_text = symbol->output_options & BARCODE_RAW_TEXT; - error_number = gs1_verify(symbol, source, length, reduced, &reduced_length); + error_number = gs1_verify(symbol, source, &length, reduced, &reduced_length); if (error_number >= ZINT_ERROR) { return error_number; } diff --git a/backend/tests/test_aztec.c b/backend/tests/test_aztec.c index a789d2bb..f5fe97be 100644 --- a/backend/tests/test_aztec.c +++ b/backend/tests/test_aztec.c @@ -305,23 +305,26 @@ static void test_options(const testCtx *const p_ctx) { /* 24*/ { BARCODE_AZTEC, GS1_MODE, READER_INIT, -1, -1, { 0, 0, "" }, "[91]A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 501: Cannot use Reader Initialisation in GS1 mode", -1, 0 }, /* 25*/ { BARCODE_AZTEC, GS1_MODE, -1, -1, -1, { 0, 0, "" }, "[91]A", 0, 15, 15, "", (41 << 8) | 3, 1 }, /* 26*/ { BARCODE_AZTEC, GS1_MODE | GS1PARENS_MODE, -1, -1, -1, { 0, 0, "" }, "(91)A", 0, 15, 15, "", (41 << 8) | 3, 1 }, - /* 27*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 26, { 0, 0, "" }, "A", 0, 109, 109, "", (99 << 8) | 4, 26 }, /* 22 layers */ - /* 28*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 27, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 709: Version '27' out of range for Reader Initialisation symbols (maximum 26)", -1, 27 }, /* 23 layers */ - /* 29*/ { BARCODE_AZTEC, -1, READER_INIT, 4, -1, { 0, 0, "" }, "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377", ZINT_ERROR_TOO_LONG, -1, -1, "Error 506: Input too long for Reader Initialisation, requires 23 layers (maximum 22)", 4, 27 }, /* 23 layers */ - /* 30*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 1, { 0, 0, "" }, "A", 0, 15, 15, "", (76 << 8) | 4, 1 }, /* Compact 1 layer */ - /* 31*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 3, { 0, 0, "" }, "A", 0, 19, 19, "", (80 << 8) | 4, 5 }, /* Compact 3 layers gets set to full 1 layer if READER_INIT set */ - /* 32*/ { BARCODE_AZTEC, -1, -1, 1, -1, { 0, 0, "" }, "A", 0, 15, 15, "", (76 << 8) | 4, 1 }, /* Compact 1 layer */ - /* 33*/ { BARCODE_AZTEC, -1, READER_INIT, 1, -1, { 0, 0, "" }, "A", 0, 15, 15, "", (76 << 8) | 4, 1 }, /* Still compact 1 layer if READER_INIT set */ - /* 34*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "0001", ZINT_ERROR_TOO_LONG, -1, -1, "Error 507: Input length 4 too long (maximum 3)", -1, 0 }, - /* 35*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 508: Invalid character at position 1 in input (digits only)", -1, 0 }, - /* 36*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "256", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 509: Input value out of range (0 to 255)", -1, 0 }, - /* 37*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, "" }, "1234567890", 0, 15, 15, "", (17 << 8) | 2, 1 }, - /* 38*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, {'1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2'} }, "1234567890", 0, 23, 23, "", (41 << 8) | 3, 3 }, - /* 39*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 1, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 701: Structured Append count '1' out of range (2 to 26)", -1, 0 }, - /* 40*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 0, 2, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 702: Structured Append index '0' out of range (1 to count 2)", -1, 0 }, - /* 41*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 3, 2, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 702: Structured Append index '3' out of range (1 to count 2)", -1, 0 }, - /* 42*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, "A B" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 703: Structured Append ID cannot contain spaces", -1, 0 }, - /* 43*/ { BARCODE_HIBC_AZTEC, -1, -1, -1, -1, { 0, 0, "" }, "1234567890;", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 203: Invalid character at position 11 in input (alphanumerics, space and \"-.$/+%\" only)", -1, 0 }, + /* 27*/ { BARCODE_AZTEC, GS1_MODE | GS1PARENS_MODE, -1, -1, -1, { 0, 0, "" }, "(91)(", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 253: Malformed AI in input (brackets don't match)", -1, 0 }, + /* 28*/ { BARCODE_AZTEC, GS1_MODE | GS1PARENS_MODE, -1, -1, -1, { 0, 0, "" }, "(91)\\(", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 253: Malformed AI in input (brackets don't match)", -1, 0 }, + /* 29*/ { BARCODE_AZTEC, GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, -1, -1, { 0, 0, "" }, "(91)\\(", 0, 15, 15, "", (41 << 8) | 3, 1 }, + /* 30*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 26, { 0, 0, "" }, "A", 0, 109, 109, "", (99 << 8) | 4, 26 }, /* 22 layers */ + /* 31*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 27, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 709: Version '27' out of range for Reader Initialisation symbols (maximum 26)", -1, 27 }, /* 23 layers */ + /* 32*/ { BARCODE_AZTEC, -1, READER_INIT, 4, -1, { 0, 0, "" }, "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377", ZINT_ERROR_TOO_LONG, -1, -1, "Error 506: Input too long for Reader Initialisation, requires 23 layers (maximum 22)", 4, 27 }, /* 23 layers */ + /* 33*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 1, { 0, 0, "" }, "A", 0, 15, 15, "", (76 << 8) | 4, 1 }, /* Compact 1 layer */ + /* 34*/ { BARCODE_AZTEC, -1, READER_INIT, -1, 3, { 0, 0, "" }, "A", 0, 19, 19, "", (80 << 8) | 4, 5 }, /* Compact 3 layers gets set to full 1 layer if READER_INIT set */ + /* 35*/ { BARCODE_AZTEC, -1, -1, 1, -1, { 0, 0, "" }, "A", 0, 15, 15, "", (76 << 8) | 4, 1 }, /* Compact 1 layer */ + /* 36*/ { BARCODE_AZTEC, -1, READER_INIT, 1, -1, { 0, 0, "" }, "A", 0, 15, 15, "", (76 << 8) | 4, 1 }, /* Still compact 1 layer if READER_INIT set */ + /* 37*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "0001", ZINT_ERROR_TOO_LONG, -1, -1, "Error 507: Input length 4 too long (maximum 3)", -1, 0 }, + /* 38*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 508: Invalid character at position 1 in input (digits only)", -1, 0 }, + /* 39*/ { BARCODE_AZRUNE, -1, -1, -1, -1, { 0, 0, "" }, "256", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 509: Input value out of range (0 to 255)", -1, 0 }, + /* 40*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, "" }, "1234567890", 0, 15, 15, "", (17 << 8) | 2, 1 }, + /* 41*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, {'1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2'} }, "1234567890", 0, 23, 23, "", (41 << 8) | 3, 3 }, + /* 42*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 1, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 701: Structured Append count '1' out of range (2 to 26)", -1, 0 }, + /* 43*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 0, 2, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 702: Structured Append index '0' out of range (1 to count 2)", -1, 0 }, + /* 44*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 3, 2, "" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 702: Structured Append index '3' out of range (1 to count 2)", -1, 0 }, + /* 45*/ { BARCODE_AZTEC, -1, -1, -1, -1, { 1, 2, "A B" }, "1234567890", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 703: Structured Append ID cannot contain spaces", -1, 0 }, + /* 46*/ { BARCODE_HIBC_AZTEC, -1, -1, -1, -1, { 0, 0, "" }, "1234567890;", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 203: Invalid character at position 11 in input (alphanumerics, space and \"-.$/+%\" only)", -1, 0 }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -3205,10 +3208,11 @@ static void test_rt(const testCtx *const p_ctx) { /* 7*/ { BARCODE_AZTEC, UNICODE_MODE, 26, BARCODE_RAW_TEXT, "é", -1, 0, 26, "é", -1, 26 }, /* 8*/ { BARCODE_AZTEC, UNICODE_MODE, 899, -1, "é", -1, 0, 899, "", -1, 0 }, /* 9*/ { BARCODE_AZTEC, UNICODE_MODE, 899, BARCODE_RAW_TEXT, "é", -1, 0, 899, "é", -1, 899 }, - /* 10*/ { BARCODE_AZTEC, GS1_MODE, -1, -1, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "", -1, 0 }, - /* 11*/ { BARCODE_AZTEC, GS1_MODE, -1, BARCODE_RAW_TEXT, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "01049123451234591597033130128\03510ABC123", -1, 3 }, - /* 12*/ { BARCODE_HIBC_AZTEC, UNICODE_MODE, -1, -1, "H123ABC01234567890", -1, 0, 0, "", -1, 0 }, - /* 13*/ { BARCODE_HIBC_AZTEC, UNICODE_MODE, -1, BARCODE_RAW_TEXT, "H123ABC01234567890", -1, 0, 0, "+H123ABC01234567890D", -1, 3 }, + /* 10*/ { BARCODE_AZTEC, GS1_MODE, -1, -1, "[01]04912345123459[15]970331[30]128[10](BC123", -1, 0, 0, "", -1, 0 }, + /* 11*/ { BARCODE_AZTEC, GS1_MODE, -1, BARCODE_RAW_TEXT, "[01]04912345123459[15]970331[30]128[10](BC123", -1, 0, 0, "01049123451234591597033130128\03510(BC123", -1, 3 }, + /* 12*/ { BARCODE_AZTEC, GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, BARCODE_RAW_TEXT, "(01)04912345123459(15)970331(30)128(10)\\(BC123", -1, 0, 0, "01049123451234591597033130128\03510(BC123", -1, 3 }, + /* 13*/ { BARCODE_HIBC_AZTEC, UNICODE_MODE, -1, -1, "H123ABC01234567890", -1, 0, 0, "", -1, 0 }, + /* 14*/ { BARCODE_HIBC_AZTEC, UNICODE_MODE, -1, BARCODE_RAW_TEXT, "H123ABC01234567890", -1, 0, 0, "+H123ABC01234567890D", -1, 3 }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_code1.c b/backend/tests/test_code1.c index 4b29aa39..df67a171 100644 --- a/backend/tests/test_code1.c +++ b/backend/tests/test_code1.c @@ -259,36 +259,37 @@ static void test_input(const testCtx *const p_ctx) { /* 5*/ { -1, -1, 1, { 0, 0, "" }, "ABCDEFGHIJKLMN", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 518: Input too long for Version A, requires 12 codewords (maximum 10)", 1 }, /* 6*/ { GS1_MODE, -1, 1, { 0, 0, "" }, "[01]12345678901231", -1, 0, 16, 18, "", 1 }, /* 7*/ { GS1_MODE | GS1PARENS_MODE, -1, 1, { 0, 0, "" }, "(01)12345678901231", -1, 0, 16, 18, "", 1 }, - /* 8*/ { -1, 3, 1, { 0, 0, "" }, "1", -1, 0, 16, 18, "", 1 }, - /* 9*/ { UNICODE_MODE, 3, 1, { 0, 0, "" }, "é", -1, 0, 16, 18, "", 1 }, - /* 10*/ { GS1_MODE, 3, 1, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 16, 18, "Warning 512: ECI ignored for GS1 mode", 1 }, - /* 11*/ { -1, -1, 9, { 0, 0, "" }, "123456789012345678", -1, 0, 8, 31, "", 9 }, - /* 12*/ { -1, -1, 9, { 0, 0, "" }, "12345678901234567A", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 515: Invalid character at position 18 in input (Version S encodes digits only)", 9 }, - /* 13*/ { -1, -1, 9, { 0, 0, "" }, "1234567890123456789", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 514: Input length 19 too long for Version S (maximum 18)", 9 }, - /* 14*/ { GS1_MODE, -1, 9, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 8, 31, "Warning 511: GS1 mode ignored for Version S", 9 }, - /* 15*/ { -1, 3, 9, { 0, 0, "" }, "1", -1, ZINT_WARN_INVALID_OPTION, 8, 11, "Warning 511: ECI ignored for Version S", 9 }, - /* 16*/ { GS1_MODE, 3, 9, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 8, 31, "Warning 511: ECI and GS1 mode ignored for Version S", 9 }, - /* 17*/ { -1, -1, 10, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", -1, 0, 16, 49, "", 10 }, - /* 18*/ { -1, -1, 10, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 519: Input length 91 too long for Version T (maximum 90)", 10 }, - /* 19*/ { -1, -1, 10, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, 0, 16, 49, "", 10 }, - /* 20*/ { -1, -1, 10, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 55 codewords (maximum 38)", 10 }, - /* 21*/ { -1, -1, 10, { 0, 0, "" }, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 38, 0, 16, 49, "", 10 }, - /* 22*/ { -1, 3, 10, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456", -1, 0, 16, 49, "", 10 }, - /* 23*/ { -1, 3, 10, { 0, 0, "" }, "12345678901234567890123456789012345678901234567890123456789012345678901234567", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 39 codewords (maximum 38)", 10 }, - /* 24*/ { -1, 3, 10, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 519: Input length 91 too long for Version T (maximum 90)", 10 }, - /* 25*/ { GS1_MODE, -1, 10, { 0, 0, "" }, "[01]12345678901231", -1, 0, 16, 17, "", 10 }, - /* 26*/ { GS1_MODE, 3, 10, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 16, 17, "Warning 512: ECI ignored for GS1 mode", 10 }, - /* 27*/ { -1, -1, 11, { 0, 0, "" }, "1", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 513: Version '11' out of range (1 to 10)", 11 }, - /* 28*/ { -1, -1, -2, { 0, 0, "" }, "1", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 513: Version '-2' out of range (1 to 10)", -2 }, - /* 29*/ { GS1_MODE, -1, -1, { 1, 2, "" }, "[01]12345678901231", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 710: Cannot have Structured Append and GS1 mode at the same time", 0 }, - /* 30*/ { -1, -1, -1, { 1, 1, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count '1' out of range (2 to 128)", 0 }, - /* 31*/ { -1, -1, -1, { 1, -1, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count '-1' out of range (2 to 128)", 0 }, - /* 32*/ { -1, -1, -1, { 1, 129, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count '129' out of range (2 to 128)", 0 }, - /* 33*/ { -1, -1, -1, { 0, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 712: Structured Append index '0' out of range (1 to count 2)", 0 }, - /* 34*/ { -1, -1, -1, { 3, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 712: Structured Append index '3' out of range (1 to count 2)", 0 }, - /* 35*/ { -1, -1, -1, { 1, 2, "1" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 713: Structured Append ID not available for Code One", 0 }, - /* 36*/ { -1, -1, 9, { 1, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 714: Structured Append not available for Version S", 9 }, - /* 37*/ { -1, -1, 9, { 3, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 714: Structured Append not available for Version S", 9 }, /* Trumps other checking */ + /* 8*/ { GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 1, { 0, 0, "" }, "(21)\\(12\\)4567890123", -1, 0, 16, 18, "", 1 }, + /* 9*/ { -1, 3, 1, { 0, 0, "" }, "1", -1, 0, 16, 18, "", 1 }, + /* 10*/ { UNICODE_MODE, 3, 1, { 0, 0, "" }, "é", -1, 0, 16, 18, "", 1 }, + /* 11*/ { GS1_MODE, 3, 1, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 16, 18, "Warning 512: ECI ignored for GS1 mode", 1 }, + /* 12*/ { -1, -1, 9, { 0, 0, "" }, "123456789012345678", -1, 0, 8, 31, "", 9 }, + /* 13*/ { -1, -1, 9, { 0, 0, "" }, "12345678901234567A", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 515: Invalid character at position 18 in input (Version S encodes digits only)", 9 }, + /* 14*/ { -1, -1, 9, { 0, 0, "" }, "1234567890123456789", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 514: Input length 19 too long for Version S (maximum 18)", 9 }, + /* 15*/ { GS1_MODE, -1, 9, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 8, 31, "Warning 511: GS1 mode ignored for Version S", 9 }, + /* 16*/ { -1, 3, 9, { 0, 0, "" }, "1", -1, ZINT_WARN_INVALID_OPTION, 8, 11, "Warning 511: ECI ignored for Version S", 9 }, + /* 17*/ { GS1_MODE, 3, 9, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 8, 31, "Warning 511: ECI and GS1 mode ignored for Version S", 9 }, + /* 18*/ { -1, -1, 10, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", -1, 0, 16, 49, "", 10 }, + /* 19*/ { -1, -1, 10, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 519: Input length 91 too long for Version T (maximum 90)", 10 }, + /* 20*/ { -1, -1, 10, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, 0, 16, 49, "", 10 }, + /* 21*/ { -1, -1, 10, { 0, 0, "" }, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 55 codewords (maximum 38)", 10 }, + /* 22*/ { -1, -1, 10, { 0, 0, "" }, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 38, 0, 16, 49, "", 10 }, + /* 23*/ { -1, 3, 10, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456", -1, 0, 16, 49, "", 10 }, + /* 24*/ { -1, 3, 10, { 0, 0, "" }, "12345678901234567890123456789012345678901234567890123456789012345678901234567", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 516: Input too long for Version T, requires 39 codewords (maximum 38)", 10 }, + /* 25*/ { -1, 3, 10, { 0, 0, "" }, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234", -1, ZINT_ERROR_TOO_LONG, -1, -1, "Error 519: Input length 91 too long for Version T (maximum 90)", 10 }, + /* 26*/ { GS1_MODE, -1, 10, { 0, 0, "" }, "[01]12345678901231", -1, 0, 16, 17, "", 10 }, + /* 27*/ { GS1_MODE, 3, 10, { 0, 0, "" }, "[01]12345678901231", -1, ZINT_WARN_INVALID_OPTION, 16, 17, "Warning 512: ECI ignored for GS1 mode", 10 }, + /* 28*/ { -1, -1, 11, { 0, 0, "" }, "1", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 513: Version '11' out of range (1 to 10)", 11 }, + /* 29*/ { -1, -1, -2, { 0, 0, "" }, "1", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 513: Version '-2' out of range (1 to 10)", -2 }, + /* 30*/ { GS1_MODE, -1, -1, { 1, 2, "" }, "[01]12345678901231", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 710: Cannot have Structured Append and GS1 mode at the same time", 0 }, + /* 31*/ { -1, -1, -1, { 1, 1, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count '1' out of range (2 to 128)", 0 }, + /* 32*/ { -1, -1, -1, { 1, -1, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count '-1' out of range (2 to 128)", 0 }, + /* 33*/ { -1, -1, -1, { 1, 129, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 711: Structured Append count '129' out of range (2 to 128)", 0 }, + /* 34*/ { -1, -1, -1, { 0, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 712: Structured Append index '0' out of range (1 to count 2)", 0 }, + /* 35*/ { -1, -1, -1, { 3, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 712: Structured Append index '3' out of range (1 to count 2)", 0 }, + /* 36*/ { -1, -1, -1, { 1, 2, "1" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 713: Structured Append ID not available for Code One", 0 }, + /* 37*/ { -1, -1, 9, { 1, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 714: Structured Append not available for Version S", 9 }, + /* 38*/ { -1, -1, 9, { 3, 2, "" }, "123456789012ABCDEFGHI", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 714: Structured Append not available for Version S", 9 }, /* Trumps other checking */ }; const int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -3391,10 +3392,11 @@ static void test_rt(const testCtx *const p_ctx) { /* 7*/ { UNICODE_MODE, 26, -1, BARCODE_RAW_TEXT, "é", -1, 0, 26, "é", -1, 26 }, /* 8*/ { UNICODE_MODE, 899, -1, -1, "é", -1, 0, 899, "", -1, 0 }, /* 9*/ { UNICODE_MODE, 899, -1, BARCODE_RAW_TEXT, "é", -1, 0, 899, "é", -1, 899 }, - /* 10*/ { GS1_MODE, -1, -1, -1, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "", -1, 0 }, - /* 11*/ { GS1_MODE, -1, -1, BARCODE_RAW_TEXT, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "01049123451234591597033130128\03510ABC123", -1, 3 }, - /* 12*/ { UNICODE_MODE, -1, 9, -1, "12345", -1, 0, 0, "", -1, 0 }, /* Version S */ - /* 13*/ { UNICODE_MODE, -1, 9, BARCODE_RAW_TEXT, "12345", -1, 0, 0, "12345", -1, 3 }, + /* 10*/ { GS1_MODE, -1, -1, -1, "[01]04912345123459[15]970331[30]128[10]ABC12(", -1, 0, 0, "", -1, 0 }, + /* 11*/ { GS1_MODE, -1, -1, BARCODE_RAW_TEXT, "[01]04912345123459[15]970331[30]128[10]ABC12(", -1, 0, 0, "01049123451234591597033130128\03510ABC12(", -1, 3 }, + /* 12*/ { GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, -1, BARCODE_RAW_TEXT, "(01)04912345123459(15)970331(30)128(10)ABC12\\(", -1, 0, 0, "01049123451234591597033130128\03510ABC12(", -1, 3 }, + /* 13*/ { UNICODE_MODE, -1, 9, -1, "12345", -1, 0, 0, "", -1, 0 }, /* Version S */ + /* 14*/ { UNICODE_MODE, -1, 9, BARCODE_RAW_TEXT, "12345", -1, 0, 0, "12345", -1, 3 }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_code16k.c b/backend/tests/test_code16k.c index 4443920c..881f4f9c 100644 --- a/backend/tests/test_code16k.c +++ b/backend/tests/test_code16k.c @@ -192,43 +192,45 @@ static void test_input(const testCtx *const p_ctx) { /* 7*/ { GS1_MODE, -1, -1, 0, "[90]123[91]1A3[20]12", -1, 0, 4, 70, 1, 1, "(20) 18 90 12 100 19 102 25 99 11 100 33 19 99 102 20 12 103 103 0 3", 4, 0, "ModeCFNC1 90 12 CodeB 3 FNC1 9 CodeC 11 CodeB A 3 CodeC FNC1 20 12 Pad (2)" }, /* 8*/ { GS1_MODE, -1, -1, 0, "[90]123A[91]123", -1, 0, 3, 70, 1, 1, "(15) 11 90 12 100 19 33 102 25 99 11 23 103 103 81 56", 3, 0, "ModeCFNC1 90 12 CodeB 3 A FNC1 9 CodeC 11 23 Pad (2)" }, /* 9*/ { GS1_MODE | GS1PARENS_MODE, -1, -1, 0, "(90)12", -1, 0, 2, 70, 1, 1, "(10) 4 90 12 103 103 103 103 103 79 62", 2, 0, "ModeCFNC1 90 12 Pad (5)" }, - /* 10*/ { UNICODE_MODE, -1, -1, 0, "a0123456789", -1, 0, 2, 70, 1, 1, "(10) 5 65 1 23 45 67 89 103 27 86", 2, 0, "ModeC1SB a 01 23 45 67 89 Pad" }, - /* 11*/ { UNICODE_MODE, -1, -1, 0, "ab0123456789", -1, 0, 2, 70, 1, 1, "(10) 6 65 66 1 23 45 67 89 19 42", 2, 0, "ModeC2SB a b 01 23 45 67 89" }, - /* 12*/ { UNICODE_MODE, -1, -1, 0, "1234\037a", -1, 0, 2, 70, 0, 1, "(10) 2 12 34 101 95 98 65 103 67 53", 2, 0, "ModeC 12 34 CodeA US 1SB a Pad; BWIPP different encodation, CodeB instead of 1SB" }, - /* 13*/ { UNICODE_MODE, -1, -1, 0, "\000\037ß", 4, 0, 2, 70, 1, 1, "(10) 0 64 95 101 63 103 103 103 75 11", 2, 0, "ModeA NUL US FNC4 ß Pad (3)" }, - /* 14*/ { UNICODE_MODE, -1, -1, 0, "\000\037é", 4, 0, 2, 70, 0, 1, "(10) 0 64 95 101 98 73 103 103 75 6", 2, 0, "ModeA NUL US FNC4 1SB é Pad (2); BWIPP different encodation, CodeB instead of 1SB" }, - /* 15*/ { UNICODE_MODE, -1, -1, 0, "\000\037éa", 5, 0, 2, 70, 0, 1, "(10) 0 64 95 100 100 73 65 103 99 69", 2, 0, "ModeA NUL US CodeB FNC4 é a Pad; BWIPP different encodation, FNC4 before CodeB" }, - /* 16*/ { UNICODE_MODE, -1, -1, 0, "abß", -1, 0, 2, 70, 1, 1, "(10) 1 65 66 100 63 103 103 103 66 56", 2, 0, "ModeB a b FNC4 ß Pad (3)" }, - /* 17*/ { DATA_MODE, -1, -1, 0, "\141\142\237", -1, 0, 2, 70, 0, 899, "(10) 1 65 66 100 98 95 103 103 6 71", 2, 0, "ModeB a b FNC4 1SA APC Pad (2); BWIPP different encodation, CodeA instead of 1SA" }, - /* 18*/ { DATA_MODE, -1, -1, 0, "\141\142\237\037", -1, 0, 2, 70, 0, 899, "(10) 1 65 66 101 101 95 95 103 72 93", 2, 0, "ModeB a b CodeA FNC4 APC US Pad; BWIPP different encodation, FNC4 before CodeA" }, - /* 19*/ { UNICODE_MODE, -1, -1, 0, "ééé", -1, 0, 2, 70, 0, 1, "(10) 1 100 73 100 73 100 73 103 105 106", 2, 0, "ModeB FNC4 é FNC4 é FNC4 é Pad; BWIPP different encodation, uses double FNC4 latch" }, - /* 20*/ { UNICODE_MODE, -1, -1, 0, "aééééb", -1, 0, 3, 70, 1, 1, "(15) 8 65 100 73 100 73 100 73 100 73 66 103 103 39 83", 3, 0, "ModeB a FNC4 é (4) b Pad (2)" }, - /* 21*/ { UNICODE_MODE, -1, -1, 0, "aéééééb", -1, 0, 3, 70, 0, 1, "(15) 8 65 100 73 100 73 100 73 100 73 100 73 66 74 106", 3, 0, "ModeB a FNC4 é (5) b; BWIPP different encodation, uses double FNC4 latch" }, - /* 22*/ { UNICODE_MODE, -1, -1, 0, "aééééébcdeé", -1, 0, 4, 70, 0, 1, "(20) 15 65 100 73 100 73 100 73 100 73 100 73 66 67 68 69 100 73 14 69", 4, 0, "ModeB a FNC4 é (5) b c d e FNC4 é; BWIPP different encodation, uses double FNC4 latch then FNC4 escapes" }, - /* 23*/ { UNICODE_MODE, -1, -1, 0, "123456789012345678901234", -1, 0, 3, 70, 1, 1, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", 3, 0, "3 rows" }, - /* 24*/ { UNICODE_MODE, -1, 2, 0, "123456789012345678901234", -1, 0, 3, 70, 0, 1, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", 3, 0, "Min 2 rows (no change); BWIPP doesn't support min rows < required" }, - /* 25*/ { UNICODE_MODE, -1, 3, 0, "123456789012345678901234", -1, 0, 3, 70, 1, 1, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", 3, 0, "Min 3 rows (no change)" }, - /* 26*/ { UNICODE_MODE, -1, 4, 0, "123456789012345678901234", -1, 0, 4, 70, 1, 1, "(20) 16 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 66 96", 4, 0, "Min 4 rows" }, - /* 27*/ { UNICODE_MODE, -1, 5, 0, "123456789012345678901234", -1, 0, 5, 70, 1, 1, "(25) 23 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 103 103 103 103 103 68 61", 5, 0, "Min 5 rows" }, - /* 28*/ { UNICODE_MODE, -1, 16, 0, "123456789012345678901234", -1, 0, 16, 70, 1, 1, "(80) 100 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 103 103 103 103 103 103", 16, 0, "Min 16 rows" }, - /* 29*/ { UNICODE_MODE, -1, 1, 0, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 1, "Error 424: Minimum number of rows '1' out of range (2 to 16)", 1, 0, "" }, - /* 30*/ { UNICODE_MODE, -1, 17, 0, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 1, "Error 424: Minimum number of rows '17' out of range (2 to 16)", 17, 0, "" }, - /* 31*/ { UNICODE_MODE, -1, -1, 0, "ÁÁÁÁÁÁ99999999999999Á", -1, 0, 6, 70, 0, 1, "(30) 29 100 33 100 33 100 33 100 33 100 33 100 33 99 99 99 99 99 99 99 99 100 100 33 103", 6, 0, "BWIPP different encodation, uses double FNC4 latch" }, - /* 32*/ { UNICODE_MODE, -1, -1, 0, "ÿ\012àa\0121\012àAà", -1, 0, 4, 70, 0, 1, "(20) 15 100 95 98 74 100 64 65 98 74 17 98 74 100 64 33 100 64 47 35", 4, 0, "BWIPP different encodation, uses CodeA instead of 1SA" }, - /* 33*/ { UNICODE_MODE, -1, -1, 0, "ÿ\012àa\0121\012àAà\012à", -1, 0, 5, 70, 0, 1, "(25) 22 100 95 98 74 100 64 65 98 74 17 98 74 100 64 33 100 64 98 74 100 64 103 89 18", 5, 0, "BWIPP different encodation, uses CodeA instead of 1SA" }, - /* 34*/ { UNICODE_MODE, -1, -1, 0, "y1234\012àa\0121\0127890àAàDà\012à", -1, 0, 7, 70, 0, 1, "(35) 40 89 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100 64 36 100", 7, 0, "BWIPP different encodation, uses Sh2B + other differences" }, - /* 35*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 7, 70, 0, 1, "(35) 41 100 95 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100 64 36", 7, 0, "BWIPP different encodation" }, - /* 36*/ { UNICODE_MODE, -1, -1, 0, "yÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, 1, "(40) 43 89 100 95 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100", 8, 0, "BWIPP different encodation (and fits in 7 rows)" }, - /* 37*/ { UNICODE_MODE, -1, -1, 0, "ÿy1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, 1, "(40) 43 100 95 89 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100", 8, 0, "BWIPP different encodation (and fits in 7 rows)" }, - /* 38*/ { UNICODE_MODE, -1, -1, 0, "ÿÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, 1, "(40) 43 100 95 100 95 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33", 8, 0, "BWIPP different encodation (and fits in 7 rows)" }, - /* 39*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012àa\0121\01223456\0127890àAàDà\012à", -1, 0, 8, 70, 0, 1, "(40) 48 100 95 12 34 101 74 100 100 64 65 98 74 17 98 74 18 99 34 56 101 74 99 78 90 100", 8, 0, "BWIPP different encodation, uses Sh2B + other differences" }, - /* 40*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012à1234a\0121\01223456\0127890àAàDà\012à", -1, 0, 9, 70, 0, 1, "(45) 55 100 95 12 34 101 74 101 98 64 99 12 34 100 65 98 74 17 98 74 18 99 34 56 101 74 99", 9, 0, "BWIPP different encodation, uses Sh2C + other differences" }, - /* 41*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012à1234ab\0121\01223456\012\0127890àAàBCDà\012\012à", -1, 0, 10, 70, 0, 1, "(50) 62 100 95 12 34 101 74 101 98 64 99 12 34 100 65 66 98 74 17 98 74 18 99 34 56 101 74", 10, 0, "BWIPP different encodation, uses Sh2C + other differences" }, - /* 42*/ { UNICODE_MODE, -1, -1, 0, "ÿ123456\012à123456abcd\0121\01223456\012\0127890àAàBCDEà\012\012à", -1, 0, 11, 70, 0, 1, "(55) 69 100 95 12 34 56 101 74 101 98 64 99 12 34 56 100 65 66 67 68 98 74 17 98 74 18 99", 11, 0, "BWIPP different encodation, uses Sh3C + other differences" }, - /* 43*/ { UNICODE_MODE, -1, -1, 0, "ÿ12345678\012à12345678abcdef\0121\01223456\012\0127890àAàBCDEFà\012\012à", -1, 0, 12, 70, 0, 1, "(60) 76 100 95 12 34 56 78 101 74 101 98 64 99 12 34 56 78 100 65 66 67 68 69 70 98 74 17", 12, 0, "BWIPP different encodation, uses Sh2C + other differences" }, - /* 44*/ { UNICODE_MODE, COMPLIANT_HEIGHT, -1, 4, "A", -1, 0, 2, 70, 1, 1, "(10) 1 33 103 103 103 103 103 103 52 82", 2, 4, "option_3 separator" }, - /* 45*/ { UNICODE_MODE, COMPLIANT_HEIGHT, -1, 5, "A", -1, 0, 2, 70, 1, 1, "(10) 1 33 103 103 103 103 103 103 52 82", 2, 1, "option_3 invalid 5 -> 1" }, - /* 46*/ { UNICODE_MODE, -1, -1, 5, "A", -1, 0, 2, 70, 1, 1, "(10) 1 33 103 103 103 103 103 103 52 82", 2, 5, "option_3 invalid 5 ignored unless COMPLIANT_HEIGHT" }, + /* 10*/ { GS1_MODE, -1, -1, 0, "[90](2", -1, 0, 2, 70, 1, 1, "(10) 3 25 16 8 18 103 103 103 90 93", 2, 0, "ModeBFNC1 9 0 ( Pad (3)" }, + /* 11*/ { GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, -1, 0, "(90)\\(2", -1, 0, 2, 70, 1, 1, "(10) 3 25 16 8 18 103 103 103 90 93", 2, 0, "ModeBFNC1 9 0 ( Pad (3)" }, + /* 12*/ { UNICODE_MODE, -1, -1, 0, "a0123456789", -1, 0, 2, 70, 1, 1, "(10) 5 65 1 23 45 67 89 103 27 86", 2, 0, "ModeC1SB a 01 23 45 67 89 Pad" }, + /* 13*/ { UNICODE_MODE, -1, -1, 0, "ab0123456789", -1, 0, 2, 70, 1, 1, "(10) 6 65 66 1 23 45 67 89 19 42", 2, 0, "ModeC2SB a b 01 23 45 67 89" }, + /* 14*/ { UNICODE_MODE, -1, -1, 0, "1234\037a", -1, 0, 2, 70, 0, 1, "(10) 2 12 34 101 95 98 65 103 67 53", 2, 0, "ModeC 12 34 CodeA US 1SB a Pad; BWIPP different encodation, CodeB instead of 1SB" }, + /* 15*/ { UNICODE_MODE, -1, -1, 0, "\000\037ß", 4, 0, 2, 70, 1, 1, "(10) 0 64 95 101 63 103 103 103 75 11", 2, 0, "ModeA NUL US FNC4 ß Pad (3)" }, + /* 16*/ { UNICODE_MODE, -1, -1, 0, "\000\037é", 4, 0, 2, 70, 0, 1, "(10) 0 64 95 101 98 73 103 103 75 6", 2, 0, "ModeA NUL US FNC4 1SB é Pad (2); BWIPP different encodation, CodeB instead of 1SB" }, + /* 17*/ { UNICODE_MODE, -1, -1, 0, "\000\037éa", 5, 0, 2, 70, 0, 1, "(10) 0 64 95 100 100 73 65 103 99 69", 2, 0, "ModeA NUL US CodeB FNC4 é a Pad; BWIPP different encodation, FNC4 before CodeB" }, + /* 18*/ { UNICODE_MODE, -1, -1, 0, "abß", -1, 0, 2, 70, 1, 1, "(10) 1 65 66 100 63 103 103 103 66 56", 2, 0, "ModeB a b FNC4 ß Pad (3)" }, + /* 19*/ { DATA_MODE, -1, -1, 0, "\141\142\237", -1, 0, 2, 70, 0, 899, "(10) 1 65 66 100 98 95 103 103 6 71", 2, 0, "ModeB a b FNC4 1SA APC Pad (2); BWIPP different encodation, CodeA instead of 1SA" }, + /* 20*/ { DATA_MODE, -1, -1, 0, "\141\142\237\037", -1, 0, 2, 70, 0, 899, "(10) 1 65 66 101 101 95 95 103 72 93", 2, 0, "ModeB a b CodeA FNC4 APC US Pad; BWIPP different encodation, FNC4 before CodeA" }, + /* 21*/ { UNICODE_MODE, -1, -1, 0, "ééé", -1, 0, 2, 70, 0, 1, "(10) 1 100 73 100 73 100 73 103 105 106", 2, 0, "ModeB FNC4 é FNC4 é FNC4 é Pad; BWIPP different encodation, uses double FNC4 latch" }, + /* 22*/ { UNICODE_MODE, -1, -1, 0, "aééééb", -1, 0, 3, 70, 1, 1, "(15) 8 65 100 73 100 73 100 73 100 73 66 103 103 39 83", 3, 0, "ModeB a FNC4 é (4) b Pad (2)" }, + /* 23*/ { UNICODE_MODE, -1, -1, 0, "aéééééb", -1, 0, 3, 70, 0, 1, "(15) 8 65 100 73 100 73 100 73 100 73 100 73 66 74 106", 3, 0, "ModeB a FNC4 é (5) b; BWIPP different encodation, uses double FNC4 latch" }, + /* 24*/ { UNICODE_MODE, -1, -1, 0, "aééééébcdeé", -1, 0, 4, 70, 0, 1, "(20) 15 65 100 73 100 73 100 73 100 73 100 73 66 67 68 69 100 73 14 69", 4, 0, "ModeB a FNC4 é (5) b c d e FNC4 é; BWIPP different encodation, uses double FNC4 latch then FNC4 escapes" }, + /* 25*/ { UNICODE_MODE, -1, -1, 0, "123456789012345678901234", -1, 0, 3, 70, 1, 1, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", 3, 0, "3 rows" }, + /* 26*/ { UNICODE_MODE, -1, 2, 0, "123456789012345678901234", -1, 0, 3, 70, 0, 1, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", 3, 0, "Min 2 rows (no change); BWIPP doesn't support min rows < required" }, + /* 27*/ { UNICODE_MODE, -1, 3, 0, "123456789012345678901234", -1, 0, 3, 70, 1, 1, "(15) 9 12 34 56 78 90 12 34 56 78 90 12 34 71 42", 3, 0, "Min 3 rows (no change)" }, + /* 28*/ { UNICODE_MODE, -1, 4, 0, "123456789012345678901234", -1, 0, 4, 70, 1, 1, "(20) 16 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 66 96", 4, 0, "Min 4 rows" }, + /* 29*/ { UNICODE_MODE, -1, 5, 0, "123456789012345678901234", -1, 0, 5, 70, 1, 1, "(25) 23 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 103 103 103 103 103 68 61", 5, 0, "Min 5 rows" }, + /* 30*/ { UNICODE_MODE, -1, 16, 0, "123456789012345678901234", -1, 0, 16, 70, 1, 1, "(80) 100 12 34 56 78 90 12 34 56 78 90 12 34 103 103 103 103 103 103 103 103 103 103 103", 16, 0, "Min 16 rows" }, + /* 31*/ { UNICODE_MODE, -1, 1, 0, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 1, "Error 424: Minimum number of rows '1' out of range (2 to 16)", 1, 0, "" }, + /* 32*/ { UNICODE_MODE, -1, 17, 0, "123456789012345678901234", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, 1, 1, "Error 424: Minimum number of rows '17' out of range (2 to 16)", 17, 0, "" }, + /* 33*/ { UNICODE_MODE, -1, -1, 0, "ÁÁÁÁÁÁ99999999999999Á", -1, 0, 6, 70, 0, 1, "(30) 29 100 33 100 33 100 33 100 33 100 33 100 33 99 99 99 99 99 99 99 99 100 100 33 103", 6, 0, "BWIPP different encodation, uses double FNC4 latch" }, + /* 34*/ { UNICODE_MODE, -1, -1, 0, "ÿ\012àa\0121\012àAà", -1, 0, 4, 70, 0, 1, "(20) 15 100 95 98 74 100 64 65 98 74 17 98 74 100 64 33 100 64 47 35", 4, 0, "BWIPP different encodation, uses CodeA instead of 1SA" }, + /* 35*/ { UNICODE_MODE, -1, -1, 0, "ÿ\012àa\0121\012àAà\012à", -1, 0, 5, 70, 0, 1, "(25) 22 100 95 98 74 100 64 65 98 74 17 98 74 100 64 33 100 64 98 74 100 64 103 89 18", 5, 0, "BWIPP different encodation, uses CodeA instead of 1SA" }, + /* 36*/ { UNICODE_MODE, -1, -1, 0, "y1234\012àa\0121\0127890àAàDà\012à", -1, 0, 7, 70, 0, 1, "(35) 40 89 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100 64 36 100", 7, 0, "BWIPP different encodation, uses Sh2B + other differences" }, + /* 37*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 7, 70, 0, 1, "(35) 41 100 95 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100 64 36", 7, 0, "BWIPP different encodation" }, + /* 38*/ { UNICODE_MODE, -1, -1, 0, "yÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, 1, "(40) 43 89 100 95 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100", 8, 0, "BWIPP different encodation (and fits in 7 rows)" }, + /* 39*/ { UNICODE_MODE, -1, -1, 0, "ÿy1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, 1, "(40) 43 100 95 89 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33 100", 8, 0, "BWIPP different encodation (and fits in 7 rows)" }, + /* 40*/ { UNICODE_MODE, -1, -1, 0, "ÿÿ1234\012àa\0121\0127890àAàDà\012à", -1, 0, 8, 70, 0, 1, "(40) 43 100 95 100 95 99 12 34 101 74 100 100 64 65 98 74 17 98 74 99 78 90 100 100 64 33", 8, 0, "BWIPP different encodation (and fits in 7 rows)" }, + /* 41*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012àa\0121\01223456\0127890àAàDà\012à", -1, 0, 8, 70, 0, 1, "(40) 48 100 95 12 34 101 74 100 100 64 65 98 74 17 98 74 18 99 34 56 101 74 99 78 90 100", 8, 0, "BWIPP different encodation, uses Sh2B + other differences" }, + /* 42*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012à1234a\0121\01223456\0127890àAàDà\012à", -1, 0, 9, 70, 0, 1, "(45) 55 100 95 12 34 101 74 101 98 64 99 12 34 100 65 98 74 17 98 74 18 99 34 56 101 74 99", 9, 0, "BWIPP different encodation, uses Sh2C + other differences" }, + /* 43*/ { UNICODE_MODE, -1, -1, 0, "ÿ1234\012à1234ab\0121\01223456\012\0127890àAàBCDà\012\012à", -1, 0, 10, 70, 0, 1, "(50) 62 100 95 12 34 101 74 101 98 64 99 12 34 100 65 66 98 74 17 98 74 18 99 34 56 101 74", 10, 0, "BWIPP different encodation, uses Sh2C + other differences" }, + /* 44*/ { UNICODE_MODE, -1, -1, 0, "ÿ123456\012à123456abcd\0121\01223456\012\0127890àAàBCDEà\012\012à", -1, 0, 11, 70, 0, 1, "(55) 69 100 95 12 34 56 101 74 101 98 64 99 12 34 56 100 65 66 67 68 98 74 17 98 74 18 99", 11, 0, "BWIPP different encodation, uses Sh3C + other differences" }, + /* 45*/ { UNICODE_MODE, -1, -1, 0, "ÿ12345678\012à12345678abcdef\0121\01223456\012\0127890àAàBCDEFà\012\012à", -1, 0, 12, 70, 0, 1, "(60) 76 100 95 12 34 56 78 101 74 101 98 64 99 12 34 56 78 100 65 66 67 68 69 70 98 74 17", 12, 0, "BWIPP different encodation, uses Sh2C + other differences" }, + /* 46*/ { UNICODE_MODE, COMPLIANT_HEIGHT, -1, 4, "A", -1, 0, 2, 70, 1, 1, "(10) 1 33 103 103 103 103 103 103 52 82", 2, 4, "option_3 separator" }, + /* 47*/ { UNICODE_MODE, COMPLIANT_HEIGHT, -1, 5, "A", -1, 0, 2, 70, 1, 1, "(10) 1 33 103 103 103 103 103 103 52 82", 2, 1, "option_3 invalid 5 -> 1" }, + /* 48*/ { UNICODE_MODE, -1, -1, 5, "A", -1, 0, 2, 70, 1, 1, "(10) 1 33 103 103 103 103 103 103 52 82", 2, 5, "option_3 invalid 5 ignored unless COMPLIANT_HEIGHT" }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_code49.c b/backend/tests/test_code49.c index abf864f8..843168c4 100644 --- a/backend/tests/test_code49.c +++ b/backend/tests/test_code49.c @@ -123,21 +123,23 @@ static void test_input(const testCtx *const p_ctx) { /* 12*/ { UNICODE_MODE, -1, -1, 0, "1234\037aA12345A", -1, 0, 3, 70, "(24) 1 2 3 4 43 5 44 4 10 10 48 5 17 9 48 0 10 48 19 2 13 32 7 33", 3, 0, "1 2 3 4 S1 US S2 (C18 4) a A NS 12345 NS (C28 0) A (Start 0, Alpha)" }, /* 13*/ { GS1_MODE, -1, -1, 0, "[90]12345[91]AB12345", -1, 0, 4, 70, "(32) 45 48 47 15 4 7 9 28 48 45 9 1 10 11 48 25 5 17 9 48 48 48 48 27 48 48 37 39 26 8 14", 4, 0, "FNC1 NS 9012345 (C18 28) NS FNC1 9 1 A B NS (C28 25) 12345 Pad (4) (C38 27) (Start 0, Alpha)" }, /* 14*/ { GS1_MODE | GS1PARENS_MODE, -1, -1, 0, "(90)12345(91)AB12345", -1, 0, 4, 70, "(32) 45 48 47 15 4 7 9 28 48 45 9 1 10 11 48 25 5 17 9 48 48 48 48 27 48 48 37 39 26 8 14", 4, 0, "FNC1 NS 9012345 (C18 28) NS FNC1 9 1 A B NS (C28 25) 12345 Pad (4) (C38 27) (Start 0, Alpha)" }, - /* 15*/ { UNICODE_MODE, -1, -1, 0, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 5, 0, "" }, - /* 16*/ { UNICODE_MODE, -1, 1, 0, "1234567890123456789012345678901234567890", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 433: Minimum number of rows out of range (2 to 8)", 1, 0, "" }, - /* 17*/ { UNICODE_MODE, -1, 9, 0, "1234567890123456789012345678901234567890", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 433: Minimum number of rows out of range (2 to 8)", 9, 0, "" }, - /* 18*/ { UNICODE_MODE, -1, 2, 0, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 5, 0, "" }, - /* 19*/ { UNICODE_MODE, -1, 3, 0, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 5, 0, "" }, - /* 20*/ { UNICODE_MODE, -1, 4, 0, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 5, 0, "" }, - /* 21*/ { UNICODE_MODE, -1, 5, 0, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 5, 0, "" }, - /* 22*/ { UNICODE_MODE, -1, 6, 0, "1234567890123456789012345678901234567890", -1, 0, 6, 70, "(48) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 6, 0, "" }, - /* 23*/ { UNICODE_MODE, -1, 7, 0, "1234567890123456789012345678901234567890", -1, 0, 7, 70, "(56) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 7, 0, "" }, - /* 24*/ { UNICODE_MODE, -1, 8, 0, "1234567890123456789012345678901234567890", -1, 0, 8, 70, "(64) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 8, 0, "" }, - /* 25*/ { UNICODE_MODE, -1, -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW", -1, 0, 8, 70, "(64) 10 11 12 13 14 15 16 42 17 18 19 20 21 22 23 42 24 25 26 27 28 29 30 42 31 32 33 34 35", 8, 0, "" }, - /* 26*/ { UNICODE_MODE, -1, -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWX", -1, ZINT_ERROR_TOO_LONG, 0, 0, "Error 432: Input too long, requires 50 codewords (maximum 49)", -1, 0, "" }, - /* 27*/ { UNICODE_MODE, COMPLIANT_HEIGHT, -1, 4, "12345", -1, 0, 2, 70, "(16) 5 17 9 48 48 48 48 27 48 48 13 23 0 13 2 0", 2, 4, "option_3 separator" }, - /* 28*/ { UNICODE_MODE, COMPLIANT_HEIGHT, -1, 5, "12345", -1, 0, 2, 70, "(16) 5 17 9 48 48 48 48 27 48 48 13 23 0 13 2 0", 2, 1, "option_3 invalid 5 -> 1" }, - /* 29*/ { UNICODE_MODE, -1, -1, 5, "12345", -1, 0, 2, 70, "(16) 5 17 9 48 48 48 48 27 48 48 13 23 0 13 2 0", 2, 5, "option_3 invalid 5 ignored unless COMPLIANT_HEIGHT" }, + /* 15*/ { GS1_MODE, -1, -1, 0, "[90](90)", -1, 0, 2, 70, "(16) 45 9 0 43 36 9 0 44 43 37 39 24 44 25 0 16", 2, 0, "" }, + /* 16*/ { GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, -1, 0, "(90)\\(90\\)", -1, 0, 2, 70, "(16) 45 9 0 43 36 9 0 44 43 37 39 24 44 25 0 16", 2, 0, "" }, + /* 17*/ { UNICODE_MODE, -1, -1, 0, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 5, 0, "" }, + /* 18*/ { UNICODE_MODE, -1, 1, 0, "1234567890123456789012345678901234567890", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 433: Minimum number of rows out of range (2 to 8)", 1, 0, "" }, + /* 19*/ { UNICODE_MODE, -1, 9, 0, "1234567890123456789012345678901234567890", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 433: Minimum number of rows out of range (2 to 8)", 9, 0, "" }, + /* 20*/ { UNICODE_MODE, -1, 2, 0, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 5, 0, "" }, + /* 21*/ { UNICODE_MODE, -1, 3, 0, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 5, 0, "" }, + /* 22*/ { UNICODE_MODE, -1, 4, 0, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 5, 0, "" }, + /* 23*/ { UNICODE_MODE, -1, 5, 0, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 5, 0, "" }, + /* 24*/ { UNICODE_MODE, -1, 6, 0, "1234567890123456789012345678901234567890", -1, 0, 6, 70, "(48) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 6, 0, "" }, + /* 25*/ { UNICODE_MODE, -1, 7, 0, "1234567890123456789012345678901234567890", -1, 0, 7, 70, "(56) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 7, 0, "" }, + /* 26*/ { UNICODE_MODE, -1, 8, 0, "1234567890123456789012345678901234567890", -1, 0, 8, 70, "(64) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", 8, 0, "" }, + /* 27*/ { UNICODE_MODE, -1, -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW", -1, 0, 8, 70, "(64) 10 11 12 13 14 15 16 42 17 18 19 20 21 22 23 42 24 25 26 27 28 29 30 42 31 32 33 34 35", 8, 0, "" }, + /* 28*/ { UNICODE_MODE, -1, -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWX", -1, ZINT_ERROR_TOO_LONG, 0, 0, "Error 432: Input too long, requires 50 codewords (maximum 49)", -1, 0, "" }, + /* 29*/ { UNICODE_MODE, COMPLIANT_HEIGHT, -1, 4, "12345", -1, 0, 2, 70, "(16) 5 17 9 48 48 48 48 27 48 48 13 23 0 13 2 0", 2, 4, "option_3 separator" }, + /* 30*/ { UNICODE_MODE, COMPLIANT_HEIGHT, -1, 5, "12345", -1, 0, 2, 70, "(16) 5 17 9 48 48 48 48 27 48 48 13 23 0 13 2 0", 2, 1, "option_3 invalid 5 -> 1" }, + /* 31*/ { UNICODE_MODE, -1, -1, 5, "12345", -1, 0, 2, 70, "(16) 5 17 9 48 48 48 48 27 48 48 13 23 0 13 2 0", 2, 5, "option_3 invalid 5 ignored unless COMPLIANT_HEIGHT" }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_composite.c b/backend/tests/test_composite.c index 81ee04e6..449c0074 100644 --- a/backend/tests/test_composite.c +++ b/backend/tests/test_composite.c @@ -3421,28 +3421,52 @@ static void test_gs1parens(const testCtx *const p_ctx) { /* 1*/ { BARCODE_EANX_CC, -1, "1234567", "[21]A12345678", 0, 8, 72 }, /* EAN-8 */ /* 2*/ { BARCODE_EAN8_CC, GS1PARENS_MODE, "1234567", "(21)A12345678", 0, 8, 72 }, /* 3*/ { BARCODE_EANX_CC, GS1PARENS_MODE, "1234567", "(21)A12345678", 0, 8, 72 }, /* EAN-8 */ - /* 4*/ { BARCODE_EAN13_CC, -1, "123456789012", "[21]A12345678", 0, 7, 99 }, - /* 5*/ { BARCODE_EANX_CC, -1, "123456789012", "[21]A12345678", 0, 7, 99 }, /* EAN-13 */ - /* 6*/ { BARCODE_EAN13_CC, GS1PARENS_MODE, "123456789012", "(21)A12345678", 0, 7, 99 }, - /* 7*/ { BARCODE_EANX_CC, GS1PARENS_MODE, "123456789012", "(21)A12345678", 0, 7, 99 }, /* EAN-13 */ - /* 8*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[21]A12345678", 0, 5, 145 }, - /* 9*/ { BARCODE_GS1_128_CC, GS1PARENS_MODE, "(01)12345678901231", "(21)A12345678", 0, 5, 145 }, - /* 10*/ { BARCODE_DBAR_OMN_CC, -1, "12345678901231", "[21]A12345678", 0, 5, 100 }, - /* 11*/ { BARCODE_DBAR_OMN_CC, GS1PARENS_MODE, "12345678901231", "(21)A12345678", 0, 5, 100 }, - /* 12*/ { BARCODE_DBAR_LTD_CC, -1, "12345678901231", "[21]A12345678", 0, 6, 79 }, - /* 13*/ { BARCODE_DBAR_LTD_CC, GS1PARENS_MODE, "12345678901231", "(21)A12345678", 0, 6, 79 }, - /* 14*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[3103]001234", "[21]A12345678", 0, 5, 200 }, - /* 15*/ { BARCODE_DBAR_EXP_CC, GS1PARENS_MODE, "(01)12345678901231(3103)001234", "(21)A12345678", 0, 5, 200 }, - /* 16*/ { BARCODE_UPCA_CC, -1, "12345678901", "[21]A12345678", 0, 7, 99 }, - /* 17*/ { BARCODE_UPCA_CC, GS1PARENS_MODE, "12345678901", "(21)A12345678", 0, 7, 99 }, - /* 18*/ { BARCODE_UPCE_CC, -1, "1234567", "[21]A12345678", 0, 9, 55 }, - /* 19*/ { BARCODE_UPCE_CC, GS1PARENS_MODE, "1234567", "(21)A12345678", 0, 9, 55 }, - /* 20*/ { BARCODE_DBAR_STK_CC, -1, "12345678901231", "[21]A12345678", 0, 9, 56 }, - /* 21*/ { BARCODE_DBAR_STK_CC, GS1PARENS_MODE, "12345678901231", "(21)A12345678", 0, 9, 56 }, - /* 22*/ { BARCODE_DBAR_OMNSTK_CC, -1, "12345678901231", "[21]A12345678", 0, 11, 56 }, - /* 23*/ { BARCODE_DBAR_OMNSTK_CC, GS1PARENS_MODE, "12345678901231", "(21)A12345678", 0, 11, 56 }, - /* 24*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[3103]001234", "[21]A12345678", 0, 9, 102 }, - /* 25*/ { BARCODE_DBAR_EXPSTK_CC, GS1PARENS_MODE, "(01)12345678901231(3103)001234", "(21)A12345678", 0, 9, 102 }, + /* 4*/ { BARCODE_EAN8_CC, -1, "1234567", "[21]A)(34(67)8", 0, 9, 72 }, + /* 5*/ { BARCODE_EAN8_CC, ESCAPE_MODE | GS1PARENS_MODE, "1234567", "(21)A\\)\\(34\\(67\\)8", 0, 9, 72 }, + /* 6*/ { BARCODE_EANX_CC, ESCAPE_MODE | GS1PARENS_MODE, "1234567", "(21)A\\)\\(34\\(67\\)8", 0, 9, 72 }, + /* 7*/ { BARCODE_EAN13_CC, -1, "123456789012", "[21]A12345678", 0, 7, 99 }, + /* 8*/ { BARCODE_EANX_CC, -1, "123456789012", "[21]A12345678", 0, 7, 99 }, /* EAN-13 */ + /* 9*/ { BARCODE_EAN13_CC, GS1PARENS_MODE, "123456789012", "(21)A12345678", 0, 7, 99 }, + /* 10*/ { BARCODE_EANX_CC, GS1PARENS_MODE, "123456789012", "(21)A12345678", 0, 7, 99 }, /* EAN-13 */ + /* 11*/ { BARCODE_EAN13_CC, -1, "123456789012", "[21]((234567)", 0, 7, 99 }, + /* 12*/ { BARCODE_EAN13_CC, ESCAPE_MODE | GS1PARENS_MODE, "123456789012", "(21)\\(\\(234567\\)", 0, 7, 99 }, + /* 13*/ { BARCODE_EANX_CC, ESCAPE_MODE | GS1PARENS_MODE, "123456789012", "(21)\\(\\(234567\\)", 0, 7, 99 }, + /* 14*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[21]A12345678", 0, 5, 145 }, + /* 15*/ { BARCODE_GS1_128_CC, GS1PARENS_MODE, "(01)12345678901231", "(21)A12345678", 0, 5, 145 }, + /* 16*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[21]()", 0, 5, 145 }, + /* 17*/ { BARCODE_GS1_128_CC, ESCAPE_MODE | GS1PARENS_MODE, "(01)12345678901231", "(21)\\(\\)", 0, 5, 145 }, + /* 18*/ { BARCODE_DBAR_OMN_CC, -1, "12345678901231", "[21]A12345678", 0, 5, 100 }, + /* 19*/ { BARCODE_DBAR_OMN_CC, GS1PARENS_MODE, "12345678901231", "(21)A12345678", 0, 5, 100 }, + /* 20*/ { BARCODE_DBAR_OMN_CC, -1, "12345678901231", "[21](21)", 0, 5, 100 }, + /* 21*/ { BARCODE_DBAR_OMN_CC, ESCAPE_MODE | GS1PARENS_MODE, "12345678901231", "(21)\\(21\\)", 0, 5, 100 }, + /* 22*/ { BARCODE_DBAR_LTD_CC, -1, "12345678901231", "[21]A12345678", 0, 6, 79 }, + /* 23*/ { BARCODE_DBAR_LTD_CC, GS1PARENS_MODE, "12345678901231", "(21)A12345678", 0, 6, 79 }, + /* 24*/ { BARCODE_DBAR_LTD_CC, -1, "12345678901231", "[21])", 0, 6, 79 }, + /* 25*/ { BARCODE_DBAR_LTD_CC, ESCAPE_MODE | GS1PARENS_MODE, "12345678901231", "(21)\\)", 0, 6, 79 }, + /* 26*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[3103]001234", "[21]A12345678", 0, 5, 200 }, + /* 27*/ { BARCODE_DBAR_EXP_CC, GS1PARENS_MODE, "(01)12345678901231(3103)001234", "(21)A12345678", 0, 5, 200 }, + /* 28*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[3103]001234", "[21])", 0, 5, 200 }, + /* 29*/ { BARCODE_DBAR_EXP_CC, ESCAPE_MODE | GS1PARENS_MODE, "(01)12345678901231(3103)001234", "(21)\\)", 0, 5, 200 }, + /* 30*/ { BARCODE_UPCA_CC, -1, "12345678901", "[21]A12345678", 0, 7, 99 }, + /* 31*/ { BARCODE_UPCA_CC, GS1PARENS_MODE, "12345678901", "(21)A12345678", 0, 7, 99 }, + /* 32*/ { BARCODE_UPCA_CC, -1, "12345678901", "[21]())(", 0, 7, 99 }, + /* 33*/ { BARCODE_UPCA_CC, ESCAPE_MODE | GS1PARENS_MODE, "12345678901", "(21)\\(\\)\\)\\(", 0, 7, 99 }, + /* 34*/ { BARCODE_UPCE_CC, -1, "1234567", "[21]A12345678", 0, 9, 55 }, + /* 35*/ { BARCODE_UPCE_CC, GS1PARENS_MODE, "1234567", "(21)A12345678", 0, 9, 55 }, + /* 36*/ { BARCODE_UPCE_CC, -1, "1234567", "[21])", 0, 9, 55 }, + /* 37*/ { BARCODE_UPCE_CC, ESCAPE_MODE | GS1PARENS_MODE, "1234567", "(21)\\)", 0, 9, 55 }, + /* 38*/ { BARCODE_DBAR_STK_CC, -1, "12345678901231", "[21]A12345678", 0, 9, 56 }, + /* 39*/ { BARCODE_DBAR_STK_CC, GS1PARENS_MODE, "12345678901231", "(21)A12345678", 0, 9, 56 }, + /* 40*/ { BARCODE_DBAR_STK_CC, -1, "12345678901231", "[21])1", 0, 9, 56 }, + /* 41*/ { BARCODE_DBAR_STK_CC, ESCAPE_MODE | GS1PARENS_MODE, "12345678901231", "(21)\\)1", 0, 9, 56 }, + /* 42*/ { BARCODE_DBAR_OMNSTK_CC, -1, "12345678901231", "[21]A12345678", 0, 11, 56 }, + /* 43*/ { BARCODE_DBAR_OMNSTK_CC, GS1PARENS_MODE, "12345678901231", "(21)A12345678", 0, 11, 56 }, + /* 44*/ { BARCODE_DBAR_OMNSTK_CC, -1, "12345678901231", "[21]A(", 0, 11, 56 }, + /* 45*/ { BARCODE_DBAR_OMNSTK_CC, ESCAPE_MODE | GS1PARENS_MODE, "12345678901231", "(21)A\\(", 0, 11, 56 }, + /* 46*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[3103]001234", "[21]A12345678", 0, 9, 102 }, + /* 47*/ { BARCODE_DBAR_EXPSTK_CC, GS1PARENS_MODE, "(01)12345678901231(3103)001234", "(21)A12345678", 0, 9, 102 }, + /* 48*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[3103]001234", "[21]()1", 0, 9, 102 }, + /* 49*/ { BARCODE_DBAR_EXPSTK_CC, ESCAPE_MODE | GS1PARENS_MODE, "(01)12345678901231(3103)001234", "(21)\\(\\)1", 0, 9, 102 }, }; const int data_size = ARRAY_SIZE(data); int i, length, composite_length, ret; @@ -3753,7 +3777,7 @@ static void test_input(const testCtx *const p_ctx) { /*119*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[20]1A", 0, 11, 56, "", 1, 0, 0 }, /*120*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, -1, -1, "12345678901231", "[02]12345678901234", ZINT_WARN_NONCOMPLIANT, 11, 56, "Warning 261: AI (02) position 14: Bad checksum '4', expected '1' (2D component)", 1, 0, 0 }, /*121*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[02]12345678901234", 0, 11, 56, "", 1, 0, 0 }, - /*122*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "", "[20]12", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 445: No primary (linear) message", -1, 0, 0 }, + /*122*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "", "[20]12", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 445: No primary (linear component)", -1, 0, 0 }, /*123*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 31, 273, "", 3, 0, 0 }, /* Tries CC-A then CC-B then CC-C - ensure errtxt empty */ /*124*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123", ZINT_WARN_NONCOMPLIANT, 29, 702, "Warning 843: Input too long, requires 115 characters (maximum 48) (linear component)", 3, 0, 0 }, /* Overlarge linear and CC-C input */ /*125*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[97]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[98]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[99]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL", ZINT_ERROR_TOO_LONG, -1, -1, "Error 442: Input too long (2D component)", -1, 0, 0 }, /* Overlarge linear and oversized CC-C input */ diff --git a/backend/tests/test_dmatrix.c b/backend/tests/test_dmatrix.c index 2dfa3bae..56c05052 100644 --- a/backend/tests/test_dmatrix.c +++ b/backend/tests/test_dmatrix.c @@ -686,24 +686,28 @@ static void test_options(const testCtx *const p_ctx) { /* 79*/ { BARCODE_DATAMATRIX, -1, -1, -1, DM_SQUARE, -1, { 0, 0, "" }, "______________________________________________________________________________________________________________________", 0, 44, 44, "", 13, 1, "118 data" }, /* 80*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, -1, -1, { 0, 0, "" }, "[90]12", 0, 10, 10, "", 1, 1, "" }, /* 81*/ { BARCODE_DATAMATRIX, GS1_MODE | GS1PARENS_MODE, -1, -1, -1, -1, { 0, 0, "" }, "(90)12", 0, 10, 10, "", 1, 1, "" }, - /* 82*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 1, 2, "" }, "1", 0, 12, 12, "", 2, 1, "" }, - /* 83*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 16, 16, "" }, "1", 0, 12, 12, "", 2, 1, "" }, - /* 84*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 1, 1, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 720: Structured Append count '1' out of range (2 to 16)", 0, 1, "" }, - /* 85*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 1, 17, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 720: Structured Append count '17' out of range (2 to 16)", 0, 1, "" }, - /* 86*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 0, 16, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 721: Structured Append index '0' out of range (1 to count 16)", 0, 1, "" }, - /* 87*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 17, 16, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 721: Structured Append index '17' out of range (1 to count 16)", 0, 1, "" }, - /* 88*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1001" }, "1", 0, 12, 12, "", 2, 1, "" }, - /* 89*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "A" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 723: Invalid Structured Append ID (digits only)", 0, 1, "" }, - /* 90*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "0" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 724: Structured Append ID1 '000' and ID2 '000' out of range (001 to 254) (ID \"000000\")", 0, 1, "" }, - /* 91*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 725: Structured Append ID1 '000' out of range (001 to 254) (ID \"000001\")", 0, 1, "" }, - /* 92*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1000" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 726: Structured Append ID2 '000' out of range (001 to 254) (ID \"001000\")", 0, 1, "" }, - /* 93*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "001255" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 726: Structured Append ID2 '255' out of range (001 to 254) (ID \"001255\")", 0, 1, "" }, - /* 94*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "255001" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 725: Structured Append ID1 '255' out of range (001 to 254) (ID \"255001\")", 0, 1, "" }, - /* 95*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "255255" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 724: Structured Append ID1 '255' and ID2 '255' out of range (001 to 254) (ID \"255255\")", 0, 1, "" }, - /* 96*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1234567" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 722: Structured Append ID length 7 too long (6 digit maximum)", 0, 1, "" }, - /* 97*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, READER_INIT, { 2, 3, "1001" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 727: Cannot have Structured Append and Reader Initialisation at the same time", 0, 1, "" }, - /* 98*/ { BARCODE_DATAMATRIX, ESCAPE_MODE, -1, -1, -1, -1, { 2, 3, "1001" }, "[)>\\R05\\GA\\R\\E", 0, 12, 26, "", 27, 1, "Macro05/06 ignored if have Structured Append TODO: error/warning " }, - /* 99*/ { BARCODE_HIBC_DM, -1, -1, -1, -1, -1, { 0, 0, "" }, "1234,67", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 203: Invalid character at position 5 in input (alphanumerics, space and \"-.$/+%\" only)", 0, 1, "" }, + /* 82*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, -1, -1, { 0, 0, "" }, "[90](", 0, 10, 10, "", 1, 1, "" }, + /* 83*/ { BARCODE_DATAMATRIX, GS1_MODE | GS1PARENS_MODE, -1, -1, -1, -1, { 0, 0, "" }, "(90)(", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 253: Malformed AI in input (brackets don't match)", 0, 1, "" }, + /* 84*/ { BARCODE_DATAMATRIX, GS1_MODE | GS1PARENS_MODE, -1, -1, -1, -1, { 0, 0, "" }, "(90)\\(", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 253: Malformed AI in input (brackets don't match)", 0, 1, "" }, + /* 85*/ { BARCODE_DATAMATRIX, GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, -1, -1, -1, { 0, 0, "" }, "(90)\\(", 0, 10, 10, "", 1, 1, "" }, + /* 86*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 1, 2, "" }, "1", 0, 12, 12, "", 2, 1, "" }, + /* 87*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 16, 16, "" }, "1", 0, 12, 12, "", 2, 1, "" }, + /* 88*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 1, 1, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 720: Structured Append count '1' out of range (2 to 16)", 0, 1, "" }, + /* 89*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 1, 17, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 720: Structured Append count '17' out of range (2 to 16)", 0, 1, "" }, + /* 90*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 0, 16, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 721: Structured Append index '0' out of range (1 to count 16)", 0, 1, "" }, + /* 91*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 17, 16, "" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 721: Structured Append index '17' out of range (1 to count 16)", 0, 1, "" }, + /* 92*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1001" }, "1", 0, 12, 12, "", 2, 1, "" }, + /* 93*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "A" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 723: Invalid Structured Append ID (digits only)", 0, 1, "" }, + /* 94*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "0" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 724: Structured Append ID1 '000' and ID2 '000' out of range (001 to 254) (ID \"000000\")", 0, 1, "" }, + /* 95*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 725: Structured Append ID1 '000' out of range (001 to 254) (ID \"000001\")", 0, 1, "" }, + /* 96*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1000" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 726: Structured Append ID2 '000' out of range (001 to 254) (ID \"001000\")", 0, 1, "" }, + /* 97*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "001255" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 726: Structured Append ID2 '255' out of range (001 to 254) (ID \"001255\")", 0, 1, "" }, + /* 98*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "255001" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 725: Structured Append ID1 '255' out of range (001 to 254) (ID \"255001\")", 0, 1, "" }, + /* 99*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "255255" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 724: Structured Append ID1 '255' and ID2 '255' out of range (001 to 254) (ID \"255255\")", 0, 1, "" }, + /*100*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, { 2, 3, "1234567" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 722: Structured Append ID length 7 too long (6 digit maximum)", 0, 1, "" }, + /*101*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, READER_INIT, { 2, 3, "1001" }, "1", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 727: Cannot have Structured Append and Reader Initialisation at the same time", 0, 1, "" }, + /*102*/ { BARCODE_DATAMATRIX, ESCAPE_MODE, -1, -1, -1, -1, { 2, 3, "1001" }, "[)>\\R05\\GA\\R\\E", 0, 12, 26, "", 27, 1, "Macro05/06 ignored if have Structured Append TODO: error/warning " }, + /*103*/ { BARCODE_HIBC_DM, -1, -1, -1, -1, -1, { 0, 0, "" }, "1234,67", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 203: Invalid character at position 5 in input (alphanumerics, space and \"-.$/+%\" only)", 0, 1, "" }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -1305,7 +1309,7 @@ static void test_input(const testCtx *const p_ctx) { int binlen; int binlens[2] = {0}; unsigned char reduced[1000]; - unsigned char *text; + const unsigned char *text; const int last_seg = 1; const int expected_rows_width = data[i].expected_rows * data[i].expected_width; const int prev_expected_rows_width = data[i - 1].expected_rows * data[i - 1].expected_width; @@ -1315,11 +1319,12 @@ static void test_input(const testCtx *const p_ctx) { i, expected_rows_width, prev_expected_rows_width); if ((data[i].input_mode & 0x07) == GS1_MODE) { - ret = gs1_verify(symbol, (unsigned char *) data[i].data, length, reduced, &length); + int data_len = length; + ret = gs1_verify(symbol, ZUCP(data[i].data), &data_len, reduced, &length); assert_zero(ret, "i:%d gs1_verify() ret %d != 0 (%s)\n", i, ret, symbol->errtxt); text = reduced; } else { - text = (unsigned char *) data[i].data; + text = ZCUCP(data[i].data); } binlen = 0; symbol->input_mode = data[i - 1].input_mode; @@ -5912,7 +5917,7 @@ static void test_encode(const testCtx *const p_ctx) { symbol->input_mode = data[i - 1].input_mode; gs1 = (symbol->input_mode & 0x07) != GS1_MODE ? 0 : (symbol->output_options & GS1_GS_SEPARATOR) ? 2 : 1; - ret = dm_encode_test(symbol, (unsigned char *) data[i].data, length, symbol->eci, last_seg, gs1, + ret = dm_encode_test(symbol, ZCUCP(data[i].data), length, symbol->eci, last_seg, gs1, binary[0], &binlen); assert_zero(ret, "i:%d dm_encode() FAST_MODE ret %d != 0 (%s)\n", i, ret, symbol->errtxt); @@ -5922,7 +5927,7 @@ static void test_encode(const testCtx *const p_ctx) { symbol->input_mode = data[i].input_mode; gs1 = (symbol->input_mode & 0x07) != GS1_MODE ? 0 : (symbol->output_options & GS1_GS_SEPARATOR) ? 2 : 1; - ret = dm_encode_test(symbol, (unsigned char *) data[i].data, length, symbol->eci, last_seg, gs1, + ret = dm_encode_test(symbol, ZCUCP(data[i].data), length, symbol->eci, last_seg, gs1, binary[1], &binlen); assert_zero(ret, "i:%d dm_encode() minimal ret %d != 0 (%s)\n", i, ret, symbol->errtxt); @@ -7632,8 +7637,7 @@ static void test_minimalenc(const testCtx *const p_ctx) { binlen = 0; symbol->input_mode |= FAST_MODE; gs1 = (symbol->input_mode & 0x07) != GS1_MODE ? 0 : (symbol->output_options & GS1_GS_SEPARATOR) ? 2 : 1; - ret = dm_encode_test(symbol, (unsigned char *) data[i].data, length, symbol->eci, last_seg, gs1, binary[0], - &binlen); + ret = dm_encode_test(symbol, ZCUCP(data[i].data), length, symbol->eci, last_seg, gs1, binary[0], &binlen); assert_equal(ret, data[i].ret, "i:%d dm_encode() FAST_MODE ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); @@ -7642,8 +7646,7 @@ static void test_minimalenc(const testCtx *const p_ctx) { binlen = 0; symbol->input_mode &= ~FAST_MODE; gs1 = (symbol->input_mode & 0x07) != GS1_MODE ? 0 : (symbol->output_options & GS1_GS_SEPARATOR) ? 2 : 1; - ret = dm_encode_test(symbol, (unsigned char *) data[i].data, length, symbol->eci, last_seg, gs1, binary[1], - &binlen); + ret = dm_encode_test(symbol, ZCUCP(data[i].data), length, symbol->eci, last_seg, gs1, binary[1], &binlen); assert_equal(ret, data[i].ret, "i:%d dm_encode() minimal ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); diff --git a/backend/tests/test_dotcode.c b/backend/tests/test_dotcode.c index 7397677f..07f3b7e8 100644 --- a/backend/tests/test_dotcode.c +++ b/backend/tests/test_dotcode.c @@ -211,21 +211,23 @@ static void test_input(const testCtx *const p_ctx) { /* 24*/ { GS1_MODE, -1, -1, -1, { 0, 0, "" }, "[17]123456[10]123", -1, ZINT_WARN_NONCOMPLIANT, "64 0C 22 38 0C 66 13", 0, 1, "17..10 12 34 56 12 ShiftB (0x66) 3; BWIPP does not allow bad month" }, /* 25*/ { GS1_MODE, -1, -1, -1, { 0, 0, "" }, "[90]ABC[90]abc[90]123", -1, 0, "5A 6A 21 22 23 6B 19 10 41 42 43 6B 19 67 01 17 6A", 1, 1, "90 LatchB (0x6A) A B C FNC1 (0x6B) 9 0 a b c FNC1 (0x6B) 9 2xShitfC (0x67) 01 23 PAD" }, /* 26*/ { GS1_MODE | GS1PARENS_MODE, -1, -1, -1, { 0, 0, "" }, "(90)ABC(90)abc(90)123", -1, 0, "5A 6A 21 22 23 6B 19 10 41 42 43 6B 19 67 01 17 6A", 1, 1, "90 LatchB (0x6A) A B C FNC1 (0x6B) 9 0 a b c FNC1 (0x6B) 9 2xShitfC (0x67) 01 23 PAD" }, - /* 27*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "99aA[{00\000", 9, 0, "6B 63 6A 41 21 3B 5B 10 10 65 40", 1, 1, "FNC1 (0x6B) 99 LatchB (0x6A) a A [ { 0 0 ShiftA (0x65) NUL" }, - /* 28*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\015\012", -1, 0, "66 60", 0, 1, "ShiftB (0x66) CR/LF; BWIPP different encodation" }, - /* 29*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A\015\012", -1, 0, "67 21 60", 0, 1, "2xShiftB (0x67) A CR/LF; BWIPP different encodation" }, - /* 30*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\015\015\012", -1, 0, "65 4D 4D 4A", 1, 1, "LatchA (0x65) CR CR LF" }, - /* 31*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "ABCDE12345678", -1, 0, "6A 21 22 23 24 25 69 0C 22 38 4E", 1, 1, "LatchB (0x6A) A B C D 4xShiftC 12 34 56 78" }, - /* 32*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\000ABCD1234567890", 15, 0, "65 40 21 22 23 24 6A 0C 22 38 4E 5A 6A", 1, 1, "LatchA (0x65) NULL A B C D LatchC (0x6A) 12 34 56 78 90 PAD" }, - /* 33*/ { DATA_MODE, -1, -1, 2 << 8, { 0, 0, "" }, "\141\142\143\144\145\200\201\202\203\204\377", -1, 0, "6A 41 42 43 44 45 70 31 5A 35 21 5A 5F 02 31", 1, 899, "LatchB (0x6A) a b c d e BinaryLatch (0x70) 0x80 0x81 0x82 0x83 0x84 0xFF" }, - /* 34*/ { DATA_MODE, -1, -1, -1, { 0, 0, "" }, "\200\061\062\240\063\064\201\202\065\066", -1, 0, "6E 40 0C 6F 00 22 70 03 10 42 6E 15 16", 1, 899, "UpperShiftA (0x6E) NUL 12 UpperShiftB (0x6F) SP 34 BinaryLatch (0x70) 0x81 0x82 TermB (0x6E) 5 6" }, - /* 35*/ { DATA_MODE, -1, -1, -1, { 0, 0, "" }, "\200\201\202\203\061\062\063\064", -1, 0, "70 13 56 0A 59 2C 67 0C 22", 1, 899, "BinaryLatch (0x70) 0x80 0x81 0x82 0x83 Intr2xShiftC (0x67) 12 3" }, - /* 36*/ { DATA_MODE, -1, -1, -1, { 0, 0, "" }, "\001\200\201\202\203\204\200\201\202\203\204", -1, 0, "65 41 70 31 5A 35 21 5A 5F 31 5A 35 21 5A 5F", 1, 899, "LatchA (0x65) SOH BinaryLatch (0x70) 0x80 0x81 0x82 0x83 0x80 0x81 0x82 0x83" }, - /* 37*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\001abc\011\015\012\036", -1, 0, "65 41 65 41 42 43 61 60 64", 1, 1, "LatchA (0x65) SOH 6xShiftB (0x65) a b c HT CR/LF RS" }, - /* 38*/ { UNICODE_MODE, -1, -1, -1, { 35, 35, "" }, "ABCDE", -1, 0, "6A 21 22 23 24 25 3A 3A 6C", 1, 1, "LatchB (0x6A) A B C D E Z Z FNC2" }, - /* 39*/ { UNICODE_MODE, -1, -1, -1, { 9, 10, "" }, "1234567890", -1, 0, "6B 0C 22 38 4E 5A 65 19 21 6C", 1, 1, "FNC1 (0x6B) 12 34 56 78 90 LatchA (0x65) 9 A FNC2" }, - /* 40*/ { UNICODE_MODE, -1, -1, -1, { 2, 3, "" }, "\001\002\003\004", -1, 0, "65 41 42 43 44 6A 12 13 6C", 1, 1, "LatchA (0x65) PAD 2 3 FNC2" }, - /* 41*/ { DATA_MODE, -1, -1, -1, { 1, 34, "" }, "\200\201\202\203", -1, 0, "70 13 56 0A 59 2C 6D 11 39 6C", 1, 899, "BinaryLatch (0x70) (...) TermA (0x6D) 1 Y FNC2" }, + /* 27*/ { GS1_MODE, -1, -1, -1, { 0, 0, "" }, "[90]AB)", -1, 0, "5A 68 21 22 09", 1, 1, "" }, + /* 28*/ { GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, -1, -1, { 0, 0, "" }, "(90)AB\\)", -1, 0, "5A 68 21 22 09", 1, 1, "" }, + /* 29*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "99aA[{00\000", 9, 0, "6B 63 6A 41 21 3B 5B 10 10 65 40", 1, 1, "FNC1 (0x6B) 99 LatchB (0x6A) a A [ { 0 0 ShiftA (0x65) NUL" }, + /* 30*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\015\012", -1, 0, "66 60", 0, 1, "ShiftB (0x66) CR/LF; BWIPP different encodation" }, + /* 31*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "A\015\012", -1, 0, "67 21 60", 0, 1, "2xShiftB (0x67) A CR/LF; BWIPP different encodation" }, + /* 32*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\015\015\012", -1, 0, "65 4D 4D 4A", 1, 1, "LatchA (0x65) CR CR LF" }, + /* 33*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "ABCDE12345678", -1, 0, "6A 21 22 23 24 25 69 0C 22 38 4E", 1, 1, "LatchB (0x6A) A B C D 4xShiftC 12 34 56 78" }, + /* 34*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\000ABCD1234567890", 15, 0, "65 40 21 22 23 24 6A 0C 22 38 4E 5A 6A", 1, 1, "LatchA (0x65) NULL A B C D LatchC (0x6A) 12 34 56 78 90 PAD" }, + /* 35*/ { DATA_MODE, -1, -1, 2 << 8, { 0, 0, "" }, "\141\142\143\144\145\200\201\202\203\204\377", -1, 0, "6A 41 42 43 44 45 70 31 5A 35 21 5A 5F 02 31", 1, 899, "LatchB (0x6A) a b c d e BinaryLatch (0x70) 0x80 0x81 0x82 0x83 0x84 0xFF" }, + /* 36*/ { DATA_MODE, -1, -1, -1, { 0, 0, "" }, "\200\061\062\240\063\064\201\202\065\066", -1, 0, "6E 40 0C 6F 00 22 70 03 10 42 6E 15 16", 1, 899, "UpperShiftA (0x6E) NUL 12 UpperShiftB (0x6F) SP 34 BinaryLatch (0x70) 0x81 0x82 TermB (0x6E) 5 6" }, + /* 37*/ { DATA_MODE, -1, -1, -1, { 0, 0, "" }, "\200\201\202\203\061\062\063\064", -1, 0, "70 13 56 0A 59 2C 67 0C 22", 1, 899, "BinaryLatch (0x70) 0x80 0x81 0x82 0x83 Intr2xShiftC (0x67) 12 3" }, + /* 38*/ { DATA_MODE, -1, -1, -1, { 0, 0, "" }, "\001\200\201\202\203\204\200\201\202\203\204", -1, 0, "65 41 70 31 5A 35 21 5A 5F 31 5A 35 21 5A 5F", 1, 899, "LatchA (0x65) SOH BinaryLatch (0x70) 0x80 0x81 0x82 0x83 0x80 0x81 0x82 0x83" }, + /* 39*/ { UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, "\001abc\011\015\012\036", -1, 0, "65 41 65 41 42 43 61 60 64", 1, 1, "LatchA (0x65) SOH 6xShiftB (0x65) a b c HT CR/LF RS" }, + /* 40*/ { UNICODE_MODE, -1, -1, -1, { 35, 35, "" }, "ABCDE", -1, 0, "6A 21 22 23 24 25 3A 3A 6C", 1, 1, "LatchB (0x6A) A B C D E Z Z FNC2" }, + /* 41*/ { UNICODE_MODE, -1, -1, -1, { 9, 10, "" }, "1234567890", -1, 0, "6B 0C 22 38 4E 5A 65 19 21 6C", 1, 1, "FNC1 (0x6B) 12 34 56 78 90 LatchA (0x65) 9 A FNC2" }, + /* 42*/ { UNICODE_MODE, -1, -1, -1, { 2, 3, "" }, "\001\002\003\004", -1, 0, "65 41 42 43 44 6A 12 13 6C", 1, 1, "LatchA (0x65) PAD 2 3 FNC2" }, + /* 43*/ { DATA_MODE, -1, -1, -1, { 1, 34, "" }, "\200\201\202\203", -1, 0, "70 13 56 0A 59 2C 6D 11 39 6C", 1, 899, "BinaryLatch (0x70) (...) TermA (0x6D) 1 Y FNC2" }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_gs1.c b/backend/tests/test_gs1.c index feb82e8e..c8ae4704 100644 --- a/backend/tests/test_gs1.c +++ b/backend/tests/test_gs1.c @@ -49,7 +49,7 @@ static void test_gs1_reduce(const testCtx *const p_ctx) { }; static const struct item data[] = { /* 0*/ { BARCODE_GS1_128, -1, "12345678901234", "", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" }, - /* 1*/ { BARCODE_GS1_128, -1, "[01]12345678901231", "", 0, "Input mode ignored; verified manually against tec-it", + /* 1*/ { BARCODE_GS1_128, -1, "[01]12345678901231", "", 0, "Input mode ignored; verified manually against TEC-IT", "11010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110100001100101100011101011" }, /* 2*/ { BARCODE_GS1_128, GS1_MODE, "[01]12345678901231", "", 0, "Input mode ignored", @@ -61,134 +61,202 @@ static void test_gs1_reduce(const testCtx *const p_ctx) { /* 4*/ { BARCODE_GS1_128, GS1PARENS_MODE, "(01)12345678901231", "", 0, "Input mode ignored (parentheses instead of square brackets)", "11010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110100001100101100011101011" }, - /* 5*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[21]1234", 0, "Input mode ignored", + /* 5*/ { BARCODE_GS1_128, GS1_MODE, "[01]12345678901231[21]()", "", 0, "Parentheses in AI data", + "1101001110011110101110110011011001011001110010001011000111000101101100001010011011110110101100111001101100011011011100100101111011101000110010011001001000110111000101100011101011" + }, + /* 6*/ { BARCODE_GS1_128, ESCAPE_MODE | GS1PARENS_MODE, "(01)12345678901231(21)\\(\\)", "", 0, "Parentheses in AI data", + "1101001110011110101110110011011001011001110010001011000111000101101100001010011011110110101100111001101100011011011100100101111011101000110010011001001000110111000101100011101011" + }, + /* 7*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[21]1234", 0, "Input mode ignored", "0000000000000000000001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010000000000000000000000000" "0000000000000000000001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010000000000000000000000000" "0000000000000000000001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010000000000000000000000000" "0010110001100001010001001100100110100110001101110100111000111010010011110101100100001001010011000110010011100100010100001000101001110011100010100" "1101001110011110101110110011011001011001110010001011000111000101101100001010011011110110101100111001101100011011101011110111010110001100011101011" }, - /* 6*/ { BARCODE_GS1_128_CC, GS1_MODE, "[01]12345678901231", "[21]1234", 0, "Input mode ignored", + /* 8*/ { BARCODE_GS1_128_CC, GS1_MODE, "[01]12345678901231", "[21]1234", 0, "Input mode ignored", "0000000000000000000001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010000000000000000000000000" "0000000000000000000001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010000000000000000000000000" "0000000000000000000001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010000000000000000000000000" "0010110001100001010001001100100110100110001101110100111000111010010011110101100100001001010011000110010011100100010100001000101001110011100010100" "1101001110011110101110110011011001011001110010001011000111000101101100001010011011110110101100111001101100011011101011110111010110001100011101011" }, - /* 7*/ { BARCODE_GS1_128_CC, UNICODE_MODE, "[01]12345678901231", "[21]1234", 0, "Input mode ignored", + /* 9*/ { BARCODE_GS1_128_CC, UNICODE_MODE, "[01]12345678901231", "[21]1234", 0, "Input mode ignored", "0000000000000000000001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010000000000000000000000000" "0000000000000000000001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010000000000000000000000000" "0000000000000000000001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010000000000000000000000000" "0010110001100001010001001100100110100110001101110100111000111010010011110101100100001001010011000110010011100100010100001000101001110011100010100" "1101001110011110101110110011011001011001110010001011000111000101101100001010011011110110101100111001101100011011101011110111010110001100011101011" }, - /* 8*/ { BARCODE_GS1_128_CC, GS1PARENS_MODE, "(01)12345678901231", "(21)1234", 0, "Input mode ignored (parentheses instead of square brackets)", + /*10*/ { BARCODE_GS1_128_CC, GS1PARENS_MODE, "(01)12345678901231", "(21)1234", 0, "Input mode ignored (parentheses instead of square brackets)", "0000000000000000000001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010000000000000000000000000" "0000000000000000000001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010000000000000000000000000" "0000000000000000000001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010000000000000000000000000" "0010110001100001010001001100100110100110001101110100111000111010010011110101100100001001010011000110010011100100010100001000101001110011100010100" "1101001110011110101110110011011001011001110010001011000111000101101100001010011011110110101100111001101100011011101011110111010110001100011101011" }, - /* 9*/ { BARCODE_EAN14, -1, "1234567890123", "", 0, "Input mode ignored; verified manually against tec-it", + /*11*/ { BARCODE_GS1_128_CC, GS1_MODE, "[01]12345678901231[10])", "[21](", 0, "Parentheses in AI data", + "0000000000000000000000000000000000000000000110110111010100001000001000110000110001010001001110100111010100011100001110001100101100011011000101000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000110110110011100000101110110110000010011100101001100100100011110010111101101011100010000011001000101000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000110110100010001000100011110111100101111001001001100110111111010011010001111100100011101011101000101000000000000000000000000000000000000" + "0010110001100001010001001100100110100110001101110100111000111010010011110101100100001001010011000110010011100100110111011010000100010011011011101000100001011101000010011100010100" + "1101001110011110101110110011011001011001110010001011000111000101101100001010011011110110101100111001101100011011001000100101111011101100100100010111011110100010111101100011101011" + }, + /*12*/ { BARCODE_GS1_128_CC, ESCAPE_MODE | GS1PARENS_MODE, "(01)12345678901231(10)\\)", "(21)\\(", 0, "Parentheses in AI data", + "0000000000000000000000000000000000000000000110110111010100001000001000110000110001010001001110100111010100011100001110001100101100011011000101000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000110110110011100000101110110110000010011100101001100100100011110010111101101011100010000011001000101000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000110110100010001000100011110111100101111001001001100110111111010011010001111100100011101011101000101000000000000000000000000000000000000" + "0010110001100001010001001100100110100110001101110100111000111010010011110101100100001001010011000110010011100100110111011010000100010011011011101000100001011101000010011100010100" + "1101001110011110101110110011011001011001110010001011000111000101101100001010011011110110101100111001101100011011001000100101111011101100100100010111011110100010111101100011101011" + }, + /*13*/ { BARCODE_EAN14, -1, "1234567890123", "", 0, "Input mode ignored; verified manually against TEC-IT", "11010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110100001100101100011101011" }, - /*10*/ { BARCODE_EAN14, GS1_MODE, "1234567890123", "", 0, "Input mode ignored", + /*14*/ { BARCODE_EAN14, GS1_MODE, "1234567890123", "", 0, "Input mode ignored", "11010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110100001100101100011101011" }, - /*11*/ { BARCODE_EAN14, UNICODE_MODE, "1234567890123", "", 0, "Input mode ignored", + /*15*/ { BARCODE_EAN14, UNICODE_MODE, "1234567890123", "", 0, "Input mode ignored", "11010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110100001100101100011101011" }, - /*12*/ { BARCODE_EAN14, GS1PARENS_MODE, "1234567890123", "", 0, "Input mode ignored (parentheses instead of square brackets)", + /*16*/ { BARCODE_EAN14, GS1PARENS_MODE, "1234567890123", "", 0, "Input mode ignored (parentheses instead of square brackets)", "11010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110100001100101100011101011" }, - /*13*/ { BARCODE_NVE18, -1, "12345678901234567", "", 0, "Input mode ignored; verified manually against tec-it", + /*17*/ { BARCODE_NVE18, -1, "12345678901234567", "", 0, "Input mode ignored; verified manually against TEC-IT", "110100111001111010111011011001100101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010010101101110001100011101011" }, - /*14*/ { BARCODE_NVE18, GS1_MODE, "12345678901234567", "", 0, "Input mode ignored", + /*18*/ { BARCODE_NVE18, GS1_MODE, "12345678901234567", "", 0, "Input mode ignored", "110100111001111010111011011001100101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010010101101110001100011101011" }, - /*15*/ { BARCODE_NVE18, UNICODE_MODE, "12345678901234567", "", 0, "Input mode ignored", + /*19*/ { BARCODE_NVE18, UNICODE_MODE, "12345678901234567", "", 0, "Input mode ignored", "110100111001111010111011011001100101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010010101101110001100011101011" }, - /*16*/ { BARCODE_NVE18, GS1PARENS_MODE, "12345678901234567", "", 0, "Input mode ignored (parentheses instead of square brackets)", + /*20*/ { BARCODE_NVE18, GS1PARENS_MODE, "12345678901234567", "", 0, "Input mode ignored (parentheses instead of square brackets)", "110100111001111010111011011001100101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010010101101110001100011101011" }, - /*17*/ { BARCODE_DBAR_EXP, -1, "2012", "", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" }, - /*18*/ { BARCODE_DBAR_EXP, -1, "[20]12", "", 0, "Input mode ignored", + /*21*/ { BARCODE_DBAR_EXP, -1, "2012", "", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" }, + /*22*/ { BARCODE_DBAR_EXP, -1, "[20]12", "", 0, "Input mode ignored", "010010000010000101101111111100001010000010000110010101111100101110001011110000000010101111100001011101" }, - /*19*/ { BARCODE_DBAR_EXP, GS1PARENS_MODE, "(20)12", "", 0, "Input mode ignored (parentheses instead of square brackets)", + /*23*/ { BARCODE_DBAR_EXP, GS1PARENS_MODE, "(20)12", "", 0, "Input mode ignored (parentheses instead of square brackets)", "010010000010000101101111111100001010000010000110010101111100101110001011110000000010101111100001011101" }, - /*20*/ { BARCODE_DBAR_EXP, GS1_MODE, "[20]12", "", 0, "Input mode ignored", + /*24*/ { BARCODE_DBAR_EXP, GS1_MODE, "[20]12", "", 0, "Input mode ignored", "010010000010000101101111111100001010000010000110010101111100101110001011110000000010101111100001011101" }, - /*21*/ { BARCODE_DBAR_EXP, GS1_MODE | GS1PARENS_MODE, "(20)12", "", 0, "Input mode ignored (parentheses instead of square brackets)", + /*25*/ { BARCODE_DBAR_EXP, GS1_MODE | GS1PARENS_MODE, "(20)12", "", 0, "Input mode ignored (parentheses instead of square brackets)", "010010000010000101101111111100001010000010000110010101111100101110001011110000000010101111100001011101" }, - /*22*/ { BARCODE_DBAR_EXP, UNICODE_MODE, "[20]12", "", 0, "Input mode ignored", + /*26*/ { BARCODE_DBAR_EXP, UNICODE_MODE, "[20]12", "", 0, "Input mode ignored", "010010000010000101101111111100001010000010000110010101111100101110001011110000000010101111100001011101" }, - /*23*/ { BARCODE_DBAR_EXP_CC, -1, "[20]12", "[21]1234", 0, "Input mode ignored; verified manually against tec-it", + /*27*/ { BARCODE_DBAR_EXP, -1, "[21])", "", 0, "Parentheses in AI data", + "010010000001010001101111111100001010000010000100110100110111111011101011110000000010000011011001110101" + }, + /*28*/ { BARCODE_DBAR_EXP, ESCAPE_MODE | GS1PARENS_MODE, "(21)\\)", "", 0, "Parentheses in AI data", + "010010000001010001101111111100001010000010000100110100110111111011101011110000000010000011011001110101" + }, + /*29*/ { BARCODE_DBAR_EXP_CC, -1, "[20]12", "[21]1234", 0, "Input mode ignored; verified manually against TEC-IT", "001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010" "001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010" "001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010" "000001111111010110010000000010100100111001100001011010000011010001110100001010101001010000011110100000" "010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101" }, - /*24*/ { BARCODE_DBAR_EXP_CC, GS1_MODE, "[20]12", "[21]1234", 0, "Input mode ignored", + /*30*/ { BARCODE_DBAR_EXP_CC, GS1_MODE, "[20]12", "[21]1234", 0, "Input mode ignored", "001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010" "001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010" "001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010" "000001111111010110010000000010100100111001100001011010000011010001110100001010101001010000011110100000" "010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101" }, - /*25*/ { BARCODE_DBAR_EXP_CC, UNICODE_MODE, "[20]12", "[21]1234", 0, "Input mode ignored", + /*31*/ { BARCODE_DBAR_EXP_CC, UNICODE_MODE, "[20]12", "[21]1234", 0, "Input mode ignored", "001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010" "001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010" "001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010" "000001111111010110010000000010100100111001100001011010000011010001110100001010101001010000011110100000" "010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101" }, - /*26*/ { BARCODE_DBAR_EXPSTK, -1, "12", "", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" }, - /*27*/ { BARCODE_DBAR_EXPSTK, -1, "[20]12", "", 0, "Input mode ignored", + /*32*/ { BARCODE_DBAR_EXP_CC, -1, "[10]()", "[21]()", 0, "Parentheses in AI data", + "00110110111010100001000001000110000110001010001001110100111010111001111101100111011001000011011000101000000000000000000000000000000000" + "00110110110010001000111110110111101100001101001001100100111110111101110101111101000110111011001000101000000000000000000000000000000000" + "00110110100010111110110100000100001111011011001001100110100111001100111001000001001001111011101000101000000000000000000000000000000000" + "00000010011111011101000000001010010101110011000001101100100000010001010000101010000100011011110001101110111101111010010100000010100000" + "01011101100000100010111111110000101010001100111110010011011111101110101111000000111011100100001110010001000010000101100011111100001010" + }, + /*33*/ { BARCODE_DBAR_EXP_CC, ESCAPE_MODE | GS1PARENS_MODE, "(10)\\(\\)", "(21)\\(\\)", 0, "Parentheses in AI data", + "00110110111010100001000001000110000110001010001001110100111010111001111101100111011001000011011000101000000000000000000000000000000000" + "00110110110010001000111110110111101100001101001001100100111110111101110101111101000110111011001000101000000000000000000000000000000000" + "00110110100010111110110100000100001111011011001001100110100111001100111001000001001001111011101000101000000000000000000000000000000000" + "00000010011111011101000000001010010101110011000001101100100000010001010000101010000100011011110001101110111101111010010100000010100000" + "01011101100000100010111111110000101010001100111110010011011111101110101111000000111011100100001110010001000010000101100011111100001010" + }, + /*34*/ { BARCODE_DBAR_EXPSTK, -1, "12", "", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" }, + /*35*/ { BARCODE_DBAR_EXPSTK, -1, "[20]12", "", 0, "Input mode ignored", "010010000010000101101111111100001010000010000110010101111100101110001011110000000010101111100001011101" }, - /*28*/ { BARCODE_DBAR_EXPSTK, GS1_MODE, "[20]12", "", 0, "Input mode ignored", + /*36*/ { BARCODE_DBAR_EXPSTK, GS1_MODE, "[20]12", "", 0, "Input mode ignored", "010010000010000101101111111100001010000010000110010101111100101110001011110000000010101111100001011101" }, - /*29*/ { BARCODE_DBAR_EXPSTK, UNICODE_MODE, "[20]12", "", 0, "Input mode ignored", + /*37*/ { BARCODE_DBAR_EXPSTK, UNICODE_MODE, "[20]12", "", 0, "Input mode ignored", "010010000010000101101111111100001010000010000110010101111100101110001011110000000010101111100001011101" }, - /*30*/ { BARCODE_DBAR_EXPSTK_CC, -1, "12", "[21]1234", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" }, - /*31*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[20]12", "[21]1234", 0, "Input mode ignored; verified manually against tec-it (same as BARCODE_DBAR_EXP_CC above)", + /*38*/ { BARCODE_DBAR_EXPSTK, -1, "[21](21)", "", 0, "Parentheses in AI data", + "010100111100010000101111111100001010000010000100110100110111111011101011110000001110011001110110000101" + "000011000011101111010000000010100101111101111011001011001000000100010100001010100001100110001001110000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000000001110010001001010000001010010101111100001010000000000000000000000000000000000000000000000000000" + "001011110001101110110001111110000101010000011110100010000000000000000000000000000000000000000000000000" + }, + /*39*/ { BARCODE_DBAR_EXPSTK, ESCAPE_MODE | GS1PARENS_MODE, "(21)\\(21\\)", "", 0, "Parentheses in AI data", + "010100111100010000101111111100001010000010000100110100110111111011101011110000001110011001110110000101" + "000011000011101111010000000010100101111101111011001011001000000100010100001010100001100110001001110000" + "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" + "000000001110010001001010000001010010101111100001010000000000000000000000000000000000000000000000000000" + "001011110001101110110001111110000101010000011110100010000000000000000000000000000000000000000000000000" + }, + /*40*/ { BARCODE_DBAR_EXPSTK_CC, -1, "12", "[21]1234", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" }, + /*41*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[20]12", "[21]1234", 0, "Input mode ignored; verified manually against TEC-IT (same as BARCODE_DBAR_EXP_CC above)", "001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010" "001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010" "001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010" "000001111111010110010000000010100100111001100001011010000011010001110100001010101001010000011110100000" "010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101" }, - /*32*/ { BARCODE_DBAR_EXPSTK_CC, GS1PARENS_MODE, "(20)12", "(21)1234", 0, "Input mode ignored (parentheses instead of square brackets)", + /*42*/ { BARCODE_DBAR_EXPSTK_CC, GS1PARENS_MODE, "(20)12", "(21)1234", 0, "Input mode ignored (parentheses instead of square brackets)", "001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010" "001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010" "001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010" "000001111111010110010000000010100100111001100001011010000011010001110100001010101001010000011110100000" "010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101" }, - /*33*/ { BARCODE_DBAR_EXPSTK_CC, GS1_MODE, "[20]12", "[21]1234", 0, "Input mode ignored", + /*43*/ { BARCODE_DBAR_EXPSTK_CC, GS1_MODE, "[20]12", "[21]1234", 0, "Input mode ignored", "001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010" "001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010" "001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010" "000001111111010110010000000010100100111001100001011010000011010001110100001010101001010000011110100000" "010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101" }, - /*34*/ { BARCODE_DBAR_EXPSTK_CC, UNICODE_MODE, "[20]12", "[21]1234", 0, "Input mode ignored", + /*44*/ { BARCODE_DBAR_EXPSTK_CC, UNICODE_MODE, "[20]12", "[21]1234", 0, "Input mode ignored", "001101101110110100001000001101001100111011000010011101001100001010001100010010011011000000110110001010" "001101101100111110100010011001101011100100000010011001001001111001011110011101011001000000110010001010" "001101101000101111100110000101001111010000001010011001101011101110011110010011110110000110111010001010" "000001111111010110010000000010100100111001100001011010000011010001110100001010101001010000011110100000" "010010000000101001101111111100001011000110011110100101111100101110001011110000000010101111100001011101" }, + /*45*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[10]1)", "[21]12)(", 0, "Parentheses in AI data", + "001101101110110100001000001101110111011100111010011101001000010010000001010010001000010000110110001010" + "001101101100111101000010001001110000110111010010011001001101100011110001011010111000100000110010001010" + "001101101000111001111101011001011100100000011010011001101001111001000001010000011110010100111010001010" + "000011111001011111010000000010100100111000001101011010001001100000010100001010101001110100110000010000" + "010100000110100000101111111100001011000111110010100101110110011111101011110000000010001011001111101101" + }, + /*46*/ { BARCODE_DBAR_EXPSTK_CC, ESCAPE_MODE | GS1PARENS_MODE, "(10)1\\)", "(21)12\\)\\(", 0, "Parentheses in AI data", + "001101101110110100001000001101110111011100111010011101001000010010000001010010001000010000110110001010" + "001101101100111101000010001001110000110111010010011001001101100011110001011010111000100000110010001010" + "001101101000111001111101011001011100100000011010011001101001111001000001010000011110010100111010001010" + "000011111001011111010000000010100100111000001101011010001001100000010100001010101001110100110000010000" + "010100000110100000101111111100001011000111110010100101110110011111101011110000000010001011001111101101" + }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -196,6 +264,8 @@ static void test_gs1_reduce(const testCtx *const p_ctx) { const char *text; + char escaped[1024]; + char escaped2[1024]; char bwipp_buf[8196]; char bwipp_msg[1024]; @@ -224,16 +294,22 @@ static void test_gs1_reduce(const testCtx *const p_ctx) { ret = ZBarcode_Encode(symbol, TCU(text), length); if (p_ctx->generate) { + const int data_len = (int) strlen(data[i].data); + const int composite_len = (int) strlen(data[i].composite); if (data[i].ret == 0) { printf(" /*%2d*/ { %s, %s, \"%s\", \"%s\", %d, \"%s\",\n", i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), - data[i].data, data[i].composite, data[i].ret, data[i].comment); + testUtilEscape(data[i].data, data_len, escaped, sizeof(escaped)), + testUtilEscape(data[i].composite, composite_len, escaped2, sizeof(escaped2)), + data[i].ret, data[i].comment); testUtilModulesPrint(symbol, " ", "\n"); printf(" },\n"); } else { printf(" /*%2d*/ { %s, %s, \"%s\", \"%s\", %s, \"%s\", \"\" },\n", i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), - data[i].data, data[i].composite, testUtilErrorName(data[i].ret), data[i].comment); + testUtilEscape(data[i].data, data_len, escaped, sizeof(escaped)), + testUtilEscape(data[i].composite, composite_len, escaped2, sizeof(escaped2)), + testUtilErrorName(data[i].ret), data[i].comment); } } else { assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", @@ -317,63 +393,79 @@ static void test_hrt(const testCtx *const p_ctx) { /* 29*/ { BARCODE_GS1_128, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "(91)ABCDE[92]GH", "", 0, "(91)ABCDE[92]GH", "" }, /* 30*/ { BARCODE_GS1_128, GS1PARENS_MODE, BARCODE_RAW_TEXT, "(91)ABCDE[92]GH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDE[92]GH", "91ABCDE[92]GH" }, /* 31*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12", "" }, /* Incorrect check digit */ - /* 32*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "[21]12345", 0, "(01)12345678901234(20)12", "" }, - /* 33*/ { BARCODE_GS1_128_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12", "01123456789012342012|2112345" }, - /* 34*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[20]12", "[21]12345", 0, "(01)12345678901231(20)12", "" }, - /* 35*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[10]12[20]AB", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB", "" }, /* AI (20) should be 2 nos. */ - /* 36*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, -1, "[01]12345678901231[10]12[20]AB", "[21]12345", 0, "(01)12345678901231(10)12(20)AB", "" }, - /* 37*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[10]AB[20]12", "[21]12345", 0, "(01)12345678901231(10)AB(20)12", "" }, - /* 38*/ { BARCODE_GS1_128_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12", "[21]12345", 0, "(01)12345678901231(10)AB(20)12", "011234567890123110AB\0352012|2112345" }, - /* 39*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[10]AB[20]12", "[30]1234567A", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)AB(20)12", "" }, - /* 40*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, -1, "[01]12345678901231[10]AB[20]12", "[30]1234567A", 0, "(01)12345678901231(10)AB(20)12", "" }, - /* 41*/ { BARCODE_EAN14, -1, -1, "1234567890123", "", 0, "(01)12345678901231", "" }, - /* 42*/ { BARCODE_EAN14, -1, BARCODE_RAW_TEXT, "1234567890123", "", 0, "(01)12345678901231", "0112345678901231" }, - /* 43*/ { BARCODE_EAN14, -1, -1, "1234", "", 0, "(01)00000000012348", "" }, - /* 44*/ { BARCODE_EAN14, -1, BARCODE_RAW_TEXT, "1234", "", 0, "(01)00000000012348", "0100000000012348" }, - /* 45*/ { BARCODE_EAN14, -1, -1, "12345", "", 0, "(01)00000000123457", "" }, - /* 46*/ { BARCODE_EAN14, -1, -1, "12340", "", 0, "(01)00000000123402", "" }, - /* 47*/ { BARCODE_NVE18, -1, -1, "12345678901234567", "", 0, "(00)123456789012345675", "" }, - /* 48*/ { BARCODE_NVE18, -1, BARCODE_RAW_TEXT, "12345678901234567", "", 0, "(00)123456789012345675", "00123456789012345675" }, - /* 49*/ { BARCODE_NVE18, -1, -1, "1234", "", 0, "(00)000000000000012348", "" }, - /* 50*/ { BARCODE_NVE18, -1, BARCODE_RAW_TEXT, "1234", "", 0, "(00)000000000000012348", "00000000000000012348" }, - /* 51*/ { BARCODE_NVE18, -1, -1, "12345", "", 0, "(00)000000000000123457", "" }, - /* 52*/ { BARCODE_NVE18, -1, -1, "12340", "", 0, "(00)000000000000123402", "" }, - /* 53*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12", "" }, /* Incorrect check digit */ - /* 54*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "", 0, "(01)12345678901234(20)12", "" }, - /* 55*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12", "01123456789012342012" }, - /* 56*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[20]12", "", 0, "(01)12345678901231(20)12", "" }, - /* 57*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[20]12", "", 0, "(01)12345678901231(20)12", "01123456789012312012" }, - /* 58*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]12[20]AB", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB", "" }, /* AI (20) should be 2 nos. */ - /* 59*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]12345678901231[10]12[20]AB", "", 0, "(01)12345678901231(10)12(20)AB", "" }, - /* 60*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]12[20]AB", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB", "01123456789012311012\03520AB" }, - /* 61*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12", "", 0, "(01)12345678901231(10)AB(20)12", "" }, - /* 62*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12", "", 0, "(01)12345678901231(10)AB(20)12", "011234567890123110AB\0352012" }, - /* 63*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC(2012", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(2012", "" }, - /* 64*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC(2012", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(2012", "011234567890123110AB\035201290ABC(2012" }, - /* 65*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC20)12", "" }, - /* 66*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC20)12", "011234567890123110AB\035201290ABC20)12" }, - /* 67*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC(20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12", "" }, - /* 68*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC(20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12", "011234567890123110AB\035201290ABC(20)12" }, - /* 69*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC(20)12[91]12(", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12(91)12(" , ""}, - /* 70*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC(20)12[91]12(", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12(91)12(" , "011234567890123110AB\035201290ABC(20)12\0359112(" }, - /* 71*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901234", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234", "" }, - /* 72*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, -1, "[01]12345678901234", "[21]12345", 0, "(01)12345678901234", "" }, - /* 73*/ { BARCODE_DBAR_EXP_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901234", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234", "0112345678901234|2112345" }, - /* 74*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231", "[21]12345", 0, "(01)12345678901231", "" }, - /* 75*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231[20]12[21]12345", "[21]12345", 0, "(01)12345678901231(20)12(21)12345", "" }, - /* 76*/ { BARCODE_DBAR_EXP_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[20]12[21]12345", "[21]12345", 0, "(01)12345678901231(20)12(21)12345", "011234567890123120122112345|2112345" }, - /* 77*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "", "" }, - /* 78*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "", 0, "", "" }, - /* 79*/ { BARCODE_DBAR_EXPSTK, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "", "01123456789012342012" }, - /* 80*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901231[20]12", "", 0, "", "" }, - /* 81*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "", "" }, - /* 82*/ { BARCODE_DBAR_EXPSTK, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "", "011234567890123110AB\035201290ABC20)12" }, - /* 83*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "" , ""}, - /* 84*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "[21]12345", 0, "", "" }, - /* 85*/ { BARCODE_DBAR_EXPSTK_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "", "01123456789012342012|2112345" }, - /* 86*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231[20]12", "[21]12345", 0, "", "" }, - /* 87*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "[21]12345", 0, "", "" }, - /* 88*/ { BARCODE_DBAR_EXPSTK_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "[21]12345", 0, "", "011234567890123110AB\035201290ABC20)12|2112345" }, + /* 32*/ { BARCODE_GS1_128, -1, -1, "[91]ABCDEF)GH", "", 0, "(91)ABCDEF)GH", "" }, + /* 33*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[91]ABCDEF)GH", "", 0, "(91)ABCDEF)GH", "91ABCDEF)GH" }, + /* 34*/ { BARCODE_GS1_128, ESCAPE_MODE | GS1PARENS_MODE, -1, "(91)ABCDEF\\)GH", "", 0, "(91)ABCDEF)GH", "" }, + /* 35*/ { BARCODE_GS1_128, ESCAPE_MODE | GS1PARENS_MODE, BARCODE_RAW_TEXT, "(91)ABCDEF\\)GH", "", 0, "(91)ABCDEF)GH", "91ABCDEF)GH" }, + /* 36*/ { BARCODE_GS1_128, -1, -1, "[91]ABCDEF(GH", "", 0, "(91)ABCDEF(GH", "" }, + /* 37*/ { BARCODE_GS1_128, -1, BARCODE_RAW_TEXT, "[91]ABCDEF(GH", "", 0, "(91)ABCDEF(GH", "91ABCDEF(GH" }, + /* 38*/ { BARCODE_GS1_128, ESCAPE_MODE | GS1PARENS_MODE, -1, "(91)ABCDEF\\(GH", "", 0, "(91)ABCDEF(GH", "" }, + /* 39*/ { BARCODE_GS1_128, ESCAPE_MODE | GS1PARENS_MODE, BARCODE_RAW_TEXT, "(91)ABCDEF\\(GH", "", 0, "(91)ABCDEF(GH", "91ABCDEF(GH" }, + /* 40*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "[21]12345", 0, "(01)12345678901234(20)12", "" }, + /* 41*/ { BARCODE_GS1_128_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12", "01123456789012342012|2112345" }, + /* 42*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[20]12", "[21]12345", 0, "(01)12345678901231(20)12", "" }, + /* 43*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[10]12[20]AB", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB", "" }, /* AI (20) should be 2 nos. */ + /* 44*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, -1, "[01]12345678901231[10]12[20]AB", "[21]12345", 0, "(01)12345678901231(10)12(20)AB", "" }, + /* 45*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[10]AB[20]12", "[21]12345", 0, "(01)12345678901231(10)AB(20)12", "" }, + /* 46*/ { BARCODE_GS1_128_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12", "[21]12345", 0, "(01)12345678901231(10)AB(20)12", "011234567890123110AB\0352012|2112345" }, + /* 47*/ { BARCODE_GS1_128_CC, -1, -1, "[01]12345678901231[10]AB[20]12", "[30]1234567A", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)AB(20)12", "" }, + /* 48*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, -1, "[01]12345678901231[10]AB[20]12", "[30]1234567A", 0, "(01)12345678901231(10)AB(20)12", "" }, + /* 49*/ { BARCODE_EAN14, -1, -1, "1234567890123", "", 0, "(01)12345678901231", "" }, + /* 50*/ { BARCODE_EAN14, -1, BARCODE_RAW_TEXT, "1234567890123", "", 0, "(01)12345678901231", "0112345678901231" }, + /* 51*/ { BARCODE_EAN14, -1, -1, "1234", "", 0, "(01)00000000012348", "" }, + /* 52*/ { BARCODE_EAN14, -1, BARCODE_RAW_TEXT, "1234", "", 0, "(01)00000000012348", "0100000000012348" }, + /* 53*/ { BARCODE_EAN14, -1, -1, "12345", "", 0, "(01)00000000123457", "" }, + /* 54*/ { BARCODE_EAN14, -1, -1, "12340", "", 0, "(01)00000000123402", "" }, + /* 55*/ { BARCODE_NVE18, -1, -1, "12345678901234567", "", 0, "(00)123456789012345675", "" }, + /* 56*/ { BARCODE_NVE18, -1, BARCODE_RAW_TEXT, "12345678901234567", "", 0, "(00)123456789012345675", "00123456789012345675" }, + /* 57*/ { BARCODE_NVE18, -1, -1, "1234", "", 0, "(00)000000000000012348", "" }, + /* 58*/ { BARCODE_NVE18, -1, BARCODE_RAW_TEXT, "1234", "", 0, "(00)000000000000012348", "00000000000000012348" }, + /* 59*/ { BARCODE_NVE18, -1, -1, "12345", "", 0, "(00)000000000000123457", "" }, + /* 60*/ { BARCODE_NVE18, -1, -1, "12340", "", 0, "(00)000000000000123402", "" }, + /* 61*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12", "" }, /* Incorrect check digit */ + /* 62*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "", 0, "(01)12345678901234(20)12", "" }, + /* 63*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12", "01123456789012342012" }, + /* 64*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[20]12", "", 0, "(01)12345678901231(20)12", "" }, + /* 65*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[20]12", "", 0, "(01)12345678901231(20)12", "01123456789012312012" }, + /* 66*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]12[20]AB", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB", "" }, /* AI (20) should be 2 nos. */ + /* 67*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, "[01]12345678901231[10]12[20]AB", "", 0, "(01)12345678901231(10)12(20)AB", "" }, + /* 68*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]12[20]AB", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB", "01123456789012311012\03520AB" }, + /* 69*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12", "", 0, "(01)12345678901231(10)AB(20)12", "" }, + /* 70*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12", "", 0, "(01)12345678901231(10)AB(20)12", "011234567890123110AB\0352012" }, + /* 71*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC(2012", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(2012", "" }, + /* 72*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC(2012", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(2012", "011234567890123110AB\035201290ABC(2012" }, + /* 73*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC20)12", "" }, + /* 74*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC20)12", "011234567890123110AB\035201290ABC20)12" }, + /* 75*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC(20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12", "" }, + /* 76*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC(20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12", "011234567890123110AB\035201290ABC(20)12" }, + /* 77*/ { BARCODE_DBAR_EXP, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC(20)12[91]12(", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12(91)12(" , ""}, + /* 78*/ { BARCODE_DBAR_EXP, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC(20)12[91]12(", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12(91)12(" , "011234567890123110AB\035201290ABC(20)12\0359112(" }, + /* 79*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901234", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234", "" }, + /* 80*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, -1, "[01]12345678901234", "[21]12345", 0, "(01)12345678901234", "" }, + /* 81*/ { BARCODE_DBAR_EXP_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901234", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234", "0112345678901234|2112345" }, + /* 82*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231", "[21]12345", 0, "(01)12345678901231", "" }, + /* 83*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231[20]12[21]12345", "[21]12345", 0, "(01)12345678901231(20)12(21)12345", "" }, + /* 84*/ { BARCODE_DBAR_EXP_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[20]12[21]12345", "[21]12345", 0, "(01)12345678901231(20)12(21)12345", "011234567890123120122112345|2112345" }, + /* 85*/ { BARCODE_DBAR_EXP_CC, -1, -1, "[01]12345678901231[10](", "[21]123()", 0, "(01)12345678901231(10)(", "" }, + /* 86*/ { BARCODE_DBAR_EXP_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10](", "[21]123()", 0, "(01)12345678901231(10)(", "011234567890123110(|21123()" }, + /* 87*/ { BARCODE_DBAR_EXP_CC, ESCAPE_MODE | GS1PARENS_MODE, -1, "(01)12345678901231(10)\\(", "(21)123\\(\\)", 0, "(01)12345678901231(10)(", "" }, + /* 88*/ { BARCODE_DBAR_EXP_CC, ESCAPE_MODE | GS1PARENS_MODE, BARCODE_RAW_TEXT, "(01)12345678901231(10)\\(", "(21)123\\(\\)", 0, "(01)12345678901231(10)(", "011234567890123110(|21123()" }, + /* 89*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "", "" }, + /* 90*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "", 0, "", "" }, + /* 91*/ { BARCODE_DBAR_EXPSTK, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "", "01123456789012342012" }, + /* 92*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901231[20]12", "", 0, "", "" }, + /* 93*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "", "" }, + /* 94*/ { BARCODE_DBAR_EXPSTK, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "", "011234567890123110AB\035201290ABC20)12" }, + /* 95*/ { BARCODE_DBAR_EXPSTK, ESCAPE_MODE | GS1PARENS_MODE, -1, "(01)12345678901231(10)AB(20)12(90)ABC20\\)12", "", 0, "", "" }, + /* 96*/ { BARCODE_DBAR_EXPSTK, ESCAPE_MODE | GS1PARENS_MODE, BARCODE_RAW_TEXT, "(01)12345678901231(10)AB(20)12(90)ABC20\\)12", "", 0, "", "011234567890123110AB\035201290ABC20)12" }, + /* 97*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "" , ""}, + /* 98*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "[21]12345", 0, "", "" }, + /* 99*/ { BARCODE_DBAR_EXPSTK_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "", "01123456789012342012|2112345" }, + /*100*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231[20]12", "[21]12345", 0, "", "" }, + /*101*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "[21]12345", 0, "", "" }, + /*102*/ { BARCODE_DBAR_EXPSTK_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "[21]12345", 0, "", "011234567890123110AB\035201290ABC20)12|2112345" }, + /*103*/ { BARCODE_DBAR_EXPSTK_CC, ESCAPE_MODE | GS1PARENS_MODE, -1, "(01)12345678901231(10)AB(20)12(90)ABC20\\)12", "(21)12345", 0, "", "" }, + /*104*/ { BARCODE_DBAR_EXPSTK_CC, ESCAPE_MODE | GS1PARENS_MODE, BARCODE_RAW_TEXT, "(01)12345678901231(10)AB(20)12(90)ABC20\\)12", "(21)12345", 0, "", "011234567890123110AB\035201290ABC20)12|2112345" }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -1492,7 +1584,7 @@ static void test_gs1_verify(const testCtx *const p_ctx) { length = (int) strlen(data[i].data); - ret = gs1_verify(symbol, (unsigned char *) data[i].data, length, (unsigned char *) reduced, &reduced_length); + ret = gs1_verify(symbol, ZUCP(data[i].data), &length, ZUCP(reduced), &reduced_length); if (p_ctx->generate) { printf(" /*%3d*/ { \"%s\", %s, \"%s\", \"%s\" },\n", @@ -2202,7 +2294,7 @@ static void test_gs1_lint(const testCtx *const p_ctx) { length = (int) strlen(data[i].data); - ret = gs1_verify(symbol, (unsigned char *) data[i].data, length, (unsigned char *) reduced, &reduced_length); + ret = gs1_verify(symbol, ZUCP(data[i].data), &length, ZUCP(reduced), &reduced_length); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (length %d \"%s\") (%s)\n", i, ret, data[i].ret, length, data[i].data, symbol->errtxt); @@ -2254,110 +2346,138 @@ static void test_input_mode(const testCtx *const p_ctx) { /* 12*/ { BARCODE_AZTEC, "[01]1234567890123", GS1_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, /* 13*/ { BARCODE_AZTEC, "[01]12345678901231", GS1_MODE, READER_INIT, ZINT_ERROR_INVALID_OPTION, 0 }, /* 14*/ { BARCODE_AZTEC, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, READER_INIT, ZINT_ERROR_INVALID_OPTION, 0 }, - /* 15*/ { BARCODE_AZTEC, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 16*/ { BARCODE_AZTEC, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 17*/ { BARCODE_AZTEC, "1234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, /* Must still begin with AI */ - /* 18*/ { BARCODE_CODABLOCKF, "[01]12345678901231", GS1_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, /* Codablock-F does not support GS1 */ - /* 19*/ { BARCODE_CODABLOCKF, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, - /* 20*/ { BARCODE_CODABLOCKF, "[01]12345678901231", GS1_MODE | ESCAPE_MODE | GS1NOCHECK_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, - /* 21*/ { BARCODE_CODABLOCKF, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, - /* 22*/ { BARCODE_CODABLOCKF, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, - /* 23*/ { BARCODE_CODEONE, "[01]12345678901231", GS1_MODE, -1, 0, 0 }, - /* 24*/ { BARCODE_CODEONE, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, 0, 1 }, - /* 25*/ { BARCODE_CODEONE, "(01)12345678901231", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 1 }, - /* 26*/ { BARCODE_CODEONE, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, - /* 27*/ { BARCODE_CODEONE, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, - /* 28*/ { BARCODE_CODEONE, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 29*/ { BARCODE_CODEONE, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /* 30*/ { BARCODE_CODEONE, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 31*/ { BARCODE_CODEONE, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /* 32*/ { BARCODE_CODEONE, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, - /* 33*/ { BARCODE_CODEONE, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, - /* 34*/ { BARCODE_CODEONE, "[01]1234567890123", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 35*/ { BARCODE_CODEONE, "[01]1234567890123", GS1_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /* 36*/ { BARCODE_CODEONE, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 37*/ { BARCODE_CODEONE, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 38*/ { BARCODE_CODE16K, "[01]12345678901231", GS1_MODE, -1, 0, 0 }, - /* 39*/ { BARCODE_CODE16K, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, 0, 1 }, - /* 40*/ { BARCODE_CODE16K, "(01)12345678901231", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 1 }, - /* 41*/ { BARCODE_CODE16K, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, - /* 42*/ { BARCODE_CODE16K, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, - /* 43*/ { BARCODE_CODE16K, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 44*/ { BARCODE_CODE16K, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /* 45*/ { BARCODE_CODE16K, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 46*/ { BARCODE_CODE16K, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /* 47*/ { BARCODE_CODE16K, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, - /* 48*/ { BARCODE_CODE16K, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, - /* 49*/ { BARCODE_CODE16K, "[01]1234567890123", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 50*/ { BARCODE_CODE16K, "[01]1234567890123", GS1_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /* 51*/ { BARCODE_CODE16K, "[01]12345678901231", GS1_MODE, READER_INIT, ZINT_ERROR_INVALID_OPTION, 0 }, - /* 52*/ { BARCODE_CODE16K, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, READER_INIT, ZINT_ERROR_INVALID_OPTION, 0 }, - /* 53*/ { BARCODE_CODE16K, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 54*/ { BARCODE_CODE16K, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 55*/ { BARCODE_CODE49, "[01]12345678901231", GS1_MODE, -1, 0, 0 }, - /* 56*/ { BARCODE_CODE49, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, 0, 1 }, - /* 57*/ { BARCODE_CODE49, "(01)12345678901231", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 1 }, - /* 58*/ { BARCODE_CODE49, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, - /* 59*/ { BARCODE_CODE49, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, - /* 60*/ { BARCODE_CODE49, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 61*/ { BARCODE_CODE49, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /* 62*/ { BARCODE_CODE49, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 63*/ { BARCODE_CODE49, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /* 64*/ { BARCODE_CODE49, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, - /* 65*/ { BARCODE_CODE49, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, - /* 66*/ { BARCODE_CODE49, "[01]1234567890123", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 67*/ { BARCODE_CODE49, "[01]1234567890123", GS1_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /* 68*/ { BARCODE_CODE49, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 69*/ { BARCODE_CODE49, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 70*/ { BARCODE_DATAMATRIX, "[01]12345678901231", GS1_MODE, -1, 0, 0 }, - /* 71*/ { BARCODE_DATAMATRIX, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, 0, 1 }, - /* 72*/ { BARCODE_DATAMATRIX, "(01)12345678901231", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 1 }, - /* 73*/ { BARCODE_DATAMATRIX, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, - /* 74*/ { BARCODE_DATAMATRIX, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, - /* 75*/ { BARCODE_DATAMATRIX, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 76*/ { BARCODE_DATAMATRIX, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /* 77*/ { BARCODE_DATAMATRIX, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 78*/ { BARCODE_DATAMATRIX, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /* 79*/ { BARCODE_DATAMATRIX, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, - /* 80*/ { BARCODE_DATAMATRIX, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, - /* 81*/ { BARCODE_DATAMATRIX, "[01]1234567890123", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 82*/ { BARCODE_DATAMATRIX, "[01]1234567890123", GS1_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /* 83*/ { BARCODE_DATAMATRIX, "[01]12345678901231", GS1_MODE, READER_INIT, ZINT_ERROR_INVALID_OPTION, 0 }, - /* 84*/ { BARCODE_DATAMATRIX, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, READER_INIT, ZINT_ERROR_INVALID_OPTION, 0 }, - /* 85*/ { BARCODE_DATAMATRIX, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 86*/ { BARCODE_DATAMATRIX, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 87*/ { BARCODE_DOTCODE, "[01]12345678901231", GS1_MODE, -1, 0, 0 }, - /* 88*/ { BARCODE_DOTCODE, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, 0, 1 }, - /* 89*/ { BARCODE_DOTCODE, "(01)12345678901231", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 1 }, - /* 90*/ { BARCODE_DOTCODE, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, - /* 91*/ { BARCODE_DOTCODE, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, - /* 92*/ { BARCODE_DOTCODE, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 93*/ { BARCODE_DOTCODE, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /* 94*/ { BARCODE_DOTCODE, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 95*/ { BARCODE_DOTCODE, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /* 96*/ { BARCODE_DOTCODE, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, - /* 97*/ { BARCODE_DOTCODE, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, - /* 98*/ { BARCODE_DOTCODE, "[01]1234567890123", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /* 99*/ { BARCODE_DOTCODE, "[01]1234567890123", GS1_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /*100*/ { BARCODE_DOTCODE, "[01]12345678901231", GS1_MODE, READER_INIT, 0, 0 }, /* Reader Init permissible with default GS1 mode */ - /*101*/ { BARCODE_DOTCODE, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, READER_INIT, 0, 1 }, - /*102*/ { BARCODE_DOTCODE, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /*103*/ { BARCODE_DOTCODE, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /*104*/ { BARCODE_QRCODE, "[01]12345678901231", GS1_MODE, -1, 0, 0 }, - /*105*/ { BARCODE_QRCODE, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, 0, 1 }, - /*106*/ { BARCODE_QRCODE, "(01)12345678901231", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 1 }, - /*107*/ { BARCODE_QRCODE, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, - /*108*/ { BARCODE_QRCODE, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, - /*109*/ { BARCODE_QRCODE, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /*110*/ { BARCODE_QRCODE, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /*111*/ { BARCODE_QRCODE, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /*112*/ { BARCODE_QRCODE, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /*113*/ { BARCODE_QRCODE, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, - /*114*/ { BARCODE_QRCODE, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, - /*115*/ { BARCODE_QRCODE, "[01]1234567890123", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /*116*/ { BARCODE_QRCODE, "[01]1234567890123", GS1_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, - /*117*/ { BARCODE_QRCODE, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, - /*118*/ { BARCODE_QRCODE, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 15*/ { BARCODE_AZTEC, "[10]()", GS1_MODE, -1, 0, 0 }, + /* 16*/ { BARCODE_AZTEC, "(10)()", GS1_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 17*/ { BARCODE_AZTEC, "(10)()", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 18*/ { BARCODE_AZTEC, "(10)\\(\\)", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 0 }, + /* 19*/ { BARCODE_AZTEC, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 20*/ { BARCODE_AZTEC, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 21*/ { BARCODE_AZTEC, "1234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, /* Must still begin with AI */ + /* 22*/ { BARCODE_CODABLOCKF, "[01]12345678901231", GS1_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, /* Codablock-F does not support GS1 */ + /* 23*/ { BARCODE_CODABLOCKF, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, + /* 24*/ { BARCODE_CODABLOCKF, "[01]12345678901231", GS1_MODE | ESCAPE_MODE | GS1NOCHECK_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, + /* 25*/ { BARCODE_CODABLOCKF, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, + /* 26*/ { BARCODE_CODABLOCKF, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, + /* 27*/ { BARCODE_CODEONE, "[01]12345678901231", GS1_MODE, -1, 0, 0 }, + /* 28*/ { BARCODE_CODEONE, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, 0, 1 }, + /* 29*/ { BARCODE_CODEONE, "(01)12345678901231", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 1 }, + /* 30*/ { BARCODE_CODEONE, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, + /* 31*/ { BARCODE_CODEONE, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, + /* 32*/ { BARCODE_CODEONE, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 33*/ { BARCODE_CODEONE, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /* 34*/ { BARCODE_CODEONE, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 35*/ { BARCODE_CODEONE, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /* 36*/ { BARCODE_CODEONE, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, + /* 37*/ { BARCODE_CODEONE, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, + /* 38*/ { BARCODE_CODEONE, "[01]1234567890123", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 39*/ { BARCODE_CODEONE, "[01]1234567890123", GS1_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /* 40*/ { BARCODE_CODEONE, "[10]()", GS1_MODE, -1, 0, 0 }, + /* 41*/ { BARCODE_CODEONE, "(10)()", GS1_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 42*/ { BARCODE_CODEONE, "(10)()", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 43*/ { BARCODE_CODEONE, "(10)\\(\\)", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 0 }, + /* 44*/ { BARCODE_CODEONE, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 45*/ { BARCODE_CODEONE, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 46*/ { BARCODE_CODE16K, "[01]12345678901231", GS1_MODE, -1, 0, 0 }, + /* 47*/ { BARCODE_CODE16K, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, 0, 1 }, + /* 48*/ { BARCODE_CODE16K, "(01)12345678901231", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 1 }, + /* 49*/ { BARCODE_CODE16K, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, + /* 50*/ { BARCODE_CODE16K, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, + /* 51*/ { BARCODE_CODE16K, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 52*/ { BARCODE_CODE16K, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /* 53*/ { BARCODE_CODE16K, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 54*/ { BARCODE_CODE16K, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /* 55*/ { BARCODE_CODE16K, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, + /* 56*/ { BARCODE_CODE16K, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, + /* 57*/ { BARCODE_CODE16K, "[01]1234567890123", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 58*/ { BARCODE_CODE16K, "[01]1234567890123", GS1_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /* 59*/ { BARCODE_CODE16K, "[01]12345678901231", GS1_MODE, READER_INIT, ZINT_ERROR_INVALID_OPTION, 0 }, + /* 60*/ { BARCODE_CODE16K, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, READER_INIT, ZINT_ERROR_INVALID_OPTION, 0 }, + /* 61*/ { BARCODE_CODE16K, "[10]()", GS1_MODE, -1, 0, 0 }, + /* 62*/ { BARCODE_CODE16K, "(10)()", GS1_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 63*/ { BARCODE_CODE16K, "(10)()", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 64*/ { BARCODE_CODE16K, "(10)\\(\\)", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 0 }, + /* 65*/ { BARCODE_CODE16K, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 66*/ { BARCODE_CODE16K, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 67*/ { BARCODE_CODE49, "[01]12345678901231", GS1_MODE, -1, 0, 0 }, + /* 68*/ { BARCODE_CODE49, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, 0, 1 }, + /* 69*/ { BARCODE_CODE49, "(01)12345678901231", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 1 }, + /* 70*/ { BARCODE_CODE49, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, + /* 71*/ { BARCODE_CODE49, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, + /* 72*/ { BARCODE_CODE49, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 73*/ { BARCODE_CODE49, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /* 74*/ { BARCODE_CODE49, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 75*/ { BARCODE_CODE49, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /* 76*/ { BARCODE_CODE49, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, + /* 77*/ { BARCODE_CODE49, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, + /* 78*/ { BARCODE_CODE49, "[01]1234567890123", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 79*/ { BARCODE_CODE49, "[01]1234567890123", GS1_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /* 80*/ { BARCODE_CODE49, "[10]()", GS1_MODE, -1, 0, 0 }, + /* 81*/ { BARCODE_CODE49, "(10)()", GS1_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 82*/ { BARCODE_CODE49, "(10)()", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 83*/ { BARCODE_CODE49, "(10)\\(\\)", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 0 }, + /* 84*/ { BARCODE_CODE49, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 85*/ { BARCODE_CODE49, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 86*/ { BARCODE_DATAMATRIX, "[01]12345678901231", GS1_MODE, -1, 0, 0 }, + /* 87*/ { BARCODE_DATAMATRIX, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, 0, 1 }, + /* 88*/ { BARCODE_DATAMATRIX, "(01)12345678901231", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 1 }, + /* 89*/ { BARCODE_DATAMATRIX, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, + /* 90*/ { BARCODE_DATAMATRIX, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, + /* 91*/ { BARCODE_DATAMATRIX, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 92*/ { BARCODE_DATAMATRIX, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /* 93*/ { BARCODE_DATAMATRIX, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 94*/ { BARCODE_DATAMATRIX, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /* 95*/ { BARCODE_DATAMATRIX, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, + /* 96*/ { BARCODE_DATAMATRIX, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, + /* 97*/ { BARCODE_DATAMATRIX, "[01]1234567890123", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /* 98*/ { BARCODE_DATAMATRIX, "[01]1234567890123", GS1_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /* 99*/ { BARCODE_DATAMATRIX, "[01]12345678901231", GS1_MODE, READER_INIT, ZINT_ERROR_INVALID_OPTION, 0 }, + /*100*/ { BARCODE_DATAMATRIX, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, READER_INIT, ZINT_ERROR_INVALID_OPTION, 0 }, + /*101*/ { BARCODE_DATAMATRIX, "[10]()", GS1_MODE, -1, 0, 0 }, + /*102*/ { BARCODE_DATAMATRIX, "(10)()", GS1_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*103*/ { BARCODE_DATAMATRIX, "(10)()", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*104*/ { BARCODE_DATAMATRIX, "(10)\\(\\)", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 0 }, + /*105*/ { BARCODE_DATAMATRIX, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*106*/ { BARCODE_DATAMATRIX, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*107*/ { BARCODE_DOTCODE, "[01]12345678901231", GS1_MODE, -1, 0, 0 }, + /*108*/ { BARCODE_DOTCODE, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, 0, 1 }, + /*109*/ { BARCODE_DOTCODE, "(01)12345678901231", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 1 }, + /*110*/ { BARCODE_DOTCODE, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, + /*111*/ { BARCODE_DOTCODE, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, + /*112*/ { BARCODE_DOTCODE, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*113*/ { BARCODE_DOTCODE, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /*114*/ { BARCODE_DOTCODE, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*115*/ { BARCODE_DOTCODE, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /*116*/ { BARCODE_DOTCODE, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, + /*117*/ { BARCODE_DOTCODE, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, + /*118*/ { BARCODE_DOTCODE, "[01]1234567890123", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*119*/ { BARCODE_DOTCODE, "[01]1234567890123", GS1_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /*120*/ { BARCODE_DOTCODE, "[01]12345678901231", GS1_MODE, READER_INIT, 0, 0 }, /* Reader Init permissible with default GS1 mode */ + /*121*/ { BARCODE_DOTCODE, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, READER_INIT, 0, 1 }, + /*122*/ { BARCODE_DOTCODE, "[10]()", GS1_MODE, -1, 0, 0 }, + /*123*/ { BARCODE_DOTCODE, "(10)()", GS1_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*124*/ { BARCODE_DOTCODE, "(10)()", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*125*/ { BARCODE_DOTCODE, "(10)\\(\\)", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 0 }, + /*126*/ { BARCODE_DOTCODE, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*127*/ { BARCODE_DOTCODE, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*128*/ { BARCODE_QRCODE, "[01]12345678901231", GS1_MODE, -1, 0, 0 }, + /*129*/ { BARCODE_QRCODE, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, 0, 1 }, + /*130*/ { BARCODE_QRCODE, "(01)12345678901231", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 1 }, + /*131*/ { BARCODE_QRCODE, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, + /*132*/ { BARCODE_QRCODE, "(01)12345678901234", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, + /*133*/ { BARCODE_QRCODE, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*134*/ { BARCODE_QRCODE, "(01)123456789012345", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /*135*/ { BARCODE_QRCODE, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*136*/ { BARCODE_QRCODE, "(01)12345678901234A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /*137*/ { BARCODE_QRCODE, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_WARN_NONCOMPLIANT, 0 }, + /*138*/ { BARCODE_QRCODE, "(01)1234567890123A", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, 0, 1 }, + /*139*/ { BARCODE_QRCODE, "[01]1234567890123", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*140*/ { BARCODE_QRCODE, "[01]1234567890123", GS1_MODE | GS1NOCHECK_MODE, -1, 0, 0 }, + /*141*/ { BARCODE_QRCODE, "[10]()", GS1_MODE, -1, 0, 0 }, + /*142*/ { BARCODE_QRCODE, "(10)()", GS1_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*143*/ { BARCODE_QRCODE, "(10)()", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*144*/ { BARCODE_QRCODE, "(10)\\(\\)", GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, -1, 0, 0 }, + /*145*/ { BARCODE_QRCODE, "1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, + /*146*/ { BARCODE_QRCODE, "1234", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_library.c b/backend/tests/test_library.c index 8f4068ec..ffb88a19 100644 --- a/backend/tests/test_library.c +++ b/backend/tests/test_library.c @@ -365,7 +365,7 @@ static void test_input_data(const testCtx *const p_ctx) { /* 2*/ { BARCODE_GS1_128, -1, "", -1, "", ZINT_ERROR_INVALID_DATA, "Error 778: No input data" }, /* 3*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", -1, "[10]121212", 0, "" }, /* 4*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", -1, "", ZINT_ERROR_INVALID_DATA, "Error 779: No composite data (2D component)" }, - /* 5*/ { BARCODE_GS1_128_CC, -1, "", -1, "[10]121212", ZINT_ERROR_INVALID_OPTION, "Error 445: No primary (linear) message" }, + /* 5*/ { BARCODE_GS1_128_CC, -1, "", -1, "[10]121212", ZINT_ERROR_INVALID_DATA, "Error 445: No primary (linear component)" }, /* 6*/ { BARCODE_DATAMATRIX, -1, "", -1, "", ZINT_ERROR_INVALID_DATA, "Error 228: No input data (segment 0 empty)" }, }; const int data_size = ARRAY_SIZE(data); @@ -408,7 +408,11 @@ static void test_input_data(const testCtx *const p_ctx) { char data_buf[ZINT_MAX_DATA_LEN + 10]; int expected_ret = ZINT_ERROR_TOO_LONG; const char *expected_errtxt[] = { - "Error 797: Input too long", "Error 340: Input length 17399 too long (maximum 256)" + "Error 797: Input too long", + "Error 340: Input length 17399 too long (maximum 256)", + "Error 799: Invalid primary, must be NUL-terminated", + "Error 854: Invalid primary (linear component), must be NUL-terminated", + "Error 855: Invalid outfile, must be NUL-terminated", }; symbol = ZBarcode_Create(); @@ -431,12 +435,48 @@ static void test_input_data(const testCtx *const p_ctx) { data_buf[ZINT_MAX_DATA_LEN - 2] = '\\'; data_buf[ZINT_MAX_DATA_LEN - 1] = 'n'; - ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, ZINT_MAX_DATA_LEN); + ret = ZBarcode_Encode(symbol, ZCUCP(data_buf), ZINT_MAX_DATA_LEN); assert_equal(ret, expected_ret, "ZBarcode_Encode(%d) ret %d != %d (%s)\n", symbol->symbology, ret, expected_ret, symbol->errtxt); assert_zero(strcmp(symbol->errtxt, expected_errtxt[1]), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, expected_errtxt[1]); + /* Check no NUL-termination */ + expected_ret = ZINT_ERROR_INVALID_DATA; + + ZBarcode_Reset(symbol); + + symbol->input_mode |= ESCAPE_MODE; /* Library only checks primary in escape mode */ + memset(symbol->primary, 'a', sizeof(symbol->primary)); + symbol->primary[0] = '\\'; /* And only if primary contains a backslash */ + + ret = ZBarcode_Encode(symbol, ZCUCP("123"), 0); + assert_equal(ret, expected_ret, "ZBarcode_Encode(%d) ret %d != %d (%s)\n", + symbol->symbology, ret, expected_ret, symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, expected_errtxt[2]), "i:%d strcmp(%s, %s) != 0\n", + i, symbol->errtxt, expected_errtxt[2]); + + ZBarcode_Reset(symbol); + + symbol->symbology = BARCODE_EAN13_CC; /* Composite always checks primary */ + memset(symbol->primary, '0', sizeof(symbol->primary)); + + ret = ZBarcode_Encode(symbol, ZCUCP("[01]12345678901231"), 0); + assert_equal(ret, expected_ret, "ZBarcode_Encode(%d) ret %d != %d (%s)\n", + symbol->symbology, ret, expected_ret, symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, expected_errtxt[3]), "i:%d strcmp(%s, %s) != 0\n", + i, symbol->errtxt, expected_errtxt[3]); + + ZBarcode_Reset(symbol); + + memset(symbol->outfile, 'A', sizeof(symbol->outfile)); + + ret = ZBarcode_Encode_and_Print(symbol, ZCUCP("123"), 0, 0); + assert_equal(ret, expected_ret, "ZBarcode_Encode_and_Print(%d) ret %d != %d (%s)\n", + symbol->symbology, ret, expected_ret, symbol->errtxt); + assert_zero(strcmp(symbol->errtxt, expected_errtxt[4]), "i:%d strcmp(%s, %s) != 0\n", + i, symbol->errtxt, expected_errtxt[4]); + ZBarcode_Delete(symbol); } diff --git a/backend/tests/test_qr.c b/backend/tests/test_qr.c index a9a3afa1..a83fb643 100644 --- a/backend/tests/test_qr.c +++ b/backend/tests/test_qr.c @@ -603,120 +603,122 @@ static void test_qr_gs1(const testCtx *const p_ctx) { /* 1*/ { GS1_MODE | GS1PARENS_MODE, 4, 7 << 8, "(01)12345678901231", 0, "51 04 00 B3 AA 37 DE 87 B1", 1, "N16" }, /* 2*/ { GS1_MODE, 2, 4 << 8, "[01]04912345123459[15]970331[30]128[10]ABC123", 0, "51 07 40 A7 AC EA 80 15 9E 4F CA 52 D2 D3 84 09 D5 E0 28 FD 82 F0 C0 EC 11 EC 11 EC", 1, "N29 A9" }, /* 3*/ { GS1_MODE | GS1PARENS_MODE, 2, 4 << 8, "(01)04912345123459(15)970331(30)128(10)ABC123", 0, "51 07 40 A7 AC EA 80 15 9E 4F CA 52 D2 D3 84 09 D5 E0 28 FD 82 F0 C0 EC 11 EC 11 EC", 1, "N29 A9" }, - /* 4*/ { GS1_MODE, 3, -1, "[91]12%[20]12", 0, "52 05 99 60 5F B5 35 80 01 08 00 EC 11", 1, "A10(11)" }, - /* 5*/ { GS1_MODE, 3, 1 << 8, "[91]123%[20]12", 0, "52 06 19 60 5E 2B 76 A0 5A 05 E0 EC 11", 1, "A11(12)" }, - /* 6*/ { GS1_MODE, 3, 6 << 8, "[91]1234%[20]12", 0, "52 06 99 60 5E 22 F6 A6 B0 00 21 00 EC", 1, "A12(13)" }, - /* 7*/ { GS1_MODE, 3, -1, "[91]12345%[20]12", 0, "51 01 F8 F3 A9 48 0F B5 35 80 01 08 00", 1, "N7 A6(7) (same bit count as A13(14))" }, - /* 8*/ { GS1_MODE, 3, 8 << 8, "[91]%%[20]12", 0, "52 05 99 6D A9 B5 35 80 01 08 00 EC 11", 1, "A9(11)" }, - /* 9*/ { GS1_MODE, 3, 6 << 8, "[91]%%%[20]12", 0, "52 06 99 6D A9 B5 36 A6 B0 00 21 00 EC", 1, "A10(13)" }, - /* 10*/ { GS1_MODE, 3, 6 << 8, "[91]A%%%%1234567890123AA%", 0, "54 07 39 31 41 25 25 25 25 10 34 7B 72 31 50 30 C8 08 73 36 A0 00", 0, "B7 N13 A3(4); BWIPP different encoding (same no. codewords)" }, - /* 11*/ { GS1_MODE, 1, -1, "[91]%23%%6789%%%34567%%%%234%%%%%", 0, "(34) 52 0C 99 6D A8 17 76 A6 D4 22 A5 C7 6A 6D 4D A8 22 C7 38 E8 18 4A 4A 4A 4A 64 66 68", 0, "A19(25) B12; BWIPP different encoding (same no. codewords, less padding)" }, - /* 12*/ { GS1_MODE, 2, 5 << 8, "[91]ABCDEFGHI[92]ABCDEF", 0, "52 0A 19 63 9A 8A 54 2A E1 6A 06 5C E6 A2 95 0A", 1, "A20(23)" }, - /* 13*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%", 0, "54 01 25 00 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11", 0, "B1; BWIPP different encoding (A2)" }, - /* 14*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%A", 0, "54 02 25 41 00 EC 11 EC 11 EC 11 EC 11 EC 11 EC", 0, "B2; BWIPP different encoding (A3)" }, - /* 15*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]A%", 0, "54 02 41 25 00 EC 11 EC 11 EC 11 EC 11 EC 11 EC", 0, "B2; BWIPP different encoding (A3)" }, - /* 16*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%AA", 0, "52 02 6D 43 98 00 EC 11 EC 11 EC 11 EC 11 EC 11", 1, "A3(4)" }, - /* 17*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]A%A", 0, "52 02 1E 8D 70 00 EC 11 EC 11 EC 11 EC 11 EC 11", 1, "A3(4)" }, - /* 18*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]AA%", 0, "52 02 1C CD A8 00 EC 11 EC 11 EC 11 EC 11 EC 11", 1, "A3(4)" }, - /* 19*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%%", 0, "54 02 25 25 00 EC 11 EC 11 EC 11 EC 11 EC 11 EC", 0, "B2; BWIPP different encoding (A4)" }, - /* 20*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%%A", 0, "54 03 25 25 41 00 EC 11 EC 11 EC 11 EC 11 EC 11", 0, "B3; BWIPP different encoding (A5)" }, - /* 21*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%A%", 0, "54 03 25 41 25 00 EC 11 EC 11 EC 11 EC 11 EC 11", 0, "B3; BWIPP different encoding (A5)" }, - /* 22*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]A%%", 0, "54 03 41 25 25 00 EC 11 EC 11 EC 11 EC 11 EC 11", 0, "B3; BWIPP different encoding (A5)" }, - /* 23*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%AAA", 0, "52 02 ED 43 98 50 00 EC 11 EC 11 EC 11 EC 11 EC", 1, "A4(5)" }, - /* 24*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]A%AA", 0, "52 02 9E 8D 70 50 00 EC 11 EC 11 EC 11 EC 11 EC", 1, "A4(5)" }, - /* 25*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]A%AA", 0, "52 02 9E 8D 70 50 00 EC 11 EC 11 EC 11 EC 11 EC", 1, "A4(5)" }, - /* 26*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]AA%A", 0, "52 02 9C CD A8 50 00 EC 11 EC 11 EC 11 EC 11 EC", 1, "A4(5)" }, - /* 27*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]AAA%", 0, "52 02 9C C3 D1 30 00 EC 11 EC 11 EC 11 EC 11 EC", 1, "A4(5)" }, - /* 28*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%%AA", 0, "54 04 25 25 41 41 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A6) (same no. codewords)" }, - /* 29*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%A%A", 0, "54 04 25 41 25 41 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A6) (same no. codewords)" }, - /* 30*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]A%%A", 0, "54 04 41 25 25 41 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A6) (same no. codewords)" }, - /* 31*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]A%A%", 0, "54 04 41 25 41 25 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A6) (same no. codewords)" }, - /* 32*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]AA%%", 0, "54 04 41 41 25 25 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A6) (same no. codewords)" }, - /* 33*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAA", 0, "52 03 ED 4D A8 73 0A 00 EC 11 EC 11 EC 11 EC 11", 1, "A5(7)" }, - /* 34*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%AA", 0, "52 03 ED 43 D1 AE 0A 00 EC 11 EC 11 EC 11 EC 11", 1, "A5(7)" }, - /* 35*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%%AA", 0, "52 03 9E 8D A9 AE 0A 00 EC 11 EC 11 EC 11 EC 11", 1, "A5(7)" }, - /* 36*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%A", 0, "52 03 9E 8D 71 B5 0A 00 EC 11 EC 11 EC 11 EC 11", 1, "A5(7)" }, - /* 37*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AA%%A", 0, "52 03 9C CD A9 B5 0A 00 EC 11 EC 11 EC 11 EC 11", 1, "A5(7)" }, - /* 38*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AA%A%", 0, "52 03 9C CD A8 7A 26 00 EC 11 EC 11 EC 11 EC 11", 1, "A5(7)" }, - /* 39*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAA%%", 0, "52 03 9C C3 D1 B5 26 00 EC 11 EC 11 EC 11 EC 11", 1, "A5(7)" }, - /* 40*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%", 0, "54 03 25 25 25 00 EC 11 EC 11 EC 11 EC 11 EC 11", 0, "B3; BWIPP different encoding (A6)" }, - /* 41*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%A", 0, "54 04 25 25 25 41 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A7)" }, - /* 42*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%A%", 0, "54 04 25 25 41 25 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A7)" }, - /* 43*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%", 0, "54 04 25 41 25 25 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A7)" }, - /* 44*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%%%", 0, "54 04 41 25 25 25 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A7)" }, - /* 45*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AA", 0, "54 05 25 25 25 41 41 00 EC 11 EC 11 EC 11 EC 11", 0, "B5; BWIPP different encoding (A8)" }, - /* 46*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AA%%%", 0, "54 05 41 41 25 25 25 00 EC 11 EC 11 EC 11 EC 11", 0, "B5; BWIPP different encoding (A8)" }, - /* 47*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AAA", 0, "54 06 25 25 25 41 41 41 00 EC 11 EC 11 EC 11 EC", 0, "B6; BWIPP different encoding (A9)" }, - /* 48*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%A%", 0, "54 06 41 25 41 25 41 25 00 EC 11 EC 11 EC 11 EC", 0, "B6; BWIPP different encoding (A9)" }, - /* 49*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAAA", 0, "52 04 6D 4D A8 73 0E 60 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, - /* 50*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%AAA", 0, "52 04 6D 43 D1 AE 0E 60 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, - /* 51*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AA%AA", 0, "52 04 6D 43 99 B5 0E 60 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, - /* 52*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAA%A", 0, "52 04 6D 43 98 7A 35 C0 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, - /* 53*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAA%", 0, "52 04 6D 43 98 73 36 A0 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, - /* 54*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%%AAA", 0, "52 04 1E 8D A9 AE 0E 60 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, - /* 55*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AA%%AA", 0, "52 04 1C CD A9 B5 0E 60 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, - /* 56*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAA%%A", 0, "52 04 1C C3 D1 B5 35 C0 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, - /* 57*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAAA%%", 0, "52 04 1C C3 99 B5 36 A0 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, - /* 58*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAAAA", 0, "52 04 ED 4D A8 73 0E 61 40 EC 11 EC 11 EC 11 EC", 1, "A7(9)" }, - /* 59*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%AAAA", 0, "52 04 ED 43 D1 AE 0E 61 40 EC 11 EC 11 EC 11 EC", 1, "A7(9)" }, - /* 60*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AA%AAA", 0, "52 04 ED 43 99 B5 0E 61 40 EC 11 EC 11 EC 11 EC", 1, "A7(9)" }, - /* 61*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAA%AA", 0, "52 04 ED 43 98 7A 35 C1 40 EC 11 EC 11 EC 11 EC", 1, "A7(9)" }, - /* 62*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAA%A", 0, "52 04 ED 43 98 73 36 A1 40 EC 11 EC 11 EC 11 EC", 1, "A7(9)" }, - /* 63*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAAA%", 0, "52 04 ED 43 98 73 0F 44 C0 EC 11 EC 11 EC 11 EC", 1, "A7(9)" }, - /* 64*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AAAAA", 0, "52 05 ED 4D A9 B5 0E 61 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 65*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%A%AAAA", 0, "52 05 ED 4D A8 7A 35 C1 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 66*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AA%AAA", 0, "52 05 ED 4D A8 73 36 A1 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 67*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAA%AA", 0, "52 05 ED 4D A8 73 0F 46 B8 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 68*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAAA%A", 0, "52 05 ED 4D A8 73 0E 66 D4 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 69*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAAAA%", 0, "52 05 ED 4D A8 73 0E 61 E8 98 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 70*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%AAAA", 0, "52 05 ED 43 D1 B5 35 C1 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 71*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AA%%AAA", 0, "52 05 ED 43 99 B5 36 A1 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 72*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAA%%AA", 0, "52 05 ED 43 98 7A 36 A6 B8 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 73*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAA%%A", 0, "52 05 ED 43 98 73 36 A6 D4 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 74*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAAA%%", 0, "52 05 ED 43 98 73 0F 46 D4 98 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 75*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%%%AAAA", 0, "52 05 9E 8D A9 B5 35 C1 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 76*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AA%%%AAA", 0, "52 05 9C CD A9 B5 36 A1 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 77*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAA%%%AA", 0, "52 05 9C C3 D1 B5 36 A6 B8 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 78*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAAA%%%A", 0, "52 05 9C C3 99 B5 36 A6 D4 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 79*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAAAA%%%", 0, "52 05 9C C3 98 7A 36 A6 D4 98 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 80*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%A%AA", 0, "52 05 9E 8D 71 B5 0F 46 B8 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 81*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%AA%A", 0, "52 05 9E 8D 71 B5 0E 66 D4 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 82*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%AAA%", 0, "52 05 9E 8D 71 B5 0E 61 E8 98 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 83*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%A%AAA", 0, "52 05 ED 43 D1 AE 36 A1 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, - /* 84*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%%AAAAAA", 0, "52 07 6D 4D A9 B5 36 A1 CC 39 87 30 00 EC 11 EC", 1, "A10(14)" }, - /* 85*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%A%AAAAA", 0, "52 07 6D 4D A9 B5 0F 46 B8 39 87 30 00 EC 11 EC", 1, "A10(14)" }, - /* 86*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AA%AAAA", 0, "52 07 6D 4D A9 B5 0E 66 D4 39 87 30 00 EC 11 EC", 1, "A10(14)" }, - /* 87*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AAA%AAA", 0, "52 07 6D 4D A9 B5 0E 61 E8 D7 07 30 00 EC 11 EC", 1, "A10(14)" }, - /* 88*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AAAA%AA", 0, "52 07 6D 4D A9 B5 0E 61 CC DA 87 30 00 EC 11 EC", 1, "A10(14)" }, - /* 89*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AAAAA%A", 0, "52 07 6D 4D A9 B5 0E 61 CC 3D 1A E0 00 EC 11 EC", 1, "A10(14)" }, - /* 90*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AAAAAA%", 0, "52 07 6D 4D A9 B5 0E 61 CC 39 9B 50 00 EC 11 EC", 1, "A10(14)" }, - /* 91*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%A%%AAAAA", 0, "52 07 6D 4D A8 7A 36 A6 B8 39 87 30 00 EC 11 EC", 1, "A10(14)" }, - /* 92*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AA%%AAAA", 0, "52 07 6D 4D A8 73 36 A6 D4 39 87 30 00 EC 11 EC", 1, "A10(14)" }, - /* 93*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAA%%AAA", 0, "52 07 6D 4D A8 73 0F 46 D4 D7 07 30 00 EC 11 EC", 1, "A10(14)" }, - /* 94*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAAA%%AA", 0, "52 07 6D 4D A8 73 0E 66 D4 DA 87 30 00 EC 11 EC", 1, "A10(14)" }, - /* 95*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAAAA%%A", 0, "52 07 6D 4D A8 73 0E 61 E8 DA 9A E0 00 EC 11 EC", 1, "A10(14)" }, - /* 96*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAAAAA%%", 0, "52 07 6D 4D A8 73 0E 61 CC DA 9B 50 00 EC 11 EC", 1, "A10(14)" }, - /* 97*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%%AAAAA", 0, "52 07 6D 43 D1 B5 36 A6 B8 39 87 30 00 EC 11 EC", 1, "A10(14)" }, - /* 98*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AA%%%AAAA", 0, "52 07 6D 43 99 B5 36 A6 D4 39 87 30 00 EC 11 EC", 1, "A10(14)" }, - /* 99*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAA%%%AAA", 0, "52 07 6D 43 98 7A 36 A6 D4 D7 07 30 00 EC 11 EC", 1, "A10(14)" }, - /*100*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAA%%%AA", 0, "52 07 6D 43 98 73 36 A6 D4 DA 87 30 00 EC 11 EC", 1, "A10(14)" }, - /*101*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAAA%%%A", 0, "52 07 6D 43 98 73 0F 46 D4 DA 9A E0 00 EC 11 EC", 1, "A10(14)" }, - /*102*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAAAA%%%", 0, "52 07 6D 43 98 73 0E 66 D4 DA 9B 50 00 EC 11 EC", 1, "A10(14)" }, - /*103*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%%%%AAAAA", 0, "52 07 1E 8D A9 B5 36 A6 B8 39 87 30 00 EC 11 EC", 1, "A10(14)" }, - /*104*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AA%%%%AAAA", 0, "52 07 1C CD A9 B5 36 A6 D4 39 87 30 00 EC 11 EC", 1, "A10(14)" }, - /*105*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAA%%%%AAA", 0, "52 07 1C C3 D1 B5 36 A6 D4 D7 07 30 00 EC 11 EC", 1, "A10(14)" }, - /*106*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAAA%%%%AA", 0, "52 07 1C C3 99 B5 36 A6 D4 DA 87 30 00 EC 11 EC", 1, "A10(14)" }, - /*107*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAAAA%%%%A", 0, "52 07 1C C3 98 7A 36 A6 D4 DA 9A E0 00 EC 11 EC", 1, "A10(14)" }, - /*108*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAAAAA%%%%", 0, "52 07 1C C3 98 73 36 A6 D4 DA 9B 50 00 EC 11 EC", 1, "A10(14)" }, - /*109*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%A%A%AA", 0, "52 07 1E 8D 71 B5 0F 46 B8 DA 87 30 00 EC 11 EC", 1, "A10(14)" }, - /*110*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%A%AA%A", 0, "52 07 1E 8D 71 B5 0F 46 B8 3D 1A E0 00 EC 11 EC", 1, "A10(14)" }, - /*111*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%A%AAA%", 0, "52 07 1E 8D 71 B5 0F 46 B8 39 9B 50 00 EC 11 EC", 1, "A10(14)" }, - /*112*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%A%A%AAA", 0, "52 07 6D 43 D1 AE 36 A1 E8 D7 07 30 00 EC 11 EC", 1, "A10(14)" }, - /*113*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%%AA%A%AA", 0, "52 07 1E 8D A9 AE 0F 46 B8 DA 87 30 00 EC 11 EC", 1, "A10(14)" }, - /*114*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%AA%AAA", 0, "52 07 6D 43 D1 B5 35 C1 E8 D7 07 30 00 EC 11 EC", 1, "A10(14)" }, - /*115*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%AAA%AA", 0, "52 07 6D 43 D1 B5 35 C1 CC DA 87 30 00 EC 11 EC", 1, "A10(14)" }, - /*116*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%AAAA%A", 0, "52 07 6D 43 D1 B5 35 C1 CC 3D 1A E0 00 EC 11 EC", 1, "A10(14)" }, - /*117*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%AAAAA%", 0, "52 07 6D 43 D1 B5 35 C1 CC 39 9B 50 00 EC 11 EC", 1, "A10(14)" }, + /* 4*/ { GS1_MODE, 4, 7 << 8, "[91])", 0, "54 03 39 31 29 00 EC 11 EC", 1, "" }, + /* 5*/ { GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, 4, 7 << 8, "(91)\\)", 0, "54 03 39 31 29 00 EC 11 EC", 1, "" }, + /* 6*/ { GS1_MODE, 3, -1, "[91]12%[20]12", 0, "52 05 99 60 5F B5 35 80 01 08 00 EC 11", 1, "A10(11)" }, + /* 7*/ { GS1_MODE, 3, 1 << 8, "[91]123%[20]12", 0, "52 06 19 60 5E 2B 76 A0 5A 05 E0 EC 11", 1, "A11(12)" }, + /* 8*/ { GS1_MODE, 3, 6 << 8, "[91]1234%[20]12", 0, "52 06 99 60 5E 22 F6 A6 B0 00 21 00 EC", 1, "A12(13)" }, + /* 9*/ { GS1_MODE, 3, -1, "[91]12345%[20]12", 0, "51 01 F8 F3 A9 48 0F B5 35 80 01 08 00", 1, "N7 A6(7) (same bit count as A13(14))" }, + /* 10*/ { GS1_MODE, 3, 8 << 8, "[91]%%[20]12", 0, "52 05 99 6D A9 B5 35 80 01 08 00 EC 11", 1, "A9(11)" }, + /* 11*/ { GS1_MODE, 3, 6 << 8, "[91]%%%[20]12", 0, "52 06 99 6D A9 B5 36 A6 B0 00 21 00 EC", 1, "A10(13)" }, + /* 12*/ { GS1_MODE, 3, 6 << 8, "[91]A%%%%1234567890123AA%", 0, "54 07 39 31 41 25 25 25 25 10 34 7B 72 31 50 30 C8 08 73 36 A0 00", 0, "B7 N13 A3(4); BWIPP different encoding (same no. codewords)" }, + /* 13*/ { GS1_MODE, 1, -1, "[91]%23%%6789%%%34567%%%%234%%%%%", 0, "(34) 52 0C 99 6D A8 17 76 A6 D4 22 A5 C7 6A 6D 4D A8 22 C7 38 E8 18 4A 4A 4A 4A 64 66 68", 0, "A19(25) B12; BWIPP different encoding (same no. codewords, less padding)" }, + /* 14*/ { GS1_MODE, 2, 5 << 8, "[91]ABCDEFGHI[92]ABCDEF", 0, "52 0A 19 63 9A 8A 54 2A E1 6A 06 5C E6 A2 95 0A", 1, "A20(23)" }, + /* 15*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%", 0, "54 01 25 00 EC 11 EC 11 EC 11 EC 11 EC 11 EC 11", 0, "B1; BWIPP different encoding (A2)" }, + /* 16*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%A", 0, "54 02 25 41 00 EC 11 EC 11 EC 11 EC 11 EC 11 EC", 0, "B2; BWIPP different encoding (A3)" }, + /* 17*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]A%", 0, "54 02 41 25 00 EC 11 EC 11 EC 11 EC 11 EC 11 EC", 0, "B2; BWIPP different encoding (A3)" }, + /* 18*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%AA", 0, "52 02 6D 43 98 00 EC 11 EC 11 EC 11 EC 11 EC 11", 1, "A3(4)" }, + /* 19*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]A%A", 0, "52 02 1E 8D 70 00 EC 11 EC 11 EC 11 EC 11 EC 11", 1, "A3(4)" }, + /* 20*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]AA%", 0, "52 02 1C CD A8 00 EC 11 EC 11 EC 11 EC 11 EC 11", 1, "A3(4)" }, + /* 21*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%%", 0, "54 02 25 25 00 EC 11 EC 11 EC 11 EC 11 EC 11 EC", 0, "B2; BWIPP different encoding (A4)" }, + /* 22*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%%A", 0, "54 03 25 25 41 00 EC 11 EC 11 EC 11 EC 11 EC 11", 0, "B3; BWIPP different encoding (A5)" }, + /* 23*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%A%", 0, "54 03 25 41 25 00 EC 11 EC 11 EC 11 EC 11 EC 11", 0, "B3; BWIPP different encoding (A5)" }, + /* 24*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]A%%", 0, "54 03 41 25 25 00 EC 11 EC 11 EC 11 EC 11 EC 11", 0, "B3; BWIPP different encoding (A5)" }, + /* 25*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%AAA", 0, "52 02 ED 43 98 50 00 EC 11 EC 11 EC 11 EC 11 EC", 1, "A4(5)" }, + /* 26*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]A%AA", 0, "52 02 9E 8D 70 50 00 EC 11 EC 11 EC 11 EC 11 EC", 1, "A4(5)" }, + /* 27*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]A%AA", 0, "52 02 9E 8D 70 50 00 EC 11 EC 11 EC 11 EC 11 EC", 1, "A4(5)" }, + /* 28*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]AA%A", 0, "52 02 9C CD A8 50 00 EC 11 EC 11 EC 11 EC 11 EC", 1, "A4(5)" }, + /* 29*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]AAA%", 0, "52 02 9C C3 D1 30 00 EC 11 EC 11 EC 11 EC 11 EC", 1, "A4(5)" }, + /* 30*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%%AA", 0, "54 04 25 25 41 41 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A6) (same no. codewords)" }, + /* 31*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]%A%A", 0, "54 04 25 41 25 41 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A6) (same no. codewords)" }, + /* 32*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]A%%A", 0, "54 04 41 25 25 41 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A6) (same no. codewords)" }, + /* 33*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]A%A%", 0, "54 04 41 25 41 25 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A6) (same no. codewords)" }, + /* 34*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 5 << 8, "[]AA%%", 0, "54 04 41 41 25 25 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A6) (same no. codewords)" }, + /* 35*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAA", 0, "52 03 ED 4D A8 73 0A 00 EC 11 EC 11 EC 11 EC 11", 1, "A5(7)" }, + /* 36*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%AA", 0, "52 03 ED 43 D1 AE 0A 00 EC 11 EC 11 EC 11 EC 11", 1, "A5(7)" }, + /* 37*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%%AA", 0, "52 03 9E 8D A9 AE 0A 00 EC 11 EC 11 EC 11 EC 11", 1, "A5(7)" }, + /* 38*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%A", 0, "52 03 9E 8D 71 B5 0A 00 EC 11 EC 11 EC 11 EC 11", 1, "A5(7)" }, + /* 39*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AA%%A", 0, "52 03 9C CD A9 B5 0A 00 EC 11 EC 11 EC 11 EC 11", 1, "A5(7)" }, + /* 40*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AA%A%", 0, "52 03 9C CD A8 7A 26 00 EC 11 EC 11 EC 11 EC 11", 1, "A5(7)" }, + /* 41*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAA%%", 0, "52 03 9C C3 D1 B5 26 00 EC 11 EC 11 EC 11 EC 11", 1, "A5(7)" }, + /* 42*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%", 0, "54 03 25 25 25 00 EC 11 EC 11 EC 11 EC 11 EC 11", 0, "B3; BWIPP different encoding (A6)" }, + /* 43*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%A", 0, "54 04 25 25 25 41 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A7)" }, + /* 44*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%A%", 0, "54 04 25 25 41 25 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A7)" }, + /* 45*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%", 0, "54 04 25 41 25 25 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A7)" }, + /* 46*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%%%", 0, "54 04 41 25 25 25 00 EC 11 EC 11 EC 11 EC 11 EC", 0, "B4; BWIPP different encoding (A7)" }, + /* 47*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AA", 0, "54 05 25 25 25 41 41 00 EC 11 EC 11 EC 11 EC 11", 0, "B5; BWIPP different encoding (A8)" }, + /* 48*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AA%%%", 0, "54 05 41 41 25 25 25 00 EC 11 EC 11 EC 11 EC 11", 0, "B5; BWIPP different encoding (A8)" }, + /* 49*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AAA", 0, "54 06 25 25 25 41 41 41 00 EC 11 EC 11 EC 11 EC", 0, "B6; BWIPP different encoding (A9)" }, + /* 50*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%A%", 0, "54 06 41 25 41 25 41 25 00 EC 11 EC 11 EC 11 EC", 0, "B6; BWIPP different encoding (A9)" }, + /* 51*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAAA", 0, "52 04 6D 4D A8 73 0E 60 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, + /* 52*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%AAA", 0, "52 04 6D 43 D1 AE 0E 60 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, + /* 53*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AA%AA", 0, "52 04 6D 43 99 B5 0E 60 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, + /* 54*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAA%A", 0, "52 04 6D 43 98 7A 35 C0 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, + /* 55*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAA%", 0, "52 04 6D 43 98 73 36 A0 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, + /* 56*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%%AAA", 0, "52 04 1E 8D A9 AE 0E 60 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, + /* 57*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AA%%AA", 0, "52 04 1C CD A9 B5 0E 60 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, + /* 58*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAA%%A", 0, "52 04 1C C3 D1 B5 35 C0 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, + /* 59*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAAA%%", 0, "52 04 1C C3 99 B5 36 A0 00 EC 11 EC 11 EC 11 EC", 1, "A6(8)" }, + /* 60*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAAAA", 0, "52 04 ED 4D A8 73 0E 61 40 EC 11 EC 11 EC 11 EC", 1, "A7(9)" }, + /* 61*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%AAAA", 0, "52 04 ED 43 D1 AE 0E 61 40 EC 11 EC 11 EC 11 EC", 1, "A7(9)" }, + /* 62*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AA%AAA", 0, "52 04 ED 43 99 B5 0E 61 40 EC 11 EC 11 EC 11 EC", 1, "A7(9)" }, + /* 63*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAA%AA", 0, "52 04 ED 43 98 7A 35 C1 40 EC 11 EC 11 EC 11 EC", 1, "A7(9)" }, + /* 64*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAA%A", 0, "52 04 ED 43 98 73 36 A1 40 EC 11 EC 11 EC 11 EC", 1, "A7(9)" }, + /* 65*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAAA%", 0, "52 04 ED 43 98 73 0F 44 C0 EC 11 EC 11 EC 11 EC", 1, "A7(9)" }, + /* 66*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AAAAA", 0, "52 05 ED 4D A9 B5 0E 61 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 67*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%A%AAAA", 0, "52 05 ED 4D A8 7A 35 C1 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 68*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AA%AAA", 0, "52 05 ED 4D A8 73 36 A1 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 69*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAA%AA", 0, "52 05 ED 4D A8 73 0F 46 B8 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 70*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAAA%A", 0, "52 05 ED 4D A8 73 0E 66 D4 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 71*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAAAA%", 0, "52 05 ED 4D A8 73 0E 61 E8 98 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 72*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%AAAA", 0, "52 05 ED 43 D1 B5 35 C1 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 73*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AA%%AAA", 0, "52 05 ED 43 99 B5 36 A1 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 74*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAA%%AA", 0, "52 05 ED 43 98 7A 36 A6 B8 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 75*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAA%%A", 0, "52 05 ED 43 98 73 36 A6 D4 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 76*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAAA%%", 0, "52 05 ED 43 98 73 0F 46 D4 98 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 77*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%%%AAAA", 0, "52 05 9E 8D A9 B5 35 C1 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 78*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AA%%%AAA", 0, "52 05 9C CD A9 B5 36 A1 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 79*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAA%%%AA", 0, "52 05 9C C3 D1 B5 36 A6 B8 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 80*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAAA%%%A", 0, "52 05 9C C3 99 B5 36 A6 D4 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 81*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAAAA%%%", 0, "52 05 9C C3 98 7A 36 A6 D4 98 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 82*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%A%AA", 0, "52 05 9E 8D 71 B5 0F 46 B8 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 83*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%AA%A", 0, "52 05 9E 8D 71 B5 0E 66 D4 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 84*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%AAA%", 0, "52 05 9E 8D 71 B5 0E 61 E8 98 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 85*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%A%AAA", 0, "52 05 ED 43 D1 AE 36 A1 CC 28 00 EC 11 EC 11 EC", 1, "A8(11)" }, + /* 86*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%%AAAAAA", 0, "52 07 6D 4D A9 B5 36 A1 CC 39 87 30 00 EC 11 EC", 1, "A10(14)" }, + /* 87*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%A%AAAAA", 0, "52 07 6D 4D A9 B5 0F 46 B8 39 87 30 00 EC 11 EC", 1, "A10(14)" }, + /* 88*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AA%AAAA", 0, "52 07 6D 4D A9 B5 0E 66 D4 39 87 30 00 EC 11 EC", 1, "A10(14)" }, + /* 89*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AAA%AAA", 0, "52 07 6D 4D A9 B5 0E 61 E8 D7 07 30 00 EC 11 EC", 1, "A10(14)" }, + /* 90*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AAAA%AA", 0, "52 07 6D 4D A9 B5 0E 61 CC DA 87 30 00 EC 11 EC", 1, "A10(14)" }, + /* 91*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AAAAA%A", 0, "52 07 6D 4D A9 B5 0E 61 CC 3D 1A E0 00 EC 11 EC", 1, "A10(14)" }, + /* 92*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%%AAAAAA%", 0, "52 07 6D 4D A9 B5 0E 61 CC 39 9B 50 00 EC 11 EC", 1, "A10(14)" }, + /* 93*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%A%%AAAAA", 0, "52 07 6D 4D A8 7A 36 A6 B8 39 87 30 00 EC 11 EC", 1, "A10(14)" }, + /* 94*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AA%%AAAA", 0, "52 07 6D 4D A8 73 36 A6 D4 39 87 30 00 EC 11 EC", 1, "A10(14)" }, + /* 95*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAA%%AAA", 0, "52 07 6D 4D A8 73 0F 46 D4 D7 07 30 00 EC 11 EC", 1, "A10(14)" }, + /* 96*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAAA%%AA", 0, "52 07 6D 4D A8 73 0E 66 D4 DA 87 30 00 EC 11 EC", 1, "A10(14)" }, + /* 97*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAAAA%%A", 0, "52 07 6D 4D A8 73 0E 61 E8 DA 9A E0 00 EC 11 EC", 1, "A10(14)" }, + /* 98*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%%AAAAAA%%", 0, "52 07 6D 4D A8 73 0E 61 CC DA 9B 50 00 EC 11 EC", 1, "A10(14)" }, + /* 99*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%%AAAAA", 0, "52 07 6D 43 D1 B5 36 A6 B8 39 87 30 00 EC 11 EC", 1, "A10(14)" }, + /*100*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AA%%%AAAA", 0, "52 07 6D 43 99 B5 36 A6 D4 39 87 30 00 EC 11 EC", 1, "A10(14)" }, + /*101*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAA%%%AAA", 0, "52 07 6D 43 98 7A 36 A6 D4 D7 07 30 00 EC 11 EC", 1, "A10(14)" }, + /*102*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAA%%%AA", 0, "52 07 6D 43 98 73 36 A6 D4 DA 87 30 00 EC 11 EC", 1, "A10(14)" }, + /*103*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAAA%%%A", 0, "52 07 6D 43 98 73 0F 46 D4 DA 9A E0 00 EC 11 EC", 1, "A10(14)" }, + /*104*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%AAAAAA%%%", 0, "52 07 6D 43 98 73 0E 66 D4 DA 9B 50 00 EC 11 EC", 1, "A10(14)" }, + /*105*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%%%%AAAAA", 0, "52 07 1E 8D A9 B5 36 A6 B8 39 87 30 00 EC 11 EC", 1, "A10(14)" }, + /*106*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AA%%%%AAAA", 0, "52 07 1C CD A9 B5 36 A6 D4 39 87 30 00 EC 11 EC", 1, "A10(14)" }, + /*107*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAA%%%%AAA", 0, "52 07 1C C3 D1 B5 36 A6 D4 D7 07 30 00 EC 11 EC", 1, "A10(14)" }, + /*108*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAAA%%%%AA", 0, "52 07 1C C3 99 B5 36 A6 D4 DA 87 30 00 EC 11 EC", 1, "A10(14)" }, + /*109*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAAAA%%%%A", 0, "52 07 1C C3 98 7A 36 A6 D4 DA 9A E0 00 EC 11 EC", 1, "A10(14)" }, + /*110*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]AAAAAA%%%%", 0, "52 07 1C C3 98 73 36 A6 D4 DA 9B 50 00 EC 11 EC", 1, "A10(14)" }, + /*111*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%A%A%AA", 0, "52 07 1E 8D 71 B5 0F 46 B8 DA 87 30 00 EC 11 EC", 1, "A10(14)" }, + /*112*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%A%AA%A", 0, "52 07 1E 8D 71 B5 0F 46 B8 3D 1A E0 00 EC 11 EC", 1, "A10(14)" }, + /*113*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%A%A%AAA%", 0, "52 07 1E 8D 71 B5 0F 46 B8 39 9B 50 00 EC 11 EC", 1, "A10(14)" }, + /*114*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%A%A%AAA", 0, "52 07 6D 43 D1 AE 36 A1 E8 D7 07 30 00 EC 11 EC", 1, "A10(14)" }, + /*115*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]A%%AA%A%AA", 0, "52 07 1E 8D A9 AE 0F 46 B8 DA 87 30 00 EC 11 EC", 1, "A10(14)" }, + /*116*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%AA%AAA", 0, "52 07 6D 43 D1 B5 35 C1 E8 D7 07 30 00 EC 11 EC", 1, "A10(14)" }, + /*117*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%AAA%AA", 0, "52 07 6D 43 D1 B5 35 C1 CC DA 87 30 00 EC 11 EC", 1, "A10(14)" }, + /*118*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%AAAA%A", 0, "52 07 6D 43 D1 B5 35 C1 CC 3D 1A E0 00 EC 11 EC", 1, "A10(14)" }, + /*119*/ { GS1_MODE | GS1NOCHECK_MODE, 2, 3 << 8, "[]%A%%AAAAA%", 0, "52 07 6D 43 D1 B5 35 C1 CC 39 9B 50 00 EC 11 EC", 1, "A10(14)" }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -8591,15 +8593,17 @@ static void test_rmqr_gs1(const testCtx *const p_ctx) { /* 1*/ { GS1_MODE | GS1PARENS_MODE, "(01)12345678901231", 0, "A6 00 59 D5 1B EF 43 D8 80 EC 11 EC", "N16" }, /* 2*/ { GS1_MODE, "[01]04912345123459[15]970331[30]128[10]ABC123", 0, "A5 D0 29 EB 3A A0 05 67 93 F2 94 B4 B4 E2 4E AF 01 47 EC 17 86", "N29 A9" }, /* 3*/ { GS1_MODE | GS1PARENS_MODE, "(01)04912345123459(15)970331(30)128(10)ABC123", 0, "A5 D0 29 EB 3A A0 05 67 93 F2 94 B4 B4 E2 4E AF 01 47 EC 17 86", "N29 A9" }, - /* 4*/ { GS1_MODE, "[91]12%[20]12", 0, "A4 9C 79 32 25 1D 24 32 48 00 EC 11", "N4 B2 N4" }, - /* 5*/ { GS1_MODE, "[91]123%[20]12", 0, "A4 BC 79 76 44 A3 A4 86 49 00 EC 11", "N5 B2 N4" }, - /* 6*/ { GS1_MODE, "[91]1234%[20]12", 0, "A4 DC 79 D4 C8 94 74 90 C9 20 EC 11", "N6 B2 N4" }, - /* 7*/ { GS1_MODE, "[91]12345%[20]12", 0, "A4 FC 79 D4 AC 89 47 49 0C 92 00 EC", "N7 B2 N4" }, - /* 8*/ { GS1_MODE, "[91]1A%[20]12", 0, "A8 E6 58 1B ED 49 89 0C 92 00 EC 11", "A6(7) N4" }, - /* 9*/ { GS1_MODE, "[91]%%[20]12", 0, "A4 56 D9 92 92 8E 92 19 24 00 EC 11", "N2 B3 N4" }, - /* 10*/ { GS1_MODE, "[91]%%%[20]12", 0, "A4 56 DA 12 92 92 8E 92 19 24 00 EC", "N2 B4 N4" }, - /* 11*/ { GS1_MODE, "[91]A%%%%12345678A%A", 0, "AC E7 26 28 24 A4 A4 A4 A4 81 ED C8 9C 88 7A 35 C0 EC 11", "B7 N8 A3(4)" }, - /* 12*/ { GS1_MODE, "[91]%23%%6789%%%34567%%%%234%%%%%", 0, "(33) A9 43 2D B5 02 EE D4 DA 84 54 B8 ED 4D A9 B5 08 55 66 1B 30 94 94 94 94 C8 CC D0 94", "A14(20) N5 B12" }, + /* 4*/ { GS1_MODE, "[10]()", 0, "A4 85 34 50 52", "" }, + /* 5*/ { GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, "(10)\\(\\)", 0, "A4 85 34 50 52", "" }, + /* 6*/ { GS1_MODE, "[91]12%[20]12", 0, "A4 9C 79 32 25 1D 24 32 48 00 EC 11", "N4 B2 N4" }, + /* 7*/ { GS1_MODE, "[91]123%[20]12", 0, "A4 BC 79 76 44 A3 A4 86 49 00 EC 11", "N5 B2 N4" }, + /* 8*/ { GS1_MODE, "[91]1234%[20]12", 0, "A4 DC 79 D4 C8 94 74 90 C9 20 EC 11", "N6 B2 N4" }, + /* 9*/ { GS1_MODE, "[91]12345%[20]12", 0, "A4 FC 79 D4 AC 89 47 49 0C 92 00 EC", "N7 B2 N4" }, + /* 10*/ { GS1_MODE, "[91]1A%[20]12", 0, "A8 E6 58 1B ED 49 89 0C 92 00 EC 11", "A6(7) N4" }, + /* 11*/ { GS1_MODE, "[91]%%[20]12", 0, "A4 56 D9 92 92 8E 92 19 24 00 EC 11", "N2 B3 N4" }, + /* 12*/ { GS1_MODE, "[91]%%%[20]12", 0, "A4 56 DA 12 92 92 8E 92 19 24 00 EC", "N2 B4 N4" }, + /* 13*/ { GS1_MODE, "[91]A%%%%12345678A%A", 0, "AC E7 26 28 24 A4 A4 A4 A4 81 ED C8 9C 88 7A 35 C0 EC 11", "B7 N8 A3(4)" }, + /* 14*/ { GS1_MODE, "[91]%23%%6789%%%34567%%%%234%%%%%", 0, "(33) A9 43 2D B5 02 EE D4 DA 84 54 B8 ED 4D A9 B5 08 55 66 1B 30 94 94 94 94 C8 CC D0 94", "A14(20) N5 B12" }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_ultra.c b/backend/tests/test_ultra.c index b0738130..ecf7de0d 100644 --- a/backend/tests/test_ultra.c +++ b/backend/tests/test_ultra.c @@ -241,41 +241,43 @@ static void test_input(const testCtx *const p_ctx) { /* 36*/ { GS1_MODE, 0, -1, -1, -1, { 0, 0, "" }, "[17]120508[10]ABCD1234[410]9501101020917", 0, "(34) 273 23 92 146 180 275 49 42 208 30 283 4 145 140 133 136 138 65 66 67 68 140 162 272", 3, "Mode: a (35)" }, /* 37*/ { GS1_MODE, 0, -1, -1, -1, { 0, 0, "" }, "[17]120508[10]ABCDEFGHI[410]9501101020917", 0, "(38) 273 26 217 78 184 22 66 98 36 49 268 35 283 6 145 140 133 136 138 65 66 67 68 69 70 71", 3, "Mode: a (36)" }, /* 38*/ { GS1_MODE | GS1PARENS_MODE, 0, -1, -1, -1, { 0, 0, "" }, "(17)120508(10)ABCDEFGHI(410)9501101020917", 0, "(38) 273 26 217 78 184 22 66 98 36 49 268 35 283 6 145 140 133 136 138 65 66 67 68 69 70 71", 3, "Mode: a (36)" }, - /* 39*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ftp://", 0, "(16) 272 6 43 99 160 36 225 13 74 13 283 4 278 269 165 7", 3, "Mode: c (6)" }, - /* 40*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, ".cgi", 0, "(16) 272 6 72 105 164 44 130 49 274 13 283 4 278 274 131 7", 3, "Mode: c (4)" }, - /* 41*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ftp://a.cgi", 0, "(18) 272 8 47 217 205 207 140 122 193 15 283 4 280 269 123 274 131 7", 3, "Mode: c (11)" }, - /* 42*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "e: file:f.shtml !", 0, "(24) 272 14 205 34 221 141 167 101 200 21 283 4 280 30 94 236 235 72 233 39 52 267 250 7", 3, "Mode: c (17)" }, - /* 43*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Aaatel:", 0, "(18) 272 8 103 151 197 33 149 230 243 15 283 4 280 262 76 6 89 7", 3, "Mode: c (7)" }, - /* 44*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Aatel:a", 0, "(18) 272 8 158 157 143 212 100 83 119 15 283 4 280 262 76 271 161 7", 3, "Mode: c (7)" }, - /* 45*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Atel:aAa", 0, "(20) 272 10 28 218 160 220 32 184 43 17 283 4 275 6 89 275 148 0 42 7", 3, "Mode: c (8)" }, - /* 46*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "tel:AAaa", 0, "(20) 272 10 75 275 26 136 192 36 62 17 283 4 275 271 161 6 28 262 118 7", 3, "Mode: c (8)" }, - /* 47*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "AAaatel:aA", 0, "(22) 272 12 79 54 35 200 219 167 35 19 283 4 276 0 42 0 41 118 46 6 156 7", 3, "Mode: c (10)" }, - /* 48*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "émailto:étel:éfile:éhttp://éhttps://éftp://", 0, "(30) 257 20 33 67 268 39 159 274 263 27 283 4 233 276 282 233 277 282 233 278 282 233 279", 3, "Mode: 8ccccccc8cccc8ccccc8ccccccc8cccccccc8cccccc (43)" }, - /* 49*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "éhttp://www.url.com", 0, "(22) 257 11 247 165 271 99 210 202 139 18 283 4 233 279 269 186 113 81 45 252 284 7", 3, "Mode: 8cccccccccccccccccc (19)" }, - /* 50*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "éhttps://www.url.com", 0, "(22) 257 11 280 218 172 261 180 78 134 18 283 4 233 280 269 186 113 81 45 252 284 7", 3, "Mode: 8ccccccccccccccccccc (20)" }, - /* 51*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "http://url.com", 0, "(20) 281 10 31 75 167 216 44 85 246 17 283 4 117 114 108 46 99 111 109 7", 3, "Mode: 8888888 (7)" }, - /* 52*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "https://url.com", 0, "(20) 282 10 164 150 180 20 226 234 261 17 283 4 117 114 108 46 99 111 109 7", 3, "Mode: 8888888 (7)" }, - /* 53*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "http://url.com", 0, "(18) 281 8 126 2 233 149 39 184 232 15 283 4 262 133 216 269 251 7", 3, "Mode: ccccccc (7)" }, - /* 54*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "https://url.com", 0, "(18) 282 8 280 103 268 218 6 16 191 15 283 4 262 133 216 269 251 7", 3, "Mode: ccccccc (7)" }, - /* 55*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "{", 0, "(14) 272 4 247 194 225 139 47 170 259 11 283 4 123 7", 3, "Mode: a (1)" }, - /* 56*/ { UNICODE_MODE, 0, -1, -1, -1, { 2, 3, "" }, "A", 0, "(16) 257 5 193 57 23 46 46 104 35 12 283 74 157 65 284 7", 3, "" }, - /* 57*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 1, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 596: Structured Append count '1' out of range (2 to 8)", -1, "" }, - /* 58*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 9, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 596: Structured Append count '9' out of range (2 to 8)", -1, "" }, - /* 59*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 597: Structured Append index '0' out of range (1 to count 3)", -1, "" }, - /* 60*/ { UNICODE_MODE, 0, -1, -1, -1, { 4, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 597: Structured Append index '4' out of range (1 to count 3)", -1, "" }, - /* 61*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "0" }, "A", 0, "(16) 257 5 41 170 63 200 4 85 166 12 283 74 203 65 284 7", 3, "" }, - /* 62*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "80088" }, "A", 0, "(18) 257 7 240 112 147 275 67 164 275 14 283 74 273 282 282 65 284 7", 3, "" }, - /* 63*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "123456" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 593: Structured Append ID length 6 too long (5 digit maximum)", -1, "" }, - /* 64*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "A" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 594: Invalid Structured Append ID (digits only)", -1, "" }, - /* 65*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "80089" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 595: Structured Append ID value '80089' out of range (1 to 80088)", -1, "" }, - /* 66*/ { UNICODE_MODE, 0, -1, 3, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 592: Revision '3' out of range (1 or 2 only)", -1, "" }, - /* 67*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "A", 0, "(14) 257 4 100 2 78 70 131 251 169 11 283 4 65 7", 3, "" }, - /* 68*/ { UNICODE_MODE, 0, 1, -1, -1, { 0, 0, "" }, "A", 0, "(10) 257 4 224 122 261 7 283 0 65 3", 1, "" }, - /* 69*/ { UNICODE_MODE, 0, 2, -1, -1, { 0, 0, "" }, "A", 0, "(14) 257 4 73 147 175 89 77 248 10 283 3 65 284 6", 2, "" }, - /* 70*/ { UNICODE_MODE, 0, 3, -1, -1, { 0, 0, "" }, "A", 0, "(14) 257 4 100 2 78 70 131 251 169 11 283 4 65 7", 3, "" }, - /* 71*/ { UNICODE_MODE, 0, 4, -1, -1, { 0, 0, "" }, "A", 0, "(16) 257 4 157 71 251 225 57 250 69 40 82 13 283 6 65 9", 4, "" }, - /* 72*/ { UNICODE_MODE, 0, 5, -1, -1, { 0, 0, "" }, "A", 0, "(18) 257 4 90 195 35 197 81 56 120 116 278 62 217 15 283 8 65 11", 5, "" }, - /* 73*/ { UNICODE_MODE, 0, 6, -1, -1, { 0, 0, "" }, "A", 0, "(20) 257 4 255 264 113 138 228 183 42 193 225 1 248 147 100 17 283 10 65 13", 6, "" }, + /* 39*/ { GS1_MODE, 0, -1, -1, -1, { 0, 0, "" }, "[10]A(B)C", 0, "(20) 273 9 144 124 52 78 147 225 98 16 283 4 138 65 40 66 41 67 284 7", 3, "" }, + /* 40*/ { GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, 0, -1, -1, -1, { 0, 0, "" }, "(10)A\\(B\\)C", 0, "(20) 273 9 144 124 52 78 147 225 98 16 283 4 138 65 40 66 41 67 284 7", 3, "" }, + /* 41*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ftp://", 0, "(16) 272 6 43 99 160 36 225 13 74 13 283 4 278 269 165 7", 3, "Mode: c (6)" }, + /* 42*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, ".cgi", 0, "(16) 272 6 72 105 164 44 130 49 274 13 283 4 278 274 131 7", 3, "Mode: c (4)" }, + /* 43*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "ftp://a.cgi", 0, "(18) 272 8 47 217 205 207 140 122 193 15 283 4 280 269 123 274 131 7", 3, "Mode: c (11)" }, + /* 44*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "e: file:f.shtml !", 0, "(24) 272 14 205 34 221 141 167 101 200 21 283 4 280 30 94 236 235 72 233 39 52 267 250 7", 3, "Mode: c (17)" }, + /* 45*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Aaatel:", 0, "(18) 272 8 103 151 197 33 149 230 243 15 283 4 280 262 76 6 89 7", 3, "Mode: c (7)" }, + /* 46*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Aatel:a", 0, "(18) 272 8 158 157 143 212 100 83 119 15 283 4 280 262 76 271 161 7", 3, "Mode: c (7)" }, + /* 47*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "Atel:aAa", 0, "(20) 272 10 28 218 160 220 32 184 43 17 283 4 275 6 89 275 148 0 42 7", 3, "Mode: c (8)" }, + /* 48*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "tel:AAaa", 0, "(20) 272 10 75 275 26 136 192 36 62 17 283 4 275 271 161 6 28 262 118 7", 3, "Mode: c (8)" }, + /* 49*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "AAaatel:aA", 0, "(22) 272 12 79 54 35 200 219 167 35 19 283 4 276 0 42 0 41 118 46 6 156 7", 3, "Mode: c (10)" }, + /* 50*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "émailto:étel:éfile:éhttp://éhttps://éftp://", 0, "(30) 257 20 33 67 268 39 159 274 263 27 283 4 233 276 282 233 277 282 233 278 282 233 279", 3, "Mode: 8ccccccc8cccc8ccccc8ccccccc8cccccccc8cccccc (43)" }, + /* 51*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "éhttp://www.url.com", 0, "(22) 257 11 247 165 271 99 210 202 139 18 283 4 233 279 269 186 113 81 45 252 284 7", 3, "Mode: 8cccccccccccccccccc (19)" }, + /* 52*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "éhttps://www.url.com", 0, "(22) 257 11 280 218 172 261 180 78 134 18 283 4 233 280 269 186 113 81 45 252 284 7", 3, "Mode: 8ccccccccccccccccccc (20)" }, + /* 53*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "http://url.com", 0, "(20) 281 10 31 75 167 216 44 85 246 17 283 4 117 114 108 46 99 111 109 7", 3, "Mode: 8888888 (7)" }, + /* 54*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "https://url.com", 0, "(20) 282 10 164 150 180 20 226 234 261 17 283 4 117 114 108 46 99 111 109 7", 3, "Mode: 8888888 (7)" }, + /* 55*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "http://url.com", 0, "(18) 281 8 126 2 233 149 39 184 232 15 283 4 262 133 216 269 251 7", 3, "Mode: ccccccc (7)" }, + /* 56*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "https://url.com", 0, "(18) 282 8 280 103 268 218 6 16 191 15 283 4 262 133 216 269 251 7", 3, "Mode: ccccccc (7)" }, + /* 57*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "{", 0, "(14) 272 4 247 194 225 139 47 170 259 11 283 4 123 7", 3, "Mode: a (1)" }, + /* 58*/ { UNICODE_MODE, 0, -1, -1, -1, { 2, 3, "" }, "A", 0, "(16) 257 5 193 57 23 46 46 104 35 12 283 74 157 65 284 7", 3, "" }, + /* 59*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 1, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 596: Structured Append count '1' out of range (2 to 8)", -1, "" }, + /* 60*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 9, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 596: Structured Append count '9' out of range (2 to 8)", -1, "" }, + /* 61*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 597: Structured Append index '0' out of range (1 to count 3)", -1, "" }, + /* 62*/ { UNICODE_MODE, 0, -1, -1, -1, { 4, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 597: Structured Append index '4' out of range (1 to count 3)", -1, "" }, + /* 63*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "0" }, "A", 0, "(16) 257 5 41 170 63 200 4 85 166 12 283 74 203 65 284 7", 3, "" }, + /* 64*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "80088" }, "A", 0, "(18) 257 7 240 112 147 275 67 164 275 14 283 74 273 282 282 65 284 7", 3, "" }, + /* 65*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "123456" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 593: Structured Append ID length 6 too long (5 digit maximum)", -1, "" }, + /* 66*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "A" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 594: Invalid Structured Append ID (digits only)", -1, "" }, + /* 67*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "80089" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 595: Structured Append ID value '80089' out of range (1 to 80088)", -1, "" }, + /* 68*/ { UNICODE_MODE, 0, -1, 3, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 592: Revision '3' out of range (1 or 2 only)", -1, "" }, + /* 69*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "A", 0, "(14) 257 4 100 2 78 70 131 251 169 11 283 4 65 7", 3, "" }, + /* 70*/ { UNICODE_MODE, 0, 1, -1, -1, { 0, 0, "" }, "A", 0, "(10) 257 4 224 122 261 7 283 0 65 3", 1, "" }, + /* 71*/ { UNICODE_MODE, 0, 2, -1, -1, { 0, 0, "" }, "A", 0, "(14) 257 4 73 147 175 89 77 248 10 283 3 65 284 6", 2, "" }, + /* 72*/ { UNICODE_MODE, 0, 3, -1, -1, { 0, 0, "" }, "A", 0, "(14) 257 4 100 2 78 70 131 251 169 11 283 4 65 7", 3, "" }, + /* 73*/ { UNICODE_MODE, 0, 4, -1, -1, { 0, 0, "" }, "A", 0, "(16) 257 4 157 71 251 225 57 250 69 40 82 13 283 6 65 9", 4, "" }, + /* 74*/ { UNICODE_MODE, 0, 5, -1, -1, { 0, 0, "" }, "A", 0, "(18) 257 4 90 195 35 197 81 56 120 116 278 62 217 15 283 8 65 11", 5, "" }, + /* 75*/ { UNICODE_MODE, 0, 6, -1, -1, { 0, 0, "" }, "A", 0, "(20) 257 4 255 264 113 138 228 183 42 193 225 1 248 147 100 17 283 10 65 13", 6, "" }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index 2c36ed42..66dc8ae7 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -2574,32 +2574,67 @@ int testUtilCanBwipp(int index, const struct zint_symbol *symbol, int option_1, } /* Convert Zint GS1 and add-on format to BWIPP's */ -static void testUtilBwippCvtGS1Data(char *bwipp_data, const int upcean, const int parens_mode, int *addon_posn) { - char *b; +static char *testUtilBwippCvtGS1Data(char *bwipp_data, const int bwipp_data_size, const int upcean, + const int parens_mode, const int parens_esc_mode, int *addon_posn, int *parens_esc) { + char *b = bwipp_data, *c; + char *be = b + bwipp_data_size; int pipe = 0; + const int length = (int) strlen(bwipp_data); + char *cpy = (char *) z_alloca(length + 1); + memcpy(cpy, bwipp_data, length + 1); *addon_posn = 0; - for (b = bwipp_data; *b; b++) { - if (upcean && *b == '|') { - pipe = 1; - } - if (!parens_mode && *b == '[') { - *b = '('; - } else if (!parens_mode && *b == ']') { - *b = ')'; - } else if ((*b == '+' || *b == ' ') && upcean && !pipe) { - *b = ' '; - *addon_posn = b - bwipp_data; + *parens_esc = 0; + for (c = cpy; b < be && *c; b++, c++) { + if ((!parens_mode && (*c == '(' || *c == ')')) + || (parens_esc_mode && *c == '\\' && (c[1] == '(' || c[1] == ')'))) { + if (b + 4 >= be) { + fprintf(stderr, "testUtilBwippCvtGS1Data: parenthesis bwipp_data buffer full (%d)\n", + bwipp_data_size); + return NULL; + } + *b++ = '^'; + *b++ = '0'; + *b++ = '4'; + if (!parens_mode) { + *b = '0' + (*c == ')'); + } else { + *b = '0' + (c[1] == ')'); + c++; + } + *parens_esc = 1; + } else { + if (upcean && *c == '|') { + pipe = 1; + } + if (!parens_mode && *c == '[') { + *b = '('; + } else if (!parens_mode && *c == ']') { + *b = ')'; + } else if ((*c == '+' || *c == ' ') && upcean && !pipe) { + *b = ' '; + *addon_posn = b - bwipp_data; + } else { + *b = *c; + } } } + + if (b >= be) { + fprintf(stderr, "testUtilBwippCvtGS1Data: bwipp_data buffer full (%d)\n", bwipp_data_size); + return NULL; + } + *b = '\0'; + + return bwipp_data; } #define z_isxdigit(c) (z_isdigit(c) || ((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f')) #define z_isodigit(c) ((c) <= '7' && (c) >= '0') /* Convert data to Ghostscript format for passing to bwipp_dump.ps */ -static char *testUtilBwippEscape(char *bwipp_data, int bwipp_data_size, const char *data, int length, - int zint_escape_mode, int eci, int *parse, int *parsefnc) { +static char *testUtilBwippEscape(char *bwipp_data, const int bwipp_data_size, const char *data, const int length, + const int zint_escape_mode, const int eci, int *parse, int *parsefnc) { char *b = bwipp_data; char *be = b + bwipp_data_size; unsigned char *d = (unsigned char *) data; @@ -2863,7 +2898,9 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int const int parens_mode = symbol->input_mode & GS1PARENS_MODE; const char obracket = parens_mode ? '(' : '['; const char cbracket = parens_mode ? ')' : ']'; + const int parens_esc_mode = parens_mode && (symbol->input_mode & ESCAPE_MODE); int addon_posn; + int parens_esc; int eci; int i, j, len; @@ -2904,17 +2941,24 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int return -1; } if (*primary != obracket && !upcean) { - strcat(bwipp_data, "(01)"); + strcat(bwipp_data, parens_mode ? "(01)" : "[01]"); } strcat(bwipp_data, primary); strcat(bwipp_data, "|"); strcat(bwipp_data, data); - testUtilBwippCvtGS1Data(bwipp_data, upcean, parens_mode, &addon_posn); + if (testUtilBwippCvtGS1Data(bwipp_data, bwipp_data_size, upcean, parens_mode, parens_esc_mode, &addon_posn, + &parens_esc) == NULL) { + return -1; + } /* Always set dontlint for now (until support for exclusive AIs check) */ sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%sdontlint", strlen(bwipp_opts_buf) ? " " : ""); bwipp_opts = bwipp_opts_buf; + if (parens_esc) { + sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%sparse", strlen(bwipp_opts_buf) ? " " : ""); + } + if (upcean) { if (symbology == BARCODE_EANX_CC && (primary_len <= 8 || (addon_posn && addon_posn <= 8))) { bwipp_barcode = "ean8composite"; @@ -2944,15 +2988,23 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int } else { if (gs1_cvt) { if (*data != obracket && !upcean) { - strcat(bwipp_data, symbology == BARCODE_NVE18 ? "(00)" : "(01)"); + strcat(bwipp_data, symbology == BARCODE_NVE18 ? parens_mode ? "(00)" : "[00]" + : parens_mode ? "(01)" : "[01]"); } strcat(bwipp_data, data); - testUtilBwippCvtGS1Data(bwipp_data, upcean, parens_mode, &addon_posn); + if (testUtilBwippCvtGS1Data(bwipp_data, bwipp_data_size, upcean, parens_mode, parens_esc_mode, + &addon_posn, &parens_esc) == NULL) { + return -1; + } /* Always set dontlint for now (until support for exclusive AIs check) */ sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%sdontlint", strlen(bwipp_opts_buf) ? " " : ""); bwipp_opts = bwipp_opts_buf; + if (parens_esc) { + sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%sparse", strlen(bwipp_opts_buf) ? " " : ""); + } + if (upcean) { if ((symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK) && (data_len <= 8 || (addon_posn && addon_posn <= 8))) { @@ -4295,8 +4347,8 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in expected = escaped; } if (gs1 && symbology != BARCODE_EAN14 && symbology != BARCODE_NVE18) { - ret = gs1_verify(symbol, (const unsigned char *) expected, expected_len, (unsigned char *) reduced, - &expected_len); + int len = expected_len; + ret = gs1_verify(symbol, ZUCP(expected), &len, ZUCP(reduced), &expected_len); if (ret >= ZINT_ERROR) { sprintf(msg, "gs1_verify %d != 0", ret); return 3; diff --git a/backend/tests/testcommon.h b/backend/tests/testcommon.h index 7098f122..5264f2f0 100644 --- a/backend/tests/testcommon.h +++ b/backend/tests/testcommon.h @@ -131,6 +131,7 @@ void assert_notequal(int e1, int e2, const char *fmt, ...); #define assert_notequal(e1, e2, ...) assert_exp((e1) != (e2), __VA_ARGS__) #endif +/* TODO: replace these with `ZUCP()`, `ZCUCP()` & `ZCCP()` resp. */ #define TU(p) ((unsigned char *) (p)) #define TCU(p) ((const unsigned char *) (p)) #define TCC(p) ((const char *) (p)) diff --git a/backend/tools/gen_gs1_lint.php b/backend/tools/gen_gs1_lint.php index cff70348..18f5897d 100644 --- a/backend/tools/gen_gs1_lint.php +++ b/backend/tools/gen_gs1_lint.php @@ -133,13 +133,13 @@ foreach ($lines as $line) { $max = (int) substr($matches[3], 2); } if ($matches[1] === 'N') { - $validator = "numeric"; + $validator = "gs1_numeric"; } elseif ($matches[1] === 'X') { - $validator = "cset82"; + $validator = "gs1_cset82"; } elseif ($matches[1] === 'Y') { - $validator = "cset39"; + $validator = "gs1_cset39"; } else { // 'Z' - $validator = "cset64"; + $validator = "gs1_cset64"; } } else if (preg_match('/^\[([NXYZ])([1-9]+)?(\.\.[0-9|]+)?\]$/', $validator, $matches)) { if (count($matches) === 3) { @@ -150,13 +150,13 @@ foreach ($lines as $line) { $max = (int) substr($matches[3], 2); } if ($matches[1] === 'N') { - $validator = "numeric"; + $validator = "gs1_numeric"; } elseif ($matches[1] === 'X') { - $validator = "cset82"; + $validator = "gs1_cset82"; } elseif ($matches[1] === 'Y') { - $validator = "cset39"; + $validator = "gs1_cset39"; } else { // 'Z' - $validator = "cset64"; + $validator = "gs1_cset64"; } } else { exit("$basename:" . __LINE__ . " ERROR: Could not parse validator \"$validator\" line $line_no" @@ -288,7 +288,7 @@ EOD; // Print the spec validator/checkers functions foreach ($spec_parts as $spec => $spec_part) { - $spec_funcs[$spec] = $spec_func = str_replace(array(' ', '.', ',', '[', ']'), '_', strtolower($spec)); + $spec_funcs[$spec] = $spec_func = 'gs1_' . str_replace(array(' ', '.', ',', '[', ']'), '_', strtolower($spec)); $comment = ''; if (isset($spec_comments[$spec])) { $comment = ' (Used by'; @@ -327,7 +327,7 @@ EOD; foreach ($checkers as $checker) { print << - + @@ -1404,6 +1404,20 @@ table below.

Record Separator +\( +0x28 +( +Opening parenthesis (only with +--gs1parens) + + +\) +0x29 +) +Closing parenthesis (only with +--gs1parens) + + \\ 0x5C \ @@ -4035,7 +4049,8 @@ sequences. GS1PARENS_MODE Parentheses (round brackets) used in GS1 data instead of square brackets to delimit Application Identifiers -(parentheses must not otherwise occur in the data). +(parentheses in the data must be escaped and ESCAPE_MODE +selected). GS1NOCHECK_MODE @@ -5059,11 +5074,13 @@ symbology is defined by the GS1 General Specifications. Application Identifiers (AIs) should be entered using [square bracket] notation. These will be converted to parentheses (round brackets) for the Human Readable Text. This method allows the inclusion of parentheses in the AI -data.

-

For compatibility with data entry in other systems, if the data does -not include parentheses, the option --gs1parens (API -input_mode |= GS1PARENS_MODE) may be used to signal that -AIs are encased in round brackets instead of square ones.

+data without escaping.

+

For compatibility with data entry in other systems, the option +--gs1parens (API input_mode |= GS1PARENS_MODE) +may be used to signal that AIs are encased in parentheses. If there are +any parentheses in the AI data, they must be escaped with a backslash +(\( or \)) and the option --esc +(API input_mode |= ESCAPE_MODE) selected.

Fixed length data should be entered at the appropriate length for correct encoding. GS1-128 does not support extended ASCII (ISO/IEC 8859-1) characters. Check digits for GTIN data AI (01) are not generated @@ -5242,10 +5259,10 @@ aria-hidden="true">zint -b DBAR_EXP --compliantheight -d "[01]988987654321 capable of encoding data from a number of AIs in a single symbol. AIs should be encased in [square brackets] in the input data, which will be displayed as parentheses (round brackets) in the Human Readable Text. -This method allows the inclusion of parentheses in the AI data. If the -data does not include parentheses, the AIs may alternatively be encased -in parentheses using the --gs1parens switch - see 6.1.10.3 GS1-128.

+This method allows the inclusion of parentheses in the AI data without +escaping. The AIs may alternatively be encased in parentheses using the +--gs1parens switch - see 6.1.10.3 +GS1-128.

The GTIN-14 data for AI (01) must include the standard GS1 check digit as this is not calculated by Zint when this symbology is encoded. Data for fixed-length AIs must be entered at the appropriate length. The @@ -9123,6 +9140,10 @@ are:

\e (0x1B) ESC Escape \G (0x1D) GS Group Separator \R (0x1E) RS Record Separator +\( (0x28) ( Opening parenthesis (only with + --gs1parens) +\) (0x29) ) Closing parenthesis (only with + --gs1parens) \\ (0x5C) \ Backslash \dNNN (NNN) Any 8-bit character where NNN is decimal (000-255) @@ -9182,8 +9203,9 @@ should be placed in square brackets "[]" (but see
--gs1parens

Process parentheses "()" as GS1 AI delimiters, rather -than square brackets "[]". The input data must not -otherwise contain parentheses.

+than square brackets "[]". If the AI data contains +parentheses, they must be backslashed ("\(" or +"\)") and the --esc option selected.

--gssep
diff --git a/docs/manual.pmd b/docs/manual.pmd index 9d4f713e..87f26242 100644 --- a/docs/manual.pmd +++ b/docs/manual.pmd @@ -521,10 +521,10 @@ Non-printing characters can be entered on the command line using backslash (`\`) as an escape character in combination with the `--esc` switch. Permissible sequences are shown in the table below. ---------------------------------------------------------------------------- +----------------------------------------------------------------------------- Escape ASCII Name Interpretation Sequence Equivalent ----------- ---------- ----- ------------------------------------------- +---------- ---------- ----- --------------------------------------------- `\0` 0x00 `NUL` Null character `\E` 0x04 `EOT` End of Transmission @@ -549,6 +549,10 @@ Sequence Equivalent `\R` 0x1E `RS` Record Separator +`\(` 0x28 `(` Opening parenthesis (only with `--gs1parens`) + +`\)` 0x29 `)` Closing parenthesis (only with `--gs1parens`) + `\\` 0x5C `\` Backslash `\dNNN` NNN Any 8-bit character where NNN is decimal @@ -565,7 +569,7 @@ Sequence Equivalent `\UNNNNNN` Any 21-bit Unicode character where NNNNNN is hexadecimal (000000-10FFFF) ---------------------------------------------------------------------------- +----------------------------------------------------------------------------- Table: {#tbl:escape_sequences tag=": Escape Sequences"} @@ -2379,7 +2383,8 @@ Value Effect `GS1PARENS_MODE` Parentheses (round brackets) used in GS1 data instead of square brackets to delimit Application Identifiers - (parentheses must not otherwise occur in the data). + (parentheses in the data must be escaped and `ESCAPE_MODE` + selected). `GS1NOCHECK_MODE` Do not check GS1 data for validity, i.e. suppress checks for valid AIs and data lengths. Invalid characters (e.g. @@ -3322,11 +3327,13 @@ A variation of Code 128 previously known as UCC/EAN-128, this symbology is defined by the GS1 General Specifications. Application Identifiers (AIs) should be entered using [square bracket] notation. These will be converted to parentheses (round brackets) for the Human Readable Text. This method allows the -inclusion of parentheses in the AI data. +inclusion of parentheses in the AI data without escaping. -For compatibility with data entry in other systems, if the data does not include -parentheses, the option `--gs1parens` (API `input_mode |= GS1PARENS_MODE`) may -be used to signal that AIs are encased in round brackets instead of square ones. +For compatibility with data entry in other systems, the option `--gs1parens` +(API `input_mode |= GS1PARENS_MODE`) may be used to signal that AIs are encased +in parentheses. If there are any parentheses in the AI data, they must be +escaped with a backslash (`\(` or `\)`) and the option `--esc` (API `input_mode +|= ESCAPE_MODE`) selected. Fixed length data should be entered at the appropriate length for correct encoding. GS1-128 does not support extended ASCII (ISO/IEC 8859-1) characters. @@ -3353,8 +3360,6 @@ digits entered, or a 14-digit number if the standard GS1 check digit is given, in which case the check digit will be verified. The GS1 check digit (if not given) and HRT-only AI `"(01)"` are added by Zint. -\clearpage - #### 6.1.10.5 NVE-18 (SSCC-18) ![`zint -b NVE18 --compliantheight -d @@ -3477,9 +3482,8 @@ Previously known as RSS Expanded this is a variable length symbology capable of encoding data from a number of AIs in a single symbol. AIs should be encased in [square brackets] in the input data, which will be displayed as parentheses (round brackets) in the Human Readable Text. This method allows the inclusion of -parentheses in the AI data. If the data does not include parentheses, the AIs -may alternatively be encased in parentheses using the `--gs1parens` switch - see -[6.1.10.3 GS1-128]. +parentheses in the AI data without escaping. The AIs may alternatively be +encased in parentheses using the `--gs1parens` switch - see [6.1.10.3 GS1-128]. The GTIN-14 data for AI (01) must include the standard GS1 check digit as this is not calculated by Zint when this symbology is encoded. Data for fixed-length diff --git a/docs/manual.txt b/docs/manual.txt index d1e28278..87b2f49e 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -676,10 +676,10 @@ Non-printing characters can be entered on the command line using backslash (\) as an escape character in combination with the --esc switch. Permissible sequences are shown in the table below. - ---------------------------------------------------------------------------- + ------------------------------------------------------------------------------ Escape ASCII Name Interpretation Sequence Equivalent - ----------- ------------ ------- ------------------------------------------- + ----------- ------------ ------- --------------------------------------------- \0 0x00 NUL Null character \E 0x04 EOT End of Transmission @@ -704,6 +704,10 @@ sequences are shown in the table below. \R 0x1E RS Record Separator + \( 0x28 ( Opening parenthesis (only with --gs1parens) + + \) 0x29 ) Closing parenthesis (only with --gs1parens) + \\ 0x5C \ Backslash \dNNN NNN Any 8-bit character where NNN is decimal @@ -718,9 +722,9 @@ sequences are shown in the table below. \uNNNN Any 16-bit Unicode BMP[2] character where NNNN is hexadecimal (0000-FFFF) - \UNNNNNN Any 21-bit Unicode character where NNNNNN - is hexadecimal (000000-10FFFF) - ---------------------------------------------------------------------------- + \UNNNNNN Any 21-bit Unicode character where NNNNNN is + hexadecimal (000000-10FFFF) + ------------------------------------------------------------------------------ Table : Escape Sequences @@ -2359,7 +2363,8 @@ member. Valid values are shown in the table below. GS1PARENS_MODE Parentheses (round brackets) used in GS1 data instead of square brackets to delimit Application Identifiers - (parentheses must not otherwise occur in the data). + (parentheses in the data must be escaped and ESCAPE_MODE + selected). GS1NOCHECK_MODE Do not check GS1 data for validity, i.e. suppress checks for valid AIs and data lengths. Invalid characters (e.g. @@ -3198,11 +3203,13 @@ A variation of Code 128 previously known as UCC/EAN-128, this symbology is defined by the GS1 General Specifications. Application Identifiers (AIs) should be entered using [square bracket] notation. These will be converted to parentheses (round brackets) for the Human Readable Text. This method allows the -inclusion of parentheses in the AI data. +inclusion of parentheses in the AI data without escaping. -For compatibility with data entry in other systems, if the data does not include -parentheses, the option --gs1parens (API input_mode |= GS1PARENS_MODE) may be -used to signal that AIs are encased in round brackets instead of square ones. +For compatibility with data entry in other systems, the option --gs1parens (API +input_mode |= GS1PARENS_MODE) may be used to signal that AIs are encased in +parentheses. If there are any parentheses in the AI data, they must be escaped +with a backslash (\( or \)) and the option --esc (API input_mode |= ESCAPE_MODE) +selected. Fixed length data should be entered at the appropriate length for correct encoding. GS1-128 does not support extended ASCII (ISO/IEC 8859-1) characters. @@ -3341,9 +3348,8 @@ Previously known as RSS Expanded this is a variable length symbology capable of encoding data from a number of AIs in a single symbol. AIs should be encased in [square brackets] in the input data, which will be displayed as parentheses (round brackets) in the Human Readable Text. This method allows the inclusion of -parentheses in the AI data. If the data does not include parentheses, the AIs -may alternatively be encased in parentheses using the --gs1parens switch - see -6.1.10.3 GS1-128. +parentheses in the AI data without escaping. The AIs may alternatively be +encased in parentheses using the --gs1parens switch - see 6.1.10.3 GS1-128. The GTIN-14 data for AI (01) must include the standard GS1 check digit as this is not calculated by Zint when this symbology is encoded. Data for fixed-length @@ -5187,6 +5193,10 @@ OPTIONS \e (0x1B) ESC Escape \G (0x1D) GS Group Separator \R (0x1E) RS Record Separator + \( (0x28) ( Opening parenthesis (only with + --gs1parens) + \) (0x29) ) Closing parenthesis (only with + --gs1parens) \\ (0x5C) \ Backslash \dNNN (NNN) Any 8-bit character where NNN is decimal (000-255) @@ -5239,7 +5249,8 @@ OPTIONS --gs1parens Process parentheses "()" as GS1 AI delimiters, rather than square brackets - "[]". The input data must not otherwise contain parentheses. + "[]". If the AI data contains parentheses, they must be backslashed ("\(" or + "\)") and the --esc option selected. --gssep diff --git a/docs/zint.1 b/docs/zint.1 index e73cebd5..c365e217 100644 --- a/docs/zint.1 +++ b/docs/zint.1 @@ -180,6 +180,10 @@ The escape sequences are: \[rs]e (0x1B) ESC Escape \[rs]G (0x1D) GS Group Separator \[rs]R (0x1E) RS Record Separator +\[rs]( (0x28) ( Opening parenthesis (only with + \-\-gs1parens) +\[rs]) (0x29) ) Closing parenthesis (only with + \-\-gs1parens) \[rs]\[rs] (0x5C) \[rs] Backslash \[rs]dNNN (NNN) Any 8\-bit character where NNN is decimal (000\-255) @@ -235,7 +239,9 @@ Do not check the validity of GS1 data. \f[CR]\-\-gs1parens\f[R] Process parentheses \f[CR]\[dq]()\[dq]\f[R] as GS1 AI delimiters, rather than square brackets \f[CR]\[dq][]\[dq]\f[R]. -The input data must not otherwise contain parentheses. +If the AI data contains parentheses, they must be backslashed +(\f[CR]\[dq]\[rs](\[dq]\f[R] or \f[CR]\[dq]\[rs])\[dq]\f[R]) and the +\f[CR]\-\-esc\f[R] option selected. .TP \f[CR]\-\-gssep\f[R] For Data Matrix in GS1 mode, use \f[CR]GS\f[R] (0x1D) as the GS1 data diff --git a/docs/zint.1.pmd b/docs/zint.1.pmd index 719586ee..e6804389 100644 --- a/docs/zint.1.pmd +++ b/docs/zint.1.pmd @@ -160,6 +160,10 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S \e (0x1B) ESC Escape \G (0x1D) GS Group Separator \R (0x1E) RS Record Separator + \( (0x28) ( Opening parenthesis (only with + --gs1parens) + \) (0x29) ) Closing parenthesis (only with + --gs1parens) \\ (0x5C) \ Backslash \dNNN (NNN) Any 8-bit character where NNN is decimal (000-255) @@ -208,8 +212,8 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S `--gs1parens` -: Process parentheses `"()"` as GS1 AI delimiters, rather than square brackets `"[]"`. The input data must not - otherwise contain parentheses. +: Process parentheses `"()"` as GS1 AI delimiters, rather than square brackets `"[]"`. If the AI data contains + parentheses, they must be backslashed (`"\("` or `"\)"`) and the `--esc` option selected. `--gssep` diff --git a/frontend_qt/mainWindow.ui b/frontend_qt/mainWindow.ui index 0b728dd5..da1e147b 100644 --- a/frontend_qt/mainWindow.ui +++ b/frontend_qt/mainWindow.ui @@ -1561,6 +1561,8 @@ or import from file <tr><td>\e&nbsp;</td><td>Escape (0x1B)</td></tr> <tr><td>\G&nbsp;</td><td>Group Separator (0x1D)</td></tr> <tr><td>\R&nbsp;</td><td>Record Separator (0x1E)</td></tr> +<tr><td>\(&nbsp;</td><td>Opening parenthesis (0x28) ("GS1 ()" only) </td></tr> +<tr><td>\)&nbsp;</td><td>Closing parenthesis (0x29) ("GS1 ()" only) </td></tr> <tr><td>\\&nbsp;</td><td>Backslash (0x5C)</td></tr> <tr><td>\dNNN&nbsp;</td><td>8-bit character (N decimal)</td></tr> <tr><td>\oNNN&nbsp;</td><td>8-bit character (N octal)</td></tr>