From 8e2db0e31799c34c83491187aabb24d6970b7bb9 Mon Sep 17 00:00:00 2001 From: sof Date: Wed, 3 Sep 1997 23:43:49 +0000 Subject: [PATCH] [project @ 1997-09-03 23:43:49 by sof] fix: freeze_ps_array did not return ByteArray with valid bounds (was error closure) --- ghc/lib/ghc/PackBase.lhs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ghc/lib/ghc/PackBase.lhs b/ghc/lib/ghc/PackBase.lhs index 8bcd701..e301134 100644 --- a/ghc/lib/ghc/PackBase.lhs +++ b/ghc/lib/ghc/PackBase.lhs @@ -228,7 +228,7 @@ packNBytesST len@(I# length#) str = -- fill in packed string from "str" fill_in ch_array 0# str >> -- freeze the puppy: - freeze_ps_array ch_array + freeze_ps_array ch_array length# where fill_in :: MutableByteArray s Int -> Int# -> [Char] -> ST s () fill_in arr_in# idx [] = @@ -246,7 +246,7 @@ packNBytesST len@(I# length#) str = \begin{code} new_ps_array :: Int# -> ST s (MutableByteArray s Int) write_ps_array :: MutableByteArray s Int -> Int# -> Char# -> ST s () -freeze_ps_array :: MutableByteArray s Int -> ST s (ByteArray Int) +freeze_ps_array :: MutableByteArray s Int -> Int# -> ST s (ByteArray Int) new_ps_array size = ST $ \ (S# s) -> case (newCharArray# size s) of { StateAndMutableByteArray# s2# barr# -> @@ -259,9 +259,9 @@ write_ps_array (MutableByteArray _ barr#) n ch = ST $ \ (S# s#) -> ((), S# s2#)} -- same as unsafeFreezeByteArray -freeze_ps_array (MutableByteArray ixs arr#) = ST $ \ (S# s#) -> +freeze_ps_array (MutableByteArray _ arr#) len# = ST $ \ (S# s#) -> case unsafeFreezeByteArray# arr# s# of { StateAndByteArray# s2# frozen# -> - (ByteArray ixs frozen#, S# s2#) } + (ByteArray (0,I# len#) frozen#, S# s2#) } \end{code} -- 1.7.10.4