1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-01-05 03:07:42 +00:00

AZTEC/PDF417: stripf ecc feedback (was getting 32-bit difference)

test suite: test for `arc4random_uniform()` before including
  "test_bwipp" & "test_random" in build
github/ci: try enabling Qt test for ubuntu
This commit is contained in:
gitlost
2025-05-24 02:51:18 +01:00
parent 578d3e4df9
commit 18096a25a7
6 changed files with 129 additions and 114 deletions

View File

@@ -1125,7 +1125,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int
error_number = ZEXT errtxt(ZINT_WARN_NONCOMPLIANT, symbol, 706, "Number of ECC codewords 3 at minimum");
symbol->option_1 = -1; /* Feedback options: indicate minimum 3 with -1 */
} else {
ecc_ratio = (float) (ecc_blocks - 3) / (data_blocks + ecc_blocks);
ecc_ratio = stripf((float) (ecc_blocks - 3) / (data_blocks + ecc_blocks));
if (ecc_ratio < 0.05f) {
error_number = ZEXT errtxtf(ZINT_WARN_NONCOMPLIANT, symbol, 708,
"Number of ECC codewords %1$d less than 5%% + 3 of data codewords %2$d",
@@ -1136,7 +1136,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, struct zint_seg segs[], const int
symbol->option_1 = ecc_ratio < 0.165f ? 1 : ecc_ratio < 0.295f ? 2 : ecc_ratio < 0.43f ? 3 : 4;
}
/* Feedback percentage in top byte */
symbol->option_1 |= ((int) (ecc_ratio * 100.0f)) << 8;
symbol->option_1 |= ((int) stripf(ecc_ratio * 100.0f)) << 8;
}
if (debug_print) {