Changeset 103363 in vbox
- Timestamp:
- Feb 14, 2024 5:23:47 PM (10 months ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/err.h
r102977 r103363 3203 3203 /** Shared Clipboard event failed error. */ 3204 3204 #define VERR_SHCLPB_EVENT_FAILED (-7152) 3205 /** No clipboard data available for requested format. */ 3206 #define VERR_SHCLPB_NO_DATA (-7153) 3205 3207 /** @} */ 3206 3208 -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp
r100657 r103363 103 103 /** 104 104 * Worker for a reading clipboard from the host. 105 * 106 * @returns VBox status code. 107 * @retval VERR_SHCLPB_NO_DATA if no clipboard data is available. 108 * @param pCtx Shared Clipbaord context to use. 109 * @param uFmt The format to read clipboard data in. 110 * @param ppv Where to return the allocated data read. 111 * Must be free'd by the caller. 112 * @param pcb Where to return number of bytes read. 113 * @param pvUser User-supplied context. 105 114 */ 106 115 static DECLCALLBACK(int) vbtrReadDataWorker(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb, void *pvUser) … … 110 119 LogFlowFuncEnter(); 111 120 112 int rc = VERR_NO_DATA; /* Play safe. */121 int rc; 113 122 114 123 uint32_t cbRead = 0; … … 145 154 146 155 if (!cbRead) 147 rc = VERR_ NO_DATA;156 rc = VERR_SHCLPB_NO_DATA; 148 157 149 158 if (RT_SUCCESS(rc)) -
trunk/src/VBox/Additions/x11/VBoxClient/clipboard-common.cpp
r101721 r103363 109 109 } 110 110 111 /** 112 * Reads clipboard from the host. 113 * 114 * @returns VBox status code. 115 * @retval VERR_SHCLPB_NO_DATA if no clipboard data is available. 116 * @param pCtx Shared Clipbaord context to use. 117 * @param uFmt The format to read clipboard data in. 118 * @param ppv Where to return the allocated data read. 119 * Must be free'd by the caller. 120 * @param pcb Where to return number of bytes read. 121 */ 111 122 RTDECL(int) VBClClipboardReadHostClipboard(PVBGLR3SHCLCMDCTX pCtx, SHCLFORMAT uFmt, void **ppv, uint32_t *pcb) 112 123 { … … 153 164 154 165 if (!cbRead) 155 rc = VERR_ NO_DATA;166 rc = VERR_SHCLPB_NO_DATA; 156 167 157 168 if (RT_FAILURE(rc)) -
trunk/src/VBox/Additions/x11/VBoxClient/clipboard-x11.cpp
r103323 r103363 212 212 LogFlowFuncEnter(); 213 213 214 int rc = VERR_NO_DATA; /* Play safe. */214 int rc; 215 215 216 216 uint32_t cbRead = 0; … … 247 247 248 248 if (!cbRead) 249 rc = VERR_ NO_DATA;249 rc = VERR_SHCLPB_NO_DATA; 250 250 251 251 if (RT_SUCCESS(rc)) -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp
r103323 r103363 1495 1495 * Helper for clipConvertToX11Data() that will cache the data returned. 1496 1496 * 1497 * @returns VBox status code. VERR_ NO_DATA if no data available.1497 * @returns VBox status code. VERR_SHCLPB_NO_DATA if no data available. 1498 1498 * @param pCtx The X11 clipboard context to use. 1499 1499 * @param uFmt Clipboard format to read data in. … … 1553 1553 1554 1554 /* Safey net in case the stuff above misbehaves 1555 * (must return VERR_ NO_DATA if no data available). */1555 * (must return VERR_SHCLPB_NO_DATA if no data available). */ 1556 1556 if ( RT_SUCCESS(rc) 1557 1557 && (pv == NULL || cb == 0)) 1558 rc = VERR_ NO_DATA;1558 rc = VERR_SHCLPB_NO_DATA; 1559 1559 1560 1560 if (RT_SUCCESS(rc)) … … 1564 1564 } 1565 1565 1566 if (RT_FAILURE(rc)) 1566 if ( RT_FAILURE(rc) 1567 && rc != VERR_SHCLPB_NO_DATA) 1567 1568 LogRel(("Shared Clipboard: Requesting data for X11 from source failed with %Rrc\n", rc)); 1568 1569 … … 1605 1606 * Satisfies a request from X11 to convert the clipboard text to UTF-8 LF. 1606 1607 * 1607 * @returns VBox status code. VERR_ NO_DATA if no data was converted.1608 * @returns VBox status code. VERR_SHCLPB_NO_DATA if no data was converted. 1608 1609 * @param pDisplay An X11 display structure, needed for conversions 1609 1610 * performed by Xlib. … … 1633 1634 const size_t cwcSrc = cbSrc / sizeof(RTUTF16); 1634 1635 if (!cwcSrc) 1635 return VERR_ NO_DATA;1636 return VERR_SHCLPB_NO_DATA; 1636 1637 1637 1638 /* This may slightly overestimate the space needed. */ … … 1866 1867 } 1867 1868 1868 if (RT_FAILURE(rc)) 1869 if ( RT_FAILURE(rc) 1870 && rc != VERR_SHCLPB_NO_DATA) 1869 1871 { 1870 1872 char *pszFmts2 = ShClFormatsToStrA(pCtx->vboxFormats); … … 2247 2249 { 2248 2250 /* The clipboard selection may have changed before we could get it. */ 2249 rc = VERR_ NO_DATA;2251 rc = VERR_SHCLPB_NO_DATA; 2250 2252 } 2251 2253 else if (pReq->Read.uFmtVBox == VBOX_SHCL_FMT_UNICODETEXT) … … 2584 2586 LogFlowFunc(("pReq->uFmtVBox=%#x, idxFmtX11=%#x\n", pReq->Read.uFmtVBox, pReq->Read.idxFmtX11)); 2585 2587 2586 int rc = VERR_ NO_DATA; /* VBox thinks we have data and we don't. */2588 int rc = VERR_SHCLPB_NO_DATA; /* VBox thinks we have data and we don't. */ 2587 2589 2588 2590 #ifdef VBOX_WITH_SHARED_CLIPBOARD_XT_BUSY … … 2704 2706 * 2705 2707 * @returns VBox status code. 2706 * @retval VERR_ NO_DATA if format is supported but no data is available currently.2708 * @retval VERR_SHCLPB_NO_DATA if format is supported but no data is available currently. 2707 2709 * @retval VERR_NOT_IMPLEMENTED if the format is not implemented. 2708 2710 * @param pCtx Context data for the clipboard backend. … … 2745 2747 } 2746 2748 else /* No payload given; could happen on invalid / not-expected formats. */ 2747 rc = VERR_ NO_DATA;2749 rc = VERR_SHCLPB_NO_DATA; 2748 2750 } 2749 2751 else if (rc == VERR_SHCLPB_EVENT_FAILED) … … 2762 2764 * 2763 2765 * @returns VBox status code. 2764 * @retval VERR_ NO_DATA if format is supported but no data is available currently.2766 * @retval VERR_SHCLPB_NO_DATA if format is supported but no data is available currently. 2765 2767 * @retval VERR_NOT_IMPLEMENTED if the format is not implemented. 2766 2768 * @param pCtx Context data for the clipboard backend. … … 2807 2809 * 2808 2810 * @returns VBox status code. 2809 * @retval VERR_ NO_DATA if format is supported but no data is available currently.2811 * @retval VERR_SHCLPB_NO_DATA if format is supported but no data is available currently. 2810 2812 * @retval VERR_NOT_IMPLEMENTED if the format is not implemented. 2811 2813 * @param pCtx Context data for the clipboard backend. -
trunk/src/VBox/GuestHost/SharedClipboard/testcase/tstClipboardGH-X11.cpp
r103239 r103363 739 739 RTTestSub(hTest, "X11 conversion failure (timeout)"); 740 740 tstClipSetSelectionValues("UTF8_STRING", XT_CONVERT_FAIL, NULL,0, 8); 741 tstStringFromX11(hTest, &X11Ctx, "", VERR_ NO_DATA);741 tstStringFromX11(hTest, &X11Ctx, "", VERR_SHCLPB_NO_DATA); 742 742 743 743 /* … … 747 747 tstClipSetSelectionValues("UTF8_STRING", XA_STRING, NULL, 0, 8); 748 748 rc = ShClX11ReadDataFromX11(&X11Ctx, &g_EventSource, g_msTimeout, VBOX_SHCL_FMT_UNICODETEXT, abBuf, sizeof(abBuf), &cbActual); 749 RTTEST_CHECK_MSG(hTest, rc == VERR_ NO_DATA,750 (hTest, "Returned %Rrc instead of VERR_ NO_DATA\n",749 RTTEST_CHECK_MSG(hTest, rc == VERR_SHCLPB_NO_DATA, 750 (hTest, "Returned %Rrc instead of VERR_SHCLPB_NO_DATA\n", 751 751 rc)); 752 752 … … 765 765 RTTestSub(hTest, "a request for an invalid VBox format from X11"); 766 766 /* Testing for 0xffff will go into handling VBOX_SHCL_FMT_UNICODETEXT, where we don't have 767 * have any data at the moment so far, so this will return VERR_ NO_DATA. */767 * have any data at the moment so far, so this will return VERR_SHCLPB_NO_DATA. */ 768 768 rc = ShClX11ReadDataFromX11(&X11Ctx, &g_EventSource, g_msTimeout, 0xffff /* vboxFormat */, abBuf, sizeof(abBuf), &cbActual); 769 RTTEST_CHECK_MSG(hTest, rc == VERR_ NO_DATA,770 (hTest, "Returned %Rrc instead of VERR_ NO_DATA\n",769 RTTEST_CHECK_MSG(hTest, rc == VERR_SHCLPB_NO_DATA, 770 (hTest, "Returned %Rrc instead of VERR_SHCLPB_NO_DATA\n", 771 771 rc)); 772 772 /* -
trunk/src/VBox/GuestHost/SharedClipboard/testcase/tstClipboardGH-X11Smoke.cpp
r102929 r103363 33 33 #include <iprt/assert.h> 34 34 #include <iprt/env.h> 35 #include <iprt/err.h>36 35 #include <iprt/test.h> 37 36 37 #include <VBox/err.h> 38 38 #include <VBox/GuestHost/SharedClipboard.h> 39 39 #include <VBox/GuestHost/SharedClipboard-x11.h> … … 50 50 { 51 51 RT_NOREF(pCtx, uFmt, ppv, pcb, pvUser); 52 return VERR_ NO_DATA;52 return VERR_SHCLPB_NO_DATA; 53 53 } 54 54 -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc-win.cpp
r100655 r103363 175 175 static int vboxClipboardSvcWinReadDataFromGuestWorker(PSHCLCONTEXT pCtx, SHCLFORMAT uFmt, void **ppvData, uint32_t *pcbData) 176 176 { 177 LogFlowFunc(("uFmt=%#x\n", uFmt)); 178 179 int rc = ShClSvcReadDataFromGuest(pCtx->pClient, uFmt, ppvData, pcbData); 180 if (RT_FAILURE(rc)) 181 LogRel(("Shared Clipboard: Reading guest clipboard data for Windows host failed with %Rrc\n", rc)); 182 183 LogFlowFuncLeaveRC(rc); 184 return rc; 177 return ShClSvcReadDataFromGuest(pCtx->pClient, uFmt, ppvData, pcbData); 185 178 } 186 179 … … 519 512 uint32_t cbData = 0; 520 513 int rc = ShClSvcReadDataFromGuest(pCtx->pClient, uFmtVBox, &pvData, &cbData); 521 if ( RT_SUCCESS(rc) 522 && pvData 523 && cbData) 514 if (RT_SUCCESS(rc)) 524 515 { 525 516 /* Wrap HTML clipboard content info CF_HTML format if needed. */ -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
r100881 r103363 1386 1386 * 1387 1387 * @returns VBox status code. 1388 * @retval VERR_SHCLPB_NO_DATA if no clipboard data is available. 1388 1389 * @param pClient Client to request to read data form. 1389 1390 * @param fFormats The formats being requested, OR'ed together (VBOX_SHCL_FMT_XXX). … … 1394 1395 int ShClSvcReadDataFromGuest(PSHCLCLIENT pClient, SHCLFORMAT fFormats, void **ppv, uint32_t *pcb) 1395 1396 { 1397 AssertPtrReturn(ppv, VERR_INVALID_POINTER); 1398 AssertPtrReturn(pcb, VERR_INVALID_POINTER); 1399 1396 1400 LogFlowFuncEnter(); 1397 1401 … … 1405 1409 if (RT_SUCCESS(rc)) 1406 1410 { 1407 if ( !pPayload 1408 || !pPayload->cbData) 1409 { 1410 rc = VERR_NO_DATA; 1411 } 1412 else 1411 if ( pPayload 1412 && pPayload->cbData) 1413 1413 { 1414 1414 *ppv = pPayload->pvData; 1415 1415 *pcb = pPayload->cbData; 1416 1416 } 1417 else 1418 rc = VERR_SHCLPB_NO_DATA; 1417 1419 } 1418 1420 … … 1420 1422 } 1421 1423 1422 if (RT_FAILURE(rc)) 1424 if ( RT_FAILURE(rc) 1425 && rc != VERR_SHCLPB_NO_DATA) 1423 1426 LogRel(("Shared Clipboard: Reading data from guest failed with %Rrc\n", rc)); 1424 1427 1425 LogFlowFunc LeaveRC(rc);1428 LogFlowFunc(("rc=%Rc, pv=%p, cb=%RU32", rc, *ppv, *pcb)); 1426 1429 return rc; 1427 1430 }
Note:
See TracChangeset
for help on using the changeset viewer.