Skip to content
Browse files

Oops! Back out part of 59aad6977070 - it was wrong

My assertion that it was safe to skip the "do I have 1 byte available?" check
was incorrect.
  • Loading branch information...
1 parent f0158d3 commit 657183396293fd167f459818c8e187e902b19236 @bos committed Dec 23, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 Data/Text/Encoding.hs
View
4 Data/Text/Encoding.hs
@@ -167,7 +167,9 @@ encodeUtf8 (Text arr off len) = unsafePerformIO $ do
start newSize n m fp'
{-# INLINE ensure #-}
case A.unsafeIndex arr n of
- w| w <= 0x7F -> poke8 m w >> go (n+1) (m+1)
+ w| w <= 0x7F -> ensure 1 $ do
+ poke8 m w
+ go (n+1) (m+1)
| w <= 0x7FF -> ensure 2 $ do
poke8 m $ (w `shiftR` 6) + 0xC0
poke8 (m+1) $ (w .&. 0x3f) + 0x80

0 comments on commit 6571833

Please sign in to comment.
Something went wrong with that request. Please try again.