tr_file const* f = &inf->files[fi];
/* get the oldest and newest nonzero timestamps for pieces in this file */
- for (p = &inf->pieces[f->firstPiece], pend = &inf->pieces[f->lastPiece]; p != pend; ++p)
+ for (p = &inf->pieces[f->firstPiece], pend = &inf->pieces[f->lastPiece] + 1; p != pend; ++p)
{
if (p->timeChecked == 0)
{
{
tr_file const* f = &inf->files[fi];
tr_piece* p = &inf->pieces[f->firstPiece];
- tr_piece const* pend = &inf->pieces[f->lastPiece];
+ tr_piece const* pend = &inf->pieces[f->lastPiece] + 1;
time_t const mtime = tr_torrentGetFileMTime(tor, fi);
time_t const timeChecked = mtime == t ? mtime : 0;
/* now that the file is complete and closed, we can start watching its
* mtime timestamp for changes to know if we need to reverify pieces */
- for (p = &inf->pieces[f->firstPiece], pend = &inf->pieces[f->lastPiece]; p != pend; ++p)
+ for (p = &inf->pieces[f->firstPiece], pend = &inf->pieces[f->lastPiece] + 1; p != pend; ++p)
{
p->timeChecked = now;
}