mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-15 23:54:34 -04:00
CODE128: reduce extended latch cut-off from 5 to 4 for better
encodation in certain cases (and no pessimizations found so far), props lyngklip (BWIPP); fix extended char latching when exactly 3 extended chars at end; count code set C (not digits) in loop deciding when to shift/latch to extended for better estimate AZTEC: return warning if ECC < 5% (due to bit-stuffing when version given); return error if > 22 layers (Zint 26) for Reader Initialisation symbol requested for better error message AZTEC/HANXIN/QRCODE: consolidate different ECC data size tables into one indexed by ECC DBAR_EXP: check for reduced length <= 77 up front for better error message HANXIN: use `malloc()` rather than `z_alloca()` for large binary array QRCODE: `ecc_level` now 0-based (not 1-based) MICROQR: consolidate different version end routines into one `microqr_end()` and use new `microqr_data` table to simplify code MICROPDF417: use table for max codewords per column library: centralize all error messages using new `errtxt()`, `errtxtf()`, `errtxt_adj()` funcs that protect `symbol->errtxt` from overflow, & try to make error messages more consistent thru-out, adding more feedback info to many, & use positional args "%n$" in prep for l10n (maybe); `is_sane/is_sane_lookup()` -> `not_sane/not_sane_lookup()`, returning 1-based position (zero on failure) instead of bool; `long` ints -> plain `int` (except those dealing with `ftell()`, `fread()` etc) as depend on int being 32-bits already GUI: in "grpDATF.ui" use "PlainText" rather than "RichText" for tracker ratio examples as height of text messing up sometimes manual: clarify Codablock-F length maximum & add examples docs: README: pandoc 3.5, Ubuntu 24.04 CMake: use "-Wpedantic" for Clang only as GNU complains about `errtxtf()` positional args "%n$"
This commit is contained in:
parent
752c1fae5d
commit
5e2044ff2e
104 changed files with 8102 additions and 7755 deletions
|
@ -43,7 +43,9 @@ static int vector_add_rect(struct zint_symbol *symbol, const float x, const floa
|
|||
struct zint_vector_rect *rect;
|
||||
|
||||
if (!(rect = (struct zint_vector_rect *) malloc(sizeof(struct zint_vector_rect)))) {
|
||||
strcpy(symbol->errtxt, "691: Insufficient memory for vector rectangle");
|
||||
/* NOTE: clang-tidy-20 gets confused about return value of function returning a function unfortunately,
|
||||
so put on 2 lines (see also "postal.c" `postnet_enc()` & `planet_enc()`, same issue) */
|
||||
errtxt(0, symbol, 691, "Insufficient memory for vector rectangle");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -69,8 +71,7 @@ static int vector_add_hexagon(struct zint_symbol *symbol, const float x, const f
|
|||
struct zint_vector_hexagon *hexagon;
|
||||
|
||||
if (!(hexagon = (struct zint_vector_hexagon *) malloc(sizeof(struct zint_vector_hexagon)))) {
|
||||
strcpy(symbol->errtxt, "692: Insufficient memory for vector hexagon");
|
||||
return 0;
|
||||
return errtxt(0, symbol, 692, "Insufficient memory for vector hexagon");
|
||||
}
|
||||
hexagon->next = NULL;
|
||||
hexagon->x = x;
|
||||
|
@ -93,8 +94,7 @@ static int vector_add_circle(struct zint_symbol *symbol, const float x, const fl
|
|||
struct zint_vector_circle *circle;
|
||||
|
||||
if (!(circle = (struct zint_vector_circle *) malloc(sizeof(struct zint_vector_circle)))) {
|
||||
strcpy(symbol->errtxt, "693: Insufficient memory for vector circle");
|
||||
return 0;
|
||||
return errtxt(0, symbol, 693, "Insufficient memory for vector circle");
|
||||
}
|
||||
circle->next = NULL;
|
||||
circle->x = x;
|
||||
|
@ -119,8 +119,7 @@ static int vector_add_string(struct zint_symbol *symbol, const unsigned char *te
|
|||
struct zint_vector_string *string;
|
||||
|
||||
if (!(string = (struct zint_vector_string *) malloc(sizeof(struct zint_vector_string)))) {
|
||||
strcpy(symbol->errtxt, "694: Insufficient memory for vector string");
|
||||
return 0;
|
||||
return errtxt(0, symbol, 694, "Insufficient memory for vector string");
|
||||
}
|
||||
string->next = NULL;
|
||||
string->x = x;
|
||||
|
@ -132,8 +131,7 @@ static int vector_add_string(struct zint_symbol *symbol, const unsigned char *te
|
|||
string->halign = halign;
|
||||
if (!(string->text = (unsigned char *) malloc(string->length + 1))) {
|
||||
free(string);
|
||||
strcpy(symbol->errtxt, "695: Insufficient memory for vector string text");
|
||||
return 0;
|
||||
return errtxt(0, symbol, 695, "Insufficient memory for vector string text");
|
||||
}
|
||||
memcpy(string->text, text, string->length);
|
||||
string->text[string->length] = '\0';
|
||||
|
@ -439,14 +437,12 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
|
|||
return error_number;
|
||||
}
|
||||
if (symbol->rows <= 0) {
|
||||
strcpy(symbol->errtxt, "697: No rows");
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
return errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 697, "No rows");
|
||||
}
|
||||
|
||||
/* Allocate memory */
|
||||
if (!(vector = symbol->vector = (struct zint_vector *) malloc(sizeof(struct zint_vector)))) {
|
||||
strcpy(symbol->errtxt, "696: Insufficient memory for vector header");
|
||||
return ZINT_ERROR_MEMORY;
|
||||
return errtxt(ZINT_ERROR_MEMORY, symbol, 696, "Insufficient memory for vector header");
|
||||
}
|
||||
vector->rectangles = NULL;
|
||||
vector->hexagons = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue