From: Ramakrishnan Muthukrishnan Date: Wed, 26 Jul 2017 05:49:58 +0000 (+0530) Subject: Bencode, Metainfo: remove warnings and general cleanup X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/biz//%22%22?a=commitdiff_plain;h=972e7a451abd851317146c196bc675fd11751fc8;p=functorrent.git Bencode, Metainfo: remove warnings and general cleanup --- diff --git a/src/FuncTorrent/Bencode.hs b/src/FuncTorrent/Bencode.hs index fd521dc..28f0460 100644 --- a/src/FuncTorrent/Bencode.hs +++ b/src/FuncTorrent/Bencode.hs @@ -20,9 +20,6 @@ {-# LANGUAGE OverloadedStrings #-} module FuncTorrent.Bencode (BVal(..) - , bValToBList - , bValToBytestr - , bValToInfoDict , bValToInteger , bstrToString , decode @@ -33,7 +30,7 @@ import Prelude hiding (length, concat) import Data.ByteString (ByteString, length, concat) import Data.ByteString.Char8 (unpack, pack) -import Data.Char (isLetter, isNumber, isPrint, isAscii) +import Data.Char (isLetter, isAscii) import Data.Map.Strict (Map, fromList, toList) import Text.ParserCombinators.Parsec import qualified Text.Parsec.ByteString as ParsecBS @@ -75,14 +72,6 @@ bValToBytestr :: BVal -> Maybe ByteString bValToBytestr (Bstr bs) = Just bs bValToBytestr _ = Nothing -bValToBList :: BVal -> Maybe [BVal] -bValToBList (Blist lst) = Just lst -bValToBList _ = Nothing - -bValToInfoDict :: BVal -> Maybe (Map String BVal) -bValToInfoDict (Bdict dict) = Just dict -bValToInfoDict _ = Nothing - bstrToString :: BVal -> Maybe String bstrToString bval = unpack <$> bValToBytestr bval diff --git a/src/FuncTorrent/Metainfo.hs b/src/FuncTorrent/Metainfo.hs index 801b53d..3f860ec 100644 --- a/src/FuncTorrent/Metainfo.hs +++ b/src/FuncTorrent/Metainfo.hs @@ -62,12 +62,11 @@ bvalToInfo (Bdict m) = let (Bint pieceLength') = m ! "piece length" -- is the key "files" present? If so, it is a multi-file torrent -- if not, it is a single file torrent. filesIfMulti = lookup "files" m - (Bint length') = m ! "length" - md5sum' = Nothing partialInfo = Info { pieceLength = pieceLength' , pieces = pieces' , private = private' , name = unpack name' + , filemeta = [] } in case filesIfMulti of