From ade31c41fba14b942cca30a4a605e48517613d25 Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Wed, 27 Nov 2019 19:32:40 +0000 Subject: [PATCH] rMQR bugfix - cater for data lengths which are not multiples of 8 when calculating symbol size --- backend/qr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/qr.c b/backend/qr.c index bc321f8f..514b0bdc 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -3280,14 +3280,14 @@ int rmqr(struct zint_symbol *symbol, const unsigned char source[], size_t length est_binlen = getBinaryLength(RMQR_VERSION + version, mode, jisdata, length, gs1, symbol->eci); footprint = rmqr_height[version] * rmqr_width[version]; if (ecc_level == LEVEL_M) { - if (rmqr_data_codewords_M[version] >= (est_binlen / 8)) { + if (8 * rmqr_data_codewords_M[version] >= est_binlen) { if (footprint < best_footprint) { autosize = version; best_footprint = footprint; } } } else { - if (rmqr_data_codewords_H[version] >= (est_binlen / 8)) { + if (8 * rmqr_data_codewords_H[version] >= est_binlen) { if (footprint < best_footprint) { autosize = version; best_footprint = footprint; @@ -3310,11 +3310,11 @@ int rmqr(struct zint_symbol *symbol, const unsigned char source[], size_t length for(i = version - 1; i > rmqr_fixed_height_upper_bound[symbol->option_2 - 33]; i--) { est_binlen = getBinaryLength(RMQR_VERSION + i, mode, jisdata, length, gs1, symbol->eci); if (ecc_level == LEVEL_M) { - if (rmqr_data_codewords_M[i] >= (est_binlen / 8)) { + if (8 * rmqr_data_codewords_M[i] >= est_binlen) { version = i; } } else { - if (rmqr_data_codewords_H[i] >= (est_binlen / 8)) { + if (8 * rmqr_data_codewords_H[i] >= est_binlen) { version = i; } }