From d6a0442a56d7b977d5f1d1d162517c9086c413eb Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Tue, 3 Dec 2013 16:15:32 +0400 Subject: New storage --- src/Data/Torrent/Layout.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Data/Torrent') diff --git a/src/Data/Torrent/Layout.hs b/src/Data/Torrent/Layout.hs index c1e26d48..7ed8679d 100644 --- a/src/Data/Torrent/Layout.hs +++ b/src/Data/Torrent/Layout.hs @@ -52,7 +52,7 @@ module Data.Torrent.Layout -- * Flat file layout , FileLayout , flatLayout - , accumOffsets + , accumPositions , fileOffset -- * Internal @@ -303,11 +303,11 @@ flatLayout prefixPath MultiFile {..} = L.map mkPath liFiles joinPath (L.map BC.unpack fiName) -- | Calculate offset of each file based on its length, incrementally. -accumOffsets :: FileLayout FileSize -> FileLayout FileOffset -accumOffsets = go 0 +accumPositions :: FileLayout FileSize -> FileLayout (FileOffset, FileSize) +accumPositions = go 0 where go !_ [] = [] - go !offset ((n, s) : xs) = (n, offset) : go (offset + s) xs + go !offset ((n, s) : xs) = (n, (offset, s)) : go (offset + s) xs -- | Gives global offset of a content file for a given full path. fileOffset :: FilePath -> FileLayout FileOffset -> Maybe FileOffset -- cgit v1.2.3