VirtualBox

Ignore:
Timestamp:
Aug 19, 2020 2:05:37 PM (4 years ago)
Author:
vboxsync
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/Additions/x11/VBoxClient/clipboard.cpp

    r85798 r85834  
    8080
    8181/**
    82  * Get clipboard data from the host.
     82 * Callback implementation for getting clipboard data from the host.
    8383 *
    84  * @returns VBox result code
     84 * @returns VBox status code. VERR_NO_DATA if no data available.
    8585 * @param   pCtx                Our context information.
    8686 * @param   Format              The format of the data being requested.
    8787 * @param   ppv                 On success and if pcb > 0, this will point to a buffer
    8888 *                              to be freed with RTMemFree containing the data read.
    89  * @param   pcb                 On success, this contains the number of bytes of data
    90  *                              returned.
     89 * @param   pcb                 On success, this contains the number of bytes of data returned.
    9190 */
    9291DECLCALLBACK(int) ShClX11RequestDataForX11Callback(PSHCLCONTEXT pCtx, SHCLFORMAT Format, void **ppv, uint32_t *pcb)
     
    138137        }
    139138
     139        if (!cbRead)
     140            rc = VERR_NO_DATA;
     141
    140142        if (RT_SUCCESS(rc))
    141143        {
     
    143145            *ppv = pvData;
    144146        }
    145 
    146         /*
    147          * Catch other errors. This also catches the case in which the buffer was
    148          * too small a second time, possibly because the clipboard contents
    149          * changed half-way through the operation.  Since we can't say whether or
    150          * not this is actually an error, we just return size 0.
    151          */
    152         if (RT_FAILURE(rc))
     147        else
     148        {
     149            /*
     150             * Catch other errors. This also catches the case in which the buffer was
     151             * too small a second time, possibly because the clipboard contents
     152             * changed half-way through the operation.  Since we can't say whether or
     153             * not this is actually an error, we just return size 0.
     154             */
    153155            RTMemFree(pvData);
     156        }
    154157    }
    155158
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