lzo 0.1.1.2 → 0.1.1.3
raw patch · 4 files changed
+30/−26 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- lzo.cabal +16/−10
- src/Codec/Compression/Lzo/Block.hsc +9/−10
- src/Codec/Compression/Lzo/File.hs +0/−6
CHANGELOG.md view
@@ -1,5 +1,10 @@ # lzo +## 0.1.1.3++ * Add `cross` flag for cross-compilation+ * Use unsafety to make it faster in various places+ ## 0.1.1.2 * Set `cc-options: -O3`
lzo.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: lzo-version: 0.1.1.2+version: 0.1.1.3 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2020 Vanessa McHale@@ -27,24 +27,30 @@ location: https://hub.darcs.net/vmchale/sak subdir: lzo +flag cross+ description: Enable this flag if cross-compiling+ default: False+ library- exposed-modules: Codec.Compression.Lzo- build-tool-depends: hsc2hs:hsc2hs -any- cc-options: -O3- c-sources: cbits/minilzo.c- hs-source-dirs: src+ exposed-modules: Codec.Compression.Lzo+ cc-options: -O3+ c-sources: cbits/minilzo.c+ hs-source-dirs: src other-modules: Codec.Compression.Lzo.Block Codec.Compression.Lzo.File - default-language: Haskell2010- include-dirs: cbits- ghc-options: -Wall -O2+ default-language: Haskell2010+ include-dirs: cbits+ ghc-options: -Wall -O2 build-depends: base >=4.9 && <5, bytestring -any, digest -any,- binary -any+ binary >=0.8.3.0++ if !flag(cross)+ build-tool-depends: hsc2hs:hsc2hs -any if impl(ghc >=8.0) ghc-options:
src/Codec/Compression/Lzo/Block.hsc view
@@ -20,7 +20,6 @@ , lzoVersionDate ) where -import Control.Applicative import Control.Exception (Exception, throw) import qualified Data.ByteString as BS import qualified Data.ByteString.Unsafe as BS@@ -30,18 +29,18 @@ import Foreign.Ptr (Ptr, nullPtr) import Foreign.Marshal.Alloc (alloca, allocaBytes) import Foreign.Storable (peek, poke)-import System.IO.Unsafe (unsafePerformIO)+import System.IO.Unsafe (unsafeDupablePerformIO, unsafePerformIO) #include <minilzo.h> type Byte = CChar -foreign import ccall lzo1x_1_compress :: Ptr Byte -> CUInt -> Ptr Byte -> Ptr CUInt -> Ptr a -> IO CInt-foreign import ccall lzo1x_decompress_safe :: Ptr Byte -> CUInt -> Ptr Byte -> Ptr CUInt -> Ptr a -> IO CInt+foreign import ccall unsafe lzo1x_1_compress :: Ptr Byte -> CUInt -> Ptr Byte -> Ptr CUInt -> Ptr a -> IO CInt+foreign import ccall unsafe lzo1x_decompress :: Ptr Byte -> CUInt -> Ptr Byte -> Ptr CUInt -> Ptr a -> IO CInt -foreign import ccall lzo_version :: CUInt-foreign import ccall lzo_version_string :: CString-foreign import ccall lzo_version_date :: CString+foreign import ccall unsafe lzo_version :: CUInt+foreign import ccall unsafe lzo_version_string :: CString+foreign import ccall unsafe lzo_version_date :: CString -- | @since 0.1.1.0 lzoVersion :: Word@@ -49,11 +48,11 @@ -- | @since 0.1.1.0 lzoVersionString :: String-lzoVersionString = unsafePerformIO $ peekCString lzo_version_string+lzoVersionString = unsafeDupablePerformIO $ peekCString lzo_version_string -- | @since 0.1.1.0 lzoVersionDate :: String-lzoVersionDate = unsafePerformIO $ peekCString lzo_version_date+lzoVersionDate = unsafeDupablePerformIO $ peekCString lzo_version_date lzo1MemCompress :: Integral a => a lzo1MemCompress = #{const LZO1X_1_MEM_COMPRESS}@@ -124,7 +123,7 @@ allocaBytes outSz $ \bytePtr -> alloca $ \szPtr -> do poke szPtr (fromIntegral outSz)- res <- LzoError <$> lzo1x_decompress_safe buf (fromIntegral bufSz) bytePtr szPtr nullPtr+ res <- LzoError <$> lzo1x_decompress buf (fromIntegral bufSz) bytePtr szPtr nullPtr when (isError res) $ throw res sz <- peek szPtr
src/Codec/Compression/Lzo/File.hs view
@@ -26,12 +26,6 @@ type LzoBlock = Maybe BS.ByteString --- getByte :: Word8 -> Get ()--- getByte b = do- -- b' <- getWord8- -- unless (b' == b) $- -- fail "Invalid magic byte; perhaps it is not an lzop file"- getMagic :: Get () getMagic = do inp <- getByteString 9