bzlib 0.5.0.1 → 0.5.0.2
raw patch · 16 files changed
+70/−40 lines, 16 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- Codec/Compression/BZip/Stream.hsc +7/−3
- bunzip2.hs +0/−6
- bzip2.hs +0/−6
- bzlib.cabal +4/−4
- cbits/LICENSE +2/−2
- cbits/blocksort.c +2/−2
- cbits/bzlib.c +2/−2
- cbits/bzlib.h +8/−2
- cbits/bzlib_private.h +3/−3
- cbits/compress.c +2/−2
- cbits/crctable.c +2/−2
- cbits/decompress.c +22/−2
- cbits/huffman.c +2/−2
- cbits/randtable.c +2/−2
- examples/bunzip2.hs +6/−0
- examples/bzip2.hs +6/−0
Codec/Compression/BZip/Stream.hsc view
@@ -58,10 +58,14 @@ import Foreign ( Word8, Ptr, nullPtr, plusPtr, peekByteOff, pokeByteOff, mallocBytes , ForeignPtr, FinalizerPtr, newForeignPtr_, addForeignPtrFinalizer- , finalizeForeignPtr, withForeignPtr, touchForeignPtr- , unsafeForeignPtrToPtr, unsafePerformIO )+ , finalizeForeignPtr, withForeignPtr, touchForeignPtr )+#if MIN_VERSION_base(4,4,0)+import Foreign.ForeignPtr.Unsafe ( unsafeForeignPtrToPtr )+import System.IO.Unsafe ( unsafePerformIO )+#else+import Foreign ( unsafeForeignPtrToPtr, unsafePerformIO )+#endif import Foreign.C- ( CInt, CUInt ) import Data.ByteString.Internal (nullForeignPtr) import System.IO.Unsafe (unsafeInterleaveIO) import System.IO (hPutStrLn, stderr)
− bunzip2.hs
@@ -1,6 +0,0 @@-module Main where--import qualified Data.ByteString.Lazy as B-import qualified Codec.Compression.BZip as BZip--main = B.interact BZip.decompress
− bzip2.hs
@@ -1,6 +0,0 @@-module Main where--import qualified Data.ByteString.Lazy as B-import qualified Codec.Compression.BZip as BZip--main = B.interact BZip.compress
bzlib.cabal view
@@ -1,6 +1,6 @@ name: bzlib-version: 0.5.0.1-copyright: (c) 2006-2008 Duncan Coutts+version: 0.5.0.2+copyright: (c) 2006-2011 Duncan Coutts license: BSD3 license-file: LICENSE author: Duncan Coutts <duncan@community.haskell.org>@@ -19,7 +19,7 @@ cabal-version: >= 1.6 extra-source-files: cbits/bzlib_private.h cbits/LICENSE -- demo programs:- bzip2.hs bunzip2.hs+ examples/bzip2.hs examples/bunzip2.hs source-repository head type: darcs@@ -39,7 +39,7 @@ extra-libraries: bz2 else -- However for the benefit of users of Windows (which does not have zlib- -- by default) we bundle a complete copy of the C sources of bzip2-1.0.5+ -- by default) we bundle a complete copy of the C sources of bzip2-1.0.6 c-sources: cbits/blocksort.c cbits/bzlib.c cbits/compress.c cbits/crctable.c cbits/decompress.c cbits/huffman.c cbits/randtable.c
cbits/LICENSE view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------- This program, "bzip2", the associated library "libbzip2", and all-documentation, are copyright (C) 1996-2007 Julian R Seward. All+documentation, are copyright (C) 1996-2010 Julian R Seward. All rights reserved. Redistribution and use in source and binary forms, with or without@@ -37,6 +37,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Julian Seward, jseward@bzip.org-bzip2/libbzip2 version 1.0.5 of 10 December 2007+bzip2/libbzip2 version 1.0.6 of 6 September 2010 --------------------------------------------------------------------------
cbits/blocksort.c view
@@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>+ bzip2/libbzip2 version 1.0.6 of 6 September 2010+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file.
cbits/bzlib.c view
@@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>+ bzip2/libbzip2 version 1.0.6 of 6 September 2010+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file.
cbits/bzlib.h view
@@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>+ bzip2/libbzip2 version 1.0.6 of 6 September 2010+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file.@@ -94,6 +94,12 @@ # define BZ_EXTERN extern #endif +/* Using WINAPI causes the function to be exported using the 'stdcall'+ * calling convention. We'd rather use the ordinary calling convention+ * so we redefine BZ_API to do nothing.+ */+#undef BZ_API+#define BZ_API(func) func /*-- Core (low-level) library functions --*/
cbits/bzlib_private.h view
@@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>+ bzip2/libbzip2 version 1.0.6 of 6 September 2010+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file.@@ -36,7 +36,7 @@ /*-- General stuff. --*/ -#define BZ_VERSION "1.0.5, 10-Dec-2007"+#define BZ_VERSION "1.0.6, 6-Sept-2010" typedef char Char; typedef unsigned char Bool;
cbits/compress.c view
@@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>+ bzip2/libbzip2 version 1.0.6 of 6 September 2010+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file.
cbits/crctable.c view
@@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>+ bzip2/libbzip2 version 1.0.6 of 6 September 2010+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file.
cbits/decompress.c view
@@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>+ bzip2/libbzip2 version 1.0.6 of 6 September 2010+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file.@@ -381,6 +381,13 @@ es = -1; N = 1; do {+ /* Check that N doesn't get too big, so that es doesn't+ go negative. The maximum value that can be+ RUNA/RUNB encoded is equal to the block size (post+ the initial RLE), viz, 900k, so bounding N at 2+ million should guard against overflow without+ rejecting any legitimate inputs. */+ if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2;@@ -485,12 +492,25 @@ RETURN(BZ_DATA_ERROR); /*-- Set up cftab to facilitate generation of T^(-1) --*/+ /* Check: unzftab entries in range. */+ for (i = 0; i <= 255; i++) {+ if (s->unzftab[i] < 0 || s->unzftab[i] > nblock)+ RETURN(BZ_DATA_ERROR);+ }+ /* Actually generate cftab. */ s->cftab[0] = 0; for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1]; for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];+ /* Check: cftab entries in range. */ for (i = 0; i <= 256; i++) { if (s->cftab[i] < 0 || s->cftab[i] > nblock) { /* s->cftab[i] can legitimately be == nblock */+ RETURN(BZ_DATA_ERROR);+ }+ }+ /* Check: cftab entries non-descending. */+ for (i = 1; i <= 256; i++) {+ if (s->cftab[i-1] > s->cftab[i]) { RETURN(BZ_DATA_ERROR); } }
cbits/huffman.c view
@@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>+ bzip2/libbzip2 version 1.0.6 of 6 September 2010+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file.
cbits/randtable.c view
@@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.5 of 10 December 2007- Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>+ bzip2/libbzip2 version 1.0.6 of 6 September 2010+ Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org> Please read the WARNING, DISCLAIMER and PATENTS sections in the README file.
+ examples/bunzip2.hs view
@@ -0,0 +1,6 @@+module Main where++import qualified Data.ByteString.Lazy as B+import qualified Codec.Compression.BZip as BZip++main = B.interact BZip.decompress
+ examples/bzip2.hs view
@@ -0,0 +1,6 @@+module Main where++import qualified Data.ByteString.Lazy as B+import qualified Codec.Compression.BZip as BZip++main = B.interact BZip.compress