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

general: prefix all INTERNAL funcs/tables with zint_, except

those in "backend/common.h", which are prefixed by `z_` - makes
  symbol clashes more unlikely when zint is statically linked
  (ticket #337, props Ulrich Becker)
DOTCODE: fix padding allowance (10 -> 52 - probable max 35) to
  cover cases with large no. of columns requested and little data,
  to prevent `codeword_array` buffer overflow
AZTEC/CODEONE: some code fiddling
general_field: prefix defines with `GF_`, shorten static funcs
  prefix `general_field_` -> `gf_`
This commit is contained in:
gitlost
2025-08-26 23:48:00 +01:00
parent e18b047a45
commit 39380d6767
106 changed files with 4477 additions and 4360 deletions

View File

@@ -46,7 +46,7 @@ static const char C11Table[11 + 1][6] = {
};
/* Code 11 */
INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int length) {
INTERNAL int zint_code11(struct zint_symbol *symbol, unsigned char source[], int length) {
static const unsigned char checkchrs[11] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-' };
int i;
int h;
@@ -62,15 +62,15 @@ INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int leng
assert(length > 0);
if (length > 140) { /* 8 (Start) + 140 * 8 + 2 * 8 (Check) + 7 (Stop) = 1151 */
return errtxtf(ZINT_ERROR_TOO_LONG, symbol, 320, "Input length %d too long (maximum 140)", length);
return z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 320, "Input length %d too long (maximum 140)", length);
}
if ((i = not_sane(SODIUM_MNS_F, source, length))) {
return errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 321,
if ((i = z_not_sane(SODIUM_MNS_F, source, length))) {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 321,
"Invalid character at position %d in input (digits and \"-\" only)", i);
}
if (symbol->option_2 < 0 || symbol->option_2 > 2) {
return errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 339, "Invalid check digit version '%d' (1 or 2 only)",
return z_errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 339, "Invalid check digit version '%d' (1 or 2 only)",
symbol->option_2);
}
if (symbol->option_2 == 2) {
@@ -91,7 +91,7 @@ INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int leng
if (source[i] == '-')
weight[i] = 10;
else
weight[i] = ctoi(source[i]);
weight[i] = z_ctoi(source[i]);
memcpy(d, C11Table[weight[i]], 6);
}
@@ -142,17 +142,17 @@ INTERNAL int code11(struct zint_symbol *symbol, unsigned char source[], int leng
memcpy(d, C11Table[11], 5);
d += 5;
expand(symbol, dest, d - dest);
z_expand(symbol, dest, d - dest);
/* TODO: Find documentation on BARCODE_CODE11 dimensions/height */
hrt_cpy_nochk(symbol, source, length);
z_hrt_cpy_nochk(symbol, source, length);
if (num_check_digits) {
hrt_cat_nochk(symbol, checkstr, num_check_digits);
z_hrt_cat_nochk(symbol, checkstr, num_check_digits);
}
if (raw_text && rt_cpy_cat(symbol, source, length, '\xFF' /*separator (none)*/, checkstr, num_check_digits)) {
return ZINT_ERROR_MEMORY; /* `rt_cpy_cat()` only fails with OOM */
if (raw_text && z_rt_cpy_cat(symbol, source, length, '\xFF' /*separator (none)*/, checkstr, num_check_digits)) {
return ZINT_ERROR_MEMORY; /* `z_rt_cpy_cat()` only fails with OOM */
}
return error_number;