From 96139d2305a0b5702791a490ae43f3d5b751d530 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Fri, 22 Jun 2018 16:42:26 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Replace=20increment=20operator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ssn/bencodeParser.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ssn/bencodeParser.ts b/src/ssn/bencodeParser.ts index 7173825..c3f5189 100644 --- a/src/ssn/bencodeParser.ts +++ b/src/ssn/bencodeParser.ts @@ -10,7 +10,7 @@ const Decoder = new TextDecoder('utf-8'); export default function bpParse(dv: DataView, posIn: number = 0): { obj: any, pos: number } { let pos = posIn; let obj; - const header = dv.getUint8(pos++); + const header = dv.getUint8(pos); pos += 1; switch (header) { case 0x64: { //'d' - dictionary (key-value object) obj = []; @@ -23,7 +23,7 @@ export default function bpParse(dv: DataView, posIn: number = 0): { obj: any, po pos = out2.pos; obj[out1.obj] = out2.obj; } while (dv.getUint8(pos) !== 0x65); //'e' - end - pos++; + pos += 1; break; } case 0x6C: { //'l' - list (array) @@ -34,11 +34,11 @@ export default function bpParse(dv: DataView, posIn: number = 0): { obj: any, po pos = out.pos; obj.push(out.obj); } while (dv.getUint8(pos) !== 0x65); //'e' - end - pos++; + pos += 1; break; } case 0x69: { //'i' - integer - let curChar = dv.getUint8(pos++); + let curChar = dv.getUint8(pos); pos += 1; let curNumber = 0; while (curChar !== 0x65) { //'e' - end if (curChar < 0x30 || curChar > 0x39) { @@ -46,7 +46,7 @@ export default function bpParse(dv: DataView, posIn: number = 0): { obj: any, po } curNumber *= 10; curNumber += curChar - 0x30; - curChar = dv.getUint8(pos++); + curChar = dv.getUint8(pos); pos += 1; } obj = curNumber; break; @@ -59,7 +59,7 @@ export default function bpParse(dv: DataView, posIn: number = 0): { obj: any, po while (curChar !== 0x3A) { //':' - integer delimiter, beginning of string strLen *= 10; strLen += curChar - 0x30; - curChar = dv.getUint8(pos++); + curChar = dv.getUint8(pos); pos += 1; } //read string obj = Decoder.decode(new DataView(dv.buffer, pos, strLen));