From e7d2449957fadc5074c5cf1708d49fcaa662b238 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Tue, 28 Aug 2018 03:53:17 +0000 Subject: [PATCH] Deleted comment and calculated the constant in QrCode.getNumRawDataModules() in all language versions except Java, because only the Java code explains the calculation in detail. --- c/qrcodegen.c | 2 +- cpp/QrCode.cpp | 2 +- javascript/qrcodegen.js | 2 +- python/qrcodegen.py | 2 +- rust/src/lib.rs | 2 +- typescript/qrcodegen.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/c/qrcodegen.c b/c/qrcodegen.c index 76876cf..31ea560 100644 --- a/c/qrcodegen.c +++ b/c/qrcodegen.c @@ -253,7 +253,7 @@ testable int getNumRawDataModules(int version) { int numAlign = version / 7 + 2; result -= (25 * numAlign - 10) * numAlign - 55; if (version >= 7) - result -= 18 * 2; // Subtract version information + result -= 36; } return result; } diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp index bb8e979..273056a 100644 --- a/cpp/QrCode.cpp +++ b/cpp/QrCode.cpp @@ -520,7 +520,7 @@ int QrCode::getNumRawDataModules(int ver) { int numAlign = ver / 7 + 2; result -= (25 * numAlign - 10) * numAlign - 55; if (ver >= 7) - result -= 18 * 2; // Subtract version information + result -= 36; } return result; } diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index 27cbc0c..fc3d5bd 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -628,7 +628,7 @@ var qrcodegen = new function() { var numAlign = Math.floor(ver / 7) + 2; result -= (25 * numAlign - 10) * numAlign - 55; if (ver >= 7) - result -= 18 * 2; // Subtract version information + result -= 36; } return result; }; diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 130f832..d2f07c1 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -515,7 +515,7 @@ class QrCode(object): numalign = ver // 7 + 2 result -= (25 * numalign - 10) * numalign - 55 if ver >= 7: - result -= 18 * 2 # Subtract version information + result -= 36 return result diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 486896f..78b2d2a 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -649,7 +649,7 @@ impl QrCode { let numalign: usize = (ver as usize) / 7 + 2; result -= (25 * numalign - 10) * numalign - 55; if ver >= 7 { - result -= 18 * 2; // Subtract version information + result -= 36; } } result diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index 73f03a3..de554a3 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -591,7 +591,7 @@ namespace qrcodegen { let numAlign: int = Math.floor(ver / 7) + 2; result -= (25 * numAlign - 10) * numAlign - 55; if (ver >= 7) - result -= 18 * 2; // Subtract version information + result -= 36; } return result; }