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()); assert(ph.offset == 0 || partial_copy.final() == partial.final());
#endif #endif
int slot_size = piece_size - ph.offset; int slot_size = piece_size - ph.offset;
if (slot_size == 0) if (slot_size > 0)
{ {
assert(ph.h.final() == whole.final()); m_scratch_buffer.resize(slot_size);
return ph.h.final(); 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); #ifndef NDEBUG
read_impl(&m_scratch_buffer[0], slot, ph.offset, slot_size, true); sha1_hash ret = ph.h.final();
ph.h.update(&m_scratch_buffer[0], slot_size); assert(ret == whole.final());
assert(whole.final() == ph.h.final()); return ret;
#else
return ph.h.final(); return ph.h.final();
#endif
} }
void storage::initialize(bool allocate_files) void storage::initialize(bool allocate_files)