summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-24 21:29:59 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-24 21:29:59 (GMT)
commita8636d143def6ec81330e49af713edbb2e08862a (patch)
treeecbaea802a0bc17da9aaadc8f12c97d15e9c768d /generic
parent334a6b720c513b352e0b4d13dc50b498a78c2ee4 (diff)
downloadtk-a8636d143def6ec81330e49af713edbb2e08862a.zip
tk-a8636d143def6ec81330e49af713edbb2e08862a.tar.gz
tk-a8636d143def6ec81330e49af713edbb2e08862a.tar.bz2
More progress
Diffstat (limited to 'generic')
-rw-r--r--generic/tkCanvText.c32
-rw-r--r--generic/tkEntry.c56
-rw-r--r--generic/tkEntry.h10
-rw-r--r--generic/tkText.c6
-rw-r--r--generic/tkText.h2
-rw-r--r--generic/tkTextBTree.c18
-rw-r--r--generic/tkTextDisp.c10
-rw-r--r--generic/tkTextImage.c2
-rw-r--r--generic/tkTextIndex.c14
-rw-r--r--generic/tkTextWind.c2
-rw-r--r--generic/ttk/ttkEntry.c14
11 files changed, 83 insertions, 83 deletions
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index d873d12..3c8f364 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -32,7 +32,7 @@ typedef struct TextItem {
*/
double x, y; /* Positioning point for text. */
- int insertPos; /* Character index of character just before
+ TkSizeT insertPos; /* Character index of character just before
* which the insertion cursor is displayed. */
/*
@@ -62,8 +62,8 @@ typedef struct TextItem {
* configuration settings above.
*/
- int numChars; /* Length of text in characters. */
- int numBytes; /* Length of text in bytes. */
+ TkSizeT numChars; /* Length of text in characters. */
+ TkSizeT numBytes; /* Length of text in bytes. */
Tk_TextLayout textLayout; /* Cached text layout information. */
int actualWidth; /* Width of text as computed. Used to make
* selections of wrapped text display
@@ -510,19 +510,19 @@ ConfigureText(
textPtr->numChars = Tcl_NumUtfChars(textPtr->text, textPtr->numBytes);
if (textInfoPtr->selItemPtr == itemPtr) {
- if (textInfoPtr->selectFirst >= textPtr->numChars) {
+ if (textInfoPtr->selectFirst >= (int)textPtr->numChars) {
textInfoPtr->selItemPtr = NULL;
} else {
- if (textInfoPtr->selectLast >= textPtr->numChars) {
+ if (textInfoPtr->selectLast >= (int)textPtr->numChars) {
textInfoPtr->selectLast = textPtr->numChars - 1;
}
if ((textInfoPtr->anchorItemPtr == itemPtr)
- && (textInfoPtr->selectAnchor >= textPtr->numChars)) {
+ && (textInfoPtr->selectAnchor >= (int)textPtr->numChars)) {
textInfoPtr->selectAnchor = textPtr->numChars - 1;
}
}
}
- if (textPtr->insertPos >= textPtr->numChars) {
+ if (textPtr->insertPos + 1 >= textPtr->numChars + 1) {
textPtr->insertPos = textPtr->numChars;
}
@@ -846,7 +846,7 @@ DisplayCanvText(
if (textInfoPtr->selItemPtr == itemPtr) {
selFirstChar = textInfoPtr->selectFirst;
selLastChar = textInfoPtr->selectLast;
- if (selLastChar > textPtr->numChars) {
+ if (selLastChar > (int)textPtr->numChars) {
selLastChar = textPtr->numChars - 1;
}
if ((selFirstChar >= 0) && (selFirstChar <= selLastChar)) {
@@ -969,7 +969,7 @@ DisplayCanvText(
TkDrawAngledTextLayout(display, drawable, textPtr->selTextGC,
textPtr->textLayout, drawableX, drawableY, textPtr->angle,
selFirstChar, selLastChar + 1);
- if (selLastChar + 1 < textPtr->numChars) {
+ if (selLastChar + 1 < (int)textPtr->numChars) {
TkDrawAngledTextLayout(display, drawable, textPtr->gc,
textPtr->textLayout, drawableX, drawableY, textPtr->angle,
selLastChar + 1, textPtr->numChars);
@@ -1027,7 +1027,7 @@ TextInsert(
if (index < 0) {
index = 0;
}
- if (index > textPtr->numChars) {
+ if (index > (int)textPtr->numChars) {
index = textPtr->numChars;
}
byteIndex = Tcl_UtfAtIndex(text, index) - text;
@@ -1064,7 +1064,7 @@ TextInsert(
textInfoPtr->selectAnchor += charsAdded;
}
}
- if (textPtr->insertPos >= index) {
+ if (textPtr->insertPos + 1 >= (TkSizeT)index + 1) {
textPtr->insertPos += charsAdded;
}
ComputeTextBbox(canvas, textPtr);
@@ -1105,7 +1105,7 @@ TextDeleteChars(
if (first < 0) {
first = 0;
}
- if (last >= textPtr->numChars) {
+ if (last >= (int)textPtr->numChars) {
last = textPtr->numChars - 1;
}
if (first > last) {
@@ -1155,9 +1155,9 @@ TextDeleteChars(
}
}
}
- if (textPtr->insertPos > first) {
+ if ((int)textPtr->insertPos > first) {
textPtr->insertPos -= charsRemoved;
- if (textPtr->insertPos < first) {
+ if ((int)textPtr->insertPos < first) {
textPtr->insertPos = first;
}
}
@@ -1393,7 +1393,7 @@ GetTextIndex(
if (TCL_OK == TkGetIntForIndex(obj, textPtr->numChars - 1, 1, &idx)) {
if (idx == TCL_INDEX_NONE) {
idx = 0;
- } else if (idx > (TkSizeT)textPtr->numChars) {
+ } else if (idx > textPtr->numChars) {
idx = textPtr->numChars;
}
*indexPtr = (int)idx;
@@ -1489,7 +1489,7 @@ SetTextCursor(
if (index < 0) {
textPtr->insertPos = 0;
- } else if (index > textPtr->numChars) {
+ } else if (index > (int)textPtr->numChars) {
textPtr->insertPos = textPtr->numChars;
} else {
textPtr->insertPos = index;
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index 67c4794..e331dcb 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -637,7 +637,7 @@ EntryWidgetObjCmd(
&index) != TCL_OK) {
goto error;
}
- if ((index == entryPtr->numChars) && (index > 0)) {
+ if ((index == (int)entryPtr->numChars) && (index > 0)) {
index--;
}
Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height);
@@ -989,7 +989,7 @@ EntryWidgetObjCmd(
break;
}
}
- if (index >= entryPtr->numChars) {
+ if (index >= (int)entryPtr->numChars) {
index = entryPtr->numChars - 1;
}
if (index < 0) {
@@ -1706,8 +1706,8 @@ DisplayEntry(
0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);
if (showSelection && (entryPtr->state != STATE_DISABLED)
- && (entryPtr->selectLast > entryPtr->leftIndex)) {
- if (entryPtr->selectFirst <= entryPtr->leftIndex) {
+ && (entryPtr->selectLast > (int)entryPtr->leftIndex)) {
+ if (entryPtr->selectFirst <= (int)entryPtr->leftIndex) {
selStartX = entryPtr->leftX;
} else {
Tk_CharBbox(entryPtr->textLayout, entryPtr->selectFirst,
@@ -1749,7 +1749,7 @@ DisplayEntry(
cursorX -= (entryPtr->insertWidth == 1) ? 1 : (entryPtr->insertWidth)/2;
Tk_SetCaretPos(entryPtr->tkwin, cursorX, baseY - fm.ascent,
fm.ascent + fm.descent);
- if (entryPtr->insertPos >= entryPtr->leftIndex && cursorX < xBound) {
+ if ((entryPtr->insertPos >= (int)entryPtr->leftIndex) && cursorX < xBound) {
if (entryPtr->flags & CURSOR_ON) {
Tk_Fill3DRectangle(tkwin, pixmap, entryPtr->insertBorder,
cursorX, baseY - fm.ascent, entryPtr->insertWidth,
@@ -1783,7 +1783,7 @@ DisplayEntry(
&& (entryPtr->selectFirst < entryPtr->selectLast)) {
int selFirst;
- if (entryPtr->selectFirst < entryPtr->leftIndex) {
+ if (entryPtr->selectFirst < (int)entryPtr->leftIndex) {
selFirst = entryPtr->leftIndex;
} else {
selFirst = entryPtr->selectFirst;
@@ -1982,7 +1982,7 @@ EntryComputeGeometry(
p = (char *)ckalloc(entryPtr->numDisplayBytes + 1);
entryPtr->displayString = p;
- for (i = entryPtr->numChars; --i >= 0; ) {
+ for (i = entryPtr->numChars; i-- > 0; ) {
memcpy(p, buf, size);
p += size;
}
@@ -2083,7 +2083,7 @@ EntryComputeGeometry(
if (rightX < overflow) {
maxOffScreen++;
}
- if (entryPtr->leftIndex > maxOffScreen) {
+ if (entryPtr->leftIndex + 1 > (TkSizeT)maxOffScreen + 1) {
entryPtr->leftIndex = maxOffScreen;
}
Tk_CharBbox(entryPtr->textLayout, entryPtr->leftIndex, &rightX,
@@ -2200,7 +2200,7 @@ InsertChars(
if ((entryPtr->selectAnchor > index) || (entryPtr->selectFirst >= index)) {
entryPtr->selectAnchor += charsAdded;
}
- if (entryPtr->leftIndex > index) {
+ if (entryPtr->leftIndex + 1 > (TkSizeT)index + 1) {
entryPtr->leftIndex += charsAdded;
}
if (entryPtr->insertPos >= index) {
@@ -2237,7 +2237,7 @@ DeleteChars(
const char *string;
char *newStr, *toDelete;
- if ((index + count) > entryPtr->numChars) {
+ if ((index + count) > (int)entryPtr->numChars) {
count = entryPtr->numChars - index;
}
if (count <= 0) {
@@ -2308,8 +2308,8 @@ DeleteChars(
entryPtr->selectAnchor = index;
}
}
- if (entryPtr->leftIndex > index) {
- if (entryPtr->leftIndex >= (index + count)) {
+ if (entryPtr->leftIndex + 1 > (TkSizeT)index + 1) {
+ if (entryPtr->leftIndex + 1 >= (TkSizeT)index + count + 1) {
entryPtr->leftIndex -= count;
} else {
entryPtr->leftIndex = index;
@@ -2482,21 +2482,21 @@ EntrySetValue(
}
if (entryPtr->selectFirst >= 0) {
- if (entryPtr->selectFirst >= entryPtr->numChars) {
+ if (entryPtr->selectFirst >= (int)entryPtr->numChars) {
entryPtr->selectFirst = -1;
entryPtr->selectLast = -1;
- } else if (entryPtr->selectLast > entryPtr->numChars) {
+ } else if (entryPtr->selectLast > (int)entryPtr->numChars) {
entryPtr->selectLast = entryPtr->numChars;
}
}
- if (entryPtr->leftIndex >= entryPtr->numChars) {
- if (entryPtr->numChars > 0) {
+ if (entryPtr->leftIndex + 1 >= entryPtr->numChars + 1) {
+ if (entryPtr->numChars + 1 > 1) {
entryPtr->leftIndex = entryPtr->numChars - 1;
} else {
entryPtr->leftIndex = 0;
}
}
- if (entryPtr->insertPos > entryPtr->numChars) {
+ if (entryPtr->insertPos > (int)entryPtr->numChars) {
entryPtr->insertPos = entryPtr->numChars;
}
@@ -2657,8 +2657,8 @@ GetEntryIndex(
if (TCL_OK == TkGetIntForIndex(indexObj, entryPtr->numChars - 1, 1, &idx)) {
if (idx == TCL_INDEX_NONE) {
idx = 0;
- } else if (idx > (TkSizeT)entryPtr->numChars) {
- idx = (TkSizeT)entryPtr->numChars;
+ } else if (idx > entryPtr->numChars) {
+ idx = entryPtr->numChars;
}
*indexPtr = (int)idx;
return TCL_OK;
@@ -2727,7 +2727,7 @@ GetEntryIndex(
* be selected, for example.
*/
- if (roundUp && (*indexPtr < entryPtr->numChars)) {
+ if (roundUp && (*indexPtr < (int)entryPtr->numChars)) {
*indexPtr += 1;
}
break;
@@ -2781,7 +2781,7 @@ EntryScanTo(
newLeftIndex = entryPtr->scanMarkIndex
- (10 * (x - entryPtr->scanMarkX)) / entryPtr->avgWidth;
- if (newLeftIndex >= entryPtr->numChars) {
+ if (newLeftIndex >= (int)entryPtr->numChars) {
newLeftIndex = entryPtr->scanMarkIndex = entryPtr->numChars - 1;
entryPtr->scanMarkX = x;
}
@@ -2790,11 +2790,11 @@ EntryScanTo(
entryPtr->scanMarkX = x;
}
- if (newLeftIndex != entryPtr->leftIndex) {
+ if ((TkSizeT)newLeftIndex != entryPtr->leftIndex) {
entryPtr->leftIndex = newLeftIndex;
entryPtr->flags |= UPDATE_SCROLLBAR;
EntryComputeGeometry(entryPtr);
- if (newLeftIndex != entryPtr->leftIndex) {
+ if ((TkSizeT)newLeftIndex != entryPtr->leftIndex) {
entryPtr->scanMarkIndex = entryPtr->leftIndex;
entryPtr->scanMarkX = x;
}
@@ -2842,8 +2842,8 @@ EntrySelectTo(
* Pick new starting and ending points for the selection.
*/
- if (entryPtr->selectAnchor > entryPtr->numChars) {
- entryPtr->selectAnchor = entryPtr->numChars;
+ if (entryPtr->selectAnchor > (int)entryPtr->numChars) {
+ entryPtr->selectAnchor = (int)entryPtr->numChars;
}
if (entryPtr->selectAnchor <= index) {
newFirst = entryPtr->selectAnchor;
@@ -3035,7 +3035,7 @@ EntryVisibleRange(
charsInWindow = Tk_PointToChar(entryPtr->textLayout,
Tk_Width(entryPtr->tkwin) - entryPtr->inset
- entryPtr->xWidth - entryPtr->layoutX - 1, 0);
- if (charsInWindow < entryPtr->numChars) {
+ if (charsInWindow < (int)entryPtr->numChars) {
charsInWindow++;
}
charsInWindow -= entryPtr->leftIndex;
@@ -3845,7 +3845,7 @@ SpinboxWidgetObjCmd(
&index) != TCL_OK) {
goto error;
}
- if ((index == entryPtr->numChars) && (index > 0)) {
+ if ((index == (int)entryPtr->numChars) && (index > 0)) {
index--;
}
Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height);
@@ -4275,7 +4275,7 @@ SpinboxWidgetObjCmd(
break;
}
}
- if (index >= entryPtr->numChars) {
+ if (index >= (int)entryPtr->numChars) {
index = entryPtr->numChars - 1;
}
if (index < 0) {
diff --git a/generic/tkEntry.h b/generic/tkEntry.h
index c81563c..f251185 100644
--- a/generic/tkEntry.h
+++ b/generic/tkEntry.h
@@ -134,7 +134,7 @@ typedef struct {
Tk_TextLayout placeholderLayout;/* Cached placeholder text layout information. */
char *placeholderString; /* String value of placeholder. */
- int placeholderChars; /* Number of chars in placeholder. */
+ TkSizeT placeholderChars; /* Number of chars in placeholder. */
XColor *placeholderColorPtr;/* Color value of placeholder foreground. */
GC placeholderGC; /* For drawing placeholder text. */
int placeholderX; /* Origin for layout. */
@@ -151,13 +151,13 @@ typedef struct {
* malloced memory with the same character
* length as string but whose characters are
* all equal to showChar. */
- int numBytes; /* Length of string in bytes. */
- int numChars; /* Length of string in characters. Both string
+ TkSizeT numBytes; /* Length of string in bytes. */
+ TkSizeT numChars; /* Length of string in characters. Both string
* and displayString have the same character
* length, but may have different byte lengths
* due to being made from different UTF-8
* characters. */
- int numDisplayBytes; /* Length of displayString in bytes. */
+ TkSizeT numDisplayBytes; /* Length of displayString in bytes. */
int inset; /* Number of pixels on the left and right
* sides that are taken up by XPAD,
* borderWidth (if any), and highlightWidth
@@ -166,7 +166,7 @@ typedef struct {
int layoutX, layoutY; /* Origin for layout. */
int leftX; /* X position at which character at leftIndex
* is drawn (varies depending on justify). */
- int leftIndex; /* Character index of left-most character
+ TkSizeT leftIndex; /* Character index of left-most character
* visible in window. */
Tcl_TimerToken insertBlinkHandler;
/* Timer handler used to blink cursor on and
diff --git a/generic/tkText.c b/generic/tkText.c
index 06ca03c..36b5ae2 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -4097,14 +4097,14 @@ TextSearchIndexInLine(
if ((segPtr->typePtr == &tkTextCharType) &&
(searchSpecPtr->searchElide
|| !TkTextIsElided(textPtr, &curIndex, NULL))) {
- if (leftToScan < segPtr->size) {
+ if (leftToScan < (int)segPtr->size) {
if (searchSpecPtr->exact) {
index += leftToScan;
} else {
index += Tcl_NumUtfChars(segPtr->body.chars, leftToScan);
}
} else if (searchSpecPtr->exact) {
- index += segPtr->size;
+ index += (int)segPtr->size;
} else {
index += Tcl_NumUtfChars(segPtr->body.chars, -1);
}
@@ -4364,7 +4364,7 @@ TextSearchFoundMatch(
}
} else {
if (searchSpecPtr->exact) {
- leftToScan -= segPtr->size;
+ leftToScan -= (int)segPtr->size;
} else {
leftToScan -= Tcl_NumUtfChars(segPtr->body.chars, -1);
}
diff --git a/generic/tkText.h b/generic/tkText.h
index 4d1d4b3..4914b2f 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -165,7 +165,7 @@ typedef struct TkTextSegment {
struct TkTextSegment *nextPtr;
/* Next in list of segments for this line, or
* NULL for end of list. */
- int size; /* Size of this segment (# of bytes of index
+ TkSizeT size; /* Size of this segment (# of bytes of index
* space it occupies). */
union {
char chars[2]; /* Characters that make up character info.
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c
index 2d8a6c3..5ce7a99 100644
--- a/generic/tkTextBTree.c
+++ b/generic/tkTextBTree.c
@@ -161,7 +161,7 @@ static int CharDeleteProc(TkTextSegment *segPtr,
TkTextLine *linePtr, int treeGone);
static TkTextSegment * CharCleanupProc(TkTextSegment *segPtr,
TkTextLine *linePtr);
-static TkTextSegment * CharSplitProc(TkTextSegment *segPtr, int index);
+static TkTextSegment * CharSplitProc(TkTextSegment *segPtr, TkSizeT index);
static void CheckNodeConsistency(Node *nodePtr, int references);
static void CleanupLine(TkTextLine *linePtr);
static void DeleteSummaries(Summary *tagPtr);
@@ -1197,7 +1197,7 @@ SplitSeg(
segPtr = linePtr->segPtr;
while (segPtr != NULL) {
- if (segPtr->size > count) {
+ if (segPtr->size > (TkSizeT)count) {
if (count == 0) {
return prevPtr;
}
@@ -3244,7 +3244,7 @@ TkBTreeCharTagged(
toggleSegPtr = NULL;
for (index = 0, segPtr = indexPtr->linePtr->segPtr;
- (index + segPtr->size) <= indexPtr->byteIndex;
+ (index + (int)segPtr->size) <= indexPtr->byteIndex;
index += segPtr->size, segPtr = segPtr->nextPtr) {
if (((segPtr->typePtr == &tkTextToggleOnType)
|| (segPtr->typePtr == &tkTextToggleOffType))
@@ -3364,7 +3364,7 @@ TkBTreeGetTags(
linePtr = indexPtr->linePtr;
index = 0;
segPtr = linePtr->segPtr;
- while ((index + segPtr->size) <= indexPtr->byteIndex) {
+ while ((index + (int)segPtr->size) <= indexPtr->byteIndex) {
if ((segPtr->typePtr == &tkTextToggleOnType)
|| (segPtr->typePtr == &tkTextToggleOffType)) {
IncCount(segPtr->body.toggle.tagPtr, 1, &tagInfo);
@@ -3528,7 +3528,7 @@ TkTextIsElided(
index = 0;
linePtr = indexPtr->linePtr;
segPtr = linePtr->segPtr;
- while ((index + segPtr->size) <= indexPtr->byteIndex) {
+ while ((index + (int)segPtr->size) <= indexPtr->byteIndex) {
if ((segPtr->typePtr == &tkTextToggleOnType)
|| (segPtr->typePtr == &tkTextToggleOffType)) {
tagPtr = segPtr->body.toggle.tagPtr;
@@ -3865,7 +3865,7 @@ TkBTreeCheck(
}
if (segPtr->size != 1) {
Tcl_Panic("TkBTreeCheck: last line has wrong # characters: %d",
- segPtr->size);
+ (int)segPtr->size);
}
if ((segPtr->body.chars[0] != '\n') || (segPtr->body.chars[1] != 0)) {
Tcl_Panic("TkBTreeCheck: last line had bad value: %s",
@@ -4549,7 +4549,7 @@ TkBTreeNumPixels(
static TkTextSegment *
CharSplitProc(
TkTextSegment *segPtr, /* Pointer to segment to split. */
- int index) /* Position within segment at which to
+ TkSizeT index) /* Position within segment at which to
* split. */
{
TkTextSegment *newPtr1, *newPtr2;
@@ -4675,10 +4675,10 @@ CharCheckProc(
* to each other: they should be merged together.
*/
- if (segPtr->size <= 0) {
+ if (segPtr->size + 1 <= 1) {
Tcl_Panic("CharCheckProc: segment has size <= 0");
}
- if (strlen(segPtr->body.chars) != (size_t) segPtr->size) {
+ if (strlen(segPtr->body.chars) != (size_t)segPtr->size) {
Tcl_Panic("CharCheckProc: segment has wrong size");
}
if (segPtr->nextPtr == NULL) {
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index c75d98b..6917292 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -1214,7 +1214,7 @@ LayoutDLine(
if (elide && indexPtr->byteIndex == 0) {
maxBytes = 0;
for (segPtr = info.segPtr; segPtr != NULL; segPtr = segPtr->nextPtr) {
- if (segPtr->size > 0) {
+ if (segPtr->size + 1 > 1) {
if (elide == 0) {
/*
* We toggled a tag and the elide state changed to
@@ -1335,7 +1335,7 @@ LayoutDLine(
connectNextLogicalLine:
byteOffset = curIndex.byteIndex;
segPtr = curIndex.linePtr->segPtr;
- while ((byteOffset + 1 > 1) && (byteOffset >= (TkSizeT)segPtr->size)) {
+ while ((byteOffset + 1 > 1) && (byteOffset + 1 >= segPtr->size + 1)) {
byteOffset -= segPtr->size;
segPtr = segPtr->nextPtr;
@@ -1375,7 +1375,7 @@ LayoutDLine(
if (elide && (lastChunkPtr != NULL)
&& (lastChunkPtr->displayProc == NULL /*ElideDisplayProc*/)) {
elidesize = segPtr->size - byteOffset;
- if ((TkSizeT)segPtr->size > byteOffset) {
+ if (segPtr->size + 1 > byteOffset + 1) {
curIndex.byteIndex += elidesize;
lastChunkPtr->numBytes += elidesize;
breakByteOffset = lastChunkPtr->breakIndex
@@ -1621,7 +1621,7 @@ LayoutDLine(
}
curIndex.byteIndex += chunkPtr->numBytes;
byteOffset += chunkPtr->numBytes;
- if (byteOffset >= (TkSizeT)segPtr->size) {
+ if (byteOffset >= segPtr->size) {
byteOffset = 0;
segPtr = segPtr->nextPtr;
if (elide && segPtr == NULL) {
@@ -7822,7 +7822,7 @@ TkTextCharLayoutProc(
}
}
checkForNextChunk:
- if ((bytesThatFit + byteOffset) == (TkSizeT)segPtr->size) {
+ if ((bytesThatFit + byteOffset) == segPtr->size) {
for (nextPtr = segPtr->nextPtr; nextPtr != NULL;
nextPtr = nextPtr->nextPtr) {
if (nextPtr->size != 0) {
diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c
index cc229d6..ef79376 100644
--- a/generic/tkTextImage.c
+++ b/generic/tkTextImage.c
@@ -631,7 +631,7 @@ EmbImageCheckProc(
}
if (eiPtr->size != 1) {
Tcl_Panic("EmbImageCheckProc: embedded image has size %d",
- eiPtr->size);
+ (int)eiPtr->size);
}
}
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index 81cad85..4a80844 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -425,7 +425,7 @@ TkTextMakeByteIndex(
indexPtr->byteIndex = index - sizeof(char);
break;
}
- if (index + segPtr->size > byteIndex) {
+ if (index + (int)segPtr->size > byteIndex) {
indexPtr->byteIndex = byteIndex;
if ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType)) {
/*
@@ -531,7 +531,7 @@ TkTextMakeCharIndex(
index += offset;
}
} else {
- if (charIndex < segPtr->size) {
+ if (charIndex < (int)segPtr->size) {
indexPtr->byteIndex = index;
break;
}
@@ -572,7 +572,7 @@ TkTextIndexToSeg(
TkSizeT offset;
for (offset = indexPtr->byteIndex, segPtr = indexPtr->linePtr->segPtr;
- offset >= (TkSizeT)segPtr->size;
+ offset >= segPtr->size;
offset -= segPtr->size, segPtr = segPtr->nextPtr) {
/* Empty loop body. */
}
@@ -1049,7 +1049,7 @@ TkTextPrintIndex(
linePtr = TkBTreeNextLine(NULL, linePtr);
segPtr = linePtr->segPtr;
}
- if (numBytes <= segPtr->size) {
+ if (numBytes <= (int)segPtr->size) {
break;
}
if (segPtr->typePtr == &tkTextCharType) {
@@ -1597,7 +1597,7 @@ TkTextIndexForwChars(
charCount--;
}
} else if (type & COUNT_INDICES) {
- if (charCount + byteOffset < (TkSizeT)segPtr->size) {
+ if (charCount + byteOffset < segPtr->size) {
dstPtr->byteIndex += charCount;
goto forwardCharDone;
}
@@ -2056,7 +2056,7 @@ TkTextIndexBackChars(
linePtr = TkBTreeNextLine(NULL, linePtr);
segPtr = linePtr->segPtr;
}
- if (segSize <= segPtr->size) {
+ if (segSize <= (int)segPtr->size) {
break;
}
segSize -= segPtr->size;
@@ -2324,7 +2324,7 @@ StartEnd(
}
offset += chSize;
indexPtr->byteIndex += chSize;
- if (offset >= (TkSizeT)segPtr->size) {
+ if (offset >= segPtr->size) {
segPtr = TkTextIndexToSeg(indexPtr, &offset);
}
}
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index d0b6a6c..b046076 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -1063,7 +1063,7 @@ EmbWinCheckProc(
Tcl_Panic("EmbWinCheckProc: embedded window is last segment in line");
}
if (ewPtr->size != 1) {
- Tcl_Panic("EmbWinCheckProc: embedded window has size %d", ewPtr->size);
+ Tcl_Panic("EmbWinCheckProc: embedded window has size %d", (int)ewPtr->size);
}
}
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index 95c1a9a..6cd8131 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -84,8 +84,8 @@ typedef struct {
* Internal state:
*/
char *string; /* Storage for string (malloced) */
- int numBytes; /* Length of string in bytes. */
- int numChars; /* Length of string in characters. */
+ TkSizeT numBytes; /* Length of string in bytes. */
+ TkSizeT numChars; /* Length of string in characters. */
int insertPos; /* Insert index */
int selectFirst; /* Index of start of selection, or -1 */
@@ -734,7 +734,7 @@ static void
EntryStoreValue(Entry *entryPtr, const char *value)
{
size_t numBytes = strlen(value);
- int numChars = Tcl_NumUtfChars(value, numBytes);
+ TkSizeT numChars = Tcl_NumUtfChars(value, numBytes);
if (entryPtr->core.flags & VALIDATING)
entryPtr->core.flags |= VALIDATION_SET_VALUE;
@@ -886,7 +886,7 @@ DeleteChars(
if (index < 0) {
index = 0;
}
- if (count > entryPtr->entry.numChars - index) {
+ if (count + index > (int)entryPtr->entry.numChars) {
count = entryPtr->entry.numChars - index;
}
if (count <= 0) {
@@ -1373,8 +1373,8 @@ EntryIndex(
const char *string;
if (TCL_OK == TkGetIntForIndex(indexObj, entryPtr->entry.numChars - 1, 1, &idx)) {
- if (idx + 1 > (TkSizeT)entryPtr->entry.numChars + 1) {
- idx = (TkSizeT)entryPtr->entry.numChars;
+ if (idx + 1 > entryPtr->entry.numChars + 1) {
+ idx = entryPtr->entry.numChars;
}
*indexPtr = (int)idx;
return TCL_OK;
@@ -1430,7 +1430,7 @@ EntryIndex(
* last character to be selected, for example.
*/
- if (roundUp && (*indexPtr < entryPtr->entry.numChars)) {
+ if (roundUp && (*indexPtr < (int)entryPtr->entry.numChars)) {
*indexPtr += 1;
}
} else {