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.
This commit is contained in:
Robin Stuart 2010-12-16 09:54:56 +00:00
parent d0f15ef423
commit 08a24d9f94

View File

@ -984,12 +984,12 @@ void add_version_info(unsigned char *grid, int size, int version)
long int version_data = qr_annex_d[version - 7]; long int version_data = qr_annex_d[version - 7];
for(i = 0; i < 6; i++) { for(i = 0; i < 6; i++) {
grid[((size - 11) * size) + i] += (version_data >> (17 - (i * 3))) & 0x01; grid[((size - 11) * size) + i] += (version_data >> (i * 3)) & 0x01;
grid[((size - 10) * size) + i] += (version_data >> (16 - (i * 3))) & 0x01; grid[((size - 10) * size) + i] += (version_data >> ((i * 3) + 1)) & 0x01;
grid[((size - 9) * size) + i] += (version_data >> (15 - (i * 3))) & 0x01; grid[((size - 9) * size) + i] += (version_data >> ((i * 3) + 2)) & 0x01;
grid[(i * size) + (size - 11)] += (version_data >> (17 - (i * 3))) & 0x01; grid[(i * size) + (size - 11)] += (version_data >> (i * 3)) & 0x01;
grid[(i * size) + (size - 10)] += (version_data >> (16 - (i * 3))) & 0x01; grid[(i * size) + (size - 10)] += (version_data >> ((i * 3) + 1)) & 0x01;
grid[(i * size) + (size - 9)] += (version_data >> (15 - (i * 3))) & 0x01; grid[(i * size) + (size - 9)] += (version_data >> ((i * 3) + 2)) & 0x01;
} }
} }