diff options
author | Andreas Klebinger <klebinger.andreas@gmx.at> | 2020-06-23 13:30:33 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-07-15 16:41:04 -0400 |
commit | aa4d84d556b39715ebc1a7860a620ec5a7d9beeb (patch) | |
tree | e946fee29dcbcd3b23fdea1c06461ecc27129a80 | |
parent | 8e58e714e9a4b5fe77c4e71802cc4b9ad1998af3 (diff) | |
download | haskell-aa4d84d556b39715ebc1a7860a620ec5a7d9beeb.tar.gz |
winio: flushCharReadBuffer shouldn't need to adjust offsets.
-rw-r--r-- | libraries/base/GHC/IO/Handle/Internals.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libraries/base/GHC/IO/Handle/Internals.hs b/libraries/base/GHC/IO/Handle/Internals.hs index f0a2cdac4b..120ae0ea66 100644 --- a/libraries/base/GHC/IO/Handle/Internals.hs +++ b/libraries/base/GHC/IO/Handle/Internals.hs @@ -596,11 +596,14 @@ flushCharReadBuffer Handle__{..} = do (bbuf1,cbuf1) <- (streamEncode decoder) bbuf0 cbuf0{ bufL=0, bufR=0, bufSize = bufL cbuf0 } - let bbuf2 = bbuf1 -- {bufOffset = bufOffset bbuf1 - fromIntegral (bufL bbuf1)} - debugIO ("finished, bbuf=" ++ summaryBuffer bbuf2 ++ - " cbuf=" ++ summaryBuffer cbuf1) - - writeIORef haByteBuffer bbuf2 + -- We should not need to update the offset here. The bytebuffer contains the + -- offset for the next read after it's used up. But this function only flushes + -- the char buffer. + -- let bbuf2 = bbuf1 -- {bufOffset = bufOffset bbuf1 - fromIntegral (bufL bbuf1)} + -- debugIO ("finished, bbuf=" ++ summaryBuffer bbuf2 ++ + -- " cbuf=" ++ summaryBuffer cbuf1) + + writeIORef haByteBuffer bbuf1 -- When flushing the byte read buffer, we seek backwards by the number |