Tweaked QrCode constructor to dispose of the isFunction array in all languages except C, but somewhat differently in each language.

pull/39/merge
Project Nayuki 6 years ago
parent c86dacacb7
commit ccd571624e

@ -129,6 +129,8 @@ QrCode::QrCode(int ver, Ecc ecl, const vector<uint8_t> &dataCodewords, int mask)
const vector<uint8_t> allCodewords = addEccAndInterleave(dataCodewords); const vector<uint8_t> allCodewords = addEccAndInterleave(dataCodewords);
drawCodewords(allCodewords); drawCodewords(allCodewords);
this->mask = handleConstructorMasking(mask); this->mask = handleConstructorMasking(mask);
isFunction.clear();
isFunction.shrink_to_fit();
} }

@ -230,6 +230,7 @@ public final class QrCode {
byte[] allCodewords = addEccAndInterleave(dataCodewords); byte[] allCodewords = addEccAndInterleave(dataCodewords);
drawCodewords(allCodewords); drawCodewords(allCodewords);
this.mask = handleConstructorMasking(mask); this.mask = handleConstructorMasking(mask);
isFunction = null;
} }

@ -113,6 +113,7 @@ var qrcodegen = new function() {
throw "Assertion error"; throw "Assertion error";
drawFormatBits(mask); // Overwrite old format bits drawFormatBits(mask); // Overwrite old format bits
applyMask(mask); // Apply the final choice of mask applyMask(mask); // Apply the final choice of mask
isFunction = null;
/*---- Read-only instance properties ----*/ /*---- Read-only instance properties ----*/

@ -188,6 +188,7 @@ class QrCode(object):
self._draw_format_bits(mask) # Overwrite old format bits self._draw_format_bits(mask) # Overwrite old format bits
self._apply_mask(mask) # Apply the final choice of mask self._apply_mask(mask) # Apply the final choice of mask
self._mask = mask self._mask = mask
del self._isfunction
# ---- Accessor methods ---- # ---- Accessor methods ----

@ -186,6 +186,8 @@ impl QrCode {
let allcodewords: Vec<u8> = result.add_ecc_and_interleave(datacodewords); let allcodewords: Vec<u8> = result.add_ecc_and_interleave(datacodewords);
result.draw_codewords(&allcodewords); result.draw_codewords(&allcodewords);
result.handle_constructor_masking(mask); result.handle_constructor_masking(mask);
result.isfunction.clear();
result.isfunction.shrink_to_fit();
result result
} }

@ -194,6 +194,7 @@ namespace qrcodegen {
this.mask = mask; this.mask = mask;
this.drawFormatBits(mask); // Overwrite old format bits this.drawFormatBits(mask); // Overwrite old format bits
this.applyMask(mask); // Apply the final choice of mask this.applyMask(mask); // Apply the final choice of mask
this.isFunction = [];
} }

Loading…
Cancel
Save