From 6a71979c2a46567057dc3cf6bf9d34a9f6bf3c56 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Mon, 26 Feb 2018 20:22:56 +0000 Subject: [PATCH] Tweaked C++ code style to use assignment operator instead of constructor for simple initialization of receiving an object. --- cpp/QrCode.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp index f831ef2..b62afe3 100644 --- a/cpp/QrCode.cpp +++ b/cpp/QrCode.cpp @@ -50,7 +50,7 @@ int QrCode::getFormatBits(Ecc ecl) { QrCode QrCode::encodeText(const char *text, Ecc ecl) { - vector segs(QrSegment::makeSegments(text)); + vector segs = QrSegment::makeSegments(text); return encodeSegments(segs, ecl); } @@ -123,7 +123,7 @@ QrCode::QrCode(int ver, Ecc ecl, const vector &dataCodewords, int mask) // Draw function patterns, draw all codewords, do masking drawFunctionPatterns(); - const vector allCodewords(appendErrorCorrection(dataCodewords)); + const vector allCodewords = appendErrorCorrection(dataCodewords); drawCodewords(allCodewords); this->mask = handleConstructorMasking(mask); } @@ -195,7 +195,7 @@ void QrCode::drawFunctionPatterns() { drawFinderPattern(3, size - 4); // Draw numerous alignment patterns - const vector alignPatPos(getAlignmentPatternPositions(version)); + const vector alignPatPos = getAlignmentPatternPositions(version); int numAlign = alignPatPos.size(); for (int i = 0; i < numAlign; i++) { for (int j = 0; j < numAlign; j++) { @@ -311,7 +311,7 @@ vector QrCode::appendErrorCorrection(const vector &data) const for (int i = 0, k = 0; i < numBlocks; i++) { vector dat(data.cbegin() + k, data.cbegin() + (k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1))); k += dat.size(); - const vector ecc(rs.getRemainder(dat)); + const vector ecc = rs.getRemainder(dat); if (i < numShortBlocks) dat.push_back(0); dat.insert(dat.end(), ecc.cbegin(), ecc.cend());