void-packages/srcpkgs/ganeti/patches/zlib-0.6-compatibility.patch
2016-05-01 05:04:06 -04:00

34 lines
1.2 KiB
Diff

Author: Apollon Oikonomopoulos <apoikos@debian.org>
Description: haskell-zlib 0.6 compatibility
Based on a patch by Klaus Aehlig submitted to ganeti-devel, Message-Id:
<052c6c02393324a9403f4291c112c4689dc1c507.1453302634.git.aehlig@google.com>
Last-Update: 2016-01-21
Forwarded: not-needed
--- a/src/Ganeti/Codec.hs
+++ b/src/Ganeti/Codec.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
{-| Provides interface to the 'zlib' library.
-}
@@ -51,6 +53,13 @@
-- | Decompresses a lazy bytestring, throwing decoding errors using
-- 'throwError'.
decompressZlib :: (MonadError e m, Error e) => BL.ByteString -> m BL.ByteString
+#if MIN_VERSION_zlib(0, 6, 0)
+decompressZlib = I.foldDecompressStreamWithInput
+ (liftM . BL.chunk)
+ return
+ (throwError . strMsg . (++)"Zlib: " . show)
+ $ I.decompressST I.zlibFormat I.defaultDecompressParams
+#else
decompressZlib = I.foldDecompressStream
(liftM . BL.chunk)
(return mempty)
@@ -58,3 +67,4 @@
. I.decompressWithErrors
I.zlibFormat
I.defaultDecompressParams
+#endif