fixes a long standing string steams bug that caused lexbase to misbehave

This commit is contained in:
Andreas Rumpf
2017-06-06 18:03:44 +02:00
parent 55c244400d
commit 0915399b50

View File

@@ -334,12 +334,16 @@ when not defined(js):
if result > 0:
copyMem(buffer, addr(s.data[s.pos]), result)
inc(s.pos, result)
else:
result = 0
proc ssPeekData(s: Stream, buffer: pointer, bufLen: int): int =
var s = StringStream(s)
result = min(bufLen, s.data.len - s.pos)
if result > 0:
copyMem(buffer, addr(s.data[s.pos]), result)
else:
result = 0
proc ssWriteData(s: Stream, buffer: pointer, bufLen: int) =
var s = StringStream(s)