Changeset 105100 in vbox for trunk/src/VBox/Runtime/common/vfs
- Timestamp:
- Jul 2, 2024 1:10:46 PM (8 months ago)
- svn:sync-xref-src-repo-rev:
- 163723
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/vfs/vfsmemory.cpp
r103005 r105100 709 709 710 710 PRTVFSMEMFILE pThis = (PRTVFSMEMFILE)pvThis; 711 if ( (fFlags & RTVFSFILE_SIZE_F_ACTION_MASK) == RTVFSFILE_SIZE_F_NORMAL 712 && (RTFOFF)cbFile >= pThis->Base.ObjInfo.cbObject) 713 { 714 /* Growing is just a matter of increasing the size of the object. */ 711 if ((fFlags & RTVFSFILE_SIZE_F_ACTION_MASK) == RTVFSFILE_SIZE_F_NORMAL) 712 { 713 if ((RTFOFF)cbFile < pThis->Base.ObjInfo.cbObject) 714 { 715 /* Remove any extent beyond the file size. */ 716 bool fHit; 717 PRTVFSMEMEXTENT pExtent = rtVfsMemFile_LocateExtent(pThis, cbFile, &fHit); 718 if ( fHit 719 && cbFile < (pExtent->off + pExtent->cb)) 720 { 721 /* Clear the data in this extent. */ 722 uint64_t cbRemaining = cbFile - pExtent->off; 723 memset(&pExtent->abData[cbRemaining], 0, pExtent->cb - cbRemaining); 724 pExtent = RTListGetNext(&pThis->ExtentHead, pExtent, RTVFSMEMEXTENT, Entry); 725 } 726 727 while (pExtent) 728 { 729 PRTVFSMEMEXTENT pFree = pExtent; 730 pExtent = RTListGetNext(&pThis->ExtentHead, pExtent, RTVFSMEMEXTENT, Entry); 731 732 RTListNodeRemove(&pFree->Entry); 733 RTMemFree(pFree); 734 } 735 736 pThis->pCurExt = NULL; 737 } 738 /* else: Growing is just a matter of increasing the size of the object. */ 739 715 740 pThis->Base.ObjInfo.cbObject = cbFile; 716 741 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.