Load data from a verification packet
| 66 | |
| 67 | // Load data from a verification packet |
| 68 | void VerificationHashTable::Load(Par2RepairerSourceFile *sourcefile, u64 blocksize) |
| 69 | { |
| 70 | VerificationHashEntry *preventry = 0; |
| 71 | |
| 72 | // Get information from the sourcefile |
| 73 | VerificationPacket *verificationpacket = sourcefile->GetVerificationPacket(); |
| 74 | u32 blockcount = verificationpacket->BlockCount(); |
| 75 | |
| 76 | // Iterate through the data blocks for the source file and the verification |
| 77 | // entries in the verification packet. |
| 78 | std::vector<DataBlock>::iterator sourceblocks = sourcefile->SourceBlocks(); |
| 79 | const FILEVERIFICATIONENTRY *verificationentry = verificationpacket->VerificationEntry(0); |
| 80 | u32 blocknumber = 0; |
| 81 | |
| 82 | while (blocknumber<blockcount) |
| 83 | { |
| 84 | DataBlock &datablock = *sourceblocks; |
| 85 | |
| 86 | // Create a new VerificationHashEntry with the details for the current |
| 87 | // data block and verification entry. |
| 88 | VerificationHashEntry *entry = new VerificationHashEntry(sourcefile, |
| 89 | &datablock, |
| 90 | blocknumber == 0, |
| 91 | verificationentry); |
| 92 | |
| 93 | // Insert the entry in the hash table |
| 94 | entry->Insert(&hashtable[entry->Checksum() & hashmask]); |
| 95 | |
| 96 | // Make the previous entry point forwards to this one |
| 97 | if (preventry) |
| 98 | { |
| 99 | preventry->Next(entry); |
| 100 | } |
| 101 | preventry = entry; |
| 102 | |
| 103 | ++blocknumber; |
| 104 | ++sourceblocks; |
| 105 | ++verificationentry; |
| 106 | } |
| 107 | } |
nothing calls this directly
no test coverage detected