diff options
author | Clint Adams <clint@debian.org> | 2012-04-26 20:40:26 -0400 |
---|---|---|
committer | Clint Adams <clint@debian.org> | 2012-04-26 20:40:26 -0400 |
commit | 00dad0cfc02fdd78abe425aa29b41855a22dea1a (patch) | |
tree | 1d2129886b5e1dc6ef620e6a7a6ae023994a019a | |
parent | 8c34729c62ba64c810fbfa73719ae7f7110c0fbe (diff) |
Make hlint happy.
-rw-r--r-- | Codec/Encryption/OpenPGP/ASCIIArmor/Multipart.hs | 2 | ||||
-rw-r--r-- | Data/Digest/CRC24.hs | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/Codec/Encryption/OpenPGP/ASCIIArmor/Multipart.hs b/Codec/Encryption/OpenPGP/ASCIIArmor/Multipart.hs index 313c3bc..e3f6c34 100644 --- a/Codec/Encryption/OpenPGP/ASCIIArmor/Multipart.hs +++ b/Codec/Encryption/OpenPGP/ASCIIArmor/Multipart.hs | |||
@@ -17,7 +17,7 @@ multipartMerge as = go as (Armor ArmorMessage [] BL.empty) | |||
17 | where | 17 | where |
18 | go :: [Armor] -> Armor -> Armor | 18 | go :: [Armor] -> Armor -> Armor |
19 | go [] state = state | 19 | go [] state = state |
20 | go ((Armor at hs bs):as) state = go as (go' at hs bs state) | 20 | go (Armor at hs bs:as) state = go as (go' at hs bs state) |
21 | go' :: ArmorType -> [(String,String)] -> ByteString -> Armor -> Armor | 21 | go' :: ArmorType -> [(String,String)] -> ByteString -> Armor -> Armor |
22 | go' (ArmorSplitMessage _ _) hs bs (Armor _ ohs obs) = Armor ArmorMessage (ohs ++ hs) (obs `BL.append` bs) | 22 | go' (ArmorSplitMessage _ _) hs bs (Armor _ ohs obs) = Armor ArmorMessage (ohs ++ hs) (obs `BL.append` bs) |
23 | go' (ArmorSplitMessageIndefinite _) hs bs (Armor _ ohs obs) = Armor ArmorMessage (ohs ++ hs) (obs `BL.append` bs) | 23 | go' (ArmorSplitMessageIndefinite _) hs bs (Armor _ ohs obs) = Armor ArmorMessage (ohs ++ hs) (obs `BL.append` bs) |
diff --git a/Data/Digest/CRC24.hs b/Data/Digest/CRC24.hs index 4586177..87b3bc9 100644 --- a/Data/Digest/CRC24.hs +++ b/Data/Digest/CRC24.hs | |||
@@ -14,17 +14,17 @@ import qualified Data.ByteString as B | |||
14 | import qualified Data.ByteString.Lazy as BL | 14 | import qualified Data.ByteString.Lazy as BL |
15 | import Data.Word (Word8, Word32) | 15 | import Data.Word (Word8, Word32) |
16 | 16 | ||
17 | crc24_init :: Word32 | 17 | crc24Init :: Word32 |
18 | crc24_init = 0xB704CE | 18 | crc24Init = 0xB704CE |
19 | 19 | ||
20 | crc24_poly :: Word32 | 20 | crc24Poly :: Word32 |
21 | crc24_poly = 0x1864CFB | 21 | crc24Poly = 0x1864CFB |
22 | 22 | ||
23 | crc24_update :: Word32 -> Word8 -> Word32 | 23 | crc24Update :: Word32 -> Word8 -> Word32 |
24 | crc24_update c b = (last . take 9 $ iterate (\x -> if (shiftL x 1) .&. 0x1000000 == 0x1000000 then shiftL x 1 `xor` crc24_poly else shiftL x 1) (c `xor` shiftL (fromIntegral b) 16)) .&. 0xFFFFFF | 24 | crc24Update c b = (last . take 9 $ iterate (\x -> if shiftL x 1 .&. 0x1000000 == 0x1000000 then shiftL x 1 `xor` crc24Poly else shiftL x 1) (c `xor` shiftL (fromIntegral b) 16)) .&. 0xFFFFFF |
25 | 25 | ||
26 | crc24 :: B.ByteString -> Word32 | 26 | crc24 :: B.ByteString -> Word32 |
27 | crc24 bs = crc24Lazy . BL.fromChunks $ [bs] | 27 | crc24 bs = crc24Lazy . BL.fromChunks $ [bs] |
28 | 28 | ||
29 | crc24Lazy :: ByteString -> Word32 | 29 | crc24Lazy :: ByteString -> Word32 |
30 | crc24Lazy bs = BL.foldl crc24_update crc24_init bs | 30 | crc24Lazy = BL.foldl crc24Update crc24Init |