Changeset 73097 in vbox for trunk/src/VBox/Storage
- Timestamp:
- Jul 12, 2018 9:06:33 PM (6 years ago)
- Location:
- trunk/src/VBox/Storage
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/CUE.cpp
r72455 r73097 276 276 { 277 277 PVDREGIONLIST pRegionListNew = (PVDREGIONLIST)RTMemRealloc(pThis->pRegionList, 278 RT_UOFFSETOF (VDREGIONLIST, aRegions[cTracksMax]));278 RT_UOFFSETOF_DYN(VDREGIONLIST, aRegions[cTracksMax])); 279 279 if (pRegionListNew) 280 280 { -
trunk/src/VBox/Storage/ISCSI.cpp
r69500 r73097 2772 2772 */ 2773 2773 size_t cI2TSegs = 2*(pScsiReq->cI2TSegs + 1); 2774 pIScsiPDU = (PISCSIPDUTX)RTMemAllocZ(RT_ OFFSETOF(ISCSIPDUTX, aISCSIReq[cI2TSegs]));2774 pIScsiPDU = (PISCSIPDUTX)RTMemAllocZ(RT_UOFFSETOF_DYN(ISCSIPDUTX, aISCSIReq[cI2TSegs])); 2775 2775 if (!pIScsiPDU) 2776 2776 return VERR_NO_MEMORY; … … 4836 4836 Assert(cbSegs == cbToRead); 4837 4837 4838 PSCSIREQ pReq = (PSCSIREQ)RTMemAllocZ(RT_ OFFSETOF(SCSIREQ, aSegs[cT2ISegs]));4838 PSCSIREQ pReq = (PSCSIREQ)RTMemAllocZ(RT_UOFFSETOF_DYN(SCSIREQ, aSegs[cT2ISegs])); 4839 4839 if (RT_LIKELY(pReq)) 4840 4840 { … … 4963 4963 Assert(cbSegs == cbToWrite); 4964 4964 4965 PSCSIREQ pReq = (PSCSIREQ)RTMemAllocZ(RT_ OFFSETOF(SCSIREQ, aSegs[cI2TSegs]));4965 PSCSIREQ pReq = (PSCSIREQ)RTMemAllocZ(RT_UOFFSETOF_DYN(SCSIREQ, aSegs[cI2TSegs])); 4966 4966 if (RT_LIKELY(pReq)) 4967 4967 { -
trunk/src/VBox/Storage/VD.cpp
r72054 r73097 544 544 { 545 545 int rc = VINF_SUCCESS; 546 PVDREGIONLIST pRegionListNew = (PVDREGIONLIST)RTMemDup(pRegionList, RT_UOFFSETOF(VDREGIONLIST, aRegions[pRegionList->cRegions])); 546 PVDREGIONLIST pRegionListNew = (PVDREGIONLIST)RTMemDup(pRegionList, 547 RT_UOFFSETOF_DYN(VDREGIONLIST, aRegions[pRegionList->cRegions])); 547 548 if (RT_LIKELY(pRegionListNew)) 548 549 { … … 1186 1187 DECLINLINE(PVDMETAXFER) vdMetaXferAlloc(PVDIOSTORAGE pIoStorage, uint64_t uOffset, size_t cb) 1187 1188 { 1188 PVDMETAXFER pMetaXfer = (PVDMETAXFER)RTMemAlloc(RT_ OFFSETOF(VDMETAXFER, abData[cb]));1189 PVDMETAXFER pMetaXfer = (PVDMETAXFER)RTMemAlloc(RT_UOFFSETOF_DYN(VDMETAXFER, abData[cb])); 1189 1190 1190 1191 if (RT_LIKELY(pMetaXfer)) -
trunk/src/VBox/Storage/VDIfVfs.cpp
r69977 r73097 357 357 { /* ObjSet */ 358 358 RTVFSOBJSETOPS_VERSION, 359 RT_ OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),359 RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj), 360 360 vdIfVfsFile_SetMode, 361 361 vdIfVfsFile_SetTimes, -
trunk/src/VBox/Storage/VDVfs.cpp
r73061 r73097 548 548 { /* ObjSet */ 549 549 RTVFSOBJSETOPS_VERSION, 550 RT_ OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),550 RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj), 551 551 vdVfsFile_SetMode, 552 552 vdVfsFile_SetTimes, -
trunk/src/VBox/Storage/VHD.cpp
r72577 r73097 1674 1674 } 1675 1675 1676 PVHDIMAGEEXPAND pExpand = (PVHDIMAGEEXPAND)RTMemAllocZ(RT_OFFSETOF(VHDIMAGEEXPAND, au8Bitmap[pImage->cDataBlockBitmapSectors * VHD_SECTOR_SIZE])); 1676 PVHDIMAGEEXPAND pExpand; 1677 pExpand = (PVHDIMAGEEXPAND)RTMemAllocZ(RT_UOFFSETOF_DYN(VHDIMAGEEXPAND, 1678 au8Bitmap[pImage->cDataBlockBitmapSectors * VHD_SECTOR_SIZE])); 1677 1679 bool fIoInProgress = false; 1678 1680 -
trunk/src/VBox/Storage/VMDK.cpp
r70853 r73097 666 666 cbBuf--; 667 667 cbInjected = 1; 668 pInflateState->iOffset = RT_ OFFSETOF(VMDKMARKER, uType);668 pInflateState->iOffset = RT_UOFFSETOF(VMDKMARKER, uType); 669 669 } 670 670 if (!cbBuf) … … 704 704 { 705 705 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 706 uOffset, pMarker, RT_ OFFSETOF(VMDKMARKER, uType));706 uOffset, pMarker, RT_UOFFSETOF(VMDKMARKER, uType)); 707 707 if (RT_FAILURE(rc)) 708 708 return rc; … … 710 710 else 711 711 { 712 memcpy(pMarker, pcvMarker, RT_ OFFSETOF(VMDKMARKER, uType));712 memcpy(pMarker, pcvMarker, RT_UOFFSETOF(VMDKMARKER, uType)); 713 713 /* pcvMarker endianness has already been partially transformed, fix it */ 714 714 pMarker->uSector = RT_H2LE_U64(pMarker->uSector); … … 730 730 /* Compressed grain marker. Data follows immediately. */ 731 731 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 732 uOffset + RT_ OFFSETOF(VMDKMARKER, uType),732 uOffset + RT_UOFFSETOF(VMDKMARKER, uType), 733 733 (uint8_t *)pExtent->pvCompGrain 734 + RT_ OFFSETOF(VMDKMARKER, uType),734 + RT_UOFFSETOF(VMDKMARKER, uType), 735 735 RT_ALIGN_Z( cbCompSize 736 + RT_ OFFSETOF(VMDKMARKER, uType),736 + RT_UOFFSETOF(VMDKMARKER, uType), 737 737 512) 738 - RT_ OFFSETOF(VMDKMARKER, uType));738 - RT_UOFFSETOF(VMDKMARKER, uType)); 739 739 740 740 if (puLBA) … … 742 742 if (pcbMarkerData) 743 743 *pcbMarkerData = RT_ALIGN( cbCompSize 744 + RT_ OFFSETOF(VMDKMARKER, uType),744 + RT_UOFFSETOF(VMDKMARKER, uType), 745 745 512); 746 746 747 747 #ifdef VMDK_USE_BLOCK_DECOMP_API 748 748 rc = RTZipBlockDecompress(RTZIPTYPE_ZLIB, 0 /*fFlags*/, 749 pExtent->pvCompGrain, cbCompSize + RT_ OFFSETOF(VMDKMARKER, uType), NULL,749 pExtent->pvCompGrain, cbCompSize + RT_UOFFSETOF(VMDKMARKER, uType), NULL, 750 750 pvBuf, cbToRead, &cbActuallyRead); 751 751 #else … … 753 753 InflateState.pImage = pImage; 754 754 InflateState.iOffset = -1; 755 InflateState.cbCompGrain = cbCompSize + RT_ OFFSETOF(VMDKMARKER, uType);755 InflateState.cbCompGrain = cbCompSize + RT_UOFFSETOF(VMDKMARKER, uType); 756 756 InflateState.pvCompGrain = pExtent->pvCompGrain; 757 757 … … 782 782 pvBuf = (const uint8_t *)pvBuf + 1; 783 783 cbBuf--; 784 pDeflateState->iOffset = RT_ OFFSETOF(VMDKMARKER, uType);784 pDeflateState->iOffset = RT_UOFFSETOF(VMDKMARKER, uType); 785 785 } 786 786 if (!cbBuf) … … 842 842 pMarker->uSector = RT_H2LE_U64(uLBA); 843 843 pMarker->cbSize = RT_H2LE_U32( DeflateState.iOffset 844 - RT_ OFFSETOF(VMDKMARKER, uType));844 - RT_UOFFSETOF(VMDKMARKER, uType)); 845 845 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 846 846 uOffset, pMarker, uSize); … … 2606 2606 Header.magicNumber = RT_H2LE_U32(VMDK_SPARSE_MAGICNUMBER); 2607 2607 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 2608 RT_ OFFSETOF(SparseExtentHeader, version),2608 RT_UOFFSETOF(SparseExtentHeader, version), 2609 2609 &Header.version, 2610 2610 sizeof(Header) 2611 - RT_ OFFSETOF(SparseExtentHeader, version));2611 - RT_UOFFSETOF(SparseExtentHeader, version)); 2612 2612 } 2613 2613 … … 3039 3039 */ 3040 3040 uint64_t u64DescSizeNew = RT_H2LE_U64(pExtent->cDescriptorSectors); 3041 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pFile->pStorage, RT_OFFSETOF(SparseExtentHeader, descriptorSize), 3041 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pFile->pStorage, 3042 RT_UOFFSETOF(SparseExtentHeader, descriptorSize), 3042 3043 &u64DescSizeNew, sizeof(u64DescSizeNew)); 3043 3044 if (RT_FAILURE(rc)) … … 5039 5040 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 5040 5041 VMDK_SECTOR2BYTE(uGrainSectorAbs), 5041 &Marker, RT_ OFFSETOF(VMDKMARKER, uType));5042 &Marker, RT_UOFFSETOF(VMDKMARKER, uType)); 5042 5043 if (RT_FAILURE(rc)) 5043 5044 return rc; … … 5050 5051 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 5051 5052 VMDK_SECTOR2BYTE(uGrainSectorAbs) 5052 + RT_ OFFSETOF(VMDKMARKER, uType),5053 + RT_UOFFSETOF(VMDKMARKER, uType), 5053 5054 &Marker.uType, sizeof(Marker.uType)); 5054 5055 if (RT_FAILURE(rc)) … … 5097 5098 if (uSector > Marker.uSector + pExtent->cSectorsPerGrain) 5098 5099 { 5099 uGrainSectorAbs += VMDK_BYTE2SECTOR(RT_ALIGN(Marker.cbSize + RT_ OFFSETOF(VMDKMARKER, uType), 512));5100 uGrainSectorAbs += VMDK_BYTE2SECTOR(RT_ALIGN(Marker.cbSize + RT_UOFFSETOF(VMDKMARKER, uType), 512)); 5100 5101 continue; 5101 5102 } -
trunk/src/VBox/Storage/testcase/VDIoBackendMem.cpp
r69500 r73097 156 156 RTSgBufSegArrayCreate(pSgBuf, NULL, &cSegs, cbTransfer); 157 157 158 pReq = (PVDIOBACKENDREQ)RTMemAlloc(RT_ OFFSETOF(VDIOBACKENDREQ, aSegs[cSegs]));158 pReq = (PVDIOBACKENDREQ)RTMemAlloc(RT_UOFFSETOF_DYN(VDIOBACKENDREQ, aSegs[cSegs])); 159 159 if (!pReq) 160 160 return VERR_NO_MEMORY; -
trunk/src/VBox/Storage/testcase/VDScript.cpp
r69500 r73097 2950 2950 } 2951 2951 2952 pFn = (PVDSCRIPTFN)RTMemAllocZ(RT_ OFFSETOF(VDSCRIPTFN, aenmArgTypes[paCallbacks->cArgs]));2952 pFn = (PVDSCRIPTFN)RTMemAllocZ(RT_UOFFSETOF_DYN(VDSCRIPTFN, aenmArgTypes[paCallbacks->cArgs])); 2953 2953 if (!pFn) 2954 2954 { -
trunk/src/VBox/Storage/testcase/VDScriptAst.cpp
r69500 r73097 349 349 DECLHIDDEN(PVDSCRIPTASTIDE) vdScriptAstNodeIdeAlloc(size_t cchIde) 350 350 { 351 PVDSCRIPTASTIDE pAstNode = (PVDSCRIPTASTIDE)RTMemAllocZ(RT_ OFFSETOF(VDSCRIPTASTIDE, aszIde[cchIde + 1]));351 PVDSCRIPTASTIDE pAstNode = (PVDSCRIPTASTIDE)RTMemAllocZ(RT_UOFFSETOF_DYN(VDSCRIPTASTIDE, aszIde[cchIde + 1])); 352 352 if (pAstNode) 353 353 {
Note:
See TracChangeset
for help on using the changeset viewer.