Small fix

This commit is contained in:
ValdikSS 2024-03-26 19:13:32 +07:00
parent a6a698f9ef
commit a5e78e23bf

View File

@ -65,8 +65,6 @@ var HASH_MASK = (1 << TABLE_LEN_BITS) - 1;
var table = Array(1 << TABLE_LEN_BITS); var table = Array(1 << TABLE_LEN_BITS);
var hash = 0; var hash = 0;
function unlzp(d, m, lim) { function unlzp(d, m, lim) {
var TABLE_LEN_BITS = 18;
var HASH_MASK = (1 << TABLE_LEN_BITS) - 1;
var mask = 0, maskpos = 0, dpos = 0, out = Array(8), outpos = 0, outfinal = ''; var mask = 0, maskpos = 0, dpos = 0, out = Array(8), outpos = 0, outfinal = '';
for (;;) { for (;;) {
@ -144,22 +142,14 @@ echo " if (domains.length < 10) return \"DIRECT\"; // list is broken
var u = unlzp(domains_lzp, mask_lzp, reqd); var u = unlzp(domains_lzp, mask_lzp, reqd);
domains_lzp = domains_lzp.slice(u[1]); domains_lzp = domains_lzp.slice(u[1]);
mask_lzp = mask_lzp.slice(u[2]); mask_lzp = mask_lzp.slice(u[2]);
leftover += u[0] leftover += u[0];
u = 0 u = 0;
//console.log('Requested ' + reqd); //if (reqd > leftover.length) alert('requested ' + reqd + ' got ' + leftover.length);
//if (reqd > leftover.length) {alert('requested ' + reqd + ' got ' + leftover.length);}
} }
if (leftover.length >= dmnl) { domains[dmn][dcnt] = leftover.slice(0, dmnl);
domains[dmn][dcnt] = leftover.slice(0, dmnl); leftover = leftover.slice(dmnl);
leftover = leftover.slice(dmnl); //if (domains[dmn][dcnt].length != dmnl) alert('ERR 1');
if (domains[dmn][dcnt].length != dmnl) alert('ERR 1!');
continue;
} else {
alert('ERR 3');
break;
}
if (domains[dmn][dcnt].length != dmnl) alert('ERR 2');
} }
} }