projects
/
haskell-directory.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
39387cb
)
Fix string truncating in hGetLine -- it was a pasto from Simon's code
author
Simon Marlow
<simonmar@microsoft.com>
Wed, 3 May 2006 10:35:04 +0000
(10:35 +0000)
committer
Simon Marlow
<simonmar@microsoft.com>
Wed, 3 May 2006 10:35:04 +0000
(10:35 +0000)
(from Don Stewart)
Data/ByteString.hs
patch
|
blob
|
history
diff --git
a/Data/ByteString.hs
b/Data/ByteString.hs
index
61ed887
..
6eb861a
100644
(file)
--- a/
Data/ByteString.hs
+++ b/
Data/ByteString.hs
@@
-238,6
+238,7
@@
import Data.Maybe (listToMaybe)
import Data.Array (listArray)
import qualified Data.Array as Array ((!))
import Data.Array (listArray)
import qualified Data.Array as Array ((!))
+-- Control.Exception.bracket not available in yhc or nhc
import Control.Exception (bracket)
import Foreign.C.String (CString, CStringLen)
import Control.Exception (bracket)
import Foreign.C.String (CString, CStringLen)
@@
-247,6
+248,7
@@
import Foreign.Marshal.Array
import Foreign.Ptr
import Foreign.Storable (Storable(..))
import Foreign.Ptr
import Foreign.Storable (Storable(..))
+-- hGetBuf and hPutBuf not available in yhc or nhc
import System.IO (stdin,stdout,hClose,hFileSize
,hGetBuf,hPutBuf,openBinaryFile
,Handle,IOMode(..))
import System.IO (stdin,stdout,hClose,hFileSize
,hGetBuf,hPutBuf,openBinaryFile
,Handle,IOMode(..))
@@
-1663,7
+1665,7
@@
hGetLine h = wantReadableHandle "Data.ByteString.hGetLine" h $ \ handle_ -> do
mkPS :: RawBuffer -> Int -> Int -> IO ByteString
mkPS buf start end = do
let len = end - start
mkPS :: RawBuffer -> Int -> Int -> IO ByteString
mkPS buf start end = do
let len = end - start
- fp <- mallocByteString (len `quot` 8)
+ fp <- mallocByteString len
withForeignPtr fp $ \p -> do
memcpy_ptr_baoff p buf start (fromIntegral len)
return (PS fp 0 len)
withForeignPtr fp $ \p -> do
memcpy_ptr_baoff p buf start (fromIntegral len)
return (PS fp 0 len)