////////////////////////////////////////////////////////////////////////// GetDataForReading //////////////////////////////////////////////////////////////////////////
| 425 | // GetDataForReading |
| 426 | /////////////////////////////////////////////////////////////////////////////// |
| 427 | int8* 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 |
nothing calls this directly
no test coverage detected