MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / qrcodegen_encodeBinary

Function qrcodegen_encodeBinary

modules/data/qrcode/qrcodegen.c:167–180  ·  view source on GitHub ↗

Public function - see documentation comment in header file.

Source from the content-addressed store, hash-verified

165
166// Public function - see documentation comment in header file.
167bool qrcodegen_encodeBinary(uint8_t dataAndTemp[], size_t dataLen, uint8_t qrcode[],
168 enum qrcodegen_Ecc ecl, int minVersion, int maxVersion, enum qrcodegen_Mask mask, bool boostEcl) {
169
170 struct qrcodegen_Segment seg;
171 seg.mode = qrcodegen_Mode_BYTE;
172 seg.bitLength = calcSegmentBitLength(seg.mode, dataLen);
173 if (seg.bitLength == -1) {
174 qrcode[0] = 0; // Set size to invalid value for safety
175 return false;
176 }
177 seg.numChars = (int)dataLen;
178 seg.data = dataAndTemp;
179 return qrcodegen_encodeSegmentsAdvanced(&seg, 1, ecl, minVersion, maxVersion, mask, boostEcl, dataAndTemp, qrcode);
180}
181
182
183// Appends the given sequence of bits to the given byte-based bit buffer, increasing the bit length.

Callers 1

xs_qrcodeFunction · 0.85

Calls 2

calcSegmentBitLengthFunction · 0.85

Tested by

no test coverage detected