MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / GetDataForReading

Method GetDataForReading

src/db/blockrecordarray.cpp:427–455  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////// GetDataForReading //////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

425// GetDataForReading
426///////////////////////////////////////////////////////////////////////////////
427int8* cBlockRecordArray::GetDataForReading(int index, int32& dataSize) //throw (eArchive)
428{
429 // make ourselves initialized, if we are not right now...
430 //
431 if (!Initialized())
432 {
433 InitForExistingBlock();
434 }
435
436 ASSERT(IsItemValid(index));
437 cBlockFile::Block* pBlock = mpBlockFile->GetBlock(mBlockNum);
438 tIndexArray& indexArray = util_GetIndexArray(pBlock);
439 //
440 // figure out the size of the block
441 //
442 dataSize = indexArray.maRecordIndex[index].GetOffset();
443 if (index != 0)
444 {
445 dataSize -= indexArray.maRecordIndex[index - 1].GetOffset();
446 }
447
448#ifdef _BLOCKFILE_DEBUG
449 AssertValid();
450 mpBlockFile->AssertValid();
451#endif
452
453
454 return (util_OffsetToAddr(pBlock, indexArray.maRecordIndex[index].GetOffset()));
455}
456
457///////////////////////////////////////////////////////////////////////////////
458// GetDataForWriting

Callers

nothing calls this directly

Calls 4

util_OffsetToAddrFunction · 0.85
GetOffsetMethod · 0.80
GetBlockMethod · 0.45
AssertValidMethod · 0.45

Tested by

no test coverage detected