VirtualBox

儲存庫 vbox 的更動 66080


忽略:
時間撮記:
2017-3-14 上午10:42:55 (8 年 以前)
作者:
vboxsync
訊息:

iprt/manifest2.cpp: Use RT_FLEXIBLE_ARRAY and RT_FLEXIBLE_ARRAY_NESTED.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Runtime/common/checksum/manifest2.cpp

    r62564 r66080  
    6565    bool                fVisited;
    6666    /** The normalized property name that StrCore::pszString points at. */
    67     char                szName[1];
     67    char                szName[RT_FLEXIBLE_ARRAY];
    6868} RTMANIFESTATTR;
    6969/** Pointer to a manifest attribute. */
     
    8686    bool                fVisited;
    8787    /** The normalized entry name that StrCore::pszString points at. */
    88     char                szName[1];
     88    char                szName[RT_FLEXIBLE_ARRAY_NESTED];
    8989} RTMANIFESTENTRY;
    9090/** Pointer to a manifest entry. */
     
    193193    AssertPtr(phManifest);
    194194
    195     RTMANIFESTINT *pThis = (RTMANIFESTINT *)RTMemAlloc(sizeof(*pThis));
     195    RTMANIFESTINT *pThis = (RTMANIFESTINT *)RTMemAlloc(RT_UOFFSETOF(RTMANIFESTINT, SelfEntry.szName[1]));
    196196    if (!pThis)
    197197        return VERR_NO_MEMORY;
     
    698698    else
    699699    {
    700         size_t         cbName = strlen(pszAttr) + 1;
    701         pAttr = (PRTMANIFESTATTR)RTMemAllocVar(RT_OFFSETOF(RTMANIFESTATTR, szName[cbName]));
     700        size_t const cbName = strlen(pszAttr) + 1;
     701        pAttr = (PRTMANIFESTATTR)RTMemAllocVar(RT_UOFFSETOF(RTMANIFESTATTR, szName[cbName]));
    702702        if (!pAttr)
    703703        {
     
    10651065    if (rc == VERR_NOT_FOUND)
    10661066    {
    1067         pEntry = (PRTMANIFESTENTRY)RTMemAlloc(RT_OFFSETOF(RTMANIFESTENTRY, szName[cchEntry + 1]));
     1067        pEntry = (PRTMANIFESTENTRY)RTMemAlloc(RT_UOFFSETOF(RTMANIFESTENTRY, szName[cchEntry + 1]));
    10681068        if (!pEntry)
    10691069            return VERR_NO_MEMORY;
     
    11911191    if (rc == VERR_NOT_FOUND)
    11921192    {
    1193         pEntry = (PRTMANIFESTENTRY)RTMemAlloc(RT_OFFSETOF(RTMANIFESTENTRY, szName[cchEntry + 1]));
     1193        pEntry = (PRTMANIFESTENTRY)RTMemAlloc(RT_UOFFSETOF(RTMANIFESTENTRY, szName[cchEntry + 1]));
    11941194        if (pEntry)
    11951195        {
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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