mirror of
https://github.com/openharmony/third_party_qrcodegen.git
synced 2026-07-19 20:23:35 -04:00
Tweaked comments and statement order in QrCode constructor, in most languages.
This commit is contained in:
+2
-4
@@ -115,16 +115,14 @@ QrCode QrCode::encodeSegments(const vector<QrSegment> &segs, Ecc ecl,
|
||||
|
||||
|
||||
QrCode::QrCode(int ver, Ecc ecl, const vector<uint8_t> &dataCodewords, int mask) :
|
||||
// Initialize fields
|
||||
// Initialize fields and check arguments
|
||||
version(ver),
|
||||
size(MIN_VERSION <= ver && ver <= MAX_VERSION ? ver * 4 + 17 : -1), // Avoid signed overflow undefined behavior
|
||||
errorCorrectionLevel(ecl),
|
||||
modules (size, vector<bool>(size)), // Initially all white
|
||||
isFunction(size, vector<bool>(size)) {
|
||||
|
||||
// Check arguments
|
||||
if (ver < MIN_VERSION || ver > MAX_VERSION || mask < -1 || mask > 7)
|
||||
throw std::domain_error("Value out of range");
|
||||
size = ver * 4 + 17;
|
||||
|
||||
// Compute ECC, draw modules, do masking
|
||||
drawFunctionPatterns();
|
||||
|
||||
Reference in New Issue
Block a user