forked from premiere/premiere-libtorrent
*** empty log message ***
This commit is contained in:
parent
dfef82ceda
commit
5fd4f6ece2
|
@ -154,7 +154,7 @@ std::string add_suffix(float val)
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < num_prefix; ++i)
|
for (i = 0; i < num_prefix; ++i)
|
||||||
{
|
{
|
||||||
if (abs(val) < 1024.f)
|
if (fabs(val) < 1024.f)
|
||||||
return to_string(val, i==0?7:6) + prefix[i];
|
return to_string(val, i==0?7:6) + prefix[i];
|
||||||
val /= 1024.f;
|
val /= 1024.f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,9 +99,10 @@ namespace libtorrent
|
||||||
|
|
||||||
const boost::filesystem::path& save_path() const;
|
const boost::filesystem::path& save_path() const;
|
||||||
|
|
||||||
// fills the vector with a map of pieces to
|
// fills the vector that maps all allocated
|
||||||
// slots, including not-yet-finished piece
|
// slots to the piece that is stored (or
|
||||||
void export_piece_map(std::vector<std::pair<int, int> >& pieces) const;
|
// partially stored) there
|
||||||
|
void export_piece_map(std::vector<int>& pieces) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct impl;
|
struct impl;
|
||||||
|
|
|
@ -370,7 +370,7 @@ namespace libtorrent {
|
||||||
const boost::filesystem::path& save_path() const
|
const boost::filesystem::path& save_path() const
|
||||||
{ return m_save_path; }
|
{ return m_save_path; }
|
||||||
|
|
||||||
void export_piece_map(std::vector<std::pair<int, int> >& p) const;
|
void export_piece_map(std::vector<int>& p) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// returns the slot currently associated with the given
|
// returns the slot currently associated with the given
|
||||||
|
@ -430,20 +430,28 @@ namespace libtorrent {
|
||||||
}
|
}
|
||||||
|
|
||||||
void piece_manager::impl::export_piece_map(
|
void piece_manager::impl::export_piece_map(
|
||||||
std::vector<std::pair<int, int> >& p) const
|
std::vector<int>& p) const
|
||||||
{
|
{
|
||||||
p.clear();
|
p.clear();
|
||||||
for (std::vector<int>::const_iterator i = m_piece_to_slot.begin();
|
std::vector<int>::const_reverse_iterator last;
|
||||||
i != m_piece_to_slot.end();
|
for (last = m_slot_to_piece.rbegin();
|
||||||
|
last != m_slot_to_piece.rend();
|
||||||
|
++last)
|
||||||
|
{
|
||||||
|
if (*last != -1) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (std::vector<int>::const_iterator i =
|
||||||
|
m_slot_to_piece.begin();
|
||||||
|
i != last.base();
|
||||||
++i)
|
++i)
|
||||||
{
|
{
|
||||||
if (*i == -1) continue;
|
p.push_back(*i);
|
||||||
p.push_back(std::make_pair(i - m_piece_to_slot.begin(), *i));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void piece_manager::export_piece_map(
|
void piece_manager::export_piece_map(
|
||||||
std::vector<std::pair<int, int> >& p) const
|
std::vector<int>& p) const
|
||||||
{
|
{
|
||||||
m_pimpl->export_piece_map(p);
|
m_pimpl->export_piece_map(p);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue