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

This commit is contained in:
Project Nayuki 2018-08-26 02:17:47 +00:00
parent c86dacacb7
commit ccd571624e
6 changed files with 8 additions and 0 deletions

View File

@ -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();
} }

View File

@ -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;
} }

View File

@ -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 ----*/

View File

@ -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 ----

View File

@ -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
} }

View File

@ -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 = [];
} }