From a14de3d959565ec53ece52ba616918487fc6182b Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Fri, 26 Oct 2018 03:47:04 +0000 Subject: [PATCH] Renamed colorX, colorY local variables in QrCode.getPenaltyScore() to just color, in all language versions. --- c/qrcodegen.c | 12 ++++++------ cpp/QrCode.cpp | 12 ++++++------ java/io/nayuki/qrcodegen/QrCode.java | 12 ++++++------ javascript/qrcodegen.js | 12 ++++++------ python/qrcodegen.py | 8 ++++---- rust/src/lib.rs | 12 ++++++------ typescript/qrcodegen.ts | 12 ++++++------ 7 files changed, 40 insertions(+), 40 deletions(-) diff --git a/c/qrcodegen.c b/c/qrcodegen.c index 79bf810..62fd04b 100644 --- a/c/qrcodegen.c +++ b/c/qrcodegen.c @@ -632,10 +632,10 @@ static long getPenaltyScore(const uint8_t qrcode[]) { // Adjacent modules in row having same color for (int y = 0; y < qrsize; y++) { - bool colorX = false; + bool color = false; for (int x = 0, runX = -1; x < qrsize; x++) { - if (x == 0 || getModule(qrcode, x, y) != colorX) { - colorX = getModule(qrcode, x, y); + if (x == 0 || getModule(qrcode, x, y) != color) { + color = getModule(qrcode, x, y); runX = 1; } else { runX++; @@ -648,10 +648,10 @@ static long getPenaltyScore(const uint8_t qrcode[]) { } // Adjacent modules in column having same color for (int x = 0; x < qrsize; x++) { - bool colorY = false; + bool color = false; for (int y = 0, runY = -1; y < qrsize; y++) { - if (y == 0 || getModule(qrcode, x, y) != colorY) { - colorY = getModule(qrcode, x, y); + if (y == 0 || getModule(qrcode, x, y) != color) { + color = getModule(qrcode, x, y); runY = 1; } else { runY++; diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp index 3b7f289..0d51cb6 100644 --- a/cpp/QrCode.cpp +++ b/cpp/QrCode.cpp @@ -430,10 +430,10 @@ long QrCode::getPenaltyScore() const { // Adjacent modules in row having same color for (int y = 0; y < size; y++) { - bool colorX = false; + bool color = false; for (int x = 0, runX = -1; x < size; x++) { - if (x == 0 || module(x, y) != colorX) { - colorX = module(x, y); + if (x == 0 || module(x, y) != color) { + color = module(x, y); runX = 1; } else { runX++; @@ -446,10 +446,10 @@ long QrCode::getPenaltyScore() const { } // Adjacent modules in column having same color for (int x = 0; x < size; x++) { - bool colorY = false; + bool color = false; for (int y = 0, runY = -1; y < size; y++) { - if (y == 0 || module(x, y) != colorY) { - colorY = module(x, y); + if (y == 0 || module(x, y) != color) { + color = module(x, y); runY = 1; } else { runY++; diff --git a/java/io/nayuki/qrcodegen/QrCode.java b/java/io/nayuki/qrcodegen/QrCode.java index f904a68..fd73760 100644 --- a/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/io/nayuki/qrcodegen/QrCode.java @@ -597,10 +597,10 @@ public final class QrCode { // Adjacent modules in row having same color for (int y = 0; y < size; y++) { - boolean colorX = false; + boolean color = false; for (int x = 0, runX = 0; x < size; x++) { - if (x == 0 || modules[y][x] != colorX) { - colorX = modules[y][x]; + if (x == 0 || modules[y][x] != color) { + color = modules[y][x]; runX = 1; } else { runX++; @@ -613,10 +613,10 @@ public final class QrCode { } // Adjacent modules in column having same color for (int x = 0; x < size; x++) { - boolean colorY = false; + boolean color = false; for (int y = 0, runY = 0; y < size; y++) { - if (y == 0 || modules[y][x] != colorY) { - colorY = modules[y][x]; + if (y == 0 || modules[y][x] != color) { + color = modules[y][x]; runY = 1; } else { runY++; diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index 16531a5..fda02bd 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -429,9 +429,9 @@ var qrcodegen = new function() { // Adjacent modules in row having same color for (var y = 0; y < size; y++) { - for (var x = 0, runX, colorX; x < size; x++) { - if (x == 0 || modules[y][x] != colorX) { - colorX = modules[y][x]; + for (var x = 0, runX, color; x < size; x++) { + if (x == 0 || modules[y][x] != color) { + color = modules[y][x]; runX = 1; } else { runX++; @@ -444,9 +444,9 @@ var qrcodegen = new function() { } // Adjacent modules in column having same color for (var x = 0; x < size; x++) { - for (var y = 0, runY, colorY; y < size; y++) { - if (y == 0 || modules[y][x] != colorY) { - colorY = modules[y][x]; + for (var y = 0, runY, color; y < size; y++) { + if (y == 0 || modules[y][x] != color) { + color = modules[y][x]; runY = 1; } else { runY++; diff --git a/python/qrcodegen.py b/python/qrcodegen.py index b623d26..9a1bcb4 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -465,8 +465,8 @@ class QrCode(object): # Adjacent modules in row having same color for y in range(size): for x in range(size): - if x == 0 or modules[y][x] != colorx: - colorx = modules[y][x] + if x == 0 or modules[y][x] != color: + color = modules[y][x] runx = 1 else: runx += 1 @@ -477,8 +477,8 @@ class QrCode(object): # Adjacent modules in column having same color for x in range(size): for y in range(size): - if y == 0 or modules[y][x] != colory: - colory = modules[y][x] + if y == 0 or modules[y][x] != color: + color = modules[y][x] runy = 1 else: runy += 1 diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 0a59396..e556b50 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -647,11 +647,11 @@ impl QrCode { // Adjacent modules in row having same color for y in 0 .. size { - let mut colorx = false; + let mut color = false; let mut runx: i32 = 0; for x in 0 .. size { - if x == 0 || self.module(x, y) != colorx { - colorx = self.module(x, y); + if x == 0 || self.module(x, y) != color { + color = self.module(x, y); runx = 1; } else { runx += 1; @@ -665,11 +665,11 @@ impl QrCode { } // Adjacent modules in column having same color for x in 0 .. size { - let mut colory = false; + let mut color = false; let mut runy: i32 = 0; for y in 0 .. size { - if y == 0 || self.module(x, y) != colory { - colory = self.module(x, y); + if y == 0 || self.module(x, y) != color { + color = self.module(x, y); runy = 1; } else { runy += 1; diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index fe17bcd..199e151 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -512,9 +512,9 @@ namespace qrcodegen { // Adjacent modules in row having same color for (let y = 0; y < this.size; y++) { - for (let x = 0, runX = 0, colorX = false; x < this.size; x++) { - if (x == 0 || this.modules[y][x] != colorX) { - colorX = this.modules[y][x]; + for (let x = 0, runX = 0, color = false; x < this.size; x++) { + if (x == 0 || this.modules[y][x] != color) { + color = this.modules[y][x]; runX = 1; } else { runX++; @@ -527,9 +527,9 @@ namespace qrcodegen { } // Adjacent modules in column having same color for (let x = 0; x < this.size; x++) { - for (let y = 0, runY = 0, colorY = false; y < this.size; y++) { - if (y == 0 || this.modules[y][x] != colorY) { - colorY = this.modules[y][x]; + for (let y = 0, runY = 0, color = false; y < this.size; y++) { + if (y == 0 || this.modules[y][x] != color) { + color = this.modules[y][x]; runY = 1; } else { runY++;