Changeset 86959 in vbox for trunk/src/VBox
- Timestamp:
- Nov 23, 2020 11:25:53 AM (4 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp
r86889 r86959 1128 1128 return "Unknown"; 1129 1129 } 1130 1131 /** 1132 * Converts Shared Clipboard formats to a string. 1133 * 1134 * @returns Stringified Shared Clipboard formats, or NULL on failure. Must be free'd with RTStrFree(). 1135 * @param fFormats Shared Clipboard formats to convert. 1136 * 1137 */ 1138 char *ShClFormatsToStrA(SHCLFORMATS fFormats) 1139 { 1140 #define APPEND_FMT_TO_STR(_aFmt) \ 1141 if (fFormats & VBOX_SHCL_FMT_##_aFmt) \ 1142 { \ 1143 if (pszFmts) \ 1144 { \ 1145 rc2 = RTStrAAppend(&pszFmts, ", "); \ 1146 if (RT_FAILURE(rc2)) \ 1147 break; \ 1148 } \ 1149 \ 1150 rc2 = RTStrAAppend(&pszFmts, #_aFmt); \ 1151 if (RT_FAILURE(rc2)) \ 1152 break; \ 1153 } 1154 1155 char *pszFmts = NULL; 1156 int rc2 = VINF_SUCCESS; 1157 1158 do 1159 { 1160 APPEND_FMT_TO_STR(UNICODETEXT); 1161 APPEND_FMT_TO_STR(BITMAP); 1162 APPEND_FMT_TO_STR(HTML); 1163 # ifdef VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS 1164 APPEND_FMT_TO_STR(URI_LIST); 1165 # endif 1166 1167 } while (0); 1168 1169 if (!pszFmts) 1170 rc2 = RTStrAAppend(&pszFmts, "NONE"); 1171 1172 if ( RT_FAILURE(rc2) 1173 && pszFmts) 1174 { 1175 RTStrFree(pszFmts); 1176 pszFmts = NULL; 1177 } 1178 1179 #undef APPEND_FMT_TO_STR 1180 1181 return pszFmts; 1182 } 1183 -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp
r86737 r86959 48 48 #include <X11/StringDefs.h> 49 49 50 #include <iprt/assert.h> 50 51 #include <iprt/types.h> 51 52 #include <iprt/mem.h> … … 444 445 LogFlow((" -> vboxFmt=%#x\n", vboxFmt)); 445 446 446 LogRel2(("Shared Clipboard: X11 reported available VBox formats: %#x\n", vboxFmt)); 447 #ifdef LOG_ENABLED 448 char *pszFmts = ShClFormatsToStrA(vboxFmt); 449 AssertPtrReturnVoid(pszFmts); 450 LogRel2(("Shared Clipboard: X11 reported available VBox formats '%s'\n", pszFmts)); 451 RTStrFree(pszFmts); 452 #endif 447 453 448 454 ShClX11ReportFormatsCallback(pCtx->pFrontend, vboxFmt); … … 1585 1591 pCtx->vboxFormats, idxFmtX11, g_aFormats[idxFmtX11].pcszAtom, fmtX11)); 1586 1592 1587 LogRel2(("Shared Clipboard: Converting VBox formats %#x to '%s' for X11\n", 1588 pCtx->vboxFormats, g_aFormats[idxFmtX11].pcszAtom)); 1593 #ifdef LOG_ENABLED 1594 char *pszFmts = ShClFormatsToStrA(pCtx->vboxFormats); 1595 AssertPtrReturn(pszFmts, VERR_NO_MEMORY); 1596 LogRel2(("Shared Clipboard: Converting VBox formats '%s' to '%s' for X11\n", 1597 pszFmts, g_aFormats[idxFmtX11].pcszAtom)); 1598 RTStrFree(pszFmts); 1599 #endif 1589 1600 1590 1601 if ( ((fmtX11 == SHCLX11FMT_UTF8) || (fmtX11 == SHCLX11FMT_TEXT)) … … 1696 1707 1697 1708 if (RT_FAILURE(rc)) 1698 LogRel(("Shared Clipboard: Converting VBox formats %#x to '%s' for X11 (idxFmtX11=%u, fmtX11=%u) failed, rc=%Rrc\n", 1699 pCtx->vboxFormats, g_aFormats[idxFmtX11].pcszAtom, idxFmtX11, fmtX11, rc)); 1709 { 1710 char *pszFmts2 = ShClFormatsToStrA(pCtx->vboxFormats); 1711 AssertPtrReturn(pszFmts2, VERR_NO_MEMORY); 1712 LogRel(("Shared Clipboard: Converting VBox formats '%s' to '%s' for X11 (idxFmtX11=%u, fmtX11=%u) failed, rc=%Rrc\n", 1713 pszFmts2, g_aFormats[idxFmtX11].pcszAtom, idxFmtX11, fmtX11, rc)); 1714 RTStrFree(pszFmts2); 1715 } 1700 1716 1701 1717 LogFlowFuncLeaveRC(rc); -
trunk/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboardSvc.cpp
r86912 r86959 1213 1213 fFormats &= ~fFormat; 1214 1214 1215 #ifdef LOG_ENABLED 1216 char *pszFmt = ShClFormatsToStrA(fFormat); 1217 AssertPtrReturn(pszFmt, VERR_NO_MEMORY); 1218 LogRel2(("Shared Clipboard: Requesting guest clipboard data in format '%s'\n", pszFmt)); 1219 RTStrFree(pszFmt); 1220 #endif 1215 1221 /* 1216 1222 * Allocate messages, one for each format. … … 1389 1395 if (!(g_fTransferMode & VBOX_SHCL_TRANSFER_MODE_ENABLED)) 1390 1396 { 1391 LogFlowFunc(("fFormats=%#x -> %#x\n", fFormats, fFormats & ~VBOX_SHCL_FMT_URI_LIST));1392 1397 fFormats &= ~VBOX_SHCL_FMT_URI_LIST; 1393 1398 } 1399 else 1400 LogRel2(("Shared Clipboard: Warning: File transfers are disabled, ignoring\n")); 1394 1401 #endif 1395 LogRel2(("Shared Clipboard: Reporting formats %#x to guest\n", fFormats)); 1402 1403 #ifdef LOG_ENABLED 1404 char *pszFmts = ShClFormatsToStrA(fFormats); 1405 AssertPtrReturn(pszFmts, VERR_NO_MEMORY); 1406 LogRel2(("Shared Clipboard: Reporting formats '%s' to guest\n", pszFmts)); 1407 RTStrFree(pszFmts); 1408 #endif 1396 1409 1397 1410 /* … … 1508 1521 else 1509 1522 { 1523 #ifdef LOG_ENABLED 1524 char *pszFmts = ShClFormatsToStrA(fFormats); 1525 AssertPtrReturn(pszFmts, VERR_NO_MEMORY); 1526 LogRel2(("Shared Clipboard: Guest reported formats '%s' to host\n", pszFmts)); 1527 RTStrFree(pszFmts); 1528 #endif 1510 1529 rc = ShClBackendFormatAnnounce(pClient, fFormats); 1511 1530 if (RT_FAILURE(rc)) … … 1606 1625 } 1607 1626 1608 LogRel2(("Shared Clipboard: Guest wants to read %RU32 bytes host clipboard data in format %RU32\n", cbData, uFormat)); 1627 #ifdef LOG_ENABLED 1628 char *pszFmt = ShClFormatsToStrA(uFormat); 1629 AssertPtrReturn(pszFmt, VERR_NO_MEMORY); 1630 LogRel2(("Shared Clipboard: Guest wants to read %RU32 bytes host clipboard data in format '%s'\n", cbData, pszFmt)); 1631 RTStrFree(pszFmt); 1632 #endif 1609 1633 1610 1634 /* … … 1796 1820 } 1797 1821 1798 LogRel2(("Shared Clipboard: Guest writes %RU32 bytes clipboard data in format %RU32 to host\n", cbData, uFormat)); 1822 #ifdef LOG_ENABLED 1823 char *pszFmt = ShClFormatsToStrA(uFormat); 1824 AssertPtrReturn(pszFmt, VERR_NO_MEMORY); 1825 LogRel2(("Shared Clipboard: Guest writes %RU32 bytes clipboard data in format '%s' to host\n", cbData, pszFmt)); 1826 RTStrFree(pszFmt); 1827 #endif 1799 1828 1800 1829 /*
Note:
See TracChangeset
for help on using the changeset viewer.