From 08a24d9f9436ed4fa7d8e77f34941df086cf06b9 Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Thu, 16 Dec 2010 09:54:56 +0000 Subject: [PATCH] Correct bug in QR Code Correction of version number bug. Version information was encoded backwards in QR Code symbols > version 7. Thanks to Chew Boon Heng and Giovanni Pedruzzi for reporting, and thanks to Sean Owen from the ZXing group for working out the problem. --- backend/qr.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/qr.c b/backend/qr.c index 0802a20c..ebb67380 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -984,12 +984,12 @@ void add_version_info(unsigned char *grid, int size, int version) long int version_data = qr_annex_d[version - 7]; for(i = 0; i < 6; i++) { - grid[((size - 11) * size) + i] += (version_data >> (17 - (i * 3))) & 0x01; - grid[((size - 10) * size) + i] += (version_data >> (16 - (i * 3))) & 0x01; - grid[((size - 9) * size) + i] += (version_data >> (15 - (i * 3))) & 0x01; - grid[(i * size) + (size - 11)] += (version_data >> (17 - (i * 3))) & 0x01; - grid[(i * size) + (size - 10)] += (version_data >> (16 - (i * 3))) & 0x01; - grid[(i * size) + (size - 9)] += (version_data >> (15 - (i * 3))) & 0x01; + grid[((size - 11) * size) + i] += (version_data >> (i * 3)) & 0x01; + grid[((size - 10) * size) + i] += (version_data >> ((i * 3) + 1)) & 0x01; + grid[((size - 9) * size) + i] += (version_data >> ((i * 3) + 2)) & 0x01; + grid[(i * size) + (size - 11)] += (version_data >> (i * 3)) & 0x01; + grid[(i * size) + (size - 10)] += (version_data >> ((i * 3) + 1)) & 0x01; + grid[(i * size) + (size - 9)] += (version_data >> ((i * 3) + 2)) & 0x01; } }