Tweaked C++ worker program to be more robust to bad inputs.

pull/31/head
Project Nayuki 7 years ago
parent 3208954e81
commit 015c243fb2

@ -37,7 +37,7 @@ using qrcodegen::QrCode;
using qrcodegen::QrSegment;
static const QrCode::Ecc ECC_LEVELS[] = {
static const std::vector<QrCode::Ecc> ECC_LEVELS{
QrCode::Ecc::LOW,
QrCode::Ecc::MEDIUM,
QrCode::Ecc::QUARTILE,
@ -83,7 +83,7 @@ int main() {
try { // Try to make QR Code symbol
const QrCode qr = QrCode::encodeSegments(segs,
ECC_LEVELS[errCorLvl], minVersion, maxVersion, mask, boostEcl == 1);
ECC_LEVELS.at(errCorLvl), minVersion, maxVersion, mask, boostEcl == 1);
// Print grid of modules
std::cout << qr.getVersion() << std::endl;
for (int y = 0; y < qr.getSize(); y++) {

Loading…
Cancel
Save