Skip to content

Commit

Permalink
Fixed auto-extending buffer size while encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
fenying committed Mar 13, 2019
1 parent ed25156 commit a7d2b55
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# Changes Logs

## v0.1.1

- Fixed auto-extending buffer size while encoding.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@litert/bencode",
"version": "0.1.0",
"version": "0.1.1",
"description": "A bencode decode/encode library based on Node.js.",
"main": "./libs/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/encoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class BEncoder implements C.IEncoder {

let v = 2;

while (ctx.buffer.length * v - ctx.cursor >= expectLength) {
while (ctx.buffer.length * v - ctx.cursor < expectLength) {

v <<= 1;
}
Expand Down

0 comments on commit a7d2b55

Please sign in to comment.