VirtualBox

Changeset 82875 in vbox


Ignore:
Timestamp:
Jan 27, 2020 1:31:54 PM (5 years ago)
Author:
vboxsync
Message:

Shared Clipboard: Use NIL_SHCLEVENTID everywhere.

Location:
trunk/src/VBox
Files:
4 edited

Legend:

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

    r82874 r82875  
    196196 * Generates a new event ID for a specific event source and registers it.
    197197 *
    198  * @returns New event ID generated, or 0 on error.
     198 * @returns New event ID generated, or NIL_SHCLEVENTID on error.
    199199 * @param   pSource             Event source to generate event for.
    200200 */
    201201SHCLEVENTID ShClEventIdGenerateAndRegister(PSHCLEVENTSOURCE pSource)
    202202{
    203     AssertPtrReturn(pSource, 0);
     203    AssertPtrReturn(pSource, NIL_SHCLEVENTID);
    204204
    205205    /*
     
    207207     */
    208208    PSHCLEVENT pEvent = (PSHCLEVENT)RTMemAllocZ(sizeof(SHCLEVENT));
    209     AssertReturn(pEvent, 0);
     209    AssertReturn(pEvent, NIL_SHCLEVENTID);
    210210    int rc = RTSemEventMultiCreate(&pEvent->hEvtMulSem);
    211     AssertRCReturnStmt(rc, RTMemFree(pEvent), 0);
     211    AssertRCReturnStmt(rc, RTMemFree(pEvent), NIL_SHCLEVENTID);
    212212
    213213    /*
     
    237237
    238238    RTMemFree(pEvent);
    239     return 0;
     239    return NIL_SHCLEVENTID;
    240240}
    241241
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-transfers.cpp

    r82852 r82875  
    126126    {
    127127        SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pCtx->pTransfer->Events);
    128         if (idEvent)
     128        if (idEvent != NIL_SHCLEVENTID)
    129129        {
    130130            HGCMSvcSetU64(&pMsgHdr->aParms[0], VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID,
     
    163163
    164164                                    idEvent = ShClEventIdGenerateAndRegister(&pCtx->pTransfer->Events);
    165                                     if (idEvent)
     165                                    if (idEvent != NIL_SHCLEVENTID)
    166166                                    {
    167167                                        HGCMSvcSetU64(&pMsgEntry->aParms[0],
     
    218218            ShClEventUnregister(&pCtx->pTransfer->Events, idEvent);
    219219        }
     220        else
     221            rc = VERR_SHCLPB_MAX_EVENTS_REACHED;
    220222    }
    221223    else
     
    241243    {
    242244        const SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pCtx->pTransfer->Events);
    243         if (idEvent)
     245        if (idEvent != NIL_SHCLEVENTID)
    244246        {
    245247            pMsg->idCtx = VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID, pCtx->pTransfer->State.uID,
     
    300302    {
    301303        const SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pCtx->pTransfer->Events);
    302         if (idEvent)
     304        if (idEvent != NIL_SHCLEVENTID)
    303305        {
    304306            pMsg->idCtx = VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID, pCtx->pTransfer->State.uID,
     
    347349    {
    348350        const SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pCtx->pTransfer->Events);
    349         if (idEvent)
     351        if (idEvent != NIL_SHCLEVENTID)
    350352        {
    351353            HGCMSvcSetU64(&pMsg->aParms[0], VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID,
     
    409411    {
    410412        const SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pCtx->pTransfer->Events);
    411         if (idEvent)
     413        if (idEvent != NIL_SHCLEVENTID)
    412414        {
    413415            HGCMSvcSetU64(&pMsg->aParms[0], VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID,
     
    470472    {
    471473        const SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pCtx->pTransfer->Events);
    472         if (idEvent)
     474        if (idEvent != NIL_SHCLEVENTID)
    473475        {
    474476            LogFlowFunc(("pszPath=%s, fCreate=0x%x\n", pCreateParms->pszPath, pCreateParms->fCreate));
     
    533535    {
    534536        const SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pCtx->pTransfer->Events);
    535         if (idEvent)
     537        if (idEvent != NIL_SHCLEVENTID)
    536538        {
    537539            HGCMSvcSetU64(&pMsg->aParms[0], VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID,
     
    588590    {
    589591        const SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pCtx->pTransfer->Events);
    590         if (idEvent)
     592        if (idEvent != NIL_SHCLEVENTID)
    591593        {
    592594            HGCMSvcSetU64(&pMsg->aParms[0], VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID,
     
    648650    {
    649651        const SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pCtx->pTransfer->Events);
    650         if (idEvent)
     652        if (idEvent != NIL_SHCLEVENTID)
    651653        {
    652654            HGCMSvcSetU64(&pMsg->aParms[0], VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID,
     
    19941996
    19951997    const SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pTransfer->Events);
    1996     if (idEvent)
     1998    if (idEvent != NIL_SHCLEVENTID)
    19971999    {
    19982000        HGCMSvcSetU64(&pMsgReadData->aParms[0], VBOX_SHCL_CONTEXTID_MAKE(pClient->State.uSessionID,
     
    20212023            ShClEventUnregister(&pTransfer->Events, idEvent);
    20222024    }
     2025    else
     2026        rc = VERR_SHCLPB_MAX_EVENTS_REACHED;
    20232027
    20242028    LogFlowFuncLeaveRC(rc);
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-x11.cpp

    r82848 r82875  
    194194        const SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pClient->EventSrc);
    195195        pReq->idEvent    = idEvent;
    196         if (idEvent)
     196        if (idEvent != NIL_SHCLEVENTID)
    197197        {
    198198            rc = ShClX11ReadDataFromX11(&pClient->State.pCtx->X11, pData->uFormat, pReq);
     
    392392
    393393    SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pClient->EventSrc);
    394     if (idEvent)
     394    if (idEvent != NIL_SHCLEVENTID)
    395395    {
    396396        CLIPREADCBREQ *pReq = (CLIPREADCBREQ *)RTMemAllocZ(sizeof(CLIPREADCBREQ));
  • trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp

    r82873 r82875  
    12161216
    12171217        const SHCLEVENTID idEvent = ShClEventIdGenerateAndRegister(&pClient->EventSrc);
    1218         if (idEvent != 0)
     1218        if (idEvent != NIL_SHCLEVENTID)
    12191219        {
    12201220            LogFlowFunc(("fFormat=%#x idEvent=%#x\n", fFormat, idEvent));
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