Skip to content

Commit 31c9c89

Browse files
committed
Correctly calculate offset in writeVString, fixes #20
1 parent 43dedf3 commit 31c9c89

File tree

5 files changed

+4
-4
lines changed

5 files changed

+4
-4
lines changed

dist/ByteBufferAB.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1756,8 +1756,8 @@
17561756
}
17571757
var start = offset,
17581758
k, l;
1759-
l = ByteBuffer.calculateVarint32(k);
17601759
k = utf8_calc_string(str);
1760+
l = ByteBuffer.calculateVarint32(k);
17611761
offset += l+k;
17621762
var capacity15 = this.buffer.byteLength;
17631763
if (offset > capacity15)

dist/ByteBufferAB.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ByteBufferAB.min.js.gz

2 Bytes
Binary file not shown.

dist/ByteBufferAB.min.map

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/types/strings/vstring.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ ByteBuffer.prototype.writeVString = function(str, offset) {
2828
buffer.copy(this.buffer, offset);
2929
offset += buffer.length;
3030
//? } else {
31-
l = ByteBuffer.calculateVarint32(k);
3231
k = utf8_calc_string(str);
32+
l = ByteBuffer.calculateVarint32(k);
3333
//? ENSURE_CAPACITY('l+k');
3434
offset += this.writeVarint32(k, offset);
3535
k = str.length;

0 commit comments

Comments
 (0)