VhdHandler.cpp (p7zip_15.14.1_src_all) | : | VhdHandler.cpp (p7zip_16.02_src_all) | ||
---|---|---|---|---|
skipping to change at line 535 | skipping to change at line 535 | |||
AddErrorMessage(L"Can't find footer"); | AddErrorMessage(L"Can't find footer"); | |||
return S_OK; | return S_OK; | |||
} | } | |||
STDMETHODIMP CHandler::Read(void *data, UInt32 size, UInt32 *processedSize) | STDMETHODIMP CHandler::Read(void *data, UInt32 size, UInt32 *processedSize) | |||
{ | { | |||
if (processedSize) | if (processedSize) | |||
*processedSize = 0; | *processedSize = 0; | |||
if (_virtPos >= Footer.CurrentSize) | if (_virtPos >= Footer.CurrentSize) | |||
return S_OK; | return S_OK; | |||
UInt64 rem = Footer.CurrentSize - _virtPos; | { | |||
if (size > rem) | const UInt64 rem = Footer.CurrentSize - _virtPos; | |||
size = (UInt32)rem; | if (size > rem) | |||
size = (UInt32)rem; | ||||
} | ||||
if (size == 0) | if (size == 0) | |||
return S_OK; | return S_OK; | |||
UInt32 blockIndex = (UInt32)(_virtPos >> Dyn.BlockSizeLog); | UInt32 blockIndex = (UInt32)(_virtPos >> Dyn.BlockSizeLog); | |||
UInt32 blockSectIndex = Bat[blockIndex]; | UInt32 blockSectIndex = Bat[blockIndex]; | |||
UInt32 blockSize = (UInt32)1 << Dyn.BlockSizeLog; | UInt32 blockSize = (UInt32)1 << Dyn.BlockSizeLog; | |||
UInt32 offsetInBlock = (UInt32)_virtPos & (blockSize - 1); | UInt32 offsetInBlock = (UInt32)_virtPos & (blockSize - 1); | |||
size = MyMin(blockSize - offsetInBlock, size); | size = MyMin(blockSize - offsetInBlock, size); | |||
HRESULT res = S_OK; | HRESULT res = S_OK; | |||
if (blockSectIndex == kUnusedBlock) | if (blockSectIndex == kUnusedBlock) | |||
skipping to change at line 568 | skipping to change at line 570 | |||
{ | { | |||
UInt64 newPos = (UInt64)blockSectIndex << kSectorSize_Log; | UInt64 newPos = (UInt64)blockSectIndex << kSectorSize_Log; | |||
if (BitMapTag != blockIndex) | if (BitMapTag != blockIndex) | |||
{ | { | |||
RINOK(ReadPhy(newPos, BitMap, (UInt32)BitMap.Size())); | RINOK(ReadPhy(newPos, BitMap, (UInt32)BitMap.Size())); | |||
BitMapTag = blockIndex; | BitMapTag = blockIndex; | |||
} | } | |||
RINOK(ReadPhy(newPos + BitMap.Size() + offsetInBlock, data, size)); | RINOK(ReadPhy(newPos + BitMap.Size() + offsetInBlock, data, size)); | |||
for (UInt32 cur = 0; cur < size;) | for (UInt32 cur = 0; cur < size;) | |||
{ | { | |||
UInt32 rem = MyMin(0x200 - (offsetInBlock & 0x1FF), size - cur); | const UInt32 rem = MyMin(0x200 - (offsetInBlock & 0x1FF), size - cur); | |||
UInt32 bmi = offsetInBlock >> kSectorSize_Log; | UInt32 bmi = offsetInBlock >> kSectorSize_Log; | |||
if (((BitMap[bmi >> 3] >> (7 - (bmi & 7))) & 1) == 0) | if (((BitMap[bmi >> 3] >> (7 - (bmi & 7))) & 1) == 0) | |||
{ | { | |||
if (ParentStream) | if (ParentStream) | |||
{ | { | |||
RINOK(ParentStream->Seek(_virtPos + cur, STREAM_SEEK_SET, NULL)); | RINOK(ParentStream->Seek(_virtPos + cur, STREAM_SEEK_SET, NULL)); | |||
RINOK(ReadStream_FALSE(ParentStream, (Byte *)data + cur, rem)); | RINOK(ReadStream_FALSE(ParentStream, (Byte *)data + cur, rem)); | |||
} | } | |||
else | else | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 6 lines changed or added |