Add text_length (length of text) to zint_symbol, and new

`BARCODE_PLAIN_HRT` option for `output_options` - for use
  primarily by ZXing-C++ but may be generally useful;
  centralize setting of HRT using new common `hrt_cpy_nochk()` etc.
  routines to ensure `text_length` always set
PLESSEY: add show default check characters option
CODE32: ignore `option_2` (check digit options)
PZN: ignore `option_2` (check digit options) except when indicates
  PZN7 only
DPD: exclude DEL from ident tag also
out_maybe_mkdir: fix `utf8_to_wide()` return (Windows only)
general: replace use of `strcpy()` etc. (except for test suite)
  with `memcpy()`, `hrt_()` etc. in lib & `cpy_str()` etc. in CLI
  & `cpy_bytearray_left()` in backend_qt
clang-tidy: update README reflecting above
backend_tcl: use sizeof(primary) to check length; tabs -> spaces
general: various code fiddling
docs: pandoc 3.6.2 -> 3.6.3
This commit is contained in:
gitlost 2025-02-15 20:32:55 +00:00
parent ddedd00d2d
commit fef8b083b4
82 changed files with 2873 additions and 1671 deletions

View file

@ -55,8 +55,8 @@ INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int leng
int error_number = 0;
char *d = dest;
int num_check_digits;
char checkstr[3] = {0};
static const char checkchrs[11] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-' };
unsigned char checkstr[2];
static const unsigned char checkchrs[11] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-' };
/* Suppresses clang-tidy clang-analyzer-core.UndefinedBinaryOperatorResult warning */
assert(length > 0);
@ -134,7 +134,8 @@ INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int leng
}
if (symbol->debug & ZINT_DEBUG_PRINT) {
printf("Check digit (%d): %s\n", num_check_digits, num_check_digits ? checkstr : "<none>");
printf("Check digits (%d): %.*s%s\n", num_check_digits, num_check_digits, checkstr,
num_check_digits ? "" : "<none>");
}
/* Stop character */
@ -145,9 +146,9 @@ INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int leng
/* TODO: Find documentation on BARCODE_CODE11 dimensions/height */
ustrcpy(symbol->text, source);
hrt_cpy_nochk(symbol, source, length);
if (num_check_digits) {
ustrcat(symbol->text, checkstr);
hrt_cat_nochk(symbol, checkstr, num_check_digits);
}
return error_number;
}