mirror of
https://github.com/woo-j/zint.git
synced 2024-12-24 17:34:05 +03:00
Interpret 4-bit codewords as big-endian for error correction
affects microQR symbol sizes M1 and M3 bug reported by Milton Neal
This commit is contained in:
parent
658cdd7a69
commit
b003627908
28
backend/qr.c
28
backend/qr.c
@ -2128,7 +2128,7 @@ void micro_qr_m1(char binary_data[]) {
|
||||
data_blocks[2] = 0;
|
||||
for (j = 0; j < 4; j++) {
|
||||
if (binary_data[16 + j] == '1') {
|
||||
data_blocks[2] += 0x08 >> j;
|
||||
data_blocks[2] += 0x80 >> j;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2302,33 +2302,19 @@ void micro_qr_m3(char binary_data[], int ecc_mode) {
|
||||
|
||||
if (ecc_mode == LEVEL_L) {
|
||||
data_blocks[10] = 0;
|
||||
if (binary_data[80] == '1') {
|
||||
data_blocks[10] += 0x08;
|
||||
for (j = 0; j < 4; j++) {
|
||||
if (binary_data[80 + j] == '1') {
|
||||
data_blocks[10] += 0x80 >> j;
|
||||
}
|
||||
if (binary_data[81] == '1') {
|
||||
data_blocks[10] += 0x04;
|
||||
}
|
||||
if (binary_data[82] == '1') {
|
||||
data_blocks[10] += 0x02;
|
||||
}
|
||||
if (binary_data[83] == '1') {
|
||||
data_blocks[10] += 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
if (ecc_mode == LEVEL_M) {
|
||||
data_blocks[8] = 0;
|
||||
if (binary_data[64] == '1') {
|
||||
data_blocks[8] += 0x08;
|
||||
for (j = 0; j < 4; j++) {
|
||||
if (binary_data[64 + j] == '1') {
|
||||
data_blocks[8] += 0x80 >> j;
|
||||
}
|
||||
if (binary_data[65] == '1') {
|
||||
data_blocks[8] += 0x04;
|
||||
}
|
||||
if (binary_data[66] == '1') {
|
||||
data_blocks[8] += 0x02;
|
||||
}
|
||||
if (binary_data[67] == '1') {
|
||||
data_blocks[8] += 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user