VirtualBox

Changeset 36412 in vbox


Ignore:
Timestamp:
Mar 24, 2011 5:25:33 PM (14 years ago)
Author:
vboxsync
Message:

GuestProps: TRANSRESET implies TRANSIENT, return it for old additions and API users.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/HostServices/GuestPropertySvc.h

    r36382 r36412  
    179179DECLINLINE(int) writeFlags(uint32_t fFlags, char *pszFlags)
    180180{
    181     /* Putting READONLY before the other RDONLY flags keeps the result short. */
    182181    static const uint32_t s_aFlagList[] =
    183182    {
    184183        TRANSIENT, READONLY, RDONLYGUEST, RDONLYHOST, TRANSRESET
    185184    };
    186     char *pszNext = pszFlags;
    187185    int rc = VINF_SUCCESS;
     186
    188187    AssertLogRelReturn(VALID_PTR(pszFlags), VERR_INVALID_POINTER);
    189     if ((fFlags & ~ALLFLAGS) != NILFLAG)
    190         rc = VERR_INVALID_PARAMETER;
    191     if (RT_SUCCESS(rc))
     188    if ((fFlags & ~ALLFLAGS) == NILFLAG)
    192189    {
    193         unsigned i = 0;
    194         for (; i < RT_ELEMENTS(s_aFlagList); ++i)
     190        /* TRANSRESET implies TRANSIENT.  For compatability with old clients we
     191           always set TRANSIENT when TRANSRESET appears. */
     192        if (fFlags & TRANSRESET)
     193            fFlags |= TRANSIENT;
     194
     195        char *pszNext = pszFlags;
     196        for (unsigned i = 0; i < RT_ELEMENTS(s_aFlagList); ++i)
    195197        {
    196198            if (s_aFlagList[i] == (fFlags & s_aFlagList[i]))
     
    207209        }
    208210        *pszNext = '\0';
    209         if (fFlags != NILFLAG)
    210             rc = VERR_INVALID_PARAMETER;  /* But pszFlags will still be set right. */
     211
     212        Assert(fFlags == NILFLAG); /* bad s_aFlagList */
    211213    }
     214    else
     215        rc = VERR_INVALID_PARAMETER;
    212216    return rc;
    213217}
  • trunk/src/VBox/HostServices/GuestProperties/testcase/tstGuestPropSvc.cpp

    r36375 r36412  
    8181    { "rdonlyhost     ",                                "RDONLYHOST" },
    8282    { "transient, transreset, rdonlyhost",              "TRANSIENT, RDONLYHOST, TRANSRESET" },
    83     { "transient, transreset, rdonlyguest",             "TRANSIENT, RDONLYGUEST, TRANSRESET" },
    84     { "rdonlyguest, rdonlyhost",                        "READONLY" }
     83    { "transient, transreset, rdonlyguest",             "TRANSIENT, RDONLYGUEST, TRANSRESET" },     /* max length */
     84    { "rdonlyguest, rdonlyhost",                        "READONLY" },
     85    { "transient,   transreset, ",                      "TRANSIENT, TRANSRESET" }, /* Don't combine them ... */
     86    { "transreset, ",                                   "TRANSIENT, TRANSRESET" }, /* ... instead expand transreset for old adds. */
    8587};
    8688
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