mirror of
https://git.code.sf.net/p/zint/code
synced 2026-08-01 02:49:52 +00:00
CLI: make --mirror available in standard non-batch mode via
new routines `mirror_start()`, `mirror_outfile()` & limit substitutions on Unix to backslash (Windows remains the same); restrict "borderwidth", "textgap", "vwhitesp", "whitesp" < 100 CODEONE: fix `ceilf()` -> `C1_MULT_CEIL()` in FAST_MODE encodation (improves/changes some encodation) composite: preserve `gs1_verify()` warning using `warn_level` hack; fix wrong name `zint_dbar_omnstk_set_height()` -> `zint_dbar_stk_set_height()`; use new `zint_micropdf_variant()` & `zint_micropdf_expand()` routines (see below) MICROPDF417: move variant determination into new shareable routine `zint_micropdf_variant()` & expansion into `zint_micropdf_expand()` qzint: add helper methods `setbordertypevalue()`, `encodedinputmode()`, `encodedoutputoptions()`, `ecivaluetoeciindex()` and `eciindextoecivalue()` dbar: for performance pre-calculate `combins()` as array coverage: add `malloc()`-type failure testing to AZTEC, CONTENT_SEGS, MEMORY_FILE, raster, Reed-Solomon & vector; numerous changes to remove unused code and test more branches common: add `isxdigit()` general: various code fiddlings manual: add char names to sequence and batch format char tables; mention long options can be shortened (& use "--compliantheight" -> "--compliant"); expand mirror explanation & document substitutions in footnote; workaround xecjk putting space after double quote when quoting cjk chars & rejig input mode examples; workaround html alignment bug in table gs1-enabled symbologies by adding extra rh dashes to header cols; add "figure nn: " to txt image tags via sed: various other small fixes and rephrasings
This commit is contained in:
+7
-15
@@ -1275,6 +1275,8 @@ INTERNAL int zint_dotcode(struct zint_symbol *symbol, struct zint_seg segs[], co
|
||||
min_dots = 9 * (data_length + 3 + (data_length / 2)) + 2;
|
||||
min_area = min_dots * 2;
|
||||
|
||||
assert(min_area >= 38); /* (9 * (1 + 3 + 0) + 2 = 19) * 2 */
|
||||
|
||||
if (width == 0) {
|
||||
/* Automatic sizing */
|
||||
/* Following Rule 3 (Section 5.2.2) and applying a recommended width to height ratio 3:2 */
|
||||
@@ -1286,6 +1288,8 @@ INTERNAL int zint_dotcode(struct zint_symbol *symbol, struct zint_seg segs[], co
|
||||
height = (int) h;
|
||||
width = (int) w;
|
||||
|
||||
assert(height >= 5 && width >= 7); /* 38 * 0.666 = 25.308, 38 * 1.5 = 57 */
|
||||
|
||||
if (((width + height) & 1) == 1) {
|
||||
if (width * height < min_area) {
|
||||
width++;
|
||||
@@ -1324,16 +1328,15 @@ INTERNAL int zint_dotcode(struct zint_symbol *symbol, struct zint_seg segs[], co
|
||||
height++;
|
||||
}
|
||||
}
|
||||
assert(height >= 5 && width >= 5);
|
||||
|
||||
if (debug_print) {
|
||||
printf("Width %d, Height %d\n", width, height);
|
||||
}
|
||||
|
||||
if (height > 200 || width > 200) {
|
||||
if (height > 200 && width > 200) {
|
||||
ZEXT z_errtxtf(0, symbol, 526, "Resulting symbol size '%1$dx%2$d' (HxW) is too large (maximum 200x200)",
|
||||
height, width);
|
||||
} else if (width > 200) {
|
||||
if (width > 200) {
|
||||
assert(height <= 200);
|
||||
z_errtxtf(0, symbol, 528, "Resulting symbol width '%d' is too large (maximum 200)", width);
|
||||
} else {
|
||||
z_errtxtf(0, symbol, 735, "Resulting symbol height '%d' is too large (maximum 200)", height);
|
||||
@@ -1341,17 +1344,6 @@ INTERNAL int zint_dotcode(struct zint_symbol *symbol, struct zint_seg segs[], co
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
if (height < 5 || width < 5) {
|
||||
/* Note: this branch probably no longer reached */
|
||||
assert(height >= 5 || width >= 5); /* If width < 5, min height is 19 */
|
||||
if (width < 5) {
|
||||
z_errtxtf(0, symbol, 529, "Resulting symbol width '%d' is too small (minimum 5)", width);
|
||||
} else {
|
||||
z_errtxtf(0, symbol, 736, "Resulting symbol height '%d' is too small (minimum 5)", height);
|
||||
}
|
||||
return ZINT_ERROR_INVALID_OPTION;
|
||||
}
|
||||
|
||||
n_dots = (height * width) / 2;
|
||||
|
||||
dot_stream = (char *) z_alloca(height * width * 3);
|
||||
|
||||
Reference in New Issue
Block a user