added support for bitcomet padding files. simplified storage read/write code.

This commit is contained in:
Arvid Norberg
2008-10-03 05:49:41 +00:00
parent ff41246c42
commit d4c206841b
5 changed files with 145 additions and 163 deletions

View File

@@ -56,7 +56,7 @@ namespace libtorrent
struct TORRENT_EXPORT file_entry
{
file_entry(): offset(0), size(0), file_base(0) {}
file_entry(): offset(0), size(0), file_base(0), pad_file(false) {}
fs::path path;
size_type offset; // the offset of this file inside the torrent
@@ -65,6 +65,7 @@ namespace libtorrent
// This is always 0 unless parts of the torrent is
// compressed into a single file, such as a so-called part file.
size_type file_base;
bool pad_file:1;
};
struct TORRENT_EXPORT file_slice
@@ -84,7 +85,7 @@ namespace libtorrent
bool is_valid() const { return m_piece_length > 0; }
void add_file(file_entry const& e);
void add_file(fs::path const& p, size_type size);
void add_file(fs::path const& p, size_type size, bool pad_file = false);
void rename_file(int index, std::string const& new_filename);
std::vector<file_slice> map_block(int piece, size_type offset