MCPcopy
hub / github.com/ShizukuIchi/pdf-editor / utf8FillLast

Function utf8FillLast

public/makeTextPDF.js:66928–66938  ·  view source on GitHub ↗
(buf)

Source from the content-addressed store, hash-verified

66926// behavior. The continuation byte check is included three times in the case
66927// where all of the continuation bytes for a character exist in the same buffer.
66928// It is also done this way as a slight performance increase instead of using a
66929// loop.
66930function utf8CheckExtraBytes(self, buf, p) {
66931 if ((buf[0] & 0xC0) !== 0x80) {
66932 self.lastNeed = 0;
66933 return '\ufffd';
66934 }
66935 if (self.lastNeed > 1 && buf.length > 1) {
66936 if ((buf[1] & 0xC0) !== 0x80) {
66937 self.lastNeed = 1;
66938 return '\ufffd';
66939 }
66940 if (self.lastNeed > 2 && buf.length > 2) {
66941 if ((buf[2] & 0xC0) !== 0x80) {

Callers

nothing calls this directly

Calls 2

utf8CheckExtraBytesFunction · 0.85
toStringMethod · 0.45

Tested by

no test coverage detected