VirtualBox

Ignore:
Timestamp:
Sep 29, 2008 4:27:32 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
37166
Message:

VbglR3GuestPropDelTree -> VbglR3GuestPropDelSet, added missing docs and make some adjustments. Fixed the missing 'const'-ness of the enumeration API.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestProp.cpp

    r12810 r12812  
    523523 * @param   ppszFlags       Where to store the first flags value on success.
    524524 *                          Should not be freed.
    525  *
    526  * @todo    Make papszPatterns char const * const *, and cPatterns size_t (so we
    527  *          can use RT_ELEMENTS without getting warnings on Windows).
    528  *          Most of the returns should also be made char const * to discourage
    529  *          changes and encourage compiler optimizations.
    530525 */
    531526VBGLR3DECL(int) VbglR3GuestPropEnum(uint32_t u32ClientId,
    532                                     char **papszPatterns,
    533                                     int cPatterns,
     527                                    char const * const *papszPatterns,
     528                                    size_t cPatterns,
    534529                                    PVBGLR3GUESTPROPENUM *ppHandle,
    535                                     char **ppszName,
    536                                     char **ppszValue,
     530                                    char const **ppszName,
     531                                    char const **ppszValue,
    537532                                    uint64_t *pu64Timestamp,
    538                                     char **ppszFlags)
     533                                    char const **ppszFlags)
    539534{
    540535    int rc = VINF_SUCCESS;
    541536    RTMemAutoPtr<VBGLR3GUESTPROPENUM, VbglR3GuestPropEnumFree> Handle;
    542     Handle = (PVBGLR3GUESTPROPENUM) RTMemAllocZ(sizeof(VBGLR3GUESTPROPENUM));
     537    Handle = (PVBGLR3GUESTPROPENUM)RTMemAllocZ(sizeof(VBGLR3GUESTPROPENUM));
    543538    if (!Handle)
    544539        rc = VERR_NO_MEMORY;
     
    546541    /* Get the length of the pattern string, including the final terminator. */
    547542    uint32_t cchPatterns = 1;
    548     for (int i = 0; i < cPatterns; ++i)
     543    for (unsigned i = 0; i < cPatterns; ++i)
    549544        cchPatterns += strlen(papszPatterns[i]) + 1;
     545
    550546    /* Pack the pattern array */
    551547    RTMemAutoPtr<char> Patterns;
    552     Patterns = (char *) RTMemAlloc(cchPatterns);
     548    Patterns = (char *)RTMemAlloc(cchPatterns);
    553549    size_t iOffs = 0;
    554     for (int i = 0; i < cPatterns; ++i)
     550    for (size_t i = 0; i < cPatterns; ++i)
    555551    {
    556552        size_t cb = strlen(papszPatterns[i]) + 1;
     
    619615 *                       set to NULL if there are no more properties to
    620616 *                       enumerate.  This pointer should not be freed.
    621  *
    622  * @todo return char const *.
    623617 */
    624618VBGLR3DECL(int) VbglR3GuestPropEnumNext(PVBGLR3GUESTPROPENUM pHandle,
    625                                         char **ppszName,
    626                                         char **ppszValue,
     619                                        char const **ppszName,
     620                                        char const **ppszValue,
    627621                                        uint64_t *pu64Timestamp,
    628                                         char **ppszFlags)
     622                                        char const **ppszFlags)
    629623{
    630624    uint32_t iBuf = pHandle->iBuf;
    631625    char *pszName = pHandle->pchBuf + iBuf;
    632     /** @todo replace these with safe memchr's and return an error if needed. */
     626    /** @todo replace these with safe memchr's and return an error if needed. A
     627     *        PLEASE add a comment about the layout because this is rather
     628     *        unreadable. */
    633629    iBuf += strlen(pszName) + 1;
    634630    char *pszValue = pHandle->pchBuf + iBuf;
     
    680676{
    681677    PVBGLR3GUESTPROPENUM pHandle;
    682     char *pszName;
    683     char *pszValue;
     678    char const *pszName, *pszValue, *pszFlags;
    684679    uint64_t pu64Timestamp;
    685     char *pszFlags;
    686680    int rc = VbglR3GuestPropEnum(u32ClientId,
    687681                                 (char **)papszPatterns, /** @todo fix this cast. */
Note: See TracChangeset for help on using the changeset viewer.

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