Use the result of writeCharBuf in GHC/IO/Encoding/Latin1.hs too
authorIan Lynagh <igloo@earth.li>
Fri, 10 Jul 2009 00:40:32 +0000 (00:40 +0000)
committerIan Lynagh <igloo@earth.li>
Fri, 10 Jul 2009 00:40:32 +0000 (00:40 +0000)
GHC/IO/Encoding/Latin1.hs

index 99b2af3..97b198c 100644 (file)
@@ -83,8 +83,8 @@ latin1_decode
          | ow >= os || ir >= iw =  done ir ow
          | otherwise = do
               c0 <- readWord8Buf iraw ir
-              writeCharBuf oraw ow (unsafeChr (fromIntegral c0))
-              loop (ir+1) (ow+1)
+              ow' <- writeCharBuf oraw ow (unsafeChr (fromIntegral c0))
+              loop (ir+1) ow'
 
        -- lambda-lifted, to avoid thunks being built in the inner-loop:
        done !ir !ow = return (if ir == iw then input{ bufL=0, bufR=0 }