Skip to content

Commit

Permalink
Add function to set the block count for a file when the verification …
Browse files Browse the repository at this point in the history
…packet is missing
  • Loading branch information
Peter B Clements committed Jul 29, 2003
1 parent 3df7550 commit e75b248
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions par2repairersourcefile.cpp
Expand Up @@ -141,3 +141,16 @@ void Par2RepairerSourceFile::SetBlocks(u32 _blocknumber,
}
}
}

// Determine the block count from the file size and block size.
void Par2RepairerSourceFile::SetBlockCount(u64 blocksize)
{
if (descriptionpacket)
{
blockcount = (u32)((descriptionpacket->FileSize() + blocksize-1) / blocksize);
}
else
{
blockcount = 0;
}
}
3 changes: 3 additions & 0 deletions par2repairersourcefile.h
Expand Up @@ -55,6 +55,9 @@ class Par2RepairerSourceFile
vector<DataBlock>::iterator _targetblocks,
u64 blocksize);

// Determine the block count from the file size and block size.
void SetBlockCount(u64 blocksize);

// Set/Get which DiskFile will contain the final repaired version of the file
void SetTargetFile(DiskFile *diskfile);
DiskFile* GetTargetFile(void) const;
Expand Down

0 comments on commit e75b248

Please sign in to comment.