|
|
|
@ -104,7 +104,7 @@ QrCode QrCode::encodeSegments(const vector<QrSegment> &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<size_t>(getNumDataCodewords(version, ecl)) * 8;
|
|
|
|
|
if (bb.size() > dataCapacityBits)
|
|
|
|
|
throw std::logic_error("Assertion error");
|
|
|
|
|
bb.appendBits(0, std::min(4, static_cast<int>(dataCapacityBits - bb.size())));
|
|
|
|
@ -235,7 +235,7 @@ void QrCode::drawFunctionPatterns() {
|
|
|
|
|
|
|
|
|
|
// Draw numerous alignment patterns
|
|
|
|
|
const vector<int> alignPatPos = getAlignmentPatternPositions();
|
|
|
|
|
int numAlign = alignPatPos.size();
|
|
|
|
|
int numAlign = static_cast<int>(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<uint8_t> QrCode::addEccAndInterleave(const vector<uint8_t> &data) const {
|
|
|
|
|
const vector<uint8_t> rsDiv = reedSolomonComputeDivisor(blockEccLen);
|
|
|
|
|
for (int i = 0, k = 0; i < numBlocks; i++) {
|
|
|
|
|
vector<uint8_t> dat(data.cbegin() + k, data.cbegin() + (k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1)));
|
|
|
|
|
k += dat.size();
|
|
|
|
|
k += static_cast<int>(dat.size());
|
|
|
|
|
const vector<uint8_t> ecc = reedSolomonComputeRemainder(dat, rsDiv);
|
|
|
|
|
if (i < numShortBlocks)
|
|
|
|
|
dat.push_back(0);
|
|
|
|
|