Changeset 73097 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Jul 12, 2018 9:06:33 PM (6 years ago)
- Location:
- trunk/src/VBox/Runtime/common
- Files:
-
- 44 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/alloc/memtracker.cpp
r69971 r73097 402 402 if (RT_UNLIKELY(!pTag)) 403 403 { 404 pTag = (PRTMEMTRACKERTAG)RTMemAllocZVar(RT_ OFFSETOF(RTMEMTRACKERTAG, szTag[cchTag + 1]));404 pTag = (PRTMEMTRACKERTAG)RTMemAllocZVar(RT_UOFFSETOF_DYN(RTMEMTRACKERTAG, szTag[cchTag + 1])); 405 405 if (pTag) 406 406 { -
trunk/src/VBox/Runtime/common/asn1/asn1-basics.cpp
r69111 r73097 198 198 199 199 /* Make the allocation. */ 200 uint32_t cbAlloc = RT_ OFFSETOF(RTASN1MEMCONTENT, au64Content) + (uint32_t)cb;200 uint32_t cbAlloc = RT_UOFFSETOF(RTASN1MEMCONTENT, au64Content) + (uint32_t)cb; 201 201 PRTASN1MEMCONTENT pHdr; 202 202 int rc = pAllocator->pfnAlloc(pAllocator, &Allocation, (void **)&pHdr, cbAlloc); … … 234 234 * Case 1 - Initial allocation. 235 235 */ 236 uint32_t cbNeeded = RT_ OFFSETOF(RTASN1MEMCONTENT, au64Content) + (uint32_t)cb;236 uint32_t cbNeeded = RT_UOFFSETOF(RTASN1MEMCONTENT, au64Content) + (uint32_t)cb; 237 237 if (!(pAsn1Core->fFlags & RTASN1CORE_F_ALLOCATED_CONTENT)) 238 238 return RTAsn1ContentAllocZ(pAsn1Core, cb, pAllocator); -
trunk/src/VBox/Runtime/common/checksum/ipv4.cpp
r69111 r73097 663 663 * Validate all the header fields we're able to... 664 664 */ 665 if (cbDhcp < RT_ OFFSETOF(RTNETBOOTP, bp_op) + sizeof(pDhcp->bp_op))665 if (cbDhcp < RT_UOFFSETOF(RTNETBOOTP, bp_op) + sizeof(pDhcp->bp_op)) 666 666 return true; 667 667 if (RT_UNLIKELY( pDhcp->bp_op != RTNETBOOTP_OP_REQUEST … … 669 669 return false; 670 670 671 if (cbDhcp < RT_ OFFSETOF(RTNETBOOTP, bp_htype) + sizeof(pDhcp->bp_htype))671 if (cbDhcp < RT_UOFFSETOF(RTNETBOOTP, bp_htype) + sizeof(pDhcp->bp_htype)) 672 672 return true; 673 673 if (RT_UNLIKELY(pDhcp->bp_htype != RTNET_ARP_ETHER)) 674 674 return false; 675 675 676 if (cbDhcp < RT_ OFFSETOF(RTNETBOOTP, bp_hlen) + sizeof(pDhcp->bp_hlen))676 if (cbDhcp < RT_UOFFSETOF(RTNETBOOTP, bp_hlen) + sizeof(pDhcp->bp_hlen)) 677 677 return true; 678 678 if (RT_UNLIKELY(pDhcp->bp_hlen != sizeof(RTMAC))) 679 679 return false; 680 680 681 if (cbDhcp < RT_ OFFSETOF(RTNETBOOTP, bp_flags) + sizeof(pDhcp->bp_flags))681 if (cbDhcp < RT_UOFFSETOF(RTNETBOOTP, bp_flags) + sizeof(pDhcp->bp_flags)) 682 682 return true; 683 683 if (RT_UNLIKELY(RT_BE2H_U16(pDhcp->bp_flags) & ~(RTNET_DHCP_FLAGS_NO_BROADCAST))) … … 688 688 * (because that seems to be indicating that it's BOOTP and not DHCP). 689 689 */ 690 cbLeft = (ssize_t)cbDhcp - RT_ OFFSETOF(RTNETBOOTP, bp_vend.Dhcp.dhcp_cookie) + sizeof(pDhcp->bp_vend.Dhcp.dhcp_cookie);690 cbLeft = (ssize_t)cbDhcp - RT_UOFFSETOF(RTNETBOOTP, bp_vend.Dhcp.dhcp_cookie) + sizeof(pDhcp->bp_vend.Dhcp.dhcp_cookie); 691 691 if (cbLeft < 0) 692 692 return true; -
trunk/src/VBox/Runtime/common/checksum/manifest2.cpp
r73041 r73097 704 704 { 705 705 size_t const cbName = strlen(pszAttr) + 1; 706 pAttr = (PRTMANIFESTATTR)RTMemAllocVar(RT_UOFFSETOF (RTMANIFESTATTR, szName[cbName]));706 pAttr = (PRTMANIFESTATTR)RTMemAllocVar(RT_UOFFSETOF_DYN(RTMANIFESTATTR, szName[cbName])); 707 707 if (!pAttr) 708 708 { … … 1070 1070 if (rc == VERR_NOT_FOUND) 1071 1071 { 1072 pEntry = (PRTMANIFESTENTRY)RTMemAlloc(RT_UOFFSETOF (RTMANIFESTENTRY, szName[cchEntry + 1]));1072 pEntry = (PRTMANIFESTENTRY)RTMemAlloc(RT_UOFFSETOF_DYN(RTMANIFESTENTRY, szName[cchEntry + 1])); 1073 1073 if (!pEntry) 1074 1074 return VERR_NO_MEMORY; … … 1196 1196 if (rc == VERR_NOT_FOUND) 1197 1197 { 1198 pEntry = (PRTMANIFESTENTRY)RTMemAlloc(RT_UOFFSETOF (RTMANIFESTENTRY, szName[cchEntry + 1]));1198 pEntry = (PRTMANIFESTENTRY)RTMemAlloc(RT_UOFFSETOF_DYN(RTMANIFESTENTRY, szName[cchEntry + 1])); 1199 1199 if (pEntry) 1200 1200 { -
trunk/src/VBox/Runtime/common/crypto/digest-core.cpp
r69111 r73097 97 97 AssertReturn(pDesc->pfnNew || offHash, VERR_INVALID_PARAMETER); 98 98 AssertReturn(!pDesc->pfnNew || (pDesc->pfnFree && pDesc->pfnInit && pDesc->pfnClone), VERR_INVALID_PARAMETER); 99 PRTCRDIGESTINT pThis = (PRTCRDIGESTINT)RTMemAllocZ(RT_ OFFSETOF(RTCRDIGESTINT, abState[offHash + pDesc->cbHash]));99 PRTCRDIGESTINT pThis = (PRTCRDIGESTINT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTCRDIGESTINT, abState[offHash + pDesc->cbHash])); 100 100 if (pThis) 101 101 { … … 140 140 int rc = VINF_SUCCESS; 141 141 uint32_t const offHash = hSrc->offHash; 142 PRTCRDIGESTINT pThis = (PRTCRDIGESTINT)RTMemAllocZ(RT_ OFFSETOF(RTCRDIGESTINT, abState[offHash + hSrc->pDesc->cbHash]));142 PRTCRDIGESTINT pThis = (PRTCRDIGESTINT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTCRDIGESTINT, abState[offHash + hSrc->pDesc->cbHash])); 143 143 if (pThis) 144 144 { -
trunk/src/VBox/Runtime/common/crypto/pkix-signature-core.cpp
r69111 r73097 107 107 */ 108 108 int rc = VINF_SUCCESS; 109 PRTCRPKIXSIGNATUREINT pThis = (PRTCRPKIXSIGNATUREINT)RTMemAllocZ(RT_OFFSETOF(RTCRPKIXSIGNATUREINT, abState[pDesc->cbState])); 109 PRTCRPKIXSIGNATUREINT pThis = (PRTCRPKIXSIGNATUREINT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTCRPKIXSIGNATUREINT, 110 abState[pDesc->cbState])); 110 111 if (pThis) 111 112 { … … 160 161 pThis->pDesc->pfnDelete(pThis->pDesc, pThis->abState, pThis->fSigning); 161 162 162 size_t cbToWipe = RT_ OFFSETOF(RTCRPKIXSIGNATUREINT, abState[pThis->pDesc->cbState]);163 size_t cbToWipe = RT_UOFFSETOF_DYN(RTCRPKIXSIGNATUREINT, abState[pThis->pDesc->cbState]); 163 164 RTMemWipeThoroughly(pThis, cbToWipe, 6); 164 165 -
trunk/src/VBox/Runtime/common/crypto/store-inmem.cpp
r69111 r73097 120 120 { 121 121 int rc; 122 PRTCRSTOREINMEMCERT pEntry = (PRTCRSTOREINMEMCERT)RTMemAllocZ(RT_UOFFSETOF (RTCRSTOREINMEMCERT, abEncoded[cbSrc]));122 PRTCRSTOREINMEMCERT pEntry = (PRTCRSTOREINMEMCERT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTCRSTOREINMEMCERT, abEncoded[cbSrc])); 123 123 if (pEntry) 124 124 { -
trunk/src/VBox/Runtime/common/dbg/dbgas.cpp
r69111 r73097 198 198 */ 199 199 size_t cchName = strlen(pszName); 200 PRTDBGASINT pDbgAs = (PRTDBGASINT)RTMemAllocVar(RT_ OFFSETOF(RTDBGASINT, szName[cchName + 1]));200 PRTDBGASINT pDbgAs = (PRTDBGASINT)RTMemAllocVar(RT_UOFFSETOF_DYN(RTDBGASINT, szName[cchName + 1])); 201 201 if (!pDbgAs) 202 202 return VERR_NO_MEMORY; -
trunk/src/VBox/Runtime/common/dbg/dbgcfg.cpp
r72264 r73097 1955 1955 * We're adding a new one. 1956 1956 */ 1957 PRTDBGCFGSTR pNew = (PRTDBGCFGSTR)RTMemAlloc(RT_ OFFSETOF(RTDBGCFGSTR, sz[cchPath + 1]));1957 PRTDBGCFGSTR pNew = (PRTDBGCFGSTR)RTMemAlloc(RT_UOFFSETOF_DYN(RTDBGCFGSTR, sz[cchPath + 1])); 1958 1958 if (!pNew) 1959 1959 return VERR_NO_MEMORY; -
trunk/src/VBox/Runtime/common/dbg/dbgmod.cpp
r69111 r73097 1442 1442 PRTDBGMODDEFERRED pDeferred; 1443 1443 rc = rtDbgModDeferredCreate(pDbgMod, rtDbgModFromMachOImageDeferredCallback, cbImage, hDbgCfg, 1444 RT_ OFFSETOF(RTDBGMODDEFERRED, u.MachO.aSegs[cSegs]),1444 RT_UOFFSETOF_DYN(RTDBGMODDEFERRED, u.MachO.aSegs[cSegs]), 1445 1445 &pDeferred); 1446 1446 if (RT_SUCCESS(rc)) -
trunk/src/VBox/Runtime/common/dbg/dbgmodcodeview.cpp
r69111 r73097 1227 1227 cbSubSect, RT_UOFFSETOF(RTCVSRCFILE, aoffSrcLines), i, offSrcFile)); 1228 1228 PCRTCVSRCFILE pSrcFile = (PCRTCVSRCFILE)((uint8_t const *)pvSubSect + offSrcFile); 1229 size_t cbSrcFileHdr = RT_UOFFSETOF (RTCVSRCFILE, aoffSrcLines[pSrcFile->cSegs])1229 size_t cbSrcFileHdr = RT_UOFFSETOF_DYN(RTCVSRCFILE, aoffSrcLines[pSrcFile->cSegs]) 1230 1230 + sizeof(RTCVSRCRANGE) * pSrcFile->cSegs 1231 1231 + sizeof(uint8_t); … … 1251 1251 cbSubSect, RT_UOFFSETOF(RTCVSRCLINE, aoffLines), iSeg, offSrcLine)); 1252 1252 PCRTCVSRCLINE pSrcLine = (PCRTCVSRCLINE)((uint8_t const *)pvSubSect + offSrcLine); 1253 size_t cbSrcLine = RT_UOFFSETOF (RTCVSRCLINE, aoffLines[pSrcLine->cPairs])1253 size_t cbSrcLine = RT_UOFFSETOF_DYN(RTCVSRCLINE, aoffLines[pSrcLine->cPairs]) 1254 1254 + pSrcLine->cPairs * sizeof(uint16_t); 1255 1255 RTDBGMODCV_CHECK_RET_BF(cbSubSect >= offSrcLine + cbSrcLine, -
trunk/src/VBox/Runtime/common/dvm/dvmvfs.cpp
r69977 r73097 472 472 { /* ObjSet */ 473 473 RTVFSOBJSETOPS_VERSION, 474 RT_ OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),474 RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj), 475 475 rtDvmVfsFile_SetMode, 476 476 rtDvmVfsFile_SetTimes, … … 921 921 922 922 size_t cchVolName = strlen(pszVolName); 923 size_t cbNeeded = RT_ OFFSETOF(RTDIRENTRYEX, szName[cchVolName + 1]);923 size_t cbNeeded = RT_UOFFSETOF_DYN(RTDIRENTRYEX, szName[cchVolName + 1]); 924 924 if (cbNeeded <= *pcbDirEntry) 925 925 { … … 982 982 { /* ObjSet */ 983 983 RTVFSOBJSETOPS_VERSION, 984 RT_ OFFSETOF(RTVFSDIROPS, Obj) - RT_OFFSETOF(RTVFSDIROPS, ObjSet),984 RT_UOFFSETOF(RTVFSDIROPS, ObjSet) - RT_UOFFSETOF(RTVFSDIROPS, Obj), 985 985 rtDvmVfsDir_SetMode, 986 986 rtDvmVfsDir_SetTimes, -
trunk/src/VBox/Runtime/common/fs/RTFsCmdLs.cpp
r70422 r73097 782 782 { 783 783 default: AssertFailed(); RT_FALL_THRU(); 784 case RTCMDLSTIME_MTIME: offTime = RT_ OFFSETOF(RTCMDLSENTRY, Info.ModificationTime); break;785 case RTCMDLSTIME_BTIME: offTime = RT_ OFFSETOF(RTCMDLSENTRY, Info.BirthTime); break;786 case RTCMDLSTIME_CTIME: offTime = RT_ OFFSETOF(RTCMDLSENTRY, Info.ChangeTime); break;787 case RTCMDLSTIME_ATIME: offTime = RT_ OFFSETOF(RTCMDLSENTRY, Info.AccessTime); break;784 case RTCMDLSTIME_MTIME: offTime = RT_UOFFSETOF(RTCMDLSENTRY, Info.ModificationTime); break; 785 case RTCMDLSTIME_BTIME: offTime = RT_UOFFSETOF(RTCMDLSENTRY, Info.BirthTime); break; 786 case RTCMDLSTIME_CTIME: offTime = RT_UOFFSETOF(RTCMDLSENTRY, Info.ChangeTime); break; 787 case RTCMDLSTIME_ATIME: offTime = RT_UOFFSETOF(RTCMDLSENTRY, Info.AccessTime); break; 788 788 } 789 789 … … 1027 1027 && *pszName) 1028 1028 { 1029 PRTCMDLSCOLLECTION pCollection = (PRTCMDLSCOLLECTION)RTMemAllocZ(RT_ OFFSETOF(RTCMDLSCOLLECTION, szName[1]));1029 PRTCMDLSCOLLECTION pCollection = (PRTCMDLSCOLLECTION)RTMemAllocZ(RT_UOFFSETOF(RTCMDLSCOLLECTION, szName[1])); 1030 1030 if (!pCollection) 1031 1031 { … … 1040 1040 /* Add new collection. */ 1041 1041 size_t cbName = strlen(pszName) + 1; 1042 PRTCMDLSCOLLECTION pCollection = (PRTCMDLSCOLLECTION)RTMemAllocZ(RT_ OFFSETOF(RTCMDLSCOLLECTION, szName[cbName]));1042 PRTCMDLSCOLLECTION pCollection = (PRTCMDLSCOLLECTION)RTMemAllocZ(RT_UOFFSETOF_DYN(RTCMDLSCOLLECTION, szName[cbName])); 1043 1043 if (pCollection) 1044 1044 { … … 1083 1083 size_t const cbGroup = pszGroup ? strlen(pszGroup) + 1 : 0; 1084 1084 size_t const cbTarget = pszTarget ? strlen(pszTarget) + 1 : 0; 1085 size_t const cbEntry = RT_ OFFSETOF(RTCMDLSENTRY, szName[cchEntry + 1 + cbOwner + cbGroup + cbTarget]);1085 size_t const cbEntry = RT_UOFFSETOF_DYN(RTCMDLSENTRY, szName[cchEntry + 1 + cbOwner + cbGroup + cbTarget]); 1086 1086 PRTCMDLSENTRY pEntry = (PRTCMDLSENTRY)RTMemAlloc(cbEntry); 1087 1087 if (pEntry) -
trunk/src/VBox/Runtime/common/fs/ext2vfs.cpp
r69861 r73097 99 99 if (!pBlkGrpDesc) 100 100 { 101 size_t cbBlkDesc = RT_ OFFSETOF(RTFILESYSTEMEXTBLKGRP, abBlockBitmap[cbBlockBitmap]);101 size_t cbBlkDesc = RT_UOFFSETOF_DYN(RTFILESYSTEMEXTBLKGRP, abBlockBitmap[cbBlockBitmap]); 102 102 pBlkGrpDesc = (PRTFILESYSTEMEXTBLKGRP)RTMemAllocZ(cbBlkDesc); 103 103 if (!pBlkGrpDesc) -
trunk/src/VBox/Runtime/common/fs/fatvfs.cpp
r72584 r73097 824 824 */ 825 825 PRTFSFATCLUSTERMAPCACHE pFatCache; 826 pThis->pFatCache = pFatCache = (PRTFSFATCLUSTERMAPCACHE)RTMemAllocZ(RT_OFFSETOF(RTFSFATCLUSTERMAPCACHE, aEntries[cEntries])); 826 pFatCache = (PRTFSFATCLUSTERMAPCACHE)RTMemAllocZ(RT_UOFFSETOF_DYN(RTFSFATCLUSTERMAPCACHE, aEntries[cEntries])); 827 pThis->pFatCache = pFatCache; 827 828 if (!pFatCache) 828 829 return RTErrInfoSet(pErrInfo, VERR_NO_MEMORY, "Failed to allocate FAT cache"); … … 2571 2572 { /* ObjSet */ 2572 2573 RTVFSOBJSETOPS_VERSION, 2573 RT_ OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),2574 RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj), 2574 2575 rtFsFatFile_SetMode, 2575 2576 rtFsFatFile_SetTimes, … … 4412 4413 if (pThis->offDir < 2) 4413 4414 { 4414 size_t cbNeeded = RT_ OFFSETOF(RTDIRENTRYEX, szName[pThis->offDir + 2]);4415 size_t cbNeeded = RT_UOFFSETOF_DYN(RTDIRENTRYEX, szName[pThis->offDir + 2]); 4415 4416 if (cbNeeded < *pcbDirEntry) 4416 4417 *pcbDirEntry = cbNeeded; … … 4554 4555 if (!fLongName) 4555 4556 cchName = rtFsFatDir_CalcUtf8LengthForDirEntry(pShared, &paEntries[iEntry].Entry); 4556 size_t cbNeeded = RT_ OFFSETOF(RTDIRENTRYEX, szName[cchName + 1]);4557 size_t cbNeeded = RT_UOFFSETOF_DYN(RTDIRENTRYEX, szName[cchName + 1]); 4557 4558 if (cbNeeded <= *pcbDirEntry) 4558 4559 *pcbDirEntry = cbNeeded; … … 4626 4627 { /* ObjSet */ 4627 4628 RTVFSOBJSETOPS_VERSION, 4628 RT_ OFFSETOF(RTVFSDIROPS, Obj) - RT_OFFSETOF(RTVFSDIROPS, ObjSet),4629 RT_UOFFSETOF(RTVFSDIROPS, ObjSet) - RT_UOFFSETOF(RTVFSDIROPS, Obj), 4629 4630 rtFsFatDir_SetMode, 4630 4631 rtFsFatDir_SetTimes, … … 5031 5032 Assert(offFirstZero >= RT_UOFFSETOF(FATBOOTSECTOR, Bpb)); 5032 5033 uint32_t const cbZeroPad = RT_MIN(offJump - offFirstZero, 5033 sizeof(pBootSector->Bpb.Bpb20) - (offFirstZero - RT_ OFFSETOF(FATBOOTSECTOR, Bpb)));5034 sizeof(pBootSector->Bpb.Bpb20) - (offFirstZero - RT_UOFFSETOF(FATBOOTSECTOR, Bpb))); 5034 5035 5035 5036 if (!ASMMemIsAllU8((uint8_t const *)pBootSector + offFirstZero, cbZeroPad, 0)) … … 5387 5388 && pBootSector->abJmp[2] <= 0x7f) 5388 5389 offJmp = RT_MIN(127, RT_MAKE_U16(pBootSector->abJmp[1], pBootSector->abJmp[2])); 5389 uint8_t const cbMaxBpb = offJmp - RT_ OFFSETOF(FATBOOTSECTOR, Bpb);5390 uint8_t const cbMaxBpb = offJmp - RT_UOFFSETOF(FATBOOTSECTOR, Bpb); 5390 5391 5391 5392 /* … … 5444 5445 if ( ( sizeof(FAT32EBPB) <= cbMaxBpb 5445 5446 && pBootSector->Bpb.Fat32Ebpb.bExtSignature == FATEBPB_SIGNATURE) 5446 || ( RT_ OFFSETOF(FAT32EBPB, achLabel) <= cbMaxBpb5447 || ( RT_UOFFSETOF(FAT32EBPB, achLabel) <= cbMaxBpb 5447 5448 && pBootSector->Bpb.Fat32Ebpb.bExtSignature == FATEBPB_SIGNATURE_OLD) ) 5448 5449 { … … 5460 5461 if ( ( sizeof(FATEBPB) <= cbMaxBpb 5461 5462 && pBootSector->Bpb.Ebpb.bExtSignature == FATEBPB_SIGNATURE) 5462 || ( RT_ OFFSETOF(FATEBPB, achLabel) <= cbMaxBpb5463 || ( RT_UOFFSETOF(FATEBPB, achLabel) <= cbMaxBpb 5463 5464 && pBootSector->Bpb.Ebpb.bExtSignature == FATEBPB_SIGNATURE_OLD) ) 5464 5465 { -
trunk/src/VBox/Runtime/common/fs/isomaker.cpp
r70155 r73097 99 99 * is the case in rtFsIsoMakerNormalizeNameForNamespace. */ 100 100 #define RTFSISOMAKER_CALC_PATHREC_SIZE(a_cbNameInDirRec) \ 101 ( RT_UOFFSETOF (ISO9660PATHREC, achDirId[(a_cbNameInDirRec) + ((a_cbNameInDirRec) & 1)]) )101 ( RT_UOFFSETOF_DYN(ISO9660PATHREC, achDirId[(a_cbNameInDirRec) + ((a_cbNameInDirRec) & 1)]) ) 102 102 103 103 … … 660 660 } g_aRTFsIsoNamespaces[] = 661 661 { 662 { RTFSISOMAKER_NAMESPACE_ISO_9660, RT_ OFFSETOF(RTFSISOMAKERINT, PrimaryIso), RT_OFFSETOF(RTFSISOMAKEROBJ, pPrimaryName), "iso-9660" },663 { RTFSISOMAKER_NAMESPACE_JOLIET, RT_ OFFSETOF(RTFSISOMAKERINT, Joliet), RT_OFFSETOF(RTFSISOMAKEROBJ, pJolietName), "joliet" },664 { RTFSISOMAKER_NAMESPACE_UDF, RT_ OFFSETOF(RTFSISOMAKERINT, Udf), RT_OFFSETOF(RTFSISOMAKEROBJ, pUdfName), "udf" },665 { RTFSISOMAKER_NAMESPACE_HFS, RT_ OFFSETOF(RTFSISOMAKERINT, Hfs), RT_OFFSETOF(RTFSISOMAKEROBJ, pHfsName), "hfs" },662 { RTFSISOMAKER_NAMESPACE_ISO_9660, RT_UOFFSETOF(RTFSISOMAKERINT, PrimaryIso), RT_UOFFSETOF(RTFSISOMAKEROBJ, pPrimaryName), "iso-9660" }, 663 { RTFSISOMAKER_NAMESPACE_JOLIET, RT_UOFFSETOF(RTFSISOMAKERINT, Joliet), RT_UOFFSETOF(RTFSISOMAKEROBJ, pJolietName), "joliet" }, 664 { RTFSISOMAKER_NAMESPACE_UDF, RT_UOFFSETOF(RTFSISOMAKERINT, Udf), RT_UOFFSETOF(RTFSISOMAKEROBJ, pUdfName), "udf" }, 665 { RTFSISOMAKER_NAMESPACE_HFS, RT_UOFFSETOF(RTFSISOMAKERINT, Hfs), RT_UOFFSETOF(RTFSISOMAKEROBJ, pHfsName), "hfs" }, 666 666 }; 667 667 … … 3611 3611 * Do the adding. 3612 3612 */ 3613 PRTFSISOMAKERSYMLINK pSymlink = (PRTFSISOMAKERSYMLINK)RTMemAllocZ(RT_UOFFSETOF (RTFSISOMAKERSYMLINK, szTarget[cchTarget + 1]));3613 PRTFSISOMAKERSYMLINK pSymlink = (PRTFSISOMAKERSYMLINK)RTMemAllocZ(RT_UOFFSETOF_DYN(RTFSISOMAKERSYMLINK, szTarget[cchTarget + 1])); 3614 3614 AssertReturn(pSymlink, VERR_NO_MEMORY); 3615 3615 int rc = rtFsIsoMakerInitCommonObj(pThis, &pSymlink->Core, RTFSISOMAKEROBJTYPE_SYMLINK, pObjInfo); … … 5882 5882 size_t cchThis = RT_MIN(cchSrc, ISO9660RRIPNM_MAX_NAME_LEN); 5883 5883 PISO9660RRIPNM pNM = (PISO9660RRIPNM)pbSys; 5884 Assert(cbSys >= RT_UOFFSETOF (ISO9660RRIPNM, achName[cchThis]));5884 Assert(cbSys >= RT_UOFFSETOF_DYN(ISO9660RRIPNM, achName[cchThis])); 5885 5885 pNM->Hdr.bSig1 = ISO9660RRIPNM_SIG1; 5886 5886 pNM->Hdr.bSig2 = ISO9660RRIPNM_SIG2; … … 7379 7379 { /* ObjSet */ 7380 7380 RTVFSOBJSETOPS_VERSION, 7381 RT_ OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),7381 RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj), 7382 7382 NULL /*SetMode*/, 7383 7383 NULL /*SetTimes*/, -
trunk/src/VBox/Runtime/common/fs/isomakerimport.cpp
r71013 r73097 732 732 || pUnion->SP.bCheck1 != ISO9660SUSPSP_CHECK1 733 733 || pUnion->SP.bCheck2 != ISO9660SUSPSP_CHECK2 734 || pUnion->SP.cbSkip > UINT8_MAX - RT_ OFFSETOF(ISO9660DIRREC, achFileId[1]))734 || pUnion->SP.cbSkip > UINT8_MAX - RT_UOFFSETOF(ISO9660DIRREC, achFileId[1])) 735 735 LogRel(("rtFsIsoImport/Rock: Malformed 'SP' entry: cbEntry=%#x (vs %#x), bVersion=%#x (vs %#x), bCheck1=%#x (vs %#x), bCheck2=%#x (vs %#x), cbSkip=%#x (vs max %#x)\n", 736 736 pUnion->Hdr.cbEntry, ISO9660SUSPSP_LEN, pUnion->Hdr.bVersion, ISO9660SUSPSP_VER, 737 737 pUnion->SP.bCheck1, ISO9660SUSPSP_CHECK1, pUnion->SP.bCheck2, ISO9660SUSPSP_CHECK2, 738 pUnion->SP.cbSkip, UINT8_MAX - RT_ OFFSETOF(ISO9660DIRREC, achFileId[1]) ));738 pUnion->SP.cbSkip, UINT8_MAX - RT_UOFFSETOF(ISO9660DIRREC, achFileId[1]) )); 739 739 else if (!fIsFirstDirRec) 740 740 LogRel(("rtFsIsoImport/Rock: Ignorining 'SP' entry in non-root directory record\n")); … … 750 750 751 751 case MAKE_SIG(ISO9660SUSPER_SIG1, ISO9660SUSPER_SIG2): /* ER */ 752 if ( pUnion->Hdr.cbEntry > RT_ OFFSETOF(ISO9660SUSPER, achPayload) + (uint32_t)pUnion->ER.cchIdentifier752 if ( pUnion->Hdr.cbEntry > RT_UOFFSETOF(ISO9660SUSPER, achPayload) + (uint32_t)pUnion->ER.cchIdentifier 753 753 + (uint32_t)pUnion->ER.cchDescription + (uint32_t)pUnion->ER.cchSource 754 754 || pUnion->Hdr.bVersion != ISO9660SUSPER_VER) … … 914 914 case MAKE_SIG(ISO9660RRIPSL_SIG1, ISO9660RRIPSL_SIG2): /* SL */ 915 915 if ( pUnion->SL.Hdr.bVersion != ISO9660RRIPSL_VER 916 || pUnion->SL.Hdr.cbEntry < RT_ OFFSETOF(ISO9660RRIPSL, abComponents[2])916 || pUnion->SL.Hdr.cbEntry < RT_UOFFSETOF(ISO9660RRIPSL, abComponents[2]) 917 917 || (pUnion->SL.fFlags & ~ISO9660RRIP_SL_F_CONTINUE) 918 918 || (pUnion->SL.abComponents[0] & ISO9660RRIP_SL_C_RESERVED_MASK) ) 919 919 LogRel(("rtFsIsoImport/Rock: Malformed 'SL' entry: cbEntry=%#x (vs %#x), bVersion=%#x (vs %#x) fFlags=%#x comp[0].fFlags=%#x\n", 920 pUnion->SL.Hdr.cbEntry, RT_ OFFSETOF(ISO9660RRIPSL, abComponents[2]),920 pUnion->SL.Hdr.cbEntry, RT_UOFFSETOF(ISO9660RRIPSL, abComponents[2]), 921 921 pUnion->SL.Hdr.bVersion, ISO9660RRIPSL_VER, pUnion->SL.fFlags, pUnion->SL.abComponents[0])); 922 922 else if (pThis->fSeenLastSL) … … 928 928 size_t offDst = strlen(pThis->szRockSymlinkTargetBuf); 929 929 uint8_t const *pbSrc = &pUnion->SL.abComponents[0]; 930 uint8_t cbSrcLeft = pUnion->SL.Hdr.cbEntry - RT_ OFFSETOF(ISO9660RRIPSL, abComponents);930 uint8_t cbSrcLeft = pUnion->SL.Hdr.cbEntry - RT_UOFFSETOF(ISO9660RRIPSL, abComponents); 931 931 while (cbSrcLeft >= 2) 932 932 { … … 1019 1019 case MAKE_SIG(ISO9660RRIPNM_SIG1, ISO9660RRIPNM_SIG2): /* NM */ 1020 1020 if ( pUnion->NM.Hdr.bVersion != ISO9660RRIPNM_VER 1021 || pUnion->NM.Hdr.cbEntry < RT_ OFFSETOF(ISO9660RRIPNM, achName)1021 || pUnion->NM.Hdr.cbEntry < RT_UOFFSETOF(ISO9660RRIPNM, achName) 1022 1022 || (pUnion->NM.fFlags & ISO9660RRIP_NM_F_RESERVED_MASK) ) 1023 1023 LogRel(("rtFsIsoImport/Rock: Malformed 'NM' entry: cbEntry=%#x (vs %#x), bVersion=%#x (vs %#x) fFlags=%#x %.*Rhxs\n", 1024 pUnion->NM.Hdr.cbEntry, RT_ OFFSETOF(ISO9660RRIPNM, achName),1024 pUnion->NM.Hdr.cbEntry, RT_UOFFSETOF(ISO9660RRIPNM, achName), 1025 1025 pUnion->NM.Hdr.bVersion, ISO9660RRIPNM_VER, pUnion->NM.fFlags, 1026 pUnion->NM.Hdr.cbEntry - RT_MIN(pUnion->NM.Hdr.cbEntry, RT_ OFFSETOF(ISO9660RRIPNM, achName)),1026 pUnion->NM.Hdr.cbEntry - RT_MIN(pUnion->NM.Hdr.cbEntry, RT_UOFFSETOF(ISO9660RRIPNM, achName)), 1027 1027 &pUnion->NM.achName[0] )); 1028 1028 else if (pThis->fSeenLastNM) … … 1032 1032 pThis->fSeenLastNM = !(pUnion->NM.fFlags & ISO9660RRIP_NM_F_CONTINUE); 1033 1033 1034 uint8_t const cchName = pUnion->NM.Hdr.cbEntry - (uint8_t)RT_ OFFSETOF(ISO9660RRIPNM, achName);1034 uint8_t const cchName = pUnion->NM.Hdr.cbEntry - (uint8_t)RT_UOFFSETOF(ISO9660RRIPNM, achName); 1035 1035 if (pUnion->NM.fFlags & (ISO9660RRIP_NM_F_CURRENT | ISO9660RRIP_NM_F_PARENT)) 1036 1036 { … … 1163 1163 ISO9660_GET_ENDIAN(&pDirRec->offExtent), pThis->cBlocksInPrimaryVolumeSpace); 1164 1164 1165 if (pDirRec->cbDirRec < RT_ OFFSETOF(ISO9660DIRREC, achFileId) + pDirRec->bFileIdLength)1165 if (pDirRec->cbDirRec < RT_UOFFSETOF(ISO9660DIRREC, achFileId) + pDirRec->bFileIdLength) 1166 1166 return rtFsIsoImpError(pThis, VERR_ISOMK_IMPORT_BAD_DIR_REC_LENGTH, 1167 1167 "Dir record size is too small: %#x (min %#x)", 1168 pDirRec->cbDirRec, RT_ OFFSETOF(ISO9660DIRREC, achFileId) + pDirRec->bFileIdLength);1168 pDirRec->cbDirRec, RT_UOFFSETOF(ISO9660DIRREC, achFileId) + pDirRec->bFileIdLength); 1169 1169 if (pDirRec->cbDirRec > cbMax) 1170 1170 return rtFsIsoImpError(pThis, VERR_ISOMK_IMPORT_BAD_DIR_REC_LENGTH, … … 1830 1830 ISO9660_GET_ENDIAN(&pDirRec->offExtent), pThis->cBlocksInPrimaryVolumeSpace); 1831 1831 1832 if (pDirRec->cbDirRec < RT_ OFFSETOF(ISO9660DIRREC, achFileId))1832 if (pDirRec->cbDirRec < RT_UOFFSETOF(ISO9660DIRREC, achFileId)) 1833 1833 return rtFsIsoImpError(pThis, VERR_ISOMK_IMPORT_BAD_ROOT_DIR_REC_LENGTH, 1834 1834 "Root dir record size is too small: %#x (min %#x)", 1835 pDirRec->cbDirRec, RT_ OFFSETOF(ISO9660DIRREC, achFileId));1835 pDirRec->cbDirRec, RT_UOFFSETOF(ISO9660DIRREC, achFileId)); 1836 1836 1837 1837 if (!(pDirRec->fFileFlags & ISO9660_FILE_FLAGS_DIRECTORY)) -
trunk/src/VBox/Runtime/common/fs/isovfs.cpp
r69977 r73097 1229 1229 * Basic sanity checking of what we use. 1230 1230 */ 1231 if ( RT_ OFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs + pFileEntry->cbAllocDescs1231 if ( RT_UOFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs + pFileEntry->cbAllocDescs 1232 1232 > pVol->Udf.VolInfo.cbBlock 1233 1233 || (pFileEntry->cbExtAttribs & 3) != 0 … … 1275 1275 idxDefaultPart, 1276 1276 ((uint64_t)pFileEntry->Tag.offTag << pVol->Udf.VolInfo.cShiftBlock) 1277 + RT_ OFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs,1277 + RT_UOFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs, 1278 1278 pVol); 1279 1279 if (RT_SUCCESS(rc)) … … 1381 1381 * Basic sanity checking of what we use. 1382 1382 */ 1383 if ( RT_ OFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs + pFileEntry->cbAllocDescs1383 if ( RT_UOFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs + pFileEntry->cbAllocDescs 1384 1384 > pVol->Udf.VolInfo.cbBlock 1385 1385 || (pFileEntry->cbExtAttribs & 3) != 0 … … 1431 1431 idxDefaultPart, 1432 1432 ((uint64_t)pFileEntry->Tag.offTag << pVol->Udf.VolInfo.cShiftBlock) 1433 + RT_ OFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs,1433 + RT_UOFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs, 1434 1434 pVol); 1435 1435 if (RT_SUCCESS(rc)) … … 2153 2153 { /* ObjSet */ 2154 2154 RTVFSOBJSETOPS_VERSION, 2155 RT_ OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),2155 RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj), 2156 2156 NULL /*SetMode*/, 2157 2157 NULL /*SetTimes*/, … … 3430 3430 { /* ObjSet */ 3431 3431 RTVFSOBJSETOPS_VERSION, 3432 RT_ OFFSETOF(RTVFSDIROPS, Obj) - RT_OFFSETOF(RTVFSDIROPS, ObjSet),3432 RT_UOFFSETOF(RTVFSDIROPS, ObjSet) - RT_UOFFSETOF(RTVFSDIROPS, Obj), 3433 3433 NULL /*SetMode*/, 3434 3434 NULL /*SetTimes*/, … … 3549 3549 wszName)); 3550 3550 3551 uint32_t offSysUse = RT_OFFSETOF(ISO9660DIRREC, achFileId[pDirRec->bFileIdLength]) + !(pDirRec->bFileIdLength & 1); 3551 uint32_t offSysUse = RT_UOFFSETOF_DYN(ISO9660DIRREC, achFileId[pDirRec->bFileIdLength]) 3552 + !(pDirRec->bFileIdLength & 1); 3552 3553 if (offSysUse < pDirRec->cbDirRec) 3553 3554 { … … 3631 3632 { 3632 3633 uint32_t offDesc = 0; 3633 while (offDesc + RT_ OFFSETOF(UDFFILEIDDESC, abImplementationUse) < pThis->cbDir)3634 while (offDesc + RT_UOFFSETOF(UDFFILEIDDESC, abImplementationUse) < pThis->cbDir) 3634 3635 { 3635 3636 PCUDFFILEIDDESC pFid = (PCUDFFILEIDDESC)&pThis->pbDir[offDesc]; … … 5368 5369 Log2(("ISO9660: RootDir.RecTime.bFileIdLength: %RX8\n", pVolDesc->RootDir.DirRec.bFileIdLength)); 5369 5370 Log2(("ISO9660: RootDir.RecTime.achFileId: '%.*s'\n", pVolDesc->RootDir.DirRec.bFileIdLength, pVolDesc->RootDir.DirRec.achFileId)); 5370 uint32_t offSysUse = RT_ OFFSETOF(ISO9660DIRREC, achFileId[pVolDesc->RootDir.DirRec.bFileIdLength])5371 uint32_t offSysUse = RT_UOFFSETOF_DYN(ISO9660DIRREC, achFileId[pVolDesc->RootDir.DirRec.bFileIdLength]) 5371 5372 + !(pVolDesc->RootDir.DirRec.bFileIdLength & 1); 5372 5373 if (offSysUse < pVolDesc->RootDir.DirRec.cbDirRec) … … 5392 5393 PISO9660DIRREC pDstRootDir, PRTERRINFO pErrInfo) 5393 5394 { 5394 if (pRootDir->cbDirRec < RT_ OFFSETOF(ISO9660DIRREC, achFileId))5395 if (pRootDir->cbDirRec < RT_UOFFSETOF(ISO9660DIRREC, achFileId)) 5395 5396 return RTERRINFO_LOG_SET_F(pErrInfo, VERR_VFS_BOGUS_FORMAT, "Root dir record size is too small: %#x (min %#x)", 5396 pRootDir->cbDirRec, RT_ OFFSETOF(ISO9660DIRREC, achFileId));5397 pRootDir->cbDirRec, RT_UOFFSETOF(ISO9660DIRREC, achFileId)); 5397 5398 5398 5399 if (!(pRootDir->fFileFlags & ISO9660_FILE_FLAGS_DIRECTORY)) … … 5494 5495 * ... and the root directory record. 5495 5496 */ 5496 *poffRootDirRec = offVolDesc + RT_ OFFSETOF(ISO9660PRIMARYVOLDESC, RootDir.DirRec);5497 *poffRootDirRec = offVolDesc + RT_UOFFSETOF(ISO9660PRIMARYVOLDESC, RootDir.DirRec); 5497 5498 return rtFsIsoVolHandleRootDir(pThis, &pVolDesc->RootDir.DirRec, pRootDir, pErrInfo); 5498 5499 } … … 5571 5572 if (RT_SUCCESS(rc)) 5572 5573 { 5573 *poffRootDirRec = offVolDesc + RT_ OFFSETOF(ISO9660SUPVOLDESC, RootDir.DirRec);5574 *poffRootDirRec = offVolDesc + RT_UOFFSETOF(ISO9660SUPVOLDESC, RootDir.DirRec); 5574 5575 *pbUcs2Level = pVolDesc->abEscapeSequences[2] == ISO9660_JOLIET_ESC_SEQ_2_LEVEL_1 ? 1 5575 5576 : pVolDesc->abEscapeSequences[2] == ISO9660_JOLIET_ESC_SEQ_2_LEVEL_2 ? 2 : 3; -
trunk/src/VBox/Runtime/common/fs/ntfsvfs.cpp
r72585 r73097 764 764 Log2(("NTFS: cwcFilename %#x\n", pInfo->cwcFilename)); 765 765 Log2(("NTFS: fFilenameType %#x\n", pInfo->fFilenameType)); 766 if (RT_UOFFSETOF (NTFSATFILENAME, wszFilename[pInfo->cwcFilename]) <= cbValue)766 if (RT_UOFFSETOF_DYN(NTFSATFILENAME, wszFilename[pInfo->cwcFilename]) <= cbValue) 767 767 Log2(("NTFS: wszFilename '%.*ls'\n", pInfo->cwcFilename, pInfo->wszFilename )); 768 768 else … … 770 770 } 771 771 else 772 Log2(("NTFS: Error! cbValue=%#x is smaller than expected (%# x) for NTFSATFILENAME!\n",773 cbValue, RT_ OFFSETOF(NTFSATFILENAME, wszFilename) ));772 Log2(("NTFS: Error! cbValue=%#x is smaller than expected (%#zx) for NTFSATFILENAME!\n", 773 cbValue, RT_UOFFSETOF(NTFSATFILENAME, wszFilename) )); 774 774 break; 775 775 } … … 2138 2138 if ( pFilename 2139 2139 && pFilename->cwcFilename >= 4 2140 && RT_UOFFSETOF (NTFSATFILENAME, wszFilename[pFilename->cwcFilename]) <= cbFilename)2140 && RT_UOFFSETOF_DYN(NTFSATFILENAME, wszFilename[pFilename->cwcFilename]) <= cbFilename) 2141 2141 { 2142 2142 PCRTUTF16 pwcExt = &pFilename->wszFilename[pFilename->cwcFilename - 4]; … … 2618 2618 { /* ObjSet */ 2619 2619 RTVFSOBJSETOPS_VERSION, 2620 RT_ OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),2620 RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj), 2621 2621 rtFsNtfsFile_SetMode, 2622 2622 rtFsNtfsFile_SetTimes, … … 2820 2820 Log2(("NTFS: cwcFilename %#x\n", pFilename->cwcFilename)); 2821 2821 Log2(("NTFS: fFilenameType %#x\n", pFilename->fFilenameType)); 2822 if (RT_UOFFSETOF (NTFSATFILENAME, wszFilename[pFilename->cwcFilename]) <= RT_LE2H_U16(pEntryHdr->cbKey))2822 if (RT_UOFFSETOF_DYN(NTFSATFILENAME, wszFilename[pFilename->cwcFilename]) <= RT_LE2H_U16(pEntryHdr->cbKey)) 2823 2823 Log2(("NTFS: wszFilename '%.*ls'\n", pFilename->cwcFilename, pFilename->wszFilename )); 2824 2824 else … … 2980 2980 { 2981 2981 PCNTFSATFILENAME pFilename = (PCNTFSATFILENAME)(pEntryHdr + 1); 2982 if (RT_UOFFSETOF (NTFSATFILENAME, wszFilename[pFilename->cwcFilename]) > cbKey)2982 if (RT_UOFFSETOF_DYN(NTFSATFILENAME, wszFilename[pFilename->cwcFilename]) > cbKey) 2983 2983 return RTERRINFO_LOG_REL_SET_F(pErrInfo, VERR_VFS_BOGUS_FORMAT, 2984 2984 "%s: Entry #%u filename is out of bounds: cwcFilename=%#x -> %#x key, max %#x", 2985 2985 pszWhat, iEntry, pFilename->cwcFilename, 2986 RT_UOFFSETOF (NTFSATFILENAME, wszFilename[pFilename->cwcFilename]), cbKey);2986 RT_UOFFSETOF_DYN(NTFSATFILENAME, wszFilename[pFilename->cwcFilename]), cbKey); 2987 2987 } 2988 2988 … … 4163 4163 { 4164 4164 4165 *pcbDirEntry = RT_UOFFSETOF (RTDIRENTRYEX, szName[pThis->paEnumStack[0].iNext + 2]);4165 *pcbDirEntry = RT_UOFFSETOF_DYN(RTDIRENTRYEX, szName[pThis->paEnumStack[0].iNext + 2]); 4166 4166 if (*pcbDirEntry > cbDirEntry) 4167 4167 return VERR_BUFFER_OVERFLOW; … … 4255 4255 rc, pFilename->cwcFilename * sizeof(RTUTF16), pFilename->wszFilename)); 4256 4256 } 4257 *pcbDirEntry = RT_UOFFSETOF (RTDIRENTRYEX, szName[cchFilename + 1]);4257 *pcbDirEntry = RT_UOFFSETOF_DYN(RTDIRENTRYEX, szName[cchFilename + 1]); 4258 4258 if (*pcbDirEntry > cbDirEntry) 4259 4259 { … … 4403 4403 { /* ObjSet */ 4404 4404 RTVFSOBJSETOPS_VERSION, 4405 RT_ OFFSETOF(RTVFSDIROPS, Obj) - RT_OFFSETOF(RTVFSDIROPS, ObjSet),4405 RT_UOFFSETOF(RTVFSDIROPS, ObjSet) - RT_UOFFSETOF(RTVFSDIROPS, Obj), 4406 4406 rtFsNtfsDir_SetMode, 4407 4407 rtFsNtfsDir_SetTimes, -
trunk/src/VBox/Runtime/common/fuzz/fuzz-observer.cpp
r72942 r73097 439 439 { 440 440 int rc = VINF_SUCCESS; 441 PRTFUZZOBSEXECCTX pExecCtx = (PRTFUZZOBSEXECCTX)RTMemAllocZ(RT_ OFFSETOF(RTFUZZOBSEXECCTX, apszArgs[pThis->cArgs + 1]));441 PRTFUZZOBSEXECCTX pExecCtx = (PRTFUZZOBSEXECCTX)RTMemAllocZ(RT_UOFFSETOF_DYN(RTFUZZOBSEXECCTX, apszArgs[pThis->cArgs + 1])); 442 442 if (RT_LIKELY(pExecCtx)) 443 443 { -
trunk/src/VBox/Runtime/common/fuzz/fuzz.cpp
r72946 r73097 333 333 static PRTFUZZINPUTINT rtFuzzCtxInputClone(PRTFUZZCTXINT pThis, const void *pvBuf, size_t cbBuf) 334 334 { 335 PRTFUZZINPUTINT pInpClone = (PRTFUZZINPUTINT)RTMemAllocZ(RT_ OFFSETOF(RTFUZZINPUTINT, abInput[cbBuf]));335 PRTFUZZINPUTINT pInpClone = (PRTFUZZINPUTINT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTFUZZINPUTINT, abInput[cbBuf])); 336 336 if (RT_LIKELY(pInpClone)) 337 337 { … … 355 355 static PRTFUZZINPUTINT rtFuzzCtxInputCreate(PRTFUZZCTXINT pThis, size_t cbInput) 356 356 { 357 PRTFUZZINPUTINT pInput = (PRTFUZZINPUTINT)RTMemAllocZ(RT_ OFFSETOF(RTFUZZINPUTINT, abInput[cbInput]));357 PRTFUZZINPUTINT pInput = (PRTFUZZINPUTINT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTFUZZINPUTINT, abInput[cbInput])); 358 358 if (RT_LIKELY(pInput)) 359 359 { … … 846 846 if (!pInput) 847 847 { 848 pInput = (PRTFUZZINPUTINT)RTMemAllocZ(RT_ OFFSETOF(RTFUZZINPUTINT, abInput[cbInput]));848 pInput = (PRTFUZZINPUTINT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTFUZZINPUTINT, abInput[cbInput])); 849 849 if (RT_LIKELY(pInput)) 850 850 { … … 897 897 if (RT_SUCCESS(rc)) 898 898 { 899 PRTFUZZINPUTINT pInput = (PRTFUZZINPUTINT)RTMemAllocZ(RT_ OFFSETOF(RTFUZZINPUTINT, abInput[cbFile]));899 PRTFUZZINPUTINT pInput = (PRTFUZZINPUTINT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTFUZZINPUTINT, abInput[cbFile])); 900 900 if (RT_LIKELY(pInput)) 901 901 { -
trunk/src/VBox/Runtime/common/ldr/ldrEx.cpp
r69111 r73097 95 95 if (uSign.au16[0] == IMAGE_DOS_SIGNATURE) 96 96 { 97 rc = pReader->pfnRead(pReader, &offHdr, sizeof(offHdr), RT_ OFFSETOF(IMAGE_DOS_HEADER, e_lfanew));97 rc = pReader->pfnRead(pReader, &offHdr, sizeof(offHdr), RT_UOFFSETOF(IMAGE_DOS_HEADER, e_lfanew)); 98 98 if (RT_FAILURE(rc)) 99 99 return rc; -
trunk/src/VBox/Runtime/common/ldr/ldrPE.cpp
r70313 r73097 1134 1134 * Enough buffer? 1135 1135 */ 1136 uint32_t cbNeeded = RT_ OFFSETOF(RTLDRIMPORTINFO, szModule[iImpOrdinal != UINT32_MAX ? offDot + 1 : off + 1]);1136 uint32_t cbNeeded = RT_UOFFSETOF_DYN(RTLDRIMPORTINFO, szModule[iImpOrdinal != UINT32_MAX ? offDot + 1 : off + 1]); 1137 1137 if (cbNeeded > cbInfo) 1138 1138 return VERR_BUFFER_OVERFLOW; … … 1519 1519 { 1520 1520 rc = RTUtf16ToUtf8Ex((PCRTUTF16)&pMisc->Data[0], 1521 (pMisc->Length - RT_ OFFSETOF(IMAGE_DEBUG_MISC, Data)) / sizeof(RTUTF16),1521 (pMisc->Length - RT_UOFFSETOF(IMAGE_DEBUG_MISC, Data)) / sizeof(RTUTF16), 1522 1522 &pszPath, RTPATH_MAX, NULL); 1523 1523 if (RT_SUCCESS(rc)) … … 2141 2141 pPlaces->offCksum = (uint32_t)pModPe->offNtHdrs 2142 2142 + (pModPe->f64Bit 2143 ? RT_ OFFSETOF(IMAGE_NT_HEADERS64, OptionalHeader.CheckSum)2144 : RT_ OFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader.CheckSum));2143 ? RT_UOFFSETOF(IMAGE_NT_HEADERS64, OptionalHeader.CheckSum) 2144 : RT_UOFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader.CheckSum)); 2145 2145 pPlaces->cbCksum = RT_SIZEOFMEMB(IMAGE_NT_HEADERS32, OptionalHeader.CheckSum); 2146 2146 pPlaces->offSecDir = (uint32_t)pModPe->offNtHdrs 2147 2147 + (pModPe->f64Bit 2148 ? RT_ OFFSETOF(IMAGE_NT_HEADERS64, OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY])2149 : RT_ OFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY]));2148 ? RT_UOFFSETOF(IMAGE_NT_HEADERS64, OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY]) 2149 : RT_UOFFSETOF(IMAGE_NT_HEADERS32, OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY])); 2150 2150 pPlaces->cbSecDir = sizeof(IMAGE_DATA_DIRECTORY); 2151 2151 pPlaces->offEndSpecial = pPlaces->offSecDir + pPlaces->cbSecDir; … … 2460 2460 RTAsn1CursorInitPrimary(&PrimaryCursor, 2461 2461 &pEntry->bCertificate[0], 2462 pEntry->dwLength - RT_ OFFSETOF(WIN_CERTIFICATE, bCertificate),2462 pEntry->dwLength - RT_UOFFSETOF(WIN_CERTIFICATE, bCertificate), 2463 2463 pErrInfo, 2464 2464 &g_RTAsn1DefaultAllocator, … … 2985 2985 2986 2986 /* from LoaderFlags and out the difference is 4 * 32-bits. */ 2987 Assert(RT_ OFFSETOF(IMAGE_OPTIONAL_HEADER32, LoaderFlags) + 16 == RT_OFFSETOF(IMAGE_OPTIONAL_HEADER64, LoaderFlags));2988 Assert( RT_ OFFSETOF(IMAGE_OPTIONAL_HEADER32, DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]) + 162989 == RT_ OFFSETOF(IMAGE_OPTIONAL_HEADER64, DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]));2987 Assert(RT_UOFFSETOF(IMAGE_OPTIONAL_HEADER32, LoaderFlags) + 16 == RT_UOFFSETOF(IMAGE_OPTIONAL_HEADER64, LoaderFlags)); 2988 Assert( RT_UOFFSETOF(IMAGE_OPTIONAL_HEADER32, DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]) + 16 2989 == RT_UOFFSETOF(IMAGE_OPTIONAL_HEADER64, DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES])); 2990 2990 uint32_t volatile *pu32Dst = (uint32_t *)&pOptHdr64->DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] - 1; 2991 2991 const uint32_t volatile *pu32Src = (uint32_t *)&pOptHdr32->DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] - 1; … … 3005 3005 * other since this is all declared volatile, but taking now chances, we'll use a temp variable. 3006 3006 */ 3007 Assert(RT_ OFFSETOF(IMAGE_OPTIONAL_HEADER32, SizeOfStackReserve) == RT_OFFSETOF(IMAGE_OPTIONAL_HEADER64, SizeOfStackReserve));3008 Assert(RT_ OFFSETOF(IMAGE_OPTIONAL_HEADER32, BaseOfData) == RT_OFFSETOF(IMAGE_OPTIONAL_HEADER64, ImageBase));3009 Assert(RT_ OFFSETOF(IMAGE_OPTIONAL_HEADER32, SectionAlignment) == RT_OFFSETOF(IMAGE_OPTIONAL_HEADER64, SectionAlignment));3007 Assert(RT_UOFFSETOF(IMAGE_OPTIONAL_HEADER32, SizeOfStackReserve) == RT_UOFFSETOF(IMAGE_OPTIONAL_HEADER64, SizeOfStackReserve)); 3008 Assert(RT_UOFFSETOF(IMAGE_OPTIONAL_HEADER32, BaseOfData) == RT_UOFFSETOF(IMAGE_OPTIONAL_HEADER64, ImageBase)); 3009 Assert(RT_UOFFSETOF(IMAGE_OPTIONAL_HEADER32, SectionAlignment) == RT_UOFFSETOF(IMAGE_OPTIONAL_HEADER64, SectionAlignment)); 3010 3010 uint32_t u32ImageBase = pOptHdr32->ImageBase; 3011 3011 pOptHdr64->ImageBase = u32ImageBase; … … 3066 3066 pLoadCfg64->DeCommitFreeBlockThreshold = u32DeCommitFreeBlockThreshold; 3067 3067 /* the rest is equal. */ 3068 Assert( RT_ OFFSETOF(IMAGE_LOAD_CONFIG_DIRECTORY32, DeCommitFreeBlockThreshold)3069 == RT_ OFFSETOF(IMAGE_LOAD_CONFIG_DIRECTORY64, DeCommitFreeBlockThreshold));3068 Assert( RT_UOFFSETOF(IMAGE_LOAD_CONFIG_DIRECTORY32, DeCommitFreeBlockThreshold) 3069 == RT_UOFFSETOF(IMAGE_LOAD_CONFIG_DIRECTORY64, DeCommitFreeBlockThreshold)); 3070 3070 } 3071 3071 … … 3898 3898 pModPe->offPkcs7SignedData = Dir.VirtualAddress 3899 3899 + (uint32_t)((uintptr_t)&pCur->bCertificate[0] - (uintptr_t)pFirst); 3900 pModPe->cbPkcs7SignedData = pCur->dwLength - RT_ OFFSETOF(WIN_CERTIFICATE, bCertificate);3900 pModPe->cbPkcs7SignedData = pCur->dwLength - RT_UOFFSETOF(WIN_CERTIFICATE, bCertificate); 3901 3901 } 3902 3902 -
trunk/src/VBox/Runtime/common/ldr/ldrVfsFile.cpp
r70309 r73097 189 189 size_t cbFilename = strlen(pszFilename) + 1; 190 190 int rc = VERR_NO_MEMORY; 191 PRTLDRREADERVFSFILE pFileReader = (PRTLDRREADERVFSFILE)RTMemAlloc(RT_ OFFSETOF(RTLDRREADERVFSFILE, szFilename[cbFilename]));191 PRTLDRREADERVFSFILE pFileReader = (PRTLDRREADERVFSFILE)RTMemAlloc(RT_UOFFSETOF_DYN(RTLDRREADERVFSFILE, szFilename[cbFilename])); 192 192 if (pFileReader) 193 193 { -
trunk/src/VBox/Runtime/common/log/log.cpp
r72863 r73097 213 213 # ifdef IN_RING3 214 214 /** The size of the RTLOGGERINTERNAL structure in ring-0. */ 215 # define RTLOGGERINTERNAL_R0_SIZE RT_ OFFSETOF(RTLOGGERINTERNAL, pfnPhase)215 # define RTLOGGERINTERNAL_R0_SIZE RT_UOFFSETOF(RTLOGGERINTERNAL, pfnPhase) 216 216 AssertCompileMemberAlignment(RTLOGGERINTERNAL, hFile, sizeof(void *)); 217 217 AssertCompileMemberAlignment(RTLOGGERINTERNAL, cbHistoryFileMax, sizeof(uint64_t)); … … 809 809 * Allocate a logger instance. 810 810 */ 811 offInternal = RT_ OFFSETOF(RTLOGGER, afGroups[cGroups]);811 offInternal = RT_UOFFSETOF_DYN(RTLOGGER, afGroups[cGroups]); 812 812 offInternal = RT_ALIGN_Z(offInternal, sizeof(uint64_t)); 813 813 cbLogger = offInternal + sizeof(RTLOGGERINTERNAL); … … 1194 1194 * Check if there's enough space for the groups. 1195 1195 */ 1196 if (cbLoggerRC < (size_t)RT_ OFFSETOF(RTLOGGERRC, afGroups[pLogger->cGroups]))1197 { 1198 AssertMsgFailed(("% d req=%d cGroups=%d\n", cbLoggerRC, RT_OFFSETOF(RTLOGGERRC, afGroups[pLogger->cGroups]), pLogger->cGroups));1196 if (cbLoggerRC < (size_t)RT_UOFFSETOF_DYN(RTLOGGERRC, afGroups[pLogger->cGroups])) 1197 { 1198 AssertMsgFailed(("%zu req=%zu cGroups=%d\n", cbLoggerRC, RT_UOFFSETOF_DYN(RTLOGGERRC, afGroups[pLogger->cGroups]), pLogger->cGroups)); 1199 1199 return VERR_BUFFER_OVERFLOW; 1200 1200 } … … 1349 1349 RTDECL(size_t) RTLogCalcSizeForR0(uint32_t cGroups, uint32_t fFlags) 1350 1350 { 1351 size_t cb = RT_ OFFSETOF(RTLOGGER, afGroups[cGroups]);1351 size_t cb = RT_UOFFSETOF_DYN(RTLOGGER, afGroups[cGroups]); 1352 1352 cb = RT_ALIGN_Z(cb, sizeof(uint64_t)); 1353 1353 cb += sizeof(RTLOGGERINTERNAL); … … 1394 1394 { 1395 1395 AssertMsgFailed(("cMaxGroups=%zd cGroups=%zd (min size %d)\n", pDstInt->cMaxGroups, 1396 pSrcLogger->cGroups, RT_ OFFSETOF(RTLOGGER, afGroups[pSrcLogger->cGroups]) + RTLOGGERINTERNAL_R0_SIZE));1396 pSrcLogger->cGroups, RT_UOFFSETOF_DYN(RTLOGGER, afGroups[pSrcLogger->cGroups]) + RTLOGGERINTERNAL_R0_SIZE)); 1397 1397 rc = VERR_INVALID_PARAMETER; 1398 1398 cGroups = pDstInt->cMaxGroups; -
trunk/src/VBox/Runtime/common/log/tracebuf.cpp
r69111 r73097 265 265 pszBuf = &pEntry->szMsg[0]; \ 266 266 *pszBuf = '\0'; \ 267 cchBuf = pThis->cbEntry - RT_ OFFSETOF(RTTRACEBUFENTRY, szMsg) - 1; \267 cchBuf = pThis->cbEntry - RT_UOFFSETOF(RTTRACEBUFENTRY, szMsg) - 1; \ 268 268 rc = VINF_SUCCESS 269 269 -
trunk/src/VBox/Runtime/common/log/tracelogreader.cpp
r71502 r73097 820 820 { 821 821 /* Allocate new internal event descriptor state. */ 822 size_t cbEvtDesc = RT_ OFFSETOF(RTTRACELOGRDREVTDESC, aEvtItemDesc[pEvtDesc->cEvtItems]);822 size_t cbEvtDesc = RT_UOFFSETOF_DYN(RTTRACELOGRDREVTDESC, aEvtItemDesc[pEvtDesc->cEvtItems]); 823 823 PRTTRACELOGRDREVTDESC pEvtDescInt = (PRTTRACELOGRDREVTDESC)RTMemAllocZ(cbEvtDesc); 824 824 if (RT_LIKELY(pEvtDesc)) … … 999 999 && pEvtStrm->cRawEvtDataSz == pEvtDesc->cRawDataNonStatic)) 1000 1000 { 1001 size_t cbEvt = RT_ OFFSETOF(RTTRACELOGRDREVTINT, abEvtData[pEvtStrm->cbEvtData]);1001 size_t cbEvt = RT_UOFFSETOF_DYN(RTTRACELOGRDREVTINT, abEvtData[pEvtStrm->cbEvtData]); 1002 1002 cbEvt += pEvtDesc->cRawDataNonStatic * sizeof(size_t); 1003 1003 PRTTRACELOGRDREVTINT pEvt = (PRTTRACELOGRDREVTINT)RTMemAllocZ(cbEvt); -
trunk/src/VBox/Runtime/common/log/tracelogwriter.cpp
r72309 r73097 137 137 static size_t rtTraceLogWrtEvtDescGetSz(PCRTTRACELOGEVTDESC pEvtDesc) 138 138 { 139 size_t cbAlloc = RT_ OFFSETOF(RTTRACELOGWREVTDESC, aEvtItemDesc[pEvtDesc->cEvtItems]);139 size_t cbAlloc = RT_UOFFSETOF_DYN(RTTRACELOGWREVTDESC, aEvtItemDesc[pEvtDesc->cEvtItems]); 140 140 141 141 cbAlloc += strlen(pEvtDesc->pszId) + 1; -
trunk/src/VBox/Runtime/common/path/RTPathGlob.cpp
r69753 r73097 1475 1475 if (pGlob->cResults < RTPATHGLOB_MAX_RESULTS) 1476 1476 { 1477 PRTPATHGLOBENTRY pEntry = (PRTPATHGLOBENTRY)RTMemAlloc(RT_ OFFSETOF(RTPATHGLOBENTRY, szPath[cchPath + 1]));1477 PRTPATHGLOBENTRY pEntry = (PRTPATHGLOBENTRY)RTMemAlloc(RT_UOFFSETOF_DYN(RTPATHGLOBENTRY, szPath[cchPath + 1])); 1478 1478 if (pEntry) 1479 1479 { … … 1515 1515 if (pGlob->cResults < RTPATHGLOB_MAX_RESULTS) 1516 1516 { 1517 PRTPATHGLOBENTRY pEntry = (PRTPATHGLOBENTRY)RTMemAlloc(RT_ OFFSETOF(RTPATHGLOBENTRY, szPath[cchPath + cchName + 1]));1517 PRTPATHGLOBENTRY pEntry = (PRTPATHGLOBENTRY)RTMemAlloc(RT_UOFFSETOF_DYN(RTPATHGLOBENTRY, szPath[cchPath + cchName + 1])); 1518 1518 if (pEntry) 1519 1519 { … … 1559 1559 if (pGlob->cResults < RTPATHGLOB_MAX_RESULTS) 1560 1560 { 1561 PRTPATHGLOBENTRY pEntry = (PRTPATHGLOBENTRY)RTMemAlloc(RT_ OFFSETOF(RTPATHGLOBENTRY, szPath[cchPath + cchName + 1]));1561 PRTPATHGLOBENTRY pEntry = (PRTPATHGLOBENTRY)RTMemAlloc(RT_UOFFSETOF_DYN(RTPATHGLOBENTRY, szPath[cchPath + cchName + 1])); 1562 1562 if (pEntry) 1563 1563 { … … 2083 2083 * Parse the path. 2084 2084 */ 2085 size_t cbParsed = RT_ OFFSETOF(RTPATHPARSED, aComps[1]); /** @todo 16 after testing */2085 size_t cbParsed = RT_UOFFSETOF(RTPATHPARSED, aComps[1]); /** @todo 16 after testing */ 2086 2086 PRTPATHPARSED pParsed = (PRTPATHPARSED)RTMemTmpAlloc(cbParsed); 2087 2087 AssertReturn(pParsed, VERR_NO_MEMORY); … … 2089 2089 if (rc == VERR_BUFFER_OVERFLOW) 2090 2090 { 2091 cbParsed = RT_ OFFSETOF(RTPATHPARSED, aComps[pParsed->cComps + 1]);2091 cbParsed = RT_UOFFSETOF_DYN(RTPATHPARSED, aComps[pParsed->cComps + 1]); 2092 2092 RTMemTmpFree(pParsed); 2093 2093 pParsed = (PRTPATHPARSED)RTMemTmpAlloc(cbParsed); … … 2112 2112 * Allocate and initialize the glob state data structure. 2113 2113 */ 2114 size_t cbGlob = RT_ OFFSETOF(RTPATHGLOB, aComps[pParsed->cComps + 1]);2114 size_t cbGlob = RT_UOFFSETOF_DYN(RTPATHGLOB, aComps[pParsed->cComps + 1]); 2115 2115 PRTPATHGLOB pGlob = (PRTPATHGLOB)RTMemTmpAllocZ(cbGlob); 2116 2116 if (pGlob) -
trunk/src/VBox/Runtime/common/path/RTPathSplit.cpp
r69111 r73097 73 73 uint16_t const cchPath = pParsedVolatile->cchPath; 74 74 uint16_t const offSuffix = pParsedVolatile->offSuffix; 75 uint32_t cbNeeded = RT_ OFFSETOF(RTPATHSPLIT, apszComps[cComps])75 uint32_t cbNeeded = RT_UOFFSETOF_DYN(RTPATHSPLIT, apszComps[cComps]) 76 76 + cchPath 77 77 + RTPATH_PROP_FIRST_NEEDS_NO_SLASH(fProps) /* zero terminator for root spec. */ -
trunk/src/VBox/Runtime/common/path/RTPathSplitA.cpp
r69111 r73097 49 49 */ 50 50 size_t cbSplit = strlen(pszPath); 51 cbSplit += RT_ OFFSETOF(RTPATHSPLIT, apszComps[cbSplit / 8]) + cbSplit / 8 + 8;51 cbSplit += RT_UOFFSETOF_DYN(RTPATHSPLIT, apszComps[cbSplit / 8]) + cbSplit / 8 + 8; 52 52 cbSplit = RT_ALIGN(cbSplit, 64); 53 53 PRTPATHSPLIT pSplit = (PRTPATHSPLIT)RTMemAllocTag(cbSplit, pszTag); -
trunk/src/VBox/Runtime/common/string/strcache.cpp
r69111 r73097 668 668 * here to encourage the heap to give us optimal alignment. 669 669 */ 670 size_t cbEntry = RT_UOFFSETOF (RTSTRCACHEBIGENTRY, Core.szString[cchString + 1]);670 size_t cbEntry = RT_UOFFSETOF_DYN(RTSTRCACHEBIGENTRY, Core.szString[cchString + 1]); 671 671 PRTSTRCACHEBIGENTRY pBigEntry = (PRTSTRCACHEBIGENTRY)RTMemAlloc(RT_ALIGN_Z(cbEntry, RTSTRCACHE_HEAP_ENTRY_SIZE_ALIGN)); 672 672 if (!pBigEntry) … … 780 780 *pcCollisions = 0; 781 781 782 uint16_t cchStringFirst = RT_UOFFSETOF (RTSTRCACHEENTRY, szString[cchString + 1]) < RTSTRCACHE_HEAP_THRESHOLD782 uint16_t cchStringFirst = RT_UOFFSETOF_DYN(RTSTRCACHEENTRY, szString[cchString + 1]) < RTSTRCACHE_HEAP_THRESHOLD 783 783 ? (uint16_t)cchString : RTSTRCACHEENTRY_BIG_LEN; 784 784 uint32_t iHash = uHashLen % pThis->cHashTab; … … 1134 1134 PRTSTRCACHEBIGENTRY pBigStr = RT_FROM_MEMBER(pStr, RTSTRCACHEBIGENTRY, Core); 1135 1135 RTListNodeRemove(&pBigStr->ListEntry); 1136 pThis->cbBigEntries -= RT_ALIGN_32(RT_UOFFSETOF (RTSTRCACHEBIGENTRY, Core.szString[cchString + 1]),1136 pThis->cbBigEntries -= RT_ALIGN_32(RT_UOFFSETOF_DYN(RTSTRCACHEBIGENTRY, Core.szString[cchString + 1]), 1137 1137 RTSTRCACHE_HEAP_ENTRY_SIZE_ALIGN); 1138 1138 -
trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp
r71826 r73097 91 91 do { \ 92 92 RTVFSOBJ_ASSERT_OPS(&(pDirOps)->Obj, a_enmType); \ 93 RTVFSOBJSET_ASSERT_OPS(&(pDirOps)->ObjSet, RT_ OFFSETOF(RTVFSDIROPS, Obj) - RT_OFFSETOF(RTVFSDIROPS, ObjSet)); \93 RTVFSOBJSET_ASSERT_OPS(&(pDirOps)->ObjSet, RT_UOFFSETOF(RTVFSDIROPS, ObjSet) - RT_UOFFSETOF(RTVFSDIROPS, Obj)); \ 94 94 Assert((pDirOps)->uVersion == RTVFSDIROPS_VERSION); \ 95 95 Assert(!(pDirOps)->fReserved); \ … … 126 126 do { \ 127 127 RTVFSOBJ_ASSERT_OPS(&(pSymlinkOps)->Obj, a_enmType); \ 128 RTVFSOBJSET_ASSERT_OPS(&(pSymlinkOps)->ObjSet, RT_ OFFSETOF(RTVFSSYMLINKOPS, Obj) - RT_OFFSETOF(RTVFSSYMLINKOPS, ObjSet)); \128 RTVFSOBJSET_ASSERT_OPS(&(pSymlinkOps)->ObjSet, RT_UOFFSETOF(RTVFSSYMLINKOPS, ObjSet) - RT_UOFFSETOF(RTVFSSYMLINKOPS, Obj)); \ 129 129 Assert((pSymlinkOps)->uVersion == RTVFSSYMLINKOPS_VERSION); \ 130 130 Assert(!(pSymlinkOps)->fReserved); \ … … 3170 3170 cbDirEntry = *pcbDirEntry; 3171 3171 AssertMsgReturn(cbDirEntry >= RT_UOFFSETOF(RTDIRENTRYEX, szName[2]), 3172 ("Invalid *pcbDirEntry=%d (min % d)\n", *pcbDirEntry, RT_OFFSETOF(RTDIRENTRYEX, szName[2])),3172 ("Invalid *pcbDirEntry=%d (min %zu)\n", *pcbDirEntry, RT_UOFFSETOF(RTDIRENTRYEX, szName[2])), 3173 3173 VERR_INVALID_PARAMETER); 3174 3174 } -
trunk/src/VBox/Runtime/common/vfs/vfsfss2dir.cpp
r67186 r73097 222 222 size_t const cbRelativePath = strlen(pszPath); 223 223 PRTVFSFSSWRITE2DIRENTRY pEntry; 224 pEntry = (PRTVFSFSSWRITE2DIRENTRY)RTMemAllocVar(RT_UOFFSETOF (RTVFSFSSWRITE2DIRENTRY, szName[cbRelativePath]));224 pEntry = (PRTVFSFSSWRITE2DIRENTRY)RTMemAllocVar(RT_UOFFSETOF_DYN(RTVFSFSSWRITE2DIRENTRY, szName[cbRelativePath])); 225 225 if (pEntry) 226 226 { … … 369 369 PRTVFSFSSWRITE2DIR pThis; 370 370 RTVFSFSSTREAM hVfsFss; 371 rc = RTVfsNewFsStream(&g_rtVfsFssToDirOps, RT_UOFFSETOF (RTVFSFSSWRITE2DIR, szBaseDir[cbBaseDir]),371 rc = RTVfsNewFsStream(&g_rtVfsFssToDirOps, RT_UOFFSETOF_DYN(RTVFSFSSWRITE2DIR, szBaseDir[cbBaseDir]), 372 372 NIL_RTVFS, NIL_RTVFSLOCK, false /*fReadOnly*/, &hVfsFss, (void **)&pThis); 373 373 if (RT_SUCCESS(rc)) -
trunk/src/VBox/Runtime/common/vfs/vfsmemory.cpp
r69977 r73097 421 421 * Allocate, initialize and insert the new extent. 422 422 */ 423 PRTVFSMEMEXTENT pNew = (PRTVFSMEMEXTENT)RTMemAllocZ(RT_ OFFSETOF(RTVFSMEMEXTENT, abData[cbExtent]));423 PRTVFSMEMEXTENT pNew = (PRTVFSMEMEXTENT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTVFSMEMEXTENT, abData[cbExtent])); 424 424 if (pNew) 425 425 { … … 731 731 { /* ObjSet */ 732 732 RTVFSOBJSETOPS_VERSION, 733 RT_ OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),733 RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj), 734 734 rtVfsMemFile_SetMode, 735 735 rtVfsMemFile_SetTimes, -
trunk/src/VBox/Runtime/common/vfs/vfsmount.cpp
r69861 r73097 238 238 Assert(offFirstZero >= RT_UOFFSETOF(FATBOOTSECTOR, Bpb)); 239 239 uint32_t const cbZeroPad = RT_MIN(offJump - offFirstZero, 240 sizeof(pBootSector->Bpb.Bpb20) - (offFirstZero - RT_ OFFSETOF(FATBOOTSECTOR, Bpb)));240 sizeof(pBootSector->Bpb.Bpb20) - (offFirstZero - RT_UOFFSETOF(FATBOOTSECTOR, Bpb))); 241 241 242 242 if (!ASMMemIsAllU8((uint8_t const *)pBootSector + offFirstZero, cbZeroPad, 0)) … … 266 266 && pBootSector->abJmp[2] <= 0x7f) 267 267 offJmp = RT_MIN(127, RT_MAKE_U16(pBootSector->abJmp[1], pBootSector->abJmp[2])); 268 uint8_t const cbMaxBpb = offJmp - RT_ OFFSETOF(FATBOOTSECTOR, Bpb);268 uint8_t const cbMaxBpb = offJmp - RT_UOFFSETOF(FATBOOTSECTOR, Bpb); 269 269 if (cbMaxBpb < sizeof(FATBPB20)) 270 270 { -
trunk/src/VBox/Runtime/common/vfs/vfsprogress.cpp
r69977 r73097 456 456 { /* ObjSet */ 457 457 RTVFSOBJSETOPS_VERSION, 458 RT_ OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),458 RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj), 459 459 rtVfsProgressFile_SetMode, 460 460 rtVfsProgressFile_SetTimes, -
trunk/src/VBox/Runtime/common/vfs/vfsreadahead.cpp
r69977 r73097 579 579 { /* ObjSet */ 580 580 RTVFSOBJSETOPS_VERSION, 581 RT_ OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),581 RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj), 582 582 rtVfsReadAhead_SetMode, 583 583 rtVfsReadAhead_SetTimes, … … 733 733 RTVFSIOSTREAM hVfsIosReadAhead = NIL_RTVFSIOSTREAM; 734 734 PRTVFSREADAHEAD pThis; 735 size_t cbThis = RT_ OFFSETOF(RTVFSREADAHEAD, aBufDescs[cBuffers]);735 size_t cbThis = RT_UOFFSETOF_DYN(RTVFSREADAHEAD, aBufDescs[cBuffers]); 736 736 if (hVfsFileSrc != NIL_RTVFSFILE) 737 737 rc = RTVfsNewFile(&g_VfsReadAheadFileOps, cbThis, RTFILE_O_READ, NIL_RTVFS, NIL_RTVFSLOCK, -
trunk/src/VBox/Runtime/common/vfs/vfsstddir.cpp
r69826 r73097 171 171 { /* ObjSet */ 172 172 RTVFSOBJSETOPS_VERSION, 173 RT_ OFFSETOF(RTVFSSYMLINKOPS, Obj) - RT_OFFSETOF(RTVFSSYMLINKOPS, ObjSet),173 RT_UOFFSETOF(RTVFSSYMLINKOPS, ObjSet) - RT_UOFFSETOF(RTVFSSYMLINKOPS, Obj), 174 174 rtVfsStdSym_SetMode, 175 175 rtVfsStdSym_SetTimes, … … 363 363 PRTVFSSTDSYMLINK pNewSymlink; 364 364 size_t cchSymlink = strlen(pszEntry); 365 rc = RTVfsNewSymlink(&g_rtVfsStdSymOps, RT_UOFFSETOF (RTVFSSTDSYMLINK, szSymlink[cchSymlink + 1]),365 rc = RTVfsNewSymlink(&g_rtVfsStdSymOps, RT_UOFFSETOF_DYN(RTVFSSTDSYMLINK, szSymlink[cchSymlink + 1]), 366 366 NIL_RTVFS, NIL_RTVFSLOCK, &hVfsSymlink, (void **)&pNewSymlink); 367 367 if (RT_SUCCESS(rc)) … … 540 540 PRTVFSSTDSYMLINK pNewSymlink; 541 541 size_t cchSymlink = strlen(pszSymlink); 542 rc = RTVfsNewSymlink(&g_rtVfsStdSymOps, RT_UOFFSETOF (RTVFSSTDSYMLINK, szSymlink[cchSymlink + 1]),542 rc = RTVfsNewSymlink(&g_rtVfsStdSymOps, RT_UOFFSETOF_DYN(RTVFSSTDSYMLINK, szSymlink[cchSymlink + 1]), 543 543 NIL_RTVFS, NIL_RTVFSLOCK, phVfsSymlink, (void **)&pNewSymlink); 544 544 if (RT_SUCCESS(rc)) … … 673 673 { /* ObjSet */ 674 674 RTVFSOBJSETOPS_VERSION, 675 RT_ OFFSETOF(RTVFSDIROPS, Obj) - RT_OFFSETOF(RTVFSDIROPS, ObjSet),675 RT_UOFFSETOF(RTVFSDIROPS, ObjSet) - RT_UOFFSETOF(RTVFSDIROPS, Obj), 676 676 rtVfsStdDir_SetMode, 677 677 rtVfsStdDir_SetTimes, -
trunk/src/VBox/Runtime/common/vfs/vfsstdfile.cpp
r69977 r73097 450 450 { /* ObjSet */ 451 451 RTVFSOBJSETOPS_VERSION, 452 RT_ OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),452 RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj), 453 453 rtVfsStdFile_SetMode, 454 454 rtVfsStdFile_SetTimes, -
trunk/src/VBox/Runtime/common/zip/pkzipvfs.cpp
r69111 r73097 717 717 { 718 718 /* sanity check */ 719 if (off + RT_ OFFSETOF(RTZIPPKZIPENDOFCENTRDIRREC, u8Comment) + eocd.cbComment == cbFile)719 if (off + RT_UOFFSETOF(RTZIPPKZIPENDOFCENTRDIRREC, u8Comment) + eocd.cbComment == cbFile) 720 720 { 721 721 pThis->offFirstCdh = eocd.offCentrDir; -
trunk/src/VBox/Runtime/common/zip/tarvfs.cpp
r69219 r73097 1191 1191 { /* ObjSet */ 1192 1192 RTVFSOBJSETOPS_VERSION, 1193 RT_ OFFSETOF(RTVFSSYMLINKOPS, Obj) - RT_OFFSETOF(RTVFSSYMLINKOPS, ObjSet),1193 RT_UOFFSETOF(RTVFSSYMLINKOPS, ObjSet) - RT_UOFFSETOF(RTVFSSYMLINKOPS, Obj), 1194 1194 rtZipTarFssSym_SetMode, 1195 1195 rtZipTarFssSym_SetTimes, -
trunk/src/VBox/Runtime/common/zip/tarvfswriter.cpp
r69977 r73097 819 819 { /* ObjSet */ 820 820 RTVFSOBJSETOPS_VERSION, 821 RT_ OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),821 RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj), 822 822 rtZipTarWriterPush_SetMode, 823 823 rtZipTarWriterPush_SetTimes, -
trunk/src/VBox/Runtime/common/zip/xarvfs.cpp
r69977 r73097 1163 1163 { /* ObjSet */ 1164 1164 RTVFSOBJSETOPS_VERSION, 1165 RT_ OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),1165 RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj), 1166 1166 rtZipXarFssFile_SetMode, 1167 1167 rtZipXarFssFile_SetTimes, … … 1433 1433 { /* ObjSet */ 1434 1434 RTVFSOBJSETOPS_VERSION, 1435 RT_ OFFSETOF(RTVFSSYMLINKOPS, Obj) - RT_OFFSETOF(RTVFSSYMLINKOPS, ObjSet),1435 RT_UOFFSETOF(RTVFSSYMLINKOPS, ObjSet) - RT_UOFFSETOF(RTVFSSYMLINKOPS, Obj), 1436 1436 rtZipXarFssSym_SetMode, 1437 1437 rtZipXarFssSym_SetTimes,
Note:
See TracChangeset
for help on using the changeset viewer.