summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkCanvLine.c2
-rw-r--r--generic/tkCanvPoly.c2
-rw-r--r--generic/tkCanvText.c6
-rw-r--r--generic/tkCmds.c6
-rw-r--r--generic/tkConfig.c12
-rw-r--r--generic/tkEntry.c12
-rw-r--r--generic/tkFont.c4
-rw-r--r--generic/tkIcu.c2
-rw-r--r--generic/tkMain.c2
-rw-r--r--generic/tkMenu.c22
-rw-r--r--generic/tkOldConfig.c8
-rw-r--r--generic/tkOption.c2
-rw-r--r--generic/tkSelect.c4
-rw-r--r--generic/tkText.c6
-rw-r--r--generic/tkTextDisp.c4
-rw-r--r--unix/tkUnixSelect.c4
-rw-r--r--unix/tkUnixSend.c2
-rw-r--r--win/tkWinMenu.c2
-rw-r--r--win/ttkWinXPTheme.c2
19 files changed, 52 insertions, 52 deletions
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index 4ccc27d..c94571d 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -1876,7 +1876,7 @@ GetLineIndex(
const char *string;
if (TCL_OK == TkGetIntForIndex(obj, 2*linePtr->numPoints - 1, 1, &idx)) {
- if (idx == TCL_INDEX_NONE) {
+ if (idx < 0) {
idx = 0;
} else if (idx > (2*(Tcl_Size)linePtr->numPoints)) {
idx = 2*linePtr->numPoints;
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index 61859c4..4a8a125 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.c
@@ -1720,7 +1720,7 @@ GetPolygonIndex(
Tcl_Size count = 2*(polyPtr->numPoints - polyPtr->autoClosed);
if (TCL_OK == TkGetIntForIndex(obj, (INT_MAX - 1) - ((INT_MAX) % count), 1, &idx)) {
- if (idx == TCL_INDEX_NONE) {
+ if (idx < 0) {
idx = 0;
} else if (idx >= INT_MAX - ((INT_MAX) % count)) {
idx = count;
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index 1e545bd..e6c935a 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -122,7 +122,7 @@ UnderlineParseProc(
obj.typePtr = NULL;
code = TkGetIntForIndex(&obj, TCL_INDEX_END, 0, &underline);
if (code == TCL_OK) {
- if (underline == TCL_INDEX_NONE) {
+ if (underline < 0) {
underline = (Tcl_Size)INT_MIN;
} else if ((size_t)underline > (size_t)TCL_INDEX_END>>1) {
underline++;
@@ -1468,7 +1468,7 @@ GetTextIndex(
const char *string;
if (TCL_OK == TkGetIntForIndex(obj, textPtr->numChars - 1, 1, &idx)) {
- if (idx == TCL_INDEX_NONE) {
+ if (idx < 0) {
idx = 0;
} else if (idx > textPtr->numChars) {
idx = textPtr->numChars;
@@ -1563,7 +1563,7 @@ SetTextCursor(
{
TextItem *textPtr = (TextItem *) itemPtr;
- if (index == TCL_INDEX_NONE) {
+ if (index < 0) {
textPtr->insertPos = 0;
} else if (index > textPtr->numChars) {
textPtr->insertPos = textPtr->numChars;
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index 0474fed..92b5411 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -818,7 +818,7 @@ ScalingCmd(
double d;
skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin);
- if (skip == TCL_INDEX_NONE) {
+ if (skip < 0) {
return TCL_ERROR;
}
screenPtr = Tk_Screen(tkwin);
@@ -873,7 +873,7 @@ UseinputmethodsCmd(
}
skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin);
- if (skip == TCL_INDEX_NONE) {
+ if (skip < 0) {
return TCL_ERROR;
}
dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -934,7 +934,7 @@ InactiveCmd(
Tk_Window tkwin = (Tk_Window)clientData;
Tcl_Size skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin);
- if (skip == TCL_INDEX_NONE) {
+ if (skip < 0) {
return TCL_ERROR;
}
if (objc == 1 + skip) {
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index d9a070a..bc36846 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -690,8 +690,8 @@ DoObjConfig(
}
return TCL_ERROR;
}
- if (newIndex == TCL_INDEX_NONE) {
- newIndex = (Tcl_Size)INT_MIN;
+ if (newIndex < 0) {
+ newIndex = INT_MIN;
} else if ((size_t)newIndex > (size_t)TCL_INDEX_END>>1) {
newIndex++;
}
@@ -1454,7 +1454,7 @@ Tk_RestoreSavedOptions(
Tk_SavedOptions *savePtr) /* Holds saved option information; must have
* been passed to Tk_SetOptions. */
{
- size_t i;
+ Tcl_Size i;
Option *optionPtr;
Tcl_Obj *newPtr; /* New object value of option, which we
* replace with old value and free. Taken from
@@ -1474,7 +1474,7 @@ Tk_RestoreSavedOptions(
ckfree(savePtr->nextPtr);
savePtr->nextPtr = NULL;
}
- for (i = savePtr->numItems - 1; i != (size_t)-1; i--) {
+ for (i = savePtr->numItems - 1; i >= 0; i--) {
optionPtr = savePtr->items[i].optionPtr;
specPtr = optionPtr->specPtr;
@@ -1483,12 +1483,12 @@ Tk_RestoreSavedOptions(
* record.
*/
- if (specPtr->objOffset != TCL_INDEX_NONE) {
+ if (specPtr->objOffset >= 0) {
newPtr = *((Tcl_Obj **) ((char *)savePtr->recordPtr + specPtr->objOffset));
} else {
newPtr = NULL;
}
- if (specPtr->internalOffset != TCL_INDEX_NONE) {
+ if (specPtr->internalOffset >= 0) {
internalPtr = (char *)savePtr->recordPtr + specPtr->internalOffset;
} else {
internalPtr = NULL;
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index e7812aa..65018e9 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -2678,7 +2678,7 @@ GetEntryIndex(
const char *string;
if (TCL_OK == TkGetIntForIndex(indexObj, entryPtr->numChars - 1, 1, &idx)) {
- if (idx == TCL_INDEX_NONE) {
+ if (idx < 0) {
idx = 0;
} else if (idx > entryPtr->numChars) {
idx = entryPtr->numChars;
@@ -2703,7 +2703,7 @@ GetEntryIndex(
*indexPtr = entryPtr->insertPos;
break;
case 's':
- if (entryPtr->selectFirst == TCL_INDEX_NONE) {
+ if (entryPtr->selectFirst < 0) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"selection isn't in widget %s",
@@ -2808,7 +2808,7 @@ EntryScanTo(
newLeftIndex = entryPtr->scanMarkIndex = entryPtr->numChars - 1;
entryPtr->scanMarkX = x;
}
- if (newLeftIndex == TCL_INDEX_NONE) {
+ if (newLeftIndex < 0) {
newLeftIndex = entryPtr->scanMarkIndex = 0;
entryPtr->scanMarkX = x;
}
@@ -2874,7 +2874,7 @@ EntrySelectTo(
} else {
newFirst = index;
newLast = entryPtr->selectAnchor;
- if (newLast == TCL_INDEX_NONE) {
+ if (newLast < 0) {
newFirst = newLast = TCL_INDEX_NONE;
}
}
@@ -2922,7 +2922,7 @@ EntryFetchSelection(
const char *string;
const char *selStart, *selEnd;
- if ((entryPtr->selectFirst == TCL_INDEX_NONE) || (!entryPtr->exportSelection)
+ if ((entryPtr->selectFirst < 0) || (!entryPtr->exportSelection)
|| Tcl_IsSafe(entryPtr->interp)) {
return -1;
}
@@ -4305,7 +4305,7 @@ SpinboxWidgetObjCmd(
if (index >= entryPtr->numChars) {
index = entryPtr->numChars - 1;
}
- if (index == TCL_INDEX_NONE) {
+ if (index < 0) {
index = 0;
}
entryPtr->leftIndex = index;
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 1c5db41..226f2a9 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -1852,7 +1852,7 @@ Tk_TextWidth(
{
int width;
- if (numBytes == TCL_INDEX_NONE) {
+ if (numBytes < 0) {
numBytes = strlen(string);
}
Tk_MeasureChars(tkfont, string, numBytes, -1, 0, &width);
@@ -2006,7 +2006,7 @@ Tk_ComputeTextLayout(
height = fmPtr->ascent + fmPtr->descent;
- if (numChars == TCL_INDEX_NONE) {
+ if (numChars < 0) {
numChars = Tcl_NumUtfChars(string, TCL_INDEX_NONE);
}
if (wrapLength == 0) {
diff --git a/generic/tkIcu.c b/generic/tkIcu.c
index c586fb0..342bd11 100644
--- a/generic/tkIcu.c
+++ b/generic/tkIcu.c
@@ -120,7 +120,7 @@ startEndOfCmd(
return TCL_ERROR;
}
if (flags & FLAG_FOLLOWING) {
- if ((idx == TCL_INDEX_NONE) && (flags & FLAG_WORD)) {
+ if ((idx < 0) && (flags & FLAG_WORD)) {
idx = 0;
}
idx = icu_following(it, idx);
diff --git a/generic/tkMain.c b/generic/tkMain.c
index ad122d9..8db676c 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -425,7 +425,7 @@ StdinProc(
length = Tcl_Gets(chan, &isPtr->line);
- if ((length == TCL_INDEX_NONE) && !isPtr->gotPartial) {
+ if ((length < 0) && !isPtr->gotPartial) {
if (isPtr->tty) {
/*
* Would be better to find a way to exit the mainLoop? Or perhaps
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 5e2f381..3eaa86e 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -749,7 +749,7 @@ MenuWidgetObjCmd(
first = 1;
}
- if ((first == TCL_INDEX_NONE) || (last < first)) {
+ if ((first < 0) || (last < first)) {
goto done;
}
DeleteMenuCloneEntries(menuPtr, first, last);
@@ -766,7 +766,7 @@ MenuWidgetObjCmd(
if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
- if (index == TCL_INDEX_NONE) {
+ if (index < 0) {
goto done;
}
mePtr = menuPtr->entries[index];
@@ -791,7 +791,7 @@ MenuWidgetObjCmd(
if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
- if (index == TCL_INDEX_NONE) {
+ if (index < 0) {
goto done;
}
mePtr = menuPtr->entries[index];
@@ -832,7 +832,7 @@ MenuWidgetObjCmd(
goto error;
}
#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
- if (index == TCL_INDEX_NONE) {
+ if (index < 0) {
Tcl_SetObjResult(interp, Tcl_NewObj());
} else
#endif
@@ -859,7 +859,7 @@ MenuWidgetObjCmd(
if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
- if (index == TCL_INDEX_NONE) {
+ if (index < 0) {
goto done;
}
result = TkInvokeMenu(interp, menuPtr, index);
@@ -912,7 +912,7 @@ MenuWidgetObjCmd(
if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
- if ((index == TCL_INDEX_NONE) || (menuPtr->entries[index]->type != CASCADE_ENTRY)) {
+ if ((index < 0) || (menuPtr->entries[index]->type != CASCADE_ENTRY)) {
result = TkPostSubmenu(interp, menuPtr, NULL);
} else {
result = TkPostSubmenu(interp, menuPtr, menuPtr->entries[index]);
@@ -930,7 +930,7 @@ MenuWidgetObjCmd(
if (GetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
goto error;
}
- if (index == TCL_INDEX_NONE) {
+ if (index < 0) {
goto done;
}
if (menuPtr->entries[index]->type == TEAROFF_ENTRY) {
@@ -1001,7 +1001,7 @@ TkInvokeMenu(
int result = TCL_OK;
TkMenuEntry *mePtr;
- if (index == TCL_INDEX_NONE) {
+ if (index < 0) {
goto done;
}
mePtr = menuPtr->entries[index];
@@ -2351,7 +2351,7 @@ MenuAddOrInsert(
} else {
index = menuPtr->numEntries;
}
- if (index == TCL_INDEX_NONE) {
+ if (index < 0) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad menu entry index \"%s\"", Tcl_GetString(indexPtr)));
Tcl_SetErrorCode(interp, "TK", "MENU", "INDEX", NULL);
@@ -2868,7 +2868,7 @@ MenuDoXPosition(
return TCL_ERROR;
}
Tcl_ResetResult(interp);
- if (index == TCL_INDEX_NONE) {
+ if (index < 0) {
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0));
} else {
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(menuPtr->entries[index]->x));
@@ -2905,7 +2905,7 @@ MenuDoYPosition(
goto error;
}
Tcl_ResetResult(interp);
- if (index == TCL_INDEX_NONE) {
+ if (index < 0) {
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0));
} else {
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(menuPtr->entries[index]->y));
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index e887154..e9c3d7c 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.c
@@ -364,7 +364,7 @@ DoConfig(
}
do {
- if (specPtr->offset == TCL_INDEX_NONE) {
+ if (specPtr->offset < 0) {
break;
}
ptr = (char *)widgRec + specPtr->offset;
@@ -666,7 +666,7 @@ Tk_ConfigureInfo(
|| (specPtr->specFlags & hateFlags)) {
continue;
}
- if ((specPtr->argvName == NULL) || (specPtr->offset == TCL_INDEX_NONE)) {
+ if ((specPtr->argvName == NULL) || (specPtr->offset < 0)) {
continue;
}
list = FormatConfigInfo(interp, tkwin, specPtr, widgRec);
@@ -781,7 +781,7 @@ FormatConfigValue(
const char *result;
*freeProcPtr = NULL;
- if (specPtr->offset == TCL_INDEX_NONE) {
+ if (specPtr->offset < 0) {
return NULL;
}
ptr = (char *)widgRec + specPtr->offset;
@@ -1005,7 +1005,7 @@ Tk_FreeOptions(
if ((specPtr->specFlags & needFlags) != needFlags) {
continue;
}
- if (specPtr->offset == TCL_INDEX_NONE) {
+ if (specPtr->offset < 0) {
continue;
}
ptr = widgRec + specPtr->offset;
diff --git a/generic/tkOption.c b/generic/tkOption.c
index b1a8d07..e626930 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.c
@@ -799,7 +799,7 @@ TkOptionClassChanged(
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- if (winPtr->optionLevel == TCL_INDEX_NONE) {
+ if (winPtr->optionLevel < 0) {
return;
}
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index f83c386..b0867fc 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -598,7 +598,7 @@ Tk_GetSelection(
count = TkSelDefaultSelection(infoPtr, target, buffer,
TK_SEL_BYTES_AT_ONCE, &type);
- if (count == TCL_INDEX_NONE) {
+ if (count < 0) {
goto cantget;
} else if (count > TK_SEL_BYTES_AT_ONCE) {
Tcl_Panic("selection handler returned too many bytes");
@@ -614,7 +614,7 @@ Tk_GetSelection(
while (1) {
count = selPtr->proc(selPtr->clientData, offset, buffer,
TK_SEL_BYTES_AT_ONCE);
- if ((count == TCL_INDEX_NONE) || (ip.selPtr == NULL)) {
+ if ((count < 0) || (ip.selPtr == NULL)) {
tsdPtr->pendingPtr = ip.nextPtr;
goto cantget;
}
diff --git a/generic/tkText.c b/generic/tkText.c
index 1b83fcd..a273b08 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -6234,7 +6234,7 @@ SearchCore(
lastNonOverlap = lastTotal;
}
- if (info.extendStart == TCL_INDEX_NONE) {
+ if (info.extendStart < 0) {
/*
* No multi-line match is possible.
*/
@@ -6333,7 +6333,7 @@ SearchCore(
if ((match &&
firstOffset + info.matches[0].end != (Tcl_Size) lastTotal &&
firstOffset + info.matches[0].end < prevFullLine)
- || info.extendStart == TCL_INDEX_NONE) {
+ || info.extendStart < 0) {
break;
}
@@ -6483,7 +6483,7 @@ SearchCore(
* previous match.
*/
- if (matchOffset == TCL_INDEX_NONE ||
+ if (matchOffset == -1 ||
((searchSpecPtr->all || searchSpecPtr->backwards)
&& ((firstOffset < matchOffset)
|| ((firstOffset + info.matches[0].end
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 9673996..b3096f9 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -3072,7 +3072,7 @@ AsyncUpdateLineMetrics(
* and we've reached the last line, then we're done.
*/
- if (dInfoPtr->metricEpoch == TCL_INDEX_NONE
+ if (dInfoPtr->metricEpoch == -1
&& lineNum == dInfoPtr->lastMetricUpdateLine) {
/*
* We have looped over all lines, so we're done. We must release our
@@ -3256,7 +3256,7 @@ TkTextUpdateLineMetrics(
* then we can't be done.
*/
- if (textPtr->dInfoPtr->metricEpoch == TCL_INDEX_NONE && lineNum == endLine) {
+ if (textPtr->dInfoPtr->metricEpoch == -1 && lineNum == endLine) {
/*
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index 89a4920..9b0437f 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.c
@@ -479,8 +479,8 @@ TkSelPropProc(
* offset to -1 to indicate we are done.
*/
- if (numItems + 1 < TK_SEL_BYTES_AT_ONCE + 1) {
- if (numItems + 1 < 2) {
+ if (numItems < TK_SEL_BYTES_AT_ONCE) {
+ if (numItems < 1) {
incrPtr->converts[i].offset = -1;
incrPtr->numIncrs--;
} else {
diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c
index f5e83af..4be6cdb 100644
--- a/unix/tkUnixSend.c
+++ b/unix/tkUnixSend.c
@@ -1970,7 +1970,7 @@ TkpTestsendCmd(
Tk_ErrorHandler handler;
int index;
- if (objc + 1 < 3) {
+ if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv,
"option ?arg ...?");
return TCL_ERROR;
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index f094ae6..96b3e1c 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -1283,7 +1283,7 @@ TkWinHandleMenuEvent(
Tcl_DStringFree(&ds);
Tcl_DStringInit(&ds);
wlabel = Tcl_UtfToWCharDString(src, len, &ds);
- if (((Tcl_Size)underline + 1 < len + 1) && (menuChar ==
+ if ((underline < len) && (menuChar ==
Tcl_UniCharToUpper(wlabel[underline]))) {
*plResult = (2 << 16) | i;
returnResult = 1;
diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c
index d464ba2..5ee9384 100644
--- a/win/ttkWinXPTheme.c
+++ b/win/ttkWinXPTheme.c
@@ -1145,7 +1145,7 @@ Ttk_CreateVsapiElement(
enum { O_HALFHEIGHT, O_HALFWIDTH, O_HEIGHT, O_MARGINS, O_PADDING,
O_SYSSIZE, O_WIDTH };
- if (objc + 1 < 3) {
+ if (objc < 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"missing required arguments 'class' and/or 'partId'", TCL_INDEX_NONE));
Tcl_SetErrorCode(interp, "TTK", "VSAPI", "REQUIRED", NULL);