VirtualBox

Changeset 73097 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Jul 12, 2018 9:06:33 PM (6 years ago)
Author:
vboxsync
Message:

*: Made RT_UOFFSETOF, RT_OFFSETOF, RT_UOFFSETOF_ADD and RT_OFFSETOF_ADD work like builtin_offsetof() and require compile time resolvable requests, adding RT_UOFFSETOF_DYN for the dynamic questions that can only be answered at runtime.

Location:
trunk/src/VBox/Runtime/common
Files:
44 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/alloc/memtracker.cpp

    r69971 r73097  
    402402    if (RT_UNLIKELY(!pTag))
    403403    {
    404         pTag = (PRTMEMTRACKERTAG)RTMemAllocZVar(RT_OFFSETOF(RTMEMTRACKERTAG, szTag[cchTag + 1]));
     404        pTag = (PRTMEMTRACKERTAG)RTMemAllocZVar(RT_UOFFSETOF_DYN(RTMEMTRACKERTAG, szTag[cchTag + 1]));
    405405        if (pTag)
    406406        {
  • trunk/src/VBox/Runtime/common/asn1/asn1-basics.cpp

    r69111 r73097  
    198198
    199199    /* 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;
    201201    PRTASN1MEMCONTENT   pHdr;
    202202    int rc = pAllocator->pfnAlloc(pAllocator, &Allocation, (void **)&pHdr, cbAlloc);
     
    234234         * Case 1 - Initial allocation.
    235235         */
    236         uint32_t cbNeeded  = RT_OFFSETOF(RTASN1MEMCONTENT, au64Content) + (uint32_t)cb;
     236        uint32_t cbNeeded  = RT_UOFFSETOF(RTASN1MEMCONTENT, au64Content) + (uint32_t)cb;
    237237        if (!(pAsn1Core->fFlags & RTASN1CORE_F_ALLOCATED_CONTENT))
    238238            return RTAsn1ContentAllocZ(pAsn1Core, cb, pAllocator);
  • trunk/src/VBox/Runtime/common/checksum/ipv4.cpp

    r69111 r73097  
    663663     * Validate all the header fields we're able to...
    664664     */
    665     if (cbDhcp < RT_OFFSETOF(RTNETBOOTP, bp_op) + sizeof(pDhcp->bp_op))
     665    if (cbDhcp < RT_UOFFSETOF(RTNETBOOTP, bp_op) + sizeof(pDhcp->bp_op))
    666666        return true;
    667667    if (RT_UNLIKELY(    pDhcp->bp_op != RTNETBOOTP_OP_REQUEST
     
    669669        return false;
    670670
    671     if (cbDhcp < RT_OFFSETOF(RTNETBOOTP, bp_htype) + sizeof(pDhcp->bp_htype))
     671    if (cbDhcp < RT_UOFFSETOF(RTNETBOOTP, bp_htype) + sizeof(pDhcp->bp_htype))
    672672        return true;
    673673    if (RT_UNLIKELY(pDhcp->bp_htype != RTNET_ARP_ETHER))
    674674        return false;
    675675
    676     if (cbDhcp < RT_OFFSETOF(RTNETBOOTP, bp_hlen) + sizeof(pDhcp->bp_hlen))
     676    if (cbDhcp < RT_UOFFSETOF(RTNETBOOTP, bp_hlen) + sizeof(pDhcp->bp_hlen))
    677677        return true;
    678678    if (RT_UNLIKELY(pDhcp->bp_hlen != sizeof(RTMAC)))
    679679        return false;
    680680
    681     if (cbDhcp < RT_OFFSETOF(RTNETBOOTP, bp_flags) + sizeof(pDhcp->bp_flags))
     681    if (cbDhcp < RT_UOFFSETOF(RTNETBOOTP, bp_flags) + sizeof(pDhcp->bp_flags))
    682682        return true;
    683683    if (RT_UNLIKELY(RT_BE2H_U16(pDhcp->bp_flags) & ~(RTNET_DHCP_FLAGS_NO_BROADCAST)))
     
    688688     * (because that seems to be indicating that it's BOOTP and not DHCP).
    689689     */
    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);
    691691    if (cbLeft < 0)
    692692        return true;
  • trunk/src/VBox/Runtime/common/checksum/manifest2.cpp

    r73041 r73097  
    704704    {
    705705        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]));
    707707        if (!pAttr)
    708708        {
     
    10701070    if (rc == VERR_NOT_FOUND)
    10711071    {
    1072         pEntry = (PRTMANIFESTENTRY)RTMemAlloc(RT_UOFFSETOF(RTMANIFESTENTRY, szName[cchEntry + 1]));
     1072        pEntry = (PRTMANIFESTENTRY)RTMemAlloc(RT_UOFFSETOF_DYN(RTMANIFESTENTRY, szName[cchEntry + 1]));
    10731073        if (!pEntry)
    10741074            return VERR_NO_MEMORY;
     
    11961196    if (rc == VERR_NOT_FOUND)
    11971197    {
    1198         pEntry = (PRTMANIFESTENTRY)RTMemAlloc(RT_UOFFSETOF(RTMANIFESTENTRY, szName[cchEntry + 1]));
     1198        pEntry = (PRTMANIFESTENTRY)RTMemAlloc(RT_UOFFSETOF_DYN(RTMANIFESTENTRY, szName[cchEntry + 1]));
    11991199        if (pEntry)
    12001200        {
  • trunk/src/VBox/Runtime/common/crypto/digest-core.cpp

    r69111 r73097  
    9797    AssertReturn(pDesc->pfnNew || offHash, VERR_INVALID_PARAMETER);
    9898    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]));
    100100    if (pThis)
    101101    {
     
    140140    int rc = VINF_SUCCESS;
    141141    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]));
    143143    if (pThis)
    144144    {
  • trunk/src/VBox/Runtime/common/crypto/pkix-signature-core.cpp

    r69111 r73097  
    107107     */
    108108    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]));
    110111    if (pThis)
    111112    {
     
    160161            pThis->pDesc->pfnDelete(pThis->pDesc, pThis->abState, pThis->fSigning);
    161162
    162         size_t cbToWipe = RT_OFFSETOF(RTCRPKIXSIGNATUREINT, abState[pThis->pDesc->cbState]);
     163        size_t cbToWipe = RT_UOFFSETOF_DYN(RTCRPKIXSIGNATUREINT, abState[pThis->pDesc->cbState]);
    163164        RTMemWipeThoroughly(pThis, cbToWipe, 6);
    164165
  • trunk/src/VBox/Runtime/common/crypto/store-inmem.cpp

    r69111 r73097  
    120120{
    121121    int                 rc;
    122     PRTCRSTOREINMEMCERT pEntry    = (PRTCRSTOREINMEMCERT)RTMemAllocZ(RT_UOFFSETOF(RTCRSTOREINMEMCERT, abEncoded[cbSrc]));
     122    PRTCRSTOREINMEMCERT pEntry    = (PRTCRSTOREINMEMCERT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTCRSTOREINMEMCERT, abEncoded[cbSrc]));
    123123    if (pEntry)
    124124    {
  • trunk/src/VBox/Runtime/common/dbg/dbgas.cpp

    r69111 r73097  
    198198     */
    199199    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]));
    201201    if (!pDbgAs)
    202202        return VERR_NO_MEMORY;
  • trunk/src/VBox/Runtime/common/dbg/dbgcfg.cpp

    r72264 r73097  
    19551955             * We're adding a new one.
    19561956             */
    1957             PRTDBGCFGSTR pNew = (PRTDBGCFGSTR)RTMemAlloc(RT_OFFSETOF(RTDBGCFGSTR, sz[cchPath + 1]));
     1957            PRTDBGCFGSTR pNew = (PRTDBGCFGSTR)RTMemAlloc(RT_UOFFSETOF_DYN(RTDBGCFGSTR, sz[cchPath + 1]));
    19581958            if (!pNew)
    19591959                return VERR_NO_MEMORY;
  • trunk/src/VBox/Runtime/common/dbg/dbgmod.cpp

    r69111 r73097  
    14421442                    PRTDBGMODDEFERRED pDeferred;
    14431443                    rc = rtDbgModDeferredCreate(pDbgMod, rtDbgModFromMachOImageDeferredCallback, cbImage, hDbgCfg,
    1444                                                 RT_OFFSETOF(RTDBGMODDEFERRED, u.MachO.aSegs[cSegs]),
     1444                                                RT_UOFFSETOF_DYN(RTDBGMODDEFERRED, u.MachO.aSegs[cSegs]),
    14451445                                                &pDeferred);
    14461446                    if (RT_SUCCESS(rc))
  • trunk/src/VBox/Runtime/common/dbg/dbgmodcodeview.cpp

    r69111 r73097  
    12271227                                 cbSubSect, RT_UOFFSETOF(RTCVSRCFILE, aoffSrcLines), i, offSrcFile));
    12281228        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])
    12301230                                    + sizeof(RTCVSRCRANGE) * pSrcFile->cSegs
    12311231                                    + sizeof(uint8_t);
     
    12511251                                     cbSubSect, RT_UOFFSETOF(RTCVSRCLINE, aoffLines), iSeg, offSrcLine));
    12521252            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])
    12541254                                        + pSrcLine->cPairs * sizeof(uint16_t);
    12551255            RTDBGMODCV_CHECK_RET_BF(cbSubSect >= offSrcLine + cbSrcLine,
  • trunk/src/VBox/Runtime/common/dvm/dvmvfs.cpp

    r69977 r73097  
    472472    { /* ObjSet */
    473473        RTVFSOBJSETOPS_VERSION,
    474         RT_OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),
     474        RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj),
    475475        rtDvmVfsFile_SetMode,
    476476        rtDvmVfsFile_SetTimes,
     
    921921
    922922        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]);
    924924        if (cbNeeded <= *pcbDirEntry)
    925925        {
     
    982982    { /* ObjSet */
    983983        RTVFSOBJSETOPS_VERSION,
    984         RT_OFFSETOF(RTVFSDIROPS, Obj) - RT_OFFSETOF(RTVFSDIROPS, ObjSet),
     984        RT_UOFFSETOF(RTVFSDIROPS, ObjSet) - RT_UOFFSETOF(RTVFSDIROPS, Obj),
    985985        rtDvmVfsDir_SetMode,
    986986        rtDvmVfsDir_SetTimes,
  • trunk/src/VBox/Runtime/common/fs/RTFsCmdLs.cpp

    r70422 r73097  
    782782    {
    783783        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;
    788788    }
    789789
     
    10271027            && *pszName)
    10281028        {
    1029             PRTCMDLSCOLLECTION pCollection = (PRTCMDLSCOLLECTION)RTMemAllocZ(RT_OFFSETOF(RTCMDLSCOLLECTION, szName[1]));
     1029            PRTCMDLSCOLLECTION pCollection = (PRTCMDLSCOLLECTION)RTMemAllocZ(RT_UOFFSETOF(RTCMDLSCOLLECTION, szName[1]));
    10301030            if (!pCollection)
    10311031            {
     
    10401040    /* Add new collection. */
    10411041    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]));
    10431043    if (pCollection)
    10441044    {
     
    10831083    size_t const cbGroup  = pszGroup  ? strlen(pszGroup)  + 1 : 0;
    10841084    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]);
    10861086    PRTCMDLSENTRY pEntry = (PRTCMDLSENTRY)RTMemAlloc(cbEntry);
    10871087    if (pEntry)
  • trunk/src/VBox/Runtime/common/fs/ext2vfs.cpp

    r69861 r73097  
    9999    if (!pBlkGrpDesc)
    100100    {
    101         size_t cbBlkDesc = RT_OFFSETOF(RTFILESYSTEMEXTBLKGRP, abBlockBitmap[cbBlockBitmap]);
     101        size_t cbBlkDesc = RT_UOFFSETOF_DYN(RTFILESYSTEMEXTBLKGRP, abBlockBitmap[cbBlockBitmap]);
    102102        pBlkGrpDesc = (PRTFILESYSTEMEXTBLKGRP)RTMemAllocZ(cbBlkDesc);
    103103        if (!pBlkGrpDesc)
  • trunk/src/VBox/Runtime/common/fs/fatvfs.cpp

    r72584 r73097  
    824824     */
    825825    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;
    827828    if (!pFatCache)
    828829        return RTErrInfoSet(pErrInfo, VERR_NO_MEMORY, "Failed to allocate FAT cache");
     
    25712572    { /* ObjSet */
    25722573        RTVFSOBJSETOPS_VERSION,
    2573         RT_OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),
     2574        RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj),
    25742575        rtFsFatFile_SetMode,
    25752576        rtFsFatFile_SetTimes,
     
    44124413    if (pThis->offDir < 2)
    44134414    {
    4414         size_t cbNeeded = RT_OFFSETOF(RTDIRENTRYEX, szName[pThis->offDir + 2]);
     4415        size_t cbNeeded = RT_UOFFSETOF_DYN(RTDIRENTRYEX, szName[pThis->offDir + 2]);
    44154416        if (cbNeeded < *pcbDirEntry)
    44164417            *pcbDirEntry = cbNeeded;
     
    45544555                if (!fLongName)
    45554556                    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]);
    45574558                if (cbNeeded <= *pcbDirEntry)
    45584559                    *pcbDirEntry = cbNeeded;
     
    46264627    { /* ObjSet */
    46274628        RTVFSOBJSETOPS_VERSION,
    4628         RT_OFFSETOF(RTVFSDIROPS, Obj) - RT_OFFSETOF(RTVFSDIROPS, ObjSet),
     4629        RT_UOFFSETOF(RTVFSDIROPS, ObjSet) - RT_UOFFSETOF(RTVFSDIROPS, Obj),
    46294630        rtFsFatDir_SetMode,
    46304631        rtFsFatDir_SetTimes,
     
    50315032    Assert(offFirstZero >= RT_UOFFSETOF(FATBOOTSECTOR, Bpb));
    50325033    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)));
    50345035
    50355036    if (!ASMMemIsAllU8((uint8_t const *)pBootSector + offFirstZero, cbZeroPad, 0))
     
    53875388             && pBootSector->abJmp[2] <= 0x7f)
    53885389        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);
    53905391
    53915392    /*
     
    54445445    if (   (   sizeof(FAT32EBPB) <= cbMaxBpb
    54455446            && pBootSector->Bpb.Fat32Ebpb.bExtSignature == FATEBPB_SIGNATURE)
    5446         || (   RT_OFFSETOF(FAT32EBPB, achLabel) <= cbMaxBpb
     5447        || (   RT_UOFFSETOF(FAT32EBPB, achLabel) <= cbMaxBpb
    54475448            && pBootSector->Bpb.Fat32Ebpb.bExtSignature == FATEBPB_SIGNATURE_OLD) )
    54485449    {
     
    54605461        if (   (   sizeof(FATEBPB) <= cbMaxBpb
    54615462                && pBootSector->Bpb.Ebpb.bExtSignature == FATEBPB_SIGNATURE)
    5462             || (   RT_OFFSETOF(FATEBPB, achLabel) <= cbMaxBpb
     5463            || (   RT_UOFFSETOF(FATEBPB, achLabel) <= cbMaxBpb
    54635464                && pBootSector->Bpb.Ebpb.bExtSignature == FATEBPB_SIGNATURE_OLD) )
    54645465        {
  • trunk/src/VBox/Runtime/common/fs/isomaker.cpp

    r70155 r73097  
    9999 *        is the case in rtFsIsoMakerNormalizeNameForNamespace. */
    100100#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)]) )
    102102
    103103
     
    660660} g_aRTFsIsoNamespaces[] =
    661661{
    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" },
    666666};
    667667
     
    36113611     * Do the adding.
    36123612     */
    3613     PRTFSISOMAKERSYMLINK pSymlink = (PRTFSISOMAKERSYMLINK)RTMemAllocZ(RT_UOFFSETOF(RTFSISOMAKERSYMLINK, szTarget[cchTarget + 1]));
     3613    PRTFSISOMAKERSYMLINK pSymlink = (PRTFSISOMAKERSYMLINK)RTMemAllocZ(RT_UOFFSETOF_DYN(RTFSISOMAKERSYMLINK, szTarget[cchTarget + 1]));
    36143614    AssertReturn(pSymlink, VERR_NO_MEMORY);
    36153615    int rc = rtFsIsoMakerInitCommonObj(pThis, &pSymlink->Core, RTFSISOMAKEROBJTYPE_SYMLINK, pObjInfo);
     
    58825882                size_t         cchThis = RT_MIN(cchSrc, ISO9660RRIPNM_MAX_NAME_LEN);
    58835883                PISO9660RRIPNM pNM     = (PISO9660RRIPNM)pbSys;
    5884                 Assert(cbSys >= RT_UOFFSETOF(ISO9660RRIPNM, achName[cchThis]));
     5884                Assert(cbSys >= RT_UOFFSETOF_DYN(ISO9660RRIPNM, achName[cchThis]));
    58855885                pNM->Hdr.bSig1      = ISO9660RRIPNM_SIG1;
    58865886                pNM->Hdr.bSig2      = ISO9660RRIPNM_SIG2;
     
    73797379    { /* ObjSet */
    73807380        RTVFSOBJSETOPS_VERSION,
    7381         RT_OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),
     7381        RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj),
    73827382        NULL /*SetMode*/,
    73837383        NULL /*SetTimes*/,
  • trunk/src/VBox/Runtime/common/fs/isomakerimport.cpp

    r71013 r73097  
    732732                    || pUnion->SP.bCheck1   != ISO9660SUSPSP_CHECK1
    733733                    || 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]))
    735735                    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",
    736736                            pUnion->Hdr.cbEntry, ISO9660SUSPSP_LEN, pUnion->Hdr.bVersion, ISO9660SUSPSP_VER,
    737737                            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]) ));
    739739                else if (!fIsFirstDirRec)
    740740                    LogRel(("rtFsIsoImport/Rock: Ignorining 'SP' entry in non-root directory record\n"));
     
    750750
    751751            case MAKE_SIG(ISO9660SUSPER_SIG1, ISO9660SUSPER_SIG2): /* ER */
    752                 if (   pUnion->Hdr.cbEntry >   RT_OFFSETOF(ISO9660SUSPER, achPayload) + (uint32_t)pUnion->ER.cchIdentifier
     752                if (   pUnion->Hdr.cbEntry >   RT_UOFFSETOF(ISO9660SUSPER, achPayload) + (uint32_t)pUnion->ER.cchIdentifier
    753753                                             + (uint32_t)pUnion->ER.cchDescription   + (uint32_t)pUnion->ER.cchSource
    754754                    || pUnion->Hdr.bVersion != ISO9660SUSPER_VER)
     
    914914            case MAKE_SIG(ISO9660RRIPSL_SIG1, ISO9660RRIPSL_SIG2): /* SL */
    915915                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])
    917917                    || (pUnion->SL.fFlags & ~ISO9660RRIP_SL_F_CONTINUE)
    918918                    || (pUnion->SL.abComponents[0] & ISO9660RRIP_SL_C_RESERVED_MASK) )
    919919                    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]),
    921921                            pUnion->SL.Hdr.bVersion, ISO9660RRIPSL_VER, pUnion->SL.fFlags, pUnion->SL.abComponents[0]));
    922922                else if (pThis->fSeenLastSL)
     
    928928                    size_t         offDst    = strlen(pThis->szRockSymlinkTargetBuf);
    929929                    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);
    931931                    while (cbSrcLeft >= 2)
    932932                    {
     
    10191019            case MAKE_SIG(ISO9660RRIPNM_SIG1, ISO9660RRIPNM_SIG2): /* NM */
    10201020                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)
    10221022                    || (pUnion->NM.fFlags & ISO9660RRIP_NM_F_RESERVED_MASK) )
    10231023                    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),
    10251025                            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)),
    10271027                            &pUnion->NM.achName[0] ));
    10281028                else if (pThis->fSeenLastNM)
     
    10321032                    pThis->fSeenLastNM = !(pUnion->NM.fFlags & ISO9660RRIP_NM_F_CONTINUE);
    10331033
    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);
    10351035                    if (pUnion->NM.fFlags & (ISO9660RRIP_NM_F_CURRENT | ISO9660RRIP_NM_F_PARENT))
    10361036                    {
     
    11631163                               ISO9660_GET_ENDIAN(&pDirRec->offExtent), pThis->cBlocksInPrimaryVolumeSpace);
    11641164
    1165     if (pDirRec->cbDirRec < RT_OFFSETOF(ISO9660DIRREC, achFileId) + pDirRec->bFileIdLength)
     1165    if (pDirRec->cbDirRec < RT_UOFFSETOF(ISO9660DIRREC, achFileId) + pDirRec->bFileIdLength)
    11661166        return rtFsIsoImpError(pThis, VERR_ISOMK_IMPORT_BAD_DIR_REC_LENGTH,
    11671167                               "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);
    11691169    if (pDirRec->cbDirRec > cbMax)
    11701170        return rtFsIsoImpError(pThis, VERR_ISOMK_IMPORT_BAD_DIR_REC_LENGTH,
     
    18301830                               ISO9660_GET_ENDIAN(&pDirRec->offExtent), pThis->cBlocksInPrimaryVolumeSpace);
    18311831
    1832     if (pDirRec->cbDirRec < RT_OFFSETOF(ISO9660DIRREC, achFileId))
     1832    if (pDirRec->cbDirRec < RT_UOFFSETOF(ISO9660DIRREC, achFileId))
    18331833        return rtFsIsoImpError(pThis, VERR_ISOMK_IMPORT_BAD_ROOT_DIR_REC_LENGTH,
    18341834                               "Root dir record size is too small: %#x (min %#x)",
    1835                                pDirRec->cbDirRec, RT_OFFSETOF(ISO9660DIRREC, achFileId));
     1835                               pDirRec->cbDirRec, RT_UOFFSETOF(ISO9660DIRREC, achFileId));
    18361836
    18371837    if (!(pDirRec->fFileFlags & ISO9660_FILE_FLAGS_DIRECTORY))
  • trunk/src/VBox/Runtime/common/fs/isovfs.cpp

    r69977 r73097  
    12291229     * Basic sanity checking of what we use.
    12301230     */
    1231     if (     RT_OFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs + pFileEntry->cbAllocDescs
     1231    if (     RT_UOFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs + pFileEntry->cbAllocDescs
    12321232           > pVol->Udf.VolInfo.cbBlock
    12331233        || (pFileEntry->cbExtAttribs & 3) != 0
     
    12751275                                                idxDefaultPart,
    12761276                                                  ((uint64_t)pFileEntry->Tag.offTag << pVol->Udf.VolInfo.cShiftBlock)
    1277                                                 + RT_OFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs,
     1277                                                + RT_UOFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs,
    12781278                                                pVol);
    12791279        if (RT_SUCCESS(rc))
     
    13811381     * Basic sanity checking of what we use.
    13821382     */
    1383     if (     RT_OFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs + pFileEntry->cbAllocDescs
     1383    if (     RT_UOFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs + pFileEntry->cbAllocDescs
    13841384           > pVol->Udf.VolInfo.cbBlock
    13851385        || (pFileEntry->cbExtAttribs & 3) != 0
     
    14311431                                                idxDefaultPart,
    14321432                                                  ((uint64_t)pFileEntry->Tag.offTag << pVol->Udf.VolInfo.cShiftBlock)
    1433                                                 + RT_OFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs,
     1433                                                + RT_UOFFSETOF(UDFFILEENTRY, abExtAttribs) + pFileEntry->cbExtAttribs,
    14341434                                                pVol);
    14351435        if (RT_SUCCESS(rc))
     
    21532153    { /* ObjSet */
    21542154        RTVFSOBJSETOPS_VERSION,
    2155         RT_OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),
     2155        RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj),
    21562156        NULL /*SetMode*/,
    21572157        NULL /*SetTimes*/,
     
    34303430    { /* ObjSet */
    34313431        RTVFSOBJSETOPS_VERSION,
    3432         RT_OFFSETOF(RTVFSDIROPS, Obj) - RT_OFFSETOF(RTVFSDIROPS, ObjSet),
     3432        RT_UOFFSETOF(RTVFSDIROPS, ObjSet) - RT_UOFFSETOF(RTVFSDIROPS, Obj),
    34333433        NULL /*SetMode*/,
    34343434        NULL /*SetTimes*/,
     
    35493549                  wszName));
    35503550
    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);
    35523553            if (offSysUse < pDirRec->cbDirRec)
    35533554            {
     
    36313632    {
    36323633        uint32_t offDesc = 0;
    3633         while (offDesc + RT_OFFSETOF(UDFFILEIDDESC, abImplementationUse) < pThis->cbDir)
     3634        while (offDesc + RT_UOFFSETOF(UDFFILEIDDESC, abImplementationUse) < pThis->cbDir)
    36343635        {
    36353636            PCUDFFILEIDDESC pFid  = (PCUDFFILEIDDESC)&pThis->pbDir[offDesc];
     
    53685369        Log2(("ISO9660:  RootDir.RecTime.bFileIdLength:      %RX8\n", pVolDesc->RootDir.DirRec.bFileIdLength));
    53695370        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])
    53715372                           + !(pVolDesc->RootDir.DirRec.bFileIdLength & 1);
    53725373        if (offSysUse < pVolDesc->RootDir.DirRec.cbDirRec)
     
    53925393                                   PISO9660DIRREC pDstRootDir, PRTERRINFO pErrInfo)
    53935394{
    5394     if (pRootDir->cbDirRec < RT_OFFSETOF(ISO9660DIRREC, achFileId))
     5395    if (pRootDir->cbDirRec < RT_UOFFSETOF(ISO9660DIRREC, achFileId))
    53955396        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));
    53975398
    53985399    if (!(pRootDir->fFileFlags & ISO9660_FILE_FLAGS_DIRECTORY))
     
    54945495     * ... and the root directory record.
    54955496     */
    5496     *poffRootDirRec = offVolDesc + RT_OFFSETOF(ISO9660PRIMARYVOLDESC, RootDir.DirRec);
     5497    *poffRootDirRec = offVolDesc + RT_UOFFSETOF(ISO9660PRIMARYVOLDESC, RootDir.DirRec);
    54975498    return rtFsIsoVolHandleRootDir(pThis, &pVolDesc->RootDir.DirRec, pRootDir, pErrInfo);
    54985499}
     
    55715572    if (RT_SUCCESS(rc))
    55725573    {
    5573         *poffRootDirRec = offVolDesc + RT_OFFSETOF(ISO9660SUPVOLDESC, RootDir.DirRec);
     5574        *poffRootDirRec = offVolDesc + RT_UOFFSETOF(ISO9660SUPVOLDESC, RootDir.DirRec);
    55745575        *pbUcs2Level    = pVolDesc->abEscapeSequences[2] == ISO9660_JOLIET_ESC_SEQ_2_LEVEL_1 ? 1
    55755576                        : pVolDesc->abEscapeSequences[2] == ISO9660_JOLIET_ESC_SEQ_2_LEVEL_2 ? 2 : 3;
  • trunk/src/VBox/Runtime/common/fs/ntfsvfs.cpp

    r72585 r73097  
    764764                                    Log2(("NTFS:     cwcFilename        %#x\n", pInfo->cwcFilename));
    765765                                    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)
    767767                                        Log2(("NTFS:     wszFilename       '%.*ls'\n", pInfo->cwcFilename, pInfo->wszFilename ));
    768768                                    else
     
    770770                                }
    771771                                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) ));
    774774                                break;
    775775                            }
     
    21382138        if (   pFilename
    21392139            && pFilename->cwcFilename >= 4
    2140             && RT_UOFFSETOF(NTFSATFILENAME, wszFilename[pFilename->cwcFilename]) <= cbFilename)
     2140            && RT_UOFFSETOF_DYN(NTFSATFILENAME, wszFilename[pFilename->cwcFilename]) <= cbFilename)
    21412141        {
    21422142            PCRTUTF16 pwcExt = &pFilename->wszFilename[pFilename->cwcFilename - 4];
     
    26182618    { /* ObjSet */
    26192619        RTVFSOBJSETOPS_VERSION,
    2620         RT_OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),
     2620        RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj),
    26212621        rtFsNtfsFile_SetMode,
    26222622        rtFsNtfsFile_SetTimes,
     
    28202820            Log2(("NTFS:             cwcFilename        %#x\n", pFilename->cwcFilename));
    28212821            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))
    28232823                Log2(("NTFS:             wszFilename       '%.*ls'\n", pFilename->cwcFilename, pFilename->wszFilename ));
    28242824            else
     
    29802980        {
    29812981            PCNTFSATFILENAME pFilename = (PCNTFSATFILENAME)(pEntryHdr + 1);
    2982             if (RT_UOFFSETOF(NTFSATFILENAME, wszFilename[pFilename->cwcFilename]) > cbKey)
     2982            if (RT_UOFFSETOF_DYN(NTFSATFILENAME, wszFilename[pFilename->cwcFilename]) > cbKey)
    29832983                return RTERRINFO_LOG_REL_SET_F(pErrInfo, VERR_VFS_BOGUS_FORMAT,
    29842984                                               "%s: Entry #%u filename is out of bounds: cwcFilename=%#x -> %#x key, max %#x",
    29852985                                               pszWhat, iEntry, pFilename->cwcFilename,
    2986                                                RT_UOFFSETOF(NTFSATFILENAME, wszFilename[pFilename->cwcFilename]), cbKey);
     2986                                               RT_UOFFSETOF_DYN(NTFSATFILENAME, wszFilename[pFilename->cwcFilename]), cbKey);
    29872987        }
    29882988
     
    41634163        {
    41644164
    4165             *pcbDirEntry = RT_UOFFSETOF(RTDIRENTRYEX, szName[pThis->paEnumStack[0].iNext + 2]);
     4165            *pcbDirEntry = RT_UOFFSETOF_DYN(RTDIRENTRYEX, szName[pThis->paEnumStack[0].iNext + 2]);
    41664166            if (*pcbDirEntry > cbDirEntry)
    41674167                return VERR_BUFFER_OVERFLOW;
     
    42554255                                rc, pFilename->cwcFilename * sizeof(RTUTF16), pFilename->wszFilename));
    42564256                    }
    4257                     *pcbDirEntry = RT_UOFFSETOF(RTDIRENTRYEX, szName[cchFilename + 1]);
     4257                    *pcbDirEntry = RT_UOFFSETOF_DYN(RTDIRENTRYEX, szName[cchFilename + 1]);
    42584258                    if (*pcbDirEntry > cbDirEntry)
    42594259                    {
     
    44034403    { /* ObjSet */
    44044404        RTVFSOBJSETOPS_VERSION,
    4405         RT_OFFSETOF(RTVFSDIROPS, Obj) - RT_OFFSETOF(RTVFSDIROPS, ObjSet),
     4405        RT_UOFFSETOF(RTVFSDIROPS, ObjSet) - RT_UOFFSETOF(RTVFSDIROPS, Obj),
    44064406        rtFsNtfsDir_SetMode,
    44074407        rtFsNtfsDir_SetTimes,
  • trunk/src/VBox/Runtime/common/fuzz/fuzz-observer.cpp

    r72942 r73097  
    439439{
    440440    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]));
    442442    if (RT_LIKELY(pExecCtx))
    443443    {
  • trunk/src/VBox/Runtime/common/fuzz/fuzz.cpp

    r72946 r73097  
    333333static PRTFUZZINPUTINT rtFuzzCtxInputClone(PRTFUZZCTXINT pThis, const void *pvBuf, size_t cbBuf)
    334334{
    335     PRTFUZZINPUTINT pInpClone = (PRTFUZZINPUTINT)RTMemAllocZ(RT_OFFSETOF(RTFUZZINPUTINT, abInput[cbBuf]));
     335    PRTFUZZINPUTINT pInpClone = (PRTFUZZINPUTINT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTFUZZINPUTINT, abInput[cbBuf]));
    336336    if (RT_LIKELY(pInpClone))
    337337    {
     
    355355static PRTFUZZINPUTINT rtFuzzCtxInputCreate(PRTFUZZCTXINT pThis, size_t cbInput)
    356356{
    357     PRTFUZZINPUTINT pInput = (PRTFUZZINPUTINT)RTMemAllocZ(RT_OFFSETOF(RTFUZZINPUTINT, abInput[cbInput]));
     357    PRTFUZZINPUTINT pInput = (PRTFUZZINPUTINT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTFUZZINPUTINT, abInput[cbInput]));
    358358    if (RT_LIKELY(pInput))
    359359    {
     
    846846    if (!pInput)
    847847    {
    848         pInput = (PRTFUZZINPUTINT)RTMemAllocZ(RT_OFFSETOF(RTFUZZINPUTINT, abInput[cbInput]));
     848        pInput = (PRTFUZZINPUTINT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTFUZZINPUTINT, abInput[cbInput]));
    849849        if (RT_LIKELY(pInput))
    850850        {
     
    897897    if (RT_SUCCESS(rc))
    898898    {
    899         PRTFUZZINPUTINT pInput = (PRTFUZZINPUTINT)RTMemAllocZ(RT_OFFSETOF(RTFUZZINPUTINT, abInput[cbFile]));
     899        PRTFUZZINPUTINT pInput = (PRTFUZZINPUTINT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTFUZZINPUTINT, abInput[cbFile]));
    900900        if (RT_LIKELY(pInput))
    901901        {
  • trunk/src/VBox/Runtime/common/ldr/ldrEx.cpp

    r69111 r73097  
    9595    if (uSign.au16[0] == IMAGE_DOS_SIGNATURE)
    9696    {
    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));
    9898        if (RT_FAILURE(rc))
    9999            return rc;
  • trunk/src/VBox/Runtime/common/ldr/ldrPE.cpp

    r70313 r73097  
    11341134                 * Enough buffer?
    11351135                 */
    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]);
    11371137                if (cbNeeded > cbInfo)
    11381138                    return VERR_BUFFER_OVERFLOW;
     
    15191519                            {
    15201520                                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),
    15221522                                                     &pszPath, RTPATH_MAX, NULL);
    15231523                                if (RT_SUCCESS(rc))
     
    21412141    pPlaces->offCksum       = (uint32_t)pModPe->offNtHdrs
    21422142                            + (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));
    21452145    pPlaces->cbCksum        = RT_SIZEOFMEMB(IMAGE_NT_HEADERS32, OptionalHeader.CheckSum);
    21462146    pPlaces->offSecDir      = (uint32_t)pModPe->offNtHdrs
    21472147                            + (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]));
    21502150    pPlaces->cbSecDir       = sizeof(IMAGE_DATA_DIRECTORY);
    21512151    pPlaces->offEndSpecial  = pPlaces->offSecDir + pPlaces->cbSecDir;
     
    24602460    RTAsn1CursorInitPrimary(&PrimaryCursor,
    24612461                            &pEntry->bCertificate[0],
    2462                             pEntry->dwLength - RT_OFFSETOF(WIN_CERTIFICATE, bCertificate),
     2462                            pEntry->dwLength - RT_UOFFSETOF(WIN_CERTIFICATE, bCertificate),
    24632463                            pErrInfo,
    24642464                            &g_RTAsn1DefaultAllocator,
     
    29852985
    29862986    /* 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]) + 16
    2989            ==   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]));
    29902990    uint32_t volatile       *pu32Dst     = (uint32_t *)&pOptHdr64->DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] - 1;
    29912991    const uint32_t volatile *pu32Src     = (uint32_t *)&pOptHdr32->DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] - 1;
     
    30053005     * other since this is all declared volatile, but taking now chances, we'll use a temp variable.
    30063006     */
    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));
    30103010    uint32_t u32ImageBase = pOptHdr32->ImageBase;
    30113011    pOptHdr64->ImageBase = u32ImageBase;
     
    30663066    pLoadCfg64->DeCommitFreeBlockThreshold      = u32DeCommitFreeBlockThreshold;
    30673067    /* 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));
    30703070}
    30713071
     
    38983898                    pModPe->offPkcs7SignedData = Dir.VirtualAddress
    38993899                                               + (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);
    39013901                }
    39023902
  • trunk/src/VBox/Runtime/common/ldr/ldrVfsFile.cpp

    r70309 r73097  
    189189    size_t cbFilename = strlen(pszFilename) + 1;
    190190    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]));
    192192    if (pFileReader)
    193193    {
  • trunk/src/VBox/Runtime/common/log/log.cpp

    r72863 r73097  
    213213# ifdef IN_RING3
    214214/** 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)
    216216AssertCompileMemberAlignment(RTLOGGERINTERNAL, hFile, sizeof(void *));
    217217AssertCompileMemberAlignment(RTLOGGERINTERNAL, cbHistoryFileMax, sizeof(uint64_t));
     
    809809     * Allocate a logger instance.
    810810     */
    811     offInternal = RT_OFFSETOF(RTLOGGER, afGroups[cGroups]);
     811    offInternal = RT_UOFFSETOF_DYN(RTLOGGER, afGroups[cGroups]);
    812812    offInternal = RT_ALIGN_Z(offInternal, sizeof(uint64_t));
    813813    cbLogger = offInternal + sizeof(RTLOGGERINTERNAL);
     
    11941194     * Check if there's enough space for the groups.
    11951195     */
    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));
    11991199        return VERR_BUFFER_OVERFLOW;
    12001200    }
     
    13491349RTDECL(size_t) RTLogCalcSizeForR0(uint32_t cGroups, uint32_t fFlags)
    13501350{
    1351     size_t cb = RT_OFFSETOF(RTLOGGER, afGroups[cGroups]);
     1351    size_t cb = RT_UOFFSETOF_DYN(RTLOGGER, afGroups[cGroups]);
    13521352    cb = RT_ALIGN_Z(cb, sizeof(uint64_t));
    13531353    cb += sizeof(RTLOGGERINTERNAL);
     
    13941394    {
    13951395        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));
    13971397        rc = VERR_INVALID_PARAMETER;
    13981398        cGroups = pDstInt->cMaxGroups;
  • trunk/src/VBox/Runtime/common/log/tracebuf.cpp

    r69111 r73097  
    265265    pszBuf  = &pEntry->szMsg[0]; \
    266266    *pszBuf = '\0'; \
    267     cchBuf  = pThis->cbEntry - RT_OFFSETOF(RTTRACEBUFENTRY, szMsg) - 1; \
     267    cchBuf  = pThis->cbEntry - RT_UOFFSETOF(RTTRACEBUFENTRY, szMsg) - 1; \
    268268    rc      = VINF_SUCCESS
    269269
  • trunk/src/VBox/Runtime/common/log/tracelogreader.cpp

    r71502 r73097  
    820820        {
    821821            /* 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]);
    823823            PRTTRACELOGRDREVTDESC pEvtDescInt = (PRTTRACELOGRDREVTDESC)RTMemAllocZ(cbEvtDesc);
    824824            if (RT_LIKELY(pEvtDesc))
     
    999999                && pEvtStrm->cRawEvtDataSz == pEvtDesc->cRawDataNonStatic))
    10001000        {
    1001             size_t cbEvt = RT_OFFSETOF(RTTRACELOGRDREVTINT, abEvtData[pEvtStrm->cbEvtData]);
     1001            size_t cbEvt = RT_UOFFSETOF_DYN(RTTRACELOGRDREVTINT, abEvtData[pEvtStrm->cbEvtData]);
    10021002            cbEvt += pEvtDesc->cRawDataNonStatic * sizeof(size_t);
    10031003            PRTTRACELOGRDREVTINT pEvt = (PRTTRACELOGRDREVTINT)RTMemAllocZ(cbEvt);
  • trunk/src/VBox/Runtime/common/log/tracelogwriter.cpp

    r72309 r73097  
    137137static size_t rtTraceLogWrtEvtDescGetSz(PCRTTRACELOGEVTDESC pEvtDesc)
    138138{
    139     size_t cbAlloc = RT_OFFSETOF(RTTRACELOGWREVTDESC, aEvtItemDesc[pEvtDesc->cEvtItems]);
     139    size_t cbAlloc = RT_UOFFSETOF_DYN(RTTRACELOGWREVTDESC, aEvtItemDesc[pEvtDesc->cEvtItems]);
    140140
    141141    cbAlloc += strlen(pEvtDesc->pszId) + 1;
  • trunk/src/VBox/Runtime/common/path/RTPathGlob.cpp

    r69753 r73097  
    14751475    if (pGlob->cResults < RTPATHGLOB_MAX_RESULTS)
    14761476    {
    1477         PRTPATHGLOBENTRY pEntry = (PRTPATHGLOBENTRY)RTMemAlloc(RT_OFFSETOF(RTPATHGLOBENTRY, szPath[cchPath + 1]));
     1477        PRTPATHGLOBENTRY pEntry = (PRTPATHGLOBENTRY)RTMemAlloc(RT_UOFFSETOF_DYN(RTPATHGLOBENTRY, szPath[cchPath + 1]));
    14781478        if (pEntry)
    14791479        {
     
    15151515    if (pGlob->cResults < RTPATHGLOB_MAX_RESULTS)
    15161516    {
    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]));
    15181518        if (pEntry)
    15191519        {
     
    15591559    if (pGlob->cResults < RTPATHGLOB_MAX_RESULTS)
    15601560    {
    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]));
    15621562        if (pEntry)
    15631563        {
     
    20832083     * Parse the path.
    20842084     */
    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 */
    20862086    PRTPATHPARSED pParsed = (PRTPATHPARSED)RTMemTmpAlloc(cbParsed);
    20872087    AssertReturn(pParsed, VERR_NO_MEMORY);
     
    20892089    if (rc == VERR_BUFFER_OVERFLOW)
    20902090    {
    2091         cbParsed = RT_OFFSETOF(RTPATHPARSED, aComps[pParsed->cComps + 1]);
     2091        cbParsed = RT_UOFFSETOF_DYN(RTPATHPARSED, aComps[pParsed->cComps + 1]);
    20922092        RTMemTmpFree(pParsed);
    20932093        pParsed = (PRTPATHPARSED)RTMemTmpAlloc(cbParsed);
     
    21122112             * Allocate and initialize the glob state data structure.
    21132113             */
    2114             size_t      cbGlob = RT_OFFSETOF(RTPATHGLOB, aComps[pParsed->cComps + 1]);
     2114            size_t      cbGlob = RT_UOFFSETOF_DYN(RTPATHGLOB, aComps[pParsed->cComps + 1]);
    21152115            PRTPATHGLOB pGlob  = (PRTPATHGLOB)RTMemTmpAllocZ(cbGlob);
    21162116            if (pGlob)
  • trunk/src/VBox/Runtime/common/path/RTPathSplit.cpp

    r69111 r73097  
    7373    uint16_t const  cchPath   = pParsedVolatile->cchPath;
    7474    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])
    7676                              + cchPath
    7777                              + RTPATH_PROP_FIRST_NEEDS_NO_SLASH(fProps) /* zero terminator for root spec. */
  • trunk/src/VBox/Runtime/common/path/RTPathSplitA.cpp

    r69111 r73097  
    4949     */
    5050    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;
    5252    cbSplit = RT_ALIGN(cbSplit, 64);
    5353    PRTPATHSPLIT pSplit = (PRTPATHSPLIT)RTMemAllocTag(cbSplit, pszTag);
  • trunk/src/VBox/Runtime/common/string/strcache.cpp

    r69111 r73097  
    668668     * here to encourage the heap to give us optimal alignment.
    669669     */
    670     size_t              cbEntry   = RT_UOFFSETOF(RTSTRCACHEBIGENTRY, Core.szString[cchString + 1]);
     670    size_t              cbEntry   = RT_UOFFSETOF_DYN(RTSTRCACHEBIGENTRY, Core.szString[cchString + 1]);
    671671    PRTSTRCACHEBIGENTRY pBigEntry = (PRTSTRCACHEBIGENTRY)RTMemAlloc(RT_ALIGN_Z(cbEntry, RTSTRCACHE_HEAP_ENTRY_SIZE_ALIGN));
    672672    if (!pBigEntry)
     
    780780    *pcCollisions = 0;
    781781
    782     uint16_t cchStringFirst = RT_UOFFSETOF(RTSTRCACHEENTRY, szString[cchString + 1]) < RTSTRCACHE_HEAP_THRESHOLD
     782    uint16_t cchStringFirst = RT_UOFFSETOF_DYN(RTSTRCACHEENTRY, szString[cchString + 1]) < RTSTRCACHE_HEAP_THRESHOLD
    783783                            ? (uint16_t)cchString : RTSTRCACHEENTRY_BIG_LEN;
    784784    uint32_t iHash          = uHashLen % pThis->cHashTab;
     
    11341134        PRTSTRCACHEBIGENTRY pBigStr = RT_FROM_MEMBER(pStr, RTSTRCACHEBIGENTRY, Core);
    11351135        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]),
    11371137                                           RTSTRCACHE_HEAP_ENTRY_SIZE_ALIGN);
    11381138
  • trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp

    r71826 r73097  
    9191    do { \
    9292        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)); \
    9494        Assert((pDirOps)->uVersion == RTVFSDIROPS_VERSION); \
    9595        Assert(!(pDirOps)->fReserved); \
     
    126126    do { \
    127127        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)); \
    129129        Assert((pSymlinkOps)->uVersion == RTVFSSYMLINKOPS_VERSION); \
    130130        Assert(!(pSymlinkOps)->fReserved); \
     
    31703170        cbDirEntry = *pcbDirEntry;
    31713171        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])),
    31733173                        VERR_INVALID_PARAMETER);
    31743174    }
  • trunk/src/VBox/Runtime/common/vfs/vfsfss2dir.cpp

    r67186 r73097  
    222222        size_t const            cbRelativePath = strlen(pszPath);
    223223        PRTVFSFSSWRITE2DIRENTRY pEntry;
    224         pEntry = (PRTVFSFSSWRITE2DIRENTRY)RTMemAllocVar(RT_UOFFSETOF(RTVFSFSSWRITE2DIRENTRY, szName[cbRelativePath]));
     224        pEntry = (PRTVFSFSSWRITE2DIRENTRY)RTMemAllocVar(RT_UOFFSETOF_DYN(RTVFSFSSWRITE2DIRENTRY, szName[cbRelativePath]));
    225225        if (pEntry)
    226226        {
     
    369369                PRTVFSFSSWRITE2DIR      pThis;
    370370                RTVFSFSSTREAM           hVfsFss;
    371                 rc = RTVfsNewFsStream(&g_rtVfsFssToDirOps, RT_UOFFSETOF(RTVFSFSSWRITE2DIR, szBaseDir[cbBaseDir]),
     371                rc = RTVfsNewFsStream(&g_rtVfsFssToDirOps, RT_UOFFSETOF_DYN(RTVFSFSSWRITE2DIR, szBaseDir[cbBaseDir]),
    372372                                      NIL_RTVFS, NIL_RTVFSLOCK, false /*fReadOnly*/, &hVfsFss, (void **)&pThis);
    373373                if (RT_SUCCESS(rc))
  • trunk/src/VBox/Runtime/common/vfs/vfsmemory.cpp

    r69977 r73097  
    421421     * Allocate, initialize and insert the new extent.
    422422     */
    423     PRTVFSMEMEXTENT pNew = (PRTVFSMEMEXTENT)RTMemAllocZ(RT_OFFSETOF(RTVFSMEMEXTENT, abData[cbExtent]));
     423    PRTVFSMEMEXTENT pNew = (PRTVFSMEMEXTENT)RTMemAllocZ(RT_UOFFSETOF_DYN(RTVFSMEMEXTENT, abData[cbExtent]));
    424424    if (pNew)
    425425    {
     
    731731    { /* ObjSet */
    732732        RTVFSOBJSETOPS_VERSION,
    733         RT_OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),
     733        RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj),
    734734        rtVfsMemFile_SetMode,
    735735        rtVfsMemFile_SetTimes,
  • trunk/src/VBox/Runtime/common/vfs/vfsmount.cpp

    r69861 r73097  
    238238        Assert(offFirstZero >= RT_UOFFSETOF(FATBOOTSECTOR, Bpb));
    239239        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)));
    241241
    242242        if (!ASMMemIsAllU8((uint8_t const *)pBootSector + offFirstZero, cbZeroPad, 0))
     
    266266                 && pBootSector->abJmp[2] <= 0x7f)
    267267            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);
    269269        if (cbMaxBpb < sizeof(FATBPB20))
    270270        {
  • trunk/src/VBox/Runtime/common/vfs/vfsprogress.cpp

    r69977 r73097  
    456456    { /* ObjSet */
    457457        RTVFSOBJSETOPS_VERSION,
    458         RT_OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),
     458        RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj),
    459459        rtVfsProgressFile_SetMode,
    460460        rtVfsProgressFile_SetTimes,
  • trunk/src/VBox/Runtime/common/vfs/vfsreadahead.cpp

    r69977 r73097  
    579579    { /* ObjSet */
    580580        RTVFSOBJSETOPS_VERSION,
    581         RT_OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),
     581        RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj),
    582582        rtVfsReadAhead_SetMode,
    583583        rtVfsReadAhead_SetTimes,
     
    733733        RTVFSIOSTREAM   hVfsIosReadAhead  = NIL_RTVFSIOSTREAM;
    734734        PRTVFSREADAHEAD pThis;
    735         size_t          cbThis = RT_OFFSETOF(RTVFSREADAHEAD, aBufDescs[cBuffers]);
     735        size_t          cbThis = RT_UOFFSETOF_DYN(RTVFSREADAHEAD, aBufDescs[cBuffers]);
    736736        if (hVfsFileSrc != NIL_RTVFSFILE)
    737737            rc = RTVfsNewFile(&g_VfsReadAheadFileOps, cbThis, RTFILE_O_READ, NIL_RTVFS, NIL_RTVFSLOCK,
  • trunk/src/VBox/Runtime/common/vfs/vfsstddir.cpp

    r69826 r73097  
    171171    { /* ObjSet */
    172172        RTVFSOBJSETOPS_VERSION,
    173         RT_OFFSETOF(RTVFSSYMLINKOPS, Obj) - RT_OFFSETOF(RTVFSSYMLINKOPS, ObjSet),
     173        RT_UOFFSETOF(RTVFSSYMLINKOPS, ObjSet) - RT_UOFFSETOF(RTVFSSYMLINKOPS, Obj),
    174174        rtVfsStdSym_SetMode,
    175175        rtVfsStdSym_SetTimes,
     
    363363                        PRTVFSSTDSYMLINK pNewSymlink;
    364364                        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]),
    366366                                             NIL_RTVFS, NIL_RTVFSLOCK, &hVfsSymlink, (void **)&pNewSymlink);
    367367                        if (RT_SUCCESS(rc))
     
    540540                PRTVFSSTDSYMLINK pNewSymlink;
    541541                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]),
    543543                                     NIL_RTVFS, NIL_RTVFSLOCK, phVfsSymlink, (void **)&pNewSymlink);
    544544                if (RT_SUCCESS(rc))
     
    673673    { /* ObjSet */
    674674        RTVFSOBJSETOPS_VERSION,
    675         RT_OFFSETOF(RTVFSDIROPS, Obj) - RT_OFFSETOF(RTVFSDIROPS, ObjSet),
     675        RT_UOFFSETOF(RTVFSDIROPS, ObjSet) - RT_UOFFSETOF(RTVFSDIROPS, Obj),
    676676        rtVfsStdDir_SetMode,
    677677        rtVfsStdDir_SetTimes,
  • trunk/src/VBox/Runtime/common/vfs/vfsstdfile.cpp

    r69977 r73097  
    450450    { /* ObjSet */
    451451        RTVFSOBJSETOPS_VERSION,
    452         RT_OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),
     452        RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj),
    453453        rtVfsStdFile_SetMode,
    454454        rtVfsStdFile_SetTimes,
  • trunk/src/VBox/Runtime/common/zip/pkzipvfs.cpp

    r69111 r73097  
    717717                {
    718718                    /* sanity check */
    719                     if (off + RT_OFFSETOF(RTZIPPKZIPENDOFCENTRDIRREC, u8Comment) + eocd.cbComment == cbFile)
     719                    if (off + RT_UOFFSETOF(RTZIPPKZIPENDOFCENTRDIRREC, u8Comment) + eocd.cbComment == cbFile)
    720720                    {
    721721                        pThis->offFirstCdh = eocd.offCentrDir;
  • trunk/src/VBox/Runtime/common/zip/tarvfs.cpp

    r69219 r73097  
    11911191    { /* ObjSet */
    11921192        RTVFSOBJSETOPS_VERSION,
    1193         RT_OFFSETOF(RTVFSSYMLINKOPS, Obj) - RT_OFFSETOF(RTVFSSYMLINKOPS, ObjSet),
     1193        RT_UOFFSETOF(RTVFSSYMLINKOPS, ObjSet) - RT_UOFFSETOF(RTVFSSYMLINKOPS, Obj),
    11941194        rtZipTarFssSym_SetMode,
    11951195        rtZipTarFssSym_SetTimes,
  • trunk/src/VBox/Runtime/common/zip/tarvfswriter.cpp

    r69977 r73097  
    819819    { /* ObjSet */
    820820        RTVFSOBJSETOPS_VERSION,
    821         RT_OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),
     821        RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj),
    822822        rtZipTarWriterPush_SetMode,
    823823        rtZipTarWriterPush_SetTimes,
  • trunk/src/VBox/Runtime/common/zip/xarvfs.cpp

    r69977 r73097  
    11631163    { /* ObjSet */
    11641164        RTVFSOBJSETOPS_VERSION,
    1165         RT_OFFSETOF(RTVFSFILEOPS, Stream.Obj) - RT_OFFSETOF(RTVFSFILEOPS, ObjSet),
     1165        RT_UOFFSETOF(RTVFSFILEOPS, ObjSet) - RT_UOFFSETOF(RTVFSFILEOPS, Stream.Obj),
    11661166        rtZipXarFssFile_SetMode,
    11671167        rtZipXarFssFile_SetTimes,
     
    14331433    { /* ObjSet */
    14341434        RTVFSOBJSETOPS_VERSION,
    1435         RT_OFFSETOF(RTVFSSYMLINKOPS, Obj) - RT_OFFSETOF(RTVFSSYMLINKOPS, ObjSet),
     1435        RT_UOFFSETOF(RTVFSSYMLINKOPS, ObjSet) - RT_UOFFSETOF(RTVFSSYMLINKOPS, Obj),
    14361436        rtZipXarFssSym_SetMode,
    14371437        rtZipXarFssSym_SetTimes,
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette