- Timestamp:
- Oct 14, 2008 11:30:03 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/xclient/clipboard.cpp
r11648 r13249 933 933 PRTUTF16 pu16GuestText, pu16HostText; 934 934 char *pcGuestText; 935 unsigned cbHostText, cwHostText, cwGuestText, cbGuestText; 935 unsigned cbHostText, cwHostText, cwGuestText, cbGuestTextBuffer; 936 size_t cbGuestTextActual; 936 937 int rc; 937 938 … … 942 943 if ((rc != VINF_SUCCESS) || cbHostText == 0) 943 944 { 944 LogFlow(("vboxClipboardConvertUtf16: vboxClipboardReadHostData returned %Vrc, %d bytes of data\n", rc, cb GuestText));945 LogFlow(("vboxClipboardConvertUtf16: vboxClipboardReadHostData returned %Vrc, %d bytes of data\n", rc, cbHostText)); 945 946 g_ctx.hostFormats = 0; 946 947 LogFlowFunc(("rc = false\n")); … … 967 968 } 968 969 /* Now convert the Utf16 Linux text to Utf8 */ 969 cbGuestText = cwGuestText * 3; /* Should always be enough. */970 pcGuestText = XtMalloc(cbGuestText );970 cbGuestTextBuffer = cwGuestText * 3; /* Should always be enough. */ 971 pcGuestText = XtMalloc(cbGuestTextBuffer); 971 972 if (pcGuestText == 0) 972 973 { … … 976 977 } 977 978 /* Our runtime can't cope with endian markers. */ 978 rc = RTUtf16ToUtf8Ex(pu16GuestText + 1, cwGuestText - 1, &pcGuestText, cbGuestText, 0); 979 cbGuestTextActual = 0; 980 rc = RTUtf16ToUtf8Ex(pu16GuestText + 1, cwGuestText - 1, &pcGuestText, cbGuestTextBuffer, &cbGuestTextActual); 979 981 RTMemFree(reinterpret_cast<char *>(pu16GuestText)); 980 982 if (rc != VINF_SUCCESS) … … 984 986 return false; 985 987 } 986 LogFlow(("vboxClipboardConvertUtf8: converted text is %.*s\n", cbGuestText , pcGuestText));988 LogFlow(("vboxClipboardConvertUtf8: converted text is %.*s\n", cbGuestTextActual, pcGuestText)); 987 989 *atomTypeReturn = g_ctx.atomUtf8; 988 990 *pValReturn = reinterpret_cast<XtPointer>(pcGuestText); 989 *pcLenReturn = cbGuestText;991 *pcLenReturn = (unsigned long)cbGuestTextActual; 990 992 *piFormatReturn = 8; 991 993 LogFlowFunc(("rc = true\n"));
Note:
See TracChangeset
for help on using the changeset viewer.