forked from premiere/premiere-libtorrent
remove deprecated file_base feature of file_storage
This commit is contained in:
parent
0ac16532ee
commit
76ef0babed
|
@ -1,3 +1,4 @@
|
|||
* removed deprecated support for file_base in file_storage
|
||||
* added support for running separate DHT nodes on each network interface
|
||||
* added support for establishing UTP connections on any network interface
|
||||
* added support for sending tracker announces on every network interface
|
||||
|
|
|
@ -168,8 +168,6 @@ namespace
|
|||
bool get_send_stats(announce_entry const& ae) { return ae.send_stats; }
|
||||
std::int64_t get_size(file_entry const& fe) { return fe.size; }
|
||||
std::int64_t get_offset(file_entry const& fe) { return fe.offset; }
|
||||
std::int64_t get_file_base(file_entry const& fe) { return fe.file_base; }
|
||||
void set_file_base(file_entry& fe, int b) { fe.file_base = b; }
|
||||
bool get_pad_file(file_entry const& fe) { return fe.pad_file; }
|
||||
bool get_executable_attribute(file_entry const& fe) { return fe.executable_attribute; }
|
||||
bool get_hidden_attribute(file_entry const& fe) { return fe.hidden_attribute; }
|
||||
|
@ -329,7 +327,6 @@ void bind_torrent_info()
|
|||
.add_property("symlink_attribute", &get_symlink_attribute)
|
||||
.add_property("offset", &get_offset)
|
||||
.add_property("size", &get_size)
|
||||
.add_property("file_base", &get_file_base, &set_file_base)
|
||||
;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -75,14 +75,6 @@ namespace libtorrent {
|
|||
// before it in the list.
|
||||
std::int64_t size;
|
||||
|
||||
// the offset in the file where the storage should start. The normal
|
||||
// case is to have this set to 0, so that the storage starts saving data at the start
|
||||
// if the file. In cases where multiple files are mapped into the same file though,
|
||||
// the ``file_base`` should be set to an offset so that the different regions do
|
||||
// not overlap. This is used when mapping "unselected" files into a so-called part
|
||||
// file.
|
||||
std::int64_t file_base;
|
||||
|
||||
// the modification time of this file specified in posix time.
|
||||
std::time_t mtime;
|
||||
|
||||
|
@ -420,9 +412,6 @@ namespace libtorrent {
|
|||
swap(ti.m_file_hashes, m_file_hashes);
|
||||
swap(ti.m_symlinks, m_symlinks);
|
||||
swap(ti.m_mtime, m_mtime);
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
swap(ti.m_file_base, m_file_base);
|
||||
#endif
|
||||
swap(ti.m_paths, m_paths);
|
||||
swap(ti.m_name, m_name);
|
||||
swap(ti.m_total_size, m_total_size);
|
||||
|
@ -532,13 +521,6 @@ namespace libtorrent {
|
|||
int file_name_len(file_index_t index) const;
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// deprecated in 1.1
|
||||
std::int64_t file_base_deprecated(int index) const;
|
||||
TORRENT_DEPRECATED
|
||||
std::int64_t file_base(int index) const;
|
||||
TORRENT_DEPRECATED
|
||||
void set_file_base(int index, std::int64_t off);
|
||||
|
||||
// these were deprecated in 1.0. Use the versions that take an index instead
|
||||
TORRENT_DEPRECATED
|
||||
sha1_hash hash(internal_file_entry const& fe) const;
|
||||
|
@ -549,10 +531,6 @@ namespace libtorrent {
|
|||
TORRENT_DEPRECATED
|
||||
int file_index(internal_file_entry const& fe) const;
|
||||
TORRENT_DEPRECATED
|
||||
std::int64_t file_base(internal_file_entry const& fe) const;
|
||||
TORRENT_DEPRECATED
|
||||
void set_file_base(internal_file_entry const& fe, std::int64_t off);
|
||||
TORRENT_DEPRECATED
|
||||
std::string file_path(internal_file_entry const& fe, std::string const& save_path = "") const;
|
||||
TORRENT_DEPRECATED
|
||||
std::string file_name(internal_file_entry const& fe) const;
|
||||
|
@ -611,13 +589,6 @@ namespace libtorrent {
|
|||
// index in m_files
|
||||
aux::vector<std::time_t, file_index_t> m_mtime;
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// if any file has a non-zero file base (i.e. multiple
|
||||
// files residing in the same physical file at different
|
||||
// offsets)
|
||||
aux::vector<std::int64_t, file_index_t> m_file_base;
|
||||
#endif
|
||||
|
||||
// all unique paths files have. The internal_file_entry::path_index
|
||||
// points into this array. The paths don't include the root directory
|
||||
// name for multi-file torrents. The m_name field need to be
|
||||
|
|
|
@ -180,7 +180,7 @@ namespace {
|
|||
}
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
file_entry::file_entry(): offset(0), size(0), file_base(0)
|
||||
file_entry::file_entry(): offset(0), size(0)
|
||||
, mtime(0), pad_file(false), hidden_attribute(false)
|
||||
, executable_attribute(false)
|
||||
, symlink_attribute(false)
|
||||
|
@ -461,11 +461,7 @@ namespace {
|
|||
{
|
||||
file_slice f;
|
||||
f.file_index = file_index_t(int(file_iter - m_files.begin()));
|
||||
f.offset = file_offset
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
+ file_base_deprecated(f.file_index)
|
||||
#endif
|
||||
;
|
||||
f.offset = file_offset;
|
||||
f.size = std::min(std::int64_t(file_iter->size) - file_offset, std::int64_t(size));
|
||||
TORRENT_ASSERT(f.size <= size);
|
||||
size -= int(f.size);
|
||||
|
@ -492,7 +488,6 @@ namespace {
|
|||
ret.path = file_path(index);
|
||||
ret.offset = ife.offset;
|
||||
ret.size = ife.size;
|
||||
ret.file_base = file_base(index);
|
||||
ret.mtime = mtime(index);
|
||||
ret.pad_file = ife.pad_file;
|
||||
ret.hidden_attribute = ife.hidden_attribute;
|
||||
|
@ -831,25 +826,6 @@ namespace {
|
|||
}
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
void file_storage::set_file_base(int index, std::int64_t off)
|
||||
{
|
||||
TORRENT_ASSERT_PRECOND(index >= file_index_t(0) && index < end_file());
|
||||
if (int(m_file_base.size()) <= index) m_file_base.resize(index + 1, 0);
|
||||
m_file_base[index] = off;
|
||||
}
|
||||
|
||||
std::int64_t file_storage::file_base_deprecated(int index) const
|
||||
{
|
||||
if (index >= int(m_file_base.size())) return 0;
|
||||
return m_file_base[index];
|
||||
}
|
||||
|
||||
std::int64_t file_storage::file_base(int index) const
|
||||
{
|
||||
if (index >= int(m_file_base.size())) return 0;
|
||||
return m_file_base[index];
|
||||
}
|
||||
|
||||
sha1_hash file_storage::hash(internal_file_entry const& fe) const
|
||||
{
|
||||
int index = int(&fe - &m_files[0]);
|
||||
|
@ -877,21 +853,6 @@ namespace {
|
|||
return index;
|
||||
}
|
||||
|
||||
void file_storage::set_file_base(internal_file_entry const& fe, std::int64_t off)
|
||||
{
|
||||
int index = int(&fe - &m_files[0]);
|
||||
TORRENT_ASSERT_PRECOND(index >= 0 && index < int(m_files.size()));
|
||||
if (int(m_file_base.size()) <= index) m_file_base.resize(index + 1, 0);
|
||||
m_file_base[index] = off;
|
||||
}
|
||||
|
||||
std::int64_t file_storage::file_base(internal_file_entry const& fe) const
|
||||
{
|
||||
int index = int(&fe - &m_files[0]);
|
||||
if (index >= int(m_file_base.size())) return 0;
|
||||
return m_file_base[index];
|
||||
}
|
||||
|
||||
std::string file_storage::file_path(internal_file_entry const& fe
|
||||
, std::string const& save_path) const
|
||||
{
|
||||
|
@ -942,14 +903,6 @@ namespace {
|
|||
if (int(m_file_hashes.size()) < index) m_file_hashes.resize(index + 1, nullptr);
|
||||
std::iter_swap(m_file_hashes.begin() + dst, m_file_hashes.begin() + index);
|
||||
}
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
if (!m_file_base.empty())
|
||||
{
|
||||
TORRENT_ASSERT(m_file_base.size() == m_files.size());
|
||||
if (int(m_file_base.size()) < index) m_file_base.resize(index + 1, 0);
|
||||
std::iter_swap(m_file_base.begin() + dst, m_file_base.begin() + index);
|
||||
}
|
||||
#endif // TORRENT_DEPRECATED
|
||||
}
|
||||
|
||||
void file_storage::optimize(int const pad_file_limit, int alignment
|
||||
|
@ -1098,9 +1051,6 @@ namespace {
|
|||
|
||||
if (!m_mtime.empty()) m_mtime.resize(index + 1, 0);
|
||||
if (!m_file_hashes.empty()) m_file_hashes.resize(index + 1, nullptr);
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
if (!m_file_base.empty()) m_file_base.resize(index + 1, 0);
|
||||
#endif
|
||||
|
||||
if (index != cur_index) reorder_file(index, cur_index);
|
||||
}
|
||||
|
|
|
@ -506,15 +506,8 @@ namespace libtorrent {
|
|||
, file::read_only | flags, ec);
|
||||
if (ec) return -1;
|
||||
|
||||
// please ignore the adjusted_offset. It's just file_offset.
|
||||
std::int64_t const adjusted_offset =
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
files().file_base_deprecated(file_index) +
|
||||
#endif
|
||||
file_offset;
|
||||
|
||||
error_code e;
|
||||
int const ret = int(handle->readv(adjusted_offset
|
||||
int const ret = int(handle->readv(file_offset
|
||||
, vec, e, flags));
|
||||
|
||||
// set this unconditionally in case the upper layer would like to treat
|
||||
|
@ -580,15 +573,8 @@ namespace libtorrent {
|
|||
, file::read_write, ec);
|
||||
if (ec) return -1;
|
||||
|
||||
// please ignore the adjusted_offset. It's just file_offset.
|
||||
std::int64_t const adjusted_offset =
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
files().file_base_deprecated(file_index) +
|
||||
#endif
|
||||
file_offset;
|
||||
|
||||
error_code e;
|
||||
int const ret = int(handle->writev(adjusted_offset
|
||||
int const ret = int(handle->writev(file_offset
|
||||
, vec, e, flags));
|
||||
|
||||
// set this unconditionally in case the upper layer would like to treat
|
||||
|
|
Loading…
Reference in New Issue