Added an assertion to QrCode.getNumRawDataModules() in all language versions.
This commit is contained in:
parent
585e80e4f5
commit
6e088f72d3
|
@ -345,6 +345,7 @@ testable int getNumRawDataModules(int ver) {
|
|||
if (ver >= 7)
|
||||
result -= 36;
|
||||
}
|
||||
assert(208 <= result && result <= 29648);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -531,6 +531,8 @@ int QrCode::getNumRawDataModules(int ver) {
|
|||
if (ver >= 7)
|
||||
result -= 36;
|
||||
}
|
||||
if (!(208 <= result && result <= 29648))
|
||||
throw std::logic_error("Assertion error");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -718,6 +718,7 @@ public final class QrCode {
|
|||
if (ver >= 7)
|
||||
result -= 6 * 3 * 2; // Subtract version information
|
||||
}
|
||||
assert 208 <= result && result <= 29648;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -550,6 +550,7 @@ class QrCode(object):
|
|||
result -= (25 * numalign - 10) * numalign - 55
|
||||
if ver >= 7:
|
||||
result -= 36
|
||||
assert 208 <= result <= 29648
|
||||
return result
|
||||
|
||||
|
||||
|
|
|
@ -753,6 +753,7 @@ impl QrCode {
|
|||
result -= 36;
|
||||
}
|
||||
}
|
||||
assert!(208 <= result && result <= 29648);
|
||||
result
|
||||
}
|
||||
|
||||
|
|
|
@ -619,6 +619,8 @@ namespace qrcodegen {
|
|||
if (ver >= 7)
|
||||
result -= 36;
|
||||
}
|
||||
if (!(208 <= result && result <= 29648))
|
||||
throw "Assertion error";
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue