mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-22 11:15:16 -04:00
Use more accurate guess of bit length when calculating smallest available version
Fixes #66, Bug report by jthie
This commit is contained in:
parent
7b53fc3469
commit
30272dd955
1 changed files with 2 additions and 7 deletions
|
@ -1589,10 +1589,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len
|
||||||
if (autosize == 1) {
|
if (autosize == 1) {
|
||||||
canShrink = 0;
|
canShrink = 0;
|
||||||
} else {
|
} else {
|
||||||
if (tribus(autosize - 1, 1, 2, 3) != tribus(autosize, 1, 2, 3)) {
|
est_binlen = getBinaryLength(autosize - 1, mode, jisdata, length, gs1, symbol->eci);
|
||||||
// Length of binary needed to encode the data in the smaller symbol is different, recalculate
|
|
||||||
est_binlen = getBinaryLength(autosize - 1, mode, jisdata, length, gs1, symbol->eci);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (ecc_level) {
|
switch (ecc_level) {
|
||||||
case LEVEL_L:
|
case LEVEL_L:
|
||||||
|
@ -1622,9 +1619,7 @@ int qr_code(struct zint_symbol *symbol, const unsigned char source[], size_t len
|
||||||
autosize--;
|
autosize--;
|
||||||
} else {
|
} else {
|
||||||
// Data did not fit in the smaller symbol, revert to original size
|
// Data did not fit in the smaller symbol, revert to original size
|
||||||
if (tribus(autosize - 1, 1, 2, 3) != tribus(autosize, 1, 2, 3)) {
|
est_binlen = getBinaryLength(autosize, mode, jisdata, length, gs1, symbol->eci);
|
||||||
est_binlen = getBinaryLength(autosize, mode, jisdata, length, gs1, symbol->eci);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (canShrink == 1);
|
} while (canShrink == 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue