zip 0.1.5 → 0.1.6
raw patch · 10 files changed
+56/−66 lines, 10 filesdep −criteriondep ~timedep ~zip
Dependencies removed: criterion
Dependency ranges changed: time, zip
Files
- CHANGELOG.md +8/−0
- Codec/Archive/Zip.hs +1/−1
- Codec/Archive/Zip/CP437.hs +1/−1
- Codec/Archive/Zip/Internal.hs +14/−3
- Codec/Archive/Zip/Type.hs +1/−1
- LICENSE.md +1/−1
- README.md +2/−2
- bench/Main.hs +0/−38
- tests/Main.hs +14/−1
- zip.cabal +14/−18
CHANGELOG.md view
@@ -1,3 +1,11 @@+## Zip 0.1.6++* Allowed `time-1.7`.++* Fixed an issue when empty archives with Zip 64 feature enabled could not+ be read (the “Parsing of archive structure failed: Cannot locate end of+ central directory”).+ ## Zip 0.1.5 * Switched to using `withBinaryFile` instead of `withFile`, because the
Codec/Archive/Zip.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Codec.Archive.Zip--- Copyright : © 2016 Mark Karpov+-- Copyright : © 2016–2017 Mark Karpov -- License : BSD 3 clause -- -- Maintainer : Mark Karpov <markkarpov@openmailbox.org>
Codec/Archive/Zip/CP437.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Codec.Archive.Zip.CP437--- Copyright : © 2016 Mark Karpov+-- Copyright : © 2016–2017 Mark Karpov -- License : BSD 3 clause -- -- Maintainer : Mark Karpov <markkarpov@openmailbox.org>
Codec/Archive/Zip/Internal.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Codec.Archive.Zip.Internal--- Copyright : © 2016 Mark Karpov+-- Copyright : © 2016–2017 Mark Karpov -- License : BSD 3 clause -- -- Maintainer : Mark Karpov <markkarpov@openmailbox.org>@@ -9,6 +9,7 @@ -- -- Low-level, non-public concepts and operations. +{-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} module Codec.Archive.Zip.Internal@@ -481,9 +482,14 @@ B.hPut h cd -- write central directory let totalCount = M.size m cdSize = B.length cd- needZip64 = totalCount >= 0xffff+ needZip64 =+#ifdef USE_ZIP64_ECD+ True+#else+ totalCount >= 0xffff || cdSize >= 0xffffffff || cdOffset >= 0xffffffff+#endif when needZip64 $ do zip64ecdOffset <- hTell h B.hPut h . runPut $ putZip64ECD totalCount cdSize cdOffset@@ -821,7 +827,12 @@ else do hSeek h AbsoluteSeek sigPos cdSig <- getNum getWord32le 4- return $ if cdSig == 0x02014b50 || cdSig == 0x06054b50+ return $ if cdSig == 0x02014b50 ||+ -- ↑ normal case: central directory file header signature+ cdSig == 0x06064b50 ||+ -- ↑ happens when zip 64 archive is empty+ cdSig == 0x06054b50+ -- ↑ happens when vanilla archive is empty then Just pos else Nothing
Codec/Archive/Zip/Type.hs view
@@ -1,6 +1,6 @@ -- | -- Module : Codec.Archive.Zip.Type--- Copyright : © 2016 Mark Karpov+-- Copyright : © 2016–2017 Mark Karpov -- License : BSD 3 clause -- -- Maintainer : Mark Karpov <markkarpov@openmailbox.org>
LICENSE.md view
@@ -1,4 +1,4 @@-Copyright © 2016 Mark Karpov+Copyright © 2016–2017 Mark Karpov All rights reserved.
README.md view
@@ -92,7 +92,7 @@ The library supports all features specified in modern .ZIP specification except for encryption and multi-disk archives. See more about this below. -For reference, here is a [copy of the specification](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT).+For reference, here is a [copy of the specification](https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.3.TXT). ### Compression methods @@ -287,6 +287,6 @@ ## License -Copyright © 2016 Mark Karpov+Copyright © 2016–2017 Mark Karpov Distributed under BSD 3 clause license.
− bench/Main.hs
@@ -1,38 +0,0 @@------ Benchmarks for the ‘zip’ package.------ Copyright © 2016 Mark Karpov <markkarpov@openmailbox.org>------ Redistribution and use in source and binary forms, with or without--- modification, are permitted provided that the following conditions are--- met:------ * Redistributions of source code must retain the above copyright notice,--- this list of conditions and the following disclaimer.------ * Redistributions in binary form must reproduce the above copyright--- notice, this list of conditions and the following disclaimer in the--- documentation and/or other materials provided with the distribution.------ * Neither the name Mark Karpov nor the names of contributors may be used--- to endorse or promote products derived from this software without--- specific prior written permission.------ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS “AS IS” AND ANY--- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED--- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE--- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY--- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL--- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS--- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)--- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,--- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN--- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE--- POSSIBILITY OF SUCH DAMAGE.--module Main (main) where--import Criterion.Main--main :: IO ()-main = defaultMain [] -- TODO
tests/Main.hs view
@@ -1,7 +1,7 @@ -- -- Tests for the ‘zip’ package. ----- Copyright © 2016 Mark Karpov <markkarpov@openmailbox.org>+-- Copyright © 2016–2017 Mark Karpov <markkarpov@openmailbox.org> -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are@@ -30,6 +30,7 @@ -- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. +{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-}@@ -734,5 +735,17 @@ emptyArchive :: ByteString emptyArchive = B.pack+#ifdef USE_ZIP64_ECD+ [ 0x50, 0x4b, 0x06, 0x06, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00+ , 0x00, 0x2e, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00+ , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00+ , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00+ , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00+ , 0x00, 0x50, 0x4b, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00+ , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50+ , 0x4b, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00+ , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]+#else [ 0x50, 0x4b, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]+#endif
zip.cabal view
@@ -1,7 +1,7 @@ -- -- Cabal configuration for ‘zip’. ----- Copyright © 2016 Mark Karpov+-- Copyright © 2016–2017 Mark Karpov -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are@@ -31,7 +31,7 @@ -- POSSIBILITY OF SUCH DAMAGE. name: zip-version: 0.1.5+version: 0.1.6 cabal-version: >= 1.10 license: BSD3 license-file: LICENSE.md@@ -51,6 +51,11 @@ manual: True default: False +flag zip64-ecd+ description: Unconditionally use Zip64 ECD format.+ manual: True+ default: False+ library build-depends: base >= 4.8 && < 5.0 , bytestring >= 0.9 && < 0.11@@ -69,7 +74,7 @@ , plan-b >= 0.2 && < 0.3 , resourcet >= 1.0 && < 2.0 , text >= 0.2 && < 1.3- , time >= 1.4 && < 1.7+ , time >= 1.4 && < 1.8 , transformers >= 0.4 && < 0.6 if !impl(ghc >= 8.0) build-depends: semigroups >= 0.16@@ -83,6 +88,8 @@ ghc-options: -Wall -Werror else ghc-options: -O2 -Wall+ if flag(zip64-ecd)+ cpp-options: -DUSE_ZIP64_ECD default-language: Haskell2010 test-suite tests@@ -93,6 +100,8 @@ ghc-options: -Wall -Werror else ghc-options: -O2 -Wall+ if flag(zip64-ecd)+ cpp-options: -DUSE_ZIP64_ECD build-depends: base >= 4.8 && < 5.0 , bytestring >= 0.9 && < 0.11 , conduit >= 1.1 && < 2.0@@ -104,22 +113,9 @@ , path >= 0.5 && < 6.0 , path-io >= 1.0.1 && < 2.0 , text >= 0.2 && < 1.3- , time >= 1.4 && < 1.7+ , time >= 1.4 && < 1.8 , transformers >= 0.4 && < 0.6- , zip >= 0.1.5- default-language: Haskell2010--benchmark bench- main-is: Main.hs- hs-source-dirs: bench- type: exitcode-stdio-1.0- if flag(dev)- ghc-options: -O2 -Wall -Werror- else- ghc-options: -O2 -Wall- build-depends: base >= 4.8 && < 5.0- , criterion >= 0.6.2 && < 1.2- , zip >= 0.1.5+ , zip >= 0.1.6 default-language: Haskell2010 source-repository head