summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkCmds.c57
-rw-r--r--generic/tkFont.c8
-rw-r--r--generic/tkInt.decls2
-rw-r--r--generic/tkIntDecls.h4
4 files changed, 37 insertions, 34 deletions
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index d7f0e8c..6184b6e 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -100,7 +100,8 @@ Tk_BellObjCmd(
};
enum options { TK_BELL_DISPLAYOF, TK_BELL_NICE };
Tk_Window tkwin = (Tk_Window)clientData;
- int i, index, nice = 0;
+ int i;
+ int index, nice = 0;
Tk_ErrorHandler handler;
if (objc > 4) {
@@ -812,15 +813,16 @@ ScalingCmd(
{
Tk_Window tkwin = (Tk_Window)clientData;
Screen *screenPtr;
- int skip, width, height;
+ Tcl_Size skip;
+ int width, height;
double d;
skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin);
- if (skip < 0) {
+ if (skip == TCL_INDEX_NONE) {
return TCL_ERROR;
}
screenPtr = Tk_Screen(tkwin);
- if (objc - skip == 1) {
+ if (objc == 1 + skip) {
d = 25.4 / 72;
d *= WidthOfScreen(screenPtr);
d /= WidthMMOfScreen(screenPtr);
@@ -830,7 +832,7 @@ ScalingCmd(
"setting the scaling not accessible in a safe interpreter", -1));
Tcl_SetErrorCode(interp, "TK", "SAFE", "SCALING", NULL);
return TCL_ERROR;
- } else if (objc - skip == 2) {
+ } else if (objc == 2 + skip) {
if (Tcl_GetDoubleFromObj(interp, objv[1+skip], &d) != TCL_OK) {
return TCL_ERROR;
}
@@ -861,7 +863,7 @@ UseinputmethodsCmd(
{
Tk_Window tkwin = (Tk_Window)clientData;
TkDisplay *dispPtr;
- int skip;
+ Tcl_Size skip;
if (Tcl_IsSafe(interp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -870,12 +872,12 @@ UseinputmethodsCmd(
return TCL_ERROR;
}
- skip = TkGetDisplayOf(interp, objc-1, objv+1, &tkwin);
- if (skip < 0) {
+ skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin);
+ if (skip == TCL_INDEX_NONE) {
return TCL_ERROR;
}
dispPtr = ((TkWindow *) tkwin)->dispPtr;
- if ((objc - skip) == 2) {
+ if (objc == 2 + skip) {
int boolVal;
@@ -888,7 +890,7 @@ UseinputmethodsCmd(
} else {
dispPtr->flags &= ~TK_DISPLAY_USE_IM;
}
- } else if ((objc - skip) != 1) {
+ } else if (objc != 1 + skip) {
Tcl_WrongNumArgs(interp, 1, objv,
"?-displayof window? ?boolean?");
return TCL_ERROR;
@@ -930,18 +932,18 @@ InactiveCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window)clientData;
- int skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin);
+ Tcl_Size skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin);
- if (skip < 0) {
+ if (skip == TCL_INDEX_NONE) {
return TCL_ERROR;
}
- if (objc - skip == 1) {
+ if (objc == 1 + skip) {
Tcl_WideInt inactive;
inactive = (Tcl_IsSafe(interp) ? -1 :
Tk_GetUserInactiveTime(Tk_Display(tkwin)));
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(inactive));
- } else if (objc - skip == 2) {
+ } else if (objc == 2 + skip) {
const char *string;
string = Tcl_GetString(objv[objc-1]);
@@ -1277,7 +1279,8 @@ Tk_WinfoObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int index, x, y, width, height, useX, useY, c_class, skip;
+ int index, x, y, width, height, useX, useY, c_class;
+ int skip;
const char *string;
TkWindow *winPtr;
Tk_Window tkwin = (Tk_Window)clientData;
@@ -1564,7 +1567,7 @@ Tk_WinfoObjCmd(
if (skip < 0) {
return TCL_ERROR;
}
- if (objc - skip != 3) {
+ if (objc != 3 + skip) {
Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? name");
return TCL_ERROR;
}
@@ -1581,7 +1584,7 @@ Tk_WinfoObjCmd(
if (skip < 0) {
return TCL_ERROR;
}
- if (objc - skip != 3) {
+ if (objc != 3 + skip) {
Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? id");
return TCL_ERROR;
}
@@ -1605,7 +1608,7 @@ Tk_WinfoObjCmd(
if (skip < 0) {
return TCL_ERROR;
}
- if (objc - skip != 4) {
+ if (objc != 4 + skip) {
Tcl_WrongNumArgs(interp, 2, objv,
"?-displayof window? rootX rootY");
return TCL_ERROR;
@@ -1629,7 +1632,7 @@ Tk_WinfoObjCmd(
if (skip < 0) {
return TCL_ERROR;
}
- if (objc - skip != 2) {
+ if (objc != 2 + skip) {
Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window?");
return TCL_ERROR;
}
@@ -1641,7 +1644,7 @@ Tk_WinfoObjCmd(
if (skip < 0) {
return TCL_ERROR;
}
- if (objc - skip != 3) {
+ if (objc != 3 + skip) {
Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? id");
return TCL_ERROR;
}
@@ -1834,12 +1837,12 @@ Tk_WinfoObjCmd(
* The return value is 0 if the argument strings did not contain the
* "-displayof" option. The return value is 2 if the argument strings
* contained both the "-displayof" option and a valid window name.
- * Otherwise, the return value is -1 if the window name was missing or
- * did not specify a valid window.
+ * Otherwise, the return value is TCL_INDEX_NONE if the window name
+ * was missing or did not specify a valid window.
*
* If the return value was 2, *tkwinPtr is filled with the token for the
- * window specified on the command line. If the return value was -1, an
- * error message is left in interp's result object.
+ * window specified on the command line. If the return value was
+ * TCL_INDEX_NONE, an error message is left in interp's result object.
*
* Side effects:
* None.
@@ -1847,7 +1850,7 @@ Tk_WinfoObjCmd(
*----------------------------------------------------------------------
*/
-int
+Tcl_Size
TkGetDisplayOf(
Tcl_Interp *interp, /* Interpreter for error reporting. */
Tcl_Size objc, /* Number of arguments. */
@@ -1874,11 +1877,11 @@ TkGetDisplayOf(
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"value for \"-displayof\" missing", -1));
Tcl_SetErrorCode(interp, "TK", "NO_VALUE", "DISPLAYOF", NULL);
- return -1;
+ return TCL_INDEX_NONE;
}
*tkwinPtr = Tk_NameToWindow(interp, Tcl_GetString(objv[1]), *tkwinPtr);
if (*tkwinPtr == NULL) {
- return -1;
+ return TCL_INDEX_NONE;
}
return 2;
}
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 0836061..11f889a 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -520,7 +520,7 @@ Tk_FontObjCmd(
* Next parameter may be an option.
*/
- n = skip + 3;
+ n = 3 + skip;
optPtr = NULL;
charPtr = NULL;
if (n < objc) {
@@ -707,7 +707,7 @@ Tk_FontObjCmd(
if (skip < 0) {
return TCL_ERROR;
}
- if (objc - skip != 2) {
+ if (objc != 2 + skip) {
Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window?");
return TCL_ERROR;
}
@@ -726,7 +726,7 @@ Tk_FontObjCmd(
return TCL_ERROR;
}
}
- if (objc - skip != 4) {
+ if (objc != 4 + skip) {
Tcl_WrongNumArgs(interp, 2, objv,
"font ?-displayof window? text");
return TCL_ERROR;
@@ -753,7 +753,7 @@ Tk_FontObjCmd(
if (skip < 0) {
return TCL_ERROR;
}
- if ((objc < 3) || ((objc - skip) > 4)) {
+ if ((objc < 3) || (objc > 4 + skip)) {
Tcl_WrongNumArgs(interp, 2, objv,
"font ?-displayof window? ?-option?");
return TCL_ERROR;
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index 25a5be1..eabef03 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -145,7 +145,7 @@ declare 34 {
TkDisplay *TkGetDisplay(Display *display)
}
declare 35 {
- int TkGetDisplayOf(Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[],
+ Tcl_Size TkGetDisplayOf(Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[],
Tk_Window *tkwinPtr)
}
declare 36 {
diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h
index 868f79c..6eeb6c5 100644
--- a/generic/tkIntDecls.h
+++ b/generic/tkIntDecls.h
@@ -140,7 +140,7 @@ EXTERN const char * TkGetDefaultScreenName(Tcl_Interp *interp,
/* 34 */
EXTERN TkDisplay * TkGetDisplay(Display *display);
/* 35 */
-EXTERN int TkGetDisplayOf(Tcl_Interp *interp, Tcl_Size objc,
+EXTERN Tcl_Size TkGetDisplayOf(Tcl_Interp *interp, Tcl_Size objc,
Tcl_Obj *const objv[], Tk_Window *tkwinPtr);
/* 36 */
EXTERN TkWindow * TkGetFocusWin(TkWindow *winPtr);
@@ -612,7 +612,7 @@ typedef struct TkIntStubs {
TkCursor * (*tkGetCursorByName) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid string); /* 32 */
const char * (*tkGetDefaultScreenName) (Tcl_Interp *interp, const char *screenName); /* 33 */
TkDisplay * (*tkGetDisplay) (Display *display); /* 34 */
- int (*tkGetDisplayOf) (Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], Tk_Window *tkwinPtr); /* 35 */
+ Tcl_Size (*tkGetDisplayOf) (Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], Tk_Window *tkwinPtr); /* 35 */
TkWindow * (*tkGetFocusWin) (TkWindow *winPtr); /* 36 */
int (*tkGetInterpNames) (Tcl_Interp *interp, Tk_Window tkwin); /* 37 */
int (*tkGetMiterPoints) (double p1[], double p2[], double p3[], double width, double m1[], double m2[]); /* 38 */