summaryrefslogtreecommitdiffstats
path: root/win/tkWinWm.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tkWinWm.c')
-rw-r--r--win/tkWinWm.c62
1 files changed, 36 insertions, 26 deletions
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 28850d5..1099375 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -2802,7 +2802,8 @@ Tk_WmObjCmd(
WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT,
WMOPT_WITHDRAW
};
- int index, length;
+ int index;
+ size_t length;
const char *argv1;
TkWindow *winPtr, **winPtrPtr = &winPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -2813,8 +2814,9 @@ Tk_WmObjCmd(
return TCL_ERROR;
}
- argv1 = Tcl_GetStringFromObj(objv[1], &length);
- if ((argv1[0] == 't') && !strncmp(argv1, "tracing", (unsigned) length)
+ argv1 = Tcl_GetString(objv[1]);
+ length = objv[1]->length;
+ if ((argv1[0] == 't') && !strncmp(argv1, "tracing", objv[1]->length)
&& (length >= 3)) {
int wmTracing;
@@ -3029,7 +3031,8 @@ WmAttributesCmd(
register WmInfo *wmPtr = winPtr->wmInfoPtr;
LONG style, exStyle, styleBit, *stylePtr = NULL;
const char *string;
- int i, boolean, length;
+ int i, boolean;
+ size_t length;
int config_fullscreen = 0, updatewrapper = 0;
int fullscreen_attr_changed = 0, fullscreen_attr = 0;
@@ -3076,23 +3079,24 @@ WmAttributesCmd(
return TCL_OK;
}
for (i = 3; i < objc; i += 2) {
- string = Tcl_GetStringFromObj(objv[i], &length);
+ string = Tcl_GetString(objv[i]);
+ length = objv[i]->length;
if ((length < 2) || (string[0] != '-')) {
goto configArgs;
}
- if (strncmp(string, "-disabled", (unsigned) length) == 0) {
+ if (strncmp(string, "-disabled", length) == 0) {
stylePtr = &style;
styleBit = WS_DISABLED;
- } else if ((strncmp(string, "-alpha", (unsigned) length) == 0)
+ } else if ((strncmp(string, "-alpha", length) == 0)
|| ((length > 2) && (strncmp(string, "-transparentcolor",
- (unsigned) length) == 0))) {
+ length) == 0))) {
stylePtr = &exStyle;
styleBit = WS_EX_LAYERED;
- } else if (strncmp(string, "-fullscreen", (unsigned) length) == 0) {
+ } else if (strncmp(string, "-fullscreen", length) == 0) {
config_fullscreen = 1;
styleBit = 0;
} else if ((length > 3)
- && (strncmp(string, "-toolwindow", (unsigned) length) == 0)) {
+ && (strncmp(string, "-toolwindow", length) == 0)) {
stylePtr = &exStyle;
styleBit = WS_EX_TOOLWINDOW;
if (objc != 4) {
@@ -3102,7 +3106,7 @@ WmAttributesCmd(
updatewrapper = 1;
}
} else if ((length > 3)
- && (strncmp(string, "-topmost", (unsigned) length) == 0)) {
+ && (strncmp(string, "-topmost", length) == 0)) {
stylePtr = &exStyle;
styleBit = WS_EX_TOPMOST;
if ((i < objc-1) && (winPtr->flags & TK_EMBEDDED)) {
@@ -3144,8 +3148,9 @@ WmAttributesCmd(
}
wmPtr->alpha = dval;
} else { /* -transparentcolor */
- const char *crefstr = Tcl_GetStringFromObj(objv[i+1], &length);
+ const char *crefstr = Tcl_GetString(objv[i+1]);
+ length = objv[i+1]->length;
if (length == 0) {
/* reset to no transparent color */
if (wmPtr->crefObj) {
@@ -3323,7 +3328,7 @@ WmClientCmd(
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
+ size_t length;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?name?");
@@ -3336,7 +3341,8 @@ WmClientCmd(
}
return TCL_OK;
}
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
+ argv3 = Tcl_GetString(objv[3]);
+ length = objv[3]->length;
if (argv3[0] == 0) {
if (wmPtr->clientMachine != NULL) {
ckfree(wmPtr->clientMachine);
@@ -3352,7 +3358,7 @@ WmClientCmd(
ckfree(wmPtr->clientMachine);
}
wmPtr->clientMachine = ckalloc(length + 1);
- memcpy(wmPtr->clientMachine, argv3, (unsigned) length + 1);
+ memcpy(wmPtr->clientMachine, argv3, length + 1);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XTextProperty textProp;
@@ -3916,7 +3922,7 @@ WmGroupCmd(
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_Window tkwin2;
const char *argv3;
- int length;
+ size_t length;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?");
@@ -3928,7 +3934,8 @@ WmGroupCmd(
}
return TCL_OK;
}
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
+ argv3 = Tcl_GetString(objv[3]);
+ length = objv[3]->length;
if (*argv3 == '\0') {
wmPtr->hints.flags &= ~WindowGroupHint;
if (wmPtr->leaderName != NULL) {
@@ -3946,7 +3953,7 @@ WmGroupCmd(
wmPtr->hints.window_group = Tk_WindowId(tkwin2);
wmPtr->hints.flags |= WindowGroupHint;
wmPtr->leaderName = ckalloc(length + 1);
- memcpy(wmPtr->leaderName, argv3, (unsigned) length + 1);
+ memcpy(wmPtr->leaderName, argv3, length + 1);
}
return TCL_OK;
}
@@ -4237,7 +4244,7 @@ WmIconnameCmd(
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
+ size_t length;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?");
@@ -4251,9 +4258,10 @@ WmIconnameCmd(
if (wmPtr->iconName != NULL) {
ckfree(wmPtr->iconName);
}
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
+ argv3 = Tcl_GetString(objv[3]);
+ length = objv[3]->length;
wmPtr->iconName = ckalloc(length + 1);
- memcpy(wmPtr->iconName, argv3, (unsigned) length + 1);
+ memcpy(wmPtr->iconName, argv3, length + 1);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName);
}
@@ -4945,7 +4953,7 @@ WmProtocolCmd(
register ProtocolHandler *protPtr, *prevPtr;
Atom protocol;
const char *cmd;
- int cmdLength;
+ size_t cmdLength;
Tcl_Obj *resultObj;
if ((objc < 3) || (objc > 5)) {
@@ -5000,7 +5008,8 @@ WmProtocolCmd(
break;
}
}
- cmd = Tcl_GetStringFromObj(objv[4], &cmdLength);
+ cmd = Tcl_GetString(objv[4]);
+ cmdLength = objv[4]->length;
if (cmdLength > 0) {
protPtr = ckalloc(HANDLER_SIZE(cmdLength));
protPtr->protocol = protocol;
@@ -5438,7 +5447,7 @@ WmTitleCmd(
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
const char *argv3;
- int length;
+ size_t length;
HWND wrapper;
if (objc > 4) {
@@ -5471,9 +5480,10 @@ WmTitleCmd(
if (wmPtr->title != NULL) {
ckfree(wmPtr->title);
}
- argv3 = Tcl_GetStringFromObj(objv[3], &length);
+ argv3 = Tcl_GetString(objv[3]);
+ length = objv[3]->length;
wmPtr->title = ckalloc(length + 1);
- memcpy(wmPtr->title, argv3, (unsigned) length + 1);
+ memcpy(wmPtr->title, argv3, length + 1);
if (!(wmPtr->flags & WM_NEVER_MAPPED) && wmPtr->wrapper != NULL) {
Tcl_DString titleString;