summaryrefslogtreecommitdiff
path: root/src/Data/Torrent/Layout.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Torrent/Layout.hs')
-rw-r--r--src/Data/Torrent/Layout.hs8
1 files changed, 4 insertions, 4 deletions
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
52 -- * Flat file layout 52 -- * Flat file layout
53 , FileLayout 53 , FileLayout
54 , flatLayout 54 , flatLayout
55 , accumOffsets 55 , accumPositions
56 , fileOffset 56 , fileOffset
57 57
58 -- * Internal 58 -- * Internal
@@ -303,11 +303,11 @@ flatLayout prefixPath MultiFile {..} = L.map mkPath liFiles
303 </> joinPath (L.map BC.unpack fiName) 303 </> joinPath (L.map BC.unpack fiName)
304 304
305-- | Calculate offset of each file based on its length, incrementally. 305-- | Calculate offset of each file based on its length, incrementally.
306accumOffsets :: FileLayout FileSize -> FileLayout FileOffset 306accumPositions :: FileLayout FileSize -> FileLayout (FileOffset, FileSize)
307accumOffsets = go 0 307accumPositions = go 0
308 where 308 where
309 go !_ [] = [] 309 go !_ [] = []
310 go !offset ((n, s) : xs) = (n, offset) : go (offset + s) xs 310 go !offset ((n, s) : xs) = (n, (offset, s)) : go (offset + s) xs
311 311
312-- | Gives global offset of a content file for a given full path. 312-- | Gives global offset of a content file for a given full path.
313fileOffset :: FilePath -> FileLayout FileOffset -> Maybe FileOffset 313fileOffset :: FilePath -> FileLayout FileOffset -> Maybe FileOffset