summaryrefslogtreecommitdiffstats
path: root/win/tkWinClipboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tkWinClipboard.c')
-rw-r--r--win/tkWinClipboard.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c
index 76711b5..2501688 100644
--- a/win/tkWinClipboard.c
+++ b/win/tkWinClipboard.c
@@ -104,7 +104,7 @@ TkSelGetSelection(
*/
locale = LANGIDFROMLCID(*((int*)data));
- GetLocaleInfo(locale, LOCALE_IDEFAULTANSICODEPAGE,
+ GetLocaleInfoA(locale, LOCALE_IDEFAULTANSICODEPAGE,
Tcl_DStringValue(&ds)+2, Tcl_DStringLength(&ds)-2);
GlobalUnlock(handle);
@@ -156,15 +156,16 @@ TkSelGetSelection(
* Pass the data off to the selection procedure.
*/
- result = (*proc)(clientData, interp, Tcl_DStringValue(&ds));
+ result = proc(clientData, interp, Tcl_DStringValue(&ds));
Tcl_DStringFree(&ds);
CloseClipboard();
return result;
error:
- Tcl_AppendResult(interp, Tk_GetAtomName(tkwin, selection),
- " selection doesn't exist or form \"",
- Tk_GetAtomName(tkwin, target), "\" not defined", NULL);
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "%s selection doesn't exist or form \"%s\" not defined",
+ Tk_GetAtomName(tkwin, selection), Tk_GetAtomName(tkwin, target)));
+ Tcl_SetErrorCode(interp, "TK", "SELECTION", "EXISTS", NULL);
return TCL_ERROR;
}
@@ -274,7 +275,7 @@ TkWinClipboardRender(
* Copy the data and change EOL characters.
*/
- buffer = rawText = ckalloc((unsigned)length + 1);
+ buffer = rawText = ckalloc(length + 1);
if (targetPtr != NULL) {
for (cbPtr = targetPtr->firstBufferPtr; cbPtr != NULL;
cbPtr = cbPtr->nextPtr) {
@@ -294,7 +295,7 @@ TkWinClipboardRender(
* encoding before placing it on the clipboard.
*/
- if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
+#ifdef UNICODE
Tcl_DStringInit(&ds);
Tcl_UtfToUniCharDString(rawText, -1, &ds);
ckfree(rawText);
@@ -310,7 +311,7 @@ TkWinClipboardRender(
GlobalUnlock(handle);
Tcl_DStringFree(&ds);
SetClipboardData(CF_UNICODETEXT, handle);
- } else {
+#else
Tcl_UtfToExternalDString(NULL, rawText, -1, &ds);
ckfree(rawText);
handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
@@ -325,7 +326,7 @@ TkWinClipboardRender(
GlobalUnlock(handle);
Tcl_DStringFree(&ds);
SetClipboardData(CF_TEXT, handle);
- }
+#endif
}
/*
@@ -384,7 +385,7 @@ UpdateClipboard(
* possible.
*/
- if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
+ if (TkWinGetPlatformId() != VER_PLATFORM_WIN32_WINDOWS) {
SetClipboardData(CF_UNICODETEXT, NULL);
} else {
SetClipboardData(CF_TEXT, NULL);