Better sliceAtEOF()
This commit is contained in:
parent
dcc2352559
commit
f4c041abdf
|
@ -47,10 +47,11 @@ function getFontNameFromSAUCE(sauce) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sliceAtEOF(data, eofMarker) {
|
function sliceAtEOF(data, eofMarker) {
|
||||||
var eof = data.length;
|
let eof = data.length;
|
||||||
// :TODO: max scan back or other beter way of doing this?!
|
const stopPos = Math.max(data.length - (256), 0); // 256 = 2 * sizeof(SAUCE)
|
||||||
for(var i = data.length - 1; i > 0; i--) {
|
|
||||||
if(data[i] === eofMarker) {
|
for(let i = eof - 1; i > stopPos; i--) {
|
||||||
|
if(eofMarker === data[i]) {
|
||||||
eof = i;
|
eof = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue