]> git.rkrishnan.org Git - functorrent.git/commitdiff
Metainfo: rename mkInfo -> bvalToInfo
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Tue, 25 Jul 2017 07:32:15 +0000 (13:02 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Tue, 25 Jul 2017 07:32:15 +0000 (13:02 +0530)
src/FuncTorrent/Metainfo.hs

index e555074ac110076f675462ae133434ed183a39f4..4cc6ed126c2685528427f0145db03f9dbc5ae6a6 100644 (file)
@@ -50,24 +50,24 @@ data Metainfo = Metainfo { info :: !(Maybe Info)
                          , infoHash :: !ByteString
                          } deriving (Eq, Show)
 
-mkInfo :: BVal -> Maybe Info
-mkInfo (Bdict m) = let (Bint pieceLength') = m ! "piece length"
-                       (Bstr pieces') = m ! "pieces"
-                       private' = Nothing
-                       (Bstr name') = m ! "name"
-                       (Bint length') = m ! "length"
-                       md5sum' = Nothing
-                   in Just Info { pieceLength = pieceLength'
-                                , pieces = pieces'
-                                , private = private'
-                                , name = unpack name'
-                                , lengthInBytes = length'
-                                , md5sum = md5sum'}
-mkInfo _ = Nothing
+bvalToInfo :: BVal -> Maybe Info
+bvalToInfo (Bdict m) = let (Bint pieceLength') = m ! "piece length"
+                           (Bstr pieces') = m ! "pieces"
+                           private' = Nothing
+                           (Bstr name') = m ! "name"
+                           (Bint length') = m ! "length"
+                           md5sum' = Nothing
+                       in Just Info { pieceLength = pieceLength'
+                                    , pieces = pieces'
+                                    , private = private'
+                                    , name = unpack name'
+                                    , lengthInBytes = length'
+                                    , md5sum = md5sum'}
+bvalToInfo _ = Nothing
 
 mkMetaInfo :: BVal   -> Either String Metainfo
 mkMetaInfo (Bdict m)  =
-    let info'         = mkInfo $ m ! "info"
+    let info'         = bvalToInfo $ m ! "info"
         announce'     = lookup "announce" m
         announceList' = lookup "announce-list" m
         creationDate' = lookup "creation date" m