Reorganized a chunk of code in worker program of {Java, Python, C, C++} language versions, without changing behavior.

This commit is contained in:
Project Nayuki
2017-08-28 04:03:05 +00:00
parent 712dfb9f77
commit 4d6185a5d3
4 changed files with 29 additions and 41 deletions
+3 -6
View File
@@ -83,11 +83,9 @@ int main() {
} else
segs.push_back(QrSegment::makeBytes(data));
// Try to make QR Code symbol
try {
try { // Try to make QR Code symbol
const QrCode qr = QrCode::encodeSegments(segs,
*ECC_LEVELS[errCorLvl], minVersion, maxVersion, mask, boostEcl == 1);
// Print grid of modules
std::cout << qr.version << std::endl;
for (int y = 0; y < qr.size; y++) {
@@ -96,12 +94,11 @@ int main() {
}
} catch (const char *msg) {
if (strcmp(msg, "Data too long") == 0)
std::cout << -1 << std::endl;
else {
if (strcmp(msg, "Data too long") != 0) {
std::cerr << msg << std::endl;
return EXIT_FAILURE;
}
std::cout << -1 << std::endl;
}
std::cout << std::flush;
}