From 85b0b5d1dad2a1e4ccdbd69c806c700cd525acba Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Sat, 31 Aug 2019 18:23:11 -0600 Subject: [PATCH] don't do pointless cast --- tests/testmultistream.nim | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/testmultistream.nim b/tests/testmultistream.nim index c740702..d0159b5 100644 --- a/tests/testmultistream.nim +++ b/tests/testmultistream.nim @@ -19,22 +19,22 @@ method readExactly*(s: TestSelectStream, of 1: var buf = newSeq[byte](1) buf[0] = 19 - copyMem(cast[pointer](cast[uint](pbytes)), addr buf[0], buf.len()) + copyMem(pbytes, addr buf[0], buf.len()) s.step = 2 of 2: var buf = "/multistream/1.0.0\n" - copyMem(cast[pointer](cast[uint](pbytes)), addr buf[0], buf.len()) + copyMem(pbytes, addr buf[0], buf.len()) s.step = 3 of 3: var buf = newSeq[byte](1) buf[0] = 18 - copyMem(cast[pointer](cast[uint](pbytes)), addr buf[0], buf.len()) + copyMem(pbytes, addr buf[0], buf.len()) s.step = 4 of 4: var buf = "/test/proto/1.0.0\n" - copyMem(cast[pointer](cast[uint](pbytes)), addr buf[0], buf.len()) + copyMem(pbytes, addr buf[0], buf.len()) else: - copyMem(cast[pointer](cast[uint](pbytes)), + copyMem(pbytes, cstring("\0x3na\n"), "\0x3na\n".len()) @@ -57,22 +57,22 @@ method readExactly*(s: TestLsStream, of 1: var buf = newSeq[byte](1) buf[0] = 19 - copyMem(cast[pointer](cast[uint](pbytes)), addr buf[0], buf.len()) + copyMem(pbytes, addr buf[0], buf.len()) s.step = 2 of 2: var buf = "/multistream/1.0.0\n" - copyMem(cast[pointer](cast[uint](pbytes)), addr buf[0], buf.len()) + copyMem(pbytes, addr buf[0], buf.len()) s.step = 3 of 3: var buf = newSeq[byte](1) buf[0] = 3 - copyMem(cast[pointer](cast[uint](pbytes)), addr buf[0], buf.len()) + copyMem(pbytes, addr buf[0], buf.len()) s.step = 4 of 4: var buf = "ls\n" - copyMem(cast[pointer](cast[uint](pbytes)), addr buf[0], buf.len()) + copyMem(pbytes, addr buf[0], buf.len()) else: - copyMem(cast[pointer](cast[uint](pbytes)), + copyMem(pbytes, cstring("\0x3na\n"), "\0x3na\n".len()) @@ -100,22 +100,22 @@ method readExactly*(s: TestNaStream, of 1: var buf = newSeq[byte](1) buf[0] = 19 - copyMem(cast[pointer](cast[uint](pbytes)), addr buf[0], buf.len()) + copyMem(pbytes, addr buf[0], buf.len()) s.step = 2 of 2: var buf = "/multistream/1.0.0\n" - copyMem(cast[pointer](cast[uint](pbytes)), addr buf[0], buf.len()) + copyMem(pbytes, addr buf[0], buf.len()) s.step = 3 of 3: var buf = newSeq[byte](1) buf[0] = 18 - copyMem(cast[pointer](cast[uint](pbytes)), addr buf[0], buf.len()) + copyMem(pbytes, addr buf[0], buf.len()) s.step = 4 of 4: var buf = "/test/proto/1.0.0\n" - copyMem(cast[pointer](cast[uint](pbytes)), addr buf[0], buf.len()) + copyMem(pbytes, addr buf[0], buf.len()) else: - copyMem(cast[pointer](cast[uint](pbytes)), + copyMem(pbytes, cstring("\0x3na\n"), "\0x3na\n".len())