diff --git a/ChangeLog b/ChangeLog
index 68647d32..30bfea73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -86,6 +86,8 @@ Changes
- CODE128: increase no. symbol chars max 60 -> 99
- frontend: truncate overlong `--primary` instead of ignoring
- man page: list size detail for matrix symbols (`--vers`)
+- CODE11/C25XXX/CODE39/EXCODE39/HIBC_39/CODE93/CODABAR/PLESSEY/MSI_PLESSEY/FLAT/
+ DAFT/TELEPEN/TELEPEN_NUM: increase allowed lengths
Bugs
----
diff --git a/backend/2of5.c b/backend/2of5.c
index 4a8fc458..ce3665c1 100644
--- a/backend/2of5.c
+++ b/backend/2of5.c
@@ -67,9 +67,9 @@ static int c25_common(struct zint_symbol *symbol, const unsigned char source[],
const int is_matrix, const char *start_stop[2], const int start_length, const int error_base) {
int i;
- char dest[500]; /* Largest destination 6 + (80 + 1) * 6 + 5 + 1 = 498 */
+ char dest[818]; /* Largest destination 4 + (80 + 1) * 10 + 3 + 1 = 818 */
char *d = dest;
- unsigned char temp[80 + 1 + 1]; /* Largest maximum 80 + optional check digit */
+ unsigned char temp[113 + 1 + 1]; /* Largest maximum 113 + optional check digit */
int have_checkdigit = symbol->option_2 == 1 || symbol->option_2 == 2;
if (length > max) {
@@ -123,35 +123,39 @@ static int c25_common(struct zint_symbol *symbol, const unsigned char source[],
/* Code 2 of 5 Standard (Code 2 of 5 Matrix) */
INTERNAL int c25standard(struct zint_symbol *symbol, unsigned char source[], int length) {
- return c25_common(symbol, source, length, 80, 1 /*is_matrix*/, C25MatrixStartStop, 6, 301);
+ /* 9 + (112 + 1) * 10 + 8 = 1147 */
+ return c25_common(symbol, source, length, 112, 1 /*is_matrix*/, C25MatrixStartStop, 6, 301);
}
/* Code 2 of 5 Industrial */
INTERNAL int c25ind(struct zint_symbol *symbol, unsigned char source[], int length) {
- return c25_common(symbol, source, length, 45, 0 /*is_matrix*/, C25IndustStartStop, 6, 303);
+ /* 10 + (79 + 1) * 14 + 9 = 1139 */
+ return c25_common(symbol, source, length, 79, 0 /*is_matrix*/, C25IndustStartStop, 6, 303);
}
/* Code 2 of 5 IATA */
INTERNAL int c25iata(struct zint_symbol *symbol, unsigned char source[], int length) {
- return c25_common(symbol, source, length, 45, 0 /*is_matrix*/, C25IataLogicStartStop, 4, 305);
+ /* 4 + (80 + 1) * 14 + 5 = 1143 */
+ return c25_common(symbol, source, length, 80, 0 /*is_matrix*/, C25IataLogicStartStop, 4, 305);
}
/* Code 2 of 5 Data Logic */
INTERNAL int c25logic(struct zint_symbol *symbol, unsigned char source[], int length) {
- return c25_common(symbol, source, length, 80, 1 /*is_matrix*/, C25IataLogicStartStop, 4, 307);
+ /* 4 + (113 + 1) * 10 + 5 = 1149 */
+ return c25_common(symbol, source, length, 113, 1 /*is_matrix*/, C25IataLogicStartStop, 4, 307);
}
/* Common to Interleaved, ITF-14, DP Leitcode, DP Identcode */
static int c25_inter_common(struct zint_symbol *symbol, unsigned char source[], int length,
const int dont_set_height) {
int i, j, error_number = 0;
- char dest[468]; /* 4 + (90 + 2) * 5 + 3 + 1 = 468 */
+ char dest[638]; /* 4 + (125 + 1) * 5 + 3 + 1 = 638 */
char *d = dest;
- unsigned char temp[90 + 2 + 1];
+ unsigned char temp[125 + 1 + 1];
int have_checkdigit = symbol->option_2 == 1 || symbol->option_2 == 2;
- if (length > 90) {
- strcpy(symbol->errtxt, "309: Input too long (90 character maximum)");
+ if (length > 125) { /* 4 + (125 + 1) * 9 + 5 = 1143 */
+ strcpy(symbol->errtxt, "309: Input too long (125 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
if (!is_sane(NEON_F, source, length)) {
diff --git a/backend/code.c b/backend/code.c
index e06b6897..cfc40e4c 100644
--- a/backend/code.c
+++ b/backend/code.c
@@ -132,8 +132,9 @@ INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int leng
int i;
int h, c_digit, c_weight, c_count, k_digit, k_weight, k_count;
- int weight[122], error_number = 0;
- char dest[750]; /* 6 + 121 * 6 + 2 * 6 + 5 + 1 == 750 */
+ int weight[141]; /* 140 + 1 extra for 1st check */
+ char dest[864]; /* 6 + 140 * 6 + 2 * 6 + 5 + 1 = 864 */
+ int error_number = 0;
char *d = dest;
int num_check_digits;
char checkstr[3] = {0};
@@ -142,8 +143,8 @@ INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int leng
/* Suppresses clang-tidy clang-analyzer-core.UndefinedBinaryOperatorResult warning */
assert(length > 0);
- if (length > 121) {
- strcpy(symbol->errtxt, "320: Input too long (121 character maximum)");
+ if (length > 140) { /* 8 (Start) + 140 * 8 + 2 * 8 (Check) + 7 (Stop) = 1151 */
+ strcpy(symbol->errtxt, "320: Input too long (140 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
if (!is_sane(SODIUM_MNS_F, source, length)) {
@@ -241,8 +242,8 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng
int i;
int counter;
int error_number = 0;
- int posns[85];
- char dest[880]; /* 10 (Start) + 85 * 10 + 10 (Check) + 9 (Stop) + 1 = 880 */
+ int posns[86];
+ char dest[890]; /* 10 (Start) + 86 * 10 + 10 (Check) + 9 (Stop) + 1 = 890 */
char *d = dest;
char localstr[2] = {0};
@@ -257,17 +258,17 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng
strcpy(symbol->errtxt, "322: Input too long (30 character maximum)");
return ZINT_ERROR_TOO_LONG;
/* Prevent encoded_data out-of-bounds >= 143 for BARCODE_HIBC_39 due to wider 'wide' bars */
- } else if ((symbol->symbology == BARCODE_HIBC_39) && (length > 69)) {
+ } else if ((symbol->symbology == BARCODE_HIBC_39) && (length > 70)) { /* 16 (Start) + 70*16 + 15 (Stop) = 1151 */
/* Note use 319 (2of5 range) as 340 taken by CODE128 */
- strcpy(symbol->errtxt, "319: Input too long (67 character maximum)"); /* 69 less '+' and check */
+ strcpy(symbol->errtxt, "319: Input too long (68 character maximum)"); /* 70 less '+' and check */
return ZINT_ERROR_TOO_LONG;
- } else if (length > 85) {
- strcpy(symbol->errtxt, "323: Input too long (85 character maximum)");
+ } else if (length > 86) { /* 13 (Start) + 86*13 + 12 (Stop) = 1143 */
+ strcpy(symbol->errtxt, "323: Input too long (86 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
to_upper(source, length);
- if (!is_sane_lookup(SILVER, 43, source, length, posns)) {
+ if (!is_sane_lookup(SILVER, 43 /* Up to "%" */, source, length, posns)) {
strcpy(symbol->errtxt, "324: Invalid character in data (alphanumerics, space and \"-.$/+%\" only)");
return ZINT_ERROR_INVALID_DATA;
}
@@ -306,7 +307,7 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng
d += 9;
if ((symbol->symbology == BARCODE_LOGMARS) || (symbol->symbology == BARCODE_HIBC_39)) {
- /* LOGMARS uses wider 'wide' bars than normal Code 39 */
+ /* LOGMARS and HIBC use wider 'wide' bars than normal Code 39 */
counter = d - dest;
for (i = 0; i < counter; i++) {
if (dest[i] == '2') {
@@ -442,14 +443,14 @@ INTERNAL int pzn(struct zint_symbol *symbol, unsigned char source[], int length)
/* Extended Code 39 - ISO/IEC 16388:2007 Annex A */
INTERNAL int excode39(struct zint_symbol *symbol, unsigned char source[], int length) {
- unsigned char buffer[85 * 2 + 1] = {0};
+ unsigned char buffer[86 * 2 + 1] = {0};
unsigned char *b = buffer;
unsigned char check_digit = '\0';
int i;
int error_number;
- if (length > 85) {
- strcpy(symbol->errtxt, "328: Input too long (85 character maximum)");
+ if (length > 86) {
+ strcpy(symbol->errtxt, "328: Input too long (86 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
@@ -463,8 +464,8 @@ INTERNAL int excode39(struct zint_symbol *symbol, unsigned char source[], int le
memcpy(b, EC39Ctrl[source[i]], 2);
b += EC39Ctrl[source[i]][1] ? 2 : 1;
}
- if (b - buffer > 85) {
- strcpy(symbol->errtxt, "317: Expanded input too long (85 symbol character maximum)");
+ if (b - buffer > 86) {
+ strcpy(symbol->errtxt, "317: Expanded input too long (86 symbol character maximum)");
return ZINT_ERROR_TOO_LONG;
}
*b = '\0';
@@ -501,17 +502,17 @@ INTERNAL int code93(struct zint_symbol *symbol, unsigned char source[], int leng
int i;
int h, weight, c, k, error_number = 0;
- int values[110]; /* 107 + 2 (Checks) */
- char buffer[216]; /* 107*2 (107 full ASCII) + 1 = 215 */
+ int values[125]; /* 123 + 2 (Checks) */
+ char buffer[247]; /* 123*2 (123 full ASCII) + 1 = 247 */
char *b = buffer;
- char dest[668]; /* 6 (Start) + 107*6 + 2*6 (Checks) + 7 (Stop) + 1 (NUL) = 668 */
+ char dest[764]; /* 6 (Start) + 123*6 + 2*6 (Checks) + 7 (Stop) + 1 (NUL) = 764 */
char *d = dest;
/* Suppresses clang-tidy clang-analyzer-core.CallAndMessage warning */
assert(length > 0);
- if (length > 107) { /* 9 (Start) + 107*9 + 2*9 (Checks) + 10 (Stop) == 1000 */
- strcpy(symbol->errtxt, "330: Input too long (107 character maximum)");
+ if (length > 123) { /* 9 (Start) + 123*9 + 2*9 (Checks) + 10 (Stop) = 1144 */
+ strcpy(symbol->errtxt, "330: Input too long (123 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
@@ -529,8 +530,8 @@ INTERNAL int code93(struct zint_symbol *symbol, unsigned char source[], int leng
/* Now we can check the true length of the barcode */
h = b - buffer;
- if (h > 107) {
- strcpy(symbol->errtxt, "332: Expanded input too long (107 symbol character maximum)");
+ if (h > 123) {
+ strcpy(symbol->errtxt, "332: Expanded input too long (123 symbol character maximum)");
return ZINT_ERROR_TOO_LONG;
}
diff --git a/backend/imail.c b/backend/imail.c
index 4dd2e7a5..f2bee1ce 100644
--- a/backend/imail.c
+++ b/backend/imail.c
@@ -246,7 +246,8 @@ INTERNAL int usps_imail(struct zint_symbol *symbol, unsigned char source[], int
char data_pattern[200];
int error_number = 0;
int i, j, read;
- char zip[35], tracker[35], temp[2];
+ char tracker[33] = {0}; /* Zero to prevent false warning from clang-tidy */
+ char zip[33], temp[2];
large_uint accum;
large_uint byte_array_reg;
unsigned char byte_array[13];
@@ -267,7 +268,7 @@ INTERNAL int usps_imail(struct zint_symbol *symbol, unsigned char source[], int
/* separate the tracking code from the routing code */
- tracker[0] = zip[0] = '\0';
+ zip[0] = '\0';
read = 0;
j = 0;
for (i = 0; i < length; i++) {
@@ -339,7 +340,7 @@ INTERNAL int usps_imail(struct zint_symbol *symbol, unsigned char source[], int
/* and then the rest */
- for (read = 2, len = (int) strlen(tracker); read < len; read++) {
+ for (read = 2; read < 20; read++) {
large_mul_u64(&accum, 10);
large_add_u64(&accum, ctoi(tracker[read]));
diff --git a/backend/medical.c b/backend/medical.c
index 8d26dd00..73361956 100644
--- a/backend/medical.c
+++ b/backend/medical.c
@@ -1,7 +1,7 @@
/* medical.c - Handles 1 track and 2 track pharmacode and Codabar */
/*
libzint - the open source barcode library
- Copyright (C) 2008-2022 Robin Stuart
+ Copyright (C) 2008-2023 Robin Stuart
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -202,14 +202,14 @@ INTERNAL int pharma_two(struct zint_symbol *symbol, unsigned char source[], int
INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int length) {
int i, error_number = 0;
- int posns[60];
- char dest[512];
+ int posns[103];
+ char dest[833]; /* (103 + 1) * 8 + 1 == 833 */
char *d = dest;
int add_checksum, count = 0, checksum = 0;
int d_chars = 0;
- if (length > 60) { /* No stack smashing please */
- strcpy(symbol->errtxt, "356: Input too long (60 character maximum)");
+ if (length > 103) { /* No stack smashing please (103 + 1) * 11 = 1144 */
+ strcpy(symbol->errtxt, "356: Input too long (103 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
/* BS EN 798:1995 4.2 "'Codabar' symbols shall consist of ... b) start character;
diff --git a/backend/plessey.c b/backend/plessey.c
index a40b8e13..73474ea1 100644
--- a/backend/plessey.c
+++ b/backend/plessey.c
@@ -1,7 +1,7 @@
/* plessey.c - Handles Plessey and MSI Plessey */
/*
libzint - the open source barcode library
- Copyright (C) 2008-2022 Robin Stuart
+ Copyright (C) 2008-2023 Robin Stuart
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -55,14 +55,14 @@ static const char MSITable[10][8] = {
INTERNAL int plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
int i;
- unsigned char checkptr[65 * 4 + 8] = {0};
+ unsigned char checkptr[67 * 4 + 8] = {0};
static const char grid[9] = {1, 1, 1, 1, 0, 1, 0, 0, 1};
- char dest[554]; /* 8 + 65 * 8 + 8 * 2 + 9 + 1 = 554 */
+ char dest[570]; /* 8 + 67 * 8 + 2 * 8 + 9 + 1 = 570 */
char *d = dest;
int error_number = 0;
- if (length > 65) {
- strcpy(symbol->errtxt, "370: Input too long (65 character maximum)");
+ if (length > 67) { /* 16 + 67 * 16 + 4 * 8 + 19 = 1139 */
+ strcpy(symbol->errtxt, "370: Input too long (67 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
if (!is_sane(SSET_F, source, length)) {
@@ -130,7 +130,7 @@ static char msi_check_digit_mod10(const unsigned char source[], const int length
int i, x = 0, undoubled = 0;
for (i = length - 1; i >= 0; i--) {
- /* Note overflow impossible for max length 65 * max weight 9 * max val 15 == 8775 */
+ /* Note overflow impossible for max length 92 * max weight 9 * max val 15 == 12420 */
x += vals[undoubled][ctoi(source[i])];
undoubled = !undoubled;
}
@@ -144,7 +144,7 @@ static char msi_check_digit_mod11(const unsigned char source[], const int length
int i, x = 0, weight = 2;
for (i = length - 1; i >= 0; i--) {
- /* Note overflow impossible for max length 65 * max weight 9 * max val 15 == 8775 */
+ /* Note overflow impossible for max length 92 * max weight 9 * max val 15 == 12420 */
x += weight * ctoi(source[i]);
weight++;
if (weight > wrap) {
@@ -204,7 +204,7 @@ static char *msi_plessey_mod1010(struct zint_symbol *symbol, const unsigned char
const int no_checktext, char *d) {
int i;
- unsigned char temp[65 + 2 + 1];
+ unsigned char temp[92 + 2 + 1];
/* Append check digits */
temp[0] = '\0';
@@ -272,7 +272,7 @@ static char *msi_plessey_mod1110(struct zint_symbol *symbol, const unsigned char
/* Uses the IBM weight system if wrap = 7, and the NCR system if wrap = 9 */
int i;
char check_digit;
- unsigned char temp[65 + 3 + 1];
+ unsigned char temp[92 + 3 + 1];
int temp_len = length;
temp[0] = '\0';
@@ -308,13 +308,13 @@ static char *msi_plessey_mod1110(struct zint_symbol *symbol, const unsigned char
INTERNAL int msi_plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
int error_number = 0;
- char dest[550]; /* 2 + 65 * 8 + 3 * 8 + 3 + 1 = 550 */
+ char dest[766]; /* 2 + 92 * 8 + 3 * 8 + 3 + 1 = 766 */
char *d = dest;
int check_option = symbol->option_2;
int no_checktext = 0;
- if (length > 65) {
- strcpy(symbol->errtxt, "372: Input too long (65 character maximum)");
+ if (length > 92) { /* 3 (Start) + 92 * 12 + 3 * 12 + 4 (Stop) = 1147 */
+ strcpy(symbol->errtxt, "372: Input too long (92 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
if (!is_sane(NEON_F, source, length)) {
diff --git a/backend/postal.c b/backend/postal.c
index 51ef1b67..8442e4e1 100644
--- a/backend/postal.c
+++ b/backend/postal.c
@@ -559,12 +559,12 @@ INTERNAL int kix(struct zint_symbol *symbol, unsigned char source[], int length)
/* Handles DAFT Code symbols */
INTERNAL int daft(struct zint_symbol *symbol, unsigned char source[], int length) {
- int posns[250];
+ int posns[576];
int loopey;
int writer;
- if (length > 250) {
- strcpy(symbol->errtxt, "492: Input too long (250 character maximum)");
+ if (length > 576) { /* 576 * 2 = 1152 */
+ strcpy(symbol->errtxt, "492: Input too long (576 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
to_upper(source, length);
@@ -610,11 +610,11 @@ INTERNAL int daft(struct zint_symbol *symbol, unsigned char source[], int length
/* Flattermarken - Not really a barcode symbology! */
INTERNAL int flat(struct zint_symbol *symbol, unsigned char source[], int length) {
int loop, error_number = 0;
- char dest[512]; /* 90 * 4 + 1 ~ */
+ char dest[512]; /* 128 * 4 = 512 */
char *d = dest;
- if (length > 90) {
- strcpy(symbol->errtxt, "494: Input too long (90 character maximum)");
+ if (length > 128) { /* 128 * 9 = 1152 */
+ strcpy(symbol->errtxt, "494: Input too long (128 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
if (!is_sane(NEON_F, source, length)) {
diff --git a/backend/telepen.c b/backend/telepen.c
index 166f347c..9ef16f0b 100644
--- a/backend/telepen.c
+++ b/backend/telepen.c
@@ -1,7 +1,7 @@
/* telepen.c - Handles Telepen and Telepen numeric */
/*
libzint - the open source barcode library
- Copyright (C) 2008-2022 Robin Stuart
+ Copyright (C) 2008-2023 Robin Stuart
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -89,15 +89,15 @@ static const char TeleLens[128] = {
INTERNAL int telepen(struct zint_symbol *symbol, unsigned char source[], int src_len) {
int i, count, check_digit;
int error_number;
- char dest[521]; /* 12 (start) + 30 * 16 (max for DELs) + 16 (check digit) + 12 (stop) + 1 = 521 */
+ char dest[1145]; /* 12 (Start) + 69 * 16 (max for DELs) + 16 (Check) + 12 (stop) + 1 = 1145 */
char *d = dest;
error_number = 0;
count = 0;
- if (src_len > 30) {
- strcpy(symbol->errtxt, "390: Input too long (30 character maximum)");
+ if (src_len > 69) { /* 16 (Start) + 69 * 16 + 16 (Check) + 16 (Stop) = 1152 */
+ strcpy(symbol->errtxt, "390: Input too long (69 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
/* Start character */
@@ -153,14 +153,14 @@ INTERNAL int telepen_num(struct zint_symbol *symbol, unsigned char source[], int
int count, check_digit, glyph;
int error_number = 0;
int i;
- char dest[521]; /* 12 (start) + 30 * 16 (max for DELs) + 16 (check digit) + 12 (stop) + 1 = 521 */
+ char dest[1129]; /* 12 (Start) + 68 * 16 (max for DELs) + 16 (Check) + 12 (Stop) + 1 = 1129 */
char *d = dest;
- unsigned char temp[61];
+ unsigned char temp[137];
count = 0;
- if (src_len > 60) {
- strcpy(symbol->errtxt, "392: Input too long (60 character maximum)");
+ if (src_len > 136) { /* 68*2 */
+ strcpy(symbol->errtxt, "392: Input too long (136 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
if (!is_sane(SODIUM_X_F, source, src_len)) {
diff --git a/backend/tests/test_2of5.c b/backend/tests/test_2of5.c
index 8e6d15ce..14775554 100644
--- a/backend/tests/test_2of5.c
+++ b/backend/tests/test_2of5.c
@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
- Copyright (C) 2020-2022 Robin Stuart
+ Copyright (C) 2020-2023 Robin Stuart
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -45,26 +45,26 @@ static void test_large(const testCtx *const p_ctx) {
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
- /* 0*/ { BARCODE_C25STANDARD, -1, "1", 80, 0, 1, 817 },
- /* 1*/ { BARCODE_C25STANDARD, -1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 2*/ { BARCODE_C25STANDARD, 1, "1", 80, 0, 1, 827 },
- /* 3*/ { BARCODE_C25STANDARD, 1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 4*/ { BARCODE_C25INTER, -1, "1", 90, 0, 1, 819 },
- /* 5*/ { BARCODE_C25INTER, -1, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 6*/ { BARCODE_C25INTER, 1, "1", 90, 0, 1, 837 },
- /* 7*/ { BARCODE_C25INTER, 1, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 8*/ { BARCODE_C25IATA, -1, "1", 45, 0, 1, 639 },
- /* 9*/ { BARCODE_C25IATA, -1, "1", 46, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 10*/ { BARCODE_C25IATA, 1, "1", 45, 0, 1, 653 },
- /* 11*/ { BARCODE_C25IATA, 1, "1", 46, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 12*/ { BARCODE_C25LOGIC, -1, "1", 80, 0, 1, 809 },
- /* 13*/ { BARCODE_C25LOGIC, -1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 14*/ { BARCODE_C25LOGIC, 1, "1", 80, 0, 1, 819 },
- /* 15*/ { BARCODE_C25LOGIC, 1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 16*/ { BARCODE_C25IND, -1, "1", 45, 0, 1, 649 },
- /* 17*/ { BARCODE_C25IND, -1, "1", 46, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 18*/ { BARCODE_C25IND, 1, "1", 45, 0, 1, 663 },
- /* 19*/ { BARCODE_C25IND, 1, "1", 46, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 0*/ { BARCODE_C25STANDARD, -1, "1", 112, 0, 1, 1137 },
+ /* 1*/ { BARCODE_C25STANDARD, -1, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 2*/ { BARCODE_C25STANDARD, 1, "1", 112, 0, 1, 1147 },
+ /* 3*/ { BARCODE_C25STANDARD, 1, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 4*/ { BARCODE_C25INTER, -1, "1", 125, 0, 1, 1143 },
+ /* 5*/ { BARCODE_C25INTER, -1, "1", 126, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 6*/ { BARCODE_C25INTER, 1, "1", 125, 0, 1, 1143 },
+ /* 7*/ { BARCODE_C25INTER, 1, "1", 126, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 8*/ { BARCODE_C25IATA, -1, "1", 80, 0, 1, 1129 },
+ /* 9*/ { BARCODE_C25IATA, -1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 10*/ { BARCODE_C25IATA, 1, "1", 80, 0, 1, 1143 },
+ /* 11*/ { BARCODE_C25IATA, 1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 12*/ { BARCODE_C25LOGIC, -1, "1", 113, 0, 1, 1139 },
+ /* 13*/ { BARCODE_C25LOGIC, -1, "1", 114, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 14*/ { BARCODE_C25LOGIC, 1, "1", 113, 0, 1, 1149 },
+ /* 15*/ { BARCODE_C25LOGIC, 1, "1", 114, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 16*/ { BARCODE_C25IND, -1, "1", 79, 0, 1, 1125 },
+ /* 17*/ { BARCODE_C25IND, -1, "1", 80, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 18*/ { BARCODE_C25IND, 1, "1", 79, 0, 1, 1139 },
+ /* 19*/ { BARCODE_C25IND, 1, "1", 80, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 20*/ { BARCODE_DPLEIT, -1, "1", 13, 0, 1, 135 },
/* 21*/ { BARCODE_DPLEIT, -1, "1", 14, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 22*/ { BARCODE_DPIDENT, -1, "1", 11, 0, 1, 117 },
@@ -74,11 +74,11 @@ static void test_large(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
char data_buf[4096];
- testStart("test_large");
+ testStartSymbol("test_large", &symbol);
for (i = 0; i < data_size; i++) {
@@ -144,9 +144,9 @@ static void test_hrt(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
- testStart("test_hrt");
+ testStartSymbol("test_hrt", &symbol);
for (i = 0; i < data_size; i++) {
@@ -191,9 +191,9 @@ static void test_input(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
- testStart("test_input");
+ testStartSymbol("test_input", &symbol);
for (i = 0; i < data_size; i++) {
@@ -316,12 +316,12 @@ static void test_encode(const testCtx *const p_ctx) {
char cmp_buf[4096];
char cmp_msg[1024];
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
- testStart("test_encode");
+ testStartSymbol("test_encode", &symbol);
for (i = 0; i < data_size; i++) {
diff --git a/backend/tests/test_code.c b/backend/tests/test_code.c
index 79fdf4a4..6df228e6 100644
--- a/backend/tests/test_code.c
+++ b/backend/tests/test_code.c
@@ -45,40 +45,42 @@ static void test_large(const testCtx *const p_ctx) {
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
- /* 0*/ { BARCODE_CODE11, -1, "1", 121, 0, 1, 999 }, /* 8 (Start) + 121*8 + 2*8 (Checks) + 7 (Stop) == 999 */
- /* 1*/ { BARCODE_CODE11, -1, "1", 122, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 2*/ { BARCODE_CODE39, -1, "1", 85, 0, 1, 1130 }, /* 13 (Start) + 85*13 + 12 (Stop) == 1130 */
- /* 3*/ { BARCODE_CODE39, -1, "1", 86, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 4*/ { BARCODE_EXCODE39, -1, "1", 85, 0, 1, 1130 },
- /* 5*/ { BARCODE_EXCODE39, -1, "1", 86, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 6*/ { BARCODE_EXCODE39, -1, "a", 42, 0, 1, 1117 }, /* Takes 2 encoding chars per char */
- /* 7*/ { BARCODE_EXCODE39, -1, "a", 43, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 8*/ { BARCODE_EXCODE39, -1, "a", 85, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 0*/ { BARCODE_CODE11, -1, "13", 140, 0, 1, 1151 }, /* 8 (Start) + 140*8 + 2*8 (Checks) + 7 (Stop) == 1151 */
+ /* 1*/ { BARCODE_CODE11, -1, "13", 141, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 2*/ { BARCODE_CODE39, -1, "1", 86, 0, 1, 1143 }, /* 13 (Start) + 86*13 + 12 (Stop) == 1143 */
+ /* 3*/ { BARCODE_CODE39, -1, "1", 87, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 4*/ { BARCODE_EXCODE39, -1, "1", 86, 0, 1, 1143 },
+ /* 5*/ { BARCODE_EXCODE39, -1, "1", 87, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 6*/ { BARCODE_EXCODE39, -1, "a", 43, 0, 1, 1143 }, /* Takes 2 encoding chars per char */
+ /* 7*/ { BARCODE_EXCODE39, -1, "a", 44, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 8*/ { BARCODE_EXCODE39, -1, "a", 86, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 9*/ { BARCODE_LOGMARS, -1, "1", 30, 0, 1, 511 }, /* 16 (Start) + 30*16 + 15 (Stop) == 511 */
/* 10*/ { BARCODE_LOGMARS, -1, "1", 31, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 11*/ { BARCODE_CODE93, -1, "1", 107, 0, 1, 1000 }, /* 9 (Start) + 107*9 + 2*9 (Checks) + 10 (Stop) == 1000 */
- /* 12*/ { BARCODE_CODE93, -1, "1", 108, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 13*/ { BARCODE_CODE93, -1, "a", 53, 0, 1, 991 }, /* Takes 2 encoding chars per char */
- /* 14*/ { BARCODE_CODE93, -1, "a", 54, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 15*/ { BARCODE_CODE93, -1, "a", 107, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 16*/ { BARCODE_PZN, -1, "1", 7, 0, 1, 142 }, /* Takes 8 with correct check digit */
- /* 17*/ { BARCODE_PZN, -1, "1", 9, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 18*/ { BARCODE_PZN, 1, "1", 6, 0, 1, 129 }, /* PZN7 takes 7 with correct check digit */
- /* 19*/ { BARCODE_PZN, 1, "1", 8, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 20*/ { BARCODE_VIN, -1, "1", 17, 0, 1, 246 },
- /* 21*/ { BARCODE_VIN, -1, "1", 18, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 22*/ { BARCODE_VIN, -1, "1", 16, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 23*/ { BARCODE_VIN, 1, "1", 17, 0, 1, 259 },
- /* 24*/ { BARCODE_HIBC_39, -1, "1", 67, 0, 1, 1135 }, /* 69 - 2 ('+' and check digit) */
- /* 25*/ { BARCODE_HIBC_39, -1, "1", 68, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 11*/ { BARCODE_CODE93, -1, "1", 123, 0, 1, 1144 }, /* 9 (Start) + 123*9 + 2*9 (Checks) + 10 (Stop) == 1144 */
+ /* 12*/ { BARCODE_CODE93, -1, "1", 124, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 13*/ { BARCODE_CODE93, -1, "a", 61, 0, 1, 1135 }, /* Takes 2 encoding chars per char */
+ /* 14*/ { BARCODE_CODE93, -1, "a", 62, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 15*/ { BARCODE_CODE93, -1, "a", 124, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 16*/ { BARCODE_CODE93, -1, "a1", 82, 0, 1, 1144 }, /* Takes 1.5 encoding chars (1.5*82 == 123) */
+ /* 17*/ { BARCODE_CODE93, -1, "a1", 83, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 18*/ { BARCODE_PZN, -1, "1", 7, 0, 1, 142 }, /* Takes 8 with correct check digit */
+ /* 19*/ { BARCODE_PZN, -1, "1", 9, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 20*/ { BARCODE_PZN, 1, "1", 6, 0, 1, 129 }, /* PZN7 takes 7 with correct check digit */
+ /* 21*/ { BARCODE_PZN, 1, "1", 8, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 22*/ { BARCODE_VIN, -1, "1", 17, 0, 1, 246 },
+ /* 23*/ { BARCODE_VIN, -1, "1", 18, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 24*/ { BARCODE_VIN, -1, "1", 16, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 25*/ { BARCODE_VIN, 1, "1", 17, 0, 1, 259 },
+ /* 26*/ { BARCODE_HIBC_39, -1, "1", 68, 0, 1, 1151 }, /* 70 - 2 ('+' and check digit) */
+ /* 27*/ { BARCODE_HIBC_39, -1, "1", 69, ZINT_ERROR_TOO_LONG, -1, -1 },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
char data_buf[4096];
- testStart("test_large");
+ testStartSymbol("test_large", &symbol);
for (i = 0; i < data_size; i++) {
@@ -164,9 +166,9 @@ static void test_hrt(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
- testStart("test_hrt");
+ testStartSymbol("test_hrt", &symbol);
for (i = 0; i < data_size; i++) {
@@ -272,9 +274,9 @@ static void test_input(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
- testStart("test_input");
+ testStartSymbol("test_input", &symbol);
for (i = 0; i < data_size; i++) {
@@ -447,7 +449,7 @@ static void test_encode(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
char escaped[1024];
char cmp_buf[8192];
@@ -456,7 +458,7 @@ static void test_encode(const testCtx *const p_ctx) {
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
- testStart("test_encode");
+ testStartSymbol("test_encode", &symbol);
for (i = 0; i < data_size; i++) {
diff --git a/backend/tests/test_medical.c b/backend/tests/test_medical.c
index 10cdc6f6..15f16de8 100644
--- a/backend/tests/test_medical.c
+++ b/backend/tests/test_medical.c
@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
- Copyright (C) 2020-2022 Robin Stuart
+ Copyright (C) 2020-2023 Robin Stuart
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -45,10 +45,10 @@ static void test_large(const testCtx *const p_ctx) {
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
- /* 0*/ { BARCODE_CODABAR, -1, "A1234567890123456789012345678901234567890123456789012345678B", 60, 0, 1, 602 },
- /* 1*/ { BARCODE_CODABAR, -1, "A12345678901234567890123456789012345678901234567890123456789B", 61, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 2*/ { BARCODE_CODABAR, 1, "A1234567890123456789012345678901234567890123456789012345678B", 60, 0, 1, 612 },
- /* 3*/ { BARCODE_CODABAR, 1, "A12345678901234567890123456789012345678901234567890123456789B", 61, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 0*/ { BARCODE_CODABAR, -1, "A+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++B", 103, 0, 1, 1133 },
+ /* 1*/ { BARCODE_CODABAR, -1, "A++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++B", 104, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 2*/ { BARCODE_CODABAR, 1, "A+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++B", 103, 0, 1, 1143 },
+ /* 3*/ { BARCODE_CODABAR, 1, "A++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++B", 104, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 4*/ { BARCODE_PHARMA, -1, "131070", 6, 0, 1, 78 },
/* 5*/ { BARCODE_PHARMA, -1, "1", 7, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 6*/ { BARCODE_PHARMA_TWO, -1, "64570080", 8, 0, 2, 31 },
@@ -58,11 +58,11 @@ static void test_large(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
- char data_buf[64];
+ char data_buf[128];
- testStart("test_large");
+ testStartSymbol("test_large", &symbol);
for (i = 0; i < data_size; i++) {
@@ -115,9 +115,9 @@ static void test_hrt(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
- testStart("test_hrt");
+ testStartSymbol("test_hrt", &symbol);
for (i = 0; i < data_size; i++) {
@@ -183,14 +183,14 @@ static void test_input(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
char cmp_buf[8192];
char cmp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
- testStart("test_input");
+ testStartSymbol("test_input", &symbol);
for (i = 0; i < data_size; i++) {
@@ -281,7 +281,7 @@ static void test_encode(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
char escaped[1024];
char cmp_buf[8192];
@@ -290,7 +290,7 @@ static void test_encode(const testCtx *const p_ctx) {
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */
- testStart("test_encode");
+ testStartSymbol("test_encode", &symbol);
for (i = 0; i < data_size; i++) {
diff --git a/backend/tests/test_plessey.c b/backend/tests/test_plessey.c
index ef024cc5..5d835a00 100644
--- a/backend/tests/test_plessey.c
+++ b/backend/tests/test_plessey.c
@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
- Copyright (C) 2020-2022 Robin Stuart
+ Copyright (C) 2020-2023 Robin Stuart
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -45,34 +45,34 @@ static void test_large(const testCtx *const p_ctx) {
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
- /* 0*/ { BARCODE_MSI_PLESSEY, -1, "9", 65, 0, 1, 787 },
- /* 1*/ { BARCODE_MSI_PLESSEY, -1, "9", 66, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 2*/ { BARCODE_MSI_PLESSEY, 1, "9", 65, 0, 1, 799 }, /* 1 mod-10 check digit */
- /* 3*/ { BARCODE_MSI_PLESSEY, 1, "9", 66, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 4*/ { BARCODE_MSI_PLESSEY, 2, "9", 65, 0, 1, 811 }, /* 2 mod-10 check digits */
- /* 5*/ { BARCODE_MSI_PLESSEY, 2, "9", 66, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 6*/ { BARCODE_MSI_PLESSEY, 3, "9", 65, 0, 1, 799 }, /* 1 mod-11 check digit */
- /* 7*/ { BARCODE_MSI_PLESSEY, 3, "9", 66, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 8*/ { BARCODE_MSI_PLESSEY, 3, "3", 65, 0, 1, 811 }, /* 1 mod-11 double check digit "10" */
- /* 9*/ { BARCODE_MSI_PLESSEY, 3, "3", 66, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 10*/ { BARCODE_MSI_PLESSEY, 4, "9", 65, 0, 1, 811 }, /* 1 mod-11 and 1 mod-10 check digit */
- /* 11*/ { BARCODE_MSI_PLESSEY, 4, "9", 66, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 12*/ { BARCODE_MSI_PLESSEY, 4, "3", 65, 0, 1, 823 }, /* 1 mod-11 double check digit "10" and 1 mod-10 check digit */
- /* 13*/ { BARCODE_MSI_PLESSEY, 4, "3", 66, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 14*/ { BARCODE_MSI_PLESSEY, 5, "9", 65, 0, 1, 799 }, /* 1 NCR mod-11 check digit */
- /* 15*/ { BARCODE_MSI_PLESSEY, 5, "9", 66, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 16*/ { BARCODE_MSI_PLESSEY, 6, "9", 65, 0, 1, 811 }, /* 1 NCR mod-11 and 1 mod-10 check digit */
- /* 17*/ { BARCODE_MSI_PLESSEY, 6, "9", 66, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 18*/ { BARCODE_PLESSEY, -1, "A", 65, 0, 1, 1107 },
- /* 19*/ { BARCODE_PLESSEY, -1, "A", 66, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 0*/ { BARCODE_MSI_PLESSEY, -1, "9", 92, 0, 1, 1111 },
+ /* 1*/ { BARCODE_MSI_PLESSEY, -1, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 2*/ { BARCODE_MSI_PLESSEY, 1, "9", 92, 0, 1, 1123 }, /* 1 mod-10 check digit */
+ /* 3*/ { BARCODE_MSI_PLESSEY, 1, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 4*/ { BARCODE_MSI_PLESSEY, 2, "9", 92, 0, 1, 1135 }, /* 2 mod-10 check digits */
+ /* 5*/ { BARCODE_MSI_PLESSEY, 2, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 6*/ { BARCODE_MSI_PLESSEY, 3, "9", 92, 0, 1, 1123 }, /* 1 mod-11 check digit */
+ /* 7*/ { BARCODE_MSI_PLESSEY, 3, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 8*/ { BARCODE_MSI_PLESSEY, 3, "4", 92, 0, 1, 1135 }, /* 1 mod-11 double check digit "10" */
+ /* 9*/ { BARCODE_MSI_PLESSEY, 3, "4", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 10*/ { BARCODE_MSI_PLESSEY, 4, "9", 92, 0, 1, 1135 }, /* 1 mod-11 and 1 mod-10 check digit */
+ /* 11*/ { BARCODE_MSI_PLESSEY, 4, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 12*/ { BARCODE_MSI_PLESSEY, 4, "4", 92, 0, 1, 1147 }, /* 1 mod-11 double check digit "10" and 1 mod-10 check digit */
+ /* 13*/ { BARCODE_MSI_PLESSEY, 4, "4", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 14*/ { BARCODE_MSI_PLESSEY, 5, "9", 92, 0, 1, 1123 }, /* 1 NCR mod-11 check digit */
+ /* 15*/ { BARCODE_MSI_PLESSEY, 5, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 16*/ { BARCODE_MSI_PLESSEY, 6, "9", 92, 0, 1, 1135 }, /* 1 NCR mod-11 and 1 mod-10 check digit */
+ /* 17*/ { BARCODE_MSI_PLESSEY, 6, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 18*/ { BARCODE_PLESSEY, -1, "A", 67, 0, 1, 1139 },
+ /* 19*/ { BARCODE_PLESSEY, -1, "A", 68, ZINT_ERROR_TOO_LONG, -1, -1 },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
char data_buf[4096];
- testStart("test_large");
+ testStartSymbol("test_large", &symbol);
for (i = 0; i < data_size; i++) {
@@ -144,9 +144,9 @@ static void test_hrt(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
- testStart("test_hrt");
+ testStartSymbol("test_hrt", &symbol);
for (i = 0; i < data_size; i++) {
@@ -190,9 +190,9 @@ static void test_input(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
- testStart("test_input");
+ testStartSymbol("test_input", &symbol);
for (i = 0; i < data_size; i++) {
@@ -268,7 +268,7 @@ static void test_encode(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
char escaped[1024];
char bwipp_buf[4096];
@@ -276,7 +276,7 @@ static void test_encode(const testCtx *const p_ctx) {
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
- testStart("test_encode");
+ testStartSymbol("test_encode", &symbol);
for (i = 0; i < data_size; i++) {
diff --git a/backend/tests/test_postal.c b/backend/tests/test_postal.c
index a7fe647b..2682db4c 100644
--- a/backend/tests/test_postal.c
+++ b/backend/tests/test_postal.c
@@ -48,8 +48,8 @@ static void test_large(const testCtx *const p_ctx) {
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
- /* 0*/ { BARCODE_FLAT, "1", 90, 0, 1, 810 },
- /* 1*/ { BARCODE_FLAT, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 0*/ { BARCODE_FLAT, "1", 128, 0, 1, 1152 },
+ /* 1*/ { BARCODE_FLAT, "1", 129, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 2*/ { BARCODE_POSTNET, "1", 11, 0, 2, 123 },
/* 3*/ { BARCODE_POSTNET, "1", 12, ZINT_WARN_NONCOMPLIANT, 2, 133 },
/* 4*/ { BARCODE_POSTNET, "1", 38, ZINT_WARN_NONCOMPLIANT, 2, 393 },
@@ -74,16 +74,16 @@ static void test_large(const testCtx *const p_ctx) {
/* 23*/ { BARCODE_PLANET, "1", 39, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 24*/ { BARCODE_KIX, "1", 18, 0, 3, 143 },
/* 25*/ { BARCODE_KIX, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 26*/ { BARCODE_DAFT, "D", 250, 0, 3, 499 },
- /* 27*/ { BARCODE_DAFT, "D", 251, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 26*/ { BARCODE_DAFT, "D", 576, 0, 3, 1151 },
+ /* 27*/ { BARCODE_DAFT, "D", 577, ZINT_ERROR_TOO_LONG, -1, -1 },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
char data_buf[4096];
- testStart("test_large");
+ testStartSymbol("test_large", &symbol);
for (i = 0; i < data_size; i++) {
@@ -128,9 +128,9 @@ static void test_koreapost(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
- testStart("test_koreapost");
+ testStartSymbol("test_koreapost", &symbol);
for (i = 0; i < data_size; i++) {
@@ -181,9 +181,9 @@ static void test_japanpost(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
- testStart("test_japanpost");
+ testStartSymbol("test_japanpost", &symbol);
for (i = 0; i < data_size; i++) {
@@ -279,14 +279,14 @@ static void test_input(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
char cmp_buf[8192];
char cmp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
- testStart("test_input");
+ testStartSymbol("test_input", &symbol);
for (i = 0; i < data_size; i++) {
@@ -475,7 +475,7 @@ static void test_encode(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
char escaped[1024];
char bwipp_buf[8192];
@@ -483,7 +483,7 @@ static void test_encode(const testCtx *const p_ctx) {
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
- testStart("test_encode");
+ testStartSymbol("test_encode", &symbol);
for (i = 0; i < data_size; i++) {
diff --git a/backend/tests/test_telepen.c b/backend/tests/test_telepen.c
index fe7d6d63..979aa763 100644
--- a/backend/tests/test_telepen.c
+++ b/backend/tests/test_telepen.c
@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
- Copyright (C) 2020-2022 Robin Stuart
+ Copyright (C) 2020-2023 Robin Stuart
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -44,18 +44,18 @@ static void test_large(const testCtx *const p_ctx) {
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
- /* 0*/ { BARCODE_TELEPEN, "\177", 30, 0, 1, 528 },
- /* 1*/ { BARCODE_TELEPEN, "\177", 31, ZINT_ERROR_TOO_LONG, -1, -1 },
- /* 2*/ { BARCODE_TELEPEN_NUM, "1", 60, 0, 1, 528 },
- /* 3*/ { BARCODE_TELEPEN_NUM, "1", 61, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 0*/ { BARCODE_TELEPEN, "\177", 69, 0, 1, 1152 },
+ /* 1*/ { BARCODE_TELEPEN, "\177", 70, ZINT_ERROR_TOO_LONG, -1, -1 },
+ /* 2*/ { BARCODE_TELEPEN_NUM, "1", 136, 0, 1, 1136 },
+ /* 3*/ { BARCODE_TELEPEN_NUM, "1", 137, ZINT_ERROR_TOO_LONG, -1, -1 },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
- char data_buf[64];
+ char data_buf[256];
- testStart("test_large");
+ testStartSymbol("test_large", &symbol);
for (i = 0; i < data_size; i++) {
@@ -106,9 +106,9 @@ static void test_hrt(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
- testStart("test_hrt");
+ testStartSymbol("test_hrt", &symbol);
for (i = 0; i < data_size; i++) {
@@ -155,9 +155,9 @@ static void test_input(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
- testStart("test_input");
+ testStartSymbol("test_input", &symbol);
for (i = 0; i < data_size; i++) {
@@ -234,7 +234,7 @@ static void test_encode(const testCtx *const p_ctx) {
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
char escaped[1024];
char bwipp_buf[8192];
@@ -242,7 +242,7 @@ static void test_encode(const testCtx *const p_ctx) {
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
- testStart("test_encode");
+ testStartSymbol("test_encode", &symbol);
for (i = 0; i < data_size; i++) {
@@ -302,20 +302,20 @@ static void test_fuzz(const testCtx *const p_ctx) {
/* Note NULs where using DELs code (16 binary characters wide) */
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
- /* 0*/ { BARCODE_TELEPEN, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 30, 0 },
- /* 1*/ { BARCODE_TELEPEN, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 31, ZINT_ERROR_TOO_LONG },
- /* 2*/ { BARCODE_TELEPEN_NUM, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 60, ZINT_ERROR_INVALID_DATA },
- /* 3*/ { BARCODE_TELEPEN_NUM, "040404040404040404040404040404040404040404040404040404040404", 60, 0 },
- /* 4*/ { BARCODE_TELEPEN_NUM, "1234567890123456789012345678901234567890123456789012345678901", 61, ZINT_ERROR_TOO_LONG },
- /* 5*/ { BARCODE_TELEPEN_NUM, "00000000000000000000000000000000000000000000000000000000000X", 60, 0 },
- /* 6*/ { BARCODE_TELEPEN_NUM, "999999999999999999999999999999999999999999999999999999999999", 60, 0 },
- /* 7*/ { BARCODE_TELEPEN_NUM, "1234567890123456789012345678901234567890123456789012345678901234567890", 4, 0 }, /* Length given, strlen > 61, so pseudo not NUL-terminated */
+ /* 0*/ { BARCODE_TELEPEN, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 69, 0 },
+ /* 1*/ { BARCODE_TELEPEN, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 70, ZINT_ERROR_TOO_LONG },
+ /* 2*/ { BARCODE_TELEPEN_NUM, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 70, ZINT_ERROR_INVALID_DATA },
+ /* 3*/ { BARCODE_TELEPEN_NUM, "0404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404", 136, 0 },
+ /* 4*/ { BARCODE_TELEPEN_NUM, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567", 137, ZINT_ERROR_TOO_LONG },
+ /* 5*/ { BARCODE_TELEPEN_NUM, "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000X", 136, 0 },
+ /* 6*/ { BARCODE_TELEPEN_NUM, "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", 136, 0 },
+ /* 7*/ { BARCODE_TELEPEN_NUM, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 4, 0 }, /* Length given, strlen > 137, so pseudo not NUL-terminated */
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
- struct zint_symbol *symbol;
+ struct zint_symbol *symbol = NULL;
- testStart("test_fuzz");
+ testStartSymbol("test_fuzz", &symbol);
for (i = 0; i < data_size; i++) {
diff --git a/docs/manual.html b/docs/manual.html
index 5c99bd03..a71a6d95 100644
--- a/docs/manual.html
+++ b/docs/manual.html
@@ -4222,7 +4222,7 @@ aria-hidden="true">zint -b CODE11 -d "9212320967"
Developed by Intermec in 1977, Code 11 is similar to Code 2 of 5
Matrix and is primarily used in telecommunications. The symbol can
encode data consisting of the digits 0-9 and the dash character
-(-) up to a maximum of 121 characters. Two modulo-11 check
+(-) up to a maximum of 140 characters. Two modulo-11 check
digits are added by default. To add just one check digit, set
--vers=1 (API option_2 = 1). To add no check
digits, set --vers=2 (API option_2 = 2).
Also known as Code 2 of 5 Matrix, this is a self-checking code used
in industrial applications and photo development. Standard Code 2 of 5
-will encode numeric input (digits 0-9) up to a maximum of 80 digits. No
+will encode numeric input (digits 0-9) up to a maximum of 112 digits. No
check digit is added by default. To add a check digit, set
--vers=1 (API option_2 = 1). To add a check
digit but not show it in the Human Readable Text, set
@@ -4254,7 +4254,7 @@ aria-hidden="true">zint -b C25IATA -d "9212320967"
Used for baggage handling in the air-transport industry by the
International Air Transport Agency, this self-checking code will encode
-numeric input (digits 0-9) up to a maximum of 45 digits. No check digit
+numeric input (digits 0-9) up to a maximum of 80 digits. No check digit
is added by default, but can be set the same as for 6.1.2.1 Standard Code 2 of 5.
Industrial Code 2 of 5 can encode numeric input (digits 0-9) up to a
-maximum of 45 digits. No check digit is added by default, but can be set
+maximum of 79 digits. No check digit is added by default, but can be set
the same as for 6.1.2.1 Standard Code 2
of 5.
This self-checking symbology encodes pairs of numbers, and so can
only encode an even number of digits (0-9). If an odd number of digits
-is entered a leading zero is added by Zint. A maximum of 45 pairs (90
+is entered a leading zero is added by Zint. A maximum of 62 pairs (124
digits) can be encoded. No check digit is added by default, but can be
set the same as for 6.1.2.1 Standard
Code 2 of 5.
Data Logic does not include a check digit by default and can encode
-numeric input (digits 0-9) up to a maximum of 80 digits. Check digit
+numeric input (digits 0-9) up to a maximum of 113 digits. Check digit
options are the same as for 6.1.2.1
Standard Code 2 of 5.
Also known as Plessey Code, this symbology was developed by the
Plessey Company Ltd. in the UK. The symbol can encode data consisting of
-digits (0-9) or letters A-F up to a maximum of 65 characters and
+digits (0-9) or letters A-F up to a maximum of 67 characters and
includes a hidden CRC check digit.
6.1.5.2 MSI Plessey
Based on Plessey and developed by MSI Data Corporation, MSI Plessey
-can encode numeric (digits 0-9) input of up to 65 digits. It has a range
+can encode numeric (digits 0-9) input of up to 92 digits. It has a range
of check digit options that are selectable by setting
--vers (API option_2), shown in the table
below:
Telepen Alpha was developed by SB Electronic Systems Limited and can
-encode ASCII text input, up to a maximum of 30 characters. Telepen
+encode ASCII text input, up to a maximum of 69 characters. Telepen
includes a hidden modulo-127 check digit, added by Zint.
6.1.6.2 Telepen Numeric
-is not valid). Up to 60 digits can be encoded. Telepen Numeric includes
+is not valid). Up to 136 digits can be encoded. Telepen Numeric includes
a hidden modulo-127 check digit which is added by Zint.
Standard Code 39 was developed in 1974 by Intermec. Input data can be
-up to 85 characters in length and can include the characters 0-9, A-Z,
+up to 86 characters in length and can include the characters 0-9, A-Z,
dash (-), full stop (.), space, asterisk
(*), dollar ($), slash (/), plus
(+) and percent (%). The standard does not
@@ -4641,9 +4641,10 @@ alt="zint -b CODE93 --compliantheight -d "C93"" />
aria-hidden="true">zint -b CODE93 --compliantheight -d "C93"
A variation of Extended Code 39, Code 93 also supports full ASCII
-text. Two check characters are added by Zint. By default these check
-characters are not shown in the Human Readable Text, but may be shown by
-setting --vers=1 (API option_2 = 1).
+text, accepting up to 123 characters. Two check characters are added by
+Zint. By default these check characters are not shown in the Human
+Readable Text, but may be shown by setting --vers=1 (API
+option_2 = 1).