VirtualBox

Ignore:
Timestamp:
Aug 19, 2020 2:05:37 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139994
Message:

Shared Clipboard/X11: Return VERR_NO_DATA in X11 callback implementations to make it easier to spot that there is no data available.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11.cpp

    r85773 r85834  
    316316
    317317/**
    318  * Reads clipboard data from the guest and passes it to the X11 clipboard.
     318 * Callback implementation for reading clipboard data from the guest.
    319319 *
    320320 * @note   Runs in Xt event thread.
    321321 *
    322  * @param  pCtx      Pointer to the host clipboard structure.
    323  * @param  fFormat   The format in which the data should be transferred
    324  *                   (VBOX_SHCL_FMT_XXX).
    325  * @param  ppv       On success and if pcb > 0, this will point to a buffer
    326  *                   to be freed with RTMemFree containing the data read.
    327  * @param  pcb       On success, this contains the number of bytes of data
    328  *                   returned.
     322 * @returns VBox status code. VERR_NO_DATA if no data available.
     323 * @param   pCtx                Pointer to the host clipboard structure.
     324 * @param   fFormat             The format in which the data should be transferred
     325 *                              (VBOX_SHCL_FMT_XXX).
     326 * @param   ppv                 On success and if pcb > 0, this will point to a buffer
     327 *                              to be freed with RTMemFree containing the data read.
     328 * @param   pcb                 On success, this contains the number of bytes of data returned.
    329329 */
    330330DECLCALLBACK(int) ShClX11RequestDataForX11Callback(PSHCLCONTEXT pCtx, SHCLFORMAT fFormat, void **ppv, uint32_t *pcb)
     
    356356            if (RT_SUCCESS(rc))
    357357            {
    358                 *ppv = pPayload ? pPayload->pvData : NULL;
    359                 *pcb = pPayload ? pPayload->cbData : 0;
     358                if (   !pPayload
     359                    || !pPayload->cbData)
     360                {
     361                    rc = VERR_NO_DATA;
     362                }
     363                else
     364                {
     365                    *ppv = pPayload->pvData;
     366                    *pcb = pPayload->cbData;
     367                }
    360368            }
    361369
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