diff --git a/c/qrcodegen.c b/c/qrcodegen.c index 2374554..7ea0b6c 100644 --- a/c/qrcodegen.c +++ b/c/qrcodegen.c @@ -70,7 +70,8 @@ testable int getNumDataCodewords(int version, enum qrcodegen_Ecc ecl); testable int getNumRawDataModules(int version); testable void calcReedSolomonGenerator(int degree, uint8_t result[]); -testable void calcReedSolomonRemainder(const uint8_t data[], int dataLen, const uint8_t generator[], int degree, uint8_t result[]); +testable void calcReedSolomonRemainder(const uint8_t data[], int dataLen, + const uint8_t generator[], int degree, uint8_t result[]); testable uint8_t finiteFieldMultiply(uint8_t x, uint8_t y); testable void initializeFunctionModules(int version, uint8_t qrcode[]); @@ -451,7 +452,9 @@ testable void calcReedSolomonGenerator(int degree, uint8_t result[]) { // Calculates the remainder of the polynomial data[0 : dataLen] when divided by the generator[0 : degree], where all // polynomials are in big endian and the generator has an implicit leading 1 term, storing the result in result[0 : degree]. -testable void calcReedSolomonRemainder(const uint8_t data[], int dataLen, const uint8_t generator[], int degree, uint8_t result[]) { +testable void calcReedSolomonRemainder(const uint8_t data[], int dataLen, + const uint8_t generator[], int degree, uint8_t result[]) { + // Perform polynomial division assert(1 <= degree && degree <= 30); memset(result, 0, degree * sizeof(result[0])); diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp index 9b5e692..3636d0c 100644 --- a/cpp/QrCode.cpp +++ b/cpp/QrCode.cpp @@ -539,7 +539,9 @@ int QrCode::getNumRawDataModules(int ver) { int QrCode::getNumDataCodewords(int ver, const Ecc &ecl) { if (ver < 1 || ver > 40) throw "Version number out of range"; - return getNumRawDataModules(ver) / 8 - ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver]; + return getNumRawDataModules(ver) / 8 + - ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] + * NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver]; } diff --git a/java/io/nayuki/qrcodegen/QrCode.java b/java/io/nayuki/qrcodegen/QrCode.java index c513ff5..04b58aa 100644 --- a/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/io/nayuki/qrcodegen/QrCode.java @@ -310,7 +310,9 @@ public final class QrCode { StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append("\n"); - sb.append(String.format("\n", size + border * 2)); + sb.append(String.format( + "\n", + size + border * 2)); sb.append("\t\n"); sb.append("\t 40) throw new IllegalArgumentException("Version number out of range"); - return getNumRawDataModules(ver) / 8 - ECC_CODEWORDS_PER_BLOCK[ecl.ordinal()][ver] * NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal()][ver]; + return getNumRawDataModules(ver) / 8 + - 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 aec0326..b15868b 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -211,7 +211,8 @@ var qrcodegen = new function() { throw "Border must be non-negative"; var result = '\n'; result += '\n'; - result += '\n'; + result += '\n'; result += '\t\n'; result += '\t Option { - assert!(1 <= minversion && minversion <= maxversion && maxversion <= 40 && -1 <= mask && mask <= 7, "Invalid value"); + assert!(1 <= minversion && minversion <= maxversion && maxversion <= 40 + && -1 <= mask && mask <= 7, "Invalid value"); // Find the minimal version number to use let mut version: u8 = minversion; let datausedbits: usize; loop { - let datacapacitybits: usize = QrCode::get_num_data_codewords(version, ecl) * 8; // Number of data bits available + // Number of data bits available + let datacapacitybits: usize = QrCode::get_num_data_codewords(version, ecl) * 8; if let Some(n) = QrSegment::get_total_bits(segs, version) { if n <= datacapacitybits { datausedbits = n; @@ -223,7 +225,9 @@ impl QrCode { let mut result: String = String::new(); result.push_str("\n"); result.push_str("\n"); - result.push_str(&format!("\n", self.size + border * 2)); + result.push_str(&format!( + "\n", + self.size + border * 2)); result.push_str("\t\n"); result.push_str("\t> 9) * 0x537);