diff options
author | bptato <nincsnevem662@gmail.com> | 2024-03-29 17:29:37 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-03-29 17:29:37 +0100 |
commit | a73bdecc9111bfd377b26b069d989030eb767d1f (patch) | |
tree | 9585ae5dc614ec2f6872a32b8c1289c78d43fe9a | |
parent | 8cdf0a47072cc0f223a73da96833dc31028835fa (diff) | |
download | chawan-a73bdecc9111bfd377b26b069d989030eb767d1f.tar.gz |
pager: fix broken writeToFile
-rw-r--r-- | src/io/dynstream.nim | 3 | ||||
-rw-r--r-- | src/local/pager.nim | 6 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/io/dynstream.nim b/src/io/dynstream.nim index 1b0f8807..8032f5ec 100644 --- a/src/io/dynstream.nim +++ b/src/io/dynstream.nim @@ -44,6 +44,9 @@ proc sendDataLoop*(s: DynStream; buffer: pointer; len: int) = if n == len: break +proc sendDataLoop*(s: DynStream; buffer: openArray[uint8]) {.inline.} = + s.sendDataLoop(unsafeAddr buffer[0], buffer.len) + proc sendDataLoop*(s: DynStream; buffer: openArray[char]) {.inline.} = s.sendDataLoop(unsafeAddr buffer[0], buffer.len) diff --git a/src/local/pager.nim b/src/local/pager.nim index 6e9ac0dd..5c639a20 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -1348,11 +1348,7 @@ proc writeToFile(istream: SocketStream; outpath: string): bool = let n = istream.recvData(buffer) if n == 0: break - if ps.sendData(buffer.toOpenArray(0, n - 1)) < n: - ps.sclose() - return false - if n < buffer.len: - break + ps.sendDataLoop(buffer.toOpenArray(0, n - 1)) ps.sclose() true |