fixes in file_win and removed debugging output from storage

This commit is contained in:
Arvid Norberg 2007-04-18 20:00:58 +00:00
parent 88d6f7a4c9
commit 9551e68074
2 changed files with 6 additions and 7 deletions

View File

@ -171,11 +171,12 @@ namespace libtorrent
if (new_handle == INVALID_HANDLE_VALUE) if (new_handle == INVALID_HANDLE_VALUE)
throw_exception(file_name); throw_exception(file_name);
// try to make the file sparse if supported // try to make the file sparse if supported
DWORD temp; if (access_mask & GENERIC_WRITE)
int ret = ::DeviceIoControl(new_handle, FSCTL_SET_SPARSE, 0, 0 {
, 0, 0, &temp, 0); DWORD temp;
if (ret == 0) ::DeviceIoControl(new_handle, FSCTL_SET_SPARSE, 0, 0
throw_exception(file_name); , 0, 0, &temp, 0);
}
// will only close old file if the open succeeded // will only close old file if the open succeeded
close(); close();
m_file_handle = new_handle; m_file_handle = new_handle;

View File

@ -2043,7 +2043,6 @@ namespace libtorrent
assert(m_piece_to_slot[pos] >= 0); assert(m_piece_to_slot[pos] >= 0);
m_storage->read(&buffer[0], m_piece_to_slot[pos], 0 m_storage->read(&buffer[0], m_piece_to_slot[pos], 0
, static_cast<int>(m_info.piece_size(pos))); , static_cast<int>(m_info.piece_size(pos)));
std::cerr << "reading" << std::endl;
new_free_slot = m_piece_to_slot[pos]; new_free_slot = m_piece_to_slot[pos];
m_slot_to_piece[pos] = pos; m_slot_to_piece[pos] = pos;
m_piece_to_slot[pos] = pos; m_piece_to_slot[pos] = pos;
@ -2055,7 +2054,6 @@ namespace libtorrent
if (write_back || m_fill_mode) if (write_back || m_fill_mode)
{ {
std::cerr << "writing" << std::endl;
m_storage->write(&buffer[0], pos, 0, static_cast<int>(m_info.piece_size(pos))); m_storage->write(&buffer[0], pos, 0, static_cast<int>(m_info.piece_size(pos)));
written = true; written = true;
if (abort_on_disk) return true; if (abort_on_disk) return true;