diff options
author | data-man <datamanrb@gmail.com> | 2018-05-25 07:46:48 +0300 |
---|---|---|
committer | data-man <datamanrb@gmail.com> | 2018-05-25 07:46:48 +0300 |
commit | 8149c074589ed80954fddd303f2c2ba29efe1fc1 (patch) | |
tree | 0912c54320636e3f6c8e229e97a2ee654ad017bb /lib/pure/streams.nim | |
parent | 3fd48b76221e74c3ac8b4b478439ffff70e3bf46 (diff) | |
download | Nim-8149c074589ed80954fddd303f2c2ba29efe1fc1.tar.gz |
Fixes streams bugs
Diffstat (limited to 'lib/pure/streams.nim')
-rw-r--r-- | lib/pure/streams.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pure/streams.nim b/lib/pure/streams.nim index a9933aa82..0326a51fb 100644 --- a/lib/pure/streams.nim +++ b/lib/pure/streams.nim @@ -132,7 +132,7 @@ proc write*(s: Stream, x: string) = when nimvm: writeData(s, cstring(x), x.len) else: - if x.len > 0: writeData(s, unsafeAddr x[0], x.len) + if x.len > 0: writeData(s, cstring(x), x.len) proc writeLine*(s: Stream, args: varargs[string, `$`]) = ## writes one or more strings to the the stream `s` followed @@ -252,14 +252,14 @@ proc readStr*(s: Stream, length: int): TaintedString = ## reads a string of length `length` from the stream `s`. Raises `EIO` if ## an error occurred. result = newString(length).TaintedString - var L = readData(s, addr(string(result)[0]), length) + var L = readData(s, cstring(result), length) if L != length: setLen(result.string, L) proc peekStr*(s: Stream, length: int): TaintedString = ## peeks a string of length `length` from the stream `s`. Raises `EIO` if ## an error occurred. result = newString(length).TaintedString - var L = peekData(s, addr(string(result)[0]), length) + var L = peekData(s, cstring(result), length) if L != length: setLen(result.string, L) proc readLine*(s: Stream, line: var TaintedString): bool = |