lzma 0.0.0.3 → 0.0.0.4
raw patch · 4 files changed
+34/−26 lines, 4 filesdep ~basenew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Codec.Compression.Lzma: CompressInputRequired :: (m (CompressStream m)) -> (ByteString -> m (CompressStream m)) -> CompressStream m
+ Codec.Compression.Lzma: CompressInputRequired :: m (CompressStream m) -> (ByteString -> m (CompressStream m)) -> CompressStream m
- Codec.Compression.Lzma: CompressOutputAvailable :: !ByteString -> (m (CompressStream m)) -> CompressStream m
+ Codec.Compression.Lzma: CompressOutputAvailable :: !ByteString -> m (CompressStream m) -> CompressStream m
- Codec.Compression.Lzma: DecompressOutputAvailable :: !ByteString -> (m (DecompressStream m)) -> DecompressStream m
+ Codec.Compression.Lzma: DecompressOutputAvailable :: !ByteString -> m (DecompressStream m) -> DecompressStream m
Files
- Changelog.md +4/−0
- lzma.cabal +13/−10
- src-tests/lzma-tests.hs +5/−6
- src/Codec/Compression/Lzma.hs +12/−10
Changelog.md view
@@ -1,3 +1,7 @@+## 0.0.0.4++* base-4.17 compatibility+ ## 0.0.0.3 * Fix potential reentrancy issue also discovered in `zlib` ([#4](https://github.com/hvr/lzma/issues/4))
lzma.cabal view
@@ -1,5 +1,7 @@+cabal-version: >=1.10 name: lzma-version: 0.0.0.3+version: 0.0.0.4+ synopsis: LZMA/XZ compression and decompression homepage: https://github.com/hvr/lzma bug-reports: https://github.com/hvr/lzma/issues@@ -11,8 +13,7 @@ stability: experimental category: Codec, Compression build-type: Simple-cabal-version: >=1.10-tested-with: GHC ==7.4.2, GHC ==7.6.3, GHC ==7.8.4, GHC ==7.10.3, GHC ==8.0.1, GHC ==8.0.2+tested-with: GHC ==7.4.2, GHC ==7.6.3, GHC ==7.8.4, GHC ==7.10.3, GHC ==8.0.2, GHC ==8.2.2, GHC ==8.4.4, GHC==8.6.5, GHC==8.8.4, GHC==8.10.7, GHC==9.0.2, GHC==9.2.4, GHC==9.4.1 description: This package provides a pure interface for compressing and decompressing@@ -28,6 +29,8 @@ . * </package/pipes-lzma pipes-lzma> (for </package/pipes pipes>) .+ * </package/lzma-conduit lzma-conduit> (for </package/conduit conduit>)+ . extra-source-files: Changelog.md@@ -44,8 +47,8 @@ exposed-modules: Codec.Compression.Lzma other-modules: LibLzma - build-depends: base >=4.5 && <4.10- , bytestring >=0.9.2 && <0.11+ build-depends: base >=4.5 && <4.18+ , bytestring >=0.9.2 && <0.12 if os(windows) build-depends: lzma-clib@@ -70,10 +73,10 @@ , base , bytestring -- additional dependencies that require version bounds- build-depends: HUnit >= 1.2 && <1.4- , QuickCheck >= 2.8 && <2.9- , tasty >= 0.10 && <0.12- , tasty-hunit == 0.9.*- , tasty-quickcheck >= 0.8.3.2 && < 0.9+ build-depends: HUnit >= 1.2 && <1.7+ , QuickCheck >= 2.8 && <2.15+ , tasty >= 0.10 && <1.5+ , tasty-hunit >= 0.9 && <0.11+ , tasty-quickcheck >= 0.8.3.2 && <0.11 ghc-options: -Wall -threaded
src-tests/lzma-tests.hs view
@@ -1,10 +1,9 @@-{-# LANGUAGE OverloadedStrings #-}- module Main (main) where import Control.Applicative import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BL+import qualified Data.ByteString.Lazy.Char8 as BL8 import Data.List import Data.Monoid import Prelude@@ -64,12 +63,12 @@ unitTests = testGroup "testcases" [ testCase "decode-empty" $ decompress nullxz @?= BL.empty , testCase "encode-empty" $ codecompress BL.empty @?= BL.empty- , testCase "encode-hello" $ codecompress "hello" @?= "hello"- , testCase "encode-hello2" $ codecompress (singletonChunked "hello") @?= "hello"+ , testCase "encode-hello" $ codecompress (BL8.pack "hello") @?= BL8.pack "hello"+ , testCase "encode-hello2" $ codecompress (singletonChunked $ BL8.pack "hello") @?= BL8.pack "hello" , testCase "decode-sample" $ decompress samplexz @?= sampleref , testCase "decode-sample2" $ decompress (singletonChunked samplexz) @?= sampleref , testCase "encode-sample" $ codecompress sampleref @?= sampleref- , testCase "encode-empty^50" $ (iterate decompress (iterate (compressWith lowProf) "" !! 50) !! 50) @?= ""+ , testCase "encode-empty^50" $ (iterate decompress (iterate (compressWith lowProf) (BL8.pack "") !! 50) !! 50) @?= BL8.pack "" , testCase "encode-10MiB-zeros" $ let z = BL.replicate (10*1024*1024) 0 in codecompress z @?= z ] @@ -96,4 +95,4 @@ singletonChunked = BL.fromChunks . map BS.singleton . BL.unpack sampleref :: BL.ByteString-sampleref = BL.concat (intersperse " " $ replicate 11 "This sentence occurs multiple times.")+sampleref = BL.concat (intersperse (BL8.pack " ") $ replicate 11 $ BL8.pack "This sentence occurs multiple times.")
src/Codec/Compression/Lzma.hs view
@@ -88,11 +88,11 @@ where loop BSL.Empty (DecompressStreamEnd rest) | BS.null rest = return BSL.Empty- | otherwise = fail "Codec.Compression.Lzma.decompressWith: trailing data"+ | otherwise = error "Codec.Compression.Lzma.decompressWith: trailing data" loop (BSL.Chunk _ _) (DecompressStreamEnd _) =- fail "Codec.Compression.Lzma.decompressWith: trailing data"+ error "Codec.Compression.Lzma.decompressWith: trailing data" loop _ (DecompressStreamError e) =- fail ("Codec.Compression.Lzma.decompressWith: decoding error " ++ show e)+ error ("Codec.Compression.Lzma.decompressWith: decoding error " ++ show e) loop BSL.Empty (DecompressInputRequired supply) = loop BSL.Empty =<< supply BS.empty loop (BSL.Chunk c bs') (DecompressInputRequired supply) =@@ -123,7 +123,7 @@ loop BSL.Empty CompressStreamEnd = return BSL.Empty loop (BSL.Chunk _ _) CompressStreamEnd =- fail "Codec.Compression.Lzma.compressWith: the impossible happened"+ error "Codec.Compression.Lzma.compressWith: the impossible happened" loop BSL.Empty (CompressInputRequired _ supply) = loop BSL.Empty =<< supply BS.empty loop (BSL.Chunk c bs') (CompressInputRequired _ supply) =@@ -222,7 +222,7 @@ LzmaRetOK | BS.null obuf -> do unless (used > 0) $- fail "compressST: input chunk not consumed"+ error "compressST: input chunk not consumed" withChunk (return inputRequired) goInput chunk' | otherwise -> return (CompressOutputAvailable obuf (withChunk (return inputRequired) goInput chunk'))@@ -235,15 +235,16 @@ -- drain encoder till LzmaRetStreamEnd is reported goSync :: LzmaAction -> ST s (CompressStream (ST s)) -> ST s (CompressStream (ST s))- goSync LzmaRun _ = fail "compressST: goSync called with invalid argument"+ goSync LzmaRun _ = error "compressST: goSync called with invalid argument" goSync action next = goSync' where goSync' = do- (rc, 0, obuf) <- strictToLazyST (noDuplicateST >>+ (rc, n, obuf) <- strictToLazyST (noDuplicateST >> runLzmaStream ls BS.empty action bUFSIZ)+ when (n /= 0) $ error "compressST: n was not zero" case rc of LzmaRetOK- | BS.null obuf -> fail ("compressIO: empty output chunk during " ++ show action)+ | BS.null obuf -> error ("compressIO: empty output chunk during " ++ show action) | otherwise -> return (CompressOutputAvailable obuf goSync') LzmaRetStreamEnd | BS.null obuf -> next@@ -348,7 +349,7 @@ LzmaRetOK | BS.null obuf -> do unless (used > 0) $- fail "decompressST: input chunk not consumed"+ error "decompressST: input chunk not consumed" withChunk (return inputRequired) goInput chunk' | otherwise -> return (DecompressOutputAvailable obuf (withChunk goDrain goInput chunk'))@@ -369,8 +370,9 @@ goSync action next = goSync' where goSync' = do- (rc, 0, obuf) <- strictToLazyST (noDuplicateST >>+ (rc, n, obuf) <- strictToLazyST (noDuplicateST >> runLzmaStream ls BS.empty action bUFSIZ)+ when (n /= 0) $ error "decompressST: n was not zero" case rc of LzmaRetOK | BS.null obuf -> next