diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-02-01 14:30:07 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-02-01 14:30:07 (GMT) |
commit | 36cc0029458ead72be711c8c402f55a4fd26edd3 (patch) | |
tree | 9d78414244a27069e5362313cf542baba8dfefb1 /win | |
parent | c122ab6dc1e84c1b07be22f6b1b3983df7268a68 (diff) | |
parent | 5f84e8bb5604b44e2682c85e6bf8724deb5c3257 (diff) | |
download | tk-36cc0029458ead72be711c8c402f55a4fd26edd3.zip tk-36cc0029458ead72be711c8c402f55a4fd26edd3.tar.gz tk-36cc0029458ead72be711c8c402f55a4fd26edd3.tar.bz2 |
Use internalRep.twoPtrValue.ptr1 in stead of internalRep.otherValuePtr everywhere.
Change some internal "length" variables from type int to type size_t, so it could handle bigger string sizes (for "novem")
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinDialog.c | 15 | ||||
-rw-r--r-- | win/tkWinWm.c | 62 |
2 files changed, 44 insertions, 33 deletions
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 3b1351e..35d07d1 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -1161,12 +1161,13 @@ MakeFilter( *p = '\0'; } else { - int len; + size_t len; if (valuePtr == NULL) { len = 0; } else { - (void) Tcl_GetStringFromObj(valuePtr, &len); + (void) Tcl_GetString(valuePtr); + len = valuePtr->length; } /* @@ -2258,7 +2259,7 @@ FontchooserConfigureCmd( } for (i = 1; i < objc; i += 2) { - int optionIndex, len; + int optionIndex; if (Tcl_GetIndexFromObjStruct(interp, objv[i], optionStrings, sizeof(char *), "option", 0, &optionIndex) != TCL_OK) { @@ -2318,8 +2319,8 @@ FontchooserConfigureCmd( if (hdPtr->fontObj) { Tcl_DecrRefCount(hdPtr->fontObj); } - Tcl_GetStringFromObj(objv[i+1], &len); - if (len) { + (void)Tcl_GetString(objv[i+1]); + if (objv[i+1]->length) { hdPtr->fontObj = objv[i+1]; if (Tcl_IsShared(hdPtr->fontObj)) { hdPtr->fontObj = Tcl_DuplicateObj(hdPtr->fontObj); @@ -2333,8 +2334,8 @@ FontchooserConfigureCmd( if (hdPtr->cmdObj) { Tcl_DecrRefCount(hdPtr->cmdObj); } - Tcl_GetStringFromObj(objv[i+1], &len); - if (len) { + (void)Tcl_GetString(objv[i+1]); + if (objv[i+1]->length) { hdPtr->cmdObj = objv[i+1]; if (Tcl_IsShared(hdPtr->cmdObj)) { hdPtr->cmdObj = Tcl_DuplicateObj(hdPtr->cmdObj); 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; |