| 1 | 1 patch for repository darcs.haskell.org:/srv/darcs/packages/array: |
|---|
| 2 | |
|---|
| 3 | Fri Apr 1 12:59:48 BST 2011 Max Bolingbroke <batterseapower@hotmail.com> |
|---|
| 4 | * Use count argument in hPutArray/hGetArray. Fixes #4827 |
|---|
| 5 | |
|---|
| 6 | New patches: |
|---|
| 7 | |
|---|
| 8 | [Use count argument in hPutArray/hGetArray. Fixes #4827 |
|---|
| 9 | Max Bolingbroke <batterseapower@hotmail.com>**20110401115948 |
|---|
| 10 | Ignore-this: 6523a13b28fc6ea3d89ebfaaf5f8651c |
|---|
| 11 | ] { |
|---|
| 12 | hunk ./Data/Array/IO.hs 77 |
|---|
| 13 | -- we would like to read directly into the buffer, but we can't |
|---|
| 14 | -- be sure that the MutableByteArray# is pinned, so we have to |
|---|
| 15 | -- allocate a separate area of memory and copy. |
|---|
| 16 | - allocaBytes n $ \p -> do |
|---|
| 17 | - r <- hGetBuf handle p n |
|---|
| 18 | + allocaBytes count $ \p -> do |
|---|
| 19 | + r <- hGetBuf handle p count |
|---|
| 20 | memcpy_ba_ptr ptr p (fromIntegral r) |
|---|
| 21 | return r |
|---|
| 22 | |
|---|
| 23 | hunk ./Data/Array/IO.hs 101 |
|---|
| 24 | | otherwise = do |
|---|
| 25 | -- as in hGetArray, we would like to use the array directly, but |
|---|
| 26 | -- we can't be sure that the MutableByteArray# is pinned. |
|---|
| 27 | - allocaBytes n $ \p -> do |
|---|
| 28 | - memcpy_ptr_ba p raw (fromIntegral n) |
|---|
| 29 | - hPutBuf handle p n |
|---|
| 30 | + allocaBytes count $ \p -> do |
|---|
| 31 | + memcpy_ptr_ba p raw (fromIntegral count) |
|---|
| 32 | + hPutBuf handle p count |
|---|
| 33 | |
|---|
| 34 | foreign import ccall unsafe "memcpy" |
|---|
| 35 | memcpy_ptr_ba :: Ptr a -> MutableByteArray# RealWorld -> CSize -> IO (Ptr ()) |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | Context: |
|---|
| 39 | |
|---|
| 40 | [TAG git migration |
|---|
| 41 | Ian Lynagh <igloo@earth.li>**20110331135042 |
|---|
| 42 | Ignore-this: 6f8ed34cbc3a330f1424783a290565ce |
|---|
| 43 | ] |
|---|
| 44 | Patch bundle hash: |
|---|
| 45 | 24b1824dfc0df991d5855aae8c6bf119e7568c28 |
|---|