*** empty log message ***

This commit is contained in:
Arvid Norberg 2003-12-27 01:34:50 +00:00
parent dfef82ceda
commit 5fd4f6ece2
3 changed files with 20 additions and 11 deletions

View File

@ -154,7 +154,7 @@ std::string add_suffix(float val)
int 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];
val /= 1024.f;
}

View File

@ -99,9 +99,10 @@ namespace libtorrent
const boost::filesystem::path& save_path() const;
// fills the vector with a map of pieces to
// slots, including not-yet-finished piece
void export_piece_map(std::vector<std::pair<int, int> >& pieces) const;
// fills the vector that maps all allocated
// slots to the piece that is stored (or
// partially stored) there
void export_piece_map(std::vector<int>& pieces) const;
private:
struct impl;

View File

@ -370,7 +370,7 @@ namespace libtorrent {
const boost::filesystem::path& save_path() const
{ 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:
// returns the slot currently associated with the given
@ -430,20 +430,28 @@ namespace libtorrent {
}
void piece_manager::impl::export_piece_map(
std::vector<std::pair<int, int> >& p) const
std::vector<int>& p) const
{
p.clear();
for (std::vector<int>::const_iterator i = m_piece_to_slot.begin();
i != m_piece_to_slot.end();
std::vector<int>::const_reverse_iterator last;
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)
{
if (*i == -1) continue;
p.push_back(std::make_pair(i - m_piece_to_slot.begin(), *i));
p.push_back(*i);
}
}
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);
}