diff --git a/c/qrcodegen.c b/c/qrcodegen.c index 3818499..17f8aaa 100644 --- a/c/qrcodegen.c +++ b/c/qrcodegen.c @@ -635,10 +635,10 @@ static long getPenaltyScore(const uint8_t qrcode[]) { // Adjacent modules in row having same color, and finder-like patterns for (int y = 0; y < qrsize; y++) { unsigned char runHistory[7] = {0}; - bool color = false; + bool runColor = false; unsigned char runX = 0; for (int x = 0; x < qrsize; x++) { - if (getModule(qrcode, x, y) == color) { + if (getModule(qrcode, x, y) == runColor) { runX++; if (runX == 5) result += PENALTY_N1; @@ -646,14 +646,14 @@ static long getPenaltyScore(const uint8_t qrcode[]) { result++; } else { addRunToHistory(runX, runHistory); - if (!color && hasFinderLikePattern(runHistory)) + if (!runColor && hasFinderLikePattern(runHistory)) result += PENALTY_N3; - color = getModule(qrcode, x, y); + runColor = getModule(qrcode, x, y); runX = 1; } } addRunToHistory(runX, runHistory); - if (color) + if (runColor) addRunToHistory(0, runHistory); // Dummy run of white if (hasFinderLikePattern(runHistory)) result += PENALTY_N3; @@ -661,10 +661,10 @@ static long getPenaltyScore(const uint8_t qrcode[]) { // Adjacent modules in column having same color, and finder-like patterns for (int x = 0; x < qrsize; x++) { unsigned char runHistory[7] = {0}; - bool color = false; + bool runColor = false; unsigned char runY = 0; for (int y = 0; y < qrsize; y++) { - if (getModule(qrcode, x, y) == color) { + if (getModule(qrcode, x, y) == runColor) { runY++; if (runY == 5) result += PENALTY_N1; @@ -672,14 +672,14 @@ static long getPenaltyScore(const uint8_t qrcode[]) { result++; } else { addRunToHistory(runY, runHistory); - if (!color && hasFinderLikePattern(runHistory)) + if (!runColor && hasFinderLikePattern(runHistory)) result += PENALTY_N3; - color = getModule(qrcode, x, y); + runColor = getModule(qrcode, x, y); runY = 1; } } addRunToHistory(runY, runHistory); - if (color) + if (runColor) addRunToHistory(0, runHistory); // Dummy run of white if (hasFinderLikePattern(runHistory)) result += PENALTY_N3; diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp index 2679805..dba2cc5 100644 --- a/cpp/QrCode.cpp +++ b/cpp/QrCode.cpp @@ -428,10 +428,10 @@ long QrCode::getPenaltyScore() const { // Adjacent modules in row having same color, and finder-like patterns for (int y = 0; y < size; y++) { std::deque runHistory(7, 0); - bool color = false; + bool runColor = false; int runX = 0; for (int x = 0; x < size; x++) { - if (module(x, y) == color) { + if (module(x, y) == runColor) { runX++; if (runX == 5) result += PENALTY_N1; @@ -439,14 +439,14 @@ long QrCode::getPenaltyScore() const { result++; } else { addRunToHistory(runX, runHistory); - if (!color && hasFinderLikePattern(runHistory)) + if (!runColor && hasFinderLikePattern(runHistory)) result += PENALTY_N3; - color = module(x, y); + runColor = module(x, y); runX = 1; } } addRunToHistory(runX, runHistory); - if (color) + if (runColor) addRunToHistory(0, runHistory); // Dummy run of white if (hasFinderLikePattern(runHistory)) result += PENALTY_N3; @@ -454,10 +454,10 @@ long QrCode::getPenaltyScore() const { // Adjacent modules in column having same color, and finder-like patterns for (int x = 0; x < size; x++) { std::deque runHistory(7, 0); - bool color = false; + bool runColor = false; int runY = 0; for (int y = 0; y < size; y++) { - if (module(x, y) == color) { + if (module(x, y) == runColor) { runY++; if (runY == 5) result += PENALTY_N1; @@ -465,14 +465,14 @@ long QrCode::getPenaltyScore() const { result++; } else { addRunToHistory(runY, runHistory); - if (!color && hasFinderLikePattern(runHistory)) + if (!runColor && hasFinderLikePattern(runHistory)) result += PENALTY_N3; - color = module(x, y); + runColor = module(x, y); runY = 1; } } addRunToHistory(runY, runHistory); - if (color) + if (runColor) addRunToHistory(0, runHistory); // Dummy run of white if (hasFinderLikePattern(runHistory)) result += PENALTY_N3; diff --git a/java/src/main/java/io/nayuki/qrcodegen/QrCode.java b/java/src/main/java/io/nayuki/qrcodegen/QrCode.java index 8ce096f..07afd7d 100644 --- a/java/src/main/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/src/main/java/io/nayuki/qrcodegen/QrCode.java @@ -598,41 +598,41 @@ public final class QrCode { // Adjacent modules in row having same color, and finder-like patterns FinderPatternDetector det = new FinderPatternDetector(); for (int y = 0; y < size; y++) { - boolean color = false; + boolean runClor = false; int runX = 0; det.reset(); for (int x = 0; x < size; x++) { - if (modules[y][x] == color) { + if (modules[y][x] == runClor) { runX++; if (runX == 5) result += PENALTY_N1; else if (runX > 5) result++; } else { - color = modules[y][x]; + runClor = modules[y][x]; runX = 1; } - result += det.addModuleAndMatch(color) * PENALTY_N3; + result += det.addModuleAndMatch(runClor) * PENALTY_N3; } result += det.terminateAndMatch() * PENALTY_N3; } // Adjacent modules in column having same color, and finder-like patterns for (int x = 0; x < size; x++) { det.reset(); - boolean color = false; + boolean runColor = false; int runY = 0; for (int y = 0; y < size; y++) { - if (modules[y][x] == color) { + if (modules[y][x] == runColor) { runY++; if (runY == 5) result += PENALTY_N1; else if (runY > 5) result++; } else { - color = modules[y][x]; + runColor = modules[y][x]; runY = 1; } - result += det.addModuleAndMatch(color) * PENALTY_N3; + result += det.addModuleAndMatch(runColor) * PENALTY_N3; } result += det.terminateAndMatch() * PENALTY_N3; } diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index d03ea89..cf77be8 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -430,10 +430,10 @@ var qrcodegen = new function() { // Adjacent modules in row having same color, and finder-like patterns for (var y = 0; y < size; y++) { var runHistory = [0,0,0,0,0,0,0]; - var color = false; + var runColor = false; var runX = 0; for (var x = 0; x < size; x++) { - if (modules[y][x] == color) { + if (modules[y][x] == runColor) { runX++; if (runX == 5) result += QrCode.PENALTY_N1; @@ -441,14 +441,14 @@ var qrcodegen = new function() { result++; } else { QrCode.addRunToHistory(runX, runHistory); - if (!color && QrCode.hasFinderLikePattern(runHistory)) + if (!runColor && QrCode.hasFinderLikePattern(runHistory)) result += QrCode.PENALTY_N3; - color = modules[y][x]; + runColor = modules[y][x]; runX = 1; } } QrCode.addRunToHistory(runX, runHistory); - if (color) + if (runColor) QrCode.addRunToHistory(0, runHistory); // Dummy run of white if (QrCode.hasFinderLikePattern(runHistory)) result += QrCode.PENALTY_N3; @@ -456,10 +456,10 @@ var qrcodegen = new function() { // Adjacent modules in column having same color, and finder-like patterns for (var x = 0; x < size; x++) { var runHistory = [0,0,0,0,0,0,0]; - var color = false; + var runColor = false; var runY = 0; for (var y = 0; y < size; y++) { - if (modules[y][x] == color) { + if (modules[y][x] == runColor) { runY++; if (runY == 5) result += QrCode.PENALTY_N1; @@ -467,14 +467,14 @@ var qrcodegen = new function() { result++; } else { QrCode.addRunToHistory(runY, runHistory); - if (!color && QrCode.hasFinderLikePattern(runHistory)) + if (!runColor && QrCode.hasFinderLikePattern(runHistory)) result += QrCode.PENALTY_N3; - color = modules[y][x]; + runColor = modules[y][x]; runY = 1; } } QrCode.addRunToHistory(runY, runHistory); - if (color) + if (runColor) QrCode.addRunToHistory(0, runHistory); // Dummy run of white if (QrCode.hasFinderLikePattern(runHistory)) result += QrCode.PENALTY_N3; diff --git a/python/qrcodegen.py b/python/qrcodegen.py index e27615b..40487da 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -465,10 +465,10 @@ class QrCode(object): # Adjacent modules in row having same color, and finder-like patterns for y in range(size): runhistory = collections.deque([0] * 7, 7) - color = False + runcolor = False runx = 0 for x in range(size): - if modules[y][x] == color: + if modules[y][x] == runcolor: runx += 1 if runx == 5: result += QrCode._PENALTY_N1 @@ -476,22 +476,22 @@ class QrCode(object): result += 1 else: runhistory.appendleft(runx) - if not color and QrCode.has_finder_like_pattern(runhistory): + if not runcolor and QrCode.has_finder_like_pattern(runhistory): result += QrCode._PENALTY_N3 - color = modules[y][x] + runcolor = modules[y][x] runx = 1 runhistory.appendleft(runx) - if color: + if runcolor: runhistory.appendleft(0) # Dummy run of white if QrCode.has_finder_like_pattern(runhistory): result += QrCode._PENALTY_N3 # Adjacent modules in column having same color, and finder-like patterns for x in range(size): runhistory = collections.deque([0] * 7, 7) - color = False + runcolor = False runy = 0 for y in range(size): - if modules[y][x] == color: + if modules[y][x] == runcolor: runy += 1 if runy == 5: result += QrCode._PENALTY_N1 @@ -499,12 +499,12 @@ class QrCode(object): result += 1 else: runhistory.appendleft(runy) - if not color and QrCode.has_finder_like_pattern(runhistory): + if not runcolor and QrCode.has_finder_like_pattern(runhistory): result += QrCode._PENALTY_N3 - color = modules[y][x] + runcolor = modules[y][x] runy = 1 runhistory.appendleft(runy) - if color: + if runcolor: runhistory.appendleft(0) # Dummy run of white if QrCode.has_finder_like_pattern(runhistory): result += QrCode._PENALTY_N3 diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 4fedaba..d337040 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -643,10 +643,10 @@ impl QrCode { // Adjacent modules in row having same color, and finder-like patterns for y in 0 .. size { let mut runhistory = RunHistory::new(); - let mut color = false; + let mut runcolor = false; let mut runx: i32 = 0; for x in 0 .. size { - if self.module(x, y) == color { + if self.module(x, y) == runcolor { runx += 1; if runx == 5 { result += PENALTY_N1; @@ -655,15 +655,15 @@ impl QrCode { } } else { runhistory.add_run(runx); - if !color && runhistory.has_finder_like_pattern() { + if !runcolor && runhistory.has_finder_like_pattern() { result += PENALTY_N3; } - color = self.module(x, y); + runcolor = self.module(x, y); runx = 1; } } runhistory.add_run(runx); - if color { + if runcolor { runhistory.add_run(0); // Dummy run of white } if runhistory.has_finder_like_pattern() { @@ -673,10 +673,10 @@ impl QrCode { // Adjacent modules in column having same color, and finder-like patterns for x in 0 .. size { let mut runhistory = RunHistory::new(); - let mut color = false; + let mut runcolor = false; let mut runy: i32 = 0; for y in 0 .. size { - if self.module(x, y) == color { + if self.module(x, y) == runcolor { runy += 1; if runy == 5 { result += PENALTY_N1; @@ -685,15 +685,15 @@ impl QrCode { } } else { runhistory.add_run(runy); - if !color && runhistory.has_finder_like_pattern() { + if !runcolor && runhistory.has_finder_like_pattern() { result += PENALTY_N3; } - color = self.module(x, y); + runcolor = self.module(x, y); runy = 1; } } runhistory.add_run(runy); - if color { + if runcolor { runhistory.add_run(0); // Dummy run of white } if runhistory.has_finder_like_pattern() { diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index 2d6677e..7366757 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -513,10 +513,10 @@ namespace qrcodegen { // Adjacent modules in row having same color, and finder-like patterns for (let y = 0; y < this.size; y++) { let runHistory = [0,0,0,0,0,0,0]; - let color = false; + let runColor = false; let runX = 0; for (let x = 0; x < this.size; x++) { - if (this.modules[y][x] == color) { + if (this.modules[y][x] == runColor) { runX++; if (runX == 5) result += QrCode.PENALTY_N1; @@ -524,14 +524,14 @@ namespace qrcodegen { result++; } else { QrCode.addRunToHistory(runX, runHistory); - if (!color && QrCode.hasFinderLikePattern(runHistory)) + if (!runColor && QrCode.hasFinderLikePattern(runHistory)) result += QrCode.PENALTY_N3; - color = this.modules[y][x]; + runColor = this.modules[y][x]; runX = 1; } } QrCode.addRunToHistory(runX, runHistory); - if (color) + if (runColor) QrCode.addRunToHistory(0, runHistory); // Dummy run of white if (QrCode.hasFinderLikePattern(runHistory)) result += QrCode.PENALTY_N3; @@ -539,10 +539,10 @@ namespace qrcodegen { // Adjacent modules in column having same color, and finder-like patterns for (let x = 0; x < this.size; x++) { let runHistory = [0,0,0,0,0,0,0]; - let color = false; + let runColor = false; let runY = 0; for (let y = 0; y < this.size; y++) { - if (this.modules[y][x] == color) { + if (this.modules[y][x] == runColor) { runY++; if (runY == 5) result += QrCode.PENALTY_N1; @@ -550,14 +550,14 @@ namespace qrcodegen { result++; } else { QrCode.addRunToHistory(runY, runHistory); - if (!color && QrCode.hasFinderLikePattern(runHistory)) + if (!runColor && QrCode.hasFinderLikePattern(runHistory)) result += QrCode.PENALTY_N3; - color = this.modules[y][x]; + runColor = this.modules[y][x]; runY = 1; } } QrCode.addRunToHistory(runY, runHistory); - if (color) + if (runColor) QrCode.addRunToHistory(0, runHistory); // Dummy run of white if (QrCode.hasFinderLikePattern(runHistory)) result += QrCode.PENALTY_N3;