diff options
Diffstat (limited to 'src/Data/Torrent/Layout.hs')
-rw-r--r-- | src/Data/Torrent/Layout.hs | 8 |
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. |
306 | accumOffsets :: FileLayout FileSize -> FileLayout FileOffset | 306 | accumPositions :: FileLayout FileSize -> FileLayout (FileOffset, FileSize) |
307 | accumOffsets = go 0 | 307 | accumPositions = 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. |
313 | fileOffset :: FilePath -> FileLayout FileOffset -> Maybe FileOffset | 313 | fileOffset :: FilePath -> FileLayout FileOffset -> Maybe FileOffset |