- Timestamp:
- May 23, 2020 5:32:19 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/VDI.cpp
r82968 r84475 2568 2568 { 2569 2569 unsigned cBlocksAllocated = getImageBlocksAllocated(&pImage->Header); /** < Blocks currently allocated, doesn't change during resize */ 2570 uint32_t cBlocksNew = cbSize / getImageBlockSize(&pImage->Header); /** < New number of blocks in the image after the resize */ 2571 if (cbSize % getImageBlockSize(&pImage->Header)) 2570 unsigned const cbBlock = RT_MAX(getImageBlockSize(&pImage->Header), 1); 2571 uint32_t cBlocksNew = cbSize / cbBlock; /** < New number of blocks in the image after the resize */ 2572 if (cbSize % cbBlock) 2572 2573 cBlocksNew++; 2573 2574 … … 2582 2583 /* Calculate how many sectors need to be relocated. */ 2583 2584 uint64_t cbOverlapping = offStartDataNew - pImage->offStartData; 2584 unsigned cBlocksReloc = cbOverlapping / getImageBlockSize(&pImage->Header);2585 if (cbOverlapping % getImageBlockSize(&pImage->Header))2585 unsigned cBlocksReloc = cbOverlapping / cbBlock; 2586 if (cbOverlapping % cbBlock) 2586 2587 cBlocksReloc++; 2587 2588 … … 2799 2800 if (IS_VDI_IMAGE_BLOCK_ALLOCATED(pImage->paBlocks[uBlock])) 2800 2801 { 2802 unsigned const cbBlock = RT_MAX(getImageBlockSize(&pImage->Header), 1); 2803 size_t const cbPreAllocated = offDiscard % cbBlock; 2804 size_t const cbPostAllocated = getImageBlockSize(&pImage->Header) - cbDiscard - cbPreAllocated; 2801 2805 uint8_t *pbBlockData; 2802 size_t cbPreAllocated, cbPostAllocated;2803 2804 cbPreAllocated = offDiscard % getImageBlockSize(&pImage->Header);2805 cbPostAllocated = getImageBlockSize(&pImage->Header) - cbDiscard - cbPreAllocated;2806 2806 2807 2807 /* Read the block data. */
Note:
See TracChangeset
for help on using the changeset viewer.