mirror of
https://git.code.sf.net/p/zint/code
synced 2025-12-17 09:57:02 +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:
@@ -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) {
|
||||
|
||||
@@ -1681,7 +1681,7 @@ INTERNAL int micropdf417(struct zint_symbol *symbol, struct zint_seg segs[], con
|
||||
|
||||
/* Feedback options */
|
||||
/* Place in top byte, leaving bottom one for maybe future use - also compatible with AZTEC */
|
||||
symbol->option_1 = ((int) roundf(ecc_cwds * 100.0f / (longueur + ecc_cwds))) << 8;
|
||||
symbol->option_1 = ((int) stripf(roundf(stripf(ecc_cwds * 100.0f / (longueur + ecc_cwds))))) << 8;
|
||||
|
||||
if (debug_print) {
|
||||
fputs("\nChoose symbol size:\n", stdout);
|
||||
|
||||
@@ -19,6 +19,8 @@ if(NOT EXISTS ${BWIPP_PS})
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tools)
|
||||
endif()
|
||||
|
||||
check_function_exists(arc4random_uniform HAVE_ARC4RANDOM_UNIFORM)
|
||||
|
||||
set(testcommon_SRCS testcommon.c testcommon.h)
|
||||
|
||||
if(ZINT_SHARED)
|
||||
@@ -45,7 +47,9 @@ zint_add_test(aztec test_aztec)
|
||||
zint_add_test(bc412 test_bc412)
|
||||
zint_add_test(big5 test_big5)
|
||||
zint_add_test(bmp test_bmp)
|
||||
if(HAVE_ARC4RANDOM_UNIFORM)
|
||||
zint_add_test(bwipp test_bwipp)
|
||||
endif()
|
||||
zint_add_test(channel test_channel)
|
||||
zint_add_test(codabar test_codabar)
|
||||
zint_add_test(codablock test_codablock)
|
||||
@@ -90,7 +94,9 @@ zint_add_test(postal test_postal)
|
||||
zint_add_test(print test_print)
|
||||
zint_add_test(ps test_ps)
|
||||
zint_add_test(qr test_qr)
|
||||
if(HAVE_ARC4RANDOM_UNIFORM)
|
||||
zint_add_test(random test_random)
|
||||
endif()
|
||||
zint_add_test(raster test_raster)
|
||||
zint_add_test(reedsol test_reedsol)
|
||||
zint_add_test(rss test_rss)
|
||||
|
||||
Reference in New Issue
Block a user