VirtualBox

Changeset 31925 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Aug 24, 2010 1:39:38 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
65135
Message:

VBoxService/PropCache: Don't touch the properties flags/reset value when just updating the value. Now the interface should be consistent.

Location:
trunk/src/VBox/Additions/common/VBoxService
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServicePropCache.cpp

    r31924 r31925  
    197197 */
    198198int 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 then
    226  *                          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, ...)
    231199{
    232200    AssertPtr(pCache);
     
    274242            {
    275243                /* Write the update. */
    276                 rc = vboxServicePropCacheWritePropF(pCache->uClientID, pNode->pszName, fFlags, pszValue);
     244                rc = vboxServicePropCacheWritePropF(pCache->uClientID, pNode->pszName, pNode->fFlags, pszValue);
    277245                RTStrFree(pNode->pszValue);
    278246                pNode->pszValue = RTStrDup(pszValue);
     
    296264        }
    297265
    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 
    308266        /* Release cache. */
    309         int rc2 = RTCritSectLeave(&pCache->CritSect);
    310         if (RT_SUCCESS(rc))
    311             rc2 = rc;
     267        RTCritSectLeave(&pCache->CritSect);
    312268    }
    313269
    314270    /* Delete temp stuff. */
    315271    RTStrFree(pszValue);
    316 
    317272    return rc;
    318273}
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServicePropCache.h

    r31912 r31925  
    2929int VBoxServicePropCacheUpdateEntry(PVBOXSERVICEVEPROPCACHE pCache, const char *pszName, uint32_t fFlags, const char *pszValueReset);
    3030int 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, ...);
    3231int VBoxServicePropCacheUpdateByPath(PVBOXSERVICEVEPROPCACHE pCache, const char *pszValue, uint32_t fFlags, const char *pszPathFormat, ...);
    3332int VBoxServicePropCacheFlush(PVBOXSERVICEVEPROPCACHE pCache);
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