Changeset 36412 in vbox
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/GuestPropertySvc.h
r36382 r36412 179 179 DECLINLINE(int) writeFlags(uint32_t fFlags, char *pszFlags) 180 180 { 181 /* Putting READONLY before the other RDONLY flags keeps the result short. */182 181 static const uint32_t s_aFlagList[] = 183 182 { 184 183 TRANSIENT, READONLY, RDONLYGUEST, RDONLYHOST, TRANSRESET 185 184 }; 186 char *pszNext = pszFlags;187 185 int rc = VINF_SUCCESS; 186 188 187 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) 192 189 { 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) 195 197 { 196 198 if (s_aFlagList[i] == (fFlags & s_aFlagList[i])) … … 207 209 } 208 210 *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 */ 211 213 } 214 else 215 rc = VERR_INVALID_PARAMETER; 212 216 return rc; 213 217 } -
trunk/src/VBox/HostServices/GuestProperties/testcase/tstGuestPropSvc.cpp
r36375 r36412 81 81 { "rdonlyhost ", "RDONLYHOST" }, 82 82 { "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. */ 85 87 }; 86 88
Note:
See TracChangeset
for help on using the changeset viewer.