fixed problems introduced in previous debugging session

This commit is contained in:
Arvid Norberg 2007-09-20 01:03:31 +00:00
parent e4265d1a56
commit fd3da79c6c
1 changed files with 10 additions and 7 deletions

View File

@ -403,16 +403,19 @@ namespace libtorrent
assert(ph.offset == 0 || partial_copy.final() == partial.final());
#endif
int slot_size = piece_size - ph.offset;
if (slot_size == 0)
if (slot_size > 0)
{
assert(ph.h.final() == whole.final());
return ph.h.final();
m_scratch_buffer.resize(slot_size);
read_impl(&m_scratch_buffer[0], slot, ph.offset, slot_size, true);
ph.h.update(&m_scratch_buffer[0], slot_size);
}
m_scratch_buffer.resize(slot_size);
read_impl(&m_scratch_buffer[0], slot, ph.offset, slot_size, true);
ph.h.update(&m_scratch_buffer[0], slot_size);
assert(whole.final() == ph.h.final());
#ifndef NDEBUG
sha1_hash ret = ph.h.final();
assert(ret == whole.final());
return ret;
#else
return ph.h.final();
#endif
}
void storage::initialize(bool allocate_files)