Dead code (Unmarshall2)

This commit is contained in:
Fabian 2021-03-30 21:40:12 -05:00
parent b052280c37
commit 5f86008338

View file

@ -131,51 +131,3 @@ marshall.Unmarshall = function(typelist, struct, state) {
state.offset = offset;
return output;
};
// Extracts data from a byte aligned struct in memory to an array
marshall.Unmarshall2 = function(typelist, GetByte) {
var output = [];
for (var i=0; i < typelist.length; i++) {
switch (typelist[i]) {
case "w":
var val = GetByte();
val += GetByte() << 8;
val += GetByte() << 16;
val += (GetByte() << 24) >>> 0;
output.push(val);
break;
case "d":
var val = GetByte();
val += GetByte() << 8;
val += GetByte() << 16;
val += (GetByte() << 24) >>> 0;
GetByte();GetByte();GetByte();GetByte();
output.push(val);
break;
case "h":
var val = GetByte();
output.push(val + (GetByte() << 8));
break;
case "b":
output.push(GetByte());
break;
case "s":
var len = GetByte();
len += GetByte() << 8;
var str = '';
var utf8converter = new UTF8StreamToUnicode();
for (var j=0; j < len; j++) {
var c = utf8converter.Put(GetByte());
if (c == -1) continue;
str += String.fromCharCode(c);
}
output.push(str);
break;
default:
message.Debug("Error in Unmarshall2: Unknown type=" + typelist[i]);
break;
}
}
return output;
};