From afc12dc9d22fa08ad91654c2023253247a238a87 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Sat, 20 Jul 2019 23:56:02 +0000 Subject: [PATCH] Synchronized some code with the parent project, without changing behavior. --- src/io/nayuki/fastqrcodegen/QrCode.java | 4 ++-- src/io/nayuki/fastqrcodegen/QrCodeGeneratorWorker.java | 1 - src/io/nayuki/fastqrcodegen/ReedSolomonGenerator.java | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/io/nayuki/fastqrcodegen/QrCode.java b/src/io/nayuki/fastqrcodegen/QrCode.java index 31c9a6e..6d44c47 100644 --- a/src/io/nayuki/fastqrcodegen/QrCode.java +++ b/src/io/nayuki/fastqrcodegen/QrCode.java @@ -458,8 +458,8 @@ public final class QrCode { if (mask == -1) { // Automatically choose best mask int minPenalty = Integer.MAX_VALUE; for (int i = 0; i < 8; i++) { - drawFormatBits(i); applyMask(masks[i]); + drawFormatBits(i); int penalty = getPenaltyScore(); if (penalty < minPenalty) { mask = i; @@ -469,8 +469,8 @@ public final class QrCode { } } assert 0 <= mask && mask <= 7; - drawFormatBits(mask); // Overwrite old format bits applyMask(masks[mask]); // Apply the final choice of mask + drawFormatBits(mask); // Overwrite old format bits return mask; // The caller shall assign this value to the final-declared field } diff --git a/src/io/nayuki/fastqrcodegen/QrCodeGeneratorWorker.java b/src/io/nayuki/fastqrcodegen/QrCodeGeneratorWorker.java index fc0c9d1..5bf9b30 100644 --- a/src/io/nayuki/fastqrcodegen/QrCodeGeneratorWorker.java +++ b/src/io/nayuki/fastqrcodegen/QrCodeGeneratorWorker.java @@ -81,7 +81,6 @@ public final class QrCodeGeneratorWorker { else segs = Arrays.asList(QrSegment.makeBytes(data)); - try { // Try to make QR Code symbol QrCode qr = QrCode.encodeSegments(segs, QrCode.Ecc.values()[errCorLvl], minVersion, maxVersion, mask, boostEcl != 0); // Print grid of modules diff --git a/src/io/nayuki/fastqrcodegen/ReedSolomonGenerator.java b/src/io/nayuki/fastqrcodegen/ReedSolomonGenerator.java index cb2def7..a4b77be 100644 --- a/src/io/nayuki/fastqrcodegen/ReedSolomonGenerator.java +++ b/src/io/nayuki/fastqrcodegen/ReedSolomonGenerator.java @@ -92,7 +92,7 @@ final class ReedSolomonGenerator { // Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result // are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8. private static int multiply(int x, int y) { - assert x >>> 8 == 0 && y >>> 8 == 0; + assert x >> 8 == 0 && y >> 8 == 0; // Russian peasant multiplication int z = 0; for (int i = 7; i >= 0; i--) {