[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:54 UTC 2010


The following commit has been merged in the master branch:
commit d321c87a3ce0d8d93b4c592119cda21992b17a31
Author: John Goerzen <jgoerzen at complete.org>
Date:   Sat Dec 4 09:24:38 2004 +0100

    Checkpointing
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.7--patch-33)

diff --git a/ChangeLog b/ChangeLog
index a9f2805..b8dd2d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.7
 #
 
+2004-12-04 02:24:38 GMT	John Goerzen <jgoerzen at complete.org>	patch-33
+
+    Summary:
+      Checkpointing
+    Revision:
+      missingh--head--0.7--patch-33
+
+
+    modified files:
+     ChangeLog libsrc/MissingH/FileArchive/GZip.hs
+
+
 2004-12-04 02:16:23 GMT	John Goerzen <jgoerzen at complete.org>	patch-32
 
     Summary:
diff --git a/libsrc/MissingH/FileArchive/GZip.hs b/libsrc/MissingH/FileArchive/GZip.hs
index dd4970d..e5ca63b 100644
--- a/libsrc/MissingH/FileArchive/GZip.hs
+++ b/libsrc/MissingH/FileArchive/GZip.hs
@@ -51,7 +51,7 @@ data Header = Header {
                       extra :: Maybe String,
                       filename :: Maybe String,
                       comment :: Maybe String
-                     }
+                     } deriving (Eq, Show)
 
 split1 :: String -> (Char, String)
 split1 s = (head s, tail s)
@@ -134,23 +134,29 @@ read_header s =
        -- skip modtime (4), extraflag (1), and os (1)
        let rem4 = drop 6 rem3
        
-       rem5 <- if (flag .&. fFEXTRA /= 0)
-                  -- Skip past the extra field if we have it.
-                  then do let (xlen_S, rem4a) = split1 rem4
-                          let (xlen2_S, rem4a) = split1 rem4
-                          let xlen = (ord xlen_S) + 256 * (ord xlen2_S)
-                          return $ drop xlen rem4a
-                  else return rem4
+       let (extra, rem5) = 
+               if (flag .&. fFEXTRA /= 0)
+               -- Skip past the extra field if we have it.
+                  then let (xlen_S, rem4a) = split1 rem4
+                           (xlen2_S, rem4b) = split1 rem4
+                           xlen = (ord xlen_S) + 256 * (ord xlen2_S)
+                           (ex, rrem) = splitAt xlen rem4b
+                           in (Just ex, rrem)
+                  else (Nothing, rem4)
        
-       rem6 <- if (flag .&. fFNAME /= 0)
-                  -- Skip past the null-terminated filename
-                  then return $ tail $ dropWhile (/= '\x00') rem5
-                  else return rem5
-
-       rem7 <- if (flag .&. fFCOMMENT /= 0)
+       let (filename, rem6) = 
+               if (flag .&. fFNAME /= 0)
+               -- Skip past the null-terminated filename
+                  then let fn = takeWhile (/= '\x00') rem5
+                                in (Just fn, drop ((length fn) + 1) rem5)
+                  else (Nothing, rem5)
+
+       let (comment, rem7) =
+               if (flag .&. fFCOMMENT /= 0)
                   -- Skip past the null-terminated comment
-                  then return $ tail $ dropWhile (/= '\x00') rem6
-                  else return rem6
+                  then let cm = takeWhile (/= '\x00') rem6
+                           in (Just cm, drop ((length cm) + 1) rem6)
+                  else (Nothing, rem6)
        
        rem8 <- if (flag .&. fFHCRC /= 0)
                   -- Skip past the header CRC
@@ -159,6 +165,6 @@ read_header s =
                   
        return (Header {method = ord method,
                       flags = flag,
-                      extra = Nothing,
-                      filename = Nothing,
-                      comment = Nothing}, rem8)
+                      extra = extra,
+                      filename = filename,
+                      comment = comment}, rem8)

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list