Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/embedpre.../assets/pdf/build
File: pdf.worker.js
}
[28500] Fix | Delete
dest.set(glyf, destStart);
[28501] Fix | Delete
glyphProfile.length = glyf.length;
[28502] Fix | Delete
return glyphProfile;
[28503] Fix | Delete
}
[28504] Fix | Delete
let i,
[28505] Fix | Delete
j = 10,
[28506] Fix | Delete
flagsCount = 0;
[28507] Fix | Delete
for (i = 0; i < contoursCount; i++) {
[28508] Fix | Delete
const endPoint = glyf[j] << 8 | glyf[j + 1];
[28509] Fix | Delete
flagsCount = endPoint + 1;
[28510] Fix | Delete
j += 2;
[28511] Fix | Delete
}
[28512] Fix | Delete
const instructionsStart = j;
[28513] Fix | Delete
const instructionsLength = glyf[j] << 8 | glyf[j + 1];
[28514] Fix | Delete
glyphProfile.sizeOfInstructions = instructionsLength;
[28515] Fix | Delete
j += 2 + instructionsLength;
[28516] Fix | Delete
const instructionsEnd = j;
[28517] Fix | Delete
let coordinatesLength = 0;
[28518] Fix | Delete
for (i = 0; i < flagsCount; i++) {
[28519] Fix | Delete
const flag = glyf[j++];
[28520] Fix | Delete
if (flag & 0xc0) {
[28521] Fix | Delete
glyf[j - 1] = flag & 0x3f;
[28522] Fix | Delete
}
[28523] Fix | Delete
let xLength = 2;
[28524] Fix | Delete
if (flag & 2) {
[28525] Fix | Delete
xLength = 1;
[28526] Fix | Delete
} else if (flag & 16) {
[28527] Fix | Delete
xLength = 0;
[28528] Fix | Delete
}
[28529] Fix | Delete
let yLength = 2;
[28530] Fix | Delete
if (flag & 4) {
[28531] Fix | Delete
yLength = 1;
[28532] Fix | Delete
} else if (flag & 32) {
[28533] Fix | Delete
yLength = 0;
[28534] Fix | Delete
}
[28535] Fix | Delete
const xyLength = xLength + yLength;
[28536] Fix | Delete
coordinatesLength += xyLength;
[28537] Fix | Delete
if (flag & 8) {
[28538] Fix | Delete
const repeat = glyf[j++];
[28539] Fix | Delete
if (repeat === 0) {
[28540] Fix | Delete
glyf[j - 1] ^= 8;
[28541] Fix | Delete
}
[28542] Fix | Delete
i += repeat;
[28543] Fix | Delete
coordinatesLength += repeat * xyLength;
[28544] Fix | Delete
}
[28545] Fix | Delete
}
[28546] Fix | Delete
if (coordinatesLength === 0) {
[28547] Fix | Delete
return glyphProfile;
[28548] Fix | Delete
}
[28549] Fix | Delete
let glyphDataLength = j + coordinatesLength;
[28550] Fix | Delete
if (glyphDataLength > glyf.length) {
[28551] Fix | Delete
return glyphProfile;
[28552] Fix | Delete
}
[28553] Fix | Delete
if (!hintsValid && instructionsLength > 0) {
[28554] Fix | Delete
dest.set(glyf.subarray(0, instructionsStart), destStart);
[28555] Fix | Delete
dest.set([0, 0], destStart + instructionsStart);
[28556] Fix | Delete
dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
[28557] Fix | Delete
glyphDataLength -= instructionsLength;
[28558] Fix | Delete
if (glyf.length - glyphDataLength > 3) {
[28559] Fix | Delete
glyphDataLength = glyphDataLength + 3 & ~3;
[28560] Fix | Delete
}
[28561] Fix | Delete
glyphProfile.length = glyphDataLength;
[28562] Fix | Delete
return glyphProfile;
[28563] Fix | Delete
}
[28564] Fix | Delete
if (glyf.length - glyphDataLength > 3) {
[28565] Fix | Delete
glyphDataLength = glyphDataLength + 3 & ~3;
[28566] Fix | Delete
dest.set(glyf.subarray(0, glyphDataLength), destStart);
[28567] Fix | Delete
glyphProfile.length = glyphDataLength;
[28568] Fix | Delete
return glyphProfile;
[28569] Fix | Delete
}
[28570] Fix | Delete
dest.set(glyf, destStart);
[28571] Fix | Delete
glyphProfile.length = glyf.length;
[28572] Fix | Delete
return glyphProfile;
[28573] Fix | Delete
}
[28574] Fix | Delete
function sanitizeHead(head, numGlyphs, locaLength) {
[28575] Fix | Delete
const data = head.data;
[28576] Fix | Delete
const version = int32(data[0], data[1], data[2], data[3]);
[28577] Fix | Delete
if (version >> 16 !== 1) {
[28578] Fix | Delete
info("Attempting to fix invalid version in head table: " + version);
[28579] Fix | Delete
data[0] = 0;
[28580] Fix | Delete
data[1] = 1;
[28581] Fix | Delete
data[2] = 0;
[28582] Fix | Delete
data[3] = 0;
[28583] Fix | Delete
}
[28584] Fix | Delete
const indexToLocFormat = int16(data[50], data[51]);
[28585] Fix | Delete
if (indexToLocFormat < 0 || indexToLocFormat > 1) {
[28586] Fix | Delete
info("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
[28587] Fix | Delete
const numGlyphsPlusOne = numGlyphs + 1;
[28588] Fix | Delete
if (locaLength === numGlyphsPlusOne << 1) {
[28589] Fix | Delete
data[50] = 0;
[28590] Fix | Delete
data[51] = 0;
[28591] Fix | Delete
} else if (locaLength === numGlyphsPlusOne << 2) {
[28592] Fix | Delete
data[50] = 0;
[28593] Fix | Delete
data[51] = 1;
[28594] Fix | Delete
} else {
[28595] Fix | Delete
throw new FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
[28596] Fix | Delete
}
[28597] Fix | Delete
}
[28598] Fix | Delete
}
[28599] Fix | Delete
function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
[28600] Fix | Delete
let itemSize, itemDecode, itemEncode;
[28601] Fix | Delete
if (isGlyphLocationsLong) {
[28602] Fix | Delete
itemSize = 4;
[28603] Fix | Delete
itemDecode = function fontItemDecodeLong(data, offset) {
[28604] Fix | Delete
return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
[28605] Fix | Delete
};
[28606] Fix | Delete
itemEncode = function fontItemEncodeLong(data, offset, value) {
[28607] Fix | Delete
data[offset] = value >>> 24 & 0xff;
[28608] Fix | Delete
data[offset + 1] = value >> 16 & 0xff;
[28609] Fix | Delete
data[offset + 2] = value >> 8 & 0xff;
[28610] Fix | Delete
data[offset + 3] = value & 0xff;
[28611] Fix | Delete
};
[28612] Fix | Delete
} else {
[28613] Fix | Delete
itemSize = 2;
[28614] Fix | Delete
itemDecode = function fontItemDecode(data, offset) {
[28615] Fix | Delete
return data[offset] << 9 | data[offset + 1] << 1;
[28616] Fix | Delete
};
[28617] Fix | Delete
itemEncode = function fontItemEncode(data, offset, value) {
[28618] Fix | Delete
data[offset] = value >> 9 & 0xff;
[28619] Fix | Delete
data[offset + 1] = value >> 1 & 0xff;
[28620] Fix | Delete
};
[28621] Fix | Delete
}
[28622] Fix | Delete
const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
[28623] Fix | Delete
const locaDataSize = itemSize * (1 + numGlyphsOut);
[28624] Fix | Delete
const locaData = new Uint8Array(locaDataSize);
[28625] Fix | Delete
locaData.set(loca.data.subarray(0, locaDataSize));
[28626] Fix | Delete
loca.data = locaData;
[28627] Fix | Delete
const oldGlyfData = glyf.data;
[28628] Fix | Delete
const oldGlyfDataLength = oldGlyfData.length;
[28629] Fix | Delete
const newGlyfData = new Uint8Array(oldGlyfDataLength);
[28630] Fix | Delete
let i, j;
[28631] Fix | Delete
const locaEntries = [];
[28632] Fix | Delete
for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
[28633] Fix | Delete
let offset = itemDecode(locaData, j);
[28634] Fix | Delete
if (offset > oldGlyfDataLength) {
[28635] Fix | Delete
offset = oldGlyfDataLength;
[28636] Fix | Delete
}
[28637] Fix | Delete
locaEntries.push({
[28638] Fix | Delete
index: i,
[28639] Fix | Delete
offset,
[28640] Fix | Delete
endOffset: 0
[28641] Fix | Delete
});
[28642] Fix | Delete
}
[28643] Fix | Delete
locaEntries.sort((a, b) => a.offset - b.offset);
[28644] Fix | Delete
for (i = 0; i < numGlyphs; i++) {
[28645] Fix | Delete
locaEntries[i].endOffset = locaEntries[i + 1].offset;
[28646] Fix | Delete
}
[28647] Fix | Delete
locaEntries.sort((a, b) => a.index - b.index);
[28648] Fix | Delete
for (i = 0; i < numGlyphs; i++) {
[28649] Fix | Delete
const {
[28650] Fix | Delete
offset,
[28651] Fix | Delete
endOffset
[28652] Fix | Delete
} = locaEntries[i];
[28653] Fix | Delete
if (offset !== 0 || endOffset !== 0) {
[28654] Fix | Delete
break;
[28655] Fix | Delete
}
[28656] Fix | Delete
const nextOffset = locaEntries[i + 1].offset;
[28657] Fix | Delete
if (nextOffset === 0) {
[28658] Fix | Delete
continue;
[28659] Fix | Delete
}
[28660] Fix | Delete
locaEntries[i].endOffset = nextOffset;
[28661] Fix | Delete
break;
[28662] Fix | Delete
}
[28663] Fix | Delete
const last = locaEntries.at(-2);
[28664] Fix | Delete
if (last.offset !== 0 && last.endOffset === 0) {
[28665] Fix | Delete
last.endOffset = oldGlyfDataLength;
[28666] Fix | Delete
}
[28667] Fix | Delete
const missingGlyphs = Object.create(null);
[28668] Fix | Delete
let writeOffset = 0;
[28669] Fix | Delete
itemEncode(locaData, 0, writeOffset);
[28670] Fix | Delete
for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
[28671] Fix | Delete
const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
[28672] Fix | Delete
const newLength = glyphProfile.length;
[28673] Fix | Delete
if (newLength === 0) {
[28674] Fix | Delete
missingGlyphs[i] = true;
[28675] Fix | Delete
}
[28676] Fix | Delete
if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
[28677] Fix | Delete
maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
[28678] Fix | Delete
}
[28679] Fix | Delete
writeOffset += newLength;
[28680] Fix | Delete
itemEncode(locaData, j, writeOffset);
[28681] Fix | Delete
}
[28682] Fix | Delete
if (writeOffset === 0) {
[28683] Fix | Delete
const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
[28684] Fix | Delete
for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
[28685] Fix | Delete
itemEncode(locaData, j, simpleGlyph.length);
[28686] Fix | Delete
}
[28687] Fix | Delete
glyf.data = simpleGlyph;
[28688] Fix | Delete
} else if (dupFirstEntry) {
[28689] Fix | Delete
const firstEntryLength = itemDecode(locaData, itemSize);
[28690] Fix | Delete
if (newGlyfData.length > firstEntryLength + writeOffset) {
[28691] Fix | Delete
glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
[28692] Fix | Delete
} else {
[28693] Fix | Delete
glyf.data = new Uint8Array(firstEntryLength + writeOffset);
[28694] Fix | Delete
glyf.data.set(newGlyfData.subarray(0, writeOffset));
[28695] Fix | Delete
}
[28696] Fix | Delete
glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
[28697] Fix | Delete
itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
[28698] Fix | Delete
} else {
[28699] Fix | Delete
glyf.data = newGlyfData.subarray(0, writeOffset);
[28700] Fix | Delete
}
[28701] Fix | Delete
return {
[28702] Fix | Delete
missingGlyphs,
[28703] Fix | Delete
maxSizeOfInstructions
[28704] Fix | Delete
};
[28705] Fix | Delete
}
[28706] Fix | Delete
function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
[28707] Fix | Delete
const start = (font.start || 0) + post.offset;
[28708] Fix | Delete
font.pos = start;
[28709] Fix | Delete
const length = post.length,
[28710] Fix | Delete
end = start + length;
[28711] Fix | Delete
const version = font.getInt32();
[28712] Fix | Delete
font.skip(28);
[28713] Fix | Delete
let glyphNames;
[28714] Fix | Delete
let valid = true;
[28715] Fix | Delete
let i;
[28716] Fix | Delete
switch (version) {
[28717] Fix | Delete
case 0x00010000:
[28718] Fix | Delete
glyphNames = MacStandardGlyphOrdering;
[28719] Fix | Delete
break;
[28720] Fix | Delete
case 0x00020000:
[28721] Fix | Delete
const numGlyphs = font.getUint16();
[28722] Fix | Delete
if (numGlyphs !== maxpNumGlyphs) {
[28723] Fix | Delete
valid = false;
[28724] Fix | Delete
break;
[28725] Fix | Delete
}
[28726] Fix | Delete
const glyphNameIndexes = [];
[28727] Fix | Delete
for (i = 0; i < numGlyphs; ++i) {
[28728] Fix | Delete
const index = font.getUint16();
[28729] Fix | Delete
if (index >= 32768) {
[28730] Fix | Delete
valid = false;
[28731] Fix | Delete
break;
[28732] Fix | Delete
}
[28733] Fix | Delete
glyphNameIndexes.push(index);
[28734] Fix | Delete
}
[28735] Fix | Delete
if (!valid) {
[28736] Fix | Delete
break;
[28737] Fix | Delete
}
[28738] Fix | Delete
const customNames = [],
[28739] Fix | Delete
strBuf = [];
[28740] Fix | Delete
while (font.pos < end) {
[28741] Fix | Delete
const stringLength = font.getByte();
[28742] Fix | Delete
strBuf.length = stringLength;
[28743] Fix | Delete
for (i = 0; i < stringLength; ++i) {
[28744] Fix | Delete
strBuf[i] = String.fromCharCode(font.getByte());
[28745] Fix | Delete
}
[28746] Fix | Delete
customNames.push(strBuf.join(""));
[28747] Fix | Delete
}
[28748] Fix | Delete
glyphNames = [];
[28749] Fix | Delete
for (i = 0; i < numGlyphs; ++i) {
[28750] Fix | Delete
const j = glyphNameIndexes[i];
[28751] Fix | Delete
if (j < 258) {
[28752] Fix | Delete
glyphNames.push(MacStandardGlyphOrdering[j]);
[28753] Fix | Delete
continue;
[28754] Fix | Delete
}
[28755] Fix | Delete
glyphNames.push(customNames[j - 258]);
[28756] Fix | Delete
}
[28757] Fix | Delete
break;
[28758] Fix | Delete
case 0x00030000:
[28759] Fix | Delete
break;
[28760] Fix | Delete
default:
[28761] Fix | Delete
warn("Unknown/unsupported post table version " + version);
[28762] Fix | Delete
valid = false;
[28763] Fix | Delete
if (propertiesObj.defaultEncoding) {
[28764] Fix | Delete
glyphNames = propertiesObj.defaultEncoding;
[28765] Fix | Delete
}
[28766] Fix | Delete
break;
[28767] Fix | Delete
}
[28768] Fix | Delete
propertiesObj.glyphNames = glyphNames;
[28769] Fix | Delete
return valid;
[28770] Fix | Delete
}
[28771] Fix | Delete
function readNameTable(nameTable) {
[28772] Fix | Delete
const start = (font.start || 0) + nameTable.offset;
[28773] Fix | Delete
font.pos = start;
[28774] Fix | Delete
const names = [[], []],
[28775] Fix | Delete
records = [];
[28776] Fix | Delete
const length = nameTable.length,
[28777] Fix | Delete
end = start + length;
[28778] Fix | Delete
const format = font.getUint16();
[28779] Fix | Delete
const FORMAT_0_HEADER_LENGTH = 6;
[28780] Fix | Delete
if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
[28781] Fix | Delete
return [names, records];
[28782] Fix | Delete
}
[28783] Fix | Delete
const numRecords = font.getUint16();
[28784] Fix | Delete
const stringsStart = font.getUint16();
[28785] Fix | Delete
const NAME_RECORD_LENGTH = 12;
[28786] Fix | Delete
let i, ii;
[28787] Fix | Delete
for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
[28788] Fix | Delete
const r = {
[28789] Fix | Delete
platform: font.getUint16(),
[28790] Fix | Delete
encoding: font.getUint16(),
[28791] Fix | Delete
language: font.getUint16(),
[28792] Fix | Delete
name: font.getUint16(),
[28793] Fix | Delete
length: font.getUint16(),
[28794] Fix | Delete
offset: font.getUint16()
[28795] Fix | Delete
};
[28796] Fix | Delete
if (isMacNameRecord(r) || isWinNameRecord(r)) {
[28797] Fix | Delete
records.push(r);
[28798] Fix | Delete
}
[28799] Fix | Delete
}
[28800] Fix | Delete
for (i = 0, ii = records.length; i < ii; i++) {
[28801] Fix | Delete
const record = records[i];
[28802] Fix | Delete
if (record.length <= 0) {
[28803] Fix | Delete
continue;
[28804] Fix | Delete
}
[28805] Fix | Delete
const pos = start + stringsStart + record.offset;
[28806] Fix | Delete
if (pos + record.length > end) {
[28807] Fix | Delete
continue;
[28808] Fix | Delete
}
[28809] Fix | Delete
font.pos = pos;
[28810] Fix | Delete
const nameIndex = record.name;
[28811] Fix | Delete
if (record.encoding) {
[28812] Fix | Delete
let str = "";
[28813] Fix | Delete
for (let j = 0, jj = record.length; j < jj; j += 2) {
[28814] Fix | Delete
str += String.fromCharCode(font.getUint16());
[28815] Fix | Delete
}
[28816] Fix | Delete
names[1][nameIndex] = str;
[28817] Fix | Delete
} else {
[28818] Fix | Delete
names[0][nameIndex] = font.getString(record.length);
[28819] Fix | Delete
}
[28820] Fix | Delete
}
[28821] Fix | Delete
return [names, records];
[28822] Fix | Delete
}
[28823] Fix | Delete
const TTOpsStackDeltas = [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2];
[28824] Fix | Delete
function sanitizeTTProgram(table, ttContext) {
[28825] Fix | Delete
let data = table.data;
[28826] Fix | Delete
let i = 0,
[28827] Fix | Delete
j,
[28828] Fix | Delete
n,
[28829] Fix | Delete
b,
[28830] Fix | Delete
funcId,
[28831] Fix | Delete
pc,
[28832] Fix | Delete
lastEndf = 0,
[28833] Fix | Delete
lastDeff = 0;
[28834] Fix | Delete
const stack = [];
[28835] Fix | Delete
const callstack = [];
[28836] Fix | Delete
const functionsCalled = [];
[28837] Fix | Delete
let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
[28838] Fix | Delete
let inFDEF = false,
[28839] Fix | Delete
ifLevel = 0,
[28840] Fix | Delete
inELSE = 0;
[28841] Fix | Delete
for (let ii = data.length; i < ii;) {
[28842] Fix | Delete
const op = data[i++];
[28843] Fix | Delete
if (op === 0x40) {
[28844] Fix | Delete
n = data[i++];
[28845] Fix | Delete
if (inFDEF || inELSE) {
[28846] Fix | Delete
i += n;
[28847] Fix | Delete
} else {
[28848] Fix | Delete
for (j = 0; j < n; j++) {
[28849] Fix | Delete
stack.push(data[i++]);
[28850] Fix | Delete
}
[28851] Fix | Delete
}
[28852] Fix | Delete
} else if (op === 0x41) {
[28853] Fix | Delete
n = data[i++];
[28854] Fix | Delete
if (inFDEF || inELSE) {
[28855] Fix | Delete
i += n * 2;
[28856] Fix | Delete
} else {
[28857] Fix | Delete
for (j = 0; j < n; j++) {
[28858] Fix | Delete
b = data[i++];
[28859] Fix | Delete
stack.push(b << 8 | data[i++]);
[28860] Fix | Delete
}
[28861] Fix | Delete
}
[28862] Fix | Delete
} else if ((op & 0xf8) === 0xb0) {
[28863] Fix | Delete
n = op - 0xb0 + 1;
[28864] Fix | Delete
if (inFDEF || inELSE) {
[28865] Fix | Delete
i += n;
[28866] Fix | Delete
} else {
[28867] Fix | Delete
for (j = 0; j < n; j++) {
[28868] Fix | Delete
stack.push(data[i++]);
[28869] Fix | Delete
}
[28870] Fix | Delete
}
[28871] Fix | Delete
} else if ((op & 0xf8) === 0xb8) {
[28872] Fix | Delete
n = op - 0xb8 + 1;
[28873] Fix | Delete
if (inFDEF || inELSE) {
[28874] Fix | Delete
i += n * 2;
[28875] Fix | Delete
} else {
[28876] Fix | Delete
for (j = 0; j < n; j++) {
[28877] Fix | Delete
b = data[i++];
[28878] Fix | Delete
stack.push(b << 8 | data[i++]);
[28879] Fix | Delete
}
[28880] Fix | Delete
}
[28881] Fix | Delete
} else if (op === 0x2b && !tooComplexToFollowFunctions) {
[28882] Fix | Delete
if (!inFDEF && !inELSE) {
[28883] Fix | Delete
funcId = stack.at(-1);
[28884] Fix | Delete
if (isNaN(funcId)) {
[28885] Fix | Delete
info("TT: CALL empty stack (or invalid entry).");
[28886] Fix | Delete
} else {
[28887] Fix | Delete
ttContext.functionsUsed[funcId] = true;
[28888] Fix | Delete
if (funcId in ttContext.functionsStackDeltas) {
[28889] Fix | Delete
const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
[28890] Fix | Delete
if (newStackLength < 0) {
[28891] Fix | Delete
warn("TT: CALL invalid functions stack delta.");
[28892] Fix | Delete
ttContext.hintsValid = false;
[28893] Fix | Delete
return;
[28894] Fix | Delete
}
[28895] Fix | Delete
stack.length = newStackLength;
[28896] Fix | Delete
} else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
[28897] Fix | Delete
callstack.push({
[28898] Fix | Delete
data,
[28899] Fix | Delete
i,
[28900] Fix | Delete
stackTop: stack.length - 1
[28901] Fix | Delete
});
[28902] Fix | Delete
functionsCalled.push(funcId);
[28903] Fix | Delete
pc = ttContext.functionsDefined[funcId];
[28904] Fix | Delete
if (!pc) {
[28905] Fix | Delete
warn("TT: CALL non-existent function");
[28906] Fix | Delete
ttContext.hintsValid = false;
[28907] Fix | Delete
return;
[28908] Fix | Delete
}
[28909] Fix | Delete
data = pc.data;
[28910] Fix | Delete
i = pc.i;
[28911] Fix | Delete
}
[28912] Fix | Delete
}
[28913] Fix | Delete
}
[28914] Fix | Delete
} else if (op === 0x2c && !tooComplexToFollowFunctions) {
[28915] Fix | Delete
if (inFDEF || inELSE) {
[28916] Fix | Delete
warn("TT: nested FDEFs not allowed");
[28917] Fix | Delete
tooComplexToFollowFunctions = true;
[28918] Fix | Delete
}
[28919] Fix | Delete
inFDEF = true;
[28920] Fix | Delete
lastDeff = i;
[28921] Fix | Delete
funcId = stack.pop();
[28922] Fix | Delete
ttContext.functionsDefined[funcId] = {
[28923] Fix | Delete
data,
[28924] Fix | Delete
i
[28925] Fix | Delete
};
[28926] Fix | Delete
} else if (op === 0x2d) {
[28927] Fix | Delete
if (inFDEF) {
[28928] Fix | Delete
inFDEF = false;
[28929] Fix | Delete
lastEndf = i;
[28930] Fix | Delete
} else {
[28931] Fix | Delete
pc = callstack.pop();
[28932] Fix | Delete
if (!pc) {
[28933] Fix | Delete
warn("TT: ENDF bad stack");
[28934] Fix | Delete
ttContext.hintsValid = false;
[28935] Fix | Delete
return;
[28936] Fix | Delete
}
[28937] Fix | Delete
funcId = functionsCalled.pop();
[28938] Fix | Delete
data = pc.data;
[28939] Fix | Delete
i = pc.i;
[28940] Fix | Delete
ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
[28941] Fix | Delete
}
[28942] Fix | Delete
} else if (op === 0x89) {
[28943] Fix | Delete
if (inFDEF || inELSE) {
[28944] Fix | Delete
warn("TT: nested IDEFs not allowed");
[28945] Fix | Delete
tooComplexToFollowFunctions = true;
[28946] Fix | Delete
}
[28947] Fix | Delete
inFDEF = true;
[28948] Fix | Delete
lastDeff = i;
[28949] Fix | Delete
} else if (op === 0x58) {
[28950] Fix | Delete
++ifLevel;
[28951] Fix | Delete
} else if (op === 0x1b) {
[28952] Fix | Delete
inELSE = ifLevel;
[28953] Fix | Delete
} else if (op === 0x59) {
[28954] Fix | Delete
if (inELSE === ifLevel) {
[28955] Fix | Delete
inELSE = 0;
[28956] Fix | Delete
}
[28957] Fix | Delete
--ifLevel;
[28958] Fix | Delete
} else if (op === 0x1c) {
[28959] Fix | Delete
if (!inFDEF && !inELSE) {
[28960] Fix | Delete
const offset = stack.at(-1);
[28961] Fix | Delete
if (offset > 0) {
[28962] Fix | Delete
i += offset - 1;
[28963] Fix | Delete
}
[28964] Fix | Delete
}
[28965] Fix | Delete
}
[28966] Fix | Delete
if (!inFDEF && !inELSE) {
[28967] Fix | Delete
let stackDelta = 0;
[28968] Fix | Delete
if (op <= 0x8e) {
[28969] Fix | Delete
stackDelta = TTOpsStackDeltas[op];
[28970] Fix | Delete
} else if (op >= 0xc0 && op <= 0xdf) {
[28971] Fix | Delete
stackDelta = -1;
[28972] Fix | Delete
} else if (op >= 0xe0) {
[28973] Fix | Delete
stackDelta = -2;
[28974] Fix | Delete
}
[28975] Fix | Delete
if (op >= 0x71 && op <= 0x75) {
[28976] Fix | Delete
n = stack.pop();
[28977] Fix | Delete
if (!isNaN(n)) {
[28978] Fix | Delete
stackDelta = -n * 2;
[28979] Fix | Delete
}
[28980] Fix | Delete
}
[28981] Fix | Delete
while (stackDelta < 0 && stack.length > 0) {
[28982] Fix | Delete
stack.pop();
[28983] Fix | Delete
stackDelta++;
[28984] Fix | Delete
}
[28985] Fix | Delete
while (stackDelta > 0) {
[28986] Fix | Delete
stack.push(NaN);
[28987] Fix | Delete
stackDelta--;
[28988] Fix | Delete
}
[28989] Fix | Delete
}
[28990] Fix | Delete
}
[28991] Fix | Delete
ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
[28992] Fix | Delete
const content = [data];
[28993] Fix | Delete
if (i > data.length) {
[28994] Fix | Delete
content.push(new Uint8Array(i - data.length));
[28995] Fix | Delete
}
[28996] Fix | Delete
if (lastDeff > lastEndf) {
[28997] Fix | Delete
warn("TT: complementing a missing function tail");
[28998] Fix | Delete
content.push(new Uint8Array([0x22, 0x2d]));
[28999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function