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/VBoxControl/VBoxControl.cpp

    r12719 r12812  
    10441044static int enumGuestProperty(int argc, char *argv[])
    10451045{
    1046 /*
    1047  * Check the syntax.  We can deduce the correct syntax from the number of
    1048  * arguments.
    1049  */
    1050     const char *paszPatterns = NULL;
    1051     if ((argc > 1) && (0 == strcmp(argv[0], "-patterns")))
    1052         paszPatterns = argv[1];
     1046    /*
     1047     * Check the syntax.  We can deduce the correct syntax from the number of
     1048     * arguments.
     1049     */
     1050    char const * const *papszPatterns = NULL;
     1051    size_t cPatterns = 0;
     1052    if (    argc > 1
     1053        && !strcmp(argv[0], "-patterns"))
     1054    {
     1055        papszPatterns = (char const * const *)&argv[1];
     1056        cPatterns = argc - 1;
     1057    }
    10531058    else if (argc != 0)
    10541059    {
     
    10571062    }
    10581063
    1059 /*
    1060  * Do the actual enumeration.
    1061  */
     1064    /*
     1065     * Do the actual enumeration.
     1066     */
    10621067    uint32_t u32ClientId = 0;
    1063     PVBGLR3GUESTPROPENUM pHandle = NULL;
    1064     RTMemAutoPtr<VBGLR3GUESTPROPENUM, VbglR3GuestPropEnumFree> Handle;
    1065     char *pszName = NULL, *pszValue = NULL, *pszFlags = NULL;
    1066     uint64_t u64Timestamp = 0;
    1067     int rc = VINF_SUCCESS;
    1068     rc = VbglR3GuestPropConnect(&u32ClientId);
    1069     if (!RT_SUCCESS(rc))
    1070         VBoxControlError("Failed to connect to the guest property service! Error: %Rrc\n", rc);
     1068    int rc = VbglR3GuestPropConnect(&u32ClientId);
    10711069    if (RT_SUCCESS(rc))
    10721070    {
    1073         char **ppaszPatterns = argc > 1 ? argv + 1 : NULL;
    1074         int cPatterns = argc > 1 ? argc - 1 : 0;
    1075         rc = VbglR3GuestPropEnum(u32ClientId, ppaszPatterns, cPatterns, &pHandle,
     1071        PVBGLR3GUESTPROPENUM pHandle;
     1072        const char *pszName, *pszValue, *pszFlags;
     1073        uint64_t u64Timestamp;
     1074
     1075        rc = VbglR3GuestPropEnum(u32ClientId, papszPatterns, cPatterns, &pHandle,
    10761076                                 &pszName, &pszValue, &u64Timestamp, &pszFlags);
    10771077        if (RT_SUCCESS(rc))
    10781078        {
    1079             Handle = pHandle;
     1079            while (RT_SUCCESS(rc) && !pszName)
     1080            {
     1081                RTPrintf("Name: %s, value: %s, timestamp: %lld, flags: %s\n",
     1082                         pszName, pszValue, u64Timestamp, pszFlags);
     1083
     1084                rc = VbglR3GuestPropEnumNext(pHandle, &pszName, &pszValue, &u64Timestamp, &pszFlags);
     1085                if (RT_FAILURE(rc))
     1086                    VBoxControlError("Error while enumerating guest properties: %Rrc\n", rc);
     1087            }
     1088
     1089            VbglR3GuestPropEnumFree(pHandle);
    10801090        }
    10811091        else if (VERR_NOT_FOUND == rc)
     
    10831093        else
    10841094            VBoxControlError("Failed to enumerate the guest properties! Error: %Rrc\n", rc);
    1085     }
    1086     while (RT_SUCCESS(rc) && (pszName != NULL))
    1087     {
    1088         RTPrintf("Name: %s, value: %s, timestamp: %lld, flags: %s\n",
    1089                  pszName, pszValue, u64Timestamp, pszFlags);
    1090         rc = VbglR3GuestPropEnumNext(Handle.get(), &pszName, &pszValue, &u64Timestamp, &pszFlags);
    1091         if (!RT_SUCCESS(rc))
    1092             VBoxControlError("Error while enumerating guest properties: %Rrc\n", rc);
    1093     }
    1094 
    1095     if (u32ClientId != 0)
    10961095        VbglR3GuestPropDisconnect(u32ClientId);
     1096    }
     1097    else
     1098        VBoxControlError("Failed to connect to the guest property service! Error: %Rrc\n", rc);
    10971099    return RT_SUCCESS(rc) ? 0 : 1;
    10981100}
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