CODE11/C25XXX/CODE39/EXCODE39/HIBC_39/CODE93/CODABAR/PLESSEY/

MSI_PLESSEY/FLAT/DAFT/TELEPEN/TELEPEN_NUM: increase allowed
  lengths to max or near-max possible in 1152 modules for most
  (all?) variable length input linear barcodes
USPS_IMAIL: suppress bogus clang-tidy warning re garbage value
  (doesn't take `strlen()` into account?)
This commit is contained in:
gitlost 2023-11-22 00:45:30 +00:00
parent 4b57fb8021
commit 06ae7c1b7a
17 changed files with 283 additions and 269 deletions

View File

@ -86,6 +86,8 @@ Changes
- CODE128: increase no. symbol chars max 60 -> 99 - CODE128: increase no. symbol chars max 60 -> 99
- frontend: truncate overlong `--primary` instead of ignoring - frontend: truncate overlong `--primary` instead of ignoring
- man page: list size detail for matrix symbols (`--vers`) - 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 Bugs
---- ----

View File

@ -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) { const int is_matrix, const char *start_stop[2], const int start_length, const int error_base) {
int i; 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; 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; int have_checkdigit = symbol->option_2 == 1 || symbol->option_2 == 2;
if (length > max) { 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) */ /* Code 2 of 5 Standard (Code 2 of 5 Matrix) */
INTERNAL int c25standard(struct zint_symbol *symbol, unsigned char source[], int length) { 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 */ /* Code 2 of 5 Industrial */
INTERNAL int c25ind(struct zint_symbol *symbol, unsigned char source[], int length) { 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 */ /* Code 2 of 5 IATA */
INTERNAL int c25iata(struct zint_symbol *symbol, unsigned char source[], int length) { 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 */ /* Code 2 of 5 Data Logic */
INTERNAL int c25logic(struct zint_symbol *symbol, unsigned char source[], int length) { 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 */ /* Common to Interleaved, ITF-14, DP Leitcode, DP Identcode */
static int c25_inter_common(struct zint_symbol *symbol, unsigned char source[], int length, static int c25_inter_common(struct zint_symbol *symbol, unsigned char source[], int length,
const int dont_set_height) { const int dont_set_height) {
int i, j, error_number = 0; 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; 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; int have_checkdigit = symbol->option_2 == 1 || symbol->option_2 == 2;
if (length > 90) { if (length > 125) { /* 4 + (125 + 1) * 9 + 5 = 1143 */
strcpy(symbol->errtxt, "309: Input too long (90 character maximum)"); strcpy(symbol->errtxt, "309: Input too long (125 character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
if (!is_sane(NEON_F, source, length)) { if (!is_sane(NEON_F, source, length)) {

View File

@ -132,8 +132,9 @@ INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int leng
int i; int i;
int h, c_digit, c_weight, c_count, k_digit, k_weight, k_count; int h, c_digit, c_weight, c_count, k_digit, k_weight, k_count;
int weight[122], error_number = 0; int weight[141]; /* 140 + 1 extra for 1st check */
char dest[750]; /* 6 + 121 * 6 + 2 * 6 + 5 + 1 == 750 */ char dest[864]; /* 6 + 140 * 6 + 2 * 6 + 5 + 1 = 864 */
int error_number = 0;
char *d = dest; char *d = dest;
int num_check_digits; int num_check_digits;
char checkstr[3] = {0}; 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 */ /* Suppresses clang-tidy clang-analyzer-core.UndefinedBinaryOperatorResult warning */
assert(length > 0); assert(length > 0);
if (length > 121) { if (length > 140) { /* 8 (Start) + 140 * 8 + 2 * 8 (Check) + 7 (Stop) = 1151 */
strcpy(symbol->errtxt, "320: Input too long (121 character maximum)"); strcpy(symbol->errtxt, "320: Input too long (140 character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
if (!is_sane(SODIUM_MNS_F, source, length)) { 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 i;
int counter; int counter;
int error_number = 0; int error_number = 0;
int posns[85]; int posns[86];
char dest[880]; /* 10 (Start) + 85 * 10 + 10 (Check) + 9 (Stop) + 1 = 880 */ char dest[890]; /* 10 (Start) + 86 * 10 + 10 (Check) + 9 (Stop) + 1 = 890 */
char *d = dest; char *d = dest;
char localstr[2] = {0}; 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)"); strcpy(symbol->errtxt, "322: Input too long (30 character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
/* Prevent encoded_data out-of-bounds >= 143 for BARCODE_HIBC_39 due to wider 'wide' bars */ /* 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 */ /* 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; return ZINT_ERROR_TOO_LONG;
} else if (length > 85) { } else if (length > 86) { /* 13 (Start) + 86*13 + 12 (Stop) = 1143 */
strcpy(symbol->errtxt, "323: Input too long (85 character maximum)"); strcpy(symbol->errtxt, "323: Input too long (86 character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
to_upper(source, length); 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)"); strcpy(symbol->errtxt, "324: Invalid character in data (alphanumerics, space and \"-.$/+%\" only)");
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
@ -306,7 +307,7 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng
d += 9; d += 9;
if ((symbol->symbology == BARCODE_LOGMARS) || (symbol->symbology == BARCODE_HIBC_39)) { 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; counter = d - dest;
for (i = 0; i < counter; i++) { for (i = 0; i < counter; i++) {
if (dest[i] == '2') { 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 */ /* Extended Code 39 - ISO/IEC 16388:2007 Annex A */
INTERNAL int excode39(struct zint_symbol *symbol, unsigned char source[], int length) { 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 *b = buffer;
unsigned char check_digit = '\0'; unsigned char check_digit = '\0';
int i; int i;
int error_number; int error_number;
if (length > 85) { if (length > 86) {
strcpy(symbol->errtxt, "328: Input too long (85 character maximum)"); strcpy(symbol->errtxt, "328: Input too long (86 character maximum)");
return ZINT_ERROR_TOO_LONG; 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); memcpy(b, EC39Ctrl[source[i]], 2);
b += EC39Ctrl[source[i]][1] ? 2 : 1; b += EC39Ctrl[source[i]][1] ? 2 : 1;
} }
if (b - buffer > 85) { if (b - buffer > 86) {
strcpy(symbol->errtxt, "317: Expanded input too long (85 symbol character maximum)"); strcpy(symbol->errtxt, "317: Expanded input too long (86 symbol character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
*b = '\0'; *b = '\0';
@ -501,17 +502,17 @@ INTERNAL int code93(struct zint_symbol *symbol, unsigned char source[], int leng
int i; int i;
int h, weight, c, k, error_number = 0; int h, weight, c, k, error_number = 0;
int values[110]; /* 107 + 2 (Checks) */ int values[125]; /* 123 + 2 (Checks) */
char buffer[216]; /* 107*2 (107 full ASCII) + 1 = 215 */ char buffer[247]; /* 123*2 (123 full ASCII) + 1 = 247 */
char *b = buffer; 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; char *d = dest;
/* Suppresses clang-tidy clang-analyzer-core.CallAndMessage warning */ /* Suppresses clang-tidy clang-analyzer-core.CallAndMessage warning */
assert(length > 0); assert(length > 0);
if (length > 107) { /* 9 (Start) + 107*9 + 2*9 (Checks) + 10 (Stop) == 1000 */ if (length > 123) { /* 9 (Start) + 123*9 + 2*9 (Checks) + 10 (Stop) = 1144 */
strcpy(symbol->errtxt, "330: Input too long (107 character maximum)"); strcpy(symbol->errtxt, "330: Input too long (123 character maximum)");
return ZINT_ERROR_TOO_LONG; 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 */ /* Now we can check the true length of the barcode */
h = b - buffer; h = b - buffer;
if (h > 107) { if (h > 123) {
strcpy(symbol->errtxt, "332: Expanded input too long (107 symbol character maximum)"); strcpy(symbol->errtxt, "332: Expanded input too long (123 symbol character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }

View File

@ -246,7 +246,8 @@ INTERNAL int usps_imail(struct zint_symbol *symbol, unsigned char source[], int
char data_pattern[200]; char data_pattern[200];
int error_number = 0; int error_number = 0;
int i, j, read; 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 accum;
large_uint byte_array_reg; large_uint byte_array_reg;
unsigned char byte_array[13]; 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 */ /* separate the tracking code from the routing code */
tracker[0] = zip[0] = '\0'; zip[0] = '\0';
read = 0; read = 0;
j = 0; j = 0;
for (i = 0; i < length; i++) { 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 */ /* 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_mul_u64(&accum, 10);
large_add_u64(&accum, ctoi(tracker[read])); large_add_u64(&accum, ctoi(tracker[read]));

View File

@ -1,7 +1,7 @@
/* medical.c - Handles 1 track and 2 track pharmacode and Codabar */ /* medical.c - Handles 1 track and 2 track pharmacode and Codabar */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2023 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
@ -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) { INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int length) {
int i, error_number = 0; int i, error_number = 0;
int posns[60]; int posns[103];
char dest[512]; char dest[833]; /* (103 + 1) * 8 + 1 == 833 */
char *d = dest; char *d = dest;
int add_checksum, count = 0, checksum = 0; int add_checksum, count = 0, checksum = 0;
int d_chars = 0; int d_chars = 0;
if (length > 60) { /* No stack smashing please */ if (length > 103) { /* No stack smashing please (103 + 1) * 11 = 1144 */
strcpy(symbol->errtxt, "356: Input too long (60 character maximum)"); strcpy(symbol->errtxt, "356: Input too long (103 character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
/* BS EN 798:1995 4.2 "'Codabar' symbols shall consist of ... b) start character; /* BS EN 798:1995 4.2 "'Codabar' symbols shall consist of ... b) start character;

View File

@ -1,7 +1,7 @@
/* plessey.c - Handles Plessey and MSI Plessey */ /* plessey.c - Handles Plessey and MSI Plessey */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2023 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
@ -55,14 +55,14 @@ static const char MSITable[10][8] = {
INTERNAL int plessey(struct zint_symbol *symbol, unsigned char source[], int length) { INTERNAL int plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
int i; 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}; 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; char *d = dest;
int error_number = 0; int error_number = 0;
if (length > 65) { if (length > 67) { /* 16 + 67 * 16 + 4 * 8 + 19 = 1139 */
strcpy(symbol->errtxt, "370: Input too long (65 character maximum)"); strcpy(symbol->errtxt, "370: Input too long (67 character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
if (!is_sane(SSET_F, source, length)) { 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; int i, x = 0, undoubled = 0;
for (i = length - 1; i >= 0; i--) { 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])]; x += vals[undoubled][ctoi(source[i])];
undoubled = !undoubled; 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; int i, x = 0, weight = 2;
for (i = length - 1; i >= 0; i--) { 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]); x += weight * ctoi(source[i]);
weight++; weight++;
if (weight > wrap) { 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) { const int no_checktext, char *d) {
int i; int i;
unsigned char temp[65 + 2 + 1]; unsigned char temp[92 + 2 + 1];
/* Append check digits */ /* Append check digits */
temp[0] = '\0'; 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 */ /* Uses the IBM weight system if wrap = 7, and the NCR system if wrap = 9 */
int i; int i;
char check_digit; char check_digit;
unsigned char temp[65 + 3 + 1]; unsigned char temp[92 + 3 + 1];
int temp_len = length; int temp_len = length;
temp[0] = '\0'; 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) { INTERNAL int msi_plessey(struct zint_symbol *symbol, unsigned char source[], int length) {
int error_number = 0; 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; char *d = dest;
int check_option = symbol->option_2; int check_option = symbol->option_2;
int no_checktext = 0; int no_checktext = 0;
if (length > 65) { if (length > 92) { /* 3 (Start) + 92 * 12 + 3 * 12 + 4 (Stop) = 1147 */
strcpy(symbol->errtxt, "372: Input too long (65 character maximum)"); strcpy(symbol->errtxt, "372: Input too long (92 character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
if (!is_sane(NEON_F, source, length)) { if (!is_sane(NEON_F, source, length)) {

View File

@ -559,12 +559,12 @@ INTERNAL int kix(struct zint_symbol *symbol, unsigned char source[], int length)
/* Handles DAFT Code symbols */ /* Handles DAFT Code symbols */
INTERNAL int daft(struct zint_symbol *symbol, unsigned char source[], int length) { INTERNAL int daft(struct zint_symbol *symbol, unsigned char source[], int length) {
int posns[250]; int posns[576];
int loopey; int loopey;
int writer; int writer;
if (length > 250) { if (length > 576) { /* 576 * 2 = 1152 */
strcpy(symbol->errtxt, "492: Input too long (250 character maximum)"); strcpy(symbol->errtxt, "492: Input too long (576 character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
to_upper(source, length); 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! */ /* Flattermarken - Not really a barcode symbology! */
INTERNAL int flat(struct zint_symbol *symbol, unsigned char source[], int length) { INTERNAL int flat(struct zint_symbol *symbol, unsigned char source[], int length) {
int loop, error_number = 0; int loop, error_number = 0;
char dest[512]; /* 90 * 4 + 1 ~ */ char dest[512]; /* 128 * 4 = 512 */
char *d = dest; char *d = dest;
if (length > 90) { if (length > 128) { /* 128 * 9 = 1152 */
strcpy(symbol->errtxt, "494: Input too long (90 character maximum)"); strcpy(symbol->errtxt, "494: Input too long (128 character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
if (!is_sane(NEON_F, source, length)) { if (!is_sane(NEON_F, source, length)) {

View File

@ -1,7 +1,7 @@
/* telepen.c - Handles Telepen and Telepen numeric */ /* telepen.c - Handles Telepen and Telepen numeric */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2023 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
@ -89,15 +89,15 @@ static const char TeleLens[128] = {
INTERNAL int telepen(struct zint_symbol *symbol, unsigned char source[], int src_len) { INTERNAL int telepen(struct zint_symbol *symbol, unsigned char source[], int src_len) {
int i, count, check_digit; int i, count, check_digit;
int error_number; 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; char *d = dest;
error_number = 0; error_number = 0;
count = 0; count = 0;
if (src_len > 30) { if (src_len > 69) { /* 16 (Start) + 69 * 16 + 16 (Check) + 16 (Stop) = 1152 */
strcpy(symbol->errtxt, "390: Input too long (30 character maximum)"); strcpy(symbol->errtxt, "390: Input too long (69 character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
/* Start character */ /* Start character */
@ -153,14 +153,14 @@ INTERNAL int telepen_num(struct zint_symbol *symbol, unsigned char source[], int
int count, check_digit, glyph; int count, check_digit, glyph;
int error_number = 0; int error_number = 0;
int i; 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; char *d = dest;
unsigned char temp[61]; unsigned char temp[137];
count = 0; count = 0;
if (src_len > 60) { if (src_len > 136) { /* 68*2 */
strcpy(symbol->errtxt, "392: Input too long (60 character maximum)"); strcpy(symbol->errtxt, "392: Input too long (136 character maximum)");
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
if (!is_sane(SODIUM_X_F, source, src_len)) { if (!is_sane(SODIUM_X_F, source, src_len)) {

View File

@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2020-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2020-2023 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
@ -45,26 +45,26 @@ static void test_large(const testCtx *const p_ctx) {
}; };
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_C25STANDARD, -1, "1", 80, 0, 1, 817 }, /* 0*/ { BARCODE_C25STANDARD, -1, "1", 112, 0, 1, 1137 },
/* 1*/ { BARCODE_C25STANDARD, -1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 1*/ { BARCODE_C25STANDARD, -1, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 2*/ { BARCODE_C25STANDARD, 1, "1", 80, 0, 1, 827 }, /* 2*/ { BARCODE_C25STANDARD, 1, "1", 112, 0, 1, 1147 },
/* 3*/ { BARCODE_C25STANDARD, 1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 3*/ { BARCODE_C25STANDARD, 1, "1", 113, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 4*/ { BARCODE_C25INTER, -1, "1", 90, 0, 1, 819 }, /* 4*/ { BARCODE_C25INTER, -1, "1", 125, 0, 1, 1143 },
/* 5*/ { BARCODE_C25INTER, -1, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 5*/ { BARCODE_C25INTER, -1, "1", 126, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 6*/ { BARCODE_C25INTER, 1, "1", 90, 0, 1, 837 }, /* 6*/ { BARCODE_C25INTER, 1, "1", 125, 0, 1, 1143 },
/* 7*/ { BARCODE_C25INTER, 1, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 7*/ { BARCODE_C25INTER, 1, "1", 126, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 8*/ { BARCODE_C25IATA, -1, "1", 45, 0, 1, 639 }, /* 8*/ { BARCODE_C25IATA, -1, "1", 80, 0, 1, 1129 },
/* 9*/ { BARCODE_C25IATA, -1, "1", 46, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 9*/ { BARCODE_C25IATA, -1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 10*/ { BARCODE_C25IATA, 1, "1", 45, 0, 1, 653 }, /* 10*/ { BARCODE_C25IATA, 1, "1", 80, 0, 1, 1143 },
/* 11*/ { BARCODE_C25IATA, 1, "1", 46, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 11*/ { BARCODE_C25IATA, 1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 12*/ { BARCODE_C25LOGIC, -1, "1", 80, 0, 1, 809 }, /* 12*/ { BARCODE_C25LOGIC, -1, "1", 113, 0, 1, 1139 },
/* 13*/ { BARCODE_C25LOGIC, -1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 13*/ { BARCODE_C25LOGIC, -1, "1", 114, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 14*/ { BARCODE_C25LOGIC, 1, "1", 80, 0, 1, 819 }, /* 14*/ { BARCODE_C25LOGIC, 1, "1", 113, 0, 1, 1149 },
/* 15*/ { BARCODE_C25LOGIC, 1, "1", 81, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 15*/ { BARCODE_C25LOGIC, 1, "1", 114, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 16*/ { BARCODE_C25IND, -1, "1", 45, 0, 1, 649 }, /* 16*/ { BARCODE_C25IND, -1, "1", 79, 0, 1, 1125 },
/* 17*/ { BARCODE_C25IND, -1, "1", 46, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 17*/ { BARCODE_C25IND, -1, "1", 80, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 18*/ { BARCODE_C25IND, 1, "1", 45, 0, 1, 663 }, /* 18*/ { BARCODE_C25IND, 1, "1", 79, 0, 1, 1139 },
/* 19*/ { BARCODE_C25IND, 1, "1", 46, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 19*/ { BARCODE_C25IND, 1, "1", 80, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 20*/ { BARCODE_DPLEIT, -1, "1", 13, 0, 1, 135 }, /* 20*/ { BARCODE_DPLEIT, -1, "1", 13, 0, 1, 135 },
/* 21*/ { BARCODE_DPLEIT, -1, "1", 14, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 21*/ { BARCODE_DPLEIT, -1, "1", 14, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 22*/ { BARCODE_DPIDENT, -1, "1", 11, 0, 1, 117 }, /* 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 data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol = NULL;
char data_buf[4096]; char data_buf[4096];
testStart("test_large"); testStartSymbol("test_large", &symbol);
for (i = 0; i < data_size; i++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; 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++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; 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++) { 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_buf[4096];
char cmp_msg[1024]; char cmp_msg[1024];
int i, length, ret; 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_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 */ 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++) { for (i = 0; i < data_size; i++) {

View File

@ -45,40 +45,42 @@ static void test_large(const testCtx *const p_ctx) {
}; };
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_CODE11, -1, "1", 121, 0, 1, 999 }, /* 8 (Start) + 121*8 + 2*8 (Checks) + 7 (Stop) == 999 */ /* 0*/ { BARCODE_CODE11, -1, "13", 140, 0, 1, 1151 }, /* 8 (Start) + 140*8 + 2*8 (Checks) + 7 (Stop) == 1151 */
/* 1*/ { BARCODE_CODE11, -1, "1", 122, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 1*/ { BARCODE_CODE11, -1, "13", 141, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 2*/ { BARCODE_CODE39, -1, "1", 85, 0, 1, 1130 }, /* 13 (Start) + 85*13 + 12 (Stop) == 1130 */ /* 2*/ { BARCODE_CODE39, -1, "1", 86, 0, 1, 1143 }, /* 13 (Start) + 86*13 + 12 (Stop) == 1143 */
/* 3*/ { BARCODE_CODE39, -1, "1", 86, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 3*/ { BARCODE_CODE39, -1, "1", 87, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 4*/ { BARCODE_EXCODE39, -1, "1", 85, 0, 1, 1130 }, /* 4*/ { BARCODE_EXCODE39, -1, "1", 86, 0, 1, 1143 },
/* 5*/ { BARCODE_EXCODE39, -1, "1", 86, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 5*/ { BARCODE_EXCODE39, -1, "1", 87, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 6*/ { BARCODE_EXCODE39, -1, "a", 42, 0, 1, 1117 }, /* Takes 2 encoding chars per char */ /* 6*/ { BARCODE_EXCODE39, -1, "a", 43, 0, 1, 1143 }, /* Takes 2 encoding chars per char */
/* 7*/ { BARCODE_EXCODE39, -1, "a", 43, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 7*/ { BARCODE_EXCODE39, -1, "a", 44, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 8*/ { BARCODE_EXCODE39, -1, "a", 85, 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 */ /* 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 }, /* 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 */ /* 11*/ { BARCODE_CODE93, -1, "1", 123, 0, 1, 1144 }, /* 9 (Start) + 123*9 + 2*9 (Checks) + 10 (Stop) == 1144 */
/* 12*/ { BARCODE_CODE93, -1, "1", 108, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 12*/ { BARCODE_CODE93, -1, "1", 124, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 13*/ { BARCODE_CODE93, -1, "a", 53, 0, 1, 991 }, /* Takes 2 encoding chars per char */ /* 13*/ { BARCODE_CODE93, -1, "a", 61, 0, 1, 1135 }, /* Takes 2 encoding chars per char */
/* 14*/ { BARCODE_CODE93, -1, "a", 54, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 14*/ { BARCODE_CODE93, -1, "a", 62, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 15*/ { BARCODE_CODE93, -1, "a", 107, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 15*/ { BARCODE_CODE93, -1, "a", 124, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 16*/ { BARCODE_PZN, -1, "1", 7, 0, 1, 142 }, /* Takes 8 with correct check digit */ /* 16*/ { BARCODE_CODE93, -1, "a1", 82, 0, 1, 1144 }, /* Takes 1.5 encoding chars (1.5*82 == 123) */
/* 17*/ { BARCODE_PZN, -1, "1", 9, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 17*/ { BARCODE_CODE93, -1, "a1", 83, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 18*/ { BARCODE_PZN, 1, "1", 6, 0, 1, 129 }, /* PZN7 takes 7 with correct check digit */ /* 18*/ { BARCODE_PZN, -1, "1", 7, 0, 1, 142 }, /* Takes 8 with correct check digit */
/* 19*/ { BARCODE_PZN, 1, "1", 8, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 19*/ { BARCODE_PZN, -1, "1", 9, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 20*/ { BARCODE_VIN, -1, "1", 17, 0, 1, 246 }, /* 20*/ { BARCODE_PZN, 1, "1", 6, 0, 1, 129 }, /* PZN7 takes 7 with correct check digit */
/* 21*/ { BARCODE_VIN, -1, "1", 18, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 21*/ { BARCODE_PZN, 1, "1", 8, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 22*/ { BARCODE_VIN, -1, "1", 16, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 22*/ { BARCODE_VIN, -1, "1", 17, 0, 1, 246 },
/* 23*/ { BARCODE_VIN, 1, "1", 17, 0, 1, 259 }, /* 23*/ { BARCODE_VIN, -1, "1", 18, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 24*/ { BARCODE_HIBC_39, -1, "1", 67, 0, 1, 1135 }, /* 69 - 2 ('+' and check digit) */ /* 24*/ { BARCODE_VIN, -1, "1", 16, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 25*/ { BARCODE_HIBC_39, -1, "1", 68, 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 data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol = NULL;
char data_buf[4096]; char data_buf[4096];
testStart("test_large"); testStartSymbol("test_large", &symbol);
for (i = 0; i < data_size; i++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; 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++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; 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++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol = NULL;
char escaped[1024]; char escaped[1024];
char cmp_buf[8192]; 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_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 */ 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++) { for (i = 0; i < data_size; i++) {

View File

@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2020-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2020-2023 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
@ -45,10 +45,10 @@ static void test_large(const testCtx *const p_ctx) {
}; };
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_CODABAR, -1, "A1234567890123456789012345678901234567890123456789012345678B", 60, 0, 1, 602 }, /* 0*/ { BARCODE_CODABAR, -1, "A+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++B", 103, 0, 1, 1133 },
/* 1*/ { BARCODE_CODABAR, -1, "A12345678901234567890123456789012345678901234567890123456789B", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 1*/ { BARCODE_CODABAR, -1, "A++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++B", 104, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 2*/ { BARCODE_CODABAR, 1, "A1234567890123456789012345678901234567890123456789012345678B", 60, 0, 1, 612 }, /* 2*/ { BARCODE_CODABAR, 1, "A+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++B", 103, 0, 1, 1143 },
/* 3*/ { BARCODE_CODABAR, 1, "A12345678901234567890123456789012345678901234567890123456789B", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 3*/ { BARCODE_CODABAR, 1, "A++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++B", 104, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 4*/ { BARCODE_PHARMA, -1, "131070", 6, 0, 1, 78 }, /* 4*/ { BARCODE_PHARMA, -1, "131070", 6, 0, 1, 78 },
/* 5*/ { BARCODE_PHARMA, -1, "1", 7, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 5*/ { BARCODE_PHARMA, -1, "1", 7, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 6*/ { BARCODE_PHARMA_TWO, -1, "64570080", 8, 0, 2, 31 }, /* 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 data_size = ARRAY_SIZE(data);
int i, length, ret; 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++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; 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++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol = NULL;
char cmp_buf[8192]; char cmp_buf[8192];
char cmp_msg[1024]; char cmp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ 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++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol = NULL;
char escaped[1024]; char escaped[1024];
char cmp_buf[8192]; 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_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 */ 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++) { for (i = 0; i < data_size; i++) {

View File

@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2020-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2020-2023 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
@ -45,34 +45,34 @@ static void test_large(const testCtx *const p_ctx) {
}; };
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_MSI_PLESSEY, -1, "9", 65, 0, 1, 787 }, /* 0*/ { BARCODE_MSI_PLESSEY, -1, "9", 92, 0, 1, 1111 },
/* 1*/ { BARCODE_MSI_PLESSEY, -1, "9", 66, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 1*/ { BARCODE_MSI_PLESSEY, -1, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 2*/ { BARCODE_MSI_PLESSEY, 1, "9", 65, 0, 1, 799 }, /* 1 mod-10 check digit */ /* 2*/ { BARCODE_MSI_PLESSEY, 1, "9", 92, 0, 1, 1123 }, /* 1 mod-10 check digit */
/* 3*/ { BARCODE_MSI_PLESSEY, 1, "9", 66, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 3*/ { BARCODE_MSI_PLESSEY, 1, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 4*/ { BARCODE_MSI_PLESSEY, 2, "9", 65, 0, 1, 811 }, /* 2 mod-10 check digits */ /* 4*/ { BARCODE_MSI_PLESSEY, 2, "9", 92, 0, 1, 1135 }, /* 2 mod-10 check digits */
/* 5*/ { BARCODE_MSI_PLESSEY, 2, "9", 66, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 5*/ { BARCODE_MSI_PLESSEY, 2, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 6*/ { BARCODE_MSI_PLESSEY, 3, "9", 65, 0, 1, 799 }, /* 1 mod-11 check digit */ /* 6*/ { BARCODE_MSI_PLESSEY, 3, "9", 92, 0, 1, 1123 }, /* 1 mod-11 check digit */
/* 7*/ { BARCODE_MSI_PLESSEY, 3, "9", 66, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 7*/ { BARCODE_MSI_PLESSEY, 3, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 8*/ { BARCODE_MSI_PLESSEY, 3, "3", 65, 0, 1, 811 }, /* 1 mod-11 double check digit "10" */ /* 8*/ { BARCODE_MSI_PLESSEY, 3, "4", 92, 0, 1, 1135 }, /* 1 mod-11 double check digit "10" */
/* 9*/ { BARCODE_MSI_PLESSEY, 3, "3", 66, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 9*/ { BARCODE_MSI_PLESSEY, 3, "4", 93, 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 */ /* 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", 66, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 11*/ { BARCODE_MSI_PLESSEY, 4, "9", 93, 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 */ /* 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, "3", 66, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 13*/ { BARCODE_MSI_PLESSEY, 4, "4", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 14*/ { BARCODE_MSI_PLESSEY, 5, "9", 65, 0, 1, 799 }, /* 1 NCR mod-11 check digit */ /* 14*/ { BARCODE_MSI_PLESSEY, 5, "9", 92, 0, 1, 1123 }, /* 1 NCR mod-11 check digit */
/* 15*/ { BARCODE_MSI_PLESSEY, 5, "9", 66, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 15*/ { BARCODE_MSI_PLESSEY, 5, "9", 93, 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 */ /* 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", 66, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 17*/ { BARCODE_MSI_PLESSEY, 6, "9", 93, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 18*/ { BARCODE_PLESSEY, -1, "A", 65, 0, 1, 1107 }, /* 18*/ { BARCODE_PLESSEY, -1, "A", 67, 0, 1, 1139 },
/* 19*/ { BARCODE_PLESSEY, -1, "A", 66, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 19*/ { BARCODE_PLESSEY, -1, "A", 68, ZINT_ERROR_TOO_LONG, -1, -1 },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol = NULL;
char data_buf[4096]; char data_buf[4096];
testStart("test_large"); testStartSymbol("test_large", &symbol);
for (i = 0; i < data_size; i++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; 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++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; 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++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol = NULL;
char escaped[1024]; char escaped[1024];
char bwipp_buf[4096]; 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 */ 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++) { for (i = 0; i < data_size; i++) {

View File

@ -48,8 +48,8 @@ static void test_large(const testCtx *const p_ctx) {
}; };
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_FLAT, "1", 90, 0, 1, 810 }, /* 0*/ { BARCODE_FLAT, "1", 128, 0, 1, 1152 },
/* 1*/ { BARCODE_FLAT, "1", 91, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 1*/ { BARCODE_FLAT, "1", 129, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 2*/ { BARCODE_POSTNET, "1", 11, 0, 2, 123 }, /* 2*/ { BARCODE_POSTNET, "1", 11, 0, 2, 123 },
/* 3*/ { BARCODE_POSTNET, "1", 12, ZINT_WARN_NONCOMPLIANT, 2, 133 }, /* 3*/ { BARCODE_POSTNET, "1", 12, ZINT_WARN_NONCOMPLIANT, 2, 133 },
/* 4*/ { BARCODE_POSTNET, "1", 38, ZINT_WARN_NONCOMPLIANT, 2, 393 }, /* 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 }, /* 23*/ { BARCODE_PLANET, "1", 39, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 24*/ { BARCODE_KIX, "1", 18, 0, 3, 143 }, /* 24*/ { BARCODE_KIX, "1", 18, 0, 3, 143 },
/* 25*/ { BARCODE_KIX, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 25*/ { BARCODE_KIX, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 26*/ { BARCODE_DAFT, "D", 250, 0, 3, 499 }, /* 26*/ { BARCODE_DAFT, "D", 576, 0, 3, 1151 },
/* 27*/ { BARCODE_DAFT, "D", 251, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 27*/ { BARCODE_DAFT, "D", 577, ZINT_ERROR_TOO_LONG, -1, -1 },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol = NULL;
char data_buf[4096]; char data_buf[4096];
testStart("test_large"); testStartSymbol("test_large", &symbol);
for (i = 0; i < data_size; i++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; 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++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; 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++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol = NULL;
char cmp_buf[8192]; char cmp_buf[8192];
char cmp_msg[1024]; char cmp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ 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++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol = NULL;
char escaped[1024]; char escaped[1024];
char bwipp_buf[8192]; 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 */ 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++) { for (i = 0; i < data_size; i++) {

View File

@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2020-2022 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2020-2023 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
@ -44,18 +44,18 @@ static void test_large(const testCtx *const p_ctx) {
}; };
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_TELEPEN, "\177", 30, 0, 1, 528 }, /* 0*/ { BARCODE_TELEPEN, "\177", 69, 0, 1, 1152 },
/* 1*/ { BARCODE_TELEPEN, "\177", 31, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 1*/ { BARCODE_TELEPEN, "\177", 70, ZINT_ERROR_TOO_LONG, -1, -1 },
/* 2*/ { BARCODE_TELEPEN_NUM, "1", 60, 0, 1, 528 }, /* 2*/ { BARCODE_TELEPEN_NUM, "1", 136, 0, 1, 1136 },
/* 3*/ { BARCODE_TELEPEN_NUM, "1", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 3*/ { BARCODE_TELEPEN_NUM, "1", 137, ZINT_ERROR_TOO_LONG, -1, -1 },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; 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++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; 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++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; 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++) { 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 data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol; struct zint_symbol *symbol = NULL;
char escaped[1024]; char escaped[1024];
char bwipp_buf[8192]; 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 */ 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++) { 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) */ /* Note NULs where using DELs code (16 binary characters wide) */
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = { 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 }, /* 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", 31, ZINT_ERROR_TOO_LONG }, /* 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", 60, ZINT_ERROR_INVALID_DATA }, /* 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, "040404040404040404040404040404040404040404040404040404040404", 60, 0 }, /* 3*/ { BARCODE_TELEPEN_NUM, "0404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404", 136, 0 },
/* 4*/ { BARCODE_TELEPEN_NUM, "1234567890123456789012345678901234567890123456789012345678901", 61, ZINT_ERROR_TOO_LONG }, /* 4*/ { BARCODE_TELEPEN_NUM, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567", 137, ZINT_ERROR_TOO_LONG },
/* 5*/ { BARCODE_TELEPEN_NUM, "00000000000000000000000000000000000000000000000000000000000X", 60, 0 }, /* 5*/ { BARCODE_TELEPEN_NUM, "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000X", 136, 0 },
/* 6*/ { BARCODE_TELEPEN_NUM, "999999999999999999999999999999999999999999999999999999999999", 60, 0 }, /* 6*/ { BARCODE_TELEPEN_NUM, "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", 136, 0 },
/* 7*/ { BARCODE_TELEPEN_NUM, "1234567890123456789012345678901234567890123456789012345678901234567890", 4, 0 }, /* Length given, strlen > 61, so pseudo not NUL-terminated */ /* 7*/ { BARCODE_TELEPEN_NUM, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 4, 0 }, /* Length given, strlen > 137, so pseudo not NUL-terminated */
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
int i, length, ret; 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++) { for (i = 0; i < data_size; i++) {

View File

@ -4222,7 +4222,7 @@ aria-hidden="true"><code>zint -b CODE11 -d "9212320967"</code></figcaption>
<p>Developed by Intermec in 1977, Code 11 is similar to Code 2 of 5 <p>Developed by Intermec in 1977, Code 11 is similar to Code 2 of 5
Matrix and is primarily used in telecommunications. The symbol can Matrix and is primarily used in telecommunications. The symbol can
encode data consisting of the digits 0-9 and the dash character encode data consisting of the digits 0-9 and the dash character
(<code>-</code>) up to a maximum of 121 characters. Two modulo-11 check (<code>-</code>) up to a maximum of 140 characters. Two modulo-11 check
digits are added by default. To add just one check digit, set digits are added by default. To add just one check digit, set
<code>--vers=1</code> (API <code>option_2 = 1</code>). To add no check <code>--vers=1</code> (API <code>option_2 = 1</code>). To add no check
digits, set <code>--vers=2</code> (API <code>option_2 = 2</code>).</p> digits, set <code>--vers=2</code> (API <code>option_2 = 2</code>).</p>
@ -4240,7 +4240,7 @@ aria-hidden="true"><code>zint -b C25STANDARD -d "9212320967"</code></figcaption>
</figure> </figure>
<p>Also known as Code 2 of 5 Matrix, this is a self-checking code used <p>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 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 check digit is added by default. To add a check digit, set
<code>--vers=1</code> (API <code>option_2 = 1</code>). To add a check <code>--vers=1</code> (API <code>option_2 = 1</code>). To add a check
digit but not show it in the Human Readable Text, set digit but not show it in the Human Readable Text, set
@ -4254,7 +4254,7 @@ aria-hidden="true"><code>zint -b C25IATA -d "9212320967"</code></figcaption>
</figure> </figure>
<p>Used for baggage handling in the air-transport industry by the <p>Used for baggage handling in the air-transport industry by the
International Air Transport Agency, this self-checking code will encode 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 <a is added by default, but can be set the same as for <a
href="#standard-code-2-of-5">6.1.2.1 Standard Code 2 of 5</a>.</p> href="#standard-code-2-of-5">6.1.2.1 Standard Code 2 of 5</a>.</p>
<h4 id="industrial-code-2-of-5">6.1.2.3 Industrial Code 2 of 5</h4> <h4 id="industrial-code-2-of-5">6.1.2.3 Industrial Code 2 of 5</h4>
@ -4265,7 +4265,7 @@ alt="zint -b C25IND -d &quot;9212320967&quot;" />
aria-hidden="true"><code>zint -b C25IND -d "9212320967"</code></figcaption> aria-hidden="true"><code>zint -b C25IND -d "9212320967"</code></figcaption>
</figure> </figure>
<p>Industrial Code 2 of 5 can encode numeric input (digits 0-9) up to a <p>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 <a href="#standard-code-2-of-5">6.1.2.1 Standard Code 2 the same as for <a href="#standard-code-2-of-5">6.1.2.1 Standard Code 2
of 5</a>.</p> of 5</a>.</p>
<h4 id="interleaved-code-2-of-5-iso-16390">6.1.2.4 Interleaved Code 2 of <h4 id="interleaved-code-2-of-5-iso-16390">6.1.2.4 Interleaved Code 2 of
@ -4278,7 +4278,7 @@ aria-hidden="true"><code>zint -b C25INTER --compliantheight -d "9212320967"</cod
</figure> </figure>
<p>This self-checking symbology encodes pairs of numbers, and so can <p>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 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 digits) can be encoded. No check digit is added by default, but can be
set the same as for <a href="#standard-code-2-of-5">6.1.2.1 Standard set the same as for <a href="#standard-code-2-of-5">6.1.2.1 Standard
Code 2 of 5</a>.</p> Code 2 of 5</a>.</p>
@ -4290,7 +4290,7 @@ alt="zint -b C25LOGIC -d &quot;9212320967&quot;" />
aria-hidden="true"><code>zint -b C25LOGIC -d "9212320967"</code></figcaption> aria-hidden="true"><code>zint -b C25LOGIC -d "9212320967"</code></figcaption>
</figure> </figure>
<p>Data Logic does not include a check digit by default and can encode <p>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 <a href="#standard-code-2-of-5">6.1.2.1 options are the same as for <a href="#standard-code-2-of-5">6.1.2.1
Standard Code 2 of 5</a>.</p> Standard Code 2 of 5</a>.</p>
<h4 id="itf-14">6.1.2.6 ITF-14</h4> <h4 id="itf-14">6.1.2.6 ITF-14</h4>
@ -4517,7 +4517,7 @@ aria-hidden="true"><code>zint -b PLESSEY -d "C64"</code></figcaption>
</figure> </figure>
<p>Also known as Plessey Code, this symbology was developed by the <p>Also known as Plessey Code, this symbology was developed by the
Plessey Company Ltd. in the UK. The symbol can encode data consisting of 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.</p> includes a hidden CRC check digit.</p>
<h4 id="msi-plessey">6.1.5.2 MSI Plessey</h4> <h4 id="msi-plessey">6.1.5.2 MSI Plessey</h4>
<figure> <figure>
@ -4527,7 +4527,7 @@ alt="zint -b MSI_PLESSEY -d &quot;6502&quot; --vers=2" />
aria-hidden="true"><code>zint -b MSI_PLESSEY -d "6502" --vers=2</code></figcaption> aria-hidden="true"><code>zint -b MSI_PLESSEY -d "6502" --vers=2</code></figcaption>
</figure> </figure>
<p>Based on Plessey and developed by MSI Data Corporation, MSI Plessey <p>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 of check digit options that are selectable by setting
<code>--vers</code> (API <code>option_2</code>), shown in the table <code>--vers</code> (API <code>option_2</code>), shown in the table
below:</p> below:</p>
@ -4587,7 +4587,7 @@ alt="zint -b TELEPEN --compliantheight -d &quot;Z80&quot;" />
aria-hidden="true"><code>zint -b TELEPEN --compliantheight -d "Z80"</code></figcaption> aria-hidden="true"><code>zint -b TELEPEN --compliantheight -d "Z80"</code></figcaption>
</figure> </figure>
<p>Telepen Alpha was developed by SB Electronic Systems Limited and can <p>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.</p> includes a hidden modulo-127 check digit, added by Zint.</p>
<h4 id="telepen-numeric">6.1.6.2 Telepen Numeric</h4> <h4 id="telepen-numeric">6.1.6.2 Telepen Numeric</h4>
<figure> <figure>
@ -4600,7 +4600,7 @@ aria-hidden="true"><code>zint -b TELEPEN_NUM --compliantheight -d "466X33"</code
symbol. Data can consist of pairs of numbers or pairs consisting of a symbol. Data can consist of pairs of numbers or pairs consisting of a
numerical digit followed an X character. For example: 466333 and 466X33 numerical digit followed an X character. For example: 466333 and 466X33
are valid codes whereas 46X333 is not (the digit pair <code>"X3"</code> are valid codes whereas 46X333 is not (the digit pair <code>"X3"</code>
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.</p> a hidden modulo-127 check digit which is added by Zint.</p>
<h3 id="code-39">6.1.7 Code 39</h3> <h3 id="code-39">6.1.7 Code 39</h3>
<h4 id="standard-code-39-iso-16388">6.1.7.1 Standard Code 39 (ISO <h4 id="standard-code-39-iso-16388">6.1.7.1 Standard Code 39 (ISO
@ -4612,7 +4612,7 @@ alt="zint -b CODE39 --compliantheight -d &quot;1A&quot; --vers=1" />
aria-hidden="true"><code>zint -b CODE39 --compliantheight -d "1A" --vers=1</code></figcaption> aria-hidden="true"><code>zint -b CODE39 --compliantheight -d "1A" --vers=1</code></figcaption>
</figure> </figure>
<p>Standard Code 39 was developed in 1974 by Intermec. Input data can be <p>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 (<code>-</code>), full stop (<code>.</code>), space, asterisk dash (<code>-</code>), full stop (<code>.</code>), space, asterisk
(<code>*</code>), dollar (<code>$</code>), slash (<code>/</code>), plus (<code>*</code>), dollar (<code>$</code>), slash (<code>/</code>), plus
(<code>+</code>) and percent (<code>%</code>). The standard does not (<code>+</code>) and percent (<code>%</code>). The standard does not
@ -4641,9 +4641,10 @@ alt="zint -b CODE93 --compliantheight -d &quot;C93&quot;" />
aria-hidden="true"><code>zint -b CODE93 --compliantheight -d "C93"</code></figcaption> aria-hidden="true"><code>zint -b CODE93 --compliantheight -d "C93"</code></figcaption>
</figure> </figure>
<p>A variation of Extended Code 39, Code 93 also supports full ASCII <p>A variation of Extended Code 39, Code 93 also supports full ASCII
text. Two check characters are added by Zint. By default these check text, accepting up to 123 characters. Two check characters are added by
characters are not shown in the Human Readable Text, but may be shown by Zint. By default these check characters are not shown in the Human
setting <code>--vers=1</code> (API <code>option_2 = 1</code>).</p> Readable Text, but may be shown by setting <code>--vers=1</code> (API
<code>option_2 = 1</code>).</p>
<h4 id="pzn-pharmazentralnummer">6.1.7.4 PZN (Pharmazentralnummer)</h4> <h4 id="pzn-pharmazentralnummer">6.1.7.4 PZN (Pharmazentralnummer)</h4>
<figure> <figure>
<img src="images/pzn.svg" title="fig:" class="lin" <img src="images/pzn.svg" title="fig:" class="lin"
@ -4671,7 +4672,8 @@ aria-hidden="true"><code>zint -b LOGMARS --compliantheight -d "12345/ABCDE" --ve
Symbols) is a variation of the Code 39 symbology used by the U.S. Symbols) is a variation of the Code 39 symbology used by the U.S.
Department of Defense. LOGMARS encodes the same character set as <a Department of Defense. LOGMARS encodes the same character set as <a
href="#standard-code-39-iso-16388">6.1.7.1 Standard Code 39 (ISO href="#standard-code-39-iso-16388">6.1.7.1 Standard Code 39 (ISO
16388)</a>, and the check digit options are also the same.</p> 16388)</a>, and the check digit options are also the same. Input is
restricted to a maximum of 30 characters.</p>
<h4 id="code-32">6.1.7.6 Code 32</h4> <h4 id="code-32">6.1.7.6 Code 32</h4>
<figure> <figure>
<img src="images/code32.svg" title="fig:" class="lin" <img src="images/code32.svg" title="fig:" class="lin"
@ -4719,7 +4721,7 @@ aria-hidden="true"><code>zint -b CODABAR --compliantheight -d "A37859B"</code></
27, this symbology was developed in 1972 by Monarch Marketing Systems 27, this symbology was developed in 1972 by Monarch Marketing Systems
for retail purposes. The American Blood Commission adopted Codabar in for retail purposes. The American Blood Commission adopted Codabar in
1977 as the standard symbology for blood identification. Codabar can 1977 as the standard symbology for blood identification. Codabar can
encode up to 60 characters starting and ending with the letters A-D and encode up to 103 characters starting and ending with the letters A-D and
containing between these letters the numbers 0-9, dash (<code>-</code>), containing between these letters the numbers 0-9, dash (<code>-</code>),
dollar (<code>$</code>), colon (<code>:</code>), slash (<code>/</code>), dollar (<code>$</code>), colon (<code>:</code>), slash (<code>/</code>),
full stop (<code>.</code>) or plus (<code>+</code>). No check character full stop (<code>.</code>) or plus (<code>+</code>). No check character
@ -7963,8 +7965,8 @@ aria-hidden="true"><code>zint -b FLAT -d "1304056"</code></figcaption>
<p>Used for the recognition of page sequences in print-shops, the <p>Used for the recognition of page sequences in print-shops, the
Flattermarken is not a true barcode symbol and requires precise Flattermarken is not a true barcode symbol and requires precise
knowledge of the position of the mark on the page. The Flattermarken knowledge of the position of the mark on the page. The Flattermarken
system can encode numeric data up to a maximum of 90 digits and does not system can encode numeric data up to a maximum of 128 digits and does
include a check digit.</p> not include a check digit.</p>
<h1 id="legal-and-version-information">7. Legal and Version <h1 id="legal-and-version-information">7. Legal and Version
Information</h1> Information</h1>
<h2 id="license">7.1 License</h2> <h2 id="license">7.1 License</h2>

View File

@ -2615,7 +2615,7 @@ widths.
Developed by Intermec in 1977, Code 11 is similar to Code 2 of 5 Matrix and is 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 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. the digits 0-9 and the dash character (`-`) up to a maximum of 140 characters.
Two modulo-11 check digits are added by default. To add just one check digit, 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` set `--vers=1` (API `option_2 = 1`). To add no check digits, set `--vers=2`
(API `option_2 = 2`). (API `option_2 = 2`).
@ -2633,10 +2633,10 @@ before using these standards.
Also known as Code 2 of 5 Matrix, this is a self-checking code used in 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 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 check digit is added numeric input (digits 0-9) up to a maximum of 112 digits. No check digit is
by default. To add a check digit, set `--vers=1` (API `option_2 = 1`). To add a added by default. To add a check digit, set `--vers=1` (API `option_2 = 1`). To
check digit but not show it in the Human Readable Text, set `--vers=2` (API add a check digit but not show it in the Human Readable Text, set `--vers=2`
`option_2 = 2`). (API `option_2 = 2`).
#### 6.1.2.2 IATA Code 2 of 5 #### 6.1.2.2 IATA Code 2 of 5
@ -2644,7 +2644,7 @@ check digit but not show it in the Human Readable Text, set `--vers=2` (API
Used for baggage handling in the air-transport industry by the International Air 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) Transport Agency, this self-checking code will encode numeric input (digits 0-9)
up to a maximum of 45 digits. No check digit is added by default, but can be set 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]. the same as for [6.1.2.1 Standard Code 2 of 5].
#### 6.1.2.3 Industrial Code 2 of 5 #### 6.1.2.3 Industrial Code 2 of 5
@ -2652,7 +2652,7 @@ the same as for [6.1.2.1 Standard Code 2 of 5].
![`zint -b C25IND -d "9212320967"`](images/c25ind.svg){.lin} ![`zint -b C25IND -d "9212320967"`](images/c25ind.svg){.lin}
Industrial Code 2 of 5 can encode numeric input (digits 0-9) up to a maximum of 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 the same as for 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]. [6.1.2.1 Standard Code 2 of 5].
#### 6.1.2.4 Interleaved Code 2 of 5 (ISO 16390) #### 6.1.2.4 Interleaved Code 2 of 5 (ISO 16390)
@ -2662,7 +2662,7 @@ Industrial Code 2 of 5 can encode numeric input (digits 0-9) up to a maximum of
This self-checking symbology encodes pairs of numbers, and so can only encode an 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 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 digits) can be encoded. No 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 check digit is added by default, but can be set the same as for [6.1.2.1
Standard Code 2 of 5]. Standard Code 2 of 5].
@ -2671,7 +2671,7 @@ Standard Code 2 of 5].
![`zint -b C25LOGIC -d "9212320967"`](images/c25logic.svg){.lin} ![`zint -b C25LOGIC -d "9212320967"`](images/c25logic.svg){.lin}
Data Logic does not include a check digit by default and can encode numeric 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 options are the 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]. same as for [6.1.2.1 Standard Code 2 of 5].
#### 6.1.2.6 ITF-14 #### 6.1.2.6 ITF-14
@ -2888,14 +2888,14 @@ UPC Version E].
Also known as Plessey Code, this symbology was developed by the Plessey Company 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 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 includes a hidden CRC check digit. A-F up to a maximum of 67 characters and includes a hidden CRC check digit.
#### 6.1.5.2 MSI Plessey #### 6.1.5.2 MSI Plessey
![`zint -b MSI_PLESSEY -d "6502" --vers=2`](images/msi_plessey.svg){.lin} ![`zint -b MSI_PLESSEY -d "6502" --vers=2`](images/msi_plessey.svg){.lin}
Based on Plessey and developed by MSI Data Corporation, MSI Plessey can encode 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 of check digit 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 options that are selectable by setting `--vers` (API `option_2`), shown in the
table below: table below:
@ -2922,7 +2922,7 @@ hidden modulo-10 check digits.
![`zint -b TELEPEN --compliantheight -d "Z80"`](images/telepen.svg){.lin} ![`zint -b TELEPEN --compliantheight -d "Z80"`](images/telepen.svg){.lin}
Telepen Alpha was developed by SB Electronic Systems Limited and can encode Telepen Alpha was developed by SB Electronic Systems Limited and can encode
ASCII text input, up to a maximum of 30 characters. Telepen includes a ASCII text input, up to a maximum of 69 characters. Telepen includes a
hidden modulo-127 check digit, added by Zint. hidden modulo-127 check digit, added by Zint.
#### 6.1.6.2 Telepen Numeric #### 6.1.6.2 Telepen Numeric
@ -2933,7 +2933,7 @@ hidden modulo-127 check digit, added by Zint.
Telepen Numeric allows compression of numeric data into a Telepen symbol. Data Telepen Numeric allows compression of numeric data into a Telepen symbol. Data
can consist of pairs of numbers or pairs consisting of a numerical digit can consist of pairs of numbers or pairs consisting of a numerical digit
followed an X character. For example: 466333 and 466X33 are valid codes whereas followed an X character. For example: 466333 and 466X33 are valid codes whereas
46X333 is not (the digit pair `"X3"` is not valid). Up to 60 digits can be 46X333 is not (the digit pair `"X3"` is not valid). Up to 136 digits can be
encoded. Telepen Numeric includes a hidden modulo-127 check digit which is added encoded. Telepen Numeric includes a hidden modulo-127 check digit which is added
by Zint. by Zint.
@ -2943,7 +2943,7 @@ by Zint.
![`zint -b CODE39 --compliantheight -d "1A" --vers=1`](images/code39.svg){.lin} ![`zint -b CODE39 --compliantheight -d "1A" --vers=1`](images/code39.svg){.lin}
Standard Code 39 was developed in 1974 by Intermec. Input data can be up to 85 Standard Code 39 was developed in 1974 by Intermec. Input data can be up to 86
characters in length and can include the characters 0-9, A-Z, dash (`-`), full characters in length and can include the characters 0-9, A-Z, dash (`-`), full
stop (`.`), space, asterisk (`*`), dollar (`$`), slash (`/`), plus (`+`) and stop (`.`), space, asterisk (`*`), dollar (`$`), slash (`/`), plus (`+`) and
percent (`%`). The standard does not require a check digit but a modulo-43 check percent (`%`). The standard does not require a check digit but a modulo-43 check
@ -2966,10 +2966,10 @@ options are the same as for [6.1.7.1 Standard Code 39 (ISO 16388)].
![`zint -b CODE93 --compliantheight -d "C93"`](images/code93.svg){.lin} ![`zint -b CODE93 --compliantheight -d "C93"`](images/code93.svg){.lin}
A variation of Extended Code 39, Code 93 also supports full ASCII text. Two A variation of Extended Code 39, Code 93 also supports full ASCII text,
check characters are added by Zint. By default these check characters are not accepting up to 123 characters. Two check characters are added by Zint. By
shown in the Human Readable Text, but may be shown by setting `--vers=1` (API default these check characters are not shown in the Human Readable Text, but may
`option_2 = 1`). be shown by setting `--vers=1` (API `option_2 = 1`).
#### 6.1.7.4 PZN (Pharmazentralnummer) #### 6.1.7.4 PZN (Pharmazentralnummer)
@ -2992,7 +2992,8 @@ will be added or if 7 digits supplied the check digit validated.
LOGMARS (Logistics Applications of Automated Marking and Reading Symbols) is a LOGMARS (Logistics Applications of Automated Marking and Reading Symbols) is a
variation of the Code 39 symbology used by the U.S. Department of Defense. variation of the Code 39 symbology used by the U.S. Department of Defense.
LOGMARS encodes the same character set as [6.1.7.1 Standard Code 39 (ISO LOGMARS encodes the same character set as [6.1.7.1 Standard Code 39 (ISO
16388)], and the check digit options are also the same. 16388)], and the check digit options are also the same. Input is restricted to
a maximum of 30 characters.
#### 6.1.7.6 Code 32 #### 6.1.7.6 Code 32
@ -3028,7 +3029,7 @@ required. An invisible Import character prefix `'I'` can be added by setting
Also known as NW-7, Monarch, ABC Codabar, USD-4, Ames Code and Code 27, this Also known as NW-7, Monarch, ABC Codabar, USD-4, Ames Code and Code 27, this
symbology was developed in 1972 by Monarch Marketing Systems for retail symbology was developed in 1972 by Monarch Marketing Systems for retail
purposes. The American Blood Commission adopted Codabar in 1977 as the standard purposes. The American Blood Commission adopted Codabar in 1977 as the standard
symbology for blood identification. Codabar can encode up to 60 characters symbology for blood identification. Codabar can encode up to 103 characters
starting and ending with the letters A-D and containing between these letters starting and ending with the letters A-D and containing between these letters
the numbers 0-9, dash (`-`), dollar (`$`), colon (`:`), slash (`/`), full stop the numbers 0-9, dash (`-`), dollar (`$`), colon (`:`), slash (`/`), full stop
(`.`) or plus (`+`). No check character is generated by default, but a modulo-16 (`.`) or plus (`+`). No check character is generated by default, but a modulo-16
@ -4623,7 +4624,7 @@ Table: {#tbl:fim_characters tag=": Valid FIM Characters"}
Used for the recognition of page sequences in print-shops, the Flattermarken is Used for the recognition of page sequences in print-shops, the Flattermarken is
not a true barcode symbol and requires precise knowledge of the position of the not a true barcode symbol and requires precise knowledge of the position of the
mark on the page. The Flattermarken system can encode numeric data up to a mark on the page. The Flattermarken system can encode numeric data up to a
maximum of 90 digits and does not include a check digit. maximum of 128 digits and does not include a check digit.
# 7. Legal and Version Information # 7. Legal and Version Information

View File

@ -2564,7 +2564,7 @@ widths.
Developed by Intermec in 1977, Code 11 is similar to Code 2 of 5 Matrix and is 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 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 the digits 0-9 and the dash character (-) up to a maximum of 140 characters. Two
modulo-11 check digits are added by default. To add just one check digit, set 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 --vers=1 (API option_2 = 1). To add no check digits, set --vers=2 (API
option_2 = 2). option_2 = 2).
@ -2582,9 +2582,9 @@ before using these standards.
Also known as Code 2 of 5 Matrix, this is a self-checking code used in 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 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 check digit is added numeric input (digits 0-9) up to a maximum of 112 digits. No check digit is
by default. To add a check digit, set --vers=1 (API option_2 = 1). To add a added by default. To add a check digit, set --vers=1 (API option_2 = 1). To add
check digit but not show it in the Human Readable Text, set --vers=2 (API a check digit but not show it in the Human Readable Text, set --vers=2 (API
option_2 = 2). option_2 = 2).
6.1.2.2 IATA Code 2 of 5 6.1.2.2 IATA Code 2 of 5
@ -2593,7 +2593,7 @@ option_2 = 2).
Used for baggage handling in the air-transport industry by the International Air 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) Transport Agency, this self-checking code will encode numeric input (digits 0-9)
up to a maximum of 45 digits. No check digit is added by default, but can be set 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. the same as for 6.1.2.1 Standard Code 2 of 5.
6.1.2.3 Industrial Code 2 of 5 6.1.2.3 Industrial Code 2 of 5
@ -2601,7 +2601,7 @@ the same as for 6.1.2.1 Standard Code 2 of 5.
[zint -b C25IND -d "9212320967"] [zint -b C25IND -d "9212320967"]
Industrial Code 2 of 5 can encode numeric input (digits 0-9) up to a maximum of 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 the same as for 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. 6.1.2.1 Standard Code 2 of 5.
6.1.2.4 Interleaved Code 2 of 5 (ISO 16390) 6.1.2.4 Interleaved Code 2 of 5 (ISO 16390)
@ -2610,7 +2610,7 @@ Industrial Code 2 of 5 can encode numeric input (digits 0-9) up to a maximum of
This self-checking symbology encodes pairs of numbers, and so can only encode an 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 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 digits) can be encoded. No 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 check digit is added by default, but can be set the same as for 6.1.2.1 Standard
Code 2 of 5. Code 2 of 5.
@ -2619,7 +2619,7 @@ Code 2 of 5.
[zint -b C25LOGIC -d "9212320967"] [zint -b C25LOGIC -d "9212320967"]
Data Logic does not include a check digit by default and can encode numeric 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 options are the 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. same as for 6.1.2.1 Standard Code 2 of 5.
6.1.2.6 ITF-14 6.1.2.6 ITF-14
@ -2803,14 +2803,14 @@ UPC Version E.
Also known as Plessey Code, this symbology was developed by the Plessey Company 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 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 includes a hidden CRC check digit. A-F up to a maximum of 67 characters and includes a hidden CRC check digit.
6.1.5.2 MSI Plessey 6.1.5.2 MSI Plessey
[zint -b MSI_PLESSEY -d "6502" --vers=2] [zint -b MSI_PLESSEY -d "6502" --vers=2]
Based on Plessey and developed by MSI Data Corporation, MSI Plessey can encode 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 of check digit 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 options that are selectable by setting --vers (API option_2), shown in the table
below: below:
@ -2837,7 +2837,7 @@ modulo-10 check digits.
[zint -b TELEPEN --compliantheight -d "Z80"] [zint -b TELEPEN --compliantheight -d "Z80"]
Telepen Alpha was developed by SB Electronic Systems Limited and can encode Telepen Alpha was developed by SB Electronic Systems Limited and can encode
ASCII text input, up to a maximum of 30 characters. Telepen includes a hidden ASCII text input, up to a maximum of 69 characters. Telepen includes a hidden
modulo-127 check digit, added by Zint. modulo-127 check digit, added by Zint.
6.1.6.2 Telepen Numeric 6.1.6.2 Telepen Numeric
@ -2847,7 +2847,7 @@ modulo-127 check digit, added by Zint.
Telepen Numeric allows compression of numeric data into a Telepen symbol. Data Telepen Numeric allows compression of numeric data into a Telepen symbol. Data
can consist of pairs of numbers or pairs consisting of a numerical digit can consist of pairs of numbers or pairs consisting of a numerical digit
followed an X character. For example: 466333 and 466X33 are valid codes whereas followed an X character. For example: 466333 and 466X33 are valid codes whereas
46X333 is not (the digit pair "X3" is not valid). Up to 60 digits can be 46X333 is not (the digit pair "X3" is not valid). Up to 136 digits can be
encoded. Telepen Numeric includes a hidden modulo-127 check digit which is added encoded. Telepen Numeric includes a hidden modulo-127 check digit which is added
by Zint. by Zint.
@ -2857,7 +2857,7 @@ by Zint.
[zint -b CODE39 --compliantheight -d "1A" --vers=1] [zint -b CODE39 --compliantheight -d "1A" --vers=1]
Standard Code 39 was developed in 1974 by Intermec. Input data can be up to 85 Standard Code 39 was developed in 1974 by Intermec. Input data can be up to 86
characters in length and can include the characters 0-9, A-Z, dash (-), full characters in length and can include the characters 0-9, A-Z, dash (-), full
stop (.), space, asterisk (*), dollar ($), slash (/), plus (+) and percent (%). stop (.), space, asterisk (*), dollar ($), slash (/), plus (+) and percent (%).
The standard does not require a check digit but a modulo-43 check digit can be The standard does not require a check digit but a modulo-43 check digit can be
@ -2876,10 +2876,10 @@ options are the same as for 6.1.7.1 Standard Code 39 (ISO 16388).
[zint -b CODE93 --compliantheight -d "C93"] [zint -b CODE93 --compliantheight -d "C93"]
A variation of Extended Code 39, Code 93 also supports full ASCII text. Two A variation of Extended Code 39, Code 93 also supports full ASCII text,
check characters are added by Zint. By default these check characters are not accepting up to 123 characters. Two check characters are added by Zint. By
shown in the Human Readable Text, but may be shown by setting --vers=1 (API default these check characters are not shown in the Human Readable Text, but may
option_2 = 1). be shown by setting --vers=1 (API option_2 = 1).
6.1.7.4 PZN (Pharmazentralnummer) 6.1.7.4 PZN (Pharmazentralnummer)
@ -2901,7 +2901,8 @@ or if 7 digits supplied the check digit validated.
LOGMARS (Logistics Applications of Automated Marking and Reading Symbols) is a LOGMARS (Logistics Applications of Automated Marking and Reading Symbols) is a
variation of the Code 39 symbology used by the U.S. Department of Defense. variation of the Code 39 symbology used by the U.S. Department of Defense.
LOGMARS encodes the same character set as 6.1.7.1 Standard Code 39 (ISO 16388), LOGMARS encodes the same character set as 6.1.7.1 Standard Code 39 (ISO 16388),
and the check digit options are also the same. and the check digit options are also the same. Input is restricted to a maximum
of 30 characters.
6.1.7.6 Code 32 6.1.7.6 Code 32
@ -2937,7 +2938,7 @@ option_2 = 1).
Also known as NW-7, Monarch, ABC Codabar, USD-4, Ames Code and Code 27, this Also known as NW-7, Monarch, ABC Codabar, USD-4, Ames Code and Code 27, this
symbology was developed in 1972 by Monarch Marketing Systems for retail symbology was developed in 1972 by Monarch Marketing Systems for retail
purposes. The American Blood Commission adopted Codabar in 1977 as the standard purposes. The American Blood Commission adopted Codabar in 1977 as the standard
symbology for blood identification. Codabar can encode up to 60 characters symbology for blood identification. Codabar can encode up to 103 characters
starting and ending with the letters A-D and containing between these letters starting and ending with the letters A-D and containing between these letters
the numbers 0-9, dash (-), dollar ($), colon (:), slash (/), full stop (.) or the numbers 0-9, dash (-), dollar ($), colon (:), slash (/), full stop (.) or
plus (+). No check character is generated by default, but a modulo-16 one can be plus (+). No check character is generated by default, but a modulo-16 one can be
@ -4446,7 +4447,7 @@ generated using the characters A-E as shown in the table below.
Used for the recognition of page sequences in print-shops, the Flattermarken is Used for the recognition of page sequences in print-shops, the Flattermarken is
not a true barcode symbol and requires precise knowledge of the position of the not a true barcode symbol and requires precise knowledge of the position of the
mark on the page. The Flattermarken system can encode numeric data up to a mark on the page. The Flattermarken system can encode numeric data up to a
maximum of 90 digits and does not include a check digit. maximum of 128 digits and does not include a check digit.
7. Legal and Version Information 7. Legal and Version Information