- GS1: fix square brackets treated as FNC1 in GS1PARENS_MODE by

changing internal FNC1 marker '[' -> '\x1D' (GS), ticket #319,
  props Moli Sojet;
  also fix non-AI square brackets -> round brackets in GS1_128 HRT
- BWIPP: update to latest
This commit is contained in:
gitlost 2024-07-11 00:35:13 +01:00
parent 7246d67175
commit fb3b3001aa
25 changed files with 352 additions and 300 deletions

View File

@ -174,6 +174,9 @@ Bugs
- QRCODE: fix out-of-bounds crash due to incorrect mode costings for GS1 - QRCODE: fix out-of-bounds crash due to incorrect mode costings for GS1
percents in `qr_in_alpha()`; fix incorrect numeric costings (out-by-1) in percents in `qr_in_alpha()`; fix incorrect numeric costings (out-by-1) in
`qr_in_numeric()`; ticket #300 (#14, #15; #16), props Andre Maute `qr_in_numeric()`; ticket #300 (#14, #15; #16), props Andre Maute
- GS1: fix square brackets treated as FNC1 in GS1PARENS_MODE by changing
internal FNC1 marker '[' -> '\x1D' (GS), ticket #319, props Moli Sojet;
also fix non-AI square brackets -> round brackets in GS1_128 HRT
Version 2.12.0 (2022-12-12) Version 2.12.0 (2022-12-12)

View File

@ -117,6 +117,8 @@ static int aztec_text_process(const unsigned char source[], int src_len, int bp,
for (i = 0; i < src_len; i++) { for (i = 0; i < src_len; i++) {
if (source[i] >= 128) { if (source[i] >= 128) {
encode_mode[i] = 'B'; encode_mode[i] = 'B';
} else if (gs1 && source[i] == '\x1D') {
encode_mode[i] = 'P'; /* For FLG(n) & FLG(0) = FNC1 */
} else { } else {
encode_mode[i] = AztecModes[source[i]]; encode_mode[i] = AztecModes[source[i]];
} }
@ -634,7 +636,7 @@ static int aztec_text_process(const unsigned char source[], int src_len, int bp,
if (!(bp = az_bin_append_posn(AztecSymbolChar[reduced_source[i]], 5, binary_string, bp))) return 0; if (!(bp = az_bin_append_posn(AztecSymbolChar[reduced_source[i]], 5, binary_string, bp))) return 0;
} }
} else if ((reduced_encode_mode[i] == 'P') || (reduced_encode_mode[i] == 'p')) { } else if ((reduced_encode_mode[i] == 'P') || (reduced_encode_mode[i] == 'p')) {
if (gs1 && (reduced_source[i] == '[')) { if (gs1 && reduced_source[i] == '\x1D') {
if (!(bp = az_bin_append_posn(0, 5, binary_string, bp))) return 0; /* FLG(n) */ if (!(bp = az_bin_append_posn(0, 5, binary_string, bp))) return 0; /* FLG(n) */
if (!(bp = az_bin_append_posn(0, 3, binary_string, bp))) return 0; /* FLG(0) = FNC1 */ if (!(bp = az_bin_append_posn(0, 3, binary_string, bp))) return 0; /* FLG(0) = FNC1 */
} else if (reduced_source[i] == 13) { } else if (reduced_source[i] == 13) {

View File

@ -246,7 +246,7 @@ static int c1_look_ahead_test(const unsigned char source[], const int length, co
} }
/* Step P */ /* Step P */
if (gs1 && (c == '[')) { if (gs1 && c == '\x1D') {
byte_count += C1_MULT_3; /* Step P1 */ byte_count += C1_MULT_3; /* Step P1 */
} else { } else {
byte_count += C1_MULT_1; /* Step P2 */ byte_count += C1_MULT_1; /* Step P2 */
@ -453,7 +453,7 @@ static int c1_codewords_remaining(struct zint_symbol *symbol, const int tp) {
static int c1_c40text_cnt(const int current_mode, const int gs1, unsigned char input) { static int c1_c40text_cnt(const int current_mode, const int gs1, unsigned char input) {
int cnt; int cnt;
if (gs1 && input == '[') { if (gs1 && input == '\x1D') {
return 2; return 2;
} }
cnt = 1; cnt = 1;
@ -616,7 +616,7 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], int len
if (debug_print) printf("ASCDD(%.2s) ", source + sp); if (debug_print) printf("ASCDD(%.2s) ", source + sp);
sp += 2; sp += 2;
} else { } else {
if ((gs1) && (source[sp] == '[')) { if (gs1 && source[sp] == '\x1D') {
if (length - (sp + 1) >= 15 && num_digits[sp + 1] >= 15) { if (length - (sp + 1) >= 15 && num_digits[sp + 1] >= 15) {
/* Step B4 */ /* Step B4 */
target[tp++] = 236; /* FNC1 and change to Decimal */ target[tp++] = 236; /* FNC1 and change to Decimal */
@ -648,7 +648,7 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], int len
target[tp++] = 235; /* FNC4 (Upper Shift) */ target[tp++] = 235; /* FNC4 (Upper Shift) */
target[tp++] = (source[sp] - 128) + 1; target[tp++] = (source[sp] - 128) + 1;
if (debug_print) printf("UpSh(%d) ", source[sp]); if (debug_print) printf("UpSh(%d) ", source[sp]);
} else if ((gs1) && (source[sp] == '[')) { } else if (gs1 && source[sp] == '\x1D') {
/* Step B8 */ /* Step B8 */
target[tp++] = 232; /* FNC1 */ target[tp++] = 232; /* FNC1 */
if (debug_print) fputs("FNC1 ", stdout); if (debug_print) fputs("FNC1 ", stdout);
@ -704,7 +704,7 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], int len
cte_buffer[cte_p++] = ct_shift[source[sp] - 128] - 1; cte_buffer[cte_p++] = ct_shift[source[sp] - 128] - 1;
} }
cte_buffer[cte_p++] = ct_value[source[sp] - 128]; cte_buffer[cte_p++] = ct_value[source[sp] - 128];
} else if (gs1 && (source[sp] == '[')) { } else if (gs1 && source[sp] == '\x1D') {
cte_buffer[cte_p++] = 1; /* Shift 2 */ cte_buffer[cte_p++] = 1; /* Shift 2 */
cte_buffer[cte_p++] = 27; /* FNC1 */ cte_buffer[cte_p++] = 27; /* FNC1 */
} else { } else {
@ -826,7 +826,7 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], int len
} else if (current_mode == C1_BYTE) { } else if (current_mode == C1_BYTE) {
next_mode = C1_BYTE; next_mode = C1_BYTE;
if (gs1 && (source[sp] == '[')) { if (gs1 && source[sp] == '\x1D') {
next_mode = C1_ASCII; next_mode = C1_ASCII;
} else { } else {
if (source[sp] <= 127) { if (source[sp] <= 127) {
@ -901,7 +901,7 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], int len
} else if (source[sp] & 0x80) { } else if (source[sp] & 0x80) {
target[tp++] = 235; /* FNC4 (Upper Shift) */ target[tp++] = 235; /* FNC4 (Upper Shift) */
target[tp++] = (source[sp] - 128) + 1; target[tp++] = (source[sp] - 128) + 1;
} else if ((gs1) && (source[sp] == '[')) { } else if (gs1 && source[sp] == '\x1D') {
target[tp++] = 232; /* FNC1 */ target[tp++] = 232; /* FNC1 */
} else { } else {
target[tp++] = source[sp] + 1; target[tp++] = source[sp] + 1;

View File

@ -306,7 +306,7 @@ INTERNAL void c128_put_in_set(int list[2][C128_MAX], const int indexliste, char
int c_count = 0; int c_count = 0;
for (i = 0; i < read; i++) { for (i = 0; i < read; i++) {
if (set[i] == 'C') { if (set[i] == 'C') {
if (source[i] == '[') { if (source[i] == '\x1D') {
if (c_count & 1) { if (c_count & 1) {
if ((i - c_count) != 0) { if ((i - c_count) != 0) {
set[i - c_count] = 'B'; set[i - c_count] = 'B';
@ -799,7 +799,7 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int
break; break;
} }
mode = c128_parunmodd(reduced[indexchaine]); mode = c128_parunmodd(reduced[indexchaine]);
if (reduced[indexchaine] == '[') { if (reduced[indexchaine] == '\x1D') {
mode = C128_ABORC; mode = C128_ABORC;
} }
} }
@ -829,7 +829,7 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int
glyph_count += 2; /* Not reached */ glyph_count += 2; /* Not reached */
} }
if ((set[i] == 'C') && (reduced[i] != '[')) { if ((set[i] == 'C') && (reduced[i] != '\x1D')) {
glyph_count += 1; /* Half a codeword */ glyph_count += 1; /* Half a codeword */
} else { } else {
glyph_count += 2; glyph_count += 2;
@ -878,7 +878,7 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int
values[bar_characters++] = 98; /* Not reached */ values[bar_characters++] = 98; /* Not reached */
} }
if (reduced[read] != '[') { if (reduced[read] != '\x1D') {
switch (set[read]) { /* Encode data characters */ switch (set[read]) { /* Encode data characters */
case 'A': case 'A':
case 'a': case 'a':
@ -1012,15 +1012,23 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int
} }
} }
if (symbol->input_mode & GS1PARENS_MODE) {
i = length < (int) sizeof(symbol->text) ? length : (int) sizeof(symbol->text);
memcpy(symbol->text, source, i);
} else {
int bracket_level = 0; /* Non-compliant closing square brackets may be in text */
for (i = 0; i < length && i < (int) sizeof(symbol->text); i++) { for (i = 0; i < length && i < (int) sizeof(symbol->text); i++) {
if (source[i] == '[') { if (source[i] == '[') {
symbol->text[i] = '('; symbol->text[i] = '(';
} else if (source[i] == ']') { bracket_level++;
} else if (source[i] == ']' && bracket_level) {
symbol->text[i] = ')'; symbol->text[i] = ')';
bracket_level--;
} else { } else {
symbol->text[i] = source[i]; symbol->text[i] = source[i];
} }
} }
}
if (i == sizeof(symbol->text)) { if (i == sizeof(symbol->text)) {
/* Trumps all other warnings */ /* Trumps all other warnings */
strcpy(symbol->errtxt, "844: Human Readable Text truncated"); strcpy(symbol->errtxt, "844: Human Readable Text truncated");

View File

@ -101,7 +101,7 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len
break; break;
} }
mode = c128_parunmodd(source[indexchaine]); mode = c128_parunmodd(source[indexchaine]);
if ((gs1) && (source[indexchaine] == '[')) { if (gs1 && source[indexchaine] == '\x1D') {
mode = C128_ABORC; mode = C128_ABORC;
} /* FNC1 */ } /* FNC1 */
} }
@ -206,7 +206,7 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len
values[bar_characters++] = 98; values[bar_characters++] = 98;
} }
if (!((gs1) && (source[read] == '['))) { if (!gs1 || source[read] != '\x1D') {
switch (set[read]) { /* Encode data characters */ switch (set[read]) { /* Encode data characters */
case 'A': case 'A':
case 'a': c128_set_a(source[read], values, &bar_characters); case 'a': c128_set_a(source[read], values, &bar_characters);

View File

@ -1,7 +1,7 @@
/* code49.c - Handles Code 49 */ /* code49.c - Handles Code 49 */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2009-2023 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@ -68,7 +68,7 @@ INTERNAL int code49(struct zint_symbol *symbol, unsigned char source[], int leng
strcpy(symbol->errtxt, "431: Invalid character in input data, extended ASCII not allowed"); strcpy(symbol->errtxt, "431: Invalid character in input data, extended ASCII not allowed");
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
if (gs1 && (source[i] == '[')) { if (gs1 && source[i] == '\x1D') {
*d++ = '*'; /* FNC1 */ *d++ = '*'; /* FNC1 */
} else { } else {
const char *const entry = c49_table7[source[i]]; const char *const entry = c49_table7[source[i]];

View File

@ -943,7 +943,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour
do { do {
ninety[i] = source[i + 2]; ninety[i] = source[i + 2];
i++; i++;
} while ((length > i + 2) && ('[' != source[i + 2])); } while (i + 2 < length && source[i + 2] != '\x1D');
} }
ninety[i] = '\0'; ninety[i] = '\0';
ninety_len = i; ninety_len = i;
@ -1013,7 +1013,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour
next_ai_posn = 2 + ninety_len; next_ai_posn = 2 + ninety_len;
if (next_ai_posn < length && source[next_ai_posn] == '[') { if (next_ai_posn < length && source[next_ai_posn] == '\x1D') {
/* There are more AIs afterwards */ /* There are more AIs afterwards */
if (next_ai_posn + 2 < length if (next_ai_posn + 2 < length
&& (source[next_ai_posn + 1] == '2') && (source[next_ai_posn + 2] == '1')) { && (source[next_ai_posn + 1] == '2') && (source[next_ai_posn + 2] == '1')) {
@ -1074,12 +1074,12 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour
} else if (z_isdigit(source[read_posn])) { } else if (z_isdigit(source[read_posn])) {
bp = bin_append_posn(source[read_posn] + 4, 6, binary_string, bp); bp = bin_append_posn(source[read_posn] + 4, 6, binary_string, bp);
} else if (source[read_posn] == '[') { } else if (source[read_posn] == '\x1D') {
bp = bin_append_posn(31, 5, binary_string, bp); bp = bin_append_posn(31, 5, binary_string, bp);
} }
read_posn++; read_posn++;
} while ((source[read_posn - 1] != '[') && (source[read_posn - 1] != '\0')); } while (source[read_posn - 1] != '\x1D' && source[read_posn - 1] != '\0');
alpha_pad = 1; /* This is overwritten if a general field is encoded */ alpha_pad = 1; /* This is overwritten if a general field is encoded */
} }
@ -1102,7 +1102,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour
if (fnc1_latch == 1) { if (fnc1_latch == 1) {
/* Encodation method "10" has been used but it is not followed by /* Encodation method "10" has been used but it is not followed by
AI 10, so a FNC1 character needs to be added */ AI 10, so a FNC1 character needs to be added */
general_field[j] = '['; general_field[j] = '\x1D';
j++; j++;
} }
@ -1128,7 +1128,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour
if (!general_field_encode(general_field, j, &mode, &last_digit, binary_string, &bp)) { if (!general_field_encode(general_field, j, &mode, &last_digit, binary_string, &bp)) {
/* Invalid character in input data */ /* Invalid character in input data */
strcpy(symbol->errtxt, "441: Invalid character in input data"); strcpy(symbol->errtxt, "441: Invalid character in 2D component input data");
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
} }

View File

@ -224,8 +224,8 @@ static int dm_isX12(const unsigned char input) {
} }
/* Return true (1) if a character is valid in EDIFACT set */ /* Return true (1) if a character is valid in EDIFACT set */
static int dm_isedifact(const unsigned char input, const int gs1) { static int dm_isedifact(const unsigned char input) {
return (input >= ' ' && input <= '^') && (!gs1 || input != '['); /* Can't encode GS1 FNC1/GS in EDIFACT */ return input >= ' ' && input <= '^';
} }
/* Does Annex J section (r)(6)(ii)(I) apply? */ /* Does Annex J section (r)(6)(ii)(I) apply? */
@ -367,7 +367,7 @@ static int dm_look_ahead_test(const unsigned char source[], const int length, co
} }
/* edifact ... step (p) */ /* edifact ... step (p) */
if (dm_isedifact(c, gs1)) { if (dm_isedifact(c)) {
edf_count += DM_MULT_3_DIV_4; /* (p)(1) */ edf_count += DM_MULT_3_DIV_4; /* (p)(1) */
} else { } else {
if (is_extended) { if (is_extended) {
@ -378,7 +378,7 @@ static int dm_look_ahead_test(const unsigned char source[], const int length, co
} }
/* base 256 ... step (q) */ /* base 256 ... step (q) */
if ((gs1 == 1) && (c == '[')) { if (gs1 == 1 && c == '\x1D') {
/* FNC1 separator */ /* FNC1 separator */
b256_count += DM_MULT_4; /* (q)(1) */ b256_count += DM_MULT_4; /* (q)(1) */
} else { } else {
@ -617,7 +617,7 @@ static int dm_codewords_remaining(struct zint_symbol *symbol, const int tp, cons
static int dm_c40text_cnt(const int current_mode, const int gs1, unsigned char input) { static int dm_c40text_cnt(const int current_mode, const int gs1, unsigned char input) {
int cnt; int cnt;
if (gs1 && input == '[') { if (gs1 && input == '\x1D') {
return 2; return 2;
} }
cnt = 1; cnt = 1;
@ -954,15 +954,15 @@ static void dm_addEdges(struct zint_symbol *symbol, const unsigned char source[]
dm_addEdge(symbol, source, length, edges, DM_X12, from, 3, previous, 0); dm_addEdge(symbol, source, length, edges, DM_X12, from, 3, previous, 0);
} }
if (gs1 != 1 || source[from] != '[') { if (gs1 != 1 || source[from] != '\x1D') {
dm_addEdge(symbol, source, length, edges, DM_BASE256, from, 1, previous, 0); dm_addEdge(symbol, source, length, edges, DM_BASE256, from, 1, previous, 0);
} }
} }
if (dm_isedifact(source[from], gs1)) { if (dm_isedifact(source[from])) {
/* We create 3 EDF edges, 2, 3 or 4 characters length. The 4-char normally doesn't have a latch to ASCII /* We create 3 EDF edges, 2, 3 or 4 characters length. The 4-char normally doesn't have a latch to ASCII
unless it is 2 characters away from the end of the input. */ unless it is 2 characters away from the end of the input. */
for (i = 1, pos = from + i; i < 4 && pos < length && dm_isedifact(source[pos], gs1); i++, pos++) { for (i = 1, pos = from + i; i < 4 && pos < length && dm_isedifact(source[pos]); i++, pos++) {
dm_addEdge(symbol, source, length, edges, DM_EDIFACT, from, i + 1, previous, 0); dm_addEdge(symbol, source, length, edges, DM_EDIFACT, from, i + 1, previous, 0);
} }
} }
@ -1116,7 +1116,7 @@ static int dm_minimalenc(struct zint_symbol *symbol, const unsigned char source[
target[tp++] = (source[sp] - 128) + 1; target[tp++] = (source[sp] - 128) + 1;
if (debug_print) printf("FN4 A%02X ", target[tp - 1] - 1); if (debug_print) printf("FN4 A%02X ", target[tp - 1] - 1);
} else { } else {
if (gs1 && (source[sp] == '[')) { if (gs1 && source[sp] == '\x1D') {
if (gs1 == 2) { if (gs1 == 2) {
target[tp++] = 29 + 1; /* GS */ target[tp++] = 29 + 1; /* GS */
if (debug_print) fputs("GS ", stdout); if (debug_print) fputs("GS ", stdout);
@ -1151,7 +1151,7 @@ static int dm_minimalenc(struct zint_symbol *symbol, const unsigned char source[
shift_set = ct_shift[source[sp] - 128]; shift_set = ct_shift[source[sp] - 128];
value = ct_value[source[sp] - 128]; value = ct_value[source[sp] - 128];
} else { } else {
if (gs1 && (source[sp] == '[')) { if (gs1 && source[sp] == '\x1D') {
if (gs1 == 2) { if (gs1 == 2) {
shift_set = ct_shift[29]; shift_set = ct_shift[29];
value = ct_value[29]; /* GS */ value = ct_value[29]; /* GS */
@ -1212,12 +1212,7 @@ static int dm_minimalenc(struct zint_symbol *symbol, const unsigned char source[
} else if (current_mode == DM_BASE256) { } else if (current_mode == DM_BASE256) {
if (gs1 == 2 && source[sp] == '[') { target[tp++] = source[sp++];
target[tp++] = 29; /* GS */
} else {
target[tp++] = source[sp];
}
sp++;
if (debug_print) printf("B%02X ", target[tp - 1]); if (debug_print) printf("B%02X ", target[tp - 1]);
} }
@ -1292,7 +1287,7 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
target[tp++] = (source[sp] - 128) + 1; target[tp++] = (source[sp] - 128) + 1;
if (debug_print) printf("FN4 A%02X ", target[tp - 1] - 1); if (debug_print) printf("FN4 A%02X ", target[tp - 1] - 1);
} else { } else {
if (gs1 && (source[sp] == '[')) { if (gs1 && source[sp] == '\x1D') {
if (gs1 == 2) { if (gs1 == 2) {
target[tp++] = 29 + 1; /* GS */ target[tp++] = 29 + 1; /* GS */
if (debug_print) fputs("GS ", stdout); if (debug_print) fputs("GS ", stdout);
@ -1339,7 +1334,7 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
shift_set = ct_shift[source[sp] - 128]; shift_set = ct_shift[source[sp] - 128];
value = ct_value[source[sp] - 128]; value = ct_value[source[sp] - 128];
} else { } else {
if (gs1 && (source[sp] == '[')) { if (gs1 && source[sp] == '\x1D') {
if (gs1 == 2) { if (gs1 == 2) {
shift_set = ct_shift[29]; shift_set = ct_shift[29];
value = ct_value[29]; /* GS */ value = ct_value[29]; /* GS */
@ -1407,7 +1402,7 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
/* step (f) EDIFACT encodation */ /* step (f) EDIFACT encodation */
} else if (current_mode == DM_EDIFACT) { } else if (current_mode == DM_EDIFACT) {
if (!dm_isedifact(source[sp], gs1)) { if (!dm_isedifact(source[sp])) {
next_mode = DM_ASCII; next_mode = DM_ASCII;
} else { } else {
next_mode = DM_EDIFACT; next_mode = DM_EDIFACT;
@ -1443,7 +1438,7 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
/* step (g) Base 256 encodation */ /* step (g) Base 256 encodation */
} else if (current_mode == DM_BASE256) { } else if (current_mode == DM_BASE256) {
if (gs1 == 1 && source[sp] == '[') { if (gs1 == 1 && source[sp] == '\x1D') {
next_mode = DM_ASCII; next_mode = DM_ASCII;
} else { } else {
next_mode = DM_BASE256; next_mode = DM_BASE256;
@ -1464,7 +1459,7 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
tp = dm_switch_mode(next_mode, target, tp, p_b256_start, debug_print); tp = dm_switch_mode(next_mode, target, tp, p_b256_start, debug_print);
not_first = 0; not_first = 0;
} else { } else {
if (gs1 == 2 && source[sp] == '[') { if (gs1 == 2 && source[sp] == '\x1D') {
target[tp++] = 29; /* GS */ target[tp++] = 29; /* GS */
} else { } else {
target[tp++] = source[sp]; target[tp++] = source[sp];
@ -1587,7 +1582,7 @@ static int dm_encode(struct zint_symbol *symbol, const unsigned char source[], c
target[tp++] = 235; /* FNC4 */ target[tp++] = 235; /* FNC4 */
target[tp++] = (source[sp] - 128) + 1; target[tp++] = (source[sp] - 128) + 1;
if (debug_print) printf("FN4 A%02X ", target[tp - 1] - 1); if (debug_print) printf("FN4 A%02X ", target[tp - 1] - 1);
} else if (gs1 && source[sp] == '[') { } else if (gs1 && source[sp] == '\x1D') {
if (gs1 == 2) { if (gs1 == 2) {
target[tp++] = 29 + 1; /* GS */ target[tp++] = 29 + 1; /* GS */
if (debug_print) fputs("GS ", stdout); if (debug_print) fputs("GS ", stdout);

View File

@ -1,7 +1,7 @@
/* dotcode.c - Handles DotCode */ /* dotcode.c - Handles DotCode */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2017-2023 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2017-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@ -658,8 +658,8 @@ static int dc_encode_message(struct zint_symbol *symbol, const unsigned char sou
continue; continue;
} }
if (dc_datum_c(source, length, position) || (source[position] == '[' && gs1)) { if (dc_datum_c(source, length, position) || (gs1 && source[position] == '\x1D')) {
if (source[position] == '[') { if (source[position] == '\x1D') {
codeword_array[ap++] = 107; /* FNC1 */ codeword_array[ap++] = 107; /* FNC1 */
position++; position++;
} else { } else {
@ -747,7 +747,7 @@ static int dc_encode_message(struct zint_symbol *symbol, const unsigned char sou
} }
/* Step D2 */ /* Step D2 */
if ((source[position] == '[') && gs1) { if (gs1 && source[position] == '\x1D') {
codeword_array[ap++] = 107; /* FNC1 */ codeword_array[ap++] = 107; /* FNC1 */
position++; position++;
if (debug_print) fputs("D2/1 ", stdout); if (debug_print) fputs("D2/1 ", stdout);
@ -841,7 +841,7 @@ static int dc_encode_message(struct zint_symbol *symbol, const unsigned char sou
} }
/* Step E2 */ /* Step E2 */
if ((source[position] == '[') && gs1) { if (gs1 && source[position] == '\x1D') {
/* Note: this branch probably never reached as no reason to be in Code Set A for GS1 data */ /* Note: this branch probably never reached as no reason to be in Code Set A for GS1 data */
codeword_array[ap++] = 107; /* FNC1 */ codeword_array[ap++] = 107; /* FNC1 */
position++; position++;

View File

@ -1,7 +1,7 @@
/* general_field.c - Handles general field compaction (GS1 DataBar and composites) */ /* general_field.c - Handles general field compaction (GS1 DataBar and composites) */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2019-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@ -39,7 +39,7 @@ static const char isoiec_puncs[] = "!\"%&'()*+,-./:;<=>?_ "; /* Note contains sp
/* Returns type of char at `i`. FNC1 counted as NUMERIC. Returns 0 if invalid char */ /* Returns type of char at `i`. FNC1 counted as NUMERIC. Returns 0 if invalid char */
static int general_field_type(const char *general_field, const int i) { static int general_field_type(const char *general_field, const int i) {
if (general_field[i] == '[' || z_isdigit(general_field[i])) { if (general_field[i] == '\x1D' || z_isdigit(general_field[i])) {
return NUMERIC; return NUMERIC;
} }
if (z_isupper(general_field[i]) || posn(alphanum_puncs, general_field[i]) != -1) { if (z_isupper(general_field[i]) || posn(alphanum_puncs, general_field[i]) != -1) {
@ -113,8 +113,8 @@ INTERNAL int general_field_encode(const char *general_field, const int general_f
bp = bin_append_posn(0, 4, binary_string, bp); /* Alphanumeric latch "0000" */ bp = bin_append_posn(0, 4, binary_string, bp); /* Alphanumeric latch "0000" */
mode = ALPHANUMERIC; mode = ALPHANUMERIC;
} else { } else {
d1 = general_field[i] == '[' ? 10 : ctoi(general_field[i]); d1 = general_field[i] == '\x1D' ? 10 : ctoi(general_field[i]);
d2 = general_field[i + 1] == '[' ? 10 : ctoi(general_field[i + 1]); d2 = general_field[i + 1] == '\x1D' ? 10 : ctoi(general_field[i + 1]);
bp = bin_append_posn((11 * d1) + d2 + 8, 7, binary_string, bp); bp = bin_append_posn((11 * d1) + d2 + 8, 7, binary_string, bp);
i += 2; i += 2;
} }
@ -132,7 +132,7 @@ INTERNAL int general_field_encode(const char *general_field, const int general_f
} }
break; break;
case ALPHANUMERIC: case ALPHANUMERIC:
if (general_field[i] == '[') { if (general_field[i] == '\x1D') {
/* 7.2.5.5.2/5.4.2 a) */ /* 7.2.5.5.2/5.4.2 a) */
bp = bin_append_posn(15, 5, binary_string, bp); /* "01111" */ bp = bin_append_posn(15, 5, binary_string, bp); /* "01111" */
mode = NUMERIC; mode = NUMERIC;
@ -162,7 +162,7 @@ INTERNAL int general_field_encode(const char *general_field, const int general_f
} }
break; break;
case ISOIEC: case ISOIEC:
if (general_field[i] == '[') { if (general_field[i] == '\x1D') {
/* 7.2.5.5.3/5.4.3 a) */ /* 7.2.5.5.3/5.4.3 a) */
bp = bin_append_posn(15, 5, binary_string, bp); /* "01111" */ bp = bin_append_posn(15, 5, binary_string, bp); /* "01111" */
mode = NUMERIC; mode = NUMERIC;

View File

@ -1513,7 +1513,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
max_bracket_level = bracket_level; max_bracket_level = bracket_level;
} }
ai_latch = 1; ai_latch = 1;
} else if (source[i] == cbracket) { } else if (source[i] == cbracket && bracket_level) {
bracket_level--; bracket_level--;
if (ai_length > max_ai_length) { if (ai_length > max_ai_length) {
max_ai_length = ai_length; max_ai_length = ai_length;
@ -1629,13 +1629,11 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
j = 0; j = 0;
ai_latch = 1; ai_latch = 1;
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
if ((source[i] != obracket) && (source[i] != cbracket)) {
reduced[j++] = source[i];
}
if (source[i] == obracket) { if (source[i] == obracket) {
bracket_level++;
/* Start of an AI string */ /* Start of an AI string */
if (ai_latch == 0) { if (ai_latch == 0) {
reduced[j++] = '['; reduced[j++] = '\x1D';
} }
if (i + 1 != length) { if (i + 1 != length) {
last_ai = to_int(source + i + 1, 2); last_ai = to_int(source + i + 1, 2);
@ -1654,12 +1652,16 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
ai_latch = 1; ai_latch = 1;
} }
} }
} else if (source[i] == cbracket && bracket_level) {
/* The closing bracket is simply dropped from the input */
bracket_level--;
} else {
reduced[j++] = source[i];
} }
/* The ']' character is simply dropped from the input */
} }
reduced[j] = '\0'; reduced[j] = '\0';
/* the character '[' in the reduced string refers to the FNC1 character */ /* The character '\x1D' (GS) in the reduced string refers to the FNC1 character */
return error_value; return error_value;
} }

View File

@ -57,7 +57,7 @@ static int qr_is_alpha(const unsigned int glyph, const int gs1) {
if (is_chr(QR_ALPHA, glyph)) { if (is_chr(QR_ALPHA, glyph)) {
return 1; return 1;
} }
if (gs1 && glyph == '[') { if (gs1 && glyph == '\x1D') {
return 1; return 1;
} }
return 0; return 0;
@ -505,10 +505,6 @@ static int qr_binary(char binary[], int bp, const int version, const char mode[]
for (i = 0; i < short_data_block_length; i++) { for (i = 0; i < short_data_block_length; i++) {
unsigned int byte = ddata[position + i]; unsigned int byte = ddata[position + i];
if (gs1 && (byte == '[')) {
byte = 0x1d; /* FNC1 */
}
bp = bin_append_posn(byte, byte > 0xFF ? 16 : 8, binary, bp); bp = bin_append_posn(byte, byte > 0xFF ? 16 : 8, binary, bp);
if (debug_print) { if (debug_print) {
@ -555,7 +551,7 @@ static int qr_binary(char binary[], int bp, const int version, const char mode[]
prod = (first * 45) + second; prod = (first * 45) + second;
i++; i++;
} else { } else {
if (gs1 && (ddata[position + i] == '[')) { if (gs1 && ddata[position + i] == '\x1D') {
first = QR_PERCENT; /* FNC1 */ first = QR_PERCENT; /* FNC1 */
} else { } else {
first = qr_alphanumeric[ddata[position + i] - 32]; first = qr_alphanumeric[ddata[position + i] - 32];
@ -571,7 +567,7 @@ static int qr_binary(char binary[], int bp, const int version, const char mode[]
prod = (first * 45) + second; prod = (first * 45) + second;
percent = 1; percent = 1;
} else { } else {
if (gs1 && (ddata[position + i] == '[')) { if (gs1 && ddata[position + i] == '\x1D') {
second = QR_PERCENT; /* FNC1 */ second = QR_PERCENT; /* FNC1 */
} else { } else {
second = qr_alphanumeric[ddata[position + i] - 32]; second = qr_alphanumeric[ddata[position + i] - 32];
@ -596,7 +592,7 @@ static int qr_binary(char binary[], int bp, const int version, const char mode[]
prod = (first * 45) + second; prod = (first * 45) + second;
percent = 1; percent = 1;
} else { } else {
if (gs1 && (ddata[position + i] == '[')) { if (gs1 && ddata[position + i] == '\x1D') {
second = QR_PERCENT; /* FNC1 */ second = QR_PERCENT; /* FNC1 */
} else { } else {
second = qr_alphanumeric[ddata[position + i] - 32]; second = qr_alphanumeric[ddata[position + i] - 32];

View File

@ -966,7 +966,7 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha
before carrying out compression */ before carrying out compression */
for (i = 0; i < read_posn; i++) { for (i = 0; i < read_posn; i++) {
if (!z_isdigit(source[i])) { if (!z_isdigit(source[i])) {
if (source[i] != '[') { if (source[i] != '\x1D') {
/* Something is wrong */ /* Something is wrong */
strcpy(symbol->errtxt, "385: Invalid character in Compressed Field data (digits only)"); strcpy(symbol->errtxt, "385: Invalid character in Compressed Field data (digits only)");
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
@ -1062,8 +1062,8 @@ static int dbar_exp_binary_string(struct zint_symbol *symbol, const unsigned cha
if (debug_print) printf("General field data = %s\n", general_field); if (debug_print) printf("General field data = %s\n", general_field);
if (j != 0) { /* If general field not empty */ if (j != 0) { /* If general field not empty */
if (!general_field_encode(general_field, j, &mode, &last_digit, binary_string, &bp)) { /* Should not happen */ if (!general_field_encode(general_field, j, &mode, &last_digit, binary_string, &bp)) {
/* Not reachable */ /* Will happen if character not in CSET 82 + space */
strcpy(symbol->errtxt, "386: Invalid character in General Field data"); strcpy(symbol->errtxt, "386: Invalid character in General Field data");
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
@ -1250,9 +1250,14 @@ static void dbar_exp_separator(struct zint_symbol *symbol, int width, const int
/* Set HRT for DataBar Expanded */ /* Set HRT for DataBar Expanded */
static void dbar_exp_hrt(struct zint_symbol *symbol, unsigned char source[], const int length) { static void dbar_exp_hrt(struct zint_symbol *symbol, unsigned char source[], const int length) {
int i;
for (i = 0; i <= length; i++) { /* Include terminating NUL */ /* Max possible length is 77 digits so will fit */
if (symbol->input_mode & GS1PARENS_MODE) {
memcpy(symbol->text, source, length + 1); /* Include terminating NUL */
} else {
int i;
/* Can't have square brackets in content so bracket level not required */
for (i = 0; i <= length /* Include terminating NUL */; i++) {
if (source[i] == '[') { if (source[i] == '[') {
symbol->text[i] = '('; symbol->text[i] = '(';
} else if (source[i] == ']') { } else if (source[i] == ']') {
@ -1261,6 +1266,7 @@ static void dbar_exp_hrt(struct zint_symbol *symbol, unsigned char source[], con
symbol->text[i] = source[i]; symbol->text[i] = source[i];
} }
} }
}
} }
/* GS1 DataBar Expanded, setting linkage for composite if `cc_rows` set */ /* GS1 DataBar Expanded, setting linkage for composite if `cc_rows` set */

View File

@ -932,46 +932,49 @@ static void test_encode(const testCtx *const p_ctx) {
/* 36*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[3100]121212[20]34[20]78", ZINT_WARN_HRT_TRUNCATED, 1, 1135, 1, "Max length", /* 36*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[3100]121212[20]34[20]78", ZINT_WARN_HRT_TRUNCATED, 1, 1135, 1, "Max length",
"1101001110011110101110110110011001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101101100110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011011011001100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110110110011001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101101100110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011011011001100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110110110011001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101101100110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011011011001100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110110110001101101100110010110011100101100111001011001110011001001110100010110001100100111011000010100100100110001100011101011" "1101001110011110101110110110011001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101101100110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011011011001100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110110110011001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101101100110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011011011001100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110110110011001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101101100110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011011011001100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110110110001101101100110010110011100101100111001011001110011001001110100010110001100100111011000010100100100110001100011101011"
}, },
/* 37*/ { BARCODE_EAN14, GS1_MODE, -1, "4070071967072", 0, 1, 134, 1, "Verified manually against TEC-IT", /* 37*/ { BARCODE_GS1_128, GS1_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "(21)12345670[23]4931", 0, 1, 189, 1, "Ticket #319, square bracket treated as FNC1 in parens mode, props Moli Sojet",
"110100111001111010111011011100100101100111001000101100011100010110101100001001011110111011100011010110011100101100101110011001000010101110111101101000111011011000110100110111001100011101011"
},
/* 38*/ { BARCODE_EAN14, GS1_MODE, -1, "4070071967072", 0, 1, 134, 1, "Verified manually against TEC-IT",
"11010011100111101011101100110110011000101000101100001001001100010011001011100100001011001001100010011001001110110111001001100011101011" "11010011100111101011101100110110011000101000101100001001001100010011001011100100001011001001100010011001001110110111001001100011101011"
}, },
/* 38*/ { BARCODE_NVE18, GS1_MODE, -1, "40700000071967072", 0, 1, 156, 1, "Verified manually against TEC-IT", /* 39*/ { BARCODE_NVE18, GS1_MODE, -1, "40700000071967072", 0, 1, 156, 1, "Verified manually against TEC-IT",
"110100111001111010111011011001100110001010001011000010011011001100110110011001001100010011001011100100001011001001100010011001001110110111011101100011101011" "110100111001111010111011011001100110001010001011000010011011001100110110011001001100010011001011100100001011001001100010011001001110110111011101100011101011"
}, },
/* 39*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "83278F8G9H0J2G", 0, 1, 211, 1, "ANSI/HIBC 2.6 - 2016 Section 4.1, not same, uses different encoding (eg begins StartA instead of StartB)", /* 40*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "83278F8G9H0J2G", 0, 1, 211, 1, "ANSI/HIBC 2.6 - 2016 Section 4.1, not same, uses different encoding (eg begins StartA instead of StartB)",
"1101001000011000100100111010011001011101111011000110110110000101001011110111010001100010111010011001101000100011100101100110001010001001110110010110111000110011100101101000100010001001100111101010001100011101011" "1101001000011000100100111010011001011101111011000110110110000101001011110111010001100010111010011001101000100011100101100110001010001001110110010110111000110011100101101000100010001001100111101010001100011101011"
}, },
/* 40*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "A123BJC5D6E71", 0, 1, 200, 1, "ANSI/HIBC 2.6 - 2016 Figure 1, same", /* 41*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "A123BJC5D6E71", 0, 1, 200, 1, "ANSI/HIBC 2.6 - 2016 Figure 1, same",
"11010010000110001001001010001100010011100110110011100101100101110010001011000101101110001000100011011011100100101100010001100111010010001101000111011011101001110011011010001000110001101101100011101011" "11010010000110001001001010001100010011100110110011100101100101110010001011000101101110001000100011011011100100101100010001100111010010001101000111011011101001110011011010001000110001101101100011101011"
}, },
/* 41*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "$$52001510X3G", 0, 1, 178, 1, "ANSI/HIBC 2.6 - 2016 Figure 5, same", /* 42*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "$$52001510X3G", 0, 1, 178, 1, "ANSI/HIBC 2.6 - 2016 Figure 5, same",
"1101001000011000100100100100011001001000110010111011110110111000101101100110010111001100110010001001011110111011100010110110010111001101000100010110001000100011110101100011101011" "1101001000011000100100100100011001001000110010111011110110111000101101100110010111001100110010001001011110111011100010110110010111001101000100010110001000100011110101100011101011"
}, },
/* 42*/ { BARCODE_DPD, UNICODE_MODE, -1, "%000393206219912345678101040", 0, 1, 211, 1, "DPDAPPD 4.0.2 - Illustrations 2, 7, 8, same; NOTE: correct HRT given by Illustration 7 only", /* 43*/ { BARCODE_DPD, UNICODE_MODE, -1, "%000393206219912345678101040", 0, 1, 211, 1, "DPDAPPD 4.0.2 - Illustrations 2, 7, 8, same; NOTE: correct HRT given by Illustration 7 only",
"1101001000010001001100100111011001011101111011011001100110100010001100011011010011001000110111001001011101111010110011100100010110001110001011011000010100110010001001100100010011000101000101011110001100011101011" "1101001000010001001100100111011001011101111011011001100110100010001100011011010011001000110111001001011101111010110011100100010110001110001011011000010100110010001001100100010011000101000101011110001100011101011"
}, },
/* 43*/ { BARCODE_DPD, UNICODE_MODE, -1, "%007110601782532948375101276", 0, 1, 211, 1, "DPDAPPD 4.0.2 - Illustration 6 **NOT SAME** HRT incorrect, also uses CodeA and inefficient encoding; verified against TEC-IT", /* 44*/ { BARCODE_DPD, UNICODE_MODE, -1, "%007110601782532948375101276", 0, 1, 211, 1, "DPDAPPD 4.0.2 - Illustration 6 **NOT SAME** HRT incorrect, also uses CodeA and inefficient encoding; verified against TEC-IT",
"1101001000010001001100100111011001011101111010011000100110001001001001100100011001101100110000101001110010110011000110110100010111101011110010011000010010110010001001011001110011001010000100010111101100011101011" "1101001000010001001100100111011001011101111010011000100110001001001001100100011001101100110000101001110010110011000110110100010111101011110010011000010010110010001001011001110011001010000100010111101100011101011"
}, },
/* 44*/ { BARCODE_DPD, UNICODE_MODE, -1, "0123456789012345678901234567", 0, 1, 189, 1, "DPDAPPD 4.0.2 - Illustration 9, same (allowing for literal HRT)", /* 45*/ { BARCODE_DPD, UNICODE_MODE, -1, "0123456789012345678901234567", 0, 1, 189, 1, "DPDAPPD 4.0.2 - Illustration 9, same (allowing for literal HRT)",
"110100111001100110110011101101110101110110001000010110011011011110110011011001110110111010111011000100001011001101101111011001101100111011011101011101100010000101100101011110001100011101011" "110100111001100110110011101101110101110110001000010110011011011110110011011001110110111010111011000100001011001101101111011001101100111011011101011101100010000101100101011110001100011101011"
}, },
/* 45*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020028101276", 0, 1, 211, 1, "DPDPLS Section 4, **NOT SAME**, figure switches to CodeC after 1st char (%), zint after 2nd (0)", /* 46*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020028101276", 0, 1, 211, 1, "DPDPLS Section 4, **NOT SAME**, figure switches to CodeC after 1st char (%), zint after 2nd (0)",
"1101001000010001001100100111011001011101111010001100100110011100101110110010011001001000111101000101101100110011011001100110011001101101100110011100110100110010001001011001110011001010000101011110001100011101011" "1101001000010001001100100111011001011101111010001100100110011100101110110010011001001000111101000101101100110011011001100110011001101101100110011100110100110010001001011001110011001010000101011110001100011101011"
}, },
/* 46*/ { BARCODE_DPD, UNICODE_MODE, -1, "007110601632532948375179276", 0, 1, 211, 1, "DPDPLS Section 4.6, **NOT SAME**, figure StartA & switches as above, zint StartB & switches as above", /* 47*/ { BARCODE_DPD, UNICODE_MODE, -1, "007110601632532948375179276", 0, 1, 211, 1, "DPDPLS Section 4.6, **NOT SAME**, figure StartA & switches as above, zint StartB & switches as above",
"1101001000010001001100100111011001011101111010011000100110001001001001100100011001101100101001100001110010110011000110110100010111101011110010011000010010100111001101010111100011001010000101100010001100011101011" "1101001000010001001100100111011001011101111010011000100110001001001001100100011001101100101001100001110010110011000110110100010111101011110010011000010010100111001101010111100011001010000101100010001100011101011"
}, },
/* 47*/ { BARCODE_DPD, UNICODE_MODE, -1, "001990009980000020084109203", 0, 1, 211, 1, "DPDPLS Section 5.1, **NOT SAME**, figure switches to CodeC after 1st char (%), zint after 2nd (0)", /* 48*/ { BARCODE_DPD, UNICODE_MODE, -1, "001990009980000020084109203", 0, 1, 211, 1, "DPDPLS Section 5.1, **NOT SAME**, figure switches to CodeC after 1st char (%), zint after 2nd (0)",
"1101001000010001001100100111011001011101111011001101100101110111101101100110011001001000111101000101101100110011011001100110011001101101100110010011110100110010001001010111100010010011000100011010001100011101011" "1101001000010001001100100111011001011101111011001101100101110111101101100110011001001000111101000101101100110011011001100110011001101101100110010011110100110010001001010111100010010011000100011010001100011101011"
}, },
/* 48*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020029136276", 0, 1, 211, 1, "DPDPLS Section 6.1, **NOT SAME**, as above", /* 49*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020029136276", 0, 1, 211, 1, "DPDPLS Section 6.1, **NOT SAME**, as above",
"1101001000010001001100100111011001011101111010001100100110011100101110110010011001001000111101000101101100110011011001100110011001101101100110011100110010100110111001111000101011001010000100001101001100011101011" "1101001000010001001100100111011001011101111010001100100110011100101110110010011001001000111101000101101100110011011001100110011001101101100110011100110010100110111001111000101011001010000100001101001100011101011"
}, },
/* 49*/ { BARCODE_DPD, UNICODE_MODE, 1, "006376209980000020044118276", 0, 1, 200, 1, "DPDPLS Section 8.7.2 relabel, **NOT SAME**, figure begins StartB then immediate CodeC, zint just StartC", /* 50*/ { BARCODE_DPD, UNICODE_MODE, 1, "006376209980000020044118276", 0, 1, 200, 1, "DPDPLS Section 8.7.2 relabel, **NOT SAME**, figure begins StartB then immediate CodeC, zint just StartC",
"11010011100110110011001010011000011001010000110010011101011101111010100111100110110011001101100110011001001110100100011001100010001011001110010111011001001011110111011001110100110111011101100011101011" "11010011100110110011001010011000011001010000110010011101011101111010100111100110110011001101100110011001001110100100011001100010001011001110010111011001001011110111011001110100110111011101100011101011"
}, },
/* 50*/ { BARCODE_UPU_S10, UNICODE_MODE, -1, "EE876543216CA", 0, 1, 156, 1, "", /* 51*/ { BARCODE_UPU_S10, UNICODE_MODE, -1, "EE876543216CA", 0, 1, 156, 1, "",
"110100100001000110100010001101000111010011001011101111011001010000111010110001100011011010011101100101111011101000100011010100011000111000101101100011101011" "110100100001000110100010001101000111010011001011101111011001010000111010110001100011011010011101100101111011101000100011010100011000111000101101100011101011"
}, },
}; };

View File

@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2019-2023 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@ -3470,21 +3470,22 @@ static void test_fuzz(const testCtx *const p_ctx) {
char *composite; char *composite;
int ret; int ret;
int bwipp_cmp; int bwipp_cmp;
char *expected_errtxt;
char *comment; char *comment;
}; };
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_EANX_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "" }, /* 0*/ { BARCODE_EANX_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 448: Input too long (5 character maximum for add-on) in linear component", "" },
/* 1*/ { BARCODE_UPCA_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "" }, /* 1*/ { BARCODE_UPCA_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 294: Input too long (5 character maximum for add-on) in linear component", "" },
/* 2*/ { BARCODE_UPCE_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "" }, /* 2*/ { BARCODE_UPCE_CC, -1, -1, "+123456789012345678", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 294: Input too long (5 character maximum for add-on) in linear component", "" },
/* 3*/ { BARCODE_EANX_CC, -1, -1, "+12345", -1, "[21]A12345678", 0 , 0, "BWIPP checks for proper EAN data" }, /* 3*/ { BARCODE_EANX_CC, -1, -1, "+12345", -1, "[21]A12345678", 0 , 0, "", "BWIPP checks for proper EAN data" },
/* 4*/ { BARCODE_EANX_CC, -1, -1, "+123456", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "" }, /* 4*/ { BARCODE_EANX_CC, -1, -1, "+123456", -1, "[21]A12345678", ZINT_ERROR_TOO_LONG, 1, "Error 448: Input too long (5 character maximum for add-on) in linear component", "" },
/* 5*/ { BARCODE_EANX_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "kks", -1, "()111%", ZINT_ERROR_INVALID_DATA, 1, "" }, /* #300 (#5), Andre Maute (`dbar_date()` not checking length + other non-checks) */ /* 5*/ { BARCODE_EANX_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "kks", -1, "()111%", ZINT_ERROR_INVALID_DATA, 1, "Error 284: Invalid character in data (digits and \"+\" only) in linear component", "" }, /* #300 (#5), Andre Maute (`dbar_date()` not checking length + other non-checks) */
/* 6*/ { BARCODE_UPCA_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\153\153\153\153\153\153\153\153\163", -1, "()90", ZINT_ERROR_TOO_LONG, 1, "" }, /* #300 (#6), Andre Maute (`dbar_date()` not checking length + other non-checks) */ /* 6*/ { BARCODE_UPCA_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\153\153\153\153\153\153\153\153\163", -1, "()90", ZINT_ERROR_TOO_LONG, 1, "Error 283: Input too long (19 character maximum) in linear component", "" }, /* #300 (#6), Andre Maute (`dbar_date()` not checking length + other non-checks) */
/* 7*/ { BARCODE_UPCA_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\377\002\000\000\153\153\153\153\163\000\000\000\153\153\153\153\153\153\153\060\047\047\043\047\057\153\153\153\153\153\000\000\000\000\153\153\153\161\153\153\153\153\153\153\153\153\153\153\153\153\153\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\001\100\000\000\000\000\000\000\000\167\167\167\167\167\167\167\167\167\167\167\167\167\167", 127, "()904OOOOO)CK0336680OOOOOOOOOOOOOO29[0kkkk%%%%(", ZINT_ERROR_TOO_LONG, 1, "" }, /* #300 (#11), Andre Maute (`gs1_verify()` not checking length on resolve AI data loop) */ /* 7*/ { BARCODE_UPCA_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\377\002\000\000\153\153\153\153\163\000\000\000\153\153\153\153\153\153\153\060\047\047\043\047\057\153\153\153\153\153\000\000\000\000\153\153\153\161\153\153\153\153\153\153\153\153\153\153\153\153\153\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\001\100\000\000\000\000\000\000\000\167\167\167\167\167\167\167\167\167\167\167\167\167\167", 127, "()904OOOOO)CK0336680OOOOOOOOOOOOOO29[0kkkk%%%%(", ZINT_ERROR_INVALID_DATA, 1, "Error 253: Malformed AI in input data (brackets don't match) in 2D component", "" }, /* #300 (#11), Andre Maute (`gs1_verify()` not checking length on resolve AI data loop) */
/* 8*/ { BARCODE_EANX_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\377\002\000\000\153\153\153\153\163\000\000\000\153\153\153\153\153\153\153\060\047\047\043\047\057\153\153\153\153\153\000\000\000\000\153\153\153\161\153\153\153\153\153\153\153\153\153\153\153\153\153\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\001\100\000\000\000\000\000\000\000\167\167\167\167\167\167\167\167\167\167\167\167\167\167", 127, "()904OOOOO)CK0336680OOOOOOOOOOOOOO29[0kkkk%%%%(", ZINT_ERROR_TOO_LONG, 1, "" }, /* #300 (#11 with EANX_CC) */ /* 8*/ { BARCODE_EANX_CC, GS1PARENS_MODE | GS1NOCHECK_MODE, -1, "\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\153\225\215\153\153\153\153\153\153\263\153\153\377\002\000\000\153\153\153\153\163\000\000\000\153\153\153\153\153\153\153\060\047\047\043\047\057\153\153\153\153\153\000\000\000\000\153\153\153\161\153\153\153\153\153\153\153\153\153\153\153\153\153\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\167\001\100\000\000\000\000\000\000\000\167\167\167\167\167\167\167\167\167\167\167\167\167\167", 127, "()904OOOOO)CK0336680OOOOOOOOOOOOOO29[0kkkk%%%%(", ZINT_ERROR_INVALID_DATA, 1, "Error 253: Malformed AI in input data (brackets don't match) in 2D component", "" }, /* #300 (#11 with EANX_CC) */
/* 9*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, 3, "[]28", -1, "[]RRR___________________KKKRRR0000", 0, 1, "" }, /* #300 (#13), Andre Maute (`calc_padding_ccc()` dividing by zero when linear width == 68) */ /* 9*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, 3, "[]28", -1, "[]RRR___________________KKKRRR0000", 0, 1, "", "" }, /* #300 (#13), Andre Maute (`calc_padding_ccc()` dividing by zero when linear width == 68) */
/*10*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, 3, "[]2", -1, "[]RRR___________________KKKRRR0000", 0, 1, "" }, /* #300 (#13 shortened to min linear input (but same linear width 68)) */ /*10*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, 3, "[]2", -1, "[]RRR___________________KKKRRR0000", 0, 1, "", "" }, /* #300 (#13 shortened to min linear input (but same linear width 68)) */
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, composite_length, ret; int i, length, composite_length, ret;
@ -3512,6 +3513,8 @@ static void test_fuzz(const testCtx *const p_ctx) {
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length); ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n",
i, symbol->errtxt, data[i].expected_errtxt);
if (ret < ZINT_ERROR) { if (ret < ZINT_ERROR) {
if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) { if (do_bwipp && testUtilCanBwipp(i, symbol, data[i].option_1, -1, -1, debug)) {

View File

@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2019-2023 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@ -6917,10 +6917,10 @@ static void test_minimalenc(const testCtx *const p_ctx) {
/*998*/ { BARCODE_DATAMATRIX, -1, -1, -1, "AAAAAAAAAAAA*+*0**AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, 0, 2, "" }, /*998*/ { BARCODE_DATAMATRIX, -1, -1, -1, "AAAAAAAAAAAA*+*0**AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, 0, 2, "" },
/*999*/ { BARCODE_DATAMATRIX, -1, -1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, 0, 0, "" }, /*999*/ { BARCODE_DATAMATRIX, -1, -1, -1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, 0, 0, "" },
/*1000*/ { BARCODE_DATAMATRIX, -1, -1, -1, "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177", 128, 0, 0, "" }, /*1000*/ { BARCODE_DATAMATRIX, -1, -1, -1, "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177", 128, 0, 0, "" },
/*1001*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, "\200\200\200[\200\200[\200\200", -1, 0, 1, "Can't have extended ASCII in GS1 mode so these will never happen" }, /*1001*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, "\200\200\200\035\200\200\035\200\200", -1, 0, 1, "Can't have extended ASCII in GS1 mode so these will never happen" },
/*1002*/ { BARCODE_DATAMATRIX, GS1_MODE, GS1_GS_SEPARATOR, -1, "\200\200\200[\200\200[\200\200", -1, 0, 0, "" }, /*1002*/ { BARCODE_DATAMATRIX, GS1_MODE, GS1_GS_SEPARATOR, -1, "\200\200\200\035\200\200\035\200\200", -1, 0, 0, "" },
/*1003*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, "\200\200\200\200[\200\200\200[\200\200", -1, 0, 1, "Stays in ASC after 1st FNC1" }, /*1003*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, "\200\200\200\200\035\200\200\200\035\200\200", -1, 0, 1, "Stays in ASC after 1st FNC1" },
/*1004*/ { BARCODE_DATAMATRIX, GS1_MODE, GS1_GS_SEPARATOR, -1, "\200\200\200\200[\200\200\200[\200\200", -1, 0, 0, "" }, /*1004*/ { BARCODE_DATAMATRIX, GS1_MODE, GS1_GS_SEPARATOR, -1, "\200\200\200\200\035\200\200\200\035\200\200", -1, 0, 0, "" },
/*1005*/ { BARCODE_DATAMATRIX, -1, -1, -1, "https://example.com/01/09506000134369", -1, 0, 0, "" }, /*1005*/ { BARCODE_DATAMATRIX, -1, -1, -1, "https://example.com/01/09506000134369", -1, 0, 0, "" },
/*1006*/ { BARCODE_DATAMATRIX, -1, -1, -1, "abcdefghi1234FGHIJKLMNabc@@@@@@@@@é", -1, 0, 0, "" }, /*1006*/ { BARCODE_DATAMATRIX, -1, -1, -1, "abcdefghi1234FGHIJKLMNabc@@@@@@@@@é", -1, 0, 0, "" },
/*1007*/ { BARCODE_DATAMATRIX, -1, -1, -1, "ABCDEF", -1, 0, 0, "" }, /*1007*/ { BARCODE_DATAMATRIX, -1, -1, -1, "ABCDEF", -1, 0, 0, "" },

View File

@ -279,38 +279,54 @@ static void test_hrt(const testCtx *const p_ctx) {
/* 3*/ { BARCODE_GS1_128, -1, "[01]12345678901231[10]12[20]AB", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB" }, /* AI (20) should be 2 nos. */ /* 3*/ { BARCODE_GS1_128, -1, "[01]12345678901231[10]12[20]AB", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB" }, /* AI (20) should be 2 nos. */
/* 4*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[01]12345678901231[10]10[20]AB", "", 0, "(01)12345678901231(10)10(20)AB" }, /* 4*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[01]12345678901231[10]10[20]AB", "", 0, "(01)12345678901231(10)10(20)AB" },
/* 5*/ { BARCODE_GS1_128, -1, "[01]12345678901231[10]AB[20]12", "", 0, "(01)12345678901231(10)AB(20)12" }, /* 5*/ { BARCODE_GS1_128, -1, "[01]12345678901231[10]AB[20]12", "", 0, "(01)12345678901231(10)AB(20)12" },
/* 6*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12" }, /* Incorrect check digit */ /* 6*/ { BARCODE_GS1_128, -1, "[91]ABCDEF]GH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDEF]GH" }, /* Invalid CSET 82 character */
/* 7*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901234[20]12", "[21]12345", 0, "(01)12345678901234(20)12" }, /* 7*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[91]ABCDEF]GH", "", 0, "(91)ABCDEF]GH" },
/* 8*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231[20]12", "[21]12345", 0, "(01)12345678901231(20)12" }, /* 8*/ { BARCODE_GS1_128, -1, "[91]ABCDEF)GH", "", 0, "(91)ABCDEF)GH" },
/* 9*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231[10]12[20]AB", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB" }, /* AI (20) should be 2 nos. */ /* 9*/ { BARCODE_GS1_128, -1, "[91]ABCDEF(GH", "", 0, "(91)ABCDEF(GH" },
/* 10*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]12[20]AB", "[21]12345", 0, "(01)12345678901231(10)12(20)AB" }, /* 10*/ { BARCODE_GS1_128, -1, "[91]ABCDE(20)12", "", 0, "(91)ABCDE(20)12" },
/* 11*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231[10]AB[20]12", "[21]12345", 0, "(01)12345678901231(10)AB(20)12" }, /* 11*/ { BARCODE_GS1_128, GS1PARENS_MODE, "(91)ABCDEF]GH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDEF]GH" }, /* Invalid CSET 82 character */
/* 12*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231[10]AB[20]12", "[30]1234567A", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)AB(20)12" }, /* 12*/ { BARCODE_GS1_128, GS1PARENS_MODE | GS1NOCHECK_MODE, "(91)ABCDEF]GH", "", 0, "(91)ABCDEF]GH" },
/* 13*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]AB[20]12", "[30]1234567A", 0, "(01)12345678901231(10)AB(20)12" }, /* 13*/ { BARCODE_GS1_128, GS1PARENS_MODE, "(91)ABCDEF)GH", "", 0, "(91)ABCDEF)GH" },
/* 14*/ { BARCODE_EAN14, -1, "1234567890123", "", 0, "(01)12345678901231" }, /* 14*/ { BARCODE_GS1_128, GS1PARENS_MODE, "(91)ABCDE[FGH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDE[FGH" }, /* Invalid CSET 82 character */
/* 15*/ { BARCODE_EAN14, -1, "1234", "", 0, "(01)00000000012348" }, /* 15*/ { BARCODE_GS1_128, GS1PARENS_MODE | GS1NOCHECK_MODE, "(91)ABCDE[FGH", "", 0, "(91)ABCDE[FGH" },
/* 16*/ { BARCODE_EAN14, -1, "12345", "", 0, "(01)00000000123457" }, /* 16*/ { BARCODE_GS1_128, GS1PARENS_MODE, "(91)ABCDE[92]GH", "", ZINT_WARN_NONCOMPLIANT, "(91)ABCDE[92]GH" }, /* Invalid CSET 82 character */
/* 17*/ { BARCODE_EAN14, -1, "12340", "", 0, "(01)00000000123402" }, /* 17*/ { BARCODE_GS1_128, GS1PARENS_MODE | GS1NOCHECK_MODE, "(91)ABCDE[92]GH", "", 0, "(91)ABCDE[92]GH" },
/* 18*/ { BARCODE_NVE18, -1, "12345678901234567", "", 0, "(00)123456789012345675" }, /* 18*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12" }, /* Incorrect check digit */
/* 19*/ { BARCODE_NVE18, -1, "1234", "", 0, "(00)000000000000012348" }, /* 19*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901234[20]12", "[21]12345", 0, "(01)12345678901234(20)12" },
/* 20*/ { BARCODE_NVE18, -1, "12345", "", 0, "(00)000000000000123457" }, /* 20*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231[20]12", "[21]12345", 0, "(01)12345678901231(20)12" },
/* 21*/ { BARCODE_NVE18, -1, "12340", "", 0, "(00)000000000000123402" }, /* 21*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231[10]12[20]AB", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB" }, /* AI (20) should be 2 nos. */
/* 22*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12" }, /* Incorrect check digit */ /* 22*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]12[20]AB", "[21]12345", 0, "(01)12345678901231(10)12(20)AB" },
/* 23*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]12345678901234[20]12", "", 0, "(01)12345678901234(20)12" }, /* 23*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231[10]AB[20]12", "[21]12345", 0, "(01)12345678901231(10)AB(20)12" },
/* 24*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[20]12", "", 0, "(01)12345678901231(20)12" }, /* 24*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231[10]AB[20]12", "[30]1234567A", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)AB(20)12" },
/* 25*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[10]12[20]AB", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB" }, /* AI (20) should be 2 nos. */ /* 25*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]AB[20]12", "[30]1234567A", 0, "(01)12345678901231(10)AB(20)12" },
/* 26*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]12345678901231[10]12[20]AB", "", 0, "(01)12345678901231(10)12(20)AB" }, /* 26*/ { BARCODE_EAN14, -1, "1234567890123", "", 0, "(01)12345678901231" },
/* 27*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[10]AB[20]12", "", 0, "(01)12345678901231(10)AB(20)12" }, /* 27*/ { BARCODE_EAN14, -1, "1234", "", 0, "(01)00000000012348" },
/* 28*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901234", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234" }, /* 28*/ { BARCODE_EAN14, -1, "12345", "", 0, "(01)00000000123457" },
/* 29*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]12345678901234", "[21]12345", 0, "(01)12345678901234" }, /* 29*/ { BARCODE_EAN14, -1, "12340", "", 0, "(01)00000000123402" },
/* 30*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "[21]12345", 0, "(01)12345678901231" }, /* 30*/ { BARCODE_NVE18, -1, "12345678901234567", "", 0, "(00)123456789012345675" },
/* 31*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[20]12[21]12345", "[21]12345", 0, "(01)12345678901231(20)12(21)12345" }, /* 31*/ { BARCODE_NVE18, -1, "1234", "", 0, "(00)000000000000012348" },
/* 32*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "" }, /* 32*/ { BARCODE_NVE18, -1, "12345", "", 0, "(00)000000000000123457" },
/* 33*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]12345678901234[20]12", "", 0, "" }, /* 33*/ { BARCODE_NVE18, -1, "12340", "", 0, "(00)000000000000123402" },
/* 34*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231[20]12", "", 0, "" }, /* 34*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234(20)12" }, /* Incorrect check digit */
/* 35*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "" }, /* 35*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]12345678901234[20]12", "", 0, "(01)12345678901234(20)12" },
/* 36*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]12345678901234[20]12", "[21]12345", 0, "" }, /* 36*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[20]12", "", 0, "(01)12345678901231(20)12" },
/* 37*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[20]12", "[21]12345", 0, "" }, /* 37*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[10]12[20]AB", "", ZINT_WARN_NONCOMPLIANT, "(01)12345678901231(10)12(20)AB" }, /* AI (20) should be 2 nos. */
/* 38*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]12345678901231[10]12[20]AB", "", 0, "(01)12345678901231(10)12(20)AB" },
/* 39*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[10]AB[20]12", "", 0, "(01)12345678901231(10)AB(20)12" },
/* 40*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[10]AB[20]12[90]ABC(2012", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(2012" },
/* 41*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC20)12" },
/* 42*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[10]AB[20]12[90]ABC(20)12", "", 0, "(01)12345678901231(10)AB(20)12(90)ABC(20)12" },
/* 43*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901234", "[21]12345", ZINT_WARN_NONCOMPLIANT, "(01)12345678901234" },
/* 44*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]12345678901234", "[21]12345", 0, "(01)12345678901234" },
/* 45*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "[21]12345", 0, "(01)12345678901231" },
/* 46*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[20]12[21]12345", "[21]12345", 0, "(01)12345678901231(20)12(21)12345" },
/* 47*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "" },
/* 48*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]12345678901234[20]12", "", 0, "" },
/* 49*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231[20]12", "", 0, "" },
/* 50*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[20]12[90]ABC(20)12", "", 0, "(01)12345678901231(20)12(90)ABC(20)12" },
/* 51*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "" },
/* 52*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]12345678901234[20]12", "[21]12345", 0, "" },
/* 53*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[20]12", "[21]12345", 0, "" },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
@ -1367,12 +1383,12 @@ static void test_gs1_verify(const testCtx *const p_ctx) {
/*1006*/ { "[9999]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9999)" }, /*1006*/ { "[9999]1234", ZINT_ERROR_INVALID_DATA, "", "260: Invalid AI (9999)" },
/*1007*/ { "[01]12345678901234[7006]200101", ZINT_WARN_NONCOMPLIANT, "01123456789012347006200101", "261: AI (01) position 14: Bad checksum '4', expected '1'" }, /*1007*/ { "[01]12345678901234[7006]200101", ZINT_WARN_NONCOMPLIANT, "01123456789012347006200101", "261: AI (01) position 14: Bad checksum '4', expected '1'" },
/*1008*/ { "[01]12345678901231[7006]200101", 0, "01123456789012317006200101", "" }, /*1008*/ { "[01]12345678901231[7006]200101", 0, "01123456789012317006200101", "" },
/*1009*/ { "[3900]1234567890[01]12345678901234", ZINT_WARN_NONCOMPLIANT, "39001234567890[0112345678901234", "261: AI (01) position 14: Bad checksum '4', expected '1'" }, /*1009*/ { "[3900]1234567890[01]12345678901234", ZINT_WARN_NONCOMPLIANT, "39001234567890\0350112345678901234", "261: AI (01) position 14: Bad checksum '4', expected '1'" },
/*1010*/ { "[3900]1234567890[01]12345678901231", 0, "39001234567890[0112345678901231", "" }, /*1010*/ { "[3900]1234567890[01]12345678901231", 0, "39001234567890\0350112345678901231", "" },
/*1011*/ { "[253]12345678901234[3901]12345678901234[20]12", ZINT_WARN_NONCOMPLIANT, "25312345678901234[390112345678901234[2012", "261: AI (253) position 13: Bad checksum '3', expected '8'" }, /*1011*/ { "[253]12345678901234[3901]12345678901234[20]12", ZINT_WARN_NONCOMPLIANT, "25312345678901234\035390112345678901234\0352012", "261: AI (253) position 13: Bad checksum '3', expected '8'" },
/*1012*/ { "[253]12345678901284[3901]12345678901234[20]12", 0, "25312345678901284[390112345678901234[2012", "" }, /*1012*/ { "[253]12345678901284[3901]12345678901234[20]12", 0, "25312345678901284\035390112345678901234\0352012", "" },
/*1013*/ { "[253]12345678901234[01]12345678901234[3901]12345678901234[20]12", ZINT_WARN_NONCOMPLIANT, "25312345678901234[0112345678901234390112345678901234[2012", "261: AI (01) position 14: Bad checksum '4', expected '1'" }, /*1013*/ { "[253]12345678901234[01]12345678901234[3901]12345678901234[20]12", ZINT_WARN_NONCOMPLIANT, "25312345678901234\0350112345678901234390112345678901234\0352012", "261: AI (01) position 14: Bad checksum '4', expected '1'" },
/*1014*/ { "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12", 0, "25312345678901284[0112345678901231390112345678901234[2012", "" }, /*1014*/ { "[253]12345678901284[01]12345678901231[3901]12345678901234[20]12", 0, "25312345678901284\0350112345678901231390112345678901234\0352012", "" },
/*1015*/ { "[01]12345678901231[0A]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "", "257: Invalid AI in input data (non-numeric characters in AI)" }, /*1015*/ { "[01]12345678901231[0A]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "", "257: Invalid AI in input data (non-numeric characters in AI)" },
/*1016*/ { "[01]12345678901231[0]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "", "256: Invalid AI in input data (AI too short)" }, /*1016*/ { "[01]12345678901231[0]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "", "256: Invalid AI in input data (AI too short)" },
/*1017*/ { "[01]12345678901231[]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "", "256: Invalid AI in input data (AI too short)" }, /*1017*/ { "[01]12345678901231[]12345678901231[20]12", ZINT_ERROR_INVALID_DATA, "", "256: Invalid AI in input data (AI too short)" },
@ -2127,122 +2143,134 @@ static void test_gs1nocheck_mode(const testCtx *const p_ctx) {
/* 51*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[1234567890]123", "", ZINT_ERROR_INVALID_DATA, "Error 255: Invalid AI in input data (AI too long)" }, /* Too long still checked */ /* 51*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[1234567890]123", "", ZINT_ERROR_INVALID_DATA, "Error 255: Invalid AI in input data (AI too long)" }, /* Too long still checked */
/* 52*/ { BARCODE_GS1_128, -1, "[12345]123", "", ZINT_ERROR_INVALID_DATA, "Error 255: Invalid AI in input data (AI too long)" }, /* 52*/ { BARCODE_GS1_128, -1, "[12345]123", "", ZINT_ERROR_INVALID_DATA, "Error 255: Invalid AI in input data (AI too long)" },
/* 53*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[12345]123", "", ZINT_ERROR_INVALID_DATA, "Error 255: Invalid AI in input data (AI too long)" }, /* Too long still checked */ /* 53*/ { BARCODE_GS1_128, GS1NOCHECK_MODE, "[12345]123", "", ZINT_ERROR_INVALID_DATA, "Error 255: Invalid AI in input data (AI too long)" }, /* Too long still checked */
/* 54*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]12", 0, "" }, /* 54*/ { BARCODE_GS1_128, GS1PARENS_MODE, "(91)AB[", "", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (91) position 3: Invalid CSET 82 character '['" },
/* 55*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231", "[20]12", 0, "" }, /* 55*/ { BARCODE_GS1_128, GS1PARENS_MODE | GS1NOCHECK_MODE, "(91)AB[", "", 0, "" },
/* 56*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901234", "[20]12", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1' in linear component" }, /* 56*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]12", 0, "" },
/* 57*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901234", "[20]12", 0, "" }, /* 57*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231", "[20]12", 0, "" },
/* 58*/ { BARCODE_GS1_128_CC, -1, "[01]123456789012345", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (01) in linear component" }, /* 58*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901234", "[20]12", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1' in linear component" },
/* 59*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]123456789012345", "[20]12", 0, "" }, /* 59*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901234", "[20]12", 0, "" },
/* 60*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]123", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (20) in 2D component" }, /* 60*/ { BARCODE_GS1_128_CC, -1, "[01]123456789012345", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (01) in linear component" },
/* 61*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231", "[20]123", 0, "" }, /* 61*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]123456789012345", "[20]12", 0, "" },
/* 62*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" }, /* 62*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]123", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (20) in 2D component" },
/* 63*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231", "[20]1A", 0, "" }, /* 63*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231", "[20]123", 0, "" },
/* 64*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, /* 64*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]1A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (20) position 2: Non-numeric character 'A' in 2D component" },
/* 65*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, /* Nonprintable ASCII still checked */ /* 65*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231", "[20]1A", 0, "" },
/* 66*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121\200", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in linear component" }, /* 66*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" },
/* 67*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121\200", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in linear component" }, /* 67*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, /* Nonprintable ASCII still checked */
/* 68*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, /* 68*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121\200", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in linear component" },
/* 69*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, /* Extended ASCII still checked */ /* 69*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121\200", "[20]12", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in linear component" },
/* 70*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, /* 70*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" },
/* 71*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, /* Format still checked */ /* 71*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, /* Extended ASCII still checked */
/* 72*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data in 2D component" }, /* 72*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" },
/* 73*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]", 0, "" }, /* Zero-length data not checked */ /* 73*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, /* Format still checked */
/* 74*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[2]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* 74*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data in 2D component" },
/* 75*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[2]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 1 AI still checked */ /* 75*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]", 0, "" }, /* Zero-length data not checked */
/* 76*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* 76*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[2]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" },
/* 77*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[]12", 0, "" }, /* Length 0 AI with data not checked */ /* 77*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[2]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 1 AI still checked */
/* 78*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[1]2[]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* 78*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" },
/* 79*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[1]2[]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 1 AI still checked */ /* 79*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[]12", 0, "" }, /* Length 0 AI with data not checked */
/* 80*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* 80*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[1]2[]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" },
/* 81*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */ /* 81*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[1]2[]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 1 AI still checked */
/* 82*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[][20]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* 82*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" },
/* 83*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[][20]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */ /* 83*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */
/* 84*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]12[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* 84*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[][20]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" },
/* 85*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]12[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */ /* 85*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[][20]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */
/* 86*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", "", 0, "" }, /* 86*/ { BARCODE_GS1_128_CC, -1, "[01]1234567890121", "[20]12[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" },
/* 87*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]12345678901231", "", 0, "" }, /* 87*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]12[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */
/* 88*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[10]123[11]1234", "", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11)" }, /* 88*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in 2D component input data" },
/* 89*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]1234", "", 0, "" }, /* 89*/ { BARCODE_GS1_128_CC, GS1NOCHECK_MODE, "[01]12345678901231", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in 2D component input data" }, /* Non-CSET 82 always checked for composite data */
/* 90*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[10]123[11]1234A", "", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11)" }, /* 90*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", "", 0, "" },
/* 91*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]1234A", "", 0, "" }, /* 91*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]12345678901231", "", 0, "" },
/* 92*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[10]123[11]12345A", "", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (11) position 6: Non-numeric character 'A'" }, /* 92*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[10]123[11]1234", "", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11)" },
/* 93*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]12345A", "", 0, "" }, /* 93*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]1234", "", 0, "" },
/* 94*/ { BARCODE_DBAR_EXP, -1, "[01]1234567890121\177", "", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1" }, /* 94*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[10]123[11]1234A", "", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11)" },
/* 95*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]1234567890121\177", "", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1" }, /* Nonprintable ASCII still checked */ /* 95*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]1234A", "", 0, "" },
/* 96*/ { BARCODE_DBAR_EXP, -1, "[01]1234567890121\200", "", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1" }, /* 96*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231[10]123[11]12345A", "", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (11) position 6: Non-numeric character 'A'" },
/* 97*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]1234567890121\200", "", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1" }, /* Extended ASCII still checked */ /* 97*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]12345A", "", 0, "" },
/* 98*/ { BARCODE_DBAR_EXP, -1, "011234567890121", "", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI" }, /* 98*/ { BARCODE_DBAR_EXP, -1, "[01]1234567890121\177", "", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1" },
/* 99*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "011234567890121", "", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI" }, /* Format still checked */ /* 99*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]1234567890121\177", "", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1" }, /* Nonprintable ASCII still checked */
/*100*/ { BARCODE_DBAR_EXP, -1, "[10]", "", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data" }, /*100*/ { BARCODE_DBAR_EXP, -1, "[01]1234567890121\200", "", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1" },
/*101*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[10]", "", 0, "" }, /* Zero-length data not checked */ /*101*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[01]1234567890121\200", "", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1" }, /* Extended ASCII still checked */
/*102*/ { BARCODE_DBAR_EXP, -1, "[2]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /*102*/ { BARCODE_DBAR_EXP, -1, "011234567890121", "", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI" },
/*103*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[2]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 1 AI still checked */ /*103*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "011234567890121", "", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI" }, /* Format still checked */
/*104*/ { BARCODE_DBAR_EXP, -1, "[]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /*104*/ { BARCODE_DBAR_EXP, -1, "[10]", "", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data" },
/*105*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[]1", "", 0, "" }, /* Length 0 AI with data not checked */ /*105*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[10]", "", 0, "" }, /* Zero-length data not checked */
/*106*/ { BARCODE_DBAR_EXP, -1, "[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /*106*/ { BARCODE_DBAR_EXP, -1, "[2]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" },
/*107*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 0 AI with no data still checked */ /*107*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[2]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 1 AI still checked */
/*108*/ { BARCODE_DBAR_EXP, -1, "[20]12[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /*108*/ { BARCODE_DBAR_EXP, -1, "[]1", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" },
/*109*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[20]12[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 0 AI with no data still checked */ /*109*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[]1", "", 0, "" }, /* Length 0 AI with data not checked */
/*110*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345", 0, "" }, /*110*/ { BARCODE_DBAR_EXP, -1, "[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" },
/*111*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345", 0, "" }, /*111*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 0 AI with no data still checked */
/*112*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]1234", "[21]ABC123[22]12345", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11) in linear component" }, /*112*/ { BARCODE_DBAR_EXP, -1, "[20]12[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" },
/*113*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]1234", "[21]ABC123[22]12345", 0, "" }, /*113*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[20]12[]", "", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short)" }, /* Length 0 AI with no data still checked */
/*114*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]123456", "[21]ABC123[22]12345", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (11) position 3: Invalid month '34' in linear component" }, /*114*/ { BARCODE_DBAR_EXP, -1, "[90]12]34", "", ZINT_ERROR_INVALID_DATA, "Error 386: Invalid character in General Field data" },
/*115*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]123456", "[21]ABC123[22]12345", 0, "" }, /*115*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, "[90]12]34", "", ZINT_ERROR_INVALID_DATA, "Error 386: Invalid character in General Field data" }, /* Non-CSET 82 always checked for DBAR_EXP */
/*116*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]123456789", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (30) in 2D component" }, /*116*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345", 0, "" },
/*117*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]123456789", 0, "" }, /*117*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345", 0, "" },
/*118*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]1234567A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (30) position 8: Non-numeric character 'A' in 2D component" }, /*118*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]1234", "[21]ABC123[22]12345", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11) in linear component" },
/*119*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]1234567A", 0, "" }, /*119*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]1234", "[21]ABC123[22]12345", 0, "" },
/*120*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, /*120*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]123456", "[21]ABC123[22]12345", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (11) position 3: Invalid month '34' in linear component" },
/*121*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, /* Nonprintable ASCII still checked */ /*121*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]123456", "[21]ABC123[22]12345", 0, "" },
/*122*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, /*122*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]123456789", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (30) in 2D component" },
/*123*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, /* Extended ASCII still checked */ /*123*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]123456789", 0, "" },
/*124*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, /*124*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]1234567A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (30) position 8: Non-numeric character 'A' in 2D component" },
/*125*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, /* Format still checked */ /*125*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]1234567A", 0, "" },
/*126*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[10]", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data in 2D component" }, /*126*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" },
/*127*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[10]", 0, "" }, /* Zero-length data not checked */ /*127*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, /* Nonprintable ASCII still checked */
/*128*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[2]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /*128*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" },
/*129*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[2]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 1 AI still checked */ /*129*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, /* Extended ASCII still checked */
/*130*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /*130*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" },
/*131*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[]12", 0, "" }, /* Length 0 AI with data not checked */ /*131*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, /* Format still checked */
/*132*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /*132*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[10]", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data in 2D component" },
/*133*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */ /*133*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[10]", 0, "" }, /* Zero-length data not checked */
/*134*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[20]12[][10]123", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /*134*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[2]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" },
/*135*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]12[][10]123", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */ /*135*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[2]1", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 1 AI still checked */
/*136*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", "", 0, "" }, /*136*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[]12", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" },
/*137*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]12345678901231", "", 0, "" }, /*137*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[]12", 0, "" }, /* Length 0 AI with data not checked */
/*138*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231[10]123[11]1234", "", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11)" }, /*138*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" },
/*139*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]1234", "", 0, "" }, /*139*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[]", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */
/*140*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231[10]123[11]1234A", "", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11)" }, /*140*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[20]12[][10]123", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" },
/*141*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]1234A", "", 0, "" }, /*141*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]12[][10]123", ZINT_ERROR_INVALID_DATA, "Error 256: Invalid AI in input data (AI too short) in 2D component" }, /* Length 0 AI with no data still checked */
/*142*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231[10]123[11]12345A", "", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (11) position 6: Non-numeric character 'A'" }, /*142*/ { BARCODE_DBAR_EXP_CC, -1, "[01]1234567890121", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in 2D component input data" },
/*143*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]12345A", "", 0, "" }, /*143*/ { BARCODE_DBAR_EXP_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in 2D component input data" }, /* Non-CSET 82 always checked for composite */
/*144*/ { BARCODE_DBAR_EXPSTK, -1, "[01]1234567890121\177", "", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1" }, /*144*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", "", 0, "" },
/*145*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]1234567890121\177", "", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1" }, /* Nonprintable ASCII still checked */ /*145*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]12345678901231", "", 0, "" },
/*146*/ { BARCODE_DBAR_EXPSTK, -1, "[01]1234567890121\200", "", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1" }, /*146*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231[10]123[11]1234", "", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11)" },
/*147*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]1234567890121\200", "", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1" }, /* Extended ASCII still checked */ /*147*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]1234", "", 0, "" },
/*148*/ { BARCODE_DBAR_EXPSTK, -1, "011234567890121", "", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI" }, /*148*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231[10]123[11]1234A", "", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11)" },
/*149*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "011234567890121", "", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI" }, /* Format still checked */ /*149*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]1234A", "", 0, "" },
/*150*/ { BARCODE_DBAR_EXPSTK, -1, "[01]", "", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data" }, /*150*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231[10]123[11]12345A", "", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (11) position 6: Non-numeric character 'A'" },
/*151*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]", "", 0, "" }, /* Zero-length data not checked */ /*151*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]12345A", "", 0, "" },
/*152*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345", 0, "" }, /*152*/ { BARCODE_DBAR_EXPSTK, -1, "[01]1234567890121\177", "", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1" },
/*153*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345", 0, "" }, /*153*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]1234567890121\177", "", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1" }, /* Nonprintable ASCII still checked */
/*154*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]1234", "[21]ABC123[22]12345", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11) in linear component" }, /*154*/ { BARCODE_DBAR_EXPSTK, -1, "[01]1234567890121\200", "", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1" },
/*155*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]1234", "[21]ABC123[22]12345", 0, "" }, /*155*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]1234567890121\200", "", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1" }, /* Extended ASCII still checked */
/*156*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]123456", "[21]ABC123[22]12345", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (11) position 3: Invalid month '34' in linear component" }, /*156*/ { BARCODE_DBAR_EXPSTK, -1, "011234567890121", "", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI" },
/*157*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]123456", "[21]ABC123[22]12345", 0, "" }, /*157*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "011234567890121", "", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI" }, /* Format still checked */
/*158*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]123456789", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (30) in 2D component" }, /*158*/ { BARCODE_DBAR_EXPSTK, -1, "[01]", "", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data" },
/*159*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]123456789", 0, "" }, /*159*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[01]", "", 0, "" }, /* Zero-length data not checked */
/*160*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]1234567A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (30) position 8: Non-numeric character 'A' in 2D component" }, /*160*/ { BARCODE_DBAR_EXPSTK, -1, "[90]12]34", "", ZINT_ERROR_INVALID_DATA, "Error 386: Invalid character in General Field data" },
/*161*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]1234567A", 0, "" }, /*161*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, "[90]12]34", "", ZINT_ERROR_INVALID_DATA, "Error 386: Invalid character in General Field data" }, /* Non-CSET 82 always checked for DBAR_EXPSTK */
/*162*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, /*162*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345", 0, "" },
/*163*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, /* Nonprintable ASCII still checked */ /*163*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345", 0, "" },
/*164*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, /*164*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]1234", "[21]ABC123[22]12345", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (11) in linear component" },
/*165*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, /* Extended ASCII still checked */ /*165*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]1234", "[21]ABC123[22]12345", 0, "" },
/*166*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, /*166*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]123456", "[21]ABC123[22]12345", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (11) position 3: Invalid month '34' in linear component" },
/*167*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, /* Format still checked */ /*167*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]12345678901231[10]123[11]123456", "[21]ABC123[22]12345", 0, "" },
/*168*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[235]", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data in 2D component" }, /*168*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]123456789", ZINT_ERROR_INVALID_DATA, "Error 259: Invalid data length for AI (30) in 2D component" },
/*169*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[235]", 0, "" }, /* Zero-length data not checked */ /*169*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]123456789", 0, "" },
/*170*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]1234567A", ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (30) position 8: Non-numeric character 'A' in 2D component" },
/*171*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]123456789012[01]12345678901231[10]123[11]121212", "[21]ABC123[22]12345[30]1234567A", 0, "" },
/*172*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" },
/*173*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\177", ZINT_ERROR_INVALID_DATA, "Error 263: DEL characters are not supported by GS1 in 2D component" }, /* Nonprintable ASCII still checked */
/*174*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" },
/*175*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[20]1\200", ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1 in 2D component" }, /* Extended ASCII still checked */
/*176*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" },
/*177*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "2012", ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI in 2D component" }, /* Format still checked */
/*178*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[235]", ZINT_ERROR_INVALID_DATA, "Error 258: Empty data field in input data in 2D component" },
/*179*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[235]", 0, "" }, /* Zero-length data not checked */
/*180*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]1234567890121", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in 2D component input data" },
/*181*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, "[01]1234567890121", "[90]12]34", ZINT_ERROR_INVALID_DATA, "Error 441: Invalid character in 2D component input data" }, /* Non-CSET 82 always checked for composite */
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;

View File

@ -2429,7 +2429,7 @@ int testUtilCanBwipp(int index, const struct zint_symbol *symbol, int option_1,
} }
/* Convert Zint GS1 and add-on format to BWIPP's */ /* Convert Zint GS1 and add-on format to BWIPP's */
static void testUtilBwippCvtGS1Data(char *bwipp_data, int upcean, int *addon_posn) { static void testUtilBwippCvtGS1Data(char *bwipp_data, const int upcean, const int parens_mode, int *addon_posn) {
char *b; char *b;
int pipe = 0; int pipe = 0;
@ -2438,9 +2438,9 @@ static void testUtilBwippCvtGS1Data(char *bwipp_data, int upcean, int *addon_pos
if (upcean && *b == '|') { if (upcean && *b == '|') {
pipe = 1; pipe = 1;
} }
if (*b == '[') { if (!parens_mode && *b == '[') {
*b = '('; *b = '(';
} else if (*b == ']') { } else if (!parens_mode && *b == ']') {
*b = ')'; *b = ')';
} else if (*b == '+' && upcean && !pipe) { } else if (*b == '+' && upcean && !pipe) {
*b = ' '; *b = ' ';
@ -2664,8 +2664,9 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
const int upcean = (ZBarcode_Cap(symbology, ZINT_CAP_EANUPC) & ZINT_CAP_EANUPC) == ZINT_CAP_EANUPC; const int upcean = (ZBarcode_Cap(symbology, ZINT_CAP_EANUPC) & ZINT_CAP_EANUPC) == ZINT_CAP_EANUPC;
const int upca = symbology == BARCODE_UPCA || symbology == BARCODE_UPCA_CHK || symbology == BARCODE_UPCA_CC; const int upca = symbology == BARCODE_UPCA || symbology == BARCODE_UPCA_CHK || symbology == BARCODE_UPCA_CC;
const char obracket = symbol->input_mode & GS1PARENS_MODE ? '(' : '['; const int parens_mode = symbol->input_mode & GS1PARENS_MODE;
const char cbracket = symbol->input_mode & GS1PARENS_MODE ? ')' : ']'; const char obracket = parens_mode ? '(' : '[';
const char cbracket = parens_mode ? ')' : ']';
int addon_posn; int addon_posn;
int eci; int eci;
int i, j, len; int i, j, len;
@ -2712,7 +2713,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
strcat(bwipp_data, primary); strcat(bwipp_data, primary);
strcat(bwipp_data, "|"); strcat(bwipp_data, "|");
strcat(bwipp_data, data); strcat(bwipp_data, data);
testUtilBwippCvtGS1Data(bwipp_data, upcean, &addon_posn); testUtilBwippCvtGS1Data(bwipp_data, upcean, parens_mode, &addon_posn);
/* Always set dontlint for now (until support for exclusive AIs check) */ /* Always set dontlint for now (until support for exclusive AIs check) */
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%sdontlint", strlen(bwipp_opts_buf) ? " " : ""); sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%sdontlint", strlen(bwipp_opts_buf) ? " " : "");
@ -2747,7 +2748,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
strcat(bwipp_data, symbology == BARCODE_NVE18 ? "(00)" : "(01)"); strcat(bwipp_data, symbology == BARCODE_NVE18 ? "(00)" : "(01)");
} }
strcat(bwipp_data, data); strcat(bwipp_data, data);
testUtilBwippCvtGS1Data(bwipp_data, upcean, &addon_posn); testUtilBwippCvtGS1Data(bwipp_data, upcean, parens_mode, &addon_posn);
/* Always set dontlint for now (until support for exclusive AIs check) */ /* Always set dontlint for now (until support for exclusive AIs check) */
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%sdontlint", strlen(bwipp_opts_buf) ? " " : ""); sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%sdontlint", strlen(bwipp_opts_buf) ? " " : "");
@ -2984,7 +2985,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
for (i = 0, j = 0, len = (int) strlen(bwipp_data); i <= len; i++) { for (i = 0, j = 0, len = (int) strlen(bwipp_data); i <= len; i++) {
if (bwipp_data[i] == obracket) { if (bwipp_data[i] == obracket) {
if (ai_latch == 0) { if (ai_latch == 0) {
bwipp_data[j++] = '['; bwipp_data[j++] = '\x1D';
} }
last_ai = to_int((unsigned char *) (bwipp_data + i + 1), 2); last_ai = to_int((unsigned char *) (bwipp_data + i + 1), 2);
if ((last_ai >= 0 && last_ai <= 4) || (last_ai >= 11 && last_ai <= 20) || last_ai == 23 if ((last_ai >= 0 && last_ai <= 4) || (last_ai >= 11 && last_ai <= 20) || last_ai == 23
@ -2997,7 +2998,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
} }
/* Replace square brackets with ^FNC1 */ /* Replace square brackets with ^FNC1 */
for (len = (int) strlen(bwipp_data), i = len - 1; i >= 0; i--) { for (len = (int) strlen(bwipp_data), i = len - 1; i >= 0; i--) {
if (bwipp_data[i] == '[') { if (bwipp_data[i] == '\x1D') {
memmove(bwipp_data + i + 5, bwipp_data + i + 1, len - i); memmove(bwipp_data + i + 5, bwipp_data + i + 1, len - i);
memcpy(bwipp_data + i, "^FNC1", 5); memcpy(bwipp_data + i, "^FNC1", 5);
len += 4; len += 4;
@ -3982,11 +3983,6 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
return 4; return 4;
} }
expected_len = (int) strlen(reduced); expected_len = (int) strlen(reduced);
for (i = 0; i < expected_len; i++) {
if (reduced[i] == '[') {
reduced[i] = 29;
}
}
expected = reduced; expected = reduced;
if (primary) { if (primary) {
/* TODO: */ /* TODO: */

View File

@ -259,7 +259,7 @@ static float ult_look_ahead_eightbit(const unsigned char source[], const int len
i = in_locn; i = in_locn;
while ((i < length) && (i < end_char)) { while ((i < length) && (i < end_char)) {
if ((source[i] == '[') && gs1) { if (gs1 && source[i] == '\x1D') {
cw[codeword_count] = 268; /* FNC1 */ cw[codeword_count] = 268; /* FNC1 */
} else { } else {
cw[codeword_count] = source[i]; cw[codeword_count] = source[i];
@ -345,7 +345,7 @@ static float ult_look_ahead_ascii(unsigned char source[], const int length, cons
} }
if (!done && source[i] < 0x80) { if (!done && source[i] < 0x80) {
if ((source[i] == '[') && gs1) { if (gs1 && source[i] == '\x1D') {
cw[codeword_count] = 272; /* FNC1 */ cw[codeword_count] = 272; /* FNC1 */
} else { } else {
cw[codeword_count] = source[i]; cw[codeword_count] = source[i];
@ -370,7 +370,7 @@ static float ult_look_ahead_ascii(unsigned char source[], const int length, cons
/* Returns true if should latch to subset other than given `subset` */ /* Returns true if should latch to subset other than given `subset` */
static int ult_c43_should_latch_other(const unsigned char source[], const int length, const int locn, static int ult_c43_should_latch_other(const unsigned char source[], const int length, const int locn,
const int subset, const int gs1) { const int subset) {
int i, fraglen, predict_window; int i, fraglen, predict_window;
int cnt, alt_cnt, fragno; int cnt, alt_cnt, fragno;
const char *const set = subset == 1 ? ult_c43_set1 : ult_c43_set2; const char *const set = subset == 1 ? ult_c43_set1 : ult_c43_set2;
@ -382,7 +382,7 @@ static int ult_c43_should_latch_other(const unsigned char source[], const int le
predict_window = locn + 3; predict_window = locn + 3;
for (i = locn, cnt = 0, alt_cnt = 0; i < predict_window; i++) { for (i = locn, cnt = 0, alt_cnt = 0; i < predict_window; i++) {
if (source[i] <= 0x1F || source[i] >= 0x7F || (gs1 && source[i] == '[')) { if (source[i] <= 0x1F || source[i] >= 0x7F) {
break; break;
} }
@ -519,7 +519,7 @@ static float ult_look_ahead_c43(const unsigned char source[], const int length,
while ((sublocn < length) && (sublocn < end_char)) { while ((sublocn < length) && (sublocn < end_char)) {
/* Check for FNC1 */ /* Check for FNC1 */
if (gs1 && source[sublocn] == '[') { if (gs1 && source[sublocn] == '\x1D') {
break; break;
} }
@ -530,7 +530,7 @@ static float ult_look_ahead_c43(const unsigned char source[], const int length,
} }
if ((new_subset != subset) && ((new_subset == 1) || (new_subset == 2))) { if ((new_subset != subset) && ((new_subset == 1) || (new_subset == 2))) {
if (ult_c43_should_latch_other(source, length, sublocn, subset, gs1)) { if (ult_c43_should_latch_other(source, length, sublocn, subset)) {
subcw[subcodeword_count] = 42; /* Latch to other C43 set */ subcw[subcodeword_count] = 42; /* Latch to other C43 set */
subcodeword_count++; subcodeword_count++;
unshift_set = new_subset; unshift_set = new_subset;
@ -674,7 +674,7 @@ static int ult_generate_codewords(struct zint_symbol *symbol, const unsigned cha
cw_fragment, &fragment_length, gs1); cw_fragment, &fragment_length, gs1);
ascii_score = ult_look_ahead_ascii(crop_source, crop_length, input_locn, current_mode, symbol_mode, ascii_score = ult_look_ahead_ascii(crop_source, crop_length, input_locn, current_mode, symbol_mode,
end_char, cw_fragment, &fragment_length, &ascii_encoded, gs1); end_char, cw_fragment, &fragment_length, &ascii_encoded, gs1);
subset = ult_c43_should_latch_other(crop_source, crop_length, input_locn, 1 /*subset*/, gs1) ? 2 : 1; subset = ult_c43_should_latch_other(crop_source, crop_length, input_locn, 1 /*subset*/) ? 2 : 1;
c43_score = ult_look_ahead_c43(crop_source, crop_length, input_locn, current_mode, end_char, c43_score = ult_look_ahead_c43(crop_source, crop_length, input_locn, current_mode, end_char,
subset, cw_fragment, &fragment_length, &c43_encoded, gs1, 0 /*debug_print*/); subset, cw_fragment, &fragment_length, &c43_encoded, gs1, 0 /*debug_print*/);
@ -752,7 +752,7 @@ static int ult_generate_codewords(struct zint_symbol *symbol, const unsigned cha
current_mode = ULT_ASCII_MODE; current_mode = ULT_ASCII_MODE;
break; break;
case 'c': case 'c':
subset = ult_c43_should_latch_other(crop_source, crop_length, input_locn, 1 /*subset*/, gs1) ? 2 : 1; subset = ult_c43_should_latch_other(crop_source, crop_length, input_locn, 1 /*subset*/) ? 2 : 1;
ult_look_ahead_c43(crop_source, crop_length, input_locn, current_mode, input_locn + block_length, ult_look_ahead_c43(crop_source, crop_length, input_locn, current_mode, input_locn + block_length,
subset, cw_fragment, &fragment_length, NULL, gs1, debug_print); subset, cw_fragment, &fragment_length, NULL, gs1, debug_print);

View File

@ -4027,7 +4027,10 @@ usage is given in section <a href="#gs1-128">6.1.10.3 GS1-128</a>.</p>
data that does not conform to the current GS1 standard. Printable ASCII data that does not conform to the current GS1 standard. Printable ASCII
input is still checked for, as is the validity of GS1 data specified input is still checked for, as is the validity of GS1 data specified
without AIs (e.g. linear data for GS1 DataBar without AIs (e.g. linear data for GS1 DataBar
Omnidirectional/Limited/etc.).</p> Omnidirectional/Limited/etc.). Also checked is GS1 DataBar Expanded and
GS1 Composite input that is not in the GS1 encodable character set 82
(see GS1 General Specifications Figure 7.11.1 GS1 AI encodable
character set 82), otherwise encodation would fail.</p>
<p>For <code>HEIGHTPERROW_MODE</code>, see <code>--heightperrow</code> <p>For <code>HEIGHTPERROW_MODE</code>, see <code>--heightperrow</code>
in section <a href="#adjusting-height">4.4 Adjusting Height</a>. The in section <a href="#adjusting-height">4.4 Adjusting Height</a>. The
<code>height</code> member should be set to the desired per-row value on <code>height</code> member should be set to the desired per-row value on

View File

@ -2406,7 +2406,10 @@ example of `GS1PARENS_MODE` usage is given in section [6.1.10.3 GS1-128].
`GS1NOCHECK_MODE` is for use with legacy systems that have data that does not `GS1NOCHECK_MODE` is for use with legacy systems that have data that does not
conform to the current GS1 standard. Printable ASCII input is still checked for, conform to the current GS1 standard. Printable ASCII input is still checked for,
as is the validity of GS1 data specified without AIs (e.g. linear data for GS1 as is the validity of GS1 data specified without AIs (e.g. linear data for GS1
DataBar Omnidirectional/Limited/etc.). DataBar Omnidirectional/Limited/etc.). Also checked is GS1 DataBar Expanded and
GS1 Composite input that is not in the GS1 encodable character set 82 (see GS1
General Specifications Figure 7.11.1 'GS1 AI encodable character set 82'),
otherwise encodation would fail.
For `HEIGHTPERROW_MODE`, see `--heightperrow` in section [4.4 Adjusting Height]. For `HEIGHTPERROW_MODE`, see `--heightperrow` in section [4.4 Adjusting Height].
The `height` member should be set to the desired per-row value on input (it will The `height` member should be set to the desired per-row value on input (it will

View File

@ -2379,7 +2379,10 @@ GS1PARENS_MODE usage is given in section 6.1.10.3 GS1-128.
GS1NOCHECK_MODE is for use with legacy systems that have data that does not GS1NOCHECK_MODE is for use with legacy systems that have data that does not
conform to the current GS1 standard. Printable ASCII input is still checked for, conform to the current GS1 standard. Printable ASCII input is still checked for,
as is the validity of GS1 data specified without AIs (e.g. linear data for GS1 as is the validity of GS1 data specified without AIs (e.g. linear data for GS1
DataBar Omnidirectional/Limited/etc.). DataBar Omnidirectional/Limited/etc.). Also checked is GS1 DataBar Expanded and
GS1 Composite input that is not in the GS1 encodable character set 82 (see GS1
General Specifications Figure 7.11.1 GS1 AI encodable character set 82),
otherwise encodation would fail.
For HEIGHTPERROW_MODE, see --heightperrow in section 4.4 Adjusting Height. The For HEIGHTPERROW_MODE, see --heightperrow in section 4.4 Adjusting Height. The
height member should be set to the desired per-row value on input (it will be height member should be set to the desired per-row value on input (it will be

View File

@ -1609,7 +1609,8 @@ as delimiters for GS1 Application Identifiers
<item> <item>
<widget class="QCheckBox" name="chkGS1NoCheck"> <widget class="QCheckBox" name="chkGS1NoCheck">
<property name="toolTip"> <property name="toolTip">
<string>Do not check GS1 data for validity <string>Do not check GS1 data for validity (note that certain
checks necessary for encodation are still performed)
(ignored if disabled)</string> (ignored if disabled)</string>
</property> </property>
<property name="text"> <property name="text">

View File

@ -802,7 +802,7 @@ void MainWindow::about()
"<p>Copyright &copy; 2006-2024 Robin Stuart and others.<br>" "<p>Copyright &copy; 2006-2024 Robin Stuart and others.<br>"
"Qt backend by BogDan Vatra.<br>" "Qt backend by BogDan Vatra.<br>"
"Released under GNU GPL 3.0 or later.</p>" "Released under GNU GPL 3.0 or later.</p>"
"<p>Qt version %2 (QSettings:<br>%3)</p>" "<p>Qt version %2<br>%3</p>"
"<p>\"Mailmark\" is a Registered Trademark of Royal Mail.<br>" "<p>\"Mailmark\" is a Registered Trademark of Royal Mail.<br>"
"\"QR Code\" is a Registered Trademark of Denso Corp.<br>" "\"QR Code\" is a Registered Trademark of Denso Corp.<br>"
"\"Telepen\" is a Registered Trademark of SB Electronics.</p>" "\"Telepen\" is a Registered Trademark of SB Electronics.</p>"