fixed bug in write resume data

This commit is contained in:
Arvid Norberg 2007-05-31 02:22:04 +00:00
parent 31247c046a
commit 43a28e7a49
1 changed files with 3 additions and 1 deletions

View File

@ -564,9 +564,11 @@ namespace libtorrent
for (int j = 0; j < num_bitmask_bytes; ++j)
{
unsigned char v = 0;
for (int k = 0; k < 8; ++k)
int bits = std::min(num_blocks_per_piece - j*8, 8);
for (int k = 0; k < bits; ++k)
v |= i->info[j*8+k].finished?(1 << k):0;
bitmask.insert(bitmask.end(), v);
assert(bits == 8 || j == num_bitmask_bytes - 1);
}
piece_struct["bitmask"] = bitmask;