minor storage fix

This commit is contained in:
Arvid Norberg 2011-03-13 21:07:46 +00:00
parent 8923f381a5
commit a18f047311
2 changed files with 5 additions and 5 deletions

View File

@ -173,7 +173,7 @@ namespace libtorrent
error_code const& error() const { return m_error; } error_code const& error() const { return m_error; }
std::string const& error_file() const { return m_error_file; } std::string const& error_file() const { return m_error_file; }
void clear_error() { m_error = error_code(); m_error_file.resize(0); } virtual void clear_error() { m_error = error_code(); m_error_file.resize(0); }
mutable error_code m_error; mutable error_code m_error;
mutable std::string m_error_file; mutable std::string m_error_file;

View File

@ -684,18 +684,18 @@ namespace libtorrent
l.unlock(); l.unlock();
if (iov) if (iov)
{ {
p.storage->write_impl(iov, p.piece, (std::min)( int ret = p.storage->write_impl(iov, p.piece, (std::min)(
i * m_block_size, piece_size) - buffer_size, iov_counter); i * m_block_size, piece_size) - buffer_size, iov_counter);
iov_counter = 0; iov_counter = 0;
++num_write_calls; if (ret > 0) ++num_write_calls;
} }
else else
{ {
TORRENT_ASSERT(buf); TORRENT_ASSERT(buf);
file::iovec_t b = { buf.get(), buffer_size }; file::iovec_t b = { buf.get(), buffer_size };
p.storage->write_impl(&b, p.piece, (std::min)( int ret = p.storage->write_impl(&b, p.piece, (std::min)(
i * m_block_size, piece_size) - buffer_size, 1); i * m_block_size, piece_size) - buffer_size, 1);
++num_write_calls; if (ret > 0) ++num_write_calls;
} }
l.lock(); l.lock();
++m_cache_stats.writes; ++m_cache_stats.writes;