lz4-hs 0.1.4.0 → 0.1.4.1
raw patch · 4 files changed
+29/−12 lines, 4 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Codec.Lz4.Foreign: lZ4FFreeDecompressionContext :: FinalizerPtr ()
Files
- CHANGELOG.md +5/−0
- lz4-hs.cabal +13/−1
- src/Codec/Lz4.chs +4/−3
- src/Codec/Lz4/Foreign.chs +7/−8
CHANGELOG.md view
@@ -1,5 +1,10 @@ # lz4 +## 0.1.4.1+ + * Use `lZ4DecompressionContextFree` correctly+ * Internal cleanup (remove redundant pragmas)+ ## 0.1.4.0 * Add `compressSz` supporting higher levels of compression for streams
lz4-hs.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: lz4-hs-version: 0.1.4.0+version: 0.1.4.1 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2020 Vanessa McHale@@ -55,6 +55,9 @@ if impl(ghc >=8.4) ghc-options: -Wmissing-export-lists + if impl(ghc >=8.10)+ ghc-options: -Wunused-packages+ test-suite lz4-test type: exitcode-stdio-1.0 main-is: Spec.hs@@ -79,6 +82,9 @@ if impl(ghc >=8.2) ghc-options: -Wcpp-undef + if impl(ghc >=8.10)+ ghc-options: -Wunused-packages+ benchmark lz4-mem type: exitcode-stdio-1.0 main-is: Mem.hs@@ -95,6 +101,9 @@ if impl(ghc >=8.0) ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates + if impl(ghc >=8.10)+ ghc-options: -Wunused-packages+ benchmark lz4-bench type: exitcode-stdio-1.0 main-is: Bench.hs@@ -119,3 +128,6 @@ if impl(ghc >=8.2) ghc-options: -Wcpp-undef++ if impl(ghc >=8.10)+ ghc-options: -Wunused-packages
src/Codec/Lz4.chs view
@@ -57,7 +57,7 @@ (ctx, buf) <- LazyST.unsafeIOToST $ do (err, preCtx) <- lZ4FCreateDecompressionContext lZ4FGetVersion- ctx <- castForeignPtr <$> newForeignPtr lZ4FFreeCompressionContext (castPtr preCtx)+ ctx <- castForeignPtr <$> newForeignPtr lZ4FFreeDecompressionContext (castPtr preCtx) check err dstBuf <- mallocForeignPtrBytes bufSz pure (ctx, dstBuf)@@ -72,7 +72,6 @@ Nothing -> (res:) <$> loop ctx buf bs' Just next -> (res:) <$> loop ctx buf (next:bs') - stepChunk :: LzDecompressionCtxPtr -> ForeignPtr a -> BS.ByteString -> LazyST.ST s (Maybe BS.ByteString, BS.ByteString) stepChunk !ctx !dst b = LazyST.unsafeIOToST $ BS.unsafeUseAsCStringLen b $ \(buf, sz) ->@@ -96,7 +95,9 @@ compress = compressSz 0 -- | @since 0.1.4.0-compressSz :: Int -> BSL.ByteString -> BSL.ByteString+compressSz :: Int -- ^ Compression level+ -> BSL.ByteString+ -> BSL.ByteString compressSz lvl bs = runST $ do let bss = BSL.toChunks bs
src/Codec/Lz4/Foreign.chs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CApiFFI #-}- module Codec.Lz4.Foreign ( -- * Blocks lZ4VersionNumber , lZ4VersionString@@ -12,6 +10,7 @@ , lZ4FGetVersion , lZ4FCreateCompressionContext , lZ4FFreeCompressionContext+ , lZ4FFreeDecompressionContext , lZ4FHeaderSizeMax , lZ4FCompressBegin , lZ4FCompressBound@@ -75,7 +74,7 @@ {# pointer *LZ4F_cctx as LzCtxPtr foreign finalizer LZ4F_freeCompressionContext as ^ -> LzCtx #} -{# fun unsafe LZ4F_createCompressionContext as ^ { alloca- `Ptr LzCtx' peek*, `CUInt' } -> `LZ4FErrorCode' #}+{# fun LZ4F_createCompressionContext as ^ { alloca- `Ptr LzCtx' peek*, `CUInt' } -> `LZ4FErrorCode' #} data LzPreferences @@ -84,7 +83,7 @@ lZ4FHeaderSizeMax :: Integral a => a lZ4FHeaderSizeMax = {# const LZ4F_HEADER_SIZE_MAX #} -{# fun unsafe LZ4F_compressBegin as ^ { `LzCtxPtr', castPtr `Ptr a', coerce `CSize', `LzPreferencesPtr' } -> `CSize' coerce #}+{# fun LZ4F_compressBegin as ^ { `LzCtxPtr', castPtr `Ptr a', coerce `CSize', `LzPreferencesPtr' } -> `CSize' coerce #} {# fun pure LZ4F_compressBound as ^ { coerce `CSize', `LzPreferencesPtr' } -> `CSize' coerce #} @@ -92,7 +91,7 @@ {# pointer *LZ4F_compressOptions_t as LzCompressOptionsPtr -> LzCompressOptions #} -{# fun unsafe LZ4F_compressUpdate as ^+{# fun LZ4F_compressUpdate as ^ { `LzCtxPtr' , castPtr `Ptr a' , coerce `CSize'@@ -102,20 +101,20 @@ } -> `CSize' coerce #} -{# fun unsafe LZ4F_compressEnd as ^+{# fun LZ4F_compressEnd as ^ { `LzCtxPtr', castPtr `Ptr a', coerce `CSize', `LzCompressOptionsPtr' } -> `CSize' coerce #} data LzDecompressionCtx {# pointer *LZ4F_dctx as LzDecompressionCtxPtr foreign finalizer LZ4F_freeDecompressionContext as ^ -> LzDecompressionCtx #} -{# fun unsafe LZ4F_createDecompressionContext as ^ { alloca- `Ptr LzDecompressionCtx' peek*, `CUInt' } -> `LZ4FErrorCode' #}+{# fun LZ4F_createDecompressionContext as ^ { alloca- `Ptr LzDecompressionCtx' peek*, `CUInt' } -> `LZ4FErrorCode' #} data LzDecompressOptions {# pointer *LZ4F_decompressOptions_t as LzDecompressOptionsPtr -> LzDecompressOptions #} -{# fun unsafe LZ4F_decompress as ^+{# fun LZ4F_decompress as ^ { `LzDecompressionCtxPtr' , castPtr `Ptr a' , castPtr `Ptr CSize'