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

This commit is contained in:
Project Nayuki 2018-02-26 19:56:44 +00:00
parent 3208954e81
commit 015c243fb2
1 changed files with 2 additions and 2 deletions

View File

@ -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++) {