File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -919,13 +919,15 @@ cstringUtf8_step !ip !len !nullAt k (BufferRange op0 ope)
919919 len' = len - nread
920920 nullAt' <- c_strstr ip' (Ptr " \xc0\x80 " # )
921921 cstringUtf8_step ip' len' nullAt' k (BufferRange op' ope)
922- | otherwise = do
923- let ! copy = min avail nullFree
924- when (copy > 0 ) ( S. memcpy op0 ip copy)
925- let ! op' = op0 `plusPtr` copy
926- ! ip' = ip `plusPtr` copy
927- len' = len - copy
922+ | avail > 0 = do
923+ -- avail <= nullFree
924+ S. memcpy op0 ip avail
925+ let ! op' = op0 `plusPtr` avail
926+ ! ip' = ip `plusPtr` avail
927+ len' = len - avail
928928 return $ bufferFull 1 op' (cstringUtf8_step ip' len' nullAt k)
929+ | otherwise =
930+ return $ bufferFull 1 op0 (cstringUtf8_step ip len nullAt k)
929931 where
930932 ! avail = ope `minusPtr` op0
931933 ! nullFree = nullAt `minusPtr` ip
You can’t perform that action at this time.
0 commit comments