VirtualBox

Ignore:
Timestamp:
Aug 27, 2019 5:47:44 PM (5 years ago)
Author:
vboxsync
Message:

Shared Clipboard/URI: Added protocol versioning support plus enhanced versions of existing commands (to also provide context IDs, among other stuff). So far only the host service(s) and the Windows guest is using the new(er) protocol.

Location:
trunk/src/VBox/GuestHost/SharedClipboard
Files:
4 edited

Legend:

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

    r80285 r80444  
    2222#include <iprt/alloc.h>
    2323#include <iprt/assert.h>
     24#include <iprt/semaphore.h>
    2425#include <iprt/path.h>
    2526
     
    2829#include <VBox/GuestHost/clipboard-helper.h>
    2930#include <VBox/HostServices/VBoxClipboardSvc.h>
     31
     32
     33/**
     34 * Allocates a new event payload.
     35 *
     36 * @returns VBox status code.
     37 * @param   uID                 Event ID to associate payload to.
     38 * @param   pvData              Data block to associate to this payload.
     39 * @param   cbData              Size (in bytes) of data block to associate.
     40 * @param   ppPayload           Where to store the allocated event payload on success.
     41 */
     42int SharedClipboardPayloadAlloc(uint32_t uID, const void *pvData, uint32_t cbData,
     43                                PSHAREDCLIPBOARDEVENTPAYLOAD *ppPayload)
     44{
     45    AssertPtrReturn(pvData, VERR_INVALID_POINTER);
     46    AssertReturn   (cbData, VERR_INVALID_PARAMETER);
     47
     48    PSHAREDCLIPBOARDEVENTPAYLOAD pPayload =
     49        (PSHAREDCLIPBOARDEVENTPAYLOAD)RTMemAlloc(sizeof(SHAREDCLIPBOARDEVENTPAYLOAD));
     50    if (!pPayload)
     51        return VERR_NO_MEMORY;
     52
     53    pPayload->pvData = RTMemAlloc(cbData);
     54    if (pPayload->pvData)
     55    {
     56        memcpy(pPayload->pvData, pvData, cbData);
     57
     58        pPayload->cbData = cbData;
     59        pPayload->uID    = uID;
     60
     61        *ppPayload = pPayload;
     62
     63        return VINF_SUCCESS;
     64    }
     65
     66    RTMemFree(pPayload);
     67    return VERR_NO_MEMORY;
     68}
     69
     70/**
     71 * Frees an event payload.
     72 *
     73 * @returns VBox status code.
     74 * @param   pPayload            Event payload to free.
     75 */
     76void SharedClipboardPayloadFree(PSHAREDCLIPBOARDEVENTPAYLOAD pPayload)
     77{
     78    if (!pPayload)
     79        return;
     80
     81    if (pPayload->pvData)
     82    {
     83        Assert(pPayload->cbData);
     84        RTMemFree(pPayload->pvData);
     85        pPayload->pvData = NULL;
     86    }
     87
     88    pPayload->cbData = 0;
     89
     90    RTMemFree(pPayload);
     91    pPayload = NULL;
     92}
     93
     94int SharedClipboardEventCreate(PSHAREDCLIPBOARDEVENT pEvent, uint16_t uID)
     95{
     96    AssertPtrReturn(pEvent, VERR_INVALID_POINTER);
     97
     98    LogFlowFunc(("Event %RU16\n", uID));
     99
     100    int rc = RTSemEventCreate(&pEvent->hEventSem);
     101    if (RT_SUCCESS(rc))
     102    {
     103        pEvent->uID      = uID;
     104        pEvent->pPayload = NULL;
     105    }
     106
     107    return rc;
     108}
     109
     110void SharedClipboardEventDestroy(PSHAREDCLIPBOARDEVENT pEvent)
     111{
     112    if (!pEvent)
     113        return;
     114
     115    LogFlowFunc(("Event %RU16\n", pEvent->uID));
     116
     117    if (pEvent->hEventSem != NIL_RTSEMEVENT)
     118    {
     119        RTSemEventDestroy(pEvent->hEventSem);
     120        pEvent->hEventSem = NIL_RTSEMEVENT;
     121    }
     122
     123    SharedClipboardPayloadFree(pEvent->pPayload);
     124
     125    pEvent->uID = 0;
     126}
     127
     128int SharedClipboardEventSourceCreate(PSHAREDCLIPBOARDEVENTSOURCE pSource, uint16_t uID)
     129{
     130    AssertPtrReturn(pSource, VERR_INVALID_POINTER);
     131
     132    LogFlowFunc(("pSource=%p, uID=%RU16\n", pSource, uID));
     133
     134    int rc = VINF_SUCCESS;
     135
     136    RTListInit(&pSource->lstEvents);
     137
     138    pSource->uID          = uID;
     139    pSource->uEventIDNext = 1; /* Event ID 0 always is reserved (marks "unused"). */
     140
     141    LogFlowFuncLeaveRC(rc);
     142    return rc;
     143}
     144
     145void SharedClipboardEventSourceDestroy(PSHAREDCLIPBOARDEVENTSOURCE pSource)
     146{
     147    if (!pSource)
     148        return;
     149
     150    LogFlowFunc(("ID=%RU16\n", pSource->uID));
     151
     152    PSHAREDCLIPBOARDEVENT pEvIt;
     153    PSHAREDCLIPBOARDEVENT pEvItNext;
     154    RTListForEachSafe(&pSource->lstEvents, pEvIt, pEvItNext, SHAREDCLIPBOARDEVENT, Node)
     155    {
     156        SharedClipboardEventDestroy(pEvIt);
     157        RTMemFree(pEvIt);
     158    }
     159}
     160
     161/**
     162 * Generates a new event ID for a specific event source.
     163 *
     164 * @returns New event ID generated, or 0 on error.
     165 * @param   pSource             Event source to generate event for.
     166 */
     167uint16_t SharedClipboardEventIDGenerate(PSHAREDCLIPBOARDEVENTSOURCE pSource)
     168{
     169    AssertPtrReturn(pSource, 0);
     170
     171    LogFlowFunc(("uSource=%RU16: New event: %RU16\n", pSource->uID, pSource->uEventIDNext));
     172    return pSource->uEventIDNext++; /** @todo Improve this. */
     173}
     174
     175/**
     176 * Returns a specific event of a event source.
     177 *
     178 * @returns Pointer to event if found, or NULL if not found.
     179 * @param   pSource             Event source to get event from.
     180 * @param   uID                 Event ID to get.
     181 */
     182inline PSHAREDCLIPBOARDEVENT sharedClipboardEventGet(PSHAREDCLIPBOARDEVENTSOURCE pSource, uint16_t uID)
     183{
     184    PSHAREDCLIPBOARDEVENT pEvIt;
     185    RTListForEach(&pSource->lstEvents, pEvIt, SHAREDCLIPBOARDEVENT, Node)
     186    {
     187        if (pEvIt->uID == uID)
     188            return pEvIt;
     189    }
     190
     191    return NULL;
     192}
     193
     194/**
     195 * Registers an event.
     196 *
     197 * @returns VBox status code.
     198 * @param   pSource             Event source to register event for.
     199 * @param   uID                 Event ID to register.
     200 */
     201int SharedClipboardEventRegister(PSHAREDCLIPBOARDEVENTSOURCE pSource, uint16_t uID)
     202{
     203    AssertPtrReturn(pSource, VERR_INVALID_POINTER);
     204
     205    int rc;
     206
     207    LogFlowFunc(("uSource=%RU16, uEvent=%RU16\n", pSource->uID, uID));
     208
     209    if (sharedClipboardEventGet(pSource, uID) == NULL)
     210    {
     211        PSHAREDCLIPBOARDEVENT pEvent
     212            = (PSHAREDCLIPBOARDEVENT)RTMemAllocZ(sizeof(SHAREDCLIPBOARDEVENT));
     213        if (pEvent)
     214        {
     215            rc = SharedClipboardEventCreate(pEvent, uID);
     216            if (RT_SUCCESS(rc))
     217            {
     218                RTListAppend(&pSource->lstEvents, &pEvent->Node);
     219
     220                LogFlowFunc(("Event %RU16\n", uID));
     221            }
     222        }
     223        else
     224            rc = VERR_NO_MEMORY;
     225    }
     226    else
     227        rc = VERR_ALREADY_EXISTS;
     228
     229#ifdef DEBUG_andy
     230    AssertRC(rc);
     231#endif
     232
     233    LogFlowFuncLeaveRC(rc);
     234    return rc;
     235}
     236
     237/**
     238 * Unregisters an event.
     239 *
     240 * @returns VBox status code.
     241 * @param   pSource             Event source to unregister event for.
     242 * @param   uID                 Event ID to unregister.
     243 */
     244int SharedClipboardEventUnregister(PSHAREDCLIPBOARDEVENTSOURCE pSource, uint16_t uID)
     245{
     246    AssertPtrReturn(pSource, VERR_INVALID_POINTER);
     247
     248    int rc;
     249
     250    LogFlowFunc(("uSource=%RU16, uEvent=%RU16\n", pSource->uID, uID));
     251
     252    PSHAREDCLIPBOARDEVENT pEvent = sharedClipboardEventGet(pSource, uID);
     253    if (pEvent)
     254    {
     255        LogFlowFunc(("Event %RU16\n", pEvent->uID));
     256
     257        SharedClipboardEventDestroy(pEvent);
     258        RTMemFree(pEvent);
     259
     260        RTListNodeRemove(&pEvent->Node);
     261
     262        rc = VINF_SUCCESS;
     263    }
     264    else
     265        rc = VERR_NOT_FOUND;
     266
     267    AssertRC(rc);
     268
     269    LogFlowFuncLeaveRC(rc);
     270    return rc;
     271}
     272
     273/**
     274 * Waits for an event to get signalled.
     275 *
     276 * @returns VBox status code.
     277 * @param   pSource             Event source that contains the event to wait for.
     278 * @param   uID                 Event ID to wait for.
     279 * @param   uTimeoutMs          Timeout (in ms) to wait.
     280 * @param   ppPayload           Where to store the (allocated) event payload on success. Needs to be free'd with
     281 *                              SharedClipboardPayloadFree().
     282 */
     283int SharedClipboardEventWait(PSHAREDCLIPBOARDEVENTSOURCE pSource, uint16_t uID, RTMSINTERVAL uTimeoutMs,
     284                             PSHAREDCLIPBOARDEVENTPAYLOAD* ppPayload)
     285{
     286    AssertPtrReturn(pSource, VERR_INVALID_POINTER);
     287
     288    LogFlowFuncEnter();
     289
     290    int rc;
     291
     292    PSHAREDCLIPBOARDEVENT pEvent = sharedClipboardEventGet(pSource, uID);
     293    if (pEvent)
     294    {
     295        rc = RTSemEventWait(pEvent->hEventSem, uTimeoutMs);
     296        if (RT_SUCCESS(rc))
     297        {
     298            *ppPayload = pEvent->pPayload;
     299
     300            pEvent->pPayload = NULL;
     301        }
     302    }
     303    else
     304        rc = VERR_NOT_FOUND;
     305
     306    LogFlowFuncLeaveRC(rc);
     307    return rc;
     308}
     309
     310/**
     311 * Signals an event.
     312 *
     313 * @returns VBox status code.
     314 * @param   pSource             Event source of event to signal.
     315 * @param   uID                 Event ID to signal.
     316 * @param   pPayload            Event payload to associate. Takes ownership. Optional.
     317 */
     318int SharedClipboardEventSignal(PSHAREDCLIPBOARDEVENTSOURCE pSource, uint16_t uID,
     319                               PSHAREDCLIPBOARDEVENTPAYLOAD pPayload)
     320{
     321    AssertPtrReturn(pSource, VERR_INVALID_POINTER);
     322
     323    int rc;
     324
     325    LogFlowFunc(("uSource=%RU16, uEvent=%RU16\n", pSource->uID, uID));
     326
     327    PSHAREDCLIPBOARDEVENT pEvent = sharedClipboardEventGet(pSource, uID);
     328    if (pEvent)
     329    {
     330        Assert(pEvent->pPayload == NULL);
     331
     332        pEvent->pPayload = pPayload;
     333
     334        rc = RTSemEventSignal(pEvent->hEventSem);
     335    }
     336    else
     337        rc = VERR_NOT_FOUND;
     338
     339#ifdef DEBUG_andy
     340    AssertRC(rc);
     341#endif
     342
     343    LogFlowFuncLeaveRC(rc);
     344    return rc;
     345}
     346
     347/**
     348 * Detaches a payload from an event.
     349 *
     350 * @returns VBox status code.
     351 * @param   pSource             Event source of event to detach payload for.
     352 * @param   uID                 Event ID to detach payload for.
     353 */
     354void SharedClipboardEventPayloadDetach(PSHAREDCLIPBOARDEVENTSOURCE pSource, uint16_t uID)
     355{
     356    AssertPtrReturnVoid(pSource);
     357
     358    LogFlowFunc(("uSource=%RU16, uEvent=%RU16\n", pSource->uID, uID));
     359
     360    PSHAREDCLIPBOARDEVENT pEvent = sharedClipboardEventGet(pSource, uID);
     361    if (pEvent)
     362    {
     363        pEvent->pPayload = NULL;
     364    }
     365#ifdef DEBUG_andy
     366    else
     367        AssertMsgFailed(("uSource=%RU16, uEvent=%RU16\n", pSource->uID, uID));
     368#endif
     369}
    30370
    31371/** @todo use const where appropriate; delinuxify the code (*Lin* -> *Host*); use AssertLogRel*. */
     
    421761        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_QUIT);
    422762        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_READ_DATA);
    423         RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_REPORT_FORMATS);
     763        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_FORMATS_WRITE);
    424764        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_TRANSFER_START);
    425765        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_URI_ROOT_LIST_HDR_READ);
     
    453793    switch (uMsg)
    454794    {
    455         RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_REPORT_FORMATS);
    456         RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_READ_DATA);
    457         RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_WRITE_DATA);
     795        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_GET_HOST_MSG_OLD);
     796        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_FORMATS_WRITE);
     797        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_DATA_READ);
     798        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_DATA_WRITE);
     799        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_CONNECT);
    458800        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_PEEK_NOWAIT);
    459801        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_MSG_PEEK_WAIT);
     
    477819        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_CANCEL);
    478820        RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_GUEST_FN_ERROR);
    479         RT_CASE_RET_STR(VBOX_SHARED_CLIPBOARD_HOST_MSG_QUIT);
    480821    }
    481822    return "Unknown";
    482823}
     824
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-uri.cpp

    r80374 r80444  
    2121#include <iprt/dir.h>
    2222#include <iprt/file.h>
     23#include <iprt/list.h>
    2324#include <iprt/path.h>
    2425#include <iprt/semaphore.h>
     
    3132static int sharedClipboardURITransferThreadCreate(PSHAREDCLIPBOARDURITRANSFER pTransfer, PFNRTTHREAD pfnThreadFunc, void *pvUser);
    3233static int sharedClipboardURITransferThreadDestroy(PSHAREDCLIPBOARDURITRANSFER pTransfer, RTMSINTERVAL uTimeoutMs);
    33 static int sharedClipboardURITransferWriteThread(RTTHREAD hThread, void *pvUser);
    3434static PSHAREDCLIPBOARDURITRANSFER sharedClipboardURICtxGetTransferInternal(PSHAREDCLIPBOARDURICTX pURI, uint32_t uIdx);
    3535static int sharedClipboardConvertFileCreateFlags(bool fWritable, unsigned fShClFlags, RTFMODE fMode,
     
    695695        pParms->pszPath = NULL;
    696696    }
     697}
     698
     699/**
     700 * Returns a specific object handle info of a transfer.
     701 *
     702 * @returns Pointer to object handle info if found, or NULL if not found.
     703 * @param   pTransfer           URI clipboard transfer to get object handle info from.
     704 * @param   hObj                Object handle of the object to get handle info for.
     705 */
     706inline PSHAREDCLIPBOARDURIOBJHANDLEINFO sharedClipboardURIObjectGet(PSHAREDCLIPBOARDURITRANSFER pTransfer,
     707                                                                    SHAREDCLIPBOARDOBJHANDLE hObj)
     708{
     709    PSHAREDCLIPBOARDURIOBJHANDLEINFO pIt;
     710    RTListForEach(&pTransfer->lstObj, pIt, SHAREDCLIPBOARDURIOBJHANDLEINFO, Node)
     711    {
     712        if (pIt->hObj == hObj)
     713            return pIt;
     714    }
     715
     716    return NULL;
    697717}
    698718
     
    744764            if (RT_SUCCESS(rc))
    745765            {
    746                 const SHAREDCLIPBOARDOBJHANDLE hObj = pTransfer->uObjHandleNext++;
    747 
     766                pInfo->hObj    = pTransfer->uObjHandleNext++;
    748767                pInfo->enmType = SHAREDCLIPBOARDURIOBJTYPE_FILE;
    749768
    750                 pTransfer->pMapObj->insert(
    751                     std::pair<SHAREDCLIPBOARDOBJHANDLE, PSHAREDCLIPBOARDURIOBJHANDLEINFO>(hObj, pInfo));
    752 
    753                 *phObj = hObj;
     769                RTListAppend(&pTransfer->lstObj, &pInfo->Node);
     770
     771                *phObj = pInfo->hObj;
    754772            }
    755773
     
    789807    if (pTransfer->State.enmSource == SHAREDCLIPBOARDSOURCE_LOCAL)
    790808    {
    791         SharedClipboardURIObjMap::iterator itObj = pTransfer->pMapObj->find(hObj);
    792         if (itObj != pTransfer->pMapObj->end())
    793         {
    794             PSHAREDCLIPBOARDURIOBJHANDLEINFO pInfo = itObj->second;
    795             AssertPtr(pInfo);
    796 
     809        PSHAREDCLIPBOARDURIOBJHANDLEINFO pInfo = sharedClipboardURIObjectGet(pTransfer, hObj);
     810        if (pInfo)
     811        {
    797812            switch (pInfo->enmType)
    798813            {
     
    820835            RTMemFree(pInfo);
    821836
    822             pTransfer->pMapObj->erase(itObj);
     837            RTListNodeRemove(&pInfo->Node);
    823838        }
    824839        else
     
    862877    if (pTransfer->State.enmSource == SHAREDCLIPBOARDSOURCE_LOCAL)
    863878    {
    864         SharedClipboardURIObjMap::iterator itObj = pTransfer->pMapObj->find(hObj);
    865         if (itObj != pTransfer->pMapObj->end())
    866         {
    867             PSHAREDCLIPBOARDURIOBJHANDLEINFO pInfo = itObj->second;
    868             AssertPtr(pInfo);
    869 
     879        PSHAREDCLIPBOARDURIOBJHANDLEINFO pInfo = sharedClipboardURIObjectGet(pTransfer, hObj);
     880        if (pInfo)
     881        {
    870882            switch (pInfo->enmType)
    871883            {
     
    927939    if (pTransfer->State.enmSource == SHAREDCLIPBOARDSOURCE_LOCAL)
    928940    {
    929         SharedClipboardURIObjMap::iterator itObj = pTransfer->pMapObj->find(hObj);
    930         if (itObj != pTransfer->pMapObj->end())
    931         {
    932             PSHAREDCLIPBOARDURIOBJHANDLEINFO pInfo = itObj->second;
    933             AssertPtr(pInfo);
    934 
     941        PSHAREDCLIPBOARDURIOBJHANDLEINFO pInfo = sharedClipboardURIObjectGet(pTransfer, hObj);
     942        if (pInfo)
     943        {
    935944            switch (pInfo->enmType)
    936945            {
     
    10701079    pTransfer->uListHandleNext   = 1;
    10711080    pTransfer->uObjHandleNext    = 1;
    1072     pTransfer->uEventIDNext      = 1;
    10731081
    10741082    pTransfer->uTimeoutMs     = 30 * 1000; /* 30s timeout by default. */
     
    10801088    RT_ZERO(pTransfer->Callbacks);
    10811089
    1082     pTransfer->pMapEvents = new SharedClipboardURITransferEventMap();
    1083     if (pTransfer->pMapEvents)
    1084     {
    1085         pTransfer->pMapLists = new SharedClipboardURIListMap();
    1086         if (pTransfer->pMapLists)
    1087         {
    1088             pTransfer->pMapObj = new SharedClipboardURIObjMap();
    1089             if (pTransfer->pMapObj)
    1090                 *ppTransfer = pTransfer;
    1091         }
    1092     }
    1093     else
    1094         rc = VERR_NO_MEMORY;
     1090    RTListInit(&pTransfer->lstList);
     1091    RTListInit(&pTransfer->lstObj);
     1092
     1093    pTransfer->cRoots = 0;
     1094    RTListInit(&pTransfer->lstRoots);
     1095
     1096    *ppTransfer = pTransfer;
    10951097
    10961098    if (RT_FAILURE(rc))
     
    11261128    RTStrFree(pTransfer->pszPathRootAbs);
    11271129
    1128     if (pTransfer->pMapEvents)
    1129     {
    1130         SharedClipboardURITransferEventMap::iterator itEvent = pTransfer->pMapEvents->begin();
    1131         while (itEvent != pTransfer->pMapEvents->end())
    1132         {
    1133 
    1134             itEvent = pTransfer->pMapEvents->begin();
    1135         }
    1136 
    1137         delete pTransfer->pMapEvents;
    1138         pTransfer->pMapEvents = NULL;
    1139     }
    1140 
    1141     if (pTransfer->pMapLists)
    1142     {
    1143         SharedClipboardURIListMap::iterator itList = pTransfer->pMapLists->begin();
    1144         while (itList != pTransfer->pMapLists->end())
    1145         {
    1146             SharedClipboardURIListHandleInfoDestroy(itList->second);
    1147             pTransfer->pMapLists->erase(itList);
    1148             itList = pTransfer->pMapLists->begin();
    1149         }
    1150 
    1151         Assert(pTransfer->pMapLists->size() == 0);
    1152 
    1153         delete pTransfer->pMapLists;
    1154         pTransfer->pMapLists = NULL;
    1155     }
    1156 
    1157     if (pTransfer->pMapObj)
    1158     {
    1159         SharedClipboardURIObjMap::iterator itObj = pTransfer->pMapObj->begin();
    1160         while (itObj != pTransfer->pMapObj->end())
    1161         {
    1162             SharedClipboardURIObjectHandleInfoDestroy(itObj->second);
    1163             pTransfer->pMapObj->erase(itObj);
    1164             itObj = pTransfer->pMapObj->begin();
    1165         }
    1166 
    1167         Assert(pTransfer->pMapObj->size() == 0);
    1168 
    1169         delete pTransfer->pMapObj;
    1170         pTransfer->pMapObj = NULL;
     1130    SharedClipboardEventSourceDestroy(&pTransfer->Events);
     1131
     1132    PSHAREDCLIPBOARDURILISTHANDLEINFO pItList, pItListNext;
     1133    RTListForEachSafe(&pTransfer->lstList, pItList, pItListNext, SHAREDCLIPBOARDURILISTHANDLEINFO, Node)
     1134    {
     1135        SharedClipboardURIListHandleInfoDestroy(pItList);
     1136
     1137        RTListNodeRemove(&pItList->Node);
     1138
     1139        RTMemFree(pItList);
     1140    }
     1141
     1142    PSHAREDCLIPBOARDURIOBJHANDLEINFO pItObj, pItObjNext;
     1143    RTListForEachSafe(&pTransfer->lstObj, pItObj, pItObjNext, SHAREDCLIPBOARDURIOBJHANDLEINFO, Node)
     1144    {
     1145        SharedClipboardURIObjectHandleInfoDestroy(pItObj);
     1146
     1147        RTListNodeRemove(&pItObj->Node);
     1148
     1149        RTMemFree(pItObj);
    11711150    }
    11721151
     
    11981177
    11991178/**
     1179 * Returns a specific list handle info of a transfer.
     1180 *
     1181 * @returns Pointer to list handle info if found, or NULL if not found.
     1182 * @param   pTransfer           URI clipboard transfer to get list handle info from.
     1183 * @param   hList               List handle of the list to get handle info for.
     1184 */
     1185inline PSHAREDCLIPBOARDURILISTHANDLEINFO sharedClipboardURITransferListGet(PSHAREDCLIPBOARDURITRANSFER pTransfer,
     1186                                                                           SHAREDCLIPBOARDLISTHANDLE hList)
     1187{
     1188    PSHAREDCLIPBOARDURILISTHANDLEINFO pIt;
     1189    RTListForEach(&pTransfer->lstList, pIt, SHAREDCLIPBOARDURILISTHANDLEINFO, Node)
     1190    {
     1191        if (pIt->hList == hList)
     1192            return pIt;
     1193    }
     1194
     1195    return NULL;
     1196}
     1197
     1198/**
    12001199 * Creates a new list handle (local only).
    12011200 *
     
    12031202 * @param   pTransfer           URI clipboard transfer to create new list handle for.
    12041203 */
    1205 static SHAREDCLIPBOARDLISTHANDLE sharedClipboardURITransferListHandleNew(PSHAREDCLIPBOARDURITRANSFER pTransfer)
     1204inline SHAREDCLIPBOARDLISTHANDLE sharedClipboardURITransferListHandleNew(PSHAREDCLIPBOARDURITRANSFER pTransfer)
    12061205{
    12071206    return pTransfer->uListHandleNext++; /** @todo Good enough for now. Improve this later. */
     
    12441243                    {
    12451244                        rc = RTDirOpen(&pInfo->u.Local.hDir, pOpenParms->pszPath);
     1245                        break;
    12461246                    }
    12471247
     
    12601260                if (RT_SUCCESS(rc))
    12611261                {
    1262                     hList = sharedClipboardURITransferListHandleNew(pTransfer);
    1263 
    1264                     pTransfer->pMapLists->insert(
    1265                         std::pair<SHAREDCLIPBOARDLISTHANDLE, PSHAREDCLIPBOARDURILISTHANDLEINFO>(hList, pInfo)); /** @todo Can this throw? */
     1262                    pInfo->hList = sharedClipboardURITransferListHandleNew(pTransfer);
     1263
     1264                    RTListAppend(&pTransfer->lstList, &pInfo->Node);
    12661265                }
    12671266                else
     
    13231322    if (pTransfer->State.enmSource == SHAREDCLIPBOARDSOURCE_LOCAL)
    13241323    {
    1325         SharedClipboardURIListMap::iterator itList = pTransfer->pMapLists->find(hList);
    1326         if (itList != pTransfer->pMapLists->end())
    1327         {
    1328             PSHAREDCLIPBOARDURILISTHANDLEINFO pInfo = itList->second;
    1329             AssertPtr(pInfo);
    1330 
     1324        PSHAREDCLIPBOARDURILISTHANDLEINFO pInfo = sharedClipboardURITransferListGet(pTransfer, hList);
     1325        if (pInfo)
     1326        {
    13311327            switch (pInfo->enmType)
    13321328            {
     
    13431339            }
    13441340
     1341            RTListNodeRemove(&pInfo->Node);
     1342
    13451343            RTMemFree(pInfo);
    1346 
    1347             pTransfer->pMapLists->erase(itList);
    13481344        }
    13491345        else
     
    15591555    if (pTransfer->State.enmSource == SHAREDCLIPBOARDSOURCE_LOCAL)
    15601556    {
    1561         SharedClipboardURIListMap::iterator itList = pTransfer->pMapLists->find(hList);
    1562         if (itList != pTransfer->pMapLists->end())
     1557        PSHAREDCLIPBOARDURILISTHANDLEINFO pInfo = sharedClipboardURITransferListGet(pTransfer, hList);
     1558        if (pInfo)
    15631559        {
    15641560            rc = SharedClipboardURIListHdrInit(pHdr);
    15651561            if (RT_SUCCESS(rc))
    15661562            {
    1567                 PSHAREDCLIPBOARDURILISTHANDLEINFO pInfo = itList->second;
    1568                 AssertPtr(pInfo);
    1569 
    15701563                switch (pInfo->enmType)
    15711564                {
     
    16661659    if (pTransfer->State.enmSource == SHAREDCLIPBOARDSOURCE_LOCAL)
    16671660    {
    1668         SharedClipboardURIListMap::iterator itList = pTransfer->pMapLists->find(hList);
    1669         if (itList != pTransfer->pMapLists->end())
    1670         {
    1671             PSHAREDCLIPBOARDURILISTHANDLEINFO pInfo = itList->second;
    1672             AssertPtr(pInfo);
    1673 
     1661        PSHAREDCLIPBOARDURILISTHANDLEINFO pInfo = sharedClipboardURITransferListGet(pTransfer, hList);
     1662        if (pInfo)
     1663        {
    16741664            switch (pInfo->enmType)
    16751665            {
     
    18261816    if (pTransfer->State.enmSource == SHAREDCLIPBOARDSOURCE_LOCAL)
    18271817    {
    1828         SharedClipboardURIListMap::iterator itList = pTransfer->pMapLists->find(hList);
    1829         fIsValid = itList != pTransfer->pMapLists->end();
     1818        fIsValid = sharedClipboardURITransferListGet(pTransfer, hList) != NULL;
    18301819    }
    18311820    else if (pTransfer->State.enmSource == SHAREDCLIPBOARDSOURCE_REMOTE)
     
    19271916    }
    19281917
    1929     pTransfer->lstRootEntries.clear();
     1918    PSHAREDCLIPBOARDURILISTROOT pListRoot, pListRootNext;
     1919    RTListForEachSafe(&pTransfer->lstRoots, pListRoot, pListRootNext, SHAREDCLIPBOARDURILISTROOT, Node)
     1920    {
     1921        RTStrFree(pListRoot->pszPathAbs);
     1922
     1923        RTListNodeRemove(&pListRoot->Node);
     1924
     1925        RTMemFree(pListRoot);
     1926        pListRoot = NULL;
     1927    }
     1928
     1929    pTransfer->cRoots = 0;
    19301930}
    19311931
     
    19521952    sharedClipboardURIListTransferRootsClear(pTransfer);
    19531953
    1954     char *pszPathRootAbs = NULL;
     1954    char  *pszPathRootAbs = NULL;
    19551955
    19561956    RTCList<RTCString> lstRootEntries = RTCString(pszRoots, cbRoots - 1).split("\r\n");
    19571957    for (size_t i = 0; i < lstRootEntries.size(); ++i)
    19581958    {
    1959         SHAREDCLIPBOARDURILISTROOT listRoot;
    1960         listRoot.strPathAbs = lstRootEntries.at(i);
     1959        PSHAREDCLIPBOARDURILISTROOT pListRoot = (PSHAREDCLIPBOARDURILISTROOT)RTMemAlloc(sizeof(SHAREDCLIPBOARDURILISTROOT));
     1960        AssertPtrBreakStmt(pListRoot, rc = VERR_NO_MEMORY);
     1961
     1962        pListRoot->pszPathAbs = RTStrDup(lstRootEntries.at(i).c_str());
     1963        AssertPtrBreakStmt(pListRoot->pszPathAbs, rc = VERR_NO_MEMORY);
    19611964
    19621965        if (!pszPathRootAbs)
    19631966        {
    1964             pszPathRootAbs = RTStrDup(listRoot.strPathAbs.c_str());
     1967            pszPathRootAbs = RTStrDup(pListRoot->pszPathAbs);
    19651968            if (pszPathRootAbs)
    19661969            {
     
    19761979
    19771980        /* Make sure all entries have the same root path. */
    1978         if (!RTStrStartsWith(listRoot.strPathAbs.c_str(), pszPathRootAbs))
     1981        if (!RTStrStartsWith(pListRoot->pszPathAbs, pszPathRootAbs))
    19791982        {
    19801983            rc = VERR_INVALID_PARAMETER;
     
    19821985        }
    19831986
    1984         pTransfer->lstRootEntries.append(listRoot);
     1987        RTListAppend(&pTransfer->lstRoots, &pListRoot->Node);
     1988
     1989        pTransfer->cRoots++;
    19851990    }
    19861991
     
    19901995    {
    19911996        pTransfer->pszPathRootAbs = pszPathRootAbs;
    1992         LogFlowFunc(("pszPathRootAbs=%s, cRoots=%zu\n", pTransfer->pszPathRootAbs, pTransfer->lstRootEntries.size()));
     1997        LogFlowFunc(("pszPathRootAbs=%s, cRoots=%zu\n", pTransfer->pszPathRootAbs, pTransfer->cRoots));
    19931998    }
    19941999
     
    20342039    AssertPtrReturn(pTransfer, 0);
    20352040
    2036     return (uint32_t)pTransfer->lstRootEntries.size();
     2041    return (uint32_t)pTransfer->cRoots;
     2042}
     2043
     2044/**
     2045 * Returns a specific root list entry of a transfer.
     2046 *
     2047 * @returns Pointer to root list entry if found, or NULL if not found.
     2048 * @param   pTransfer           URI clipboard transfer to get root list entry from.
     2049 * @param   uIdx                Index of root list entry to return.
     2050 */
     2051inline PSHAREDCLIPBOARDURILISTROOT sharedClipboardURILTransferRootsGet(PSHAREDCLIPBOARDURITRANSFER pTransfer, uint32_t uIdx)
     2052{
     2053    if (uIdx >= pTransfer->cRoots)
     2054        return NULL;
     2055
     2056    PSHAREDCLIPBOARDURILISTROOT pIt = RTListGetFirst(&pTransfer->lstRoots, SHAREDCLIPBOARDURILISTROOT, Node);
     2057    while (uIdx--)
     2058        pIt = RTListGetNext(&pTransfer->lstRoots, pIt, SHAREDCLIPBOARDURILISTROOT, Node);
     2059
     2060    return pIt;
    20372061}
    20382062
     
    20462070 */
    20472071int SharedClipboardURILTransferRootsEntry(PSHAREDCLIPBOARDURITRANSFER pTransfer,
    2048                                           uint32_t uIndex, PVBOXCLIPBOARDROOTLISTENTRY pEntry)
     2072                                          uint64_t uIndex, PVBOXCLIPBOARDROOTLISTENTRY pEntry)
    20492073{
    20502074    AssertPtrReturn(pTransfer, VERR_INVALID_POINTER);
    20512075    AssertPtrReturn(pEntry,    VERR_INVALID_POINTER);
    20522076
    2053     if (uIndex >= pTransfer->lstRootEntries.size())
     2077    if (uIndex >= pTransfer->cRoots)
    20542078        return VERR_INVALID_PARAMETER;
    20552079
    20562080    int rc;
    20572081
    2058     PSHAREDCLIPBOARDURILISTROOT pRoot = &pTransfer->lstRootEntries.at(uIndex);
    2059     AssertPtrReturn(pRoot, VERR_INVALID_POINTER);
     2082    PSHAREDCLIPBOARDURILISTROOT pRoot = sharedClipboardURILTransferRootsGet(pTransfer, uIndex);
     2083    AssertPtrReturn(pRoot, VERR_INVALID_PARAMETER);
    20602084
    20612085    /* Make sure that we only advertise relative source paths, not absolute ones. */
    2062     const char *pcszSrcPath = pRoot->strPathAbs.c_str();
     2086    const char *pcszSrcPath = pRoot->pszPathAbs;
    20632087
    20642088    char *pszFileName = RTPathFilename(pcszSrcPath);
     
    21242148            return VERR_NO_MEMORY;
    21252149
    2126         const uint32_t cRoots = (uint32_t)pTransfer->lstRootEntries.size();
    2127 
    2128         LogFlowFunc(("cRoots=%RU32\n", cRoots));
     2150        const uint64_t cRoots = (uint32_t)pTransfer->cRoots;
     2151
     2152        LogFlowFunc(("cRoots=%RU64\n", cRoots));
    21292153
    21302154        if (cRoots)
     
    21342158            if (paRootListEntries)
    21352159            {
    2136                 for (uint32_t i = 0; i < cRoots; ++i)
     2160                for (uint64_t i = 0; i < cRoots; ++i)
    21372161                {
    21382162                    rc = SharedClipboardURILTransferRootsEntry(pTransfer, i, &paRootListEntries[i]);
     
    22502274
    22512275/**
    2252  * Allocates a new event payload.
    2253  *
    2254  * @returns VBox status code.
    2255  * @param   uID                 Event ID to associate payload to.
    2256  * @param   pvData              Data block to associate to this payload.
    2257  * @param   cbData              Size (in bytes) of data block to associate.
    2258  * @param   ppPayload           Where to store the allocated event payload on success.
    2259  */
    2260 int SharedClipboardURITransferPayloadAlloc(uint32_t uID, const void *pvData, uint32_t cbData,
    2261                                            PSHAREDCLIPBOARDURITRANSFERPAYLOAD *ppPayload)
    2262 {
    2263     PSHAREDCLIPBOARDURITRANSFERPAYLOAD pPayload =
    2264         (PSHAREDCLIPBOARDURITRANSFERPAYLOAD)RTMemAlloc(sizeof(SHAREDCLIPBOARDURITRANSFERPAYLOAD));
    2265     if (!pPayload)
    2266         return VERR_NO_MEMORY;
    2267 
    2268     pPayload->pvData = RTMemAlloc(cbData);
    2269     if (pPayload->pvData)
    2270     {
    2271         memcpy(pPayload->pvData, pvData, cbData);
    2272 
    2273         pPayload->cbData = cbData;
    2274         pPayload->uID    = uID;
    2275 
    2276         *ppPayload = pPayload;
    2277 
    2278         return VINF_SUCCESS;
    2279     }
    2280 
    2281     RTMemFree(pPayload);
    2282     return VERR_NO_MEMORY;
    2283 }
    2284 
    2285 /**
    2286  * Frees an event payload.
    2287  *
    2288  * @returns VBox status code.
    2289  * @param   pPayload            URI clipboard transfer event payload to free.
    2290  */
    2291 void SharedClipboardURITransferPayloadFree(PSHAREDCLIPBOARDURITRANSFERPAYLOAD pPayload)
    2292 {
    2293     if (!pPayload)
    2294         return;
    2295 
    2296     if (pPayload->pvData)
    2297     {
    2298         Assert(pPayload->cbData);
    2299         RTMemFree(pPayload->pvData);
    2300         pPayload->pvData = NULL;
    2301     }
    2302 
    2303     pPayload->cbData = 0;
    2304 
    2305     RTMemFree(pPayload);
    2306     pPayload = NULL;
    2307 }
    2308 
    2309 /**
    2310  * Generates a new event ID for a specific URI transfer.
    2311  *
    2312  * @returns New event ID generated, or 0 on error.
    2313  * @param   pTransfer           URI clipboard transfer to generate event for.
    2314  */
    2315 uint16_t SharedClipboardURITransferEventIDGenerate(PSHAREDCLIPBOARDURITRANSFER pTransfer)
    2316 {
    2317     LogFlowFunc(("New event %RU16\n", pTransfer->uEventIDNext));
    2318     return pTransfer->uEventIDNext++; /** @todo Improve this. */
    2319 }
    2320 
    2321 /**
    2322  * Registers an URI transfer event.
    2323  *
    2324  * @returns VBox status code.
    2325  * @param   pTransfer           URI clipboard transfer to register event for.
    2326  * @param   uID                 Event ID to register.
    2327  */
    2328 int SharedClipboardURITransferEventRegister(PSHAREDCLIPBOARDURITRANSFER pTransfer, uint16_t uID)
    2329 {
    2330     int rc;
    2331 
    2332     SharedClipboardURITransferEventMap::iterator itEvent = pTransfer->pMapEvents->find(uID);
    2333     if (itEvent == pTransfer->pMapEvents->end())
    2334     {
    2335         PSHAREDCLIPBOARDURITRANSFEREVENT pEvent
    2336             = (PSHAREDCLIPBOARDURITRANSFEREVENT)RTMemAllocZ(sizeof(SHAREDCLIPBOARDURITRANSFEREVENT));
    2337         if (pEvent)
    2338         {
    2339             rc = RTSemEventCreate(&pEvent->hEventSem);
    2340             if (RT_SUCCESS(rc))
    2341             {
    2342                 pTransfer->pMapEvents->insert(std::pair<uint16_t, PSHAREDCLIPBOARDURITRANSFEREVENT>(uID, pEvent)); /** @todo Can this throw? */
    2343 
    2344                 LogFlowFunc(("Event %RU16\n", uID));
    2345             }
    2346         }
    2347         else
    2348             rc = VERR_NO_MEMORY;
    2349     }
    2350     else
    2351         rc = VERR_ALREADY_EXISTS;
    2352 
    2353 #ifdef DEBUG_andy
    2354     AssertRC(rc);
    2355 #endif
    2356 
    2357     LogFlowFuncLeaveRC(rc);
    2358     return rc;
    2359 }
    2360 
    2361 /**
    2362  * Unregisters an URI transfer event.
    2363  *
    2364  * @returns VBox status code.
    2365  * @param   pTransfer           URI clipboard transfer to unregister event for.
    2366  * @param   uID                 Event ID to unregister.
    2367  */
    2368 int SharedClipboardURITransferEventUnregister(PSHAREDCLIPBOARDURITRANSFER pTransfer, uint16_t uID)
    2369 {
    2370     int rc;
    2371 
    2372     SharedClipboardURITransferEventMap::const_iterator itEvent = pTransfer->pMapEvents->find(uID);
    2373     if (itEvent != pTransfer->pMapEvents->end())
    2374     {
    2375         SharedClipboardURITransferPayloadFree(itEvent->second->pPayload);
    2376 
    2377         RTSemEventDestroy(itEvent->second->hEventSem);
    2378 
    2379         RTMemFree(itEvent->second);
    2380 
    2381         pTransfer->pMapEvents->erase(itEvent);
    2382 
    2383         LogFlowFunc(("Event %RU16\n", uID));
    2384 
    2385         rc = VINF_SUCCESS;
    2386     }
    2387     else
    2388         rc = VERR_NOT_FOUND;
    2389 
    2390     AssertRC(rc);
    2391 
    2392     LogFlowFuncLeaveRC(rc);
    2393     return rc;
    2394 }
    2395 
    2396 /**
    2397  * Waits for an URI transfer event to get signalled.
    2398  *
    2399  * @returns VBox status code.
    2400  * @param   pTransfer           URI clipboard transfer that contains the event to wait for.
    2401  * @param   uID                 Event ID to wait for.
    2402  * @param   uTimeoutMs          Timeout (in ms) to wait.
    2403  * @param   ppPayload           Where to store the (allocated) event payload on success. Needs to be free'd with
    2404  *                              SharedClipboardURITransferPayloadFree().
    2405  */
    2406 int SharedClipboardURITransferEventWait(PSHAREDCLIPBOARDURITRANSFER pTransfer, uint16_t uID, RTMSINTERVAL uTimeoutMs,
    2407                                         PSHAREDCLIPBOARDURITRANSFERPAYLOAD *ppPayload)
    2408 {
    2409     LogFlowFuncEnter();
    2410 
    2411     int rc;
    2412 
    2413     SharedClipboardURITransferEventMap::const_iterator itEvent = pTransfer->pMapEvents->find(uID);
    2414     if (itEvent != pTransfer->pMapEvents->end())
    2415     {
    2416         rc = RTSemEventWait(itEvent->second->hEventSem, uTimeoutMs);
    2417         if (RT_SUCCESS(rc))
    2418         {
    2419             *ppPayload = itEvent->second->pPayload;
    2420 
    2421             itEvent->second->pPayload = NULL;
    2422         }
    2423     }
    2424     else
    2425         rc = VERR_NOT_FOUND;
    2426 
    2427     LogFlowFuncLeaveRC(rc);
    2428     return rc;
    2429 }
    2430 
    2431 /**
    2432  * Signals an URI transfer event.
    2433  *
    2434  * @returns VBox status code.
    2435  * @param   pTransfer           URI clipboard transfer of event to signal.
    2436  * @param   uID                 Event ID to signal.
    2437  * @param   pPayload            Event payload to associate. Takes ownership. Optional.
    2438  */
    2439 int SharedClipboardURITransferEventSignal(PSHAREDCLIPBOARDURITRANSFER pTransfer, uint16_t uID,
    2440                                           PSHAREDCLIPBOARDURITRANSFERPAYLOAD pPayload)
    2441 {
    2442     int rc;
    2443 
    2444     SharedClipboardURITransferEventMap::const_iterator itEvent = pTransfer->pMapEvents->find(uID);
    2445     if (itEvent != pTransfer->pMapEvents->end())
    2446     {
    2447         Assert(itEvent->second->pPayload == NULL);
    2448 
    2449         itEvent->second->pPayload = pPayload;
    2450 
    2451         rc = RTSemEventSignal(itEvent->second->hEventSem);
    2452     }
    2453     else
    2454         rc = VERR_NOT_FOUND;
    2455 
    2456 #ifdef DEBUG_andy
    2457     AssertRC(rc);
    2458 #endif
    2459 
    2460     LogFlowFuncLeaveRC(rc);
    2461     return rc;
    2462 }
    2463 
    2464 /**
    24652276 * Creates a thread for a clipboard URI transfer.
    24662277 *
     
    27082519    AssertPtrReturnVoid(pURI);
    27092520
    2710     LogFlowFunc(("cRunning=%RU32\n", pURI->cRunning));
     2521    LogFlowFunc(("cTransfers=%RU32, cRunning=%RU32\n", pURI->cTransfers, pURI->cRunning));
    27112522
    27122523    /* Remove all transfers which are not in a running state (e.g. only announced). */
     
    27242535            Assert(pURI->cTransfers);
    27252536            pURI->cTransfers--;
    2726 
    2727             LogFlowFunc(("cTransfers=%RU32\n", pURI->cTransfers));
    27282537        }
    27292538    }
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-win.cpp

    r79672 r80444  
    384384 * @returns VBox status code.
    385385 * @param   pCtx                Windows clipboard context to retrieve formats for.
    386  * @param   pfFormats           Where to store the retrieved formats of type VBOX_SHARED_CLIPBOARD_FMT_ (bitmask).
    387  */
    388 int VBoxClipboardWinGetFormats(PVBOXCLIPBOARDWINCTX pCtx, PVBOXCLIPBOARDFORMATS pfFormats)
    389 {
    390     AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
    391     AssertPtrReturn(pfFormats, VERR_INVALID_POINTER);
     386 * @param   pFormats            Where to store the retrieved formats.
     387 */
     388int VBoxClipboardWinGetFormats(PVBOXCLIPBOARDWINCTX pCtx, PSHAREDCLIPBOARDFORMATDATA pFormats)
     389{
     390    AssertPtrReturn(pCtx,     VERR_INVALID_POINTER);
     391    AssertPtrReturn(pFormats, VERR_INVALID_POINTER);
    392392
    393393    VBOXCLIPBOARDFORMATS fFormats = VBOX_SHARED_CLIPBOARD_FMT_NONE;
     
    412412    {
    413413        LogFlowFunc(("fFormats=0x%08X\n", fFormats));
    414         *pfFormats = fFormats;
     414
     415        pFormats->uFormats   = fFormats;
     416        pFormats->fFlags = 0; /** @todo Handle flags. */
    415417    }
    416418
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp

    r78583 r80444  
    588588 *        unit test.  So keep it simple, be paranoid and log everything.
    589589 */
    590 static void clipConvertX11Targets(Widget widget, XtPointer pClientData,
     590static void clipConvertX11Targets(Widget widget, XtPointer pClient,
    591591                                  Atom * /* selection */, Atom *atomType,
    592592                                  XtPointer pValue, long unsigned int *pcLen,
     
    594594{
    595595    RT_NOREF1(piFormat);
    596     CLIPBACKEND *pCtx = reinterpret_cast<CLIPBACKEND *>(pClientData);
     596    CLIPBACKEND *pCtx = reinterpret_cast<CLIPBACKEND *>(pClient);
    597597    Atom *pAtoms = (Atom *)pValue;
    598598    unsigned i, j;
     
    17641764 *        the X11 clipboard contains a format we understand.
    17651765 */
    1766 static void clipConvertX11CB(void *pClientData, void *pvSrc, unsigned cbSrc)
    1767 {
    1768     CLIPREADX11CBREQ *pReq = (CLIPREADX11CBREQ *) pClientData;
     1766static void clipConvertX11CB(void *pClient, void *pvSrc, unsigned cbSrc)
     1767{
     1768    CLIPREADX11CBREQ *pReq = (CLIPREADX11CBREQ *) pClient;
    17691769    LogRelFlowFunc(("pReq->mFormat=%02X, pReq->mTextFormat=%u, "
    17701770                "pReq->mBitmapFormat=%u, pReq->mHtmlFormat=%u, pReq->mCtx=%p\n",
     
    19091909 *        the X11 clipboard contains a format we understand.
    19101910 */
    1911 static void cbConvertX11CB(Widget widget, XtPointer pClientData,
     1911static void cbConvertX11CB(Widget widget, XtPointer pClient,
    19121912                           Atom * /* selection */, Atom *atomType,
    19131913                           XtPointer pvSrc, long unsigned int *pcLen,
     
    19161916    RT_NOREF1(widget);
    19171917    if (*atomType == XT_CONVERT_FAIL) /* Xt timeout */
    1918         clipConvertX11CB(pClientData, NULL, 0);
     1918        clipConvertX11CB(pClient, NULL, 0);
    19191919    else
    1920         clipConvertX11CB(pClientData, pvSrc, (*pcLen) * (*piFormat) / 8);
     1920        clipConvertX11CB(pClient, pvSrc, (*pcLen) * (*piFormat) / 8);
    19211921
    19221922    XtFree((char *)pvSrc);
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