don't do pointless cast

This commit is contained in:
Dmitriy Ryajov 2019-08-31 18:23:11 -06:00
parent ef7a0b41e4
commit 85b0b5d1da
1 changed files with 15 additions and 15 deletions

View File

@ -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())