Renamed 'packedKanjiData' constant in demo programs.

pull/16/head
Project Nayuki 7 years ago
parent 4a62fb138a
commit 3db1e2d9b1

@ -146,7 +146,7 @@ static void doSegmentDemo() {
const QrCode qr4 = QrCode::encodeText(madoka, QrCode::Ecc::LOW);
printQr(qr4);
const std::vector<int> packedKanjiData{ // Kanji mode encoding (13 bits per character)
const std::vector<int> kanjiChars{ // Kanji mode encoding (13 bits per character)
0x0035, 0x1002, 0x0FC0, 0x0AED, 0x0AD7,
0x015C, 0x0147, 0x0129, 0x0059, 0x01BD,
0x018D, 0x018A, 0x0036, 0x0141, 0x0144,
@ -155,10 +155,10 @@ static void doSegmentDemo() {
0x0000, 0x0208, 0x01FF, 0x0008,
};
qrcodegen::BitBuffer bb;
for (int c : packedKanjiData)
for (int c : kanjiChars)
bb.appendBits(c, 13);
const QrCode qr5 = QrCode::encodeSegments(
{QrSegment(QrSegment::Mode::KANJI, packedKanjiData.size(), bb)},
{QrSegment(QrSegment::Mode::KANJI, kanjiChars.size(), bb)},
QrCode::Ecc::LOW);
printQr(qr5);
}

@ -141,7 +141,7 @@ public final class QrCodeGeneratorDemo {
qr = QrCode.encodeText(madoka, QrCode.Ecc.LOW);
writePng(qr.toImage(9, 4), "madoka-utf8-QR.png");
int[] packedKanjiData = { // Kanji mode encoding (13 bits per character)
int[] kanjiChars = { // Kanji mode encoding (13 bits per character)
0x0035, 0x1002, 0x0FC0, 0x0AED, 0x0AD7,
0x015C, 0x0147, 0x0129, 0x0059, 0x01BD,
0x018D, 0x018A, 0x0036, 0x0141, 0x0144,
@ -150,9 +150,9 @@ public final class QrCodeGeneratorDemo {
0x0000, 0x0208, 0x01FF, 0x0008,
};
BitBuffer bb = new BitBuffer();
for (int c : packedKanjiData)
for (int c : kanjiChars)
bb.appendBits(c, 13);
segs = Arrays.asList(new QrSegment(QrSegment.Mode.KANJI, packedKanjiData.length, bb));
segs = Arrays.asList(new QrSegment(QrSegment.Mode.KANJI, kanjiChars.length, bb));
qr = QrCode.encodeSegments(segs, QrCode.Ecc.LOW);
writePng(qr.toImage(9, 4), "madoka-kanji-QR.png");
}

@ -115,7 +115,7 @@ def do_segment_demo():
qr = qrcodegen.QrCode.encode_text(madoka, qrcodegen.QrCode.Ecc.LOW)
print_qr(qr)
packedkanjidata = [ # Kanji mode encoding (13 bits per character)
kanjiCharBits = [ # Kanji mode encoding (13 bits per character)
0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
@ -146,7 +146,7 @@ def do_segment_demo():
0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
]
segs = [qrcodegen.QrSegment(qrcodegen.QrSegment.Mode.KANJI, len(packedkanjidata) // 13, packedkanjidata)]
segs = [qrcodegen.QrSegment(qrcodegen.QrSegment.Mode.KANJI, len(kanjiCharBits) // 13, kanjiCharBits)]
qr = qrcodegen.QrCode.encode_segments(segs, qrcodegen.QrCode.Ecc.LOW)
print_qr(qr)

Loading…
Cancel
Save