VirtualBox

Ignore:
Timestamp:
Feb 4, 2016 1:46:53 PM (9 years ago)
Author:
vboxsync
Message:

iprt: Added RTManifestQueryAllAttrTypes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/checksum/manifest2.cpp

    r59567 r59575  
    882882
    883883    return rtManifestQueryAttrWorker(&pThis->SelfEntry, pszAttr, fType, pszValue, cbValue, pfType);
     884}
     885
     886
     887/**
     888 * Callback employed by RTManifestQueryAllAttrTypes to collect attribute types.
     889 *
     890 * @returns VINF_SUCCESS.
     891 * @param   pStr                The attribute string node.
     892 * @param   pvUser              Pointer to type flags (uint32_t).
     893 */
     894static DECLCALLBACK(int) rtMainfestQueryAllAttrTypesEnumAttrCallback(PRTSTRSPACECORE pStr, void *pvUser)
     895{
     896    PRTMANIFESTATTR pAttr   = (PRTMANIFESTATTR)pStr;
     897    uint32_t       *pfTypes = (uint32_t *)pvUser;
     898    *pfTypes |= pAttr->fType;
     899    return VINF_SUCCESS;
     900}
     901
     902
     903/**
     904 * Callback employed by RTManifestQueryAllAttrTypes to collect attribute types
     905 * for an entry.
     906 *
     907 * @returns VINF_SUCCESS.
     908 * @param   pStr                The attribute string node.
     909 * @param   pvUser              Pointer to type flags (uint32_t).
     910 */
     911static DECLCALLBACK(int) rtMainfestQueryAllAttrTypesEnumEntryCallback(PRTSTRSPACECORE pStr, void *pvUser)
     912{
     913    PRTMANIFESTENTRY pEntry = RT_FROM_MEMBER(pStr, RTMANIFESTENTRY, StrCore);
     914    return RTStrSpaceEnumerate(&pEntry->Attributes, rtMainfestQueryAllAttrTypesEnumAttrCallback, pvUser);
     915}
     916
     917
     918RTDECL(int) RTManifestQueryAllAttrTypes(RTMANIFEST hManifest, bool fEntriesOnly, uint32_t *pfTypes)
     919{
     920    RTMANIFESTINT *pThis = hManifest;
     921    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     922    AssertReturn(pThis->u32Magic == RTMANIFEST_MAGIC, VERR_INVALID_HANDLE);
     923    AssertPtr(pfTypes);
     924
     925    *pfTypes = 0;
     926    int rc = RTStrSpaceEnumerate(&pThis->Entries, rtMainfestQueryAllAttrTypesEnumEntryCallback, pfTypes);
     927    if (RT_SUCCESS(rc) && fEntriesOnly)
     928        rc = rtMainfestQueryAllAttrTypesEnumAttrCallback(&pThis->SelfEntry.StrCore, pfTypes);
     929    return VINF_SUCCESS;
    884930}
    885931
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