Thu, 25 Oct 2001 12:06:53 +0200 (CEST), Michael Marte
<[EMAIL PROTECTED]> pisze:
> I found that decompress hangs if data ends prematurely, i.e.
>
> do
> content <- readFile fp
> doSomething (Bzip2.decompress content)
>
> does not terminate in this case.
Try this patch (sorry, untested):
--- examples/Bzip2.hsc~ Mon Jun 11 23:19:50 2001
+++ examples/Bzip2.hsc Thu Oct 25 17:55:19 2001
@@ -169,6 +169,7 @@
let blockIn = take blockSize input
ok <- decompressBlock strm blockIn blockSize
case ok of
+RunOk 0 [] -> ioError (userError "bzip2: premature end of
+compressed data")
RunOk inSize blockOut -> liftM (blockOut++) $ unsafeInterleaveIO $
decompressLoop strm (drop inSize input)
StreamEnd output -> return output
It's in CVS at SourceForge now.
--
__("< Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZASTÊPCZA
QRCZAK
___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users