[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 14:49:36 UTC 2010
The following commit has been merged in the master branch:
commit ec6546fe48456a2c94fbf2c007b56e84d431a382
Author: John Goerzen <jgoerzen at complete.org>
Date: Sat Dec 4 04:54:11 2004 +0100
Checkpointing
Keywords:
(jgoerzen at complete.org--projects/missingh--head--0.7--patch-19)
diff --git a/ChangeLog b/ChangeLog
index 337d8b4..9da7b02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.7
#
+2004-12-03 21:54:11 GMT John Goerzen <jgoerzen at complete.org> patch-19
+
+ Summary:
+ Checkpointing
+ Revision:
+ missingh--head--0.7--patch-19
+
+
+ modified files:
+ ChangeLog libsrc/MissingH/FileArchive/GZip.hs
+
+
2004-12-03 21:43:54 GMT John Goerzen <jgoerzen at complete.org> patch-18
Summary:
diff --git a/libsrc/MissingH/FileArchive/GZip.hs b/libsrc/MissingH/FileArchive/GZip.hs
index 08576cb..fa57e87 100644
--- a/libsrc/MissingH/FileArchive/GZip.hs
+++ b/libsrc/MissingH/FileArchive/GZip.hs
@@ -25,13 +25,25 @@ where
import MissingH.Compression.Inflate
import MissingH.Checksum.CRC32
import Data.List
+import Data.Bits
import Control.Monad.Error
+import Data.Char
type GZipError = String
-- | First two bytes of file
magic = "\x1f\x8b"
+-- | Flags
+fFTEXT = 1
+fFHCRC = 2
+fFEXTRA = 4
+fFNAME = 8
+fFCOMMENT = 16
+
+split1 :: String -> (Char, String)
+split1 s = (head s, tail s)
+
{- | Read the GZip header. Return (Header, Remainder).
-}
read_header :: String -> Either GZipError (String, String)
@@ -41,4 +53,19 @@ read_header s =
if mag /= magic
then throwError "Not a GZip file"
else ok
- return ("test", rem)
\ No newline at end of file
+ let (method, rem) = split1 rem
+ if (ord(method) /= 8)
+ then throwError "Unknown compression method"
+ else ok
+ let (flag_S, rem) = split1 rem
+ let flag = ord flag_S
+ -- skip modtime (4), extraflag (1), and os (1)
+ let rem = drop 6 rem
+
+ rem <- if (flag .&. fFEXTRA /= 0)
+ then do let (xlen_S, rem2) = split1 rem
+ let (xlen2_S, rem2) = split1 rem2
+ let xlen = (ord xlen_S) + 256 * (ord xlen2_S)
+ return $ drop xlen rem2
+ else return rem
+ return ("foo", rem)
\ No newline at end of file
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list