diff --git a/cpp/QrCode.cpp b/cpp/QrCode.cpp index c849f44..9eef0e4 100644 --- a/cpp/QrCode.cpp +++ b/cpp/QrCode.cpp @@ -104,7 +104,7 @@ QrCode QrCode::encodeSegments(const vector &segs, Ecc ecl, throw std::logic_error("Assertion error"); // Add terminator and pad up to a byte if applicable - size_t dataCapacityBits = getNumDataCodewords(version, ecl) * 8; + size_t dataCapacityBits = static_cast(getNumDataCodewords(version, ecl)) * 8; if (bb.size() > dataCapacityBits) throw std::logic_error("Assertion error"); bb.appendBits(0, std::min(4, static_cast(dataCapacityBits - bb.size()))); @@ -235,7 +235,7 @@ void QrCode::drawFunctionPatterns() { // Draw numerous alignment patterns const vector alignPatPos = getAlignmentPatternPositions(); - int numAlign = alignPatPos.size(); + int numAlign = static_cast(alignPatPos.size()); for (int i = 0; i < numAlign; i++) { for (int j = 0; j < numAlign; j++) { // Don't draw on the three finder corners @@ -348,7 +348,7 @@ vector QrCode::addEccAndInterleave(const vector &data) const { const vector rsDiv = reedSolomonComputeDivisor(blockEccLen); 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(); + k += static_cast(dat.size()); const vector ecc = reedSolomonComputeRemainder(dat, rsDiv); if (i < numShortBlocks) dat.push_back(0); diff --git a/cpp/QrCodeGeneratorWorker.cpp b/cpp/QrCodeGeneratorWorker.cpp index 2295593..073107f 100644 --- a/cpp/QrCodeGeneratorWorker.cpp +++ b/cpp/QrCodeGeneratorWorker.cpp @@ -26,6 +26,7 @@ * Software. */ +#include #include #include #include @@ -83,7 +84,7 @@ int main() { try { // Try to make QR Code symbol const QrCode qr = QrCode::encodeSegments(segs, - ECC_LEVELS.at(errCorLvl), minVersion, maxVersion, mask, boostEcl == 1); + ECC_LEVELS.at(static_cast(errCorLvl)), minVersion, maxVersion, mask, boostEcl == 1); // Print grid of modules std::cout << qr.getVersion() << std::endl; for (int y = 0; y < qr.getSize(); y++) {