fix warnings

This commit is contained in:
Arvid Norberg 2015-05-18 05:32:18 +00:00
parent abf9c83732
commit 051ca6b22c
6 changed files with 27 additions and 25 deletions

View File

@ -461,7 +461,7 @@ namespace libtorrent
// writes out the blocks [start, end) (releases the lock
// during the file operation)
int flush_range(cached_piece_entry* p, int start, int end
, int flags, tailqueue& completed_jobs, mutex::scoped_lock& l);
, tailqueue& completed_jobs, mutex::scoped_lock& l);
// low level flush operations, used by flush_range
int build_iovec(cached_piece_entry* pe, int start, int end

View File

@ -58,7 +58,7 @@ namespace libtorrent
// free the slot the given piece is stored in. We no longer need to store this
// piece in the part file
void free_piece(int piece, error_code& ec);
void free_piece(int piece);
void move_partfile(std::string const& path, error_code& ec);

View File

@ -346,7 +346,7 @@ namespace libtorrent
DLOG("try_flush_hashed: (%d) blocks_in_piece: %d end: %d\n"
, int(p->piece), int(p->blocks_in_piece), end);
return flush_range(p, 0, end, 0, completed_jobs, l);
return flush_range(p, 0, end, completed_jobs, l);
}
// piece range
@ -713,7 +713,7 @@ namespace libtorrent
// issues write operations for blocks in the given
// range on the given piece.
int disk_io_thread::flush_range(cached_piece_entry* pe, int start, int end
, int flags, tailqueue& completed_jobs, mutex::scoped_lock& l)
, tailqueue& completed_jobs, mutex::scoped_lock& l)
{
TORRENT_ASSERT(l.locked());
INVARIANT_CHECK;
@ -791,7 +791,7 @@ namespace libtorrent
else if ((flags & flush_write_cache) && pe->num_dirty > 0)
{
// issue write commands
flush_range(pe, 0, INT_MAX, 0, completed_jobs, l);
flush_range(pe, 0, INT_MAX, completed_jobs, l);
// if we're also flushing the read cache, this piece
// should be removed as soon as all write jobs finishes
@ -943,7 +943,7 @@ namespace libtorrent
#endif
++pe->piece_refcount;
num -= flush_range(pe, 0, INT_MAX, 0, completed_jobs, l);
num -= flush_range(pe, 0, INT_MAX, completed_jobs, l);
--pe->piece_refcount;
m_disk_cache.maybe_free_piece(pe);
@ -991,7 +991,7 @@ namespace libtorrent
for (int i = 0; i < num_flush; ++i)
{
flush_range(to_flush[i], 0, INT_MAX, 0, completed_jobs, l);
flush_range(to_flush[i], 0, INT_MAX, completed_jobs, l);
TORRENT_ASSERT(to_flush[i]->piece_refcount > 0);
--to_flush[i]->piece_refcount;
m_disk_cache.maybe_free_piece(to_flush[i]);

View File

@ -242,7 +242,7 @@ namespace libtorrent
}
}
void part_file::free_piece(int piece, error_code& ec)
void part_file::free_piece(int piece)
{
mutex::scoped_lock l(m_mutex);
@ -322,10 +322,13 @@ namespace libtorrent
boost::int64_t slot_offset = boost::int64_t(m_header_size) + boost::int64_t(i->second) * m_piece_size;
file::iovec_t v = { buf.get(), size_t(block_to_copy) };
int ret = m_file.readv(slot_offset + piece_offset, &v, 1, ec);
if (ec) return;
TORRENT_ASSERT(ec || ret == block_to_copy);
if (ec || ret != block_to_copy) return;
ret = f.writev(file_offset, &v, 1, ec);
if (ec) return;
TORRENT_ASSERT(ec || ret == block_to_copy);
if (ec || ret != block_to_copy) return;
if (block_to_copy == m_piece_size)
{

View File

@ -118,8 +118,7 @@ int test_main()
pf.export_file(output, 10 * piece_size, 1024, ec);
if (ec) fprintf(stderr, "export_file: %s\n", ec.message().c_str());
pf.free_piece(10, ec);
if (ec) fprintf(stderr, "free_piece: %s\n", ec.message().c_str());
pf.free_piece(10);
pf.flush_metadata(ec);
if (ec) fprintf(stderr, "flush_metadata: %s\n", ec.message().c_str());