Dont convert string to cstring when writing to stream.

This commit is contained in:
Yuriy Glukhov 2016-01-20 23:52:14 +02:00
commit df211b24fd

View file

@ -148,7 +148,10 @@ proc write*[T](s: Stream, x: T) =
proc write*(s: Stream, x: string) = proc write*(s: Stream, x: string) =
## writes the string `x` to the the stream `s`. No length field or ## writes the string `x` to the the stream `s`. No length field or
## terminating zero is written. ## terminating zero is written.
when nimvm:
writeData(s, cstring(x), x.len) writeData(s, cstring(x), x.len)
else:
if x.len > 0: writeData(s, unsafeAddr x[0], x.len)
proc writeLn*(s: Stream, args: varargs[string, `$`]) {.deprecated.} = proc writeLn*(s: Stream, args: varargs[string, `$`]) {.deprecated.} =
## **Deprecated since version 0.11.4:** Use **writeLine** instead. ## **Deprecated since version 0.11.4:** Use **writeLine** instead.