general: reenable -Wpedantic for gcc by using __extension__ (ZEXT)

to suppress warnings about `errtxtf` operand number "%<n>$" args;
  enable some further warnings
test suite: enable -Wpedantic and fix/suppress any warnings
This commit is contained in:
gitlost 2025-01-27 11:03:33 +00:00
parent a4b557786f
commit b377b14360
93 changed files with 1397 additions and 1370 deletions

View file

@ -1,5 +1,5 @@
# Copyright (C) 2008 by BogDan Vatra < bogdan@licentia.eu >
# Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
# Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
# vim: set ts=4 sw=4 et :
cmake_minimum_required(VERSION 3.10)
@ -53,18 +53,31 @@ if(NOT MSVC) # Use default warnings if MSVC otherwise inundated
add_compile_options("-Wextra")
endif()
# gcc complains about "%n$" `errtxtf()` arguments if "-Wpedantic" used, so only use for clang
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
check_c_compiler_flag("-Wpedantic" C_COMPILER_FLAG_WPEDANTIC)
if(C_COMPILER_FLAG_WPEDANTIC)
add_compile_options("-Wpedantic")
endif()
check_c_compiler_flag("-Wpedantic" C_COMPILER_FLAG_WPEDANTIC)
if(C_COMPILER_FLAG_WPEDANTIC)
add_compile_options("-Wpedantic")
endif()
check_c_compiler_flag("-Wcast-align" C_COMPILER_FLAG_WCASTALIGN)
if(C_COMPILER_FLAG_WCASTALIGN)
add_compile_options("-Wcast-align")
endif()
check_c_compiler_flag("-Wpointer-arith" C_COMPILER_FLAG_WPOINTERARITH)
if(C_COMPILER_FLAG_WPOINTERARITH)
add_compile_options("-Wpointer-arith")
endif()
check_c_compiler_flag("-Wshadow" C_COMPILER_FLAG_WSHADOW)
if(C_COMPILER_FLAG_WSHADOW)
add_compile_options("-Wshadow")
endif()
check_c_compiler_flag("-Wundef" C_COMPILER_FLAG_WUNDEF)
if(C_COMPILER_FLAG_WUNDEF)
add_compile_options("-Wundef")
endif()
check_c_compiler_flag("-Wwrite-strings" C_COMPILER_FLAG_WWRITESTRINGS)
if(C_COMPILER_FLAG_WWRITESTRINGS)
add_compile_options("-Wwrite-strings")
endif()
endif()
if(ZINT_DEBUG)

View file

@ -65,8 +65,8 @@ static int c25_common(struct zint_symbol *symbol, const unsigned char source[],
if (length > max) {
/* errtxt 301: 303: 305: 307: */
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, error_base, "Input length %1$d too long (maximum %2$d)", length,
max);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, error_base, "Input length %1$d too long (maximum %2$d)",
length, max);
}
if ((i = not_sane(NEON_F, source, length))) {
/* Note: for all "at position" error messages, escape sequences not accounted for */

View file

@ -1,7 +1,7 @@
/* auspost.c - Handles Australia Post 4-State Barcode */
/*
libzint - the open source barcode library
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -194,7 +194,7 @@ INTERNAL int auspost(struct zint_symbol *symbol, unsigned char source[], int len
/* Verify that the first 8 characters are numbers */
memcpy(dpid, localstr, 8);
dpid[8] = '\0';
if ((i = not_sane(NEON_F, (unsigned char *) dpid, 8))) {
if ((i = not_sane(NEON_F, (const unsigned char *) dpid, 8))) {
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 405,
"Invalid character at position %d in DPID (first 8 characters) (digits only)", i);
}

View file

@ -1,7 +1,7 @@
/* aztec.c - Handles Aztec 2D Symbols */
/*
libzint - the open source barcode library
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -893,9 +893,9 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int
"Structured Append count '%d' out of range (2 to 26)", symbol->structapp.count);
}
if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 702,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 702,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
}
for (id_len = 0; id_len < 32 && symbol->structapp.id[id_len]; id_len++);
@ -976,14 +976,14 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int
if (layers == 0) { /* Couldn't find a symbol which fits the data */
if (adjustment_size == 0) {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 707,
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 707,
"Input too long for ECC level %1$d, requires too many codewords (maximum %2$d)",
ecc_level, AztecDataSizes[ecc_level - 1][31] / 12);
}
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 504,
"Input too long for ECC level %1$d, requires %2$d codewords (maximum %3$d)",
ecc_level, (data_length + adjustment_size + 11) / 12,
AztecDataSizes[ecc_level - 1][31] / 12);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 504,
"Input too long for ECC level %1$d, requires %2$d codewords (maximum %3$d)",
ecc_level, (data_length + adjustment_size + 11) / 12,
AztecDataSizes[ecc_level - 1][31] / 12);
}
codeword_size = az_codeword_size(layers);
@ -991,9 +991,9 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int
adjusted_length = az_bitrun_stuff(binary_string, data_length, codeword_size,
adjustment_size ? data_maxsize : AZTEC_BIN_CAPACITY, adjusted_string);
if (adjusted_length == 0) {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 705,
"Input too long for ECC level %1$d, requires too many codewords (maximum %2$d)",
ecc_level, (adjustment_size ? data_maxsize : AZTEC_BIN_CAPACITY) / codeword_size);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 705,
"Input too long for ECC level %1$d, requires too many codewords (maximum %2$d)",
ecc_level, (adjustment_size ? data_maxsize : AZTEC_BIN_CAPACITY) / codeword_size);
}
adjustment_size = adjusted_length - data_length;
@ -1050,9 +1050,9 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int
adjusted_length = az_bitrun_stuff(binary_string, data_length, codeword_size, data_maxsize, adjusted_string);
if (adjusted_length == 0) {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 704,
"Input too long for Version %1$d, requires too many codewords (maximum %2$d)",
symbol->option_2, data_maxsize / codeword_size);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 704,
"Input too long for Version %1$d, requires too many codewords (maximum %2$d)",
symbol->option_2, data_maxsize / codeword_size);
}
/* Add padding */
@ -1067,10 +1067,10 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int
/* Check if the data actually fits into the selected symbol size */
if (adjusted_length + padbits > data_maxsize) {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 505,
"Input too long for Version %1$d, requires %2$d codewords (maximum %3$d)",
symbol->option_2, (adjusted_length + padbits) / codeword_size,
data_maxsize / codeword_size);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 505,
"Input too long for Version %1$d, requires %2$d codewords (maximum %3$d)",
symbol->option_2, (adjusted_length + padbits) / codeword_size,
data_maxsize / codeword_size);
}
adjusted_length = az_add_padding(padbits, codeword_size, adjusted_string, adjusted_length);
@ -1102,9 +1102,9 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int
ecc_blocks = AztecSizes[layers - 1] - data_blocks;
}
if (ecc_blocks < data_blocks / 20) {
error_number = errtxtf(ZINT_WARN_NONCOMPLIANT, symbol, 708,
"Number of ECC codewords %1$d less than %2$d (5%% of data codewords %3$d)",
ecc_blocks, data_blocks / 20, data_blocks);
error_number = ZEXT errtxtf(ZINT_WARN_NONCOMPLIANT, symbol, 708,
"Number of ECC codewords %1$d less than %2$d (5%% of data codewords %3$d)",
ecc_blocks, data_blocks / 20, data_blocks);
}
if (debug_print) {

View file

@ -1,7 +1,7 @@
/* bmp.c - Handles output to Windows Bitmap file */
/*
libzint - the open source barcode library
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -115,7 +115,7 @@ INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix
/* Open output file in binary mode */
if (!fm_open(fmp, symbol, "wb")) {
errtxtf(0, symbol, 601, "Could not open BMP output file (%1$d: %2$s)", fmp->err, strerror(fmp->err));
ZEXT errtxtf(0, symbol, 601, "Could not open BMP output file (%1$d: %2$s)", fmp->err, strerror(fmp->err));
free(rowbuf);
return ZINT_ERROR_FILE_ACCESS;
}
@ -158,14 +158,14 @@ INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix
free(rowbuf);
if (fm_error(fmp)) {
errtxtf(0, symbol, 603, "Incomplete write of BMP output (%1$d: %2$s)", fmp->err, strerror(fmp->err));
ZEXT errtxtf(0, symbol, 603, "Incomplete write of BMP output (%1$d: %2$s)", fmp->err, strerror(fmp->err));
(void) fm_close(fmp, symbol);
return ZINT_ERROR_FILE_WRITE;
}
if (!fm_close(fmp, symbol)) {
return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 605, "Failure on closing BMP output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
return ZEXT errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 605, "Failure on closing BMP output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
}
return 0;

View file

@ -216,12 +216,12 @@ INTERNAL int channel(struct zint_symbol *symbol, unsigned char source[], int len
if (target_value > max_ranges[channels]) {
if (channels == 8) {
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 318, "Input value \"%1$d\" out of range (0 to %2$d)",
target_value, max_ranges[channels]);
return ZEXT errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 318, "Input value \"%1$d\" out of range (0 to %2$d)",
target_value, max_ranges[channels]);
}
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 335,
"Input value \"%1$d\" out of range (0 to %2$d for %3$d channels)",
target_value, max_ranges[channels], channels);
return ZEXT errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 335,
"Input value \"%1$d\" out of range (0 to %2$d for %3$d channels)", target_value,
max_ranges[channels], channels);
}
CHNCHR(channels, target_value, B, S);

View file

@ -79,8 +79,8 @@ INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int len
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 359, "Does not end with \"A\", \"B\", \"C\" or \"D\"");
}
if ((i = not_sane_lookup(CALCIUM, sizeof(CALCIUM) - 1, source, length, posns))) {
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 357,
"Invalid character at position %1$d in input (\"%2$s\" only)", i, CALCIUM);
return ZEXT errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 357,
"Invalid character at position %1$d in input (\"%2$s\" only)", i, CALCIUM);
}
/* And must not use A, B, C or D otherwise (BS EN 798:1995 4.3.2) */
if ((i = not_sane(CALCIUM_INNER_F, source + 1, length - 2))) {

View file

@ -454,8 +454,9 @@ INTERNAL int vin(struct zint_symbol *symbol, unsigned char source[], int length)
}
if (input_check != output_check) {
return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 338,
"Invalid check digit '%1$c' (position 9), expecting '%2$c'", input_check, output_check);
return ZEXT errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 338,
"Invalid check digit '%1$c' (position 9), expecting '%2$c'", input_check,
output_check);
}
}

View file

@ -1,7 +1,7 @@
/* code1.c - USS Code One */
/*
libzint - the open source barcode library
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -1046,9 +1046,9 @@ INTERNAL int codeone(struct zint_symbol *symbol, struct zint_seg segs[], const i
"Structured Append count '%d' out of range (2 to 128)", symbol->structapp.count);
}
if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 712,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 712,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
}
if (symbol->structapp.id[0]) {
return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 713, "Structured Append ID not available for Code One");
@ -1249,9 +1249,9 @@ INTERNAL int codeone(struct zint_symbol *symbol, struct zint_seg segs[], const i
}
if ((symbol->option_2 != 0) && (symbol->option_2 < size)) {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 518,
"Input too long for Version %1$c, requires %2$d codewords (maximum %3$d)",
'A' + symbol->option_2 - 1, data_length, c1_data_length[symbol->option_2 - 1]);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 518,
"Input too long for Version %1$c, requires %2$d codewords (maximum %3$d)",
'A' + symbol->option_2 - 1, data_length, c1_data_length[symbol->option_2 - 1]);
}
data_cw = c1_data_length[size - 1];

View file

@ -51,8 +51,8 @@ static int nve18_or_ean14(struct zint_symbol *symbol, unsigned char source[], co
int i;
if (length > data_len) {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 345, "Input length %1$d too long (maximum %2$d)", length,
data_len);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 345, "Input length %1$d too long (maximum %2$d)", length,
data_len);
}
if ((i = not_sane(NEON_F, source, length))) {
@ -260,8 +260,8 @@ INTERNAL int upu_s10(struct zint_symbol *symbol, unsigned char source[], int len
check_digit = 5;
}
if (have_check_digit && ctoi(have_check_digit) != check_digit) {
return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 838, "Invalid check digit '%1$c', expecting '%2$c'",
have_check_digit, itoc(check_digit));
return ZEXT errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 838, "Invalid check digit '%1$c', expecting '%2$c'",
have_check_digit, itoc(check_digit));
}
/* Add in (back) check digit */
local_source[12] = local_source[11];

View file

@ -245,6 +245,12 @@ INTERNAL void expand(struct zint_symbol *symbol, const char data[], const int le
omitted */
INTERNAL int errtxt(const int error_number, struct zint_symbol *symbol, const int err_id, const char *msg);
#if defined(__GNUC__) && !defined(__clang__)
#define ZEXT __extension__ /* Suppress gcc pedantic warnings including when using format "%<n>$" with `errtxtf()` */
#else
#define ZEXT
#endif
/* Set `symbol->errtxt` to "err_id: msg" with restricted subset of `printf()` formatting, returning `error_number`.
If `err_id` is -1, the "err_id: " prefix is omitted. Only the following specifiers are supported: "c", "d", "f",
"g" and "s", with no modifiers apart from "<n>$" numbering for l10n ("<n>" 1-9), in which case all specifiers must

View file

@ -1,7 +1,7 @@
/* composite.c - Handles GS1 Composite Symbols */
/*
libzint - the open source barcode library
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -1433,7 +1433,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l
}
if (error_number) {
errtxtf(0, symbol, -1, "%1$s%2$s", linear->errtxt, " (linear component)");
ZEXT errtxtf(0, symbol, -1, "%1$s%2$s", linear->errtxt, " (linear component)");
if (error_number >= ZINT_ERROR) {
ZBarcode_Delete(linear);
return error_number;

View file

@ -1531,7 +1531,9 @@ static int dm_encode(struct zint_symbol *symbol, const unsigned char source[], c
symbols_left = last_seg ? dm_codewords_remaining(symbol, tp, process_p) : 3;
if (debug_print) printf("\nsymbols_left %d, tp %d, process_p %d, last_seg %d, ", symbols_left, tp, process_p, last_seg);
if (debug_print) {
printf("\nsymbols_left %d, tp %d, process_p %d, last_seg %d, ", symbols_left, tp, process_p, last_seg);
}
if (current_mode == DM_C40 || current_mode == DM_TEXT) {
/* NOTE: changed to follow spec exactly here, only using Shift 1 padded triplets when 2 symbol chars remain.
@ -1694,9 +1696,9 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co
"Structured Append count '%d' out of range (2 to 16)", symbol->structapp.count);
}
if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 721,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 721,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
}
if (symbol->structapp.id[0]) {
int id, id_len, id1_err, id2_err;
@ -1718,19 +1720,19 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co
id2_err = id2 < 1 || id2 > 254;
if (id1_err || id2_err) {
if (id1_err && id2_err) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 724,
"Structured Append ID1 '%1$03d' and ID2 '%2$03d' out of range (001 to 254)"
" (ID \"%3$03d%4$03d\")",
id1, id2, id1, id2);
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 724,
"Structured Append ID1 '%1$03d' and ID2 '%2$03d' out of range (001 to 254)"
" (ID \"%3$03d%4$03d\")",
id1, id2, id1, id2);
}
if (id1_err) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 725,
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 725,
"Structured Append ID1 '%1$03d' out of range (001 to 254) (ID \"%2$03d%3$03d\")",
id1, id1, id2);
}
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 726,
"Structured Append ID2 '%1$03d' out of range (001 to 254) (ID \"%2$03d%3$03d\")",
id2, id1, id2);
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 726,
"Structured Append ID2 '%1$03d' out of range (001 to 254) (ID \"%2$03d%3$03d\")",
id2, id1, id2);
}
} else {
id1 = id2 = 1;
@ -1852,9 +1854,9 @@ static int dm_ecc200(struct zint_symbol *symbol, struct zint_seg segs[], const i
if (binlen > dm_matrixbytes[symbolsize]) {
if ((symbol->option_2 >= 1) && (symbol->option_2 <= DMSIZESCOUNT)) {
/* The symbol size was given by --ver (option_2) */
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 522,
"Input too long for Version %1$d, requires %2$d codewords (maximum %3$d)",
symbol->option_2, binlen, dm_matrixbytes[symbolsize]);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 522,
"Input too long for Version %1$d, requires %2$d codewords (maximum %3$d)",
symbol->option_2, binlen, dm_matrixbytes[symbolsize]);
}
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 523, "Input too long, requires %d codewords (maximum 1558)",
binlen);

View file

@ -1,7 +1,7 @@
/* dotcode.c - Handles DotCode */
/*
libzint - the open source barcode library
Copyright (C) 2017-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2017-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -1244,9 +1244,9 @@ INTERNAL int dotcode(struct zint_symbol *symbol, struct zint_seg segs[], const i
"Structured Append count '%d' out of range (2 to 35)", symbol->structapp.count);
}
if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 731,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 731,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
}
if (symbol->structapp.id[0]) {
return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 732, "Structured Append ID not available for DotCode");
@ -1337,20 +1337,21 @@ INTERNAL int dotcode(struct zint_symbol *symbol, struct zint_seg segs[], const i
if ((height > 200) || (width > 200)) {
if (height > 200 && width > 200) {
errtxtf(0, symbol, 526, "Symbol size '%1$dx%2$d' (WxH) is too large", width, height);
ZEXT errtxtf(0, symbol, 526, "Symbol size '%1$dx%2$d' (WxH) is too large", width, height);
} else {
errtxtf(0, symbol, 528, "Symbol %1$s '%2$d' is too large",
width > 200 ? "width" : "height", width > 200 ? width : height);
ZEXT errtxtf(0, symbol, 528, "Symbol %1$s '%2$d' is too large", width > 200 ? "width" : "height",
width > 200 ? width : height);
}
return ZINT_ERROR_INVALID_OPTION;
}
if ((height < 5) || (width < 5)) {
if (height < 5 && width < 5) { /* Won't happen as if width < 5, min height is 19 */
errtxtf(0, symbol, 527, "Symbol size '%1$dx%2$d' (WxH) is too small", width, height); /* Not reached */
ZEXT errtxtf(0, symbol, 527, "Symbol size '%1$dx%2$d' (WxH) is too small", width,
height); /* Not reached */
} else {
errtxtf(0, symbol, 529, "Symbol %1$s '%2$d' is too small",
width < 5 ? "width" : "height", width < 5 ? width : height);
ZEXT errtxtf(0, symbol, 529, "Symbol %1$s '%2$d' is too small", width < 5 ? "width" : "height",
width < 5 ? width : height);
}
return ZINT_ERROR_INVALID_OPTION;
}

View file

@ -1,7 +1,7 @@
/* emf.c - Support for Microsoft Enhanced Metafile Format */
/*
libzint - the open source barcode library
Copyright (C) 2016-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2016-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -701,8 +701,8 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) {
/* Send EMF data to file */
if (!fm_open(fmp, symbol, "wb")) {
return errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 640, "Could not open EMF output file (%1$d: %2$s)", fmp->err,
strerror(fmp->err));
return ZEXT errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 640, "Could not open EMF output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
}
fm_write(&emr_header, sizeof(emr_header_t), 1, fmp);
@ -820,14 +820,14 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) {
fm_write(&emr_eof, sizeof(emr_eof_t), 1, fmp);
if (fm_error(fmp)) {
errtxtf(0, symbol, 644, "Incomplete write of EMF output (%1$d: %2$s)", fmp->err, strerror(fmp->err));
ZEXT errtxtf(0, symbol, 644, "Incomplete write of EMF output (%1$d: %2$s)", fmp->err, strerror(fmp->err));
(void) fm_close(fmp, symbol);
return ZINT_ERROR_FILE_WRITE;
}
if (!fm_close(fmp, symbol)) {
return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 941, "Failure on closing EMF output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
return ZEXT errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 941, "Failure on closing EMF output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
}
return error_number;
}

View file

@ -1,7 +1,7 @@
/* gif.c - Handles output to gif file */
/*
libzint - the open source barcode library
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -276,8 +276,8 @@ INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
/* Open output file in binary mode */
if (!fm_open(State.fmp, symbol, "wb")) {
errtxtf(0, symbol, 611, "Could not open GIF output file (%1$d: %2$s)", State.fmp->err,
strerror(State.fmp->err));
ZEXT errtxtf(0, symbol, 611, "Could not open GIF output file (%1$d: %2$s)", State.fmp->err,
strerror(State.fmp->err));
free(State.pOut);
return ZINT_ERROR_FILE_ACCESS;
}
@ -453,15 +453,15 @@ INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
fm_putc(';', State.fmp);
if (fm_error(State.fmp)) {
errtxtf(0, symbol, 615, "Incomplete write of GIF output (%1$d: %2$s)", State.fmp->err,
strerror(State.fmp->err));
ZEXT errtxtf(0, symbol, 615, "Incomplete write of GIF output (%1$d: %2$s)", State.fmp->err,
strerror(State.fmp->err));
(void) fm_close(State.fmp, symbol);
return ZINT_ERROR_FILE_WRITE;
}
if (!fm_close(State.fmp, symbol)) {
return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 617, "Failure on closing GIF output file (%1$d: %2$s)",
State.fmp->err, strerror(State.fmp->err));
return ZEXT errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 617, "Failure on closing GIF output file (%1$d: %2$s)",
State.fmp->err, strerror(State.fmp->err));
}
return 0;

View file

@ -1,7 +1,7 @@
/* gridmtx.c - Grid Matrix */
/*
libzint - the open source barcode library
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -1073,9 +1073,9 @@ INTERNAL int gridmatrix(struct zint_symbol *symbol, struct zint_seg segs[], cons
"Structured Append count '%d' out of range (2 to 16)", symbol->structapp.count);
}
if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 537,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 537,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
}
if (symbol->structapp.id[0]) {
int id, id_len;
@ -1131,9 +1131,9 @@ INTERNAL int gridmatrix(struct zint_symbol *symbol, struct zint_seg segs[], cons
if (symbol->option_2 >= min_layers) {
layers = symbol->option_2;
} else {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 534,
"Input too long for Version %1$d, requires %2$d codewords (maximum %3$d)",
symbol->option_2, data_cw, gm_max_cw[symbol->option_2 - 1]);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 534,
"Input too long for Version %1$d, requires %2$d codewords (maximum %3$d)",
symbol->option_2, data_cw, gm_max_cw[symbol->option_2 - 1]);
}
}
@ -1189,9 +1189,9 @@ INTERNAL int gridmatrix(struct zint_symbol *symbol, struct zint_seg segs[], cons
}
if (data_cw > data_max) {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 532,
"Input too long for ECC level %1$d, requires %2$d codewords (maximum %3$d)",
ecc_level, data_cw, data_max);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 532,
"Input too long for ECC level %1$d, requires %2$d codewords (maximum %3$d)", ecc_level,
data_cw, data_max);
}
if (debug_print) {
printf("Layers: %d, ECC level: %d, Data Codewords: %d\n", layers, ecc_level, data_cw);

View file

@ -1,7 +1,7 @@
/* gs1.c - Verifies GS1 data */
/*
libzint - the open source barcode library
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -1771,7 +1771,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
} else if (err_no == 2 || err_no == 4) { /* 4 is backward-incompatible bad length */
errtxtf(0, symbol, 259, "Invalid data length for AI (%02d)", ai_value[i]);
} else {
errtxtf(0, symbol, 261, "AI (%1$02d) position %2$d: %3$s", ai_value[i], err_posn, err_msg);
ZEXT errtxtf(0, symbol, 261, "AI (%1$02d) position %2$d: %3$s", ai_value[i], err_posn, err_msg);
}
/* For backward compatibility only error on unknown AI or bad length */
if (err_no == 1 || err_no == 2) {

View file

@ -1,7 +1,7 @@
/* hanxin.c - Han Xin Code */
/*
libzint - the open source barcode library
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -1585,14 +1585,14 @@ INTERNAL int hanxin(struct zint_symbol *symbol, struct zint_seg segs[], const in
if ((symbol->option_2 != 0) && (symbol->option_2 < version)) {
free(binary);
if (ecc_level == 1) {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 542,
"Input too long for Version %1$d, requires %2$d codewords (maximum %3$d)",
symbol->option_2, codewords, hx_data_codewords[ecc_level - 1][symbol->option_2 - 1]);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 542,
"Input too long for Version %1$d, requires %2$d codewords (maximum %3$d)",
symbol->option_2, codewords, hx_data_codewords[ecc_level - 1][symbol->option_2 - 1]);
}
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 542,
"Input too long for Version %1$d, ECC %2$d, requires %3$d codewords (maximum %4$d)",
symbol->option_2, ecc_level, codewords,
hx_data_codewords[ecc_level - 1][symbol->option_2 - 1]);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 542,
"Input too long for Version %1$d, ECC %2$d, requires %3$d codewords (maximum %4$d)",
symbol->option_2, ecc_level, codewords,
hx_data_codewords[ecc_level - 1][symbol->option_2 - 1]);
}
/* If there is spare capacity, increase the level of ECC */

View file

@ -1,7 +1,7 @@
/* imail.c - Handles Intelligent Mail (aka OneCode) for USPS */
/*
libzint - the open source barcode library
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -313,7 +313,7 @@ INTERNAL int usps_imail(struct zint_symbol *symbol, unsigned char source[], int
/* Routing code first */
large_load_str_u64(&accum, (unsigned char *) zip, zip_len);
large_load_str_u64(&accum, (const unsigned char *) zip, zip_len);
/* add weight to routing code */
if (zip_len > 9) {

View file

@ -1,7 +1,7 @@
/* library.c - external functions of libzint */
/*
libzint - the open source barcode library
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -336,7 +336,7 @@ static int dump_plot(struct zint_symbol *symbol) {
}
if (ferror(f)) {
errtxtf(0, symbol, 795, "Incomplete write to output (%1$d: %2$s)", errno, strerror(errno));
ZEXT errtxtf(0, symbol, 795, "Incomplete write to output (%1$d: %2$s)", errno, strerror(errno));
if (!output_to_stdout) {
(void) fclose(f);
}
@ -345,13 +345,13 @@ static int dump_plot(struct zint_symbol *symbol) {
if (output_to_stdout) {
if (fflush(f) != 0) {
return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 796, "Incomplete flush to output (%1$d: %2$s)",
errno, strerror(errno));
return ZEXT errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 796, "Incomplete flush to output (%1$d: %2$s)",
errno, strerror(errno));
}
} else {
if (fclose(f) != 0) {
return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 792, "Failure on closing output file (%1$d: %2$s)",
errno, strerror(errno));
return ZEXT errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 792, "Failure on closing output file (%1$d: %2$s)",
errno, strerror(errno));
}
}
@ -737,14 +737,16 @@ static int esc_base(struct zint_symbol *symbol, const unsigned char *input_strin
}
if (val == -1) {
return errtxtf(-1, symbol, 238, "Invalid character in escape sequence '%2$.*1$s' in input (%3$s only)",
base == 'x' ? 4 : 5, input_string + in_posn - 2,
base == 'd' ? "decimal" : base == 'o' ? "octal" : "hexadecimal");
return ZEXT errtxtf(-1, symbol, 238,
"Invalid character in escape sequence '%2$.*1$s' in input (%3$s only)",
base == 'x' ? 4 : 5, input_string + in_posn - 2,
base == 'd' ? "decimal" : base == 'o' ? "octal" : "hexadecimal");
}
if (val > 255) {
assert(base != 'x');
return errtxtf(-1, symbol, 237, "Value of escape sequence '%1$.5s' in input out of range (000 to %2$s)",
input_string + in_posn - 2, base == 'd' ? "255" : "377");
return ZEXT errtxtf(-1, symbol, 237,
"Value of escape sequence '%1$.5s' in input out of range (000 to %2$s)",
input_string + in_posn - 2, base == 'd' ? "255" : "377");
}
return val;
@ -1094,8 +1096,8 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[
/* Reconcile symbol ECI and first segment ECI if both set */
if (symbol->eci != local_segs[0].eci) {
if (symbol->eci && local_segs[0].eci) {
errtxtf(0, symbol, 774, "Symbol ECI '%1$d' must match segment zero ECI '%2$d'",
symbol->eci, local_segs[0].eci);
ZEXT errtxtf(0, symbol, 774, "Symbol ECI '%1$d' must match segment zero ECI '%2$d'",
symbol->eci, local_segs[0].eci);
return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, -1, NULL);
}
if (symbol->eci) {
@ -1192,7 +1194,7 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[
return error_tag(ZINT_ERROR_INVALID_DATA, symbol, 799, "Invalid primary string");
}
ustrcpy(primary, symbol->primary);
error_number = escape_char_process(symbol, (unsigned char *) primary, &primary_len,
error_number = escape_char_process(symbol, (const unsigned char *) primary, &primary_len,
(unsigned char *) symbol->primary);
if (error_number != 0) { /* Only returns errors, not warnings */
return error_tag(error_number, symbol, -1, NULL);
@ -1486,14 +1488,14 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, const char *filename) {
file = fopen(filename, "rb");
#endif
if (!file) {
errtxtf(0, symbol, 229, "Unable to read input file (%1$d: %2$s)", errno, strerror(errno));
ZEXT errtxtf(0, symbol, 229, "Unable to read input file (%1$d: %2$s)", errno, strerror(errno));
return error_tag(ZINT_ERROR_INVALID_DATA, symbol, -1, NULL);
}
file_opened = 1;
/* Get file length */
if (fseek(file, 0, SEEK_END) != 0) {
errtxtf(0, symbol, 797, "Unable to seek input file (%1$d: %2$s)", errno, strerror(errno));
ZEXT errtxtf(0, symbol, 797, "Unable to seek input file (%1$d: %2$s)", errno, strerror(errno));
(void) fclose(file);
return error_tag(ZINT_ERROR_INVALID_DATA, symbol, -1, NULL);
}
@ -1511,7 +1513,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, const char *filename) {
}
if (fseek(file, 0, SEEK_SET) != 0) {
errtxtf(0, symbol, 793, "Unable to seek input file (%1$d: %2$s)", errno, strerror(errno));
ZEXT errtxtf(0, symbol, 793, "Unable to seek input file (%1$d: %2$s)", errno, strerror(errno));
(void) fclose(file);
return error_tag(ZINT_ERROR_INVALID_DATA, symbol, -1, NULL);
}
@ -1531,7 +1533,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, const char *filename) {
do {
n = fread(buffer + nRead, 1, fileLen - nRead, file);
if (ferror(file)) {
errtxtf(0, symbol, 241, "Input file read error (%1$d: %2$s)", errno, strerror(errno));
ZEXT errtxtf(0, symbol, 241, "Input file read error (%1$d: %2$s)", errno, strerror(errno));
free(buffer);
if (file_opened) {
(void) fclose(file);
@ -1543,7 +1545,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, const char *filename) {
if (file_opened) {
if (fclose(file) != 0) {
errtxtf(0, symbol, 794, "Failure on closing input file (%1$d: %2$s)", errno, strerror(errno));
ZEXT errtxtf(0, symbol, 794, "Failure on closing input file (%1$d: %2$s)", errno, strerror(errno));
free(buffer);
return error_tag(ZINT_ERROR_INVALID_DATA, symbol, -1, NULL);
}

View file

@ -1,7 +1,7 @@
/* mailmark.c - Royal Mail 4-state and 2D Mailmark barcodes */
/*
libzint - the open source barcode library
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -220,7 +220,7 @@ INTERNAL int mailmark_4s(struct zint_symbol *symbol, unsigned char source[], int
printf("Producing 4-state Mailmark (%d): %s<end>\n", length, local_source);
}
if ((i = not_sane(RUBIDIUM_F, (unsigned char *) local_source, length))) {
if ((i = not_sane(RUBIDIUM_F, (const unsigned char *) local_source, length))) {
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 581,
"Invalid character at position %d in input (alphanumerics and space only)", i);
}

View file

@ -1,7 +1,7 @@
/* maxicode.c - Handles MaxiCode */
/*
libzint - the open source barcode library
Copyright (C) 2010-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2010-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -220,8 +220,8 @@ static int mx_enc_eci(const int eci, unsigned char codewords[144], int ci) {
/* Get the shortest encoded length for the Code Set (state) and plot the path */
static int mx_get_best_length(const int state, const int i, const unsigned char ch, const int digits, const int num_a,
const int best_lengths[16][MX_STATES], const char best_origins[16][MX_STATES],
unsigned char *const path_op, char *const prior_code_set) {
int best_lengths[16][MX_STATES], char best_origins[16][MX_STATES], unsigned char *const path_op,
char *const prior_code_set) {
const char *const latch_length_s = mx_latch_len[state];
int min_len = 999999;
int j;
@ -674,9 +674,9 @@ INTERNAL int maxicode(struct zint_symbol *symbol, struct zint_seg segs[], const
"Structured Append count '%d' out of range (2 to 8)", symbol->structapp.count);
}
if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 559,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 559,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
}
if (symbol->structapp.id[0]) {
return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 549, "Structured Append ID not available for MaxiCode");

View file

@ -281,8 +281,8 @@ INTERNAL int pzn(struct zint_symbol *symbol, unsigned char source[], int length)
const int pzn7 = symbol->option_2 == 1;
if (length > 8 - pzn7) {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 325, "Input length %1$d too long (maximum %2$d)", length,
8 - pzn7);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 325, "Input length %1$d too long (maximum %2$d)", length,
8 - pzn7);
}
if (length == 8 - pzn7) {
have_check_digit = source[7 - pzn7];
@ -314,8 +314,8 @@ INTERNAL int pzn(struct zint_symbol *symbol, unsigned char source[], int length)
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 327, "Invalid PZN, check digit is '10'");
}
if (have_check_digit && ctoi(have_check_digit) != check_digit) {
return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 890, "Invalid check digit '%1$c', expecting '%2$c'",
have_check_digit, itoc(check_digit));
return ZEXT errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 890, "Invalid check digit '%1$c', expecting '%2$c'",
have_check_digit, itoc(check_digit));
}
localstr[8 - pzn7] = itoc(check_digit);

View file

@ -1,7 +1,7 @@
/* output.c - Common routines for raster/vector
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -56,8 +56,8 @@ static int out_check_colour(struct zint_symbol *symbol, const char *colour, cons
name);
}
if (not_sane(OUT_SSET_F, (unsigned char *) colour, len)) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 881,
"Malformed %1$s RGB colour '%2$s' (hexadecimal only)", name, colour);
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 881,
"Malformed %1$s RGB colour '%2$s' (hexadecimal only)", name, colour);
}
return 0;

View file

@ -1,7 +1,7 @@
/* pcx.c - Handles output to ZSoft PCX file */
/*
libzint - the open source barcode library
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -86,8 +86,8 @@ INTERNAL int pcx_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix
/* Open output file in binary mode */
if (!fm_open(fmp, symbol, "wb")) {
return errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 621, "Could not open PCX output file (%1$d: %2$s)", fmp->err,
strerror(fmp->err));
return ZEXT errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 621, "Could not open PCX output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
}
fm_write(&header, sizeof(pcx_header_t), 1, fmp);
@ -151,14 +151,14 @@ INTERNAL int pcx_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix
}
if (fm_error(fmp)) {
errtxtf(0, symbol, 622, "Incomplete write of PCX output (%1$d: %2$s)", fmp->err, strerror(fmp->err));
ZEXT errtxtf(0, symbol, 622, "Incomplete write of PCX output (%1$d: %2$s)", fmp->err, strerror(fmp->err));
(void) fm_close(fmp, symbol);
return ZINT_ERROR_FILE_WRITE;
}
if (!fm_close(fmp, symbol)) {
return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 624, "Failure on closing PCX output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
return ZEXT errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 624, "Failure on closing PCX output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
}
return 0;

View file

@ -1,7 +1,7 @@
/* pdf417.c - Handles PDF417 stacked symbology */
/*
libzint - the open source barcode library
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2025 Robin Stuart <rstuart114@gmail.com>
Portions Copyright (C) 2004 Grandzebu
Bug Fixes thanks to KL Chin <klchin@users.sourceforge.net>
@ -1130,9 +1130,9 @@ static int pdf_initial_segs(struct zint_symbol *symbol, struct zint_seg segs[],
"Structured Append count '%d' out of range (2 to 99999)", symbol->structapp.count);
}
if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 741,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 741,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
}
if (symbol->structapp.id[0]) {
int id_len;
@ -1152,9 +1152,9 @@ static int pdf_initial_segs(struct zint_symbol *symbol, struct zint_seg segs[],
"Invalid Structured Append ID (digits only)");
}
if (ids[id_cnt] > 899) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 744,
"Structured Append ID triplet %1$d value '%2$03d' out of range (000 to 899)",
id_cnt + 1, ids[id_cnt]);
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 744,
"Structured Append ID triplet %1$d value '%2$03d' out of range (000 to 899)",
id_cnt + 1, ids[id_cnt]);
}
}
}
@ -1280,8 +1280,8 @@ static int pdf_enc(struct zint_symbol *symbol, struct zint_seg segs[], const int
}
}
if (rows != symbol->option_3) {
error_number = errtxtf(ZINT_WARN_INVALID_OPTION, symbol, 746,
"Number of rows increased from %1$d to %2$d", symbol->option_3, rows);
error_number = ZEXT errtxtf(ZINT_WARN_INVALID_OPTION, symbol, 746,
"Number of rows increased from %1$d to %2$d", symbol->option_3, rows);
}
} else { /* Rows automatic, cols automatic or given */
if (cols < 1) { /* Cols automatic */
@ -1302,8 +1302,8 @@ static int pdf_enc(struct zint_symbol *symbol, struct zint_seg segs[], const int
"Input too long, requires too many codewords (maximum 928)");
}
if (symbol->option_2 && cols != symbol->option_2) { /* Note previously did not warn if cols auto-upped */
error_number = errtxtf(ZINT_WARN_INVALID_OPTION, symbol, 748,
"Number of columns increased from %1$d to %2$d", symbol->option_2, cols);
error_number = ZEXT errtxtf(ZINT_WARN_INVALID_OPTION, symbol, 748,
"Number of columns increased from %1$d to %2$d", symbol->option_2, cols);
}
}
}
@ -1547,9 +1547,9 @@ INTERNAL int micropdf417(struct zint_symbol *symbol, struct zint_seg segs[], con
if (symbol->option_2 >= 1 && mclength + structapp_cp > col_max_codewords[symbol->option_2]) {
/* The user specified the column but the data doesn't fit - go to automatic */
if (symbol->warn_level == WARN_FAIL_ALL) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 469,
"Input too long for number of columns '%1$d', requires %2$d codewords (maximum %3$d)",
symbol->option_2, mclength + structapp_cp, col_max_codewords[symbol->option_2]);
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 469,
"Input too long for number of columns '%1$d', requires %2$d codewords (maximum %3$d)",
symbol->option_2, mclength + structapp_cp, col_max_codewords[symbol->option_2]);
}
error_number = errtxtf(ZINT_WARN_INVALID_OPTION, symbol, 470,
"Input too long for number of columns '%d', ignoring", symbol->option_2);

View file

@ -1,7 +1,7 @@
/* png.c - Handles output to PNG file */
/*
libzint - the open source barcode library
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -212,8 +212,8 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix
/* Open output file in binary mode */
if (!fm_open(fmp, symbol, "wb")) {
return errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 632, "Could not open PNG output file (%1$d: %2$s)", fmp->err,
strerror(fmp->err));
return ZEXT errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 632, "Could not open PNG output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
}
/* Set up error handling routine as proc() above */
@ -312,14 +312,14 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix
png_destroy_write_struct(&png_ptr, &info_ptr);
if (fm_error(fmp)) {
errtxtf(0, symbol, 638, "Incomplete write of PNG output (%1$d: %2$s)", fmp->err, strerror(fmp->err));
ZEXT errtxtf(0, symbol, 638, "Incomplete write of PNG output (%1$d: %2$s)", fmp->err, strerror(fmp->err));
(void) fm_close(fmp, symbol);
return ZINT_ERROR_FILE_WRITE;
}
if (!fm_close(fmp, symbol)) {
return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 960, "Failure on closing PNG output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
return ZEXT errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 960, "Failure on closing PNG output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
}
return 0;

View file

@ -1,7 +1,7 @@
/* ps.c - Post Script output */
/*
libzint - the open source barcode library
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -198,8 +198,8 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) {
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 646, "Vector header NULL");
}
if (!fm_open(fmp, symbol, "w")) {
return errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 645, "Could not open EPS output file (%1$d: %2$s)", fmp->err,
strerror(fmp->err));
return ZEXT errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 645, "Could not open EPS output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
}
if (is_rgb) {
@ -507,14 +507,14 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) {
}
if (fm_error(fmp)) {
errtxtf(0, symbol, 647, "Incomplete write of EPS output (%1$d: %2$s)", fmp->err, strerror(fmp->err));
ZEXT errtxtf(0, symbol, 647, "Incomplete write of EPS output (%1$d: %2$s)", fmp->err, strerror(fmp->err));
(void) fm_close(fmp, symbol);
return ZINT_ERROR_FILE_WRITE;
}
if (!fm_close(fmp, symbol)) {
return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 649, "Failure on closing EPS output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
return ZEXT errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 649, "Failure on closing EPS output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
}
return 0;

View file

@ -1,7 +1,7 @@
/* qr.c Handles QR Code, Micro QR Code, UPNQR and rMQR */
/* qr.c Handles QR Code, Micro QR Code, UPNQR and rMQR */
/*
libzint - the open source barcode library
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -1672,9 +1672,9 @@ INTERNAL int qrcode(struct zint_symbol *symbol, struct zint_seg segs[], const in
"Structured Append count '%d' out of range (2 to 16)", symbol->structapp.count);
}
if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 751,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 751,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
}
if (symbol->structapp.id[0]) {
int id, id_len;
@ -1726,12 +1726,13 @@ INTERNAL int qrcode(struct zint_symbol *symbol, struct zint_seg segs[], const in
if (est_binlen > (8 * max_cw)) {
if (ecc_level == QR_LEVEL_L) {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 567, "Input too long, requires %1$d codewords (maximum %2$d)",
(est_binlen + 7) / 8, max_cw);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 567,
"Input too long, requires %1$d codewords (maximum %2$d)", (est_binlen + 7) / 8,
max_cw);
}
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 561,
"Input too long for ECC level %1$c, requires %2$d codewords (maximum %3$d)",
qr_ecc_level_names[ecc_level], (est_binlen + 7) / 8, max_cw);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 561,
"Input too long for ECC level %1$c, requires %2$d codewords (maximum %3$d)",
qr_ecc_level_names[ecc_level], (est_binlen + 7) / 8, max_cw);
}
autosize = 40;
@ -1796,10 +1797,10 @@ INTERNAL int qrcode(struct zint_symbol *symbol, struct zint_seg segs[], const in
}
if (symbol->option_2 < version) {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 569,
"Input too long for Version %1$d-%2$c, requires %3$d codewords (maximum %4$d)",
symbol->option_2, qr_ecc_level_names[ecc_level], (est_binlen + 7) / 8,
qr_data_codewords[ecc_level][symbol->option_2 - 1]);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 569,
"Input too long for Version %1$d-%2$c, requires %3$d codewords (maximum %4$d)",
symbol->option_2, qr_ecc_level_names[ecc_level], (est_binlen + 7) / 8,
qr_data_codewords[ecc_level][symbol->option_2 - 1]);
}
}
@ -2269,9 +2270,9 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len
/* Eliminate possible versions depending on binary length and error correction level specified */
if (binary_count[3] > microqr_data[ecc_level][3][0]) {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 565,
"Input too long for Version M4-%1$c, requires %2$d codewords (maximum %3$d)",
qr_ecc_level_names[ecc_level], (binary_count[3] + 7) / 8, microqr_data[ecc_level][3][1]);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 565,
"Input too long for Version M4-%1$c, requires %2$d codewords (maximum %3$d)",
qr_ecc_level_names[ecc_level], (binary_count[3] + 7) / 8, microqr_data[ecc_level][3][1]);
}
for (i = 0; i < 3; i++) {
if (binary_count[i] > microqr_data[ecc_level][i][0]) {
@ -2303,10 +2304,10 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len
if (symbol->option_2 - 1 >= version) {
version = symbol->option_2 - 1;
} else {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 570,
"Input too long for Version M%1$d-%2$c, requires %3$d codewords (maximum %4$d)",
symbol->option_2, qr_ecc_level_names[ecc_level], (binary_count[version] + 7) / 8,
microqr_data[ecc_level][symbol->option_2 - 1][1]);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 570,
"Input too long for Version M%1$d-%2$c, requires %3$d codewords (maximum %4$d)",
symbol->option_2, qr_ecc_level_names[ecc_level], (binary_count[version] + 7) / 8,
microqr_data[ecc_level][symbol->option_2 - 1][1]);
}
}
@ -2658,9 +2659,9 @@ INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int
max_cw = rmqr_data_codewords[ecc_level >> 1][31];
if (est_binlen > (8 * max_cw)) {
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 578,
"Input too long for ECC level %1$c, requires %2$d codewords (maximum %3$d)",
qr_ecc_level_names[ecc_level], (est_binlen + 7) / 8, max_cw);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 578,
"Input too long for ECC level %1$c, requires %2$d codewords (maximum %3$d)",
qr_ecc_level_names[ecc_level], (est_binlen + 7) / 8, max_cw);
}
version = 31; /* Set default to keep compiler happy */
@ -2719,10 +2720,10 @@ INTERNAL int rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const int
if (est_binlen > (target_codewords * 8)) {
/* User has selected a symbol too small for the data */
assert(symbol->option_2 > 0);
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 560,
"Input too long for Version %1$d %2$s-%3$c, requires %4$d codewords (maximum %5$d)",
symbol->option_2, rmqr_version_names[symbol->option_2 - 1], qr_ecc_level_names[ecc_level],
(est_binlen + 7) / 8, target_codewords);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 560,
"Input too long for Version %1$d %2$s-%3$c, requires %4$d codewords (maximum %5$d)",
symbol->option_2, rmqr_version_names[symbol->option_2 - 1], qr_ecc_level_names[ecc_level],
(est_binlen + 7) / 8, target_codewords);
}
if (debug_print) {

View file

@ -1,7 +1,7 @@
/* rss.c - GS1 DataBar (formerly Reduced Space Symbology) */
/*
libzint - the open source barcode library
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -303,8 +303,8 @@ INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int
if (length == 14) { /* Verify check digit */
if (gs1_check_digit(source, 13) != source[13]) {
return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 388, "Invalid check digit '%1$c', expecting '%2$c'",
source[13], gs1_check_digit(source, 13));
return ZEXT errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 388, "Invalid check digit '%1$c', expecting '%2$c'",
source[13], gs1_check_digit(source, 13));
}
length--; /* Ignore */
}
@ -638,8 +638,8 @@ INTERNAL int dbar_ltd_cc(struct zint_symbol *symbol, unsigned char source[], int
if (length == 14) { /* Verify check digit */
if (gs1_check_digit(source, 13) != source[13]) {
return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 389, "Invalid check digit '%1$c', expecting '%2$c'",
source[13], gs1_check_digit(source, 13));
return ZEXT errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 389, "Invalid check digit '%1$c', expecting '%2$c'",
source[13], gs1_check_digit(source, 13));
}
length--; /* Ignore */
}

View file

@ -1,7 +1,7 @@
/* svg.c - Scalable Vector Graphics */
/*
libzint - the open source barcode library
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -175,8 +175,8 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) {
return errtxt(ZINT_ERROR_INVALID_DATA, symbol, 681, "Vector header NULL");
}
if (!fm_open(fmp, symbol, "w")) {
return errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 680, "Could not open SVG output file (%1$d: %2$s)", fmp->err,
strerror(fmp->err));
return ZEXT errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 680, "Could not open SVG output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
}
/* Start writing the header */
@ -344,14 +344,14 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) {
"</svg>\n", fmp);
if (fm_error(fmp)) {
errtxtf(0, symbol, 682, "Incomplete write to SVG output (%1$d: %2$s)", fmp->err, strerror(fmp->err));
ZEXT errtxtf(0, symbol, 682, "Incomplete write to SVG output (%1$d: %2$s)", fmp->err, strerror(fmp->err));
(void) fm_close(fmp, symbol);
return ZINT_ERROR_FILE_WRITE;
}
if (!fm_close(fmp, symbol)) {
return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 684, "Failure on closing SVG output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
return ZEXT errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 684, "Failure on closing SVG output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
}
return 0;

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -37,12 +37,12 @@ static void test_large(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -93,7 +93,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -115,8 +115,8 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
char *expected;
const char *data;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -160,7 +160,7 @@ static void test_hrt(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -177,11 +177,11 @@ static void test_input(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -212,7 +212,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -234,13 +234,13 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* BARCODE_ITF14 examples verified manually against GS1 General Specifications 21.0.1 */
static const struct item data[] = {
@ -351,7 +351,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -411,12 +411,12 @@ static void test_perf(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_C25INTER, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 1, 819, "C25INTER 90" },
@ -457,7 +457,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, DATA_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -36,7 +36,7 @@ static void test_large(const testCtx *const p_ctx) {
struct item {
int symbology;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
@ -81,7 +81,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -100,9 +100,9 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -123,7 +123,7 @@ static void test_hrt(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -139,11 +139,11 @@ static void test_input(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -189,7 +189,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -226,13 +226,13 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_AUSPOST, "96184209", 0, 3, 73, "AusPost Tech Specs Diagram 1; verified manually against TEC-IT",
@ -332,7 +332,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -374,7 +374,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int length;
int ret;
};
@ -402,7 +402,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
ZBarcode_Delete(symbol);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -41,7 +41,7 @@ static void test_large(const testCtx *const p_ctx) {
int option_2;
int output_options;
struct zint_structapp structapp;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
@ -202,7 +202,7 @@ static void test_large(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
@ -248,7 +248,7 @@ static void test_options(const testCtx *const p_ctx) {
int option_1;
int option_2;
struct zint_structapp structapp;
char *data;
const char *data;
int ret;
int expected_rows;
@ -304,7 +304,7 @@ static void test_options(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -329,15 +329,15 @@ static void test_encode(const testCtx *const p_ctx) {
int output_options;
int option_1;
int option_2;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_AZTEC, UNICODE_MODE, -1, -1, -1, 1, "123456789012", -1, 0, 15, 15, 1, "ISO/IEC 24778:2008 Figure 1 (left)",
@ -2622,7 +2622,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, -1, data[i].output_options, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -2688,8 +2688,8 @@ static void test_encode_segs(const testCtx *const p_ctx) {
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, -1, -1, 1, { { TU(""), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 15, 15, 1, "ISO/IEC 24778:2008 16.5 example",
@ -2968,10 +2968,10 @@ static void test_fuzz(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
const char *data;
int length;
int ret;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -3727,7 +3727,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d symbol->errtxt %s != %s\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -3766,12 +3766,12 @@ static void test_perf(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_AZTEC, -1, -1, -1,
@ -3837,7 +3837,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2022-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2022-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -38,13 +38,13 @@ static void test_input(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -91,7 +91,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_BC412, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -126,14 +126,14 @@ static void test_encode(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, -1, -1, "AQ45670", 0, 1, 102, 1, "SEMI T1-95 Figure 2, same",
@ -164,7 +164,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_BC412, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2021-2022 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2021-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -175,12 +175,12 @@ static int big5_utf8(struct zint_symbol *symbol, const unsigned char source[], i
static void test_big5_utf8(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
int ret_length;
unsigned int expected_b5data[20];
char *comment;
const char *comment;
};
/*
_ U+FF3F fullwidth low line, not in ISO/Win, in Big5 0xA1C4, UTF-8 EFBCBF
@ -207,7 +207,7 @@ static void test_big5_utf8(const testCtx *const p_ctx) {
length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
ret_length = length;
ret = big5_utf8(&symbol, (unsigned char *) data[i].data, &ret_length, b5data);
ret = big5_utf8(&symbol, TCU(data[i].data), &ret_length, b5data);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol.errtxt);
if (ret == 0) {
int j;

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -32,7 +32,7 @@
#include "testcommon.h"
#include <sys/stat.h>
INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf);
INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, const unsigned char *pixelbuf);
static void test_pixel_plot(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
@ -40,7 +40,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
struct item {
int width;
int height;
char *pattern;
const char *pattern;
int repeat;
int ret;
};
@ -61,7 +61,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
int i, ret;
struct zint_symbol *symbol;
char *bmp = "out.bmp";
const char *bmp = "out.bmp";
char data_buf[8 * 2 + 1];
@ -99,7 +99,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
symbol->bitmap = (unsigned char *) data_buf;
ret = bmp_pixel_plot(symbol, (unsigned char *) data_buf);
ret = bmp_pixel_plot(symbol, TCU(data_buf));
assert_equal(ret, data[i].ret, "i:%d bmp_pixel_plot ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -135,10 +135,10 @@ static void test_print(const testCtx *const p_ctx) {
int whitespace_height;
int option_1;
int option_2;
char *fgcolour;
char *bgcolour;
char *data;
char *expected_file;
const char *fgcolour;
const char *bgcolour;
const char *data;
const char *expected_file;
};
static const struct item data[] = {
/* 0*/ { BARCODE_PDF417, -1, -1, 5, -1, -1, -1, "147AD0", "FC9630", "123", "pdf417_fg_bg.bmp" },
@ -195,7 +195,7 @@ static void test_print(const testCtx *const p_ctx) {
strcpy(symbol->bgcolour, data[i].bgcolour);
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
strcpy(symbol->outfile, bmp);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -36,10 +36,10 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int option_2;
char *data;
const char *data;
int length;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -80,7 +80,7 @@ static void test_hrt(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CHANNEL, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -96,11 +96,11 @@ static void test_input(const testCtx *const p_ctx) {
struct item {
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -174,7 +174,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CHANNEL, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -197,13 +197,13 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { -1, "1234", 0, 1, 27, "ANSI/AIM BC12-1998 Figure 1",
@ -436,7 +436,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CHANNEL, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -476,7 +476,7 @@ static void test_encode(const testCtx *const p_ctx) {
static void test_generate(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
};
static const struct item data[] = { { "576688" }, { "7742862" } };
const int data_size = ARRAY_SIZE(data);
@ -493,7 +493,7 @@ static void test_generate(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CHANNEL, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, 0);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
ZBarcode_Delete(symbol);

View file

@ -39,7 +39,7 @@ static void test_large(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
@ -72,7 +72,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -92,9 +92,9 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -120,7 +120,7 @@ static void test_hrt(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -136,7 +136,7 @@ static void test_input(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
@ -177,7 +177,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d symbol->errtxt %s != %s\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -213,13 +213,13 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODABAR, -1, "A37859B", 0, 1, 72, "BS EN 798:1995 Figure 1",
@ -260,7 +260,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {

View file

@ -37,12 +37,12 @@ static void test_large(const testCtx *const p_ctx) {
struct item {
int option_1;
int option_2;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/*
é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII
@ -106,7 +106,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODABLOCKF, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -129,12 +129,12 @@ static void test_options(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
char *comment;
const char *expected_errtxt;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -178,7 +178,7 @@ static void test_options(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODABLOCKF, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
@ -201,12 +201,12 @@ static void test_reader_init(const testCtx *const p_ctx) {
int symbology;
int input_mode;
int output_options;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODABLOCKF, UNICODE_MODE, READER_INIT, "1234", 0, 2, 101, "67 64 40 60 63 0C 22 2B 6A 67 64 0B 63 64 3A 1C 29 6A", "CodeB FNC3 CodeC 12 34 / CodeB Pads" },
@ -232,7 +232,7 @@ static void test_reader_init(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -262,14 +262,14 @@ static void test_input(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
/*
NUL U+0000, CodeA-only
@ -365,7 +365,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -420,14 +420,14 @@ static void test_encode(const testCtx *const p_ctx) {
int symbology;
int option_1;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODABLOCKF, 1, -1, "AIM", 0, 1, 68, 1, "Same as CODE128 (not supported by BWIPP or ZXing-C++)",
@ -539,7 +539,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -597,11 +597,11 @@ static void test_fuzz(const testCtx *const p_ctx) {
struct item {
int option_1;
int option_2;
char *data;
const char *data;
int length;
int ret;
int bwipp_cmp;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { -1, -1, "\034\034I", 3, 0, 1, "" },
@ -637,7 +637,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODABLOCKF, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {

View file

@ -37,12 +37,12 @@ static void test_large(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -89,7 +89,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -111,10 +111,10 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int length;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -164,7 +164,7 @@ static void test_hrt(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -182,12 +182,12 @@ static void test_input(const testCtx *const p_ctx) {
int symbology;
int input_mode;
int option_2;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -260,7 +260,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -282,14 +282,14 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODE39, -1, "1A", -1, 0, 1, 51, "ISO/IEC 16388:2007 Figure 1",
@ -417,7 +417,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -477,12 +477,12 @@ static void test_perf(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODE39, -1, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+", 0, 1, 1130, "CODE39 85" },
@ -525,7 +525,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, DATA_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -38,12 +38,12 @@ static void test_large(const testCtx *const p_ctx) {
int eci;
int option_2;
struct zint_structapp structapp;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* Reference AIM USS Code One Table 2 */
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
@ -217,7 +217,7 @@ static void test_large(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -241,7 +241,7 @@ static void test_input(const testCtx *const p_ctx) {
int eci;
int option_2;
struct zint_structapp structapp;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
@ -307,7 +307,7 @@ static void test_input(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -330,15 +330,15 @@ static void test_encode(const testCtx *const p_ctx) {
int eci;
int option_2;
struct zint_structapp structapp;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* Figure examples AIM USS Code One (USSCO) Revision March 3, 2000 */
static const struct item data[] = {
@ -2910,7 +2910,7 @@ static void test_encode(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -2972,8 +2972,8 @@ static void test_encode_segs(const testCtx *const p_ctx) {
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* Figure examples AIM USS Code One (USSCO) Revision March 3, 2000 */
static const struct item data[] = {
@ -3363,11 +3363,11 @@ static void test_fuzz(const testCtx *const p_ctx) {
struct item {
int option_2;
char *data;
const char *data;
int length;
int ret;
int bwipp_cmp;
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -3398,7 +3398,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODEONE, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {

View file

@ -39,12 +39,12 @@ static void test_large(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -71,7 +71,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -93,10 +93,10 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int length;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -120,7 +120,7 @@ static void test_hrt(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -138,12 +138,12 @@ static void test_input(const testCtx *const p_ctx) {
int symbology;
int input_mode;
int option_2;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -172,7 +172,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -194,14 +194,14 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODE11, -1, "123-45", -1, 0, 1, 78, "2 check digits (52); verified manually against TEC-IT",
@ -245,7 +245,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -305,12 +305,12 @@ static void test_perf(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODE11, -1, "1234567890-1234567890-1234567890-1234567890-1234567890-1234567890-1234567890-1234567890-1234567890-1234567890-1234567890-", 0, 1, 966, "CODE11 121" },
@ -349,7 +349,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, DATA_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -40,11 +40,11 @@ static void test_large(const testCtx *const p_ctx) {
int symbology;
int input_mode;
int output_options;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/*
é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII
@ -126,7 +126,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, data[i].output_options, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -176,10 +176,10 @@ static void test_hrt(const testCtx *const p_ctx) {
int symbology;
int input_mode;
int option_2;
char *data;
const char *data;
int length;
char *expected;
const char *expected;
};
/*
é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII
@ -256,7 +256,7 @@ static void test_hrt(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -305,12 +305,12 @@ static void test_reader_init(const testCtx *const p_ctx) {
int symbology;
int input_mode;
int output_options;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, READER_INIT, "A", 0, 1, 57, "(5) 104 96 33 60 106", "StartB FNC3 A" },
@ -347,7 +347,7 @@ static void test_reader_init(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -388,13 +388,13 @@ static void test_input(const testCtx *const p_ctx) {
struct item {
int input_mode;
char *data;
const char *data;
int length;
int ret;
int expected_width;
int bwipp_cmp;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
/*
NUL U+0000, CodeA-only
@ -559,7 +559,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODE128, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
if (p_ctx->generate) {
printf(" /*%3d*/ { %s, \"%s\", %d, %s, %d, %d, \"%s\", \"%s\" },\n",
@ -614,12 +614,12 @@ static void test_gs1_128_input(const testCtx *const p_ctx) {
struct item {
int input_mode;
char *data;
const char *data;
int ret;
int expected_width;
int bwipp_cmp;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { GS1_MODE, "[90]1[90]1", 0, 123, 0, "(11) 105 102 90 100 17 102 25 99 1 56 106", "StartC FNC1 9 0 1 FNC1 9 0 1; BWIPP different encodation (same width)" },
@ -680,7 +680,7 @@ static void test_gs1_128_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_GS1_128, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
if (p_ctx->generate) {
printf(" /*%3d*/ { %s, \"%s\", %s, %d, %d, \"%s\", \"%s\" },\n",
@ -739,12 +739,12 @@ static void test_hibc_input(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int ret;
int expected_width;
int bwipp_cmp;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { ",", ZINT_ERROR_INVALID_DATA, -1, 0, "Error 203: Invalid character at position 1 in input (alphanumerics, space and \"-.$/+%\" only)", "" },
@ -782,7 +782,7 @@ static void test_hibc_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_HIBC_128, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -835,11 +835,11 @@ static void test_nve18_input(const testCtx *const p_ctx) {
struct item {
int input_mode;
char *data;
const char *data;
int ret;
int expected_width;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { -1, "123456789012345678", ZINT_ERROR_TOO_LONG, -1, "Error 345: Input length 18 too long (maximum 17)", "" },
@ -865,7 +865,7 @@ static void test_nve18_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_NVE18, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
@ -890,11 +890,11 @@ static void test_ean14_input(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int ret;
int expected_width;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { "12345678901234", ZINT_ERROR_TOO_LONG, -1, "Error 345: Input length 14 too long (maximum 13)", "" },
@ -919,7 +919,7 @@ static void test_ean14_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_EAN14, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -945,13 +945,13 @@ static void test_dpd_input(const testCtx *const p_ctx) {
struct item {
int option_2;
int output_options;
char *data;
const char *data;
int ret;
int expected_width;
float expected_height;
int bwipp_cmp;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { -1, -1, "12345678901234567890123456", ZINT_ERROR_TOO_LONG, -1, 0, 1, "Error 349: DPD input length 26 wrong (27 or 28 only)", "" },
@ -1012,7 +1012,7 @@ static void test_dpd_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_DPD, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -1066,11 +1066,11 @@ static void test_upu_s10_input(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int ret;
int expected_width;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { "AB123456789ABC", ZINT_ERROR_TOO_LONG, 0, "Error 834: Input length 14 wrong (12 or 13 only)", "" },
@ -1117,7 +1117,7 @@ static void test_upu_s10_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_UPU_S10, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -1159,14 +1159,14 @@ static void test_encode(const testCtx *const p_ctx) {
int symbology;
int input_mode;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* BARCODE_GS1_128 examples verified manually against GS1 General Specifications 21.0.1 (GGS) */
/* BARCODE_DPD examples Specification DPD and primetime Parcel Despatch (DPDAPPD) Version 4.0.2, also
@ -1356,7 +1356,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -1422,12 +1422,12 @@ static void test_perf(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODE128, "123456ABCD123456ABCD123456ABCD123456ABCD123456ABCD123456ABCD", 0, 1, 618, "CODE128 60" },
@ -1467,7 +1467,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, DATA_MODE, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -35,12 +35,12 @@ static void test_large(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -76,7 +76,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODE16K, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -98,12 +98,12 @@ static void test_reader_init(const testCtx *const p_ctx) {
struct item {
int input_mode;
int output_options;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, READER_INIT, "A", 0, 2, 70, "(10) 1 96 33 103 103 103 103 103 68 35", "ModeB FNC3 A Pad (5)" },
@ -130,7 +130,7 @@ static void test_reader_init(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODE16K, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -158,14 +158,14 @@ static void test_input(const testCtx *const p_ctx) {
struct item {
int input_mode;
int option_1;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
/*
NUL U+0000, CodeA-only
@ -246,7 +246,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODE16K, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -300,13 +300,13 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int input_mode;
int option_1;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, -1, "ab0123456789", 0, 2, 70, "BS EN 12323:2005 Figure 3",
@ -373,7 +373,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODE16K, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -35,12 +35,12 @@ static void test_large(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -69,7 +69,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODE49, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -91,13 +91,13 @@ static void test_input(const testCtx *const p_ctx) {
struct item {
int input_mode;
int option_1;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
/*
NUL U+0000, S1 SP (39)
@ -155,7 +155,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODE49, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -194,13 +194,13 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int input_mode;
int option_1;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, -1, "MULTIPLE ROWS IN CODE 49", 0, 5, 70, "ANSI/AIM BC6-2000 Figure 1",
@ -251,7 +251,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODE49, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -54,7 +54,7 @@ static int is_sane_orig(const char test_string[], const unsigned char source[],
static void test_to_int(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
};
@ -88,9 +88,9 @@ static void test_to_int(const testCtx *const p_ctx) {
static void test_to_upper(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -126,7 +126,7 @@ static void test_to_upper(const testCtx *const p_ctx) {
static void test_chr_cnt(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
char c;
int ret;
@ -159,11 +159,11 @@ static void test_not_sane(const testCtx *const p_ctx) {
struct item {
unsigned int flg;
char *data;
const char *data;
int length;
int ret;
char *orig_test;
const char *orig_test;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -292,9 +292,9 @@ static void test_not_sane(const testCtx *const p_ctx) {
static void test_not_sane_lookup(const testCtx *const p_ctx) {
struct item {
char *test_string;
const char *test_string;
int test_length;
char *data;
const char *data;
int length;
int ret;
@ -339,8 +339,8 @@ static void test_errtxt(const testCtx *const p_ctx) {
int debug_test;
int error_number;
int err_id;
char *msg;
char *expected;
const char *msg;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -385,13 +385,13 @@ static void test_errtxtf(const testCtx *const p_ctx) {
int debug_test;
int error_number;
int err_id;
char *fmt;
const char *fmt;
int num_args;
int i_arg;
const char *s_arg;
double f_arg;
int ret;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -536,7 +536,7 @@ static void test_errtxtf(const testCtx *const p_ctx) {
static void test_cnt_digits(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int position;
int max;
@ -572,10 +572,10 @@ static void test_cnt_digits(const testCtx *const p_ctx) {
static void test_is_valid_utf8(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -612,13 +612,13 @@ static void test_utf8_to_unicode(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int length;
int disallow_4byte;
int ret;
int ret_length;
unsigned int expected_vals[20];
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -666,11 +666,11 @@ static void test_hrt_cpy_iso8859_1(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int length;
int ret;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
/*
NBSP U+00A0 (\240, 160), UTF-8 C2A0 (\302\240)
@ -748,8 +748,8 @@ static void test_set_height(const testCtx *const p_ctx) {
int ret;
float expected_height;
char *expected_errtxt;
char *comment;
const char *expected_errtxt;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -803,7 +803,7 @@ static void test_debug_test_codeword_dump_int(const testCtx *const p_ctx) {
struct item {
int codewords[50];
int length;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -36,8 +36,8 @@ static void test_eanx_leading_zeroes(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
int expected_rows;
@ -92,7 +92,7 @@ static void test_eanx_leading_zeroes(const testCtx *const p_ctx) {
composite_length = (int) strlen(data[i].composite);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length);
ret = ZBarcode_Encode(symbol, TCU(data[i].composite), composite_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
@ -104,7 +104,8 @@ static void test_eanx_leading_zeroes(const testCtx *const p_ctx) {
testFinish();
}
static void test_helper_generate(const struct zint_symbol *symbol, int ret, int i, char *data, char *composite, int option_1, char *comment, int bwipp_cmp) {
static void test_helper_generate(const struct zint_symbol *symbol, int ret, int i, const char *data,
const char *composite, int option_1, const char *comment, int bwipp_cmp) {
char esc_data[1024];
char esc_composite[4096];
@ -140,15 +141,15 @@ static void test_examples(const testCtx *const p_ctx) {
int symbology;
int input_mode;
int option_1;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* Verified manually against GS1 General Specifications 21.0.1 (GGS) and ISO/IEC 24723:2010, with noted exceptions, and verified via bwipp_dump.ps against BWIPP */
static const struct item data[] = {
@ -1553,7 +1554,7 @@ static void test_examples(const testCtx *const p_ctx) {
composite_length = (int) strlen(data[i].composite);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length);
ret = ZBarcode_Encode(symbol, TCU(data[i].composite), composite_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -1598,14 +1599,14 @@ static void test_odd_numbered_numeric(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_1;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* Verified via bwipp_dump.ps against BWIPP, and manually against tec-it.com */
static const struct item data[] = {
@ -1726,7 +1727,7 @@ static void test_odd_numbered_numeric(const testCtx *const p_ctx) {
composite_length = (int) strlen(data[i].composite);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length);
ret = ZBarcode_Encode(symbol, TCU(data[i].composite), composite_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -1762,15 +1763,15 @@ static void test_ean128_cc_shift(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_1;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* Verified via bwipp_dump.ps against BWIPP except where noted, when shift verified manually (tec-it.com seems to be off by 2 for top shifts > 1) */
static const struct item data[] = {
@ -1855,7 +1856,7 @@ static void test_ean128_cc_shift(const testCtx *const p_ctx) {
composite_length = (int) strlen(data[i].composite);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length);
ret = ZBarcode_Encode(symbol, TCU(data[i].composite), composite_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -1893,13 +1894,13 @@ static void test_ean128_cc_width(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
/* Verified manually with BWIPP (except very large tests) */
static const struct item data[] = {
@ -1936,7 +1937,7 @@ static void test_ean128_cc_width(const testCtx *const p_ctx) {
composite_length = (int) strlen(data[i].composite);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length);
ret = ZBarcode_Encode(symbol, TCU(data[i].composite), composite_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -1960,14 +1961,14 @@ static void test_encodation_0(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_1;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* Verified via bwipp_dump.ps against BWIPP and manually against tec-it.com (with noted exception) */
static const struct item data[] = {
@ -2403,7 +2404,7 @@ static void test_encodation_0(const testCtx *const p_ctx) {
composite_length = (int) strlen(data[i].composite);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length);
ret = ZBarcode_Encode(symbol, TCU(data[i].composite), composite_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -2439,14 +2440,14 @@ static void test_encodation_10(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_1;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* Verified via bwipp_dump.ps against BWIPP, and manually, with noted exceptions, against tec-it.com */
static const struct item data[] = {
@ -2541,7 +2542,7 @@ static void test_encodation_10(const testCtx *const p_ctx) {
composite_length = (int) strlen(data[i].composite);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length);
ret = ZBarcode_Encode(symbol, TCU(data[i].composite), composite_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -2577,14 +2578,14 @@ static void test_encodation_11(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_1;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* Verified via bwipp_dump.ps against BWIPP, and manually against tec-it.com (with noted exception) */
static const struct item data[] = {
@ -2957,7 +2958,7 @@ static void test_encodation_11(const testCtx *const p_ctx) {
composite_length = (int) strlen(data[i].composite);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length);
ret = ZBarcode_Encode(symbol, TCU(data[i].composite), composite_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -2995,13 +2996,13 @@ static void test_addongap(const testCtx *const p_ctx) {
int symbology;
int option_1;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* Verified via bwipp_dump.ps against BWIPP */
static const struct item data[] = {
@ -3091,7 +3092,7 @@ static void test_addongap(const testCtx *const p_ctx) {
char bwipp_buf[8192];
char bwipp_msg[1024];
char *composite = "[91]12";
const char *composite = "[91]12";
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
@ -3110,7 +3111,7 @@ static void test_addongap(const testCtx *const p_ctx) {
composite_length = (int) strlen(composite);
ret = ZBarcode_Encode(symbol, (const unsigned char *) composite, composite_length);
ret = ZBarcode_Encode(symbol, TCU(composite), composite_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -3150,8 +3151,8 @@ static void test_gs1parens(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
int expected_rows;
@ -3201,7 +3202,7 @@ static void test_gs1parens(const testCtx *const p_ctx) {
composite_length = (int) strlen(data[i].composite);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length);
ret = ZBarcode_Encode(symbol, TCU(data[i].composite), composite_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
@ -3219,11 +3220,11 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -3282,7 +3283,7 @@ static void test_hrt(const testCtx *const p_ctx) {
composite_length = (int) strlen(data[i].composite);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length);
ret = ZBarcode_Encode(symbol, TCU(data[i].composite), composite_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, data[i].ret, ret, symbol->errtxt);
assert_zero(strcmp((const char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -3303,13 +3304,13 @@ static void test_input(const testCtx *const p_ctx) {
int option_1;
int option_2;
int option_3;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -3446,7 +3447,7 @@ static void test_input(const testCtx *const p_ctx) {
composite_length = (int) strlen(data[i].composite);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length);
ret = ZBarcode_Encode(symbol, TCU(data[i].composite), composite_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, data[i].ret, ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -3470,13 +3471,13 @@ static void test_fuzz(const testCtx *const p_ctx) {
int symbology;
int input_mode;
int option_1;
char *data;
const char *data;
int length;
char *composite;
const char *composite;
int ret;
int bwipp_cmp;
char *expected_errtxt;
char *comment;
const char *expected_errtxt;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -3516,7 +3517,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
composite_length = (int) strlen(data[i].composite);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length);
ret = ZBarcode_Encode(symbol, TCU(data[i].composite), composite_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n",
i, symbol->errtxt, data[i].expected_errtxt);
@ -3555,13 +3556,13 @@ static void test_perf(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_1;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_EANX_CC, 1, "123456789012",
@ -3609,7 +3610,7 @@ static void test_perf(const testCtx *const p_ctx) {
composite_length = (int) strlen(data[i].composite);
start = clock();
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].composite, composite_length);
ret = ZBarcode_Encode(symbol, TCU(data[i].composite), composite_length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -39,14 +39,14 @@ static void test_large(const testCtx *const p_ctx) {
int symbology;
int option_2;
struct zint_structapp structapp;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
char *expected_errtxt2;
char *comment;
const char *expected_errtxt;
const char *expected_errtxt2;
const char *comment;
};
/* ISO/IEC 16022:2006 Table 7 and ISO/IEC 21471:2020 (DMRE) Table 7 */
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
@ -382,7 +382,7 @@ static void test_large(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
if (p_ctx->generate) {
char errtxt[sizeof(symbol->errtxt)];
@ -394,7 +394,7 @@ static void test_large(const testCtx *const p_ctx) {
testUtilErrorName(ret), symbol->rows, symbol->width, errtxt);
ZBarcode_Clear(symbol);
symbol->input_mode |= FAST_MODE;
(void) ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
(void) ZBarcode_Encode(symbol, TCU(data_buf), length);
printf(" \"%s\", \"%s\" },\n", strcmp(errtxt, symbol->errtxt) != 0 ? symbol->errtxt : "", data[i].comment);
} else {
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
@ -419,7 +419,7 @@ static void test_large(const testCtx *const p_ctx) {
ZBarcode_Clear(symbol);
symbol->input_mode |= FAST_MODE;
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
@ -460,10 +460,10 @@ static void test_buffer(const testCtx *const p_ctx) {
int eci;
int input_mode;
int output_options;
char *data;
const char *data;
int ret;
int bwipp_cmp;
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -492,7 +492,7 @@ static void test_buffer(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_DATAMATRIX, data[i].input_mode, data[i].eci, -1 /*option_1*/, -1, -1, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret);
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
if (!data[i].bwipp_cmp) {
@ -537,7 +537,7 @@ static void test_options(const testCtx *const p_ctx) {
int option_3;
int output_options;
struct zint_structapp structapp;
char *data;
const char *data;
int ret;
int expected_rows;
@ -675,7 +675,7 @@ static void test_options(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -712,7 +712,7 @@ static void test_options(const testCtx *const p_ctx) {
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d symbol->errtxt %s != %s\n", i, symbol->errtxt, data[i].expected_errtxt);
symbol->input_mode |= FAST_MODE;
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode FAST_MODE ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -734,12 +734,12 @@ static void test_reader_init(const testCtx *const p_ctx) {
int symbology;
int input_mode;
int output_options;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_DATAMATRIX, UNICODE_MODE, READER_INIT, "A", 0, 10, 10, "EA 42 81 19 A4 53 21 DF", "" },
@ -769,7 +769,7 @@ static void test_reader_init(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -827,15 +827,15 @@ static void test_input(const testCtx *const p_ctx) {
int option_2;
int option_3;
int output_options;
char *data;
const char *data;
int ret;
int expected_eci;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *expected;
char *comment;
const char *expected;
const char *comment;
int expected_diff; /* Difference between default minimal encodation and ISO encodation (FAST_MODE) */
};
@ -1110,7 +1110,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_DATAMATRIX, data[i].input_mode, data[i].eci, -1 /*option_1*/, data[i].option_2, data[i].option_3, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -1224,16 +1224,16 @@ static void test_encode(const testCtx *const p_ctx) {
int output_options;
int option_2;
int option_3;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
const char *comment;
int expected_diff; /* Difference between default minimal encodation and ISO encodation (FAST_MODE) */
char *expected;
const char *expected;
};
/* Verified manually against ISO/IEC 16022:2006, ISO/IEC 21471:2020, GS1 General Specifications 21.0.1 (GGS), ANSI/HIBC LIC 2.6-2016 (HIBC/LIC),
ANSI/HIBC PAS 1.3-2010 (HIBC/PAS) and AIM ITS/04-023:2022 (ECI Part 3: Register), with noted exceptions
@ -5680,7 +5680,7 @@ static void test_encode(const testCtx *const p_ctx) {
-1 /*option_1*/, data[i].option_2, data[i].option_3, data[i].output_options,
data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret);
if (p_ctx->generate) {
@ -5791,8 +5791,8 @@ static void test_encode_segs(const testCtx *const p_ctx) {
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, -1, -1, { 0, 0, "" }, { { TU(""), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 14, 14, 1, "ISO 16022:2006 11.6 example",
@ -6212,12 +6212,12 @@ static void test_minimalenc(const testCtx *const p_ctx) {
int input_mode;
int output_options;
int option_2;
char *data;
const char *data;
int length;
int ret;
int expected_diff; /* Difference between default minimal encodation and ISO encodation (FAST_MODE) */
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -7316,12 +7316,12 @@ static void test_perf(const testCtx *const p_ctx) {
int input_mode;
int option_2;
int option_3;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_DATAMATRIX, FAST_MODE, -1, -1,
@ -7428,7 +7428,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -39,7 +39,7 @@ static void test_large(const testCtx *const p_ctx) {
char datum;
int length;
int ret;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -69,7 +69,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_DOTCODE, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -89,7 +89,7 @@ static void test_options(const testCtx *const p_ctx) {
int option_2;
int option_3;
struct zint_structapp structapp;
char *data;
const char *data;
int ret;
int expected_rows;
@ -137,7 +137,7 @@ static void test_options(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -161,12 +161,12 @@ static void test_input(const testCtx *const p_ctx) {
int option_2;
int option_3;
struct zint_structapp structapp;
char *data;
const char *data;
int length;
int ret;
char *expected;
const char *expected;
int bwipp_cmp;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, -1, 13, -1, { 0, 0, "" }, "A", -1, 0, "66 21 6A", 1, "" },
@ -241,7 +241,7 @@ static void test_input(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -296,7 +296,7 @@ static void test_encode(const testCtx *const p_ctx) {
int option_2;
int option_3;
struct zint_structapp structapp;
char *data;
const char *data;
int length;
int ret;
@ -304,8 +304,8 @@ static void test_encode(const testCtx *const p_ctx) {
int expected_width;
int bwipp_cmp;
int zxingcpp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* ISS DotCode, Rev 4.0, DRAFT 0.15, TSC Pre-PR #5, MAY 28, 2019 */
static const struct item data[] = {
@ -1104,7 +1104,7 @@ static void test_encode(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -1177,8 +1177,8 @@ static void test_encode_segs(const testCtx *const p_ctx) {
int expected_width;
int bwipp_cmp;
int zxingcpp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* ISS DotCode, Rev 4.0, DRAFT 0.15, TSC Pre-PR #5, MAY 28, 2019 */
static const struct item data[] = {
@ -1564,7 +1564,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
struct item {
int input_mode;
char *data;
const char *data;
int length;
int ret;
};
@ -1608,7 +1608,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_DOTCODE, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
ZBarcode_Delete(symbol);
@ -1687,12 +1687,12 @@ static void test_perf(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_DOTCODE, -1, -1, -1,
@ -1727,7 +1727,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -37,13 +37,13 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_DXFILMEDGE, -1, "79-7", 0, 2, 23, "DX code 1: 79, DX code 2: 7. DX Extract = 1271. DX Full: X1271X (X is any digit)",
@ -167,7 +167,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -212,11 +212,11 @@ static void test_input(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -260,7 +260,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -79,7 +79,7 @@ static void test_bom(const testCtx *const p_ctx) {
length = (int) strlen(data);
ret = ZBarcode_Encode(symbol, (unsigned char *) data, length);
ret = ZBarcode_Encode(symbol, TCU(data), length);
assert_equal(ret, ZINT_WARN_USES_ECI, "ZBarcode_Encode ret %d != ZINT_WARN_USES_ECI\n", ret);
assert_equal(symbol->eci, 21, "eci %d != 21\n", symbol->eci); /* ECI 21 == Windows-1250 */
@ -109,7 +109,7 @@ static void test_iso_8859_16(const testCtx *const p_ctx) {
length = (int) strlen(data);
ret = ZBarcode_Encode(symbol, (unsigned char *) data, length);
ret = ZBarcode_Encode(symbol, TCU(data), length);
assert_equal(ret, ZINT_WARN_USES_ECI, "ZBarcode_Encode ret %d != ZINT_WARN_USES_ECI\n", ret);
assert_equal(symbol->eci, 18, "eci %d != 18\n", symbol->eci); /* ECI 18 == ISO 8859-16 */
@ -126,10 +126,10 @@ static void test_reduced_charset_input(const testCtx *const p_ctx) {
int symbology;
int input_mode;
int eci;
char *data;
const char *data;
int ret;
int expected_eci;
char *comment;
const char *comment;
};
/*
é U+00E9 in ISO 8859-1 plus other ISO 8859 (but not in ISO 8859-7 or ISO 8859-11), Win 1250 plus other Win, not in Shift JIS
@ -396,7 +396,7 @@ static void test_reduced_charset_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (data[i].expected_eci != -1) {
@ -724,7 +724,7 @@ static void test_utf8_to_eci_ascii(const testCtx *const p_ctx) {
struct item {
int eci;
char *data;
const char *data;
int length;
int ret;
};
@ -783,11 +783,11 @@ static void test_utf8_to_eci_ascii(const testCtx *const p_ctx) {
static void test_utf8_to_eci_utf16be(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
int expected_length;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -848,11 +848,11 @@ static void test_utf8_to_eci_utf16be(const testCtx *const p_ctx) {
static void test_utf8_to_eci_utf16le(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
int expected_length;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -913,11 +913,11 @@ static void test_utf8_to_eci_utf16le(const testCtx *const p_ctx) {
static void test_utf8_to_eci_utf32be(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
int expected_length;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -977,11 +977,11 @@ static void test_utf8_to_eci_utf32be(const testCtx *const p_ctx) {
static void test_utf8_to_eci_utf32le(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
int expected_length;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -1041,7 +1041,7 @@ static void test_utf8_to_eci_utf32le(const testCtx *const p_ctx) {
static void test_utf8_to_eci_sjis(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
int expected_length;
@ -1097,7 +1097,7 @@ static void test_utf8_to_eci_sjis(const testCtx *const p_ctx) {
static void test_utf8_to_eci_big5(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
int expected_length;
@ -1143,7 +1143,7 @@ static void test_utf8_to_eci_big5(const testCtx *const p_ctx) {
static void test_utf8_to_eci_gb2312(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
int expected_length;
@ -1189,7 +1189,7 @@ static void test_utf8_to_eci_gb2312(const testCtx *const p_ctx) {
static void test_utf8_to_eci_euc_kr(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
int expected_length;
@ -1235,7 +1235,7 @@ static void test_utf8_to_eci_euc_kr(const testCtx *const p_ctx) {
static void test_utf8_to_eci_gbk(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
int expected_length;
@ -1281,7 +1281,7 @@ static void test_utf8_to_eci_gbk(const testCtx *const p_ctx) {
static void test_utf8_to_eci_gb18030(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
int expected_length;

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -46,12 +46,12 @@ static void test_print(const testCtx *const p_ctx) {
int option_2;
float scale;
float dpmm;
char *fgcolour;
char *bgcolour;
const char *fgcolour;
const char *bgcolour;
int rotate_angle;
char *data;
char *expected_file;
char *comment;
const char *data;
const char *expected_file;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, 0.0f, 0, "", "", 0, "Égjpqy", "code128_egrave_bold.emf", "" },
@ -154,7 +154,7 @@ static void test_print(const testCtx *const p_ctx) {
strcpy(symbol->bgcolour, data[i].bgcolour);
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
strcpy(symbol->outfile, emf);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2023-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2023-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -45,12 +45,12 @@ static void test_svg(const testCtx *const p_ctx) {
struct item {
int symbology;
int output_options;
char *outfile;
char *data;
const char *outfile;
const char *data;
int length;
int ret;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -85,7 +85,7 @@ static void test_svg(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, data[i].output_options, data[i].data, data[i].length, debug);
strcpy(symbol->outfile, data[i].outfile);
ret = ZBarcode_Encode_and_Print(symbol, TU(data[i].data), length, 0);
ret = ZBarcode_Encode_and_Print(symbol, TCU(data[i].data), length, 0);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode_and_Print(%d) ret %d != %d (%s)\n",
i, data[i].symbology, ret, data[i].ret, symbol->errtxt);
@ -445,7 +445,7 @@ static void test_large(const testCtx *const p_ctx) {
symbol->option_2 = 84;
symbol->scale = 10.0f; /* Could go up to 86.5 (pixel buffer 0x3FB913B1, file size 8868579) but very very slow */
ret = ZBarcode_Encode_and_Print(symbol, TU(data), -1, 0);
ret = ZBarcode_Encode_and_Print(symbol, TCU(data), -1, 0);
assert_zero(ret, "ZBarcode_Encode_and_Print ret %d != 0 (%s)\n", ret, symbol->errtxt);
assert_nonnull(symbol->memfile, "memfile NULL (%s)\n", symbol->errtxt);
assert_equal(symbol->memfile_size, expected_size, "memfile_size %d != expected %d\n",

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -246,12 +246,12 @@ static void test_u_gb18030_int(const testCtx *const p_ctx) {
static void test_gb18030_utf8(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
int ret_length;
unsigned int expected_gbdata[30];
char *comment;
const char *comment;
};
/*
é U+00E9 in ISO 8859-1 plus other ISO 8859 (but not in ISO 8859-7 or ISO 8859-11), Win 1250 plus other Win, in GB 18030 0xA8A6, UTF-8 C3A9
@ -313,12 +313,12 @@ static void test_gb18030_utf8_to_eci(const testCtx *const p_ctx) {
struct item {
int eci;
int full_multibyte;
char *data;
const char *data;
int length;
int ret;
int ret_length;
unsigned int expected_gbdata[30];
char *comment;
const char *comment;
};
/*
é U+00E9 in ISO 8859-1 0xE9, Win 1250 plus other Win, in HANXIN Chinese mode first byte range 0x81..FE
@ -432,12 +432,12 @@ static void test_gb18030_cpy(const testCtx *const p_ctx) {
struct item {
int full_multibyte;
char *data;
const char *data;
int length;
int ret;
int ret_length;
unsigned int expected_gbdata[30];
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -536,10 +536,10 @@ static void test_perf(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int ret;
char *comment;
const char *comment;
};
struct item data[] = {
/* 0*/ { "1234567890", 0, "10 numerics" },

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -153,12 +153,12 @@ static void test_u_gb2312_int(const testCtx *const p_ctx) {
static void test_gb2312_utf8(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
int ret_length;
unsigned int expected_gbdata[20];
char *comment;
const char *comment;
};
/*
é U+00E9 in ISO 8859-1 plus other ISO 8859 (but not in ISO 8859-7 or ISO 8859-11), Win 1250 plus other Win, in GB 2312 0xA8A6, UTF-8 C3A9
@ -219,12 +219,12 @@ static void test_gb2312_utf8_to_eci(const testCtx *const p_ctx) {
struct item {
int eci;
int full_multibyte;
char *data;
const char *data;
int length;
int ret;
int ret_length;
unsigned int expected_gbdata[20];
char *comment;
const char *comment;
};
/*
é U+00E9 in ISO 8859-1 0xE9, Win 1250 plus other Win, in GRIDMATRIX Chinese mode first byte range 0xA1..A9, 0xB0..F7
@ -323,12 +323,12 @@ static void test_gb2312_cpy(const testCtx *const p_ctx) {
struct item {
int full_multibyte;
char *data;
const char *data;
int length;
int ret;
int ret_length;
unsigned int expected_gbdata[20];
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -377,10 +377,10 @@ static void test_perf(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int ret;
char *comment;
const char *comment;
};
struct item data[] = {
/* 0*/ { "1234567890", 0, "10 numerics" },

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -40,7 +40,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
int symbology;
int width;
int height;
char *pattern;
const char *pattern;
int repeat;
int ret;
};
@ -62,7 +62,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
int i, ret;
struct zint_symbol *symbol = NULL;
char *gif = "out.gif";
const char *gif = "out.gif";
char data_buf[19 * 32 + 1]; /* 19 * 32 == 608 */
@ -137,11 +137,11 @@ static void test_print(const testCtx *const p_ctx) {
float scale;
float dot_size;
struct zint_structapp structapp;
char *fgcolour;
char *bgcolour;
char *data;
char *expected_file;
char *comment;
const char *fgcolour;
const char *bgcolour;
const char *data;
const char *expected_file;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_DOTCODE, -1, -1, -1, -1, -1, -1, 0, 0, 0, { 0, 0, "" }, "", "", "12", "dotcode_1.0.gif", "" },
@ -243,7 +243,7 @@ static void test_print(const testCtx *const p_ctx) {
strcpy(symbol->bgcolour, data[i].bgcolour);
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
strcpy(symbol->outfile, gif);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -37,12 +37,12 @@ static void test_large(const testCtx *const p_ctx) {
struct item {
int option_2;
int option_3;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -109,7 +109,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, data[i].option_3, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -132,7 +132,7 @@ static void test_options(const testCtx *const p_ctx) {
int option_1;
int option_2;
struct zint_structapp structapp;
char *data;
const char *data;
int ret_encode;
int ret_vector;
int expected_size;
@ -182,7 +182,7 @@ static void test_options(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt);
if (ret < ZINT_ERROR) {
assert_equal(symbol->width, data[i].expected_size, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_size);
@ -210,11 +210,11 @@ static void test_input(const testCtx *const p_ctx) {
int output_options;
int option_3;
struct zint_structapp structapp;
char *data;
const char *data;
int ret;
int expected_eci;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
/*
é U+00E9 in ISO 8859-1 plus other ISO 8859 (but not in ISO 8859-7 or ISO 8859-11), Win 1250 plus other Win, in GB 2312 0xA8A6, UTF-8 C3A9
@ -363,7 +363,7 @@ static void test_input(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret);
if (p_ctx->generate) {
@ -390,7 +390,7 @@ static void test_encode(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int input_mode;
int option_1;
int option_2;
@ -398,8 +398,8 @@ static void test_encode(const testCtx *const p_ctx) {
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { "1234", UNICODE_MODE, -1, -1, 0, 18, 18, "",
@ -514,7 +514,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_GRIDMATRIX, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -553,8 +553,8 @@ static void test_encode_segs(const testCtx *const p_ctx) {
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/*
not in GB 2312 (in ISO/IEC 8869-1)
@ -903,12 +903,12 @@ static void test_perf(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_GRIDMATRIX, UNICODE_MODE, -1, -1,
@ -951,7 +951,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -40,12 +40,12 @@ static void test_gs1_reduce(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_GS1_128, -1, "12345678901234", "", ZINT_ERROR_INVALID_DATA, "GS1 data required", "" },
@ -194,7 +194,7 @@ static void test_gs1_reduce(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
char bwipp_buf[8196];
char bwipp_msg[1024];
@ -218,7 +218,7 @@ static void test_gs1_reduce(const testCtx *const p_ctx) {
}
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, text, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
if (p_ctx->generate) {
if (data[i].ret == 0) {
@ -265,11 +265,11 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -332,7 +332,7 @@ static void test_hrt(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
testStartSymbol("test_hrt", &symbol);
@ -351,7 +351,7 @@ static void test_hrt(const testCtx *const p_ctx) {
}
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, text, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, data[i].ret, ret, symbol->errtxt);
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -367,10 +367,10 @@ static void test_hrt(const testCtx *const p_ctx) {
static void test_gs1_verify(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int ret;
char *expected;
char *expected_errtxt;
const char *expected;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -1448,10 +1448,10 @@ static void test_gs1_verify(const testCtx *const p_ctx) {
static void test_gs1_lint(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int ret;
char *expected;
char *expected_errtxt;
const char *expected;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -2144,7 +2144,7 @@ static void test_input_mode(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int input_mode;
int output_options;
int ret;
@ -2289,7 +2289,7 @@ static void test_input_mode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->index == -1 && data[i].compare_previous) {
ret = testUtilSymbolCmp(symbol, &previous_symbol);
@ -2312,10 +2312,10 @@ static void test_gs1nocheck_mode(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -2506,7 +2506,7 @@ static void test_gs1nocheck_mode(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
testStartSymbol("test_gs1nocheck_mode", &symbol);
@ -2525,7 +2525,7 @@ static void test_gs1nocheck_mode(const testCtx *const p_ctx) {
}
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, text, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -38,12 +38,12 @@ static void test_large(const testCtx *const p_ctx) {
int option_1;
int option_2;
int option_3;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -96,7 +96,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_HANXIN, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -129,7 +129,7 @@ static void test_options(const testCtx *const p_ctx) {
struct item {
int option_1;
int option_2;
char *data;
const char *data;
int ret_encode;
int ret_vector;
int expected_size;
@ -170,7 +170,7 @@ static void test_options(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_HANXIN, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt);
if (data[i].ret_vector != -1) {
@ -206,13 +206,13 @@ static void test_input(const testCtx *const p_ctx) {
int input_mode;
int eci;
int option_3;
char *data;
const char *data;
int length;
int ret;
int expected_eci;
char *expected;
const char *expected;
int zxingcpp_cmp;
char *comment;
const char *comment;
};
/*
é U+00E9 in ISO 8859-1 plus other ISO 8859 (but not in ISO 8859-7 or ISO 8859-11), Win 1250 plus other Win, in GB 18030 0xA8A6, UTF-8 C3A9
@ -338,7 +338,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_HANXIN, data[i].input_mode, data[i].eci, -1 /*option_1*/, -1, data[i].option_3, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -387,14 +387,14 @@ static void test_encode(const testCtx *const p_ctx) {
int option_1;
int option_2;
int option_3;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, -1, -1, -1, -1, "1234", -1, 0, 23, 23, "Mode nnnn, mask 10",
@ -3187,7 +3187,7 @@ static void test_encode(const testCtx *const p_ctx) {
data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/,
data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -3240,8 +3240,8 @@ static void test_encode_segs(const testCtx *const p_ctx) {
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, -1, -1, -1, { { TU(""), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 23, 23, "Standard example",
@ -3542,11 +3542,11 @@ static void test_fuzz(const testCtx *const p_ctx) {
int option_1;
int option_2;
int option_3;
char *data;
const char *data;
int length;
int ret;
int bwipp_cmp;
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -3567,7 +3567,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
ZBarcode_Delete(symbol);
@ -3589,12 +3589,12 @@ static void test_perf(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_HANXIN, UNICODE_MODE, -1, -1,
@ -3653,7 +3653,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -133,7 +133,7 @@ static void test_csv(const testCtx *const p_ctx) {
if (test_performance) {
start = clock();
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data, (int) strlen(data));
ret = ZBarcode_Encode(symbol, TCU(data), (int) strlen(data));
if (test_performance) {
total += clock() - start;
}
@ -167,8 +167,8 @@ static void test_hrt(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
char *expected;
const char *data;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -189,7 +189,7 @@ static void test_hrt(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_USPS_IMAIL, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -204,11 +204,11 @@ static void test_input(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -246,7 +246,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_USPS_IMAIL, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -276,13 +276,13 @@ static void test_encode(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { "01234567094987654321-01234567891", 0, 3, 129, "USPS-B-3200 Rev. H (2015) Figure 5",
@ -312,7 +312,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_USPS_IMAIL, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {

View file

@ -816,7 +816,7 @@ static void test_dump(const testCtx *const p_ctx) {
struct item {
large_uint t;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -41,7 +41,7 @@ static void test_checks(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_1;
char *data;
const char *data;
int length;
int input_mode;
int eci;
@ -56,7 +56,7 @@ static void test_checks(const testCtx *const p_ctx) {
int warn_level;
int ret;
char *expected;
const char *expected;
int expected_symbology;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
@ -258,7 +258,7 @@ static void test_checks(const testCtx *const p_ctx) {
symbol->warn_level = data[i].warn_level;
}
ret = ZBarcode_Encode(symbol, TU(data[i].data), length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%d) ret %d != %d (%s)\n", i, data[i].symbology, ret, data[i].ret, symbol->errtxt);
ret = strcmp(symbol->errtxt, data[i].expected);
@ -289,7 +289,7 @@ static void test_checks_segs(const testCtx *const p_ctx) {
int warn_level;
int ret;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -345,12 +345,12 @@ static void test_input_data(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
char *data;
const char *data;
int length;
char *composite;
const char *composite;
int ret;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -366,7 +366,7 @@ static void test_input_data(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
testStartSymbol("test_input_data", &symbol);
@ -385,7 +385,7 @@ static void test_input_data(const testCtx *const p_ctx) {
}
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, text, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%d) ret %d != %d (%s)\n", i, data[i].symbology, ret, data[i].ret, symbol->errtxt);
ret = strcmp(symbol->errtxt, data[i].expected);
@ -397,7 +397,7 @@ static void test_input_data(const testCtx *const p_ctx) {
if (p_ctx->index == -1 && p_ctx->exclude[0] == -1) {
char data_buf[ZINT_MAX_DATA_LEN + 10];
int expected_ret = ZINT_ERROR_TOO_LONG;
char *expected_errtxt[] = { "Error 797: Input too long", "Error 340: Input length 17399 too long (maximum 256)" };
const char *expected_errtxt[] = { "Error 797: Input too long", "Error 340: Input length 17399 too long (maximum 256)" };
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
@ -527,7 +527,7 @@ static void test_symbologies(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
symbol->symbology = i;
ret = ZBarcode_Encode(symbol, TU(""), 0);
ret = ZBarcode_Encode(symbol, TCU(""), 0);
assert_notequal(ret, ZINT_ERROR_ENCODING_PROBLEM, "i:%d Encoding problem (%s)\n", i, symbol->errtxt);
if (!ZBarcode_ValidID(i)) {
@ -551,12 +551,12 @@ static void test_input_mode(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int input_mode;
int ret;
int expected_input_mode;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -587,7 +587,7 @@ static void test_input_mode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODE49 /*Supports GS1*/, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, TU(data[i].data), length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->input_mode, data[i].expected_input_mode, "i:%d symbol->input_mode %d != %d\n", i, symbol->input_mode, data[i].expected_input_mode);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d ZBarcode_Encode strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -605,13 +605,13 @@ static void test_escape_char_process(const testCtx *const p_ctx) {
int symbology;
int input_mode;
int eci;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
int expected_width;
char *expected;
const char *expected;
int compare_previous;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 26, "01 05 08 09 0A 0B 0C 0D 0E 1C 1E 1F EB 02 5D 81 21 0D 92 2E 3D FD B6 9A 37 2A CD 61 FB 95", 0, "" },
@ -707,9 +707,9 @@ static void test_escape_char_process(const testCtx *const p_ctx) {
char escaped[1024];
char escaped_composite[1024];
struct zint_symbol previous_symbol;
char *input_filename = "test_escape.txt";
const char *input_filename = "test_escape.txt";
char *text;
const char *text;
testStartSymbol("test_escape_char_process", &symbol);
@ -731,7 +731,7 @@ static void test_escape_char_process(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode | ESCAPE_MODE, data[i].eci, -1 /*option_1*/, -1, -1, -1 /*output_options*/, text, -1, debug);
ret = ZBarcode_Encode(symbol, TU(text), length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -796,9 +796,9 @@ static void test_escape_char_process_test(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
char *data;
const char *data;
int ret;
char *expected;
const char *expected;
int expected_len;
};
static const struct item data[] = {
@ -1126,9 +1126,9 @@ static void test_encode_file_directory(const testCtx *const p_ctx) {
static void test_encode_file(const testCtx *const p_ctx) {
int ret;
struct zint_symbol *symbol = NULL;
char *data = "1";
char *filename = "test_encode_file_in.txt";
char *outfile = "test_encode_file_out.gif";
const char *data = "1";
const char *filename = "test_encode_file_in.txt";
const char *outfile = "test_encode_file_out.gif";
FILE *fp;
(void)p_ctx;
@ -1206,7 +1206,7 @@ static void test_encode_print_outfile_directory(const testCtx *const p_ctx) {
assert_zero(ret, "testUtilMkDir(%s) %d != 0 (%d: %s)\n", dirname, ret, errno, strerror(errno));
strcpy(symbol->outfile, dirname);
ret = ZBarcode_Encode_and_Print(symbol, TU("1"), 0, 0);
ret = ZBarcode_Encode_and_Print(symbol, TCU("1"), 0, 0);
assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "ret %d != ZINT_ERROR_FILE_ACCESS (%s)\n", ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, expected), "strcmp(%s, %s) != 0\n", symbol->errtxt, expected);
@ -1222,9 +1222,9 @@ static void test_bad_args(const testCtx *const p_ctx) {
int ret;
unsigned int uret;
struct zint_symbol *symbol = NULL;
char *data = "1";
char *filename = "1.png";
char *empty = "";
const char *data = "1";
const char *filename = "1.png";
const char *empty = "";
struct zint_seg seg = { TU("1"), -1, 4 };
struct zint_seg seg_empty = { TU(""), -1, 4 };
struct zint_seg seg_too_long = { TU("1"), ZINT_MAX_DATA_LEN + 1, 4 };
@ -1260,16 +1260,16 @@ static void test_bad_args(const testCtx *const p_ctx) {
assert_zero(uret, "ZBarcode_Cap(10, ~0) uret 0x%X != 0\n", uret);
/* NULL symbol */
assert_equal(ZBarcode_Encode(NULL, TU(data), 1), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode(NULL, data, 1) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode(NULL, TCU(data), 1), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode(NULL, data, 1) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_Segs(NULL, &seg, 1), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs(NULL, &seg, 1) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Print(NULL, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Print(NULL, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Buffer(NULL, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Buffer(NULL, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Buffer_Vector(NULL, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Buffer_Vector(NULL, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_and_Print(NULL, TU(data), 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Print(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_and_Print(NULL, TCU(data), 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Print(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_Segs_and_Print(NULL, &seg, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Seg_and_Print(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_and_Buffer(NULL, TU(data), 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_and_Buffer(NULL, TCU(data), 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_Segs_and_Buffer(NULL, &seg, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs_and_Buffer(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_and_Buffer_Vector(NULL, TU(data), 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer_Vector(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_and_Buffer_Vector(NULL, TCU(data), 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer_Vector(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_Segs_and_Buffer_Vector(NULL, &seg, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs_and_Buffer_Vector(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_File(NULL, filename), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_File(NULL, filename) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_File_and_Print(NULL, filename, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_File_and_Print(NULL, filename, 0) != ZINT_ERROR_INVALID_DATA\n");
@ -1315,23 +1315,23 @@ static void test_bad_args(const testCtx *const p_ctx) {
/* Empty data/segs/filename */
symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode(symbol, TU(empty), 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode(symbol, TU(empty), 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
assert_equal(ZBarcode_Encode(symbol, TCU(empty), 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode(symbol, TCU(empty), 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_Segs(symbol, &seg_empty, 1), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs(symbol, &seg_empty, 1) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_Segs(symbol, &seg_empty, 1) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_and_Print(symbol, TU(empty), 0, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Print(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_and_Print(symbol, TU(empty), 0, 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
assert_equal(ZBarcode_Encode_and_Print(symbol, TCU(empty), 0, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Print(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_and_Print(symbol, TCU(empty), 0, 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_and_Buffer(symbol, TU(empty), 0, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_and_Buffer(symbol, TU(empty), 0, 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
assert_equal(ZBarcode_Encode_and_Buffer(symbol, TCU(empty), 0, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_and_Buffer(symbol, TCU(empty), 0, 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_and_Buffer_Vector(symbol, TU(empty), 0, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer_Vector(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_and_Buffer_Vector(symbol, TU(empty), 0, 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
assert_equal(ZBarcode_Encode_and_Buffer_Vector(symbol, TCU(empty), 0, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_and_Buffer_Vector(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_and_Buffer_Vector(symbol, TCU(empty), 0, 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, &seg_empty, 1, 0), ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, &seg_empty, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt), "ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, &seg_empty, 1, 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
@ -1361,8 +1361,8 @@ static void test_bad_args(const testCtx *const p_ctx) {
/* Data/seg too big */
symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode(symbol, TU(empty), ZINT_MAX_DATA_LEN + 1), ZINT_ERROR_TOO_LONG, "ZBarcode_Encode(symbol, empty, ZINT_MAX_DATA_LEN + 1) != ZINT_ERROR_TOO_LONG\n");
assert_zero(strcmp(expected[7], symbol->errtxt), "ZBarcode_Encode(symbol, TU(empty), ZINT_MAX_DATA_LEN + 1) strcmp(%s, %s) != 0\n", expected[7], symbol->errtxt);
assert_equal(ZBarcode_Encode(symbol, TCU(empty), ZINT_MAX_DATA_LEN + 1), ZINT_ERROR_TOO_LONG, "ZBarcode_Encode(symbol, empty, ZINT_MAX_DATA_LEN + 1) != ZINT_ERROR_TOO_LONG\n");
assert_zero(strcmp(expected[7], symbol->errtxt), "ZBarcode_Encode(symbol, TCU(empty), ZINT_MAX_DATA_LEN + 1) strcmp(%s, %s) != 0\n", expected[7], symbol->errtxt);
symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_Segs(symbol, &seg_too_long, 1), ZINT_ERROR_TOO_LONG, "ZBarcode_Encode_Segs(symbol, &seg_too_long, 1) != ZINT_ERROR_TOO_LONG\n");
assert_zero(strcmp(expected[7], symbol->errtxt), "ZBarcode_Encode_Segs(symbol, &seg_too_long, 1) strcmp(%s, %s) != 0\n", expected[7], symbol->errtxt);
@ -1611,9 +1611,9 @@ static void test_error_tag(const testCtx *const p_ctx) {
int debug_test;
int error_number;
int warn_level;
char *data;
const char *data;
int ret;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -1702,7 +1702,7 @@ static void test_zero_outfile(const testCtx *const p_ctx) {
int ret;
struct zint_symbol *symbol = NULL;
char *data = "1234";
const char *data = "1234";
(void)p_ctx;
@ -1714,7 +1714,7 @@ static void test_zero_outfile(const testCtx *const p_ctx) {
assert_nonzero(symbol->outfile[0], "ZBarcode_Create() outfile zero\n");
symbol->outfile[0] = '\0';
ret = ZBarcode_Encode(symbol, TU(data), 0);
ret = ZBarcode_Encode(symbol, TCU(data), 0);
assert_zero(ret, "ZBarcode_Encode(%s) ret %d != 0 (%s)\n", data, ret, symbol->errtxt);
assert_zero(symbol->outfile[0], "ZBarcode_Encode() outfile non-zero\n");
@ -1735,7 +1735,7 @@ static void test_clear(const testCtx *const p_ctx) {
int ret;
struct zint_symbol *symbol = NULL;
char *data = "1234";
const char *data = "1234";
(void)p_ctx;
@ -1754,7 +1754,7 @@ static void test_clear(const testCtx *const p_ctx) {
/* Raster */
ret = ZBarcode_Encode(symbol, TU(data), 0);
ret = ZBarcode_Encode(symbol, TCU(data), 0);
assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt);
assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n");
@ -1785,7 +1785,7 @@ static void test_clear(const testCtx *const p_ctx) {
/* Vector */
ret = ZBarcode_Encode(symbol, TU(data), 0);
ret = ZBarcode_Encode(symbol, TCU(data), 0);
assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt);
assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n");
@ -1855,7 +1855,7 @@ static void test_reset(const testCtx *const p_ctx) {
int ret;
struct zint_symbol *symbol;
struct zint_symbol *symbol_def;
char *data = "1234";
const char *data = "1234";
(void)p_ctx;
@ -1871,7 +1871,7 @@ static void test_reset(const testCtx *const p_ctx) {
/* Raster */
ret = ZBarcode_Encode(symbol, TU(data), 0);
ret = ZBarcode_Encode(symbol, TCU(data), 0);
assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt);
assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n");
@ -1922,7 +1922,7 @@ static void test_reset(const testCtx *const p_ctx) {
set_symbol_fields(symbol);
ret = ZBarcode_Encode(symbol, TU(data), 0);
ret = ZBarcode_Encode(symbol, TCU(data), 0);
assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt);
assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n");
@ -1984,7 +1984,7 @@ static void test_scale_from_xdimdp(const testCtx *const p_ctx) {
float x_dim;
float dpmm;
int dpi;
char *filetype;
const char *filetype;
float expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
@ -2116,7 +2116,7 @@ static void test_xdimdp_from_scale(const testCtx *const p_ctx) {
float scale;
float dpmm; /* Note testing "normal" case that want X-dim, not dpmm */
int dpi;
char *filetype;
const char *filetype;
float expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -35,7 +35,7 @@ static void test_4s_input(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
@ -115,7 +115,7 @@ static void test_4s_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_MAILMARK_4S, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -138,12 +138,12 @@ static void test_4s_encode_vector(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int ret_encode;
float w;
float h;
int ret_vector;
char *expected_daft;
const char *expected_daft;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -185,7 +185,7 @@ static void test_4s_encode_vector(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_MAILMARK_4S, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt);
assert_equal(symbol->rows, 3, "i:%d symbol->rows %d != 3\n", i, symbol->rows);
@ -207,13 +207,13 @@ static void test_4s_encode(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { "1100000000000XY11 ", 0, 3, 131, "Verified manually against TEC-IT",
@ -239,7 +239,7 @@ static void test_4s_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_MAILMARK_4S, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -271,11 +271,11 @@ static void test_2d_input(const testCtx *const p_ctx) {
struct item {
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -329,7 +329,7 @@ static void test_2d_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_MAILMARK_2D, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -349,14 +349,14 @@ static void test_2d_encode(const testCtx *const p_ctx) {
struct item {
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* Mailmark Mailing Requirements for Letters and Large Letters 14th Nov 2019 (MMRLLL)
https://www.royalmailtechnical.com/rmt_docs/User_Guides_2020/Mailmark_Letters_and_Large_Letters_20200723.pdf */
@ -550,7 +550,7 @@ static void test_2d_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_MAILMARK_2D, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -37,14 +37,14 @@ static void test_large(const testCtx *const p_ctx) {
struct item {
int option_1;
int option_2;
char *pattern;
const char *pattern;
int length;
char *primary;
const char *primary;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -112,7 +112,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_MAXICODE, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
strcpy(symbol->primary, data[i].primary);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
@ -166,15 +166,15 @@ static void test_input(const testCtx *const p_ctx) {
int option_1;
int option_2;
struct zint_structapp structapp;
char *data;
const char *data;
int length;
char *primary;
const char *primary;
int ret;
int expected_width;
char *expected;
const char *expected;
int bwipp_cmp;
int zxingcpp_cmp;
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -278,7 +278,7 @@ static void test_input(const testCtx *const p_ctx) {
}
strcpy(symbol->primary, data[i].primary);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -340,16 +340,16 @@ static void test_encode(const testCtx *const p_ctx) {
int option_1;
int option_2;
struct zint_structapp structapp;
char *data;
const char *data;
int length;
char *primary;
const char *primary;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { -1, -1, -1, { 0, 0, "" }, "THIS IS A 93 CHARACTER CODE SET A MESSAGE THAT FILLS A MODE 4, UNAPPENDED, MAXICODE SYMBOL...", -1, "", 0, 33, 30, 1, "ISO/IEC 16023:2000 Figure 2 (and L1), same",
@ -1184,7 +1184,7 @@ static void test_encode(const testCtx *const p_ctx) {
}
strcpy(symbol->primary, data[i].primary);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -1246,14 +1246,14 @@ static void test_encode_segs(const testCtx *const p_ctx) {
int option_2;
struct zint_structapp structapp;
struct zint_seg segs[3];
char *primary;
const char *primary;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, -1, -1, { 0, 0, "" }, { { TU(""), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, "", 0, 33, 30, 1, "ISO 16023:2000 4.15.4 example",
@ -1850,7 +1850,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
struct item {
int eci;
char *data;
const char *data;
int length;
int ret;
};
@ -1878,7 +1878,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_MAXICODE, -1 /*input_mode*/, data[i].eci, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
ZBarcode_Delete(symbol);
@ -1902,13 +1902,13 @@ static void test_perf(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
char *primary;
const char *data;
const char *primary;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_MAXICODE, UNICODE_MODE | ESCAPE_MODE, -1, -1,
@ -1959,7 +1959,7 @@ static void test_perf(const testCtx *const p_ctx) {
strcpy(symbol->primary, data[i].primary);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -37,12 +37,12 @@ static void test_large(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -77,7 +77,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -99,9 +99,9 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -133,7 +133,7 @@ static void test_hrt(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -150,7 +150,7 @@ static void test_input(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
@ -208,7 +208,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d symbol->errtxt %s != %s\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -244,13 +244,13 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_PHARMA, -1, "131070", 0, 1, 78, "",
@ -302,7 +302,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2021-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2021-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -38,10 +38,10 @@
static void test_check_colour_options(const testCtx *const p_ctx) {
struct item {
char *fgcolour;
char *bgcolour;
const char *fgcolour;
const char *bgcolour;
int ret;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -90,13 +90,13 @@ static void test_check_colour_options(const testCtx *const p_ctx) {
static void test_colour_get_rgb(const testCtx *const p_ctx) {
struct item {
char *colour;
const char *colour;
int ret;
unsigned char red;
unsigned char green;
unsigned char blue;
unsigned char alpha;
char *expected_cmyk;
const char *expected_cmyk;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -154,14 +154,14 @@ static void test_colour_get_rgb(const testCtx *const p_ctx) {
static void test_colour_get_cmyk(const testCtx *const p_ctx) {
struct item {
char *colour;
const char *colour;
int ret;
int cyan;
int magenta;
int yellow;
int black;
unsigned char alpha;
char *expected_rgb;
const char *expected_rgb;
int ret_rgb;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
@ -323,9 +323,9 @@ static void test_set_whitespace_offsets(const testCtx *const p_ctx) {
static void test_fopen(const testCtx *const p_ctx) {
struct item {
char dir[32];
char subdir[32];
char *filename;
const char dir[32];
const char subdir[32];
const char *filename;
int succeed;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -42,11 +42,11 @@ static void test_print(const testCtx *const p_ctx) {
int whitespace_height;
int option_1;
int option_2;
char *fgcolour;
char *bgcolour;
const char *fgcolour;
const char *bgcolour;
float scale;
char *data;
char *expected_file;
const char *data;
const char *expected_file;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -61,7 +61,7 @@ static void test_print(const testCtx *const p_ctx) {
struct zint_symbol *symbol;
const char *data_dir = "/backend/tests/data/pcx";
char *pcx = "out.pcx";
const char *pcx = "out.pcx";
char expected_file[4096];
char escaped[1024];
int escaped_size = 1024;
@ -109,7 +109,7 @@ static void test_print(const testCtx *const p_ctx) {
}
symbol->debug |= debug;
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
strcpy(symbol->outfile, pcx);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -39,12 +39,12 @@ static void test_large(const testCtx *const p_ctx) {
int option_1;
int option_2;
int option_3;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -85,7 +85,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -98,7 +98,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, FAST_MODE, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -123,7 +123,7 @@ static void test_options(const testCtx *const p_ctx) {
int option_3;
int warn_level;
struct zint_structapp structapp;
char *data;
const char *data;
int ret_encode;
int ret_vector;
@ -209,7 +209,7 @@ static void test_options(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt);
if (data[i].option_3 != -1) {
@ -246,12 +246,12 @@ static void test_reader_init(const testCtx *const p_ctx) {
int symbology;
int input_mode;
int output_options;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_PDF417, UNICODE_MODE, READER_INIT, "A", 0, 6, 103, "(12) 4 921 29 900 209 917 46 891 522 472 822 385", "Outputs Test Alpha flag 900" },
@ -280,7 +280,7 @@ static void test_reader_init(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, -1, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -326,14 +326,14 @@ static void test_input(const testCtx *const p_ctx) {
int option_1;
int option_2;
struct zint_structapp structapp;
char *data;
const char *data;
int ret;
int expected_eci;
int expected_rows;
int expected_width;
char *expected;
const char *expected;
int bwipp_cmp;
char *comment;
const char *comment;
};
/* é U+00E9 (\351, 233), UTF-8 C3A9 */
/* β U+03B2 in ISO 8859-7 Greek (but not other ISO 8859 or Win page) (\342, 226), UTF-8 CEB2 */
@ -451,7 +451,7 @@ static void test_input(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -527,14 +527,14 @@ static void test_encode(const testCtx *const p_ctx) {
int option_1;
int option_2;
int option_3;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_PDF417, -1, UNICODE_MODE | FAST_MODE, 1, 2, -1, "PDF417 Symbology Standard", 0, 10, 103, 0, "ISO 15438:2015 Figure 1, same, BWIPP uses different encodation, same codeword count",
@ -3949,7 +3949,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -4035,8 +4035,8 @@ static void test_encode_segs(const testCtx *const p_ctx) {
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, { { TU(""), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 8, 103, 1, "Standard example",
@ -4786,11 +4786,11 @@ static void test_fuzz(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
const char *data;
int length;
int ret;
int bwipp_cmp;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, -1, -1,
@ -5591,7 +5591,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -5808,12 +5808,12 @@ static void test_perf(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_PDF417, -1, -1, -1, "1234567890", 0, 7, 103, "10 numerics" },
@ -5892,7 +5892,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
@ -5952,7 +5952,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -37,12 +37,12 @@ static void test_large(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -87,7 +87,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -109,9 +109,9 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -160,7 +160,7 @@ static void test_hrt(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -177,11 +177,11 @@ static void test_input(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -207,7 +207,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
@ -229,13 +229,13 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_MSI_PLESSEY, -1, "1234567890", 0, 1, 127, "Verified manually against tec-it",
@ -293,7 +293,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -342,12 +342,12 @@ static void test_perf(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_PLESSEY, -1, "1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1", 0, 1, 1107, "PLESSEY 65" },
@ -388,7 +388,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, DATA_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -42,7 +42,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
struct item {
int width;
int height;
char *pattern;
const char *pattern;
int repeat;
int ret;
};
@ -60,7 +60,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
int i, ret;
struct zint_symbol *symbol = NULL;
char *png = "out.png";
const char *png = "out.png";
char data_buf[8 * 2 + 1];
@ -135,14 +135,14 @@ static void test_print(const testCtx *const p_ctx) {
float height;
float scale;
struct zint_structapp structapp;
char *fgcolour;
char *bgcolour;
const char *fgcolour;
const char *bgcolour;
float text_gap;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
char *expected_file;
char *comment;
const char *expected_file;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, -1, -1, -1, -1, -1, -1, 10.0, 0, { 0, 0, "" }, "", "", 1, "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", "", 0, "code128_latin1_1.png", "" },
@ -249,7 +249,7 @@ static void test_print(const testCtx *const p_ctx) {
int escaped_size = 1024;
unsigned char filebuf[32768];
int filebuf_size;
char *text;
const char *text;
const char *const have_identify = testUtilHaveIdentify();
@ -310,7 +310,7 @@ static void test_print(const testCtx *const p_ctx) {
}
text_length = (int) strlen(text);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, text_length);
ret = ZBarcode_Encode(symbol, TCU(text), text_length);
assert_equal(ret, data[i].ret, "i:%d %s ZBarcode_Encode ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt);
strcpy(symbol->outfile, png);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -40,12 +40,12 @@ static void test_large(const testCtx *const p_ctx) {
struct item {
int symbology;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -98,7 +98,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -117,7 +117,7 @@ static void test_koreapost(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int ret_encode;
int ret_vector;
@ -143,7 +143,7 @@ static void test_koreapost(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_KOREAPOST, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret_encode);
if (ret < ZINT_ERROR) {
@ -165,14 +165,14 @@ static void test_japanpost(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int ret_encode;
int ret_vector;
float expected_height;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { "123", 0, 0, 8, 3, 133, "Check 3" },
@ -196,7 +196,7 @@ static void test_japanpost(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_JAPANPOST, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret_encode);
if (ret < ZINT_ERROR) {
@ -221,14 +221,14 @@ static void test_input(const testCtx *const p_ctx) {
int symbology;
int option_2;
float height;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
float expected_height;
char *expected_errtxt;
const char *expected_errtxt;
int bwipp_cmp;
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -303,7 +303,7 @@ static void test_input(const testCtx *const p_ctx) {
symbol->height = data[i].height;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -339,13 +339,13 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_FLAT, "1304056", 0, 1, 63, "Verified manually against tec-it",
@ -498,7 +498,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -547,12 +547,12 @@ static void test_perf(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_POSTNET, -1, "12345678901", 0, 2, 123, "POSTNET 11" },
@ -592,7 +592,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, DATA_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -45,8 +45,8 @@ static void test_print(const testCtx *const p_ctx) {
int option_1;
int option_2;
float scale;
char *data;
char *expected_file;
const char *data;
const char *expected_file;
};
struct item data[] = {
/* 0*/ { BARCODE_CODE128, -1, -1, -1, "AIM", "code128_aim" },
@ -60,7 +60,7 @@ static void test_print(const testCtx *const p_ctx) {
struct zint_symbol *symbol = NULL;
int j;
char *exts[] = { "bmp", "emf", "eps", "gif", "pcx", "png", "svg", "tif", "txt" };
const char *exts[] = { "bmp", "emf", "eps", "gif", "pcx", "png", "svg", "tif", "txt" };
int exts_size = ARRAY_SIZE(exts);
char data_dir[1024];
@ -134,7 +134,7 @@ static void test_print(const testCtx *const p_ctx) {
symbol->scale = data[i].scale;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
strcpy(symbol->outfile, "out.");

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -46,11 +46,11 @@ static void test_print(const testCtx *const p_ctx) {
int option_2;
float scale;
float dot_size;
char *fgcolour;
char *bgcolour;
const char *fgcolour;
const char *bgcolour;
int rotate_angle;
char *data;
char *expected_file;
const char *data;
const char *expected_file;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, 0, 0, "", "", 0, "Égjpqy", "code128_egrave_bold.eps" },
@ -167,7 +167,7 @@ static void test_print(const testCtx *const p_ctx) {
strcpy(symbol->bgcolour, data[i].bgcolour);
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
strcpy(symbol->outfile, eps);
@ -226,8 +226,8 @@ INTERNAL void ps_convert_test(const unsigned char *string, unsigned char *ps_str
static void test_ps_convert(const testCtx *const p_ctx) {
struct item {
char *data;
char *expected;
const char *data;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { "1\\(é)2€3¿", "1\\\\\\(\351\\)23\277" },

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -38,12 +38,12 @@ static void test_qr_large(const testCtx *const p_ctx) {
int option_1;
int option_2;
int option_3;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -93,7 +93,7 @@ static void test_qr_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_QRCODE, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3 | FAST_MODE, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -104,7 +104,7 @@ static void test_qr_large(const testCtx *const p_ctx) {
}
symbol->input_mode |= FAST_MODE;
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -151,12 +151,12 @@ static void test_qr_options(const testCtx *const p_ctx) {
int option_1;
int option_2;
struct zint_structapp structapp;
char *data;
const char *data;
int ret_encode;
int ret_vector;
int expected_size;
int compare_previous;
char *expected;
const char *expected;
};
/* 貫 U+8CAB kanji, in Shift JIS 0x8AD1 (\212\321), UTF-8 E8B2AB */
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
@ -229,7 +229,7 @@ static void test_qr_options(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
if (p_ctx->index == -1 && data[i].compare_previous != -1) {
@ -259,13 +259,13 @@ static void test_qr_input(const testCtx *const p_ctx) {
int eci;
int option_1;
int option_3;
char *data;
const char *data;
int ret;
int expected_eci;
char *expected;
const char *expected;
int bwipp_cmp;
int zxingcpp_cmp;
char *comment;
const char *comment;
};
/* é U+00E9 in ISO 8859-1 plus other ISO 8859 (but not in ISO 8859-7 or ISO 8859-11), Win 1250 plus other Win, not in Shift JIS, UTF-8 C3A9 */
/* β U+03B2 in ISO 8859-7 Greek (but not other ISO 8859 or Win page), in Shift JIS 0x83C0, UTF-8 CEB2 */
@ -452,7 +452,7 @@ static void test_qr_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_QRCODE, data[i].input_mode, data[i].eci, data[i].option_1, -1, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -514,11 +514,11 @@ static void test_qr_gs1(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_3;
char *data;
const char *data;
int ret;
char *expected;
const char *expected;
int bwipp_cmp;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { GS1_MODE, 4, 7 << 8, "[01]12345678901231", 0, "51 04 00 B3 AA 37 DE 87 B1", 1, "N16" },
@ -664,7 +664,7 @@ static void test_qr_gs1(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_QRCODE, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -720,11 +720,11 @@ static void test_qr_optimize(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_3; /* OR-ed with ZINT_FULL_MULTIBYTE */
char *data;
const char *data;
int ret;
char *expected;
const char *expected;
int bwipp_cmp;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, 4, -1, "1", 0, "10 04 40 EC 11 EC 11 EC 11", 1, "N1" },
@ -782,7 +782,7 @@ static void test_qr_optimize(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_QRCODE, data[i].input_mode, -1 /*eci*/, data[i].option_1, -1, data[i].option_3 | ZINT_FULL_MULTIBYTE, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -836,15 +836,15 @@ static void test_qr_encode(const testCtx *const p_ctx) {
int option_2;
int option_3;
struct zint_structapp structapp;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* や U+3084 kanji, in Shift JIS 0x82E2 (\202\342), UTF-8 E38284; its 2nd byte 0xE2 + 0x40-FC also form Shift JIS */
static const struct item data[] = {
@ -4307,7 +4307,7 @@ static void test_qr_encode(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -4376,8 +4376,8 @@ static void test_qr_encode_segs(const testCtx *const p_ctx) {
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_QRCODE, UNICODE_MODE, 4, -1, 8 << 8, { 0, 0, "" }, { { TU(""), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 21, 21, 1, "Standard example",
@ -4716,12 +4716,12 @@ static void test_qr_perf(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_QRCODE, UNICODE_MODE, -1, -1, "12345678901234", 0, 21, 21, "14 chars, Numeric mode" },
@ -4803,7 +4803,7 @@ static void test_qr_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
@ -4849,7 +4849,7 @@ static void test_qr_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
@ -4883,11 +4883,11 @@ static void test_microqr_options(const testCtx *const p_ctx) {
struct item {
int option_1;
int option_2;
char *data;
const char *data;
int ret_encode;
int ret_vector;
int expected_size;
char *expected_errtxt;
const int expected_size;
const char *expected_errtxt;
int compare_previous;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
@ -4973,7 +4973,7 @@ static void test_microqr_options(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_MICROQR, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
if (p_ctx->index == -1 && data[i].compare_previous != -1) {
@ -5001,12 +5001,12 @@ static void test_microqr_input(const testCtx *const p_ctx) {
struct item {
int input_mode;
int option_3;
char *data;
const char *data;
int ret;
char *expected;
const char *expected;
int bwipp_cmp;
int zxingcpp_cmp;
char *comment;
const char *comment;
};
/* é U+00E9 in ISO 8859-1 plus other ISO 8859 (but not in ISO 8859-7 or ISO 8859-11), Win 1250 plus other Win, not in Shift JIS, UTF-8 C3A9 */
/* β U+03B2 in ISO 8859-7 Greek (but not other ISO 8859 or Win page), in Shift JIS 0x83C0, UTF-8 CEB2 */
@ -5088,7 +5088,7 @@ static void test_microqr_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_MICROQR, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -5145,10 +5145,10 @@ static void test_microqr_padding(const testCtx *const p_ctx) {
struct item {
int option_1;
char *data;
const char *data;
int ret;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { -1, "1", 0, "22 00 00 (20)", "M1, bits left 13" },
@ -5217,7 +5217,7 @@ static void test_microqr_padding(const testCtx *const p_ctx) {
length = (int) strlen(data[i].data);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -5263,12 +5263,12 @@ static void test_microqr_optimize(const testCtx *const p_ctx) {
int option_1;
int option_2;
int option_3;
char *data;
const char *data;
int ret;
char *expected;
const char *expected;
int bwipp_cmp;
int zxingcpp_cmp;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, -1, -1, -1, "1", 0, "22 00 00 (20)", 1, 1, "N1" },
@ -5309,7 +5309,7 @@ static void test_microqr_optimize(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_MICROQR, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -5366,14 +5366,14 @@ static void test_microqr_encode(const testCtx *const p_ctx) {
int option_1;
int option_2;
int option_3;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, 1, -1, -1, "01234567", 0, 13, 13, 1, "ISO 18004 Figure 2 (and I.2) (mask 01)",
@ -6359,7 +6359,7 @@ static void test_microqr_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_MICROQR, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -6420,12 +6420,12 @@ static void test_microqr_perf(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_MICROQR, UNICODE_MODE, 1, 1, "12345", 0, 11, 11, "Max 5 numbers, M1" },
@ -6456,7 +6456,7 @@ static void test_microqr_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
@ -6486,10 +6486,10 @@ static void test_upnqr_input(const testCtx *const p_ctx) {
struct item {
int input_mode;
char *data;
const char *data;
int ret;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
/* Ą U+0104 in ISO 8859-2 0xA1, in other ISO 8859 and Win 1250, UTF-8 C484 */
/* Ŕ U+0154 in ISO 8859-2 0xC0, in Win 1250 but not other ISO 8859 or Win page, UTF-8 C594 */
@ -6532,7 +6532,7 @@ static void test_upnqr_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_UPNQR, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
assert_equal(symbol->eci, 4, "i:%d ZBarcode_Encode symbol->eci %d != 4\n", i, symbol->eci);
@ -6574,13 +6574,13 @@ static void test_upnqr_encode(const testCtx *const p_ctx) {
int option_1;
int option_2;
int option_3;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* https://www.upn-qr.si/uploads/files/Tehnicni standard UPN QR.pdf */
@ -7084,7 +7084,7 @@ static void test_upnqr_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_UPNQR, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -7146,7 +7146,7 @@ static void test_rmqr_large(const testCtx *const p_ctx) {
struct item {
int option_1;
int option_2;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
@ -7696,7 +7696,7 @@ static void test_rmqr_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_RMQR, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, data[i].option_2, ZINT_FULL_MULTIBYTE, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
@ -7713,7 +7713,7 @@ static void test_rmqr_large(const testCtx *const p_ctx) {
}
symbol->input_mode |= FAST_MODE;
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -7748,14 +7748,14 @@ static void test_rmqr_options(const testCtx *const p_ctx) {
int eci;
int option_1;
int option_2;
char *data;
const char *data;
int ret_encode;
int ret_vector;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
int zxingcpp_cmp;
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -7853,7 +7853,7 @@ static void test_rmqr_options(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_RMQR, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -7897,13 +7897,13 @@ static void test_rmqr_input(const testCtx *const p_ctx) {
int option_1;
int option_2;
int option_3;
char *data;
const char *data;
int ret;
int expected_eci;
char *expected;
const char *expected;
int bwipp_cmp;
int zxingcpp_cmp;
char *comment;
const char *comment;
};
/* See test_qr_input() for details about test characters */
static const struct item data[] = {
@ -8049,7 +8049,7 @@ static void test_rmqr_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_RMQR, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -8109,10 +8109,10 @@ static void test_rmqr_gs1(const testCtx *const p_ctx) {
struct item {
int input_mode;
char *data;
const char *data;
int ret;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { GS1_MODE, "[01]12345678901231", 0, "A6 00 59 D5 1B EF 43 D8 80 EC 11 EC", "N16" },
@ -8152,7 +8152,7 @@ static void test_rmqr_gs1(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_RMQR, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -8189,11 +8189,11 @@ static void test_rmqr_optimize(const testCtx *const p_ctx) {
int input_mode;
int option_1;
int option_2;
char *data;
const char *data;
int ret;
char *expected;
const char *expected;
int bwipp_cmp;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, 4, 11, "1", 0, "22 20 EC 11 EC", 1, "N1" },
@ -8243,7 +8243,7 @@ static void test_rmqr_optimize(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_RMQR, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, ZINT_FULL_MULTIBYTE, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -8296,14 +8296,14 @@ static void test_rmqr_encode(const testCtx *const p_ctx) {
int option_1;
int option_2;
int option_3;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* ISO/IEC 23941:2022 */
static const struct item data[] = {
@ -8709,7 +8709,7 @@ static void test_rmqr_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_RMQR, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -8775,8 +8775,8 @@ static void test_rmqr_encode_segs(const testCtx *const p_ctx) {
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, 2, 11, -1, { { TU(""), -1, 0 }, { TU("Ж"), -1, 7 }, { TU(""), 0, 0 } }, 0, 11, 27, 1, "Standard example",
@ -8973,11 +8973,11 @@ static void test_fuzz(const testCtx *const p_ctx) {
int option_1;
int option_2;
int option_3;
char *data;
const char *data;
int length;
int ret;
int bwipp_cmp;
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -9000,7 +9000,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, data[i].eci, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
ZBarcode_Delete(symbol);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -46,10 +46,10 @@ static void test_options(const testCtx *const p_ctx) {
struct item {
int symbology;
char *fgcolour;
char *bgcolour;
const char *fgcolour;
const char *bgcolour;
int rotate_angle;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
@ -112,8 +112,8 @@ static void test_buffer(const testCtx *const p_ctx) {
struct item {
int symbology;
int output_options;
char *data;
char *composite;
const char *data;
const char *composite;
float expected_height;
int expected_rows;
@ -391,7 +391,7 @@ static void test_buffer(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
testStartSymbol("test_buffer", &symbol);
@ -410,7 +410,7 @@ static void test_buffer(const testCtx *const p_ctx) {
}
length = testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, -1, -1, data[i].output_options, text, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
ret = ZBarcode_Buffer(symbol, 0);
@ -447,7 +447,7 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
int symbology;
int show_hrt; /* Using -1 in data as show_hrt, 1 in data as show_hrt but empty space */
int output_options;
char *data;
const char *data;
int ret;
float expected_height;
@ -626,7 +626,7 @@ static void test_row_separator(const testCtx *const p_ctx) {
int border_width;
int option_1;
int option_3;
char *data;
const char *data;
int ret;
float expected_height;
@ -713,8 +713,8 @@ static void test_stacking(const testCtx *const p_ctx) {
int output_options;
int option_1;
int option_3;
char *data;
char *data2;
const char *data;
const char *data2;
float expected_height;
int expected_rows;
@ -748,11 +748,11 @@ static void test_stacking(const testCtx *const p_ctx) {
assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, -1, data[i].option_3, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ret %d != zero\n", i, ret);
length2 = (int) strlen(data[i].data2);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data2, length2);
ret = ZBarcode_Encode(symbol, TCU(data[i].data2), length2);
assert_zero(ret, "i:%d ret %d != zero\n", i, ret);
ret = ZBarcode_Buffer(symbol, 0);
@ -806,13 +806,13 @@ static void test_stacking_too_many(const testCtx *const p_ctx) {
for (i = 0; i < 200; i++) {
length = testUtilSetSymbol(symbol, BARCODE_CODE128, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1, data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data, length);
ret = ZBarcode_Encode(symbol, TCU(data), length);
assert_zero(ret, "i:%d ret %d != zero\n", i, ret);
}
assert_equal(symbol->rows, 200, "symbol->rows %d != 200\n", symbol->rows);
length = testUtilSetSymbol(symbol, BARCODE_CODE128, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1, data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data, length);
ret = ZBarcode_Encode(symbol, TCU(data), length);
assert_equal(ret, ZINT_ERROR_TOO_LONG, "ret %d != ZINT_ERROR_TOO_LONG\n", ret);
assert_zero(strcmp(symbol->errtxt, expected_errtxt), "symbol->errtxt(%s) != expected_errtxt(%s)\n", symbol->errtxt, expected_errtxt);
@ -832,7 +832,7 @@ static void test_output_options(const testCtx *const p_ctx) {
int output_options;
int rotate_angle;
float scale;
char *data;
const char *data;
int ret;
float expected_height;
@ -970,7 +970,7 @@ static void test_output_options(const testCtx *const p_ctx) {
symbol->scale = data[i].scale;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
ret = ZBarcode_Buffer(symbol, data[i].rotate_angle);
@ -1013,8 +1013,8 @@ static void test_draw_string_wrap(const testCtx *const p_ctx) {
struct item {
int symbology;
int output_options;
char *data;
char *text;
const char *data;
const char *text;
float expected_height;
int expected_rows;
@ -1046,7 +1046,7 @@ static void test_draw_string_wrap(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 (%s)\n", i, data[i].symbology, ret, symbol->errtxt);
/* Cheat by overwriting text */
@ -1088,7 +1088,7 @@ static void test_code128_utf8(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
float expected_height;
int expected_rows;
@ -1119,7 +1119,7 @@ static void test_code128_utf8(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_CODE128, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, BARCODE_CODE128, ret, symbol->errtxt);
ret = ZBarcode_Buffer(symbol, 0);
@ -1163,8 +1163,8 @@ static void test_scale(const testCtx *const p_ctx) {
int output_options;
float height;
float scale;
char *data;
char *composite;
const char *data;
const char *composite;
int ret_raster;
float expected_height;
@ -1271,7 +1271,7 @@ static void test_scale(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
testStartSymbol("test_scale", &symbol);
@ -1300,7 +1300,7 @@ static void test_scale(const testCtx *const p_ctx) {
}
length = testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, data[i].output_options, text, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_nonzero(ret < ZINT_ERROR, "i:%d ZBarcode_Encode(%s) ret %d >= ZINT_ERROR (%s)\n",
i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
@ -1353,7 +1353,7 @@ static void test_guard_descent(const testCtx *const p_ctx) {
struct item {
int symbology;
float guard_descent;
char *data;
const char *data;
int ret_raster;
float expected_height;
@ -1423,7 +1423,7 @@ static void test_guard_descent(const testCtx *const p_ctx) {
symbol->guard_descent = data[i].guard_descent;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 (%s)\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer(symbol, 0);
@ -1474,8 +1474,8 @@ static void test_quiet_zones(const testCtx *const p_ctx) {
int option_1;
int option_2;
int show_hrt;
char *data;
char *composite;
const char *data;
const char *composite;
int ret_raster;
float expected_height;
@ -1830,7 +1830,7 @@ static void test_quiet_zones(const testCtx *const p_ctx) {
text = data[i].data;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 (%s)\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer(symbol, 0);
@ -1893,8 +1893,8 @@ static void test_text_gap(const testCtx *const p_ctx) {
int show_hrt;
float text_gap;
float scale;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
float expected_height;
@ -2002,7 +2002,7 @@ static void test_text_gap(const testCtx *const p_ctx) {
}
length = testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, data[i].output_options, text, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 (%s)\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer(symbol, 0);
@ -2058,9 +2058,9 @@ static void test_buffer_plot(const testCtx *const p_ctx) {
int whitespace_width;
int output_options;
float height;
char *fgcolour;
char *bgcolour;
char *data;
const char *fgcolour;
const char *bgcolour;
const char *data;
int ret;
float expected_height;
@ -2068,7 +2068,7 @@ static void test_buffer_plot(const testCtx *const p_ctx) {
int expected_width;
int expected_bitmap_width;
int expected_bitmap_height;
char *expected_bitmap;
const char *expected_bitmap;
};
static const struct item data[] = {
/* 0*/ { BARCODE_PDF417, 0, 1, -1, -1, 15, "", "", "1", 0, 16, 4, 86, 86, 16,
@ -2196,7 +2196,7 @@ static void test_buffer_plot(const testCtx *const p_ctx) {
symbol->show_hrt = 0;
symbol->scale = 0.5f;
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%s) ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt);
ret = ZBarcode_Buffer(symbol, 0);
@ -2247,8 +2247,8 @@ static void test_height(const testCtx *const p_ctx) {
int symbology;
int output_options;
float height;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
float expected_height;
@ -2256,7 +2256,7 @@ static void test_height(const testCtx *const p_ctx) {
int expected_width;
int expected_bitmap_width;
int expected_bitmap_height;
char *expected_errtxt;
const char *expected_errtxt;
const char *comment;
};
@ -2882,7 +2882,7 @@ static void test_height(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
testStartSymbol("test_height", &symbol);
@ -2912,7 +2912,7 @@ static void test_height(const testCtx *const p_ctx) {
}
length = (int) strlen(text);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%s) ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt);
ret = ZBarcode_Buffer(symbol, 0);
@ -2954,8 +2954,8 @@ static void test_height_per_row(const testCtx *const p_ctx) {
int option_3;
float height;
float scale;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
float expected_height;
@ -3048,7 +3048,7 @@ static void test_height_per_row(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
testStartSymbol("test_height_per_row", &symbol);
@ -3075,7 +3075,7 @@ static void test_height_per_row(const testCtx *const p_ctx) {
}
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, text, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%s) ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt);
ret = ZBarcode_Buffer(symbol, 0);
@ -3125,12 +3125,12 @@ static void test_perf_scale(const testCtx *const p_ctx) {
int option_2;
float height;
float scale;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, 0, 1.3,
@ -3183,7 +3183,7 @@ static void test_perf_scale(const testCtx *const p_ctx) {
}
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -36,13 +36,13 @@ static void test_binary_div_modulo_divisor(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
float w;
float h;
int expected_rows;
int expected_width;
char *expected;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_DBAR_OMN, "1234567890123", 100, 30, 1, 96, "010111010010000001001110000000010100001011111010110100011001100101111111110001011011000111000101" },
@ -121,7 +121,7 @@ static void test_binary_div_modulo_divisor(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
char escaped[1024];
char cmp_buf[1024];
@ -147,7 +147,7 @@ static void test_binary_div_modulo_divisor(const testCtx *const p_ctx) {
}
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, text, -1, debug);
ret = ZBarcode_Encode(symbol, (const unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
if (p_ctx->generate) {
@ -202,14 +202,14 @@ static void test_examples(const testCtx *const p_ctx) {
int input_mode;
int option_2;
int option_3;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* Verified manually against GS1 General Specifications 21.0.1 (GGS) and ISO/IEC 24724:2011, and verified via bwipp_dump.ps against BWIPP */
static const struct item data[] = {
@ -883,7 +883,7 @@ static void test_examples(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -939,12 +939,12 @@ static void test_general_field(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* Verified via bwipp_dump.ps against BWIPP and manually against tec-it.com (some separators differ from tec-it.com where noted) */
static const struct item data[] = {
@ -1210,7 +1210,7 @@ static void test_general_field(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
if (p_ctx->generate) {
@ -1239,13 +1239,13 @@ static void test_binary_buffer_size(const testCtx *const p_ctx) {
struct item {
int input_mode;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
char *comment;
const char *expected_errtxt;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { -1, "[91]1", 0, 1, 102, "", "Minimum digit" },
@ -1276,7 +1276,7 @@ static void test_binary_buffer_size(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_DBAR_EXP, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
@ -1302,10 +1302,10 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
char *data;
const char *data;
int ret;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -1334,7 +1334,7 @@ static void test_hrt(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, data[i].ret, ret, symbol->errtxt);
assert_zero(strcmp((const char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -1353,11 +1353,11 @@ static void test_input(const testCtx *const p_ctx) {
int input_mode;
int option_2;
int option_3;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -1488,7 +1488,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, data[i].option_3, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (const unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -176,12 +176,12 @@ static void test_u_sjis_int(const testCtx *const p_ctx) {
static void test_sjis_utf8(const testCtx *const p_ctx) {
struct item {
char *data;
const char *data;
int length;
int ret;
int ret_length;
unsigned int expected_jisdata[20];
char *comment;
const char *comment;
};
/*
é U+00E9 in ISO 8859-1 plus other ISO 8859 (but not in ISO 8859-7 or ISO 8859-11), Win 1250 plus other Win, not in Shift JIS, UTF-8 C3A9
@ -241,12 +241,12 @@ static void test_sjis_utf8_to_eci(const testCtx *const p_ctx) {
struct item {
int eci;
int full_multibyte;
char *data;
const char *data;
int length;
int ret;
int ret_length;
unsigned int expected_jisdata[20];
char *comment;
const char *comment;
};
/*
é U+00E9 in ISO 8859-1 0xE9, Win 1250 plus other Win, in QR Kanji mode first byte range 0x81..9F, 0xE0..EB
@ -332,12 +332,12 @@ static void test_sjis_cpy(const testCtx *const p_ctx) {
struct item {
int full_multibyte;
char *data;
const char *data;
int length;
int ret;
int ret_length;
unsigned int expected_jisdata[20];
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -385,10 +385,10 @@ static void test_perf(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int ret;
char *comment;
const char *comment;
};
struct item data[] = {
/* 0*/ { "1234567890", 0, "10 numerics" },

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -47,14 +47,14 @@ static void test_print(const testCtx *const p_ctx) {
int option_2;
int option_3;
float height;
char *fgcolour;
char *bgcolour;
const char *fgcolour;
const char *bgcolour;
int rotate_angle;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
char *expected_file;
char *comment;
const char *expected_file;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODE128, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "<>\"&'", "", 0, "code128_amperands.svg", "" },
@ -150,7 +150,7 @@ static void test_print(const testCtx *const p_ctx) {
char expected_file[1024];
char escaped[1024];
int escaped_size = 1024;
char *text;
const char *text;
int have_libreoffice = 0;
int have_vnu = 0;
@ -209,7 +209,7 @@ static void test_print(const testCtx *const p_ctx) {
}
text_length = (int) strlen(text);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, text_length);
ret = ZBarcode_Encode(symbol, TCU(text), text_length);
assert_equal(ret, data[i].ret, "i:%d %s ZBarcode_Encode ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt);
strcpy(symbol->outfile, svg);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -36,12 +36,12 @@ static void test_large(const testCtx *const p_ctx) {
struct item {
int symbology;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -70,7 +70,7 @@ static void test_large(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -91,10 +91,10 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int length;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -122,7 +122,7 @@ static void test_hrt(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_zero(strcmp((char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -138,12 +138,12 @@ static void test_input(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -172,7 +172,7 @@ static void test_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -197,14 +197,14 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int length;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_TELEPEN, "1A", -1, 0, 1, 80, "Telepen BSiH Example, same",
@ -259,7 +259,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -301,7 +301,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int length;
int ret;
};
@ -335,7 +335,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
ZBarcode_Delete(symbol);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -41,7 +41,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
struct item {
int width;
int height;
char *pattern;
const char *pattern;
int repeat;
int no_identify; /* identify fails for some valid TIFFs (eg. RGB with LZW and large rows) */
int ret;
@ -91,7 +91,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) {
int i, ret;
struct zint_symbol *symbol = NULL;
char *tif = "out.tif";
const char *tif = "out.tif";
char data_buf[ZINT_MAX_DATA_LEN * 2 + 1];
@ -172,12 +172,12 @@ static void test_print(const testCtx *const p_ctx) {
int option_2;
int height;
float scale;
char *fgcolour;
char *bgcolour;
char *data;
char *composite;
char *expected_file;
char *comment;
const char *fgcolour;
const char *bgcolour;
const char *data;
const char *composite;
const char *expected_file;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { BARCODE_CODE128, -1, -1, -1, 1, -1, -1, -1, -1, 0, 0, "112233", "EEDDCC", "A", "", "code128_fgbg.tif", "" },
@ -216,7 +216,7 @@ static void test_print(const testCtx *const p_ctx) {
int escaped_size = 1024;
unsigned char filebuf[32768];
int filebuf_size;
char *text;
const char *text;
int have_tiffinfo = testUtilHaveTiffInfo();
const char *const have_identify = testUtilHaveIdentify();
@ -273,7 +273,7 @@ static void test_print(const testCtx *const p_ctx) {
}
text_length = (int) strlen(text);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, text_length);
ret = ZBarcode_Encode(symbol, TCU(text), text_length);
assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt);
strcpy(symbol->outfile, tif);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -38,12 +38,12 @@ static void test_large(const testCtx *const p_ctx) {
int option_1;
int option_3;
struct zint_structapp structapp;
char *pattern;
const char *pattern;
int length;
int ret;
int expected_rows;
int expected_width;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -109,7 +109,7 @@ static void test_large(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length);
ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -132,12 +132,12 @@ static void test_reader_init(const testCtx *const p_ctx) {
int input_mode;
int output_options;
int option_3;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, READER_INIT, 0, "A", 0, 13, 14, "(3) 257 269 65", "8-bit FNC3 A" },
@ -162,7 +162,7 @@ static void test_reader_init(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_ULTRA, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1 /*option_2*/, data[i].option_3, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -195,10 +195,10 @@ static void test_input(const testCtx *const p_ctx) {
int option_2;
int option_3;
struct zint_structapp structapp;
char *data;
const char *data;
int ret;
char *expected;
char *comment;
const char *expected;
const char *comment;
};
static const struct item data[] = {
/* 0*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 0, "" }, "A", 0, "(2) 257 65", "Default (Revision 1)" },
@ -293,7 +293,7 @@ static void test_input(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -322,14 +322,14 @@ static void test_encode(const testCtx *const p_ctx) {
int option_2;
int option_3;
struct zint_structapp structapp;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* Based on AIMD/TSC15032-43 (v 0.99c), with values updated from BWIPP update 2021-07-14
https://github.com/bwipp/postscriptbarcode/commit/4255810845fa8d45c6192dd30aee1fdad1aaf0cc
@ -804,7 +804,7 @@ static void test_encode(const testCtx *const p_ctx) {
symbol->structapp = data[i].structapp;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -861,8 +861,8 @@ static void test_encode_segs(const testCtx *const p_ctx) {
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
/* Based on AIMD/TSC15032-43 (v 0.99c), with values updated from BWIPP update 2021-07-14
https://github.com/bwipp/postscriptbarcode/commit/4255810845fa8d45c6192dd30aee1fdad1aaf0cc

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -36,10 +36,10 @@ static void test_upce_input(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int ret;
char *hrt;
const char *hrt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -116,7 +116,7 @@ static void test_upce_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (ret < ZINT_ERROR) {
@ -155,7 +155,7 @@ static void test_upca_print(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int ret;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
@ -177,7 +177,7 @@ static void test_upca_print(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
strcpy(symbol->outfile, "out.gif");
@ -197,9 +197,9 @@ static void test_upca_input(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int ret;
char *expected_errtxt;
const char *expected_errtxt;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -297,7 +297,7 @@ static void test_upca_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
@ -312,10 +312,10 @@ static void test_eanx_input(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int ret;
char *ret_errtxt;
char *comment;
const char *ret_errtxt;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -469,7 +469,7 @@ static void test_eanx_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
if (p_ctx->generate) {
printf(" /*%3d*/ { %s, \"%s\", %s, \"%s\", \"%s\" },\n",
@ -491,11 +491,11 @@ static void test_isbn_input(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
char *data;
const char *data;
int ret_encode;
int ret_vector;
char *ret_errtxt;
char *comment;
const char *ret_errtxt;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -622,7 +622,7 @@ static void test_isbn_input(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, BARCODE_ISBNX, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
if (p_ctx->generate) {
printf(" /*%3d*/ { \"%s\", %s, %d, \"%s\", \"%s\" },\n",
@ -650,9 +650,9 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int ret;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -729,7 +729,7 @@ static void test_hrt(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
assert_zero(strcmp((const char *) symbol->text, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->text, data[i].expected);
@ -745,7 +745,7 @@ static void test_vector_same(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int ret_encode;
int ret_vector;
};
@ -773,7 +773,7 @@ static void test_vector_same(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);
@ -808,13 +808,13 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
char *expected;
const char *comment;
const char *expected;
};
static const struct item data[] = {
/* 0*/ { BARCODE_UPCA, -1, "01234567890", 0, 1, 95, "GGS Figure 5.1-1 UPC-A (also Figure 5.2.2.3-1., 5.2.6.6-2., 6.4.9-1. and BS EN 797:1996 Figure 3)",
@ -948,7 +948,7 @@ static void test_encode(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
@ -1000,7 +1000,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int length;
int ret;
};
@ -1033,7 +1033,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
ZBarcode_Delete(symbol);
@ -1055,12 +1055,12 @@ static void test_perf(const testCtx *const p_ctx) {
struct item {
int symbology;
int option_2;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
char *comment;
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
@ -1108,7 +1108,7 @@ static void test_perf(const testCtx *const p_ctx) {
length = testUtilSetSymbol(symbol, data[i].symbology, DATA_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
start = clock();
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
diff_encode += clock() - start;
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -478,10 +478,10 @@ static void test_options(const testCtx *const p_ctx) {
struct item {
int symbology;
char *fgcolour;
char *bgcolour;
const char *fgcolour;
const char *bgcolour;
int rotate_angle;
char *data;
const char *data;
int ret;
int expected_rows;
int expected_width;
@ -541,8 +541,8 @@ static void test_buffer_vector(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
char *composite;
const char *data;
const char *composite;
float expected_height;
int expected_rows;
@ -688,7 +688,7 @@ static void test_buffer_vector(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
char errmsg[128];
testStartSymbol("test_buffer_vector", &symbol);
@ -712,7 +712,7 @@ static void test_buffer_vector(const testCtx *const p_ctx) {
}
length = (int) strlen(text);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);
@ -750,8 +750,8 @@ static void test_has_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
char *composite;
const char *data;
const char *composite;
};
struct item data[] = {
/* 0*/ { BARCODE_CODE11, "1234567890", "" },
@ -857,7 +857,7 @@ static void test_has_hrt(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
char errmsg[128];
testStartSymbol("test_has_hrt", &symbol);
@ -881,7 +881,7 @@ static void test_has_hrt(const testCtx *const p_ctx) {
}
length = (int) strlen(text);
ret = ZBarcode_Encode_and_Buffer_Vector(symbol, (unsigned char *) text, length, 0);
ret = ZBarcode_Encode_and_Buffer_Vector(symbol, (const unsigned char *) text, length, 0);
assert_zero(ret, "i:%d ZBarcode_Encode_and_Buffer_Vector(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt);
assert_nonnull(symbol->vector, "i:%d ZBarcode_Encode_and_Buffer_Vector(%d) vector NULL\n", i, data[i].symbology);
@ -901,7 +901,7 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
int symbology;
int show_hrt;
int output_options;
char *data;
const char *data;
int ret;
float expected_height;
@ -1005,7 +1005,7 @@ static void test_upcean_hrt(const testCtx *const p_ctx) {
length = (int) strlen(data[i].data);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);
@ -1061,7 +1061,7 @@ static void test_row_separator(const testCtx *const p_ctx) {
int border_width;
int option_1;
int option_3;
char *data;
const char *data;
int ret;
float expected_height;
@ -1103,7 +1103,7 @@ static void test_row_separator(const testCtx *const p_ctx) {
symbol->border_width = data[i].border_width;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);
@ -1131,8 +1131,8 @@ static void test_stacking(const testCtx *const p_ctx) {
int output_options;
int option_1;
int option_3;
char *data;
char *data2;
const char *data;
const char *data2;
float expected_height;
int expected_rows;
@ -1166,11 +1166,11 @@ static void test_stacking(const testCtx *const p_ctx) {
assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, data[i].option_1, -1, data[i].option_3, data[i].output_options, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ret %d != zero\n", i, ret);
length2 = (int) strlen(data[i].data2);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data2, length2);
ret = ZBarcode_Encode(symbol, TCU(data[i].data2), length2);
assert_zero(ret, "i:%d ret %d != zero\n", i, ret);
ret = ZBarcode_Buffer(symbol, 0);
@ -1213,7 +1213,7 @@ static void test_output_options(const testCtx *const p_ctx) {
int whitespace_height;
int border_width;
int output_options;
char *data;
const char *data;
int ret;
float expected_height;
@ -1311,7 +1311,7 @@ static void test_output_options(const testCtx *const p_ctx) {
symbol->border_width = data[i].border_width;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);
@ -1355,7 +1355,7 @@ static void test_noncomposite_string_x(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int expected_width;
float expected_string_x;
@ -1385,7 +1385,7 @@ static void test_noncomposite_string_x(const testCtx *const p_ctx) {
length = (int) strlen(data[i].data);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);
@ -1409,7 +1409,7 @@ static void test_upcean_whitespace_width(const testCtx *const p_ctx) {
struct item {
int symbology;
char *data;
const char *data;
int whitespace_width;
int expected_width;
@ -1447,7 +1447,7 @@ static void test_upcean_whitespace_width(const testCtx *const p_ctx) {
length = (int) strlen(data[i].data);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);
@ -1486,8 +1486,8 @@ static void test_scale(const testCtx *const p_ctx) {
int output_options;
float height;
float scale;
char *data;
char *composite;
const char *data;
const char *composite;
int ret_vector;
float expected_height;
@ -1515,7 +1515,7 @@ static void test_scale(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
struct zint_vector_rect *rect;
testStartSymbol("test_scale", &symbol);
@ -1545,7 +1545,7 @@ static void test_scale(const testCtx *const p_ctx) {
}
length = (int) strlen(text);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_nonzero(ret < ZINT_ERROR, "i:%d ZBarcode_Encode(%d) ret %d >= ZINT_ERROR (%s)\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);
@ -1588,7 +1588,7 @@ static void test_guard_descent(const testCtx *const p_ctx) {
struct item {
int symbology;
float guard_descent;
char *data;
const char *data;
int ret;
float expected_height;
@ -1658,7 +1658,7 @@ static void test_guard_descent(const testCtx *const p_ctx) {
symbol->guard_descent = data[i].guard_descent;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);
@ -1701,8 +1701,8 @@ static void test_quiet_zones(const testCtx *const p_ctx) {
int option_1;
int option_2;
int show_hrt;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
float expected_height;
@ -2048,7 +2048,7 @@ static void test_quiet_zones(const testCtx *const p_ctx) {
text = data[i].data;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);
@ -2099,8 +2099,8 @@ static void test_text_gap(const testCtx *const p_ctx) {
int show_hrt;
float text_gap;
float scale;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
float expected_height;
@ -2211,7 +2211,7 @@ static void test_text_gap(const testCtx *const p_ctx) {
}
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, data[i].output_options, text, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);
@ -2258,8 +2258,8 @@ static void test_height(const testCtx *const p_ctx) {
int symbology;
int output_options;
float height;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
float expected_height;
@ -2892,7 +2892,7 @@ static void test_height(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
testStartSymbol("test_height", &symbol);
@ -2922,7 +2922,7 @@ static void test_height(const testCtx *const p_ctx) {
}
length = (int) strlen(text);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%s) ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);
@ -2961,8 +2961,8 @@ static void test_height_per_row(const testCtx *const p_ctx) {
int option_3;
float height;
float scale;
char *data;
char *composite;
const char *data;
const char *composite;
int ret;
float expected_height;
@ -3055,7 +3055,7 @@ static void test_height_per_row(const testCtx *const p_ctx) {
int i, length, ret;
struct zint_symbol *symbol = NULL;
char *text;
const char *text;
testStartSymbol("test_height_per_row", &symbol);
@ -3082,7 +3082,7 @@ static void test_height_per_row(const testCtx *const p_ctx) {
}
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, text, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) text, length);
ret = ZBarcode_Encode(symbol, TCU(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%s) ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);

View file

@ -287,7 +287,7 @@ static int validate_int_range(const char src[], int *p_val, int *p_val_end) {
/* Begin test program, parse args */
void testRun(int argc, char *argv[], testFunction funcs[], int funcs_size) {
int i, ran;
char *optarg;
char *opt_arg;
char *func = NULL;
char func_buf[256 + 5];
char *func_not = NULL;
@ -324,8 +324,8 @@ void testRun(int argc, char *argv[], testFunction funcs[], int funcs_size) {
fprintf(stderr, "***testRun: -d debug value missing, ignoring***\n");
} else {
int d; /* Allow multiple debug flags, OR-ing */
optarg = argv[++i];
if (!validate_int(optarg, &d)) {
opt_arg = argv[++i];
if (!validate_int(opt_arg, &d)) {
fprintf(stderr, "***testRun: -d debug value invalid, ignoring***\n");
} else {
ctx.debug |= d;
@ -335,13 +335,13 @@ void testRun(int argc, char *argv[], testFunction funcs[], int funcs_size) {
if (i + 1 == argc) {
fprintf(stderr, "***testRun: -f func value missing, ignoring***\n");
} else {
optarg = argv[++i];
if (strlen(optarg) < 256) {
if (strncmp(optarg, "test_", 5) == 0) {
strcpy(func_buf, optarg);
opt_arg = argv[++i];
if (strlen(opt_arg) < 256) {
if (strncmp(opt_arg, "test_", 5) == 0) {
strcpy(func_buf, opt_arg);
} else {
strcpy(func_buf, "test_");
strcat(func_buf, optarg);
strcat(func_buf, opt_arg);
}
func = func_buf;
} else {
@ -353,13 +353,13 @@ void testRun(int argc, char *argv[], testFunction funcs[], int funcs_size) {
if (i + 1 == argc) {
fprintf(stderr, "***testRun: -n func exclude value missing, ignoring***\n");
} else {
optarg = argv[++i];
if (strlen(optarg) < 256) {
if (strncmp(optarg, "test_", 5) == 0) {
strcpy(func_not_buf, optarg);
opt_arg = argv[++i];
if (strlen(opt_arg) < 256) {
if (strncmp(opt_arg, "test_", 5) == 0) {
strcpy(func_not_buf, opt_arg);
} else {
strcpy(func_not_buf, "test_");
strcat(func_not_buf, optarg);
strcat(func_not_buf, opt_arg);
}
func_not = func_not_buf;
} else {
@ -379,8 +379,8 @@ void testRun(int argc, char *argv[], testFunction funcs[], int funcs_size) {
if (i + 1 == argc) {
fprintf(stderr, "***testRun: -i index value missing, ignoring***\n");
} else {
optarg = argv[++i];
if (!validate_int_range(optarg, &ctx.index, &ctx.index_end)) {
opt_arg = argv[++i];
if (!validate_int_range(opt_arg, &ctx.index, &ctx.index_end)) {
fprintf(stderr, "***testRun: -i index value invalid, ignoring***\n");
ctx.index = ctx.index_end = -1;
}
@ -389,10 +389,10 @@ void testRun(int argc, char *argv[], testFunction funcs[], int funcs_size) {
if (i + 1 == argc) {
fprintf(stderr, "***testRun: -x exclude value missing, ignoring***\n");
} else {
optarg = argv[++i];
opt_arg = argv[++i];
if (exclude_idx + 1 == ZINT_TEST_CTX_EXC_MAX) {
fprintf(stderr, "***testRun: too many -x exclude values, ignoring***\n");
} else if (!validate_int_range(optarg, &ctx.exclude[exclude_idx], &ctx.exclude_end[exclude_idx])) {
} else if (!validate_int_range(opt_arg, &ctx.exclude[exclude_idx], &ctx.exclude_end[exclude_idx])) {
fprintf(stderr, "***testRun: -x exclude value invalid, ignoring***\n");
ctx.exclude[exclude_idx] = ctx.exclude_end[exclude_idx] = -1;
} else {

View file

@ -66,7 +66,6 @@ extern int pclose(FILE *stream);
#endif
#if defined(__GNUC__)
# pragma GCC diagnostic ignored "-Wpedantic"
# pragma GCC diagnostic ignored "-Woverlength-strings"
#elif defined(_MSC_VER)
# pragma warning(disable: 4305) /* truncation from 'double' to 'float' */
@ -82,8 +81,8 @@ extern const char *testAssertFilename;
#define testStart(name) (testStartReal("", name, NULL))
#define testStartSymbol(name, pp_symbol) (testStartReal("", name, pp_symbol))
#else
#define testStart(name) (testStartReal(__func__, name, NULL))
#define testStartSymbol(name, pp_symbol) (testStartReal(__func__, name, pp_symbol))
#define testStart(name) (ZEXT testStartReal(__func__, name, NULL))
#define testStartSymbol(name, pp_symbol) (ZEXT testStartReal(__func__, name, pp_symbol))
#endif
void testStartReal(const char *func, const char *name, struct zint_symbol **pp_symbol);
void testFinish(void);
@ -130,6 +129,7 @@ void assert_notequal(int e1, int e2, const char *fmt, ...);
#endif
#define TU(p) ((unsigned char *) (p))
#define TCU(p) ((const unsigned char *) (p))
INTERNAL void vector_free(struct zint_symbol *symbol); /* Free vector structures */

View file

@ -1,7 +1,7 @@
/* tif.c - Aldus Tagged Image File Format support */
/*
libzint - the open source barcode library
Copyright (C) 2016-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2016-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -310,8 +310,8 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix
/* Open output file in binary mode */
if (!fm_open(fmp, symbol, "wb")) {
return errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 672, "Could not open TIF output file (%1$d: %2$s)", fmp->err,
strerror(fmp->err));
return ZEXT errtxtf(ZINT_ERROR_FILE_ACCESS, symbol, 672, "Could not open TIF output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
}
if (!output_to_stdout) {
compression = TIF_LZW;
@ -589,7 +589,7 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix
}
if (fm_error(fmp)) {
errtxtf(0, symbol, 679, "Incomplete write of TIF output (%1$d: %2$s)", fmp->err, strerror(fmp->err));
ZEXT errtxtf(0, symbol, 679, "Incomplete write of TIF output (%1$d: %2$s)", fmp->err, strerror(fmp->err));
(void) fm_close(fmp, symbol);
return ZINT_ERROR_FILE_WRITE;
}
@ -601,8 +601,8 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix
}
}
if (!fm_close(fmp, symbol)) {
return errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 981, "Failure on closing TIF output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
return ZEXT errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 981, "Failure on closing TIF output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err));
}
return 0;

View file

@ -1,7 +1,7 @@
/* ultra.c - Ultracode */
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -949,9 +949,9 @@ INTERNAL int ultra(struct zint_symbol *symbol, struct zint_seg segs[], const int
"Structured Append count '%d' out of range (2 to 8)", symbol->structapp.count);
}
if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 597,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 597,
"Structured Append index '%1$d' out of range (1 to count %2$d)",
symbol->structapp.index, symbol->structapp.count);
}
scr_cw_count = 1;
@ -1059,9 +1059,9 @@ INTERNAL int ultra(struct zint_symbol *symbol, struct zint_seg segs[], const int
total_cws = data_cw_count + qcc + 3; /* 3 == TCC pattern + RSEC pattern + QCC pattern */
if (total_cws - 3 > 282) {
static const int max_data_cws_by_ecc[6] = { 279, 266, 255, 237, 223, 205 };
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 591,
"Input too long for ECC level EC%1$d, requires %2$d codewords (maximum %3$d)",
ecc_level, data_cw_count, max_data_cws_by_ecc[ecc_level]);
return ZEXT errtxtf(ZINT_ERROR_TOO_LONG, symbol, 591,
"Input too long for ECC level EC%1$d, requires %2$d codewords (maximum %3$d)",
ecc_level, data_cw_count, max_data_cws_by_ecc[ecc_level]);
}
rows = 5;

View file

@ -1,7 +1,7 @@
/* upcean.c - Handles UPC, EAN and ISBN */
/*
libzint - the open source barcode library
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -121,8 +121,8 @@ static int upca_cc(struct zint_symbol *symbol, const unsigned char source[], int
gtin[length] = '\0';
} else {
if (source[length - 1] != gs1_check_digit(gtin, 11)) {
return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 270, "Invalid check digit '%1$c', expecting '%2$c'",
source[length - 1], gs1_check_digit(gtin, 11));
return ZEXT errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 270, "Invalid check digit '%1$c', expecting '%2$c'",
source[length - 1], gs1_check_digit(gtin, 11));
}
}
if (symbol->debug & ZINT_DEBUG_PRINT) {
@ -270,8 +270,8 @@ static int upce_cc(struct zint_symbol *symbol, unsigned char source[], int lengt
check_digit = gs1_check_digit(equivalent, 11);
if (src_check_digit && src_check_digit != check_digit) {
return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 274, "Invalid check digit '%1$c', expecting '%2$c'",
src_check_digit, check_digit);
return ZEXT errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 274, "Invalid check digit '%1$c', expecting '%2$c'",
src_check_digit, check_digit);
}
/* Use the number system and check digit information to choose a parity scheme */
@ -409,8 +409,8 @@ static int ean13_cc(struct zint_symbol *symbol, const unsigned char source[], in
gtin[length] = '\0';
} else {
if (source[length - 1] != gs1_check_digit(gtin, 12)) {
return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 275, "Invalid check digit '%1$c', expecting '%2$c'",
source[length - 1], gs1_check_digit(gtin, 12));
return ZEXT errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 275, "Invalid check digit '%1$c', expecting '%2$c'",
source[length - 1], gs1_check_digit(gtin, 12));
}
}
if (symbol->debug & ZINT_DEBUG_PRINT) {
@ -482,8 +482,8 @@ static int ean8_cc(struct zint_symbol *symbol, const unsigned char source[], int
gtin[length] = '\0';
} else {
if (source[length - 1] != gs1_check_digit(gtin, 7)) {
return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 276, "Invalid check digit '%1$c', expecting '%2$c'",
source[length - 1], gs1_check_digit(gtin, 7));
return ZEXT errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 276, "Invalid check digit '%1$c', expecting '%2$c'",
source[length - 1], gs1_check_digit(gtin, 7));
}
}
if (symbol->debug & ZINT_DEBUG_PRINT) {
@ -569,8 +569,8 @@ static int isbnx(struct zint_symbol *symbol, unsigned char source[], const int l
check_digit = gs1_check_digit(source, 12);
if (source[12] != check_digit) {
return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 280, "Invalid ISBN check digit '%1$c', expecting '%2$c'",
source[12], check_digit);
return ZEXT errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 280,
"Invalid ISBN check digit '%1$c', expecting '%2$c'", source[12], check_digit);
}
source[12] = '\0';
@ -591,9 +591,9 @@ static int isbnx(struct zint_symbol *symbol, unsigned char source[], const int l
check_digit = isbnx_check(source, 9);
if (check_digit != source[9]) {
return errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 281,
"Invalid %1$s check digit '%2$c', expecting '%3$c'", length == 9 ? "SBN" : "ISBN",
source[9], check_digit);
return ZEXT errtxtf(ZINT_ERROR_INVALID_CHECK, symbol, 281,
"Invalid %1$s check digit '%2$c', expecting '%3$c'", length == 9 ? "SBN" : "ISBN",
source[9], check_digit);
}
for (i = 11; i > 2; i--) { /* This drops the check digit */
source[i] = source[i - 3];

View file

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2021-2024 by Robin Stuart <rstuart114@gmail.com> *
* Copyright (C) 2021-2025 by Robin Stuart <rstuart114@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -446,7 +446,7 @@ private slots:
void renderTest()
{
#ifdef TESTQZINT_GUILESS
QSKIP("disabled on Linux for Qt5 > 5.15.13 & Qt6 > 6.4.2 due to memory leaks (ZINT_SANITIZE)");
QSKIP("disabled on Linux for Qt5 > 5.15.13 & Qt6 > 6.4.2 due to memory leaks (ZINT_SANITIZE)", "" /*Dummy arg to suppress -Wc++20-extensions*/);
#endif
Zint::QZint bc;

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -281,10 +281,10 @@ static void test_dump_args(const testCtx *const p_ctx) {
struct item {
int b;
char *data;
char *data2;
char *input;
char *input2;
const char *data;
const char *data2;
const char *input;
const char *input2;
int input_mode;
int output_options;
int batch;
@ -294,13 +294,13 @@ static void test_dump_args(const testCtx *const p_ctx) {
int fullmultibyte;
int mask;
int mode;
char *primary;
const char *primary;
int rows;
int secure;
int square;
int vers;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -355,8 +355,8 @@ static void test_dump_args(const testCtx *const p_ctx) {
char cmd[4096];
char buf[4096];
char *input1_filename = "test_dump_args1.txt";
char *input2_filename = "test_dump_args2.txt";
const char *input1_filename = "test_dump_args1.txt";
const char *input2_filename = "test_dump_args2.txt";
int have_input1;
int have_input2;
@ -413,14 +413,14 @@ static void test_dump_segs(const testCtx *const p_ctx) {
struct item {
int b;
char *data;
char *data_seg1;
char *data_seg2;
const char *data;
const char *data_seg1;
const char *data_seg2;
int eci;
int eci_seg1;
int eci_seg2;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -498,13 +498,13 @@ static void test_input(const testCtx *const p_ctx) {
int batch;
int input_mode;
int mirror;
char *filetype;
char *input_filename;
char *input;
char *outfile;
const char *filetype;
const char *input_filename;
const char *input;
const char *outfile;
int num_expected;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -544,14 +544,14 @@ static void test_input(const testCtx *const p_ctx) {
char cmd[4096];
char buf[4096];
char *input_filename;
char *outfile;
const char *input_filename;
const char *outfile;
testStart("test_input");
for (i = 0; i < data_size; i++) {
int j;
char *slash;
const char *slash;
if (testContinue(p_ctx, i)) continue;
#ifdef _WIN32
@ -610,9 +610,9 @@ static void test_stdin_input(const testCtx *const p_ctx) {
struct item {
int b;
char *data;
char *input;
char *outfile;
const char *data;
const char *input;
const char *outfile;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -624,7 +624,7 @@ static void test_stdin_input(const testCtx *const p_ctx) {
char cmd[4096];
char buf[4096];
char *input_filename = "-";
const char *input_filename = "-";
testStart("test_stdin_input");
@ -656,11 +656,11 @@ static void test_batch_input(const testCtx *const p_ctx) {
struct item {
int b;
char *data;
char *input;
char *input2;
const char *data;
const char *input;
const char *input2;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -674,8 +674,8 @@ static void test_batch_input(const testCtx *const p_ctx) {
char cmd[4096];
char buf[4096];
char *input1_filename = "test_batch_input1.txt";
char *input2_filename = "test_batch_input2.txt";
const char *input1_filename = "test_batch_input1.txt";
const char *input2_filename = "test_batch_input2.txt";
int have_input1;
int have_input2;
@ -717,10 +717,10 @@ static void test_batch_large(const testCtx *const p_ctx) {
struct item {
int b;
int mirror;
char *pattern;
const char *pattern;
int length;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -735,7 +735,7 @@ static void test_batch_large(const testCtx *const p_ctx) {
char data_buf[8192];
char buf[16384];
char *input_filename = "test_batch_large.txt";
const char *input_filename = "test_batch_large.txt";
int have_input;
testStart("test_batch_large");
@ -790,7 +790,7 @@ static void test_checks(const testCtx *const p_ctx) {
double dotsize;
double textgap;
int eci;
char *filetype;
const char *filetype;
double height;
double guard_descent;
int mask;
@ -805,7 +805,7 @@ static void test_checks(const testCtx *const p_ctx) {
int vwhitesp;
int w;
char *expected;
const char *expected;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
@ -1163,12 +1163,12 @@ static void test_other_opts(const testCtx *const p_ctx) {
struct item {
int b;
char *data;
const char *data;
int input_mode;
char *opt;
char *opt_data;
const char *opt;
const char *opt_data;
char *expected;
const char *expected;
int strstr_cmp;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
@ -1284,11 +1284,11 @@ static void test_combos(const testCtx *const p_ctx) {
struct item {
int b;
char *data;
char *opts;
const char *data;
const char *opts;
char *expected;
char *outfilename;
const char *expected;
const char *outfilename;
int strstr_cmp;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
@ -1334,10 +1334,10 @@ static void test_exit_status(const testCtx *const p_ctx) {
struct item {
int b;
char *data;
const char *data;
int input_mode;
char *opt;
char *opt_data;
const char *opt;
const char *opt_data;
int expected;
};

View file

@ -1,5 +1,5 @@
Harald Oehlmann
2025-01-22
2025-01-27
Why to use VC6 ?
It avoids DLL Hell as the runtime is present on all Windows Versions since XP.
@ -19,7 +19,7 @@ cd $ZR\..\zlib
nmake -f win32\Makefile.msc
-> generates zlib.lib, zlib1.dll
b) lpng (version: 1.6.44 - note 1.6.45 has non-C89 variable declaration)
b) lpng (current version: 1.6.46)
* put libpng to $ZR\..\lpng
cd $ZR\..\lpng
nmake -f scripts\makefile.vcwin32