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

Method GetDataForWriting

src/db/blockrecordarray.cpp:460–488  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////// GetDataForWriting //////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

458// GetDataForWriting
459///////////////////////////////////////////////////////////////////////////////
460int8* cBlockRecordArray::GetDataForWriting(int index, int32& dataSize) //throw (eArchive)
461{
462 // make ourselves initialized, if we are not right now...
463 //
464 if (!Initialized())
465 {
466 InitForExistingBlock();
467 }
468
469 ASSERT(IsItemValid(index));
470 cBlockFile::Block* pBlock = mpBlockFile->GetBlock(mBlockNum);
471 tIndexArray& indexArray = util_GetIndexArray(pBlock);
472 pBlock->SetDirty();
473 //
474 // figure out the size of the block
475 //
476 dataSize = indexArray.maRecordIndex[index].GetOffset();
477 if (index != 0)
478 {
479 dataSize -= indexArray.maRecordIndex[index - 1].GetOffset();
480 }
481
482#ifdef _BLOCKFILE_DEBUG
483 AssertValid();
484 mpBlockFile->AssertValid();
485#endif
486
487 return (util_OffsetToAddr(pBlock, indexArray.maRecordIndex[index].GetOffset()));
488}
489
490
491///////////////////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected