From 0a0ac19f9ba0bcf729fe1bdfb6cc0c84e68fb50d Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Fri, 5 Oct 2018 01:42:57 +0000 Subject: [PATCH] Aligned code involving QrCode grid fields, in most languages. --- cpp/QrCode.cpp | 2 +- java/io/nayuki/qrcodegen/QrCode.java | 2 +- javascript/qrcodegen.js | 4 ++-- rust/src/lib.rs | 2 +- typescript/qrcodegen.ts | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp index 3a9b25a..ab6039c 100644 --- a/cpp/QrCode.cpp +++ b/cpp/QrCode.cpp @@ -119,7 +119,7 @@ QrCode::QrCode(int ver, Ecc ecl, const vector &dataCodewords, int mask) version(ver), size(MIN_VERSION <= ver && ver <= MAX_VERSION ? ver * 4 + 17 : -1), // Avoid signed overflow undefined behavior errorCorrectionLevel(ecl), - modules(size, vector(size)), // Entirely white grid + modules (size, vector(size)), // Entirely white grid isFunction(size, vector(size)) { // Check arguments diff --git a/java/io/nayuki/qrcodegen/QrCode.java b/java/io/nayuki/qrcodegen/QrCode.java index 24603bf..83f17f7 100644 --- a/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/io/nayuki/qrcodegen/QrCode.java @@ -222,7 +222,7 @@ public final class QrCode { // Initialize fields version = ver; size = ver * 4 + 17; - modules = new boolean[size][size]; // Entirely white grid + modules = new boolean[size][size]; // Entirely white grid isFunction = new boolean[size][size]; // Draw function patterns, draw all codewords, do masking diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index 499c038..efe2900 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -83,10 +83,10 @@ var qrcodegen = new function() { var row = []; for (var i = 0; i < size; i++) row.push(false); - var modules = []; + var modules = []; var isFunction = []; for (var i = 0; i < size; i++) { - modules.push(row.slice()); + modules .push(row.slice()); isFunction.push(row.slice()); } diff --git a/rust/src/lib.rs b/rust/src/lib.rs index ac10d47..b0d75bd 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -186,7 +186,7 @@ impl QrCode { size: size as i32, mask: Mask::new(0), // Dummy value errorcorrectionlevel: ecl, - modules: vec![false; size * size], // Entirely white grid + modules : vec![false; size * size], // Entirely white grid isfunction: vec![false; size * size], }; diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index d8d12e9..fbe04ad 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -138,7 +138,7 @@ namespace qrcodegen { public readonly size: int; // The modules of this QR Code symbol (false = white, true = black). Immutable after constructor finishes. - private readonly modules: Array> = []; + private readonly modules : Array> = []; // Indicates function modules that are not subjected to masking. Discarded when constructor finishes. private readonly isFunction: Array> = []; @@ -172,7 +172,7 @@ namespace qrcodegen { for (let i = 0; i < this.size; i++) row.push(false); for (let i = 0; i < this.size; i++) { - this.modules.push(row.slice()); + this.modules .push(row.slice()); this.isFunction.push(row.slice()); }