Changeset 31925 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Aug 24, 2010 1:39:38 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 65135
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServicePropCache.cpp
r31924 r31925 197 197 */ 198 198 int VBoxServicePropCacheUpdate(PVBOXSERVICEVEPROPCACHE pCache, const char *pszName, const char *pszValueFormat, ...) 199 {200 char *pszValue = NULL;201 int rc;202 if (pszValueFormat)203 {204 va_list va;205 va_start(va, pszValueFormat);206 RTStrAPrintfV(&pszValue, pszValueFormat, va);207 va_end(va);208 }209 rc = VBoxServicePropCacheUpdateEx(pCache, pszName, 0 /* Not used */, NULL /* Not used */, pszValue);210 if (pszValue)211 RTStrFree(pszValue);212 return rc;213 }214 215 216 /**217 * Updates the local guest property cache and writes it to HGCM if outdated.218 *219 * @returns VBox status code.220 *221 * @param pCache The property cache.222 * @param pszName The property name.223 * @param fFlags The property flags to set.224 * @param pszValueReset The property reset value.225 * @param pszValueFormat The property format string. If this is NULL then226 * the property will be deleted (if possible).227 * @param ... Format arguments.228 */229 int VBoxServicePropCacheUpdateEx(PVBOXSERVICEVEPROPCACHE pCache, const char *pszName, uint32_t fFlags,230 const char *pszValueReset, const char *pszValueFormat, ...)231 199 { 232 200 AssertPtr(pCache); … … 274 242 { 275 243 /* Write the update. */ 276 rc = vboxServicePropCacheWritePropF(pCache->uClientID, pNode->pszName, fFlags, pszValue);244 rc = vboxServicePropCacheWritePropF(pCache->uClientID, pNode->pszName, pNode->fFlags, pszValue); 277 245 RTStrFree(pNode->pszValue); 278 246 pNode->pszValue = RTStrDup(pszValue); … … 296 264 } 297 265 298 /* Update rest of the fields. */299 if (pszValueReset)300 {301 if (pNode->pszValueReset)302 RTStrFree(pNode->pszValueReset);303 pNode->pszValueReset = RTStrDup(pszValueReset);304 }305 if (fFlags)306 pNode->fFlags = fFlags;307 308 266 /* Release cache. */ 309 int rc2 = RTCritSectLeave(&pCache->CritSect); 310 if (RT_SUCCESS(rc)) 311 rc2 = rc; 267 RTCritSectLeave(&pCache->CritSect); 312 268 } 313 269 314 270 /* Delete temp stuff. */ 315 271 RTStrFree(pszValue); 316 317 272 return rc; 318 273 } -
trunk/src/VBox/Additions/common/VBoxService/VBoxServicePropCache.h
r31912 r31925 29 29 int VBoxServicePropCacheUpdateEntry(PVBOXSERVICEVEPROPCACHE pCache, const char *pszName, uint32_t fFlags, const char *pszValueReset); 30 30 int VBoxServicePropCacheUpdate(PVBOXSERVICEVEPROPCACHE pCache, const char *pszName, const char *pszValueFormat, ...); 31 int VBoxServicePropCacheUpdateEx(PVBOXSERVICEVEPROPCACHE pCache, const char *pszName, uint32_t fFlags, const char *pszValueReset, const char *pszValueFormat, ...);32 31 int VBoxServicePropCacheUpdateByPath(PVBOXSERVICEVEPROPCACHE pCache, const char *pszValue, uint32_t fFlags, const char *pszPathFormat, ...); 33 32 int VBoxServicePropCacheFlush(PVBOXSERVICEVEPROPCACHE pCache);
Note:
See TracChangeset
for help on using the changeset viewer.