- Timestamp:
- Jul 2, 2009 10:07:50 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp
r21184 r21185 905 905 int *piFormatReturn) 906 906 { 907 char *pszTmp = NULL ;907 char *pszTmp = NULL, *pszTmp2 = NULL; 908 908 size_t cbTmp = 0, cbActual = 0; 909 909 XTextProperty property; … … 923 923 rc = clipWinTxtToUtf8(pwszSrc, cbSrc, pszTmp, cbTmp + 1, 924 924 &cbActual); 925 /* And finally (!) convert the Utf8 text to compound text. */ 926 #ifdef X_HAVE_UTF8_STRING 925 /* Convert the Utf8 text to the current encoding (usually a noop). */ 927 926 if (RT_SUCCESS(rc)) 928 xrc = Xutf8TextListToTextProperty(pDisplay, &pszTmp, 1, 929 XCompoundTextStyle, &property); 930 #else 927 rc = RTStrUtf8ToCurrentCP(&pszTmp2, pszTmp); 928 /* And finally (!) convert the resulting text to compound text. */ 931 929 if (RT_SUCCESS(rc)) 932 xrc = XmbTextListToTextProperty(pDisplay, &pszTmp , 1,930 xrc = XmbTextListToTextProperty(pDisplay, &pszTmp2, 1, 933 931 XCompoundTextStyle, &property); 934 #endif935 932 if (RT_SUCCESS(rc) && xrc < 0) 936 933 rc = ( xrc == XNoMemory ? VERR_NO_MEMORY … … 939 936 : VERR_UNRESOLVED_ERROR); 940 937 RTMemFree(pszTmp); 938 RTStrFree(pszTmp2); 941 939 *atomTypeReturn = property.encoding; 942 940 *pValReturn = reinterpret_cast<XtPointer>(property.value); … … 1262 1260 int rc = VINF_SUCCESS; 1263 1261 XTextProperty property; 1264 char **ppcTmp = NULL ;1262 char **ppcTmp = NULL, *pszTmp = NULL; 1265 1263 int cProps; 1266 1264 … … 1269 1267 property.format = 8; 1270 1268 property.nitems = cbSrc; 1271 #ifdef X_HAVE_UTF8_STRING1272 int xrc = Xutf8TextPropertyToTextList(XtDisplay(widget), &property,1273 &ppcTmp, &cProps);1274 #else1275 1269 int xrc = XmbTextPropertyToTextList(XtDisplay(widget), &property, 1276 1270 &ppcTmp, &cProps); 1277 #endif1278 1271 if (xrc < 0) 1279 1272 rc = ( xrc == XNoMemory ? VERR_NO_MEMORY … … 1281 1274 : xrc == XConverterNotFound ? VERR_NOT_SUPPORTED 1282 1275 : VERR_UNRESOLVED_ERROR); 1276 /* Convert the text returned to UTF8 */ 1277 if (RT_SUCCESS(rc)) 1278 rc = RTStrCurrentCPToUtf8(&pszTmp, *ppcTmp); 1283 1279 /* Now convert the UTF8 to UTF16 */ 1284 1280 if (RT_SUCCESS(rc)) 1285 rc = clipUtf8ToWinTxt( *ppcTmp, strlen(*ppcTmp), ppwszDest, pcbDest);1281 rc = clipUtf8ToWinTxt(pszTmp, strlen(pszTmp), ppwszDest, pcbDest); 1286 1282 if (ppcTmp != NULL) 1287 1283 XFreeStringList(ppcTmp); 1284 RTStrFree(pszTmp); 1288 1285 LogFlowFunc(("Returning %Rrc\n", rc)); 1289 1286 if (pcbDest)
Note:
See TracChangeset
for help on using the changeset viewer.