mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Correct bug in QR Code
Correct bug in numeric encoding of QR Code data reported by John Hennessy.
This commit is contained in:
parent
a686482a44
commit
6792246fe9
13
backend/qr.c
13
backend/qr.c
@ -257,7 +257,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
|||||||
|
|
||||||
qr_bscan(binary, byte, 0x80);
|
qr_bscan(binary, byte, 0x80);
|
||||||
|
|
||||||
if(debug) { printf("0x%4X ", byte); }
|
if(debug) { printf("0x%2X(%d) ", byte, byte); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if(debug) { printf("\n"); }
|
if(debug) { printf("\n"); }
|
||||||
@ -372,12 +372,12 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
|||||||
second = posn(NEON, (char) jisdata[position + i + 1]);
|
second = posn(NEON, (char) jisdata[position + i + 1]);
|
||||||
count = 2;
|
count = 2;
|
||||||
prod = (prod * 10) + second;
|
prod = (prod * 10) + second;
|
||||||
}
|
|
||||||
|
|
||||||
if(mode[position + i + 2] == 'N') {
|
if(mode[position + i + 2] == 'N') {
|
||||||
third = posn(NEON, (char) jisdata[position + i + 2]);
|
third = posn(NEON, (char) jisdata[position + i + 2]);
|
||||||
count = 3;
|
count = 3;
|
||||||
prod = (prod * 10) + third;
|
prod = (prod * 10) + third;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qr_bscan(binary, prod, 1 << (3 * count)); /* count = 1..3 */
|
qr_bscan(binary, prod, 1 << (3 * count)); /* count = 1..3 */
|
||||||
@ -434,6 +434,7 @@ void qr_binary(int datastream[], int version, int target_binlen, char mode[], in
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(debug) {
|
if(debug) {
|
||||||
|
printf("Resulting codewords:\n\t");
|
||||||
for(i = 0; i < target_binlen; i++) {
|
for(i = 0; i < target_binlen; i++) {
|
||||||
printf("0x%2X ", datastream[i]);
|
printf("0x%2X ", datastream[i]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user