Slightly tweaked code and comments to correspond to other language ports.

pull/134/head
Project Nayuki 3 years ago
parent 41b90335d9
commit d6be9c5e44

@ -200,9 +200,9 @@ class QrCode:
minpenalty = penalty
self._apply_mask(i) # Undoes the mask due to XOR
assert 0 <= mask <= 7
self._mask = mask
self._apply_mask(mask) # Apply the final choice of mask
self._draw_format_bits(mask) # Overwrite old format bits
self._mask = mask
del self._isfunction

@ -210,8 +210,7 @@ impl QrCode {
// Find the minimal version number to use
let mut version: Version = minversion;
let datausedbits: usize = loop {
// Number of data bits available
let datacapacitybits: usize = QrCode::get_num_data_codewords(version, ecl) * 8;
let datacapacitybits: usize = QrCode::get_num_data_codewords(version, ecl) * 8; // Number of data bits available
let dataused: Option<usize> = QrSegment::get_total_bits(segs, version);
if dataused.map_or(false, |n| n <= datacapacitybits) {
break dataused.unwrap(); // This version number is found to be suitable

Loading…
Cancel
Save