From e7854eb797aea13011eb72a29781fa3a842a684e Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Fri, 31 Aug 2018 17:23:16 +0000 Subject: [PATCH] Reformatted some whitespace for alignment in all language versions. --- c/qrcodegen.c | 4 ++-- cpp/QrCode.cpp | 4 ++-- java/io/nayuki/qrcodegen/QrCode.java | 4 ++-- javascript/qrcodegen.js | 4 ++-- python/qrcodegen.py | 4 ++-- rust/src/lib.rs | 4 ++-- typescript/qrcodegen.ts | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/c/qrcodegen.c b/c/qrcodegen.c index 19caed5..cfb7eb1 100644 --- a/c/qrcodegen.c +++ b/c/qrcodegen.c @@ -200,7 +200,7 @@ testable void addEccAndInterleave(uint8_t data[], int version, enum qrcodegen_Ec // Calculate parameter numbers assert(0 <= (int)ecl && (int)ecl < 4 && qrcodegen_VERSION_MIN <= version && version <= qrcodegen_VERSION_MAX); int numBlocks = NUM_ERROR_CORRECTION_BLOCKS[(int)ecl][version]; - int blockEccLen = ECC_CODEWORDS_PER_BLOCK[(int)ecl][version]; + int blockEccLen = ECC_CODEWORDS_PER_BLOCK [(int)ecl][version]; int rawCodewords = getNumRawDataModules(version) / 8; int dataLen = getNumDataCodewords(version, ecl); int numShortBlocks = numBlocks - rawCodewords % numBlocks; @@ -233,7 +233,7 @@ testable int getNumDataCodewords(int version, enum qrcodegen_Ecc ecl) { int v = version, e = (int)ecl; assert(0 <= e && e < 4); return getNumRawDataModules(v) / 8 - - ECC_CODEWORDS_PER_BLOCK[e][v] + - ECC_CODEWORDS_PER_BLOCK [e][v] * NUM_ERROR_CORRECTION_BLOCKS[e][v]; } diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp index 8160866..514435b 100644 --- a/cpp/QrCode.cpp +++ b/cpp/QrCode.cpp @@ -306,7 +306,7 @@ vector QrCode::addEccAndInterleave(const vector &data) const { // Calculate parameter numbers int numBlocks = NUM_ERROR_CORRECTION_BLOCKS[static_cast(errorCorrectionLevel)][version]; - int blockEccLen = ECC_CODEWORDS_PER_BLOCK[static_cast(errorCorrectionLevel)][version]; + int blockEccLen = ECC_CODEWORDS_PER_BLOCK [static_cast(errorCorrectionLevel)][version]; int rawCodewords = getNumRawDataModules(version) / 8; int numShortBlocks = numBlocks - rawCodewords % numBlocks; int shortBlockLen = rawCodewords / numBlocks; @@ -524,7 +524,7 @@ int QrCode::getNumRawDataModules(int ver) { int QrCode::getNumDataCodewords(int ver, Ecc ecl) { return getNumRawDataModules(ver) / 8 - - ECC_CODEWORDS_PER_BLOCK[static_cast(ecl)][ver] + - ECC_CODEWORDS_PER_BLOCK [static_cast(ecl)][ver] * NUM_ERROR_CORRECTION_BLOCKS[static_cast(ecl)][ver]; } diff --git a/java/io/nayuki/qrcodegen/QrCode.java b/java/io/nayuki/qrcodegen/QrCode.java index 532d163..36e7939 100644 --- a/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/io/nayuki/qrcodegen/QrCode.java @@ -442,7 +442,7 @@ public final class QrCode { // Calculate parameter numbers int numBlocks = NUM_ERROR_CORRECTION_BLOCKS[errorCorrectionLevel.ordinal()][version]; - int blockEccLen = ECC_CODEWORDS_PER_BLOCK[errorCorrectionLevel.ordinal()][version]; + int blockEccLen = ECC_CODEWORDS_PER_BLOCK [errorCorrectionLevel.ordinal()][version]; int rawCodewords = getNumRawDataModules(version) / 8; int numShortBlocks = numBlocks - rawCodewords % numBlocks; int shortBlockLen = rawCodewords / numBlocks; @@ -693,7 +693,7 @@ public final class QrCode { // This stateless pure function could be implemented as a (40*4)-cell lookup table. static int getNumDataCodewords(int ver, Ecc ecl) { return getNumRawDataModules(ver) / 8 - - ECC_CODEWORDS_PER_BLOCK[ecl.ordinal()][ver] + - ECC_CODEWORDS_PER_BLOCK [ecl.ordinal()][ver] * NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal()][ver]; } diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index bb4096e..ffc6fe0 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -315,7 +315,7 @@ var qrcodegen = new function() { // Calculate parameter numbers var numBlocks = QrCode.NUM_ERROR_CORRECTION_BLOCKS[errCorLvl.ordinal][version]; - var blockEccLen = QrCode.ECC_CODEWORDS_PER_BLOCK[errCorLvl.ordinal][version]; + var blockEccLen = QrCode.ECC_CODEWORDS_PER_BLOCK [errCorLvl.ordinal][version]; var rawCodewords = Math.floor(QrCode.getNumRawDataModules(version) / 8); var numShortBlocks = numBlocks - rawCodewords % numBlocks; var shortBlockLen = Math.floor(rawCodewords / numBlocks); @@ -633,7 +633,7 @@ var qrcodegen = new function() { // This stateless pure function could be implemented as a (40*4)-cell lookup table. QrCode.getNumDataCodewords = function(ver, ecl) { return Math.floor(QrCode.getNumRawDataModules(ver) / 8) - - QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * + QrCode.ECC_CODEWORDS_PER_BLOCK [ecl.ordinal][ver] * QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver]; }; diff --git a/python/qrcodegen.py b/python/qrcodegen.py index fbf5a13..67e45ae 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -356,7 +356,7 @@ class QrCode(object): # Calculate parameter numbers numblocks = QrCode._NUM_ERROR_CORRECTION_BLOCKS[self._errcorlvl.ordinal][version] - blockecclen = QrCode._ECC_CODEWORDS_PER_BLOCK[self._errcorlvl.ordinal][version] + blockecclen = QrCode._ECC_CODEWORDS_PER_BLOCK [self._errcorlvl.ordinal][version] rawcodewords = QrCode._get_num_raw_data_modules(version) // 8 numshortblocks = numblocks - rawcodewords % numblocks shortblocklen = rawcodewords // numblocks @@ -523,7 +523,7 @@ class QrCode(object): QR Code of the given version number and error correction level, with remainder bits discarded. This stateless pure function could be implemented as a (40*4)-cell lookup table.""" return QrCode._get_num_raw_data_modules(ver) // 8 \ - - QrCode._ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] \ + - QrCode._ECC_CODEWORDS_PER_BLOCK [ecl.ordinal][ver] \ * QrCode._NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver] diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 2b78197..f80c22a 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -410,7 +410,7 @@ impl QrCode { // Calculate parameter numbers let numblocks: usize = QrCode::table_get(&NUM_ERROR_CORRECTION_BLOCKS, ver, ecl); - let blockecclen: usize = QrCode::table_get(&ECC_CODEWORDS_PER_BLOCK, ver, ecl); + let blockecclen: usize = QrCode::table_get(&ECC_CODEWORDS_PER_BLOCK , ver, ecl); let rawcodewords: usize = QrCode::get_num_raw_data_modules(ver) / 8; let numshortblocks: usize = numblocks - rawcodewords % numblocks; let shortblocklen: usize = rawcodewords / numblocks; @@ -659,7 +659,7 @@ impl QrCode { // This stateless pure function could be implemented as a (40*4)-cell lookup table. fn get_num_data_codewords(ver: Version, ecl: QrCodeEcc) -> usize { QrCode::get_num_raw_data_modules(ver) / 8 - - QrCode::table_get(&ECC_CODEWORDS_PER_BLOCK, ver, ecl) + - QrCode::table_get(&ECC_CODEWORDS_PER_BLOCK , ver, ecl) * QrCode::table_get(&NUM_ERROR_CORRECTION_BLOCKS, ver, ecl) } diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index 5538270..797b493 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -385,7 +385,7 @@ namespace qrcodegen { // Calculate parameter numbers let numBlocks: int = QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver]; - let blockEccLen: int = QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver]; + let blockEccLen: int = QrCode.ECC_CODEWORDS_PER_BLOCK [ecl.ordinal][ver]; let rawCodewords: int = Math.floor(QrCode.getNumRawDataModules(ver) / 8); let numShortBlocks: int = numBlocks - rawCodewords % numBlocks; let shortBlockLen: int = Math.floor(rawCodewords / numBlocks); @@ -597,7 +597,7 @@ namespace qrcodegen { // This stateless pure function could be implemented as a (40*4)-cell lookup table. private static getNumDataCodewords(ver: int, ecl: QrCode.Ecc): int { return Math.floor(QrCode.getNumRawDataModules(ver) / 8) - - QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * + QrCode.ECC_CODEWORDS_PER_BLOCK [ecl.ordinal][ver] * QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver]; }