VirtualBox

Ignore:
Timestamp:
Jun 19, 2023 9:11:37 AM (18 months ago)
Author:
vboxsync
Message:

Shared Clipboard: Unified root list entry code to also use the generic list entry code, a lot of updates for the cross OS transfer handling code, more updates for HTTP server transfer handling.

This also changed the handling of how that transfers are being initiated, as we needed to have this for X11: Before, transfers were initiated as soon as on side announced the URI list format -- now we postpone initiating the transfer until the receiving side requests the data as URI list.

bugref:9437

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp

    r99974 r100204  
    6363 * @returns VBox status code.
    6464 * @param   uID                 Payload ID to set for this payload. Useful for consequtive payloads.
    65  * @param   pvData              Data block to associate to this payload.
    66  * @param   cbData              Size (in bytes) of data block to associate.
     65 * @param   pvData              Data to associate to this payload.
     66 *                              The payload owns the data then.
     67 * @param   cbData              Size (in bytes) of data to associate.
     68 * @param   ppPayload           Where to store the allocated event payload on success.
     69 */
     70int ShClPayloadInit(uint32_t uID, void *pvData, uint32_t cbData,
     71                    PSHCLEVENTPAYLOAD *ppPayload)
     72{
     73    AssertPtrReturn(pvData, VERR_INVALID_POINTER);
     74    AssertReturn(cbData > 0, VERR_INVALID_PARAMETER);
     75
     76    PSHCLEVENTPAYLOAD pPayload = (PSHCLEVENTPAYLOAD)RTMemAlloc(sizeof(SHCLEVENTPAYLOAD));
     77    if (pPayload)
     78    {
     79        pPayload->pvData = pvData;
     80        pPayload->cbData = cbData;
     81        pPayload->uID    = uID;
     82
     83        *ppPayload = pPayload;
     84        return VINF_SUCCESS;
     85    }
     86
     87    return VERR_NO_MEMORY;
     88}
     89
     90/**
     91 * Allocates a new event payload.
     92 *
     93 * @returns VBox status code.
     94 * @param   uID                 Payload ID to set for this payload. Useful for consequtive payloads.
     95 * @param   pvData              Data block to allocate (duplicate) to this payload.
     96 * @param   cbData              Size (in bytes) of data block to allocate.
    6797 * @param   ppPayload           Where to store the allocated event payload on success.
    6898 */
     
    73103    AssertReturn(cbData > 0, VERR_INVALID_PARAMETER);
    74104
    75     PSHCLEVENTPAYLOAD pPayload = (PSHCLEVENTPAYLOAD)RTMemAlloc(sizeof(SHCLEVENTPAYLOAD));
    76     if (pPayload)
    77     {
    78         pPayload->pvData = RTMemDup(pvData, cbData);
    79         if (pPayload->pvData)
    80         {
    81             pPayload->cbData = cbData;
    82             pPayload->uID    = uID;
    83 
    84             *ppPayload = pPayload;
    85             return VINF_SUCCESS;
    86         }
    87 
    88         RTMemFree(pPayload);
    89     }
     105    void *pvDataDup = RTMemDup(pvData, cbData);
     106    if (pvDataDup)
     107        return ShClPayloadInit(uID, pvDataDup, cbData, ppPayload);
     108
    90109    return VERR_NO_MEMORY;
    91110}
     
    418437 * Detaches a payload from an event, internal version.
    419438 *
    420  * @returns Pointer to the detached payload. Can be NULL if the payload has no payload.
     439 * @returns Pointer to the detached payload. Can be NULL if the event has no payload.
    421440 * @param   pEvent              Event to detach payload for.
    422441 */
     
    480499
    481500/**
    482  * Releases an event by decreasing its reference count.
     501 * Releases event by decreasing its reference count. Will be destroys once the reference count reaches 0.
    483502 *
    484503 * @returns New reference count, or UINT32_MAX if failed.
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