reverted part of the file_storage API to match the previous one more closly

This commit is contained in:
Arvid Norberg
2010-11-29 05:44:29 +00:00
parent f82321c1dd
commit 2e69366b02
13 changed files with 232 additions and 195 deletions

View File

@@ -41,14 +41,14 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent
{
boost::intrusive_ptr<file> file_pool::open_file(void* st, std::string const& p
, file_entry const& fe, file_storage const& fs, int m, error_code& ec)
, file_storage::iterator fe, file_storage const& fs, int m, error_code& ec)
{
TORRENT_ASSERT(st != 0);
TORRENT_ASSERT(is_complete(p));
TORRENT_ASSERT((m & file::rw_mask) == file::read_only
|| (m & file::rw_mask) == file::read_write);
mutex::scoped_lock l(m_mutex);
file_set::iterator i = m_files.find(std::make_pair(st, fs.file_index(fe)));
file_set::iterator i = m_files.find(std::make_pair(st, fs.file_index(*fe)));
if (i != m_files.end())
{
lru_file_entry& e = i->second;
@@ -77,7 +77,7 @@ namespace libtorrent
// the new read/write privilages
TORRENT_ASSERT(e.file_ptr->refcount() == 1);
e.file_ptr->close();
std::string full_path = combine_path(p, fs.file_path(fe));
std::string full_path = combine_path(p, fs.file_path(*fe));
if (!e.file_ptr->open(full_path, m, ec))
{
m_files.erase(i);
@@ -115,12 +115,12 @@ namespace libtorrent
ec = error_code(ENOMEM, get_posix_category());
return e.file_ptr;
}
std::string full_path = combine_path(p, fs.file_path(fe));
std::string full_path = combine_path(p, fs.file_path(*fe));
if (!e.file_ptr->open(full_path, m, ec))
return boost::intrusive_ptr<file>();
e.mode = m;
e.key = st;
m_files.insert(std::make_pair(std::make_pair(st, fs.file_index(fe)), e));
m_files.insert(std::make_pair(std::make_pair(st, fs.file_index(*fe)), e));
TORRENT_ASSERT(e.file_ptr->is_open());
return e.file_ptr;
}