Skip to content

Commit

Permalink
fix offset bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgrammerIn-wonderland committed Aug 28, 2024
1 parent eb6b7c6 commit 9a79a7f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/marshall.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ marshall.Marshall = function(typelist, input, struct, offset) {
struct[offset++] = 0; // set the length later
struct[offset++] = 0;
size += 2;

var stringBytes = texten.encode(item);
size += stringBytes.byteLength;
length += stringBytes.byteLength;
Expand Down Expand Up @@ -112,13 +112,14 @@ marshall.Unmarshall = function(typelist, struct, state) {
len += struct[offset++] << 8;
// var str = "";
// var utf8converter = new UTF8StreamToUnicode();

// for(var j=0; j < len; j++) {
// var c = utf8converter.Put(struct[offset++]);
// if(c === -1) continue;ofc
// if(c === -1) continue;
// str += String.fromCharCode(c);
// }
var stringBytes = struct.slice(offset, offset + len);
offset += len;
output.push(textde.decode(stringBytes));
break;
case "Q":
Expand Down

0 comments on commit 9a79a7f

Please sign in to comment.