1
0
mirror of https://git.code.sf.net/p/zint/code synced 2025-12-18 10:27:09 +00:00

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

@@ -58,6 +58,7 @@ INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int len
char *d = dest;
int add_checksum, count = 0, checksum = 0;
int d_chars = 0;
const int plain_hrt = symbol->output_options & BARCODE_PLAIN_HRT;
if (length > 103) { /* No stack smashing please (103 + 1) * 11 = 1144 */
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 356, "Input length %d too long (maximum 103)", length);
@@ -133,11 +134,11 @@ INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int len
(void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/);
}
ustrcpy(symbol->text, source);
if (symbol->option_2 == 2) {
symbol->text[length - 1] = CALCIUM[checksum]; /* Place before final A/B/C/D character (BS EN 798:1995 A.3) */
symbol->text[length] = source[length - 1];
symbol->text[length + 1] = '\0';
if (symbol->option_2 == 2 || (plain_hrt && add_checksum)) {
/* Place before final A/B/C/D character (BS EN 798:1995 A.3) */
hrt_printf_nochk(symbol, "%.*s%c%c", length - 1, source, CALCIUM[checksum], source[length - 1]);
} else {
hrt_cpy_nochk(symbol, source, length);
}
return error_number;