summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvas.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-25 15:08:53 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-05-25 15:08:53 (GMT)
commit8e4c7b8f2f43e49559dba9709768e1c737e6b3b1 (patch)
tree9e4d8b272990338f713721e12686c38f1fb34ee6 /generic/tkCanvas.c
parentb3af1ba9a9e88b812152b32edbb39e4ea9d73b06 (diff)
parentb24734f447464d9b41cb0aaaf478615872427a8e (diff)
downloadtk-8e4c7b8f2f43e49559dba9709768e1c737e6b3b1.zip
tk-8e4c7b8f2f43e49559dba9709768e1c737e6b3b1.tar.gz
tk-8e4c7b8f2f43e49559dba9709768e1c737e6b3b1.tar.bz2
Formatting and even more size_t usage.
Diffstat (limited to 'generic/tkCanvas.c')
-rw-r--r--generic/tkCanvas.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 54087e6..288949d 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -52,7 +52,7 @@ typedef struct TagSearch {
int searchOver; /* Non-zero means NextItem should always
* return NULL. */
int type; /* Search type (see #defs below) */
- int id; /* Item id for searches by id */
+ TkSizeT id; /* Item id for searches by id */
const char *string; /* Tag expression string */
int stringIndex; /* Current position in string scan */
int stringLength; /* Length of tag expression string */
@@ -732,8 +732,8 @@ Tk_CanvasObjCmd(
canvasPtr->textInfo.selBorderWidth = 0;
canvasPtr->textInfo.selFgColorPtr = NULL;
canvasPtr->textInfo.selItemPtr = NULL;
- canvasPtr->textInfo.selectFirst = -1;
- canvasPtr->textInfo.selectLast = -1;
+ canvasPtr->textInfo.selectFirst = TCL_INDEX_NONE;
+ canvasPtr->textInfo.selectLast = TCL_INDEX_NONE;
canvasPtr->textInfo.anchorItemPtr = NULL;
canvasPtr->textInfo.selectAnchor = 0;
canvasPtr->textInfo.insertBorder = NULL;
@@ -1306,8 +1306,7 @@ CanvasWidgetCmd(
typePtr = matchPtr;
itemPtr = (Tk_Item *)ckalloc(typePtr->itemSize);
- itemPtr->id = canvasPtr->nextId;
- canvasPtr->nextId++;
+ itemPtr->id = canvasPtr->nextId++;
itemPtr->tagPtr = itemPtr->staticTagSpace;
itemPtr->tagSpace = TK_TAG_SPACE;
itemPtr->numTags = 0;
@@ -1457,7 +1456,7 @@ CanvasWidgetCmd(
tag = Tk_GetUid(Tcl_GetString(objv[2]));
}
FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) {
- for (i = itemPtr->numTags-1; i >= 0; i--) {
+ for (i = (int)itemPtr->numTags-1; i >= 0; i--) {
if (itemPtr->tagPtr[i] == tag) {
/*
@@ -1531,7 +1530,7 @@ CanvasWidgetCmd(
int i;
Tcl_Obj *resultObj = Tcl_NewObj();
- for (i = 0; i < itemPtr->numTags; i++) {
+ for (i = 0; i < (int)itemPtr->numTags; i++) {
Tcl_ListObjAppendElement(NULL, resultObj,
Tcl_NewStringObj(itemPtr->tagPtr[i], -1));
}
@@ -2012,8 +2011,8 @@ CanvasWidgetCmd(
goto done;
}
if (canvasPtr->textInfo.selItemPtr == itemPtr) {
- if (index < (canvasPtr->textInfo.selectFirst
- + canvasPtr->textInfo.selectLast)/2) {
+ if (index < (int)((canvasPtr->textInfo.selectFirst
+ + canvasPtr->textInfo.selectLast)/2)) {
canvasPtr->textInfo.selectAnchor =
canvasPtr->textInfo.selectLast + 1;
} else {
@@ -4223,7 +4222,7 @@ TagSearchEvalExpr(
* set result 1 if tag is found in item's tags
*/
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
+ for (tagPtr = itemPtr->tagPtr, count = (int)itemPtr->numTags;
count > 0; tagPtr++, count--) {
if (*tagPtr == uid) {
result = 1;
@@ -4243,7 +4242,7 @@ TagSearchEvalExpr(
* set result 1 if tag is found in item's tags.
*/
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
+ for (tagPtr = itemPtr->tagPtr, count = (int)itemPtr->numTags;
count > 0; tagPtr++, count--) {
if (*tagPtr == uid) {
result = 1;
@@ -4409,7 +4408,7 @@ TagSearchFirst(
uid = searchPtr->expr->uid;
for (lastPtr = NULL, itemPtr = searchPtr->canvasPtr->firstItemPtr;
itemPtr != NULL; lastPtr=itemPtr, itemPtr=itemPtr->nextPtr) {
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
+ for (tagPtr = itemPtr->tagPtr, count = (int)itemPtr->numTags;
count > 0; tagPtr++, count--) {
if (*tagPtr == uid) {
searchPtr->lastPtr = lastPtr;
@@ -4511,7 +4510,7 @@ TagSearchNext(
uid = searchPtr->expr->uid;
for (; itemPtr != NULL; lastPtr = itemPtr, itemPtr = itemPtr->nextPtr) {
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
+ for (tagPtr = itemPtr->tagPtr, count = (int)itemPtr->numTags;
count > 0; tagPtr++, count--) {
if (*tagPtr == uid) {
searchPtr->lastPtr = lastPtr;
@@ -4581,7 +4580,7 @@ DoItem(
return;
}
- for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags;
+ for (tagPtr = itemPtr->tagPtr, count = (int)itemPtr->numTags;
count > 0; tagPtr++, count--) {
if (tag == *tagPtr) {
return;
@@ -5301,7 +5300,7 @@ PickCurrentItem(
*/
if ((itemPtr == canvasPtr->currentItemPtr) && !buttonDown) {
- for (i = itemPtr->numTags-1; i >= 0; i--) {
+ for (i = (int)itemPtr->numTags-1; i >= 0; i--) {
if (itemPtr->tagPtr[i] == searchUids->currentUid)
/* then */ {
memmove((void *)(itemPtr->tagPtr + i),
@@ -5489,10 +5488,10 @@ CanvasDoEvent(
objectPtr = (void **)ckalloc(numObjects * sizeof(void *));
}
objectPtr[0] = (char *)searchUids->allUid;
- for (i = itemPtr->numTags-1; i >= 0; i--) {
+ for (i = (int)itemPtr->numTags - 1; i >= 0; i--) {
objectPtr[i+1] = (char *)itemPtr->tagPtr[i];
}
- objectPtr[itemPtr->numTags+1] = itemPtr;
+ objectPtr[itemPtr->numTags + 1] = itemPtr;
/*
* Copy uids of matching expressions into object array
@@ -5654,15 +5653,15 @@ CanvasSelectTo(
canvasPtr->textInfo.anchorItemPtr = itemPtr;
canvasPtr->textInfo.selectAnchor = index;
}
- if (canvasPtr->textInfo.selectAnchor <= index) {
+ if (canvasPtr->textInfo.selectAnchor + 1 <= (TkSizeT)index + 1) {
canvasPtr->textInfo.selectFirst = canvasPtr->textInfo.selectAnchor;
canvasPtr->textInfo.selectLast = index;
} else {
canvasPtr->textInfo.selectFirst = index;
canvasPtr->textInfo.selectLast = canvasPtr->textInfo.selectAnchor - 1;
}
- if ((canvasPtr->textInfo.selectFirst != oldFirst)
- || (canvasPtr->textInfo.selectLast != oldLast)
+ if ((canvasPtr->textInfo.selectFirst != (TkSizeT)oldFirst)
+ || (canvasPtr->textInfo.selectLast != (TkSizeT)oldLast)
|| (itemPtr != oldSelPtr)) {
EventuallyRedrawItem(canvasPtr, itemPtr);
}
@@ -5692,10 +5691,10 @@ CanvasSelectTo(
static TkSizeT
CanvasFetchSelection(
ClientData clientData, /* Information about canvas widget. */
- TkSizeT offset, /* Offset within selection of first character
+ TkSizeT offset, /* Offset within selection of first character
* to be returned. */
char *buffer, /* Location in which to place selection. */
- TkSizeT maxBytes) /* Maximum number of bytes to place at buffer,
+ TkSizeT maxBytes) /* Maximum number of bytes to place at buffer,
* not including terminating NULL
* character. */
{