summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkTextBTree.c309
-rw-r--r--generic/tkTextDisp.c28
-rw-r--r--generic/tkTextImage.c82
-rw-r--r--generic/tkTextIndex.c38
-rw-r--r--generic/tkTextMark.c63
-rw-r--r--generic/tkTextTag.c48
-rw-r--r--generic/tkTextWind.c65
7 files changed, 310 insertions, 323 deletions
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c
index 81e31dc..fba26b9 100644
--- a/generic/tkTextBTree.c
+++ b/generic/tkTextBTree.c
@@ -140,9 +140,9 @@ int tkBTreeDebug = 0;
* Macros that determine how much space to allocate for new segments:
*/
-#define CSEG_SIZE(chars) ((unsigned) (Tk_Offset(TkTextSegment, body) \
+#define CSEG_SIZE(chars) ((unsigned)(Tk_Offset(TkTextSegment, body) \
+ 1 + (chars)))
-#define TSEG_SIZE ((unsigned) (Tk_Offset(TkTextSegment, body) \
+#define TSEG_SIZE ((unsigned)(Tk_Offset(TkTextSegment, body) \
+ sizeof(TkTextToggle)))
/*
@@ -261,10 +261,10 @@ TkTextBTree
TkBTreeCreate(
TkSharedText *sharedTextPtr)
{
- register BTree *treePtr;
- register Node *rootPtr;
- register TkTextLine *linePtr, *linePtr2;
- register TkTextSegment *segPtr;
+ BTree *treePtr;
+ Node *rootPtr;
+ TkTextLine *linePtr, *linePtr2;
+ TkTextSegment *segPtr;
/*
* The tree will initially have two empty lines. The second line isn't
@@ -273,9 +273,9 @@ TkBTreeCreate(
* of the tree.
*/
- rootPtr = ckalloc(sizeof(Node));
- linePtr = ckalloc(sizeof(TkTextLine));
- linePtr2 = ckalloc(sizeof(TkTextLine));
+ rootPtr = (Node *)ckalloc(sizeof(Node));
+ linePtr = (TkTextLine *)ckalloc(sizeof(TkTextLine));
+ linePtr2 = (TkTextLine *)ckalloc(sizeof(TkTextLine));
rootPtr->parentPtr = NULL;
rootPtr->nextPtr = NULL;
@@ -296,7 +296,7 @@ TkBTreeCreate(
linePtr->parentPtr = rootPtr;
linePtr->nextPtr = linePtr2;
- segPtr = ckalloc(CSEG_SIZE(1));
+ segPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(1));
linePtr->segPtr = segPtr;
segPtr->typePtr = &tkTextCharType;
segPtr->nextPtr = NULL;
@@ -306,7 +306,7 @@ TkBTreeCreate(
linePtr2->parentPtr = rootPtr;
linePtr2->nextPtr = NULL;
- segPtr = ckalloc(CSEG_SIZE(1));
+ segPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(1));
linePtr2->segPtr = segPtr;
segPtr->typePtr = &tkTextCharType;
segPtr->nextPtr = NULL;
@@ -314,7 +314,7 @@ TkBTreeCreate(
segPtr->body.chars[0] = '\n';
segPtr->body.chars[1] = 0;
- treePtr = ckalloc(sizeof(BTree));
+ treePtr = (BTree *)ckalloc(sizeof(BTree));
treePtr->sharedTextPtr = sharedTextPtr;
treePtr->rootPtr = rootPtr;
treePtr->clients = 0;
@@ -366,7 +366,7 @@ TkBTreeAddClient(
int defaultHeight) /* Default line height for the new client, or
* -1 if no pixel heights are to be kept. */
{
- register BTree *treePtr = (BTree *) tree;
+ BTree *treePtr = (BTree *) tree;
if (treePtr == NULL) {
Tcl_Panic("NULL treePtr in TkBTreeAddClient");
@@ -632,9 +632,9 @@ AdjustStartEndRefs(
i++;
}
treePtr->startEndCount = count;
- treePtr->startEnd = ckrealloc(treePtr->startEnd,
+ treePtr->startEnd = (TkTextLine **)ckrealloc(treePtr->startEnd,
sizeof(TkTextLine *) * count);
- treePtr->startEndRef = ckrealloc(treePtr->startEndRef,
+ treePtr->startEndRef = (TkText **)ckrealloc(treePtr->startEndRef,
sizeof(TkText *) * count);
}
if ((action & TEXT_ADD_REFS)
@@ -650,9 +650,9 @@ AdjustStartEndRefs(
count = treePtr->startEndCount;
- treePtr->startEnd = ckrealloc(treePtr->startEnd,
+ treePtr->startEnd = (TkTextLine **)ckrealloc(treePtr->startEnd,
sizeof(TkTextLine *) * count);
- treePtr->startEndRef = ckrealloc(treePtr->startEndRef,
+ treePtr->startEndRef = (TkText **)ckrealloc(treePtr->startEndRef,
sizeof(TkText *) * count);
if (textPtr->start != NULL) {
@@ -725,7 +725,7 @@ AdjustPixelClient(
loopPtr = loopPtr->nextPtr;
}
} else {
- register TkTextLine *linePtr = nodePtr->children.linePtr;
+ TkTextLine *linePtr = nodePtr->children.linePtr;
while (linePtr != NULL) {
if (!*counting && (linePtr == start)) {
@@ -735,7 +735,7 @@ AdjustPixelClient(
*counting = 0;
}
if (newPixelReferences != treePtr->pixelReferences) {
- linePtr->pixels = ckrealloc(linePtr->pixels,
+ linePtr->pixels = (int *)ckrealloc(linePtr->pixels,
sizeof(int) * 2 * newPixelReferences);
}
@@ -752,7 +752,7 @@ AdjustPixelClient(
}
}
if (newPixelReferences != treePtr->pixelReferences) {
- nodePtr->numPixels = ckrealloc(nodePtr->numPixels,
+ nodePtr->numPixels = (int *)ckrealloc(nodePtr->numPixels,
sizeof(int) * newPixelReferences);
}
nodePtr->numPixels[useReference] = pixelCount;
@@ -802,7 +802,7 @@ RemovePixelClient(
ckfree(nodePtr->numPixels);
nodePtr->numPixels = NULL;
} else {
- nodePtr->numPixels = ckrealloc(nodePtr->numPixels,
+ nodePtr->numPixels = (int *)ckrealloc(nodePtr->numPixels,
sizeof(int) * (treePtr->pixelReferences - 1));
}
if (nodePtr->level != 0) {
@@ -812,7 +812,7 @@ RemovePixelClient(
nodePtr = nodePtr->nextPtr;
}
} else {
- register TkTextLine *linePtr = nodePtr->children.linePtr;
+ TkTextLine *linePtr = nodePtr->children.linePtr;
while (linePtr != NULL) {
if (overwriteWithLast != -1) {
linePtr->pixels[2*overwriteWithLast] =
@@ -823,7 +823,7 @@ RemovePixelClient(
if (treePtr->pixelReferences == 1) {
linePtr->pixels = NULL;
} else {
- linePtr->pixels = ckrealloc(linePtr->pixels,
+ linePtr->pixels = (int *)ckrealloc(linePtr->pixels,
sizeof(int) * 2 * (treePtr->pixelReferences-1));
}
linePtr = linePtr->nextPtr;
@@ -850,7 +850,7 @@ RemovePixelClient(
static void
DestroyNode(
- register Node *nodePtr) /* Destroy from this node downwards. */
+ Node *nodePtr) /* Destroy from this node downwards. */
{
if (nodePtr->level == 0) {
TkTextLine *linePtr;
@@ -868,7 +868,7 @@ DestroyNode(
ckfree(linePtr);
}
} else {
- register Node *childPtr;
+ Node *childPtr;
while (nodePtr->children.nodePtr != NULL) {
childPtr = nodePtr->children.nodePtr;
@@ -900,10 +900,10 @@ DestroyNode(
static void
DeleteSummaries(
- register Summary *summaryPtr)
+ Summary *summaryPtr)
/* First in list of node's tag summaries. */
{
- register Summary *nextPtr;
+ Summary *nextPtr;
while (summaryPtr != NULL) {
nextPtr = summaryPtr->nextPtr;
@@ -932,7 +932,7 @@ DeleteSummaries(
int
TkBTreeAdjustPixelHeight(
const TkText *textPtr, /* Client of the B-tree. */
- register TkTextLine *linePtr,
+ TkTextLine *linePtr,
/* The logical line to update. */
int newPixelHeight, /* The line's known height in pixels. */
int mergedLogicalLines) /* The number of extra logical lines which
@@ -942,7 +942,7 @@ TkBTreeAdjustPixelHeight(
* height associated with the given
* linePtr. */
{
- register Node *nodePtr;
+ Node *nodePtr;
int changeToPixelCount; /* Counts change to total number of pixels in
* file. */
int pixelReference = textPtr->pixelReference;
@@ -1001,7 +1001,7 @@ TkBTreeAdjustPixelHeight(
void
TkBTreeInsertChars(
TkTextBTree tree, /* Tree to insert into. */
- register TkTextIndex *indexPtr,
+ TkTextIndex *indexPtr,
/* Indicates where to insert text. When the
* function returns, this index is no longer
* valid because of changes to the segment
@@ -1009,8 +1009,8 @@ TkBTreeInsertChars(
const char *string) /* Pointer to bytes to insert (may contain
* newlines, must be null-terminated). */
{
- register Node *nodePtr;
- register TkTextSegment *prevPtr;
+ Node *nodePtr;
+ TkTextSegment *prevPtr;
/* The segment just before the first new
* segment (NULL means new segment is at
* beginning of line). */
@@ -1019,10 +1019,10 @@ TkBTreeInsertChars(
* insert at beginning of line. */
TkTextLine *linePtr; /* Current line (new segments are added to
* this line). */
- register TkTextSegment *segPtr;
+ TkTextSegment *segPtr;
TkTextLine *newLinePtr;
int chunkSize; /* # characters in current chunk. */
- register const char *eol; /* Pointer to character just after last one in
+ const char *eol; /* Pointer to character just after last one in
* current chunk. */
int changeToLineCount; /* Counts change to total number of lines in
* file. */
@@ -1044,7 +1044,7 @@ TkBTreeInsertChars(
changeToLineCount = 0;
if (treePtr->pixelReferences > PIXEL_CLIENTS) {
- changeToPixelCount = ckalloc(sizeof(int) * treePtr->pixelReferences);
+ changeToPixelCount = (int *)ckalloc(sizeof(int) * treePtr->pixelReferences);
} else {
changeToPixelCount = pixels;
}
@@ -1060,7 +1060,7 @@ TkBTreeInsertChars(
}
}
chunkSize = eol-string;
- segPtr = ckalloc(CSEG_SIZE(chunkSize));
+ segPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(chunkSize));
segPtr->typePtr = &tkTextCharType;
if (curPtr == NULL) {
segPtr->nextPtr = linePtr->segPtr;
@@ -1070,7 +1070,7 @@ TkBTreeInsertChars(
curPtr->nextPtr = segPtr;
}
segPtr->size = chunkSize;
- memcpy(segPtr->body.chars, string, (size_t) chunkSize);
+ memcpy(segPtr->body.chars, string, (size_t)chunkSize);
segPtr->body.chars[chunkSize] = 0;
if (eol[-1] != '\n') {
@@ -1082,8 +1082,8 @@ TkBTreeInsertChars(
* the remainder of the old line to it.
*/
- newLinePtr = ckalloc(sizeof(TkTextLine));
- newLinePtr->pixels =
+ newLinePtr = (TkTextLine *)ckalloc(sizeof(TkTextLine));
+ newLinePtr->pixels = (int *)
ckalloc(sizeof(int) * 2 * treePtr->pixelReferences);
newLinePtr->parentPtr = linePtr->parentPtr;
@@ -1312,10 +1312,10 @@ CleanupLine(
void
TkBTreeDeleteIndexRange(
TkTextBTree tree, /* Tree to delete from. */
- register TkTextIndex *index1Ptr,
+ TkTextIndex *index1Ptr,
/* Indicates first character that is to be
* deleted. */
- register TkTextIndex *index2Ptr)
+ TkTextIndex *index2Ptr)
/* Indicates character just after the last one
* that is to be deleted. */
{
@@ -1596,8 +1596,8 @@ TkBTreeFindLine(
int line) /* Index of desired line. */
{
BTree *treePtr = (BTree *) tree;
- register Node *nodePtr;
- register TkTextLine *linePtr;
+ Node *nodePtr;
+ TkTextLine *linePtr;
if (treePtr == NULL) {
treePtr = (BTree *) textPtr->sharedTextPtr->tree;
@@ -1686,8 +1686,8 @@ TkBTreeFindPixelLine(
int *pixelOffset) /* Used to return offset. */
{
BTree *treePtr = (BTree *) tree;
- register Node *nodePtr;
- register TkTextLine *linePtr;
+ Node *nodePtr;
+ TkTextLine *linePtr;
int pixelReference = textPtr->pixelReference;
nodePtr = treePtr->rootPtr;
@@ -1755,10 +1755,10 @@ TkBTreeFindPixelLine(
TkTextLine *
TkBTreeNextLine(
const TkText *textPtr, /* Next line in the context of this client. */
- register TkTextLine *linePtr)
+ TkTextLine *linePtr)
/* Pointer to existing line in B-tree. */
{
- register Node *nodePtr;
+ Node *nodePtr;
if (linePtr->nextPtr != NULL) {
if (textPtr != NULL && (linePtr == textPtr->end)) {
@@ -1811,12 +1811,12 @@ TkBTreeNextLine(
TkTextLine *
TkBTreePreviousLine(
TkText *textPtr, /* Relative to this client of the B-tree. */
- register TkTextLine *linePtr)
+ TkTextLine *linePtr)
/* Pointer to existing line in B-tree. */
{
- register Node *nodePtr;
- register Node *node2Ptr;
- register TkTextLine *prevPtr;
+ Node *nodePtr;
+ Node *node2Ptr;
+ TkTextLine *prevPtr;
if (textPtr != NULL && textPtr->start == linePtr) {
return NULL;
@@ -1895,8 +1895,8 @@ TkBTreePixelsTo(
const TkText *textPtr, /* Relative to this client of the B-tree. */
TkTextLine *linePtr) /* Pointer to existing line in B-tree. */
{
- register TkTextLine *linePtr2;
- register Node *nodePtr, *parentPtr;
+ TkTextLine *linePtr2;
+ Node *nodePtr, *parentPtr;
int index;
int pixelReference = textPtr->pixelReference;
@@ -1921,7 +1921,7 @@ TkBTreePixelsTo(
for (parentPtr = nodePtr->parentPtr ; parentPtr != NULL;
nodePtr = parentPtr, parentPtr = parentPtr->parentPtr) {
- register Node *nodePtr2;
+ Node *nodePtr2;
for (nodePtr2 = parentPtr->children.nodePtr; nodePtr2 != nodePtr;
nodePtr2 = nodePtr2->nextPtr) {
@@ -1957,8 +1957,8 @@ TkBTreeLinesTo(
const TkText *textPtr, /* Relative to this client of the B-tree. */
TkTextLine *linePtr) /* Pointer to existing line in B-tree. */
{
- register TkTextLine *linePtr2;
- register Node *nodePtr, *parentPtr, *nodePtr2;
+ TkTextLine *linePtr2;
+ Node *nodePtr, *parentPtr, *nodePtr2;
int index;
/*
@@ -2037,7 +2037,6 @@ TkBTreeLinesTo(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
void
TkBTreeLinkSegment(
TkTextSegment *segPtr, /* Pointer to new segment to be added to
@@ -2046,7 +2045,7 @@ TkBTreeLinkSegment(
TkTextIndex *indexPtr) /* Where to add segment: it gets linked in
* just before the segment indicated here. */
{
- register TkTextSegment *prevPtr;
+ TkTextSegment *prevPtr;
prevPtr = SplitSeg(indexPtr);
if (prevPtr == NULL) {
@@ -2080,13 +2079,12 @@ TkBTreeLinkSegment(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
void
TkBTreeUnlinkSegment(
TkTextSegment *segPtr, /* Segment to be unlinked. */
TkTextLine *linePtr) /* Line that currently contains segment. */
{
- register TkTextSegment *prevPtr;
+ TkTextSegment *prevPtr;
if (linePtr->segPtr == segPtr) {
linePtr->segPtr = segPtr->nextPtr;
@@ -2135,9 +2133,9 @@ TkBTreeUnlinkSegment(
int
TkBTreeTag(
- register TkTextIndex *index1Ptr,
+ TkTextIndex *index1Ptr,
/* Indicates first character in range. */
- register TkTextIndex *index2Ptr,
+ TkTextIndex *index2Ptr,
/* Indicates character just after the last one
* in range. */
TkTextTag *tagPtr, /* Tag to add or remove. */
@@ -2157,7 +2155,7 @@ TkBTreeTag(
oldState = TkBTreeCharTagged(index1Ptr, tagPtr);
if ((add != 0) ^ oldState) {
- segPtr = ckalloc(TSEG_SIZE);
+ segPtr = (TkTextSegment *)ckalloc(TSEG_SIZE);
segPtr->typePtr = (add) ? &tkTextToggleOnType : &tkTextToggleOffType;
prevPtr = SplitSeg(index1Ptr);
if (prevPtr == NULL) {
@@ -2228,7 +2226,7 @@ TkBTreeTag(
}
}
if ((add != 0) ^ oldState) {
- segPtr = ckalloc(TSEG_SIZE);
+ segPtr = (TkTextSegment *)ckalloc(TSEG_SIZE);
segPtr->typePtr = (add) ? &tkTextToggleOffType : &tkTextToggleOnType;
prevPtr = SplitSeg(index2Ptr);
if (prevPtr == NULL) {
@@ -2285,14 +2283,14 @@ TkBTreeTag(
static void
ChangeNodeToggleCount(
- register Node *nodePtr, /* Node whose toggle count for a tag must be
+ Node *nodePtr, /* Node whose toggle count for a tag must be
* changed. */
TkTextTag *tagPtr, /* Information about tag. */
int delta) /* Amount to add to current toggle count for
* tag (may be negative). */
{
- register Summary *summaryPtr, *prevPtr;
- register Node *node2Ptr;
+ Summary *summaryPtr, *prevPtr;
+ Node *node2Ptr;
int rootLevel; /* Level of original tag root. */
tagPtr->toggleCount += delta;
@@ -2372,7 +2370,7 @@ ChangeNodeToggleCount(
Node *rootNodePtr = tagPtr->tagRootPtr;
- summaryPtr = ckalloc(sizeof(Summary));
+ summaryPtr = (Summary *)ckalloc(sizeof(Summary));
summaryPtr->tagPtr = tagPtr;
summaryPtr->toggleCount = tagPtr->toggleCount - delta;
summaryPtr->nextPtr = rootNodePtr->summaryPtr;
@@ -2381,7 +2379,7 @@ ChangeNodeToggleCount(
rootLevel = rootNodePtr->level;
tagPtr->tagRootPtr = rootNodePtr;
}
- summaryPtr = ckalloc(sizeof(Summary));
+ summaryPtr = (Summary *)ckalloc(sizeof(Summary));
summaryPtr->tagPtr = tagPtr;
summaryPtr->toggleCount = delta;
summaryPtr->nextPtr = nodePtr->summaryPtr;
@@ -2471,10 +2469,10 @@ FindTagStart(
TkTextTag *tagPtr, /* Tag to search for. */
TkTextIndex *indexPtr) /* Return - index information. */
{
- register Node *nodePtr;
- register TkTextLine *linePtr;
- register TkTextSegment *segPtr;
- register Summary *summaryPtr;
+ Node *nodePtr;
+ TkTextLine *linePtr;
+ TkTextSegment *segPtr;
+ Summary *summaryPtr;
int offset;
nodePtr = tagPtr->tagRootPtr;
@@ -2556,10 +2554,10 @@ FindTagEnd(
TkTextTag *tagPtr, /* Tag to search for. */
TkTextIndex *indexPtr) /* Return - index information. */
{
- register Node *nodePtr, *lastNodePtr;
- register TkTextLine *linePtr ,*lastLinePtr;
- register TkTextSegment *segPtr, *lastSegPtr, *last2SegPtr;
- register Summary *summaryPtr;
+ Node *nodePtr, *lastNodePtr;
+ TkTextLine *linePtr ,*lastLinePtr;
+ TkTextSegment *segPtr, *lastSegPtr, *last2SegPtr;
+ Summary *summaryPtr;
int lastoffset, lastoffset2, offset;
nodePtr = tagPtr->tagRootPtr;
@@ -2652,7 +2650,7 @@ TkBTreeStartSearch(
* position *will* be returned. */
TkTextTag *tagPtr, /* Tag to search for. NULL means search for
* any tag. */
- register TkTextSearch *searchPtr)
+ TkTextSearch *searchPtr)
/* Where to store information about search's
* progress. */
{
@@ -2748,7 +2746,7 @@ TkBTreeStartSearchBack(
* position *will* be returned. */
TkTextTag *tagPtr, /* Tag to search for. NULL means search for
* any tag. */
- register TkTextSearch *searchPtr)
+ TkTextSearch *searchPtr)
/* Where to store information about search's
* progress. */
{
@@ -2849,14 +2847,14 @@ TkBTreeStartSearchBack(
int
TkBTreeNextTag(
- register TkTextSearch *searchPtr)
+ TkTextSearch *searchPtr)
/* Information about search in progress; must
* have been set up by call to
* TkBTreeStartSearch. */
{
- register TkTextSegment *segPtr;
- register Node *nodePtr;
- register Summary *summaryPtr;
+ TkTextSegment *segPtr;
+ Node *nodePtr;
+ Summary *summaryPtr;
if (searchPtr->linesLeft <= 0) {
goto searchOver;
@@ -3014,15 +3012,15 @@ TkBTreeNextTag(
int
TkBTreePrevTag(
- register TkTextSearch *searchPtr)
+ TkTextSearch *searchPtr)
/* Information about search in progress; must
* have been set up by call to
* TkBTreeStartSearch. */
{
- register TkTextSegment *segPtr, *prevPtr;
- register TkTextLine *linePtr, *prevLinePtr;
- register Node *nodePtr, *node2Ptr, *prevNodePtr;
- register Summary *summaryPtr;
+ TkTextSegment *segPtr, *prevPtr;
+ TkTextLine *linePtr, *prevLinePtr;
+ Node *nodePtr, *node2Ptr, *prevNodePtr;
+ Summary *summaryPtr;
int byteIndex, linesSkipped;
int pastLast; /* Saw last marker during scan. */
@@ -3232,9 +3230,9 @@ TkBTreeCharTagged(
* check for a tag. */
TkTextTag *tagPtr) /* Tag of interest. */
{
- register Node *nodePtr;
- register TkTextLine *siblingLinePtr;
- register TkTextSegment *segPtr;
+ Node *nodePtr;
+ TkTextLine *siblingLinePtr;
+ TkTextSegment *segPtr;
TkTextSegment *toggleSegPtr;
int toggles, index;
@@ -3288,8 +3286,8 @@ TkBTreeCharTagged(
toggles = 0;
for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL;
nodePtr = nodePtr->parentPtr) {
- register Node *siblingPtr;
- register Summary *summaryPtr;
+ Node *siblingPtr;
+ Summary *summaryPtr;
for (siblingPtr = nodePtr->parentPtr->children.nodePtr;
siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) {
@@ -3336,7 +3334,6 @@ TkBTreeCharTagged(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
TkTextTag **
TkBTreeGetTags(
const TkTextIndex *indexPtr,/* Indicates a particular position in the
@@ -3347,9 +3344,9 @@ TkBTreeGetTags(
int *numTagsPtr) /* Store number of tags found at this
* location. */
{
- register Node *nodePtr;
- register TkTextLine *siblingLinePtr;
- register TkTextSegment *segPtr;
+ Node *nodePtr;
+ TkTextLine *siblingLinePtr;
+ TkTextSegment *segPtr;
TkTextLine *linePtr;
int src, dst, index;
TagInfo tagInfo;
@@ -3357,8 +3354,8 @@ TkBTreeGetTags(
tagInfo.numTags = 0;
tagInfo.arraySize = NUM_TAG_INFOS;
- tagInfo.tagPtrs = ckalloc(NUM_TAG_INFOS * sizeof(TkTextTag *));
- tagInfo.counts = ckalloc(NUM_TAG_INFOS * sizeof(int));
+ tagInfo.tagPtrs = (TkTextTag **)ckalloc(NUM_TAG_INFOS * sizeof(TkTextTag *));
+ tagInfo.counts = (int *)ckalloc(NUM_TAG_INFOS * sizeof(int));
/*
* Record tag toggles within the line of indexPtr but preceding indexPtr.
@@ -3410,8 +3407,8 @@ TkBTreeGetTags(
for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL;
nodePtr = nodePtr->parentPtr) {
- register Node *siblingPtr;
- register Summary *summaryPtr;
+ Node *siblingPtr;
+ Summary *summaryPtr;
for (siblingPtr = nodePtr->parentPtr->children.nodePtr;
siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) {
@@ -3482,7 +3479,6 @@ TkBTreeGetTags(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
TkTextIsElided(
const TkText *textPtr, /* Overall information about text widget. */
@@ -3492,17 +3488,17 @@ TkTextIsElided(
* indexPtr's elide state will be stored and
* returned. */
{
- register Node *nodePtr;
- register TkTextLine *siblingLinePtr;
- register TkTextSegment *segPtr;
- register TkTextTag *tagPtr = NULL;
- register int i, index;
- register TkTextElideInfo *infoPtr;
+ Node *nodePtr;
+ TkTextLine *siblingLinePtr;
+ TkTextSegment *segPtr;
+ TkTextTag *tagPtr = NULL;
+ int i, index;
+ TkTextElideInfo *infoPtr;
TkTextLine *linePtr;
int elide;
if (elideInfo == NULL) {
- infoPtr = ckalloc(sizeof(TkTextElideInfo));
+ infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo));
} else {
infoPtr = elideInfo;
}
@@ -3517,8 +3513,8 @@ TkTextIsElided(
*/
if (LOTSA_TAGS < infoPtr->numTags) {
- infoPtr->tagCnts = ckalloc(sizeof(int) * infoPtr->numTags);
- infoPtr->tagPtrs = ckalloc(sizeof(TkTextTag *) * infoPtr->numTags);
+ infoPtr->tagCnts = (int *)ckalloc(sizeof(int) * infoPtr->numTags);
+ infoPtr->tagPtrs = (TkTextTag **)ckalloc(sizeof(TkTextTag *) * infoPtr->numTags);
}
for (i=0; i<infoPtr->numTags; i++) {
@@ -3591,8 +3587,8 @@ TkTextIsElided(
for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL;
nodePtr = nodePtr->parentPtr) {
- register Node *siblingPtr;
- register Summary *summaryPtr;
+ Node *siblingPtr;
+ Summary *summaryPtr;
for (siblingPtr = nodePtr->parentPtr->children.nodePtr;
siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) {
@@ -3697,7 +3693,7 @@ IncCount(
TagInfo *tagInfoPtr) /* Holds cumulative information about tags;
* increment count here. */
{
- register TkTextTag **tagPtrPtr;
+ TkTextTag **tagPtrPtr;
int count;
for (tagPtrPtr = tagInfoPtr->tagPtrs, count = tagInfoPtr->numTags;
@@ -3718,12 +3714,12 @@ IncCount(
int *newCounts, newSize;
newSize = 2 * tagInfoPtr->arraySize;
- newTags = ckalloc(newSize * sizeof(TkTextTag *));
+ newTags = (TkTextTag **)ckalloc(newSize * sizeof(TkTextTag *));
memcpy(newTags, tagInfoPtr->tagPtrs,
tagInfoPtr->arraySize * sizeof(TkTextTag *));
ckfree(tagInfoPtr->tagPtrs);
tagInfoPtr->tagPtrs = newTags;
- newCounts = ckalloc(newSize * sizeof(int));
+ newCounts = (int *)ckalloc(newSize * sizeof(int));
memcpy(newCounts, tagInfoPtr->counts,
tagInfoPtr->arraySize * sizeof(int));
ckfree(tagInfoPtr->counts);
@@ -3759,11 +3755,11 @@ TkBTreeCheck(
TkTextBTree tree) /* Tree to check. */
{
BTree *treePtr = (BTree *) tree;
- register Summary *summaryPtr;
- register Node *nodePtr;
- register TkTextLine *linePtr;
- register TkTextSegment *segPtr;
- register TkTextTag *tagPtr;
+ Summary *summaryPtr;
+ Node *nodePtr;
+ TkTextLine *linePtr;
+ TkTextSegment *segPtr;
+ TkTextTag *tagPtr;
Tcl_HashEntry *entryPtr;
Tcl_HashSearch search;
int count;
@@ -3774,7 +3770,7 @@ TkBTreeCheck(
for (entryPtr=Tcl_FirstHashEntry(&treePtr->sharedTextPtr->tagTable,&search);
entryPtr != NULL ; entryPtr = Tcl_NextHashEntry(&search)) {
- tagPtr = Tcl_GetHashValue(entryPtr);
+ tagPtr = (TkTextTag *)Tcl_GetHashValue(entryPtr);
nodePtr = tagPtr->tagRootPtr;
if (nodePtr == NULL) {
if (tagPtr->toggleCount != 0) {
@@ -3898,14 +3894,14 @@ TkBTreeCheck(
static void
CheckNodeConsistency(
- register Node *nodePtr, /* Node whose subtree should be checked. */
+ Node *nodePtr, /* Node whose subtree should be checked. */
int references) /* Number of referring widgets which have
* pixel counts. */
{
- register Node *childNodePtr;
- register Summary *summaryPtr, *summaryPtr2;
- register TkTextLine *linePtr;
- register TkTextSegment *segPtr;
+ Node *childNodePtr;
+ Summary *summaryPtr, *summaryPtr2;
+ TkTextLine *linePtr;
+ TkTextSegment *segPtr;
int numChildren, numLines, toggleCount, minChildren, i;
int *numPixels;
int pixels[PIXEL_CLIENTS];
@@ -3926,7 +3922,7 @@ CheckNodeConsistency(
numChildren = 0;
numLines = 0;
if (references > PIXEL_CLIENTS) {
- numPixels = ckalloc(sizeof(int) * references);
+ numPixels = (int *)ckalloc(sizeof(int) * references);
} else {
numPixels = pixels;
}
@@ -4087,7 +4083,7 @@ CheckNodeConsistency(
static void
Rebalance(
BTree *treePtr, /* Tree that is being rebalanced. */
- register Node *nodePtr) /* Node that may be out of balance. */
+ Node *nodePtr) /* Node that may be out of balance. */
{
/*
* Loop over the entire ancestral chain of the node, working up through
@@ -4095,8 +4091,8 @@ Rebalance(
*/
for ( ; nodePtr != NULL; nodePtr = nodePtr->parentPtr) {
- register Node *newPtr, *childPtr;
- register TkTextLine *linePtr;
+ Node *newPtr, *childPtr;
+ TkTextLine *linePtr;
int i;
/*
@@ -4114,7 +4110,7 @@ Rebalance(
*/
if (nodePtr->parentPtr == NULL) {
- newPtr = ckalloc(sizeof(Node));
+ newPtr = (Node *)ckalloc(sizeof(Node));
newPtr->parentPtr = NULL;
newPtr->nextPtr = NULL;
newPtr->summaryPtr = NULL;
@@ -4122,7 +4118,7 @@ Rebalance(
newPtr->children.nodePtr = nodePtr;
newPtr->numChildren = 1;
newPtr->numLines = nodePtr->numLines;
- newPtr->numPixels =
+ newPtr->numPixels = (int *)
ckalloc(sizeof(int) * treePtr->pixelReferences);
for (i=0; i<treePtr->pixelReferences; i++) {
newPtr->numPixels[i] = nodePtr->numPixels[i];
@@ -4130,8 +4126,8 @@ Rebalance(
RecomputeNodeCounts(treePtr, newPtr);
treePtr->rootPtr = newPtr;
}
- newPtr = ckalloc(sizeof(Node));
- newPtr->numPixels =
+ newPtr = (Node *)ckalloc(sizeof(Node));
+ newPtr->numPixels = (int *)
ckalloc(sizeof(int) * treePtr->pixelReferences);
for (i=0; i<treePtr->pixelReferences; i++) {
newPtr->numPixels[i] = 0;
@@ -4170,7 +4166,7 @@ Rebalance(
}
while (nodePtr->numChildren < MIN_CHILDREN) {
- register Node *otherPtr;
+ Node *otherPtr;
Node *halfwayNodePtr = NULL; /* Initialization needed only */
TkTextLine *halfwayLinePtr = NULL; /* to prevent cc warnings. */
int totalChildren, firstChildren, i;
@@ -4234,7 +4230,7 @@ Rebalance(
otherPtr->children.linePtr = NULL;
}
if (nodePtr->level == 0) {
- register TkTextLine *linePtr;
+ TkTextLine *linePtr;
for (linePtr = nodePtr->children.linePtr, i = 1;
linePtr->nextPtr != NULL;
@@ -4250,7 +4246,7 @@ Rebalance(
i++;
}
} else {
- register Node *childPtr;
+ Node *childPtr;
for (childPtr = nodePtr->children.nodePtr, i = 1;
childPtr->nextPtr != NULL;
@@ -4326,14 +4322,14 @@ Rebalance(
static void
RecomputeNodeCounts(
- register BTree *treePtr, /* The whole B-tree. */
- register Node *nodePtr) /* Node whose tag summary information must be
+ BTree *treePtr, /* The whole B-tree. */
+ Node *nodePtr) /* Node whose tag summary information must be
* recomputed. */
{
- register Summary *summaryPtr, *summaryPtr2;
- register Node *childPtr;
- register TkTextLine *linePtr;
- register TkTextSegment *segPtr;
+ Summary *summaryPtr, *summaryPtr2;
+ Node *childPtr;
+ TkTextLine *linePtr;
+ TkTextSegment *segPtr;
TkTextTag *tagPtr;
int ref;
@@ -4377,7 +4373,7 @@ RecomputeNodeCounts(
for (summaryPtr = nodePtr->summaryPtr; ;
summaryPtr = summaryPtr->nextPtr) {
if (summaryPtr == NULL) {
- summaryPtr = ckalloc(sizeof(Summary));
+ summaryPtr = (Summary *)ckalloc(sizeof(Summary));
summaryPtr->tagPtr = tagPtr;
summaryPtr->toggleCount = 1;
summaryPtr->nextPtr = nodePtr->summaryPtr;
@@ -4405,7 +4401,7 @@ RecomputeNodeCounts(
for (summaryPtr = nodePtr->summaryPtr; ;
summaryPtr = summaryPtr->nextPtr) {
if (summaryPtr == NULL) {
- summaryPtr = ckalloc(sizeof(Summary));
+ summaryPtr = (Summary *)ckalloc(sizeof(Summary));
summaryPtr->tagPtr = summaryPtr2->tagPtr;
summaryPtr->toggleCount = summaryPtr2->toggleCount;
summaryPtr->nextPtr = nodePtr->summaryPtr;
@@ -4558,12 +4554,12 @@ CharSplitProc(
{
TkTextSegment *newPtr1, *newPtr2;
- newPtr1 = ckalloc(CSEG_SIZE(index));
- newPtr2 = ckalloc(CSEG_SIZE(segPtr->size - index));
+ newPtr1 = (TkTextSegment *)ckalloc(CSEG_SIZE(index));
+ newPtr2 = (TkTextSegment *)ckalloc(CSEG_SIZE(segPtr->size - index));
newPtr1->typePtr = &tkTextCharType;
newPtr1->nextPtr = newPtr2;
newPtr1->size = index;
- memcpy(newPtr1->body.chars, segPtr->body.chars, (size_t) index);
+ memcpy(newPtr1->body.chars, segPtr->body.chars, (size_t)index);
newPtr1->body.chars[index] = 0;
newPtr2->typePtr = &tkTextCharType;
newPtr2->nextPtr = segPtr->nextPtr;
@@ -4592,12 +4588,11 @@ CharSplitProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static TkTextSegment *
CharCleanupProc(
TkTextSegment *segPtr, /* Pointer to first of two adjacent segments
* to join. */
- TkTextLine *linePtr) /* Line containing segments (not used). */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segments (not used). */
{
TkTextSegment *segPtr2, *newPtr;
@@ -4605,7 +4600,7 @@ CharCleanupProc(
if ((segPtr2 == NULL) || (segPtr2->typePtr != &tkTextCharType)) {
return segPtr;
}
- newPtr = ckalloc(CSEG_SIZE(segPtr->size + segPtr2->size));
+ newPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(segPtr->size + segPtr2->size));
newPtr->typePtr = &tkTextCharType;
newPtr->nextPtr = segPtr2->nextPtr;
newPtr->size = segPtr->size + segPtr2->size;
@@ -4633,12 +4628,11 @@ CharCleanupProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
CharDeleteProc(
TkTextSegment *segPtr, /* Segment to delete. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
@@ -4663,7 +4657,6 @@ CharDeleteProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static void
CharCheckProc(
TkTextSegment *segPtr, /* Segment to check. */
@@ -4679,7 +4672,7 @@ CharCheckProc(
if (segPtr->size <= 0) {
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) {
@@ -4858,7 +4851,7 @@ ToggleCheckProc(
TkTextSegment *segPtr, /* Segment to check. */
TkTextLine *linePtr) /* Line containing segment. */
{
- register Summary *summaryPtr;
+ Summary *summaryPtr;
int needSummary;
if (segPtr->size != 0) {
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 0eae4a9..a02544d 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -1072,8 +1072,7 @@ FreeStyle(
TextStyle *stylePtr)
/* Information about style to free. */
{
- stylePtr->refCount--;
- if (stylePtr->refCount == 0) {
+ if (stylePtr->refCount-- <= 1) {
if (stylePtr->bgGC != NULL) {
Tk_FreeGC(textPtr->display, stylePtr->bgGC);
}
@@ -3164,8 +3163,8 @@ GenerateWidgetViewSyncEvent(
} else {
textPtr->dInfoPtr->flags |= OUT_OF_SYNC;
}
- TkSendVirtualEvent(textPtr->tkwin, "WidgetViewSync",
- Tcl_NewBooleanObj(NewSyncState));
+ TkSendVirtualEvent(textPtr->tkwin, "WidgetViewSync",
+ Tcl_NewBooleanObj(NewSyncState));
}
}
@@ -8811,24 +8810,25 @@ TextGetScrollInfoObj(
}
switch ((enum viewUnits) index) {
case VIEW_SCROLL_PAGES:
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
- return TKTEXT_SCROLL_ERROR;
+ if (Tcl_GetIntFromObj(interp, objv[3], intPtr) == TCL_OK) {
+ return TKTEXT_SCROLL_PAGES;
}
- return TKTEXT_SCROLL_PAGES;
+ break;
case VIEW_SCROLL_PIXELS:
if (Tk_GetPixelsFromObj(interp, textPtr->tkwin, objv[3],
- intPtr) != TCL_OK) {
- return TKTEXT_SCROLL_ERROR;
+ intPtr) == TCL_OK) {
+ return TKTEXT_SCROLL_PIXELS;
}
- return TKTEXT_SCROLL_PIXELS;
+ break;
case VIEW_SCROLL_UNITS:
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
- return TKTEXT_SCROLL_ERROR;
+ if (Tcl_GetIntFromObj(interp, objv[3], intPtr) == TCL_OK) {
+ return TKTEXT_SCROLL_UNITS;
}
- return TKTEXT_SCROLL_UNITS;
+ break;
+ default:
+ Tcl_Panic("unexpected switch fallthrough");
}
}
- Tcl_Panic("unexpected switch fallthrough");
return TKTEXT_SCROLL_ERROR;
}
diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c
index 41dd448..bc0da0a 100644
--- a/generic/tkTextImage.c
+++ b/generic/tkTextImage.c
@@ -18,7 +18,7 @@
*/
#define EI_SEG_SIZE \
- ((unsigned) (Tk_Offset(TkTextSegment, body) + sizeof(TkTextEmbImage)))
+ ((unsigned)(Tk_Offset(TkTextSegment, body) + sizeof(TkTextEmbImage)))
/*
* Prototypes for functions defined in this file:
@@ -117,7 +117,7 @@ static const Tk_OptionSpec optionSpecs[] = {
int
TkTextImageCmd(
- register TkText *textPtr, /* Information about text widget. */
+ TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
@@ -125,7 +125,7 @@ TkTextImageCmd(
* objv[1] is "image". */
{
int idx;
- register TkTextSegment *eiPtr;
+ TkTextSegment *eiPtr;
TkTextIndex index;
static const char *const optionStrings[] = {
"cget", "configure", "create", "names", NULL
@@ -161,7 +161,7 @@ TkTextImageCmd(
Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_IMAGE", NULL);
return TCL_ERROR;
}
- objPtr = Tk_GetOptionValue(interp, (char *) &eiPtr->body.ei,
+ objPtr = Tk_GetOptionValue(interp, (char *)&eiPtr->body.ei,
eiPtr->body.ei.optionTable, objv[4], textPtr->tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
@@ -188,7 +188,7 @@ TkTextImageCmd(
}
if (objc <= 5) {
Tcl_Obj *objPtr = Tk_GetOptionInfo(interp,
- (char *) &eiPtr->body.ei, eiPtr->body.ei.optionTable,
+ (char *)&eiPtr->body.ei, eiPtr->body.ei.optionTable,
(objc == 5) ? objv[4] : NULL, textPtr->tkwin);
if (objPtr == NULL) {
@@ -242,7 +242,7 @@ TkTextImageCmd(
* Create the new image segment and initialize it.
*/
- eiPtr = ckalloc(EI_SEG_SIZE);
+ eiPtr = (TkTextSegment *)ckalloc(EI_SEG_SIZE);
eiPtr->typePtr = &tkTextEmbImageType;
eiPtr->size = 1;
eiPtr->body.ei.sharedTextPtr = textPtr->sharedTextPtr;
@@ -279,19 +279,18 @@ TkTextImageCmd(
Tcl_HashEntry *hPtr;
Tcl_Obj *resultObj;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, NULL);
- return TCL_ERROR;
- }
- resultObj = Tcl_NewObj();
- for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable,
- &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
- Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
- -1));
+ if (objc == 3) {
+ resultObj = Tcl_NewObj();
+ for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable,
+ &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
+ Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1));
+ }
+ Tcl_SetObjResult(interp, resultObj);
+ return TCL_OK;
}
- Tcl_SetObjResult(interp, resultObj);
- return TCL_OK;
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
+ break;
}
default:
Tcl_Panic("unexpected switch fallthrough");
@@ -337,7 +336,7 @@ EmbImageConfigure(
int conflict = 0; /* True if we have a name conflict */
size_t len; /* length of image name */
- if (Tk_SetOptions(textPtr->interp, (char *) &eiPtr->body.ei,
+ if (Tk_SetOptions(textPtr->interp, (char *)&eiPtr->body.ei,
eiPtr->body.ei.optionTable,
objc, objv, textPtr->tkwin, NULL, NULL) != TCL_OK) {
return TCL_ERROR;
@@ -389,7 +388,7 @@ EmbImageConfigure(
len = strlen(name);
for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable,
&search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- char *haveName =
+ char *haveName = (char *)
Tcl_GetHashKey(&textPtr->sharedTextPtr->imageTable, hPtr);
if (strncmp(name, haveName, len) == 0) {
@@ -419,7 +418,7 @@ EmbImageConfigure(
&dummy);
Tcl_SetHashValue(hPtr, eiPtr);
Tcl_SetObjResult(textPtr->interp, Tcl_NewStringObj(name, -1));
- eiPtr->body.ei.name = ckalloc(Tcl_DStringLength(&newName) + 1);
+ eiPtr->body.ei.name = (char *)ckalloc(Tcl_DStringLength(&newName) + 1);
strcpy(eiPtr->body.ei.name, name);
Tcl_DStringFree(&newName);
@@ -444,12 +443,11 @@ EmbImageConfigure(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
EmbImageDeleteProc(
TkTextSegment *eiPtr, /* Segment being deleted. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
@@ -527,24 +525,23 @@ EmbImageCleanupProc(
*--------------------------------------------------------------
*/
- /*ARGSUSED*/
static int
EmbImageLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *eiPtr, /* Segment corresponding to indexPtr. */
int offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- int maxChars, /* Chunk must not include more than this many
+ TCL_UNUSED(int), /* Chunk must not include more than this many
* characters. */
int noCharsYet, /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode, /* Wrap mode to use for line:
+ TCL_UNUSED(TkWrapMode), /* Wrap mode to use for line:
* TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
* TEXT_WRAPMODE_WORD. */
- register TkTextDispChunk *chunkPtr)
+ TkTextDispChunk *chunkPtr)
/* Structure to fill in with information about
* this chunk. The x field has already been
* set by the caller. */
@@ -619,7 +616,7 @@ EmbImageLayoutProc(
static void
EmbImageCheckProc(
TkTextSegment *eiPtr, /* Segment to check. */
- TkTextLine *linePtr) /* Line containing segment. */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segment. */
{
if (eiPtr->nextPtr == NULL) {
Tcl_Panic("EmbImageCheckProc: embedded image is last segment in line");
@@ -660,12 +657,12 @@ EmbImageDisplayProc(
* (x-position is in the chunk itself). */
int lineHeight, /* Total height of line. */
int baseline, /* Offset of baseline from y. */
- Display *display, /* Display to use for drawing. */
+ TCL_UNUSED(Display *), /* Display to use for drawing. */
Drawable dst, /* Pixmap or window in which to draw */
- int screenY) /* Y-coordinate in text window that
+ TCL_UNUSED(int)) /* Y-coordinate in text window that
* corresponds to y. */
{
- TkTextSegment *eiPtr = chunkPtr->clientData;
+ TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData;
int lineX, imageX, imageY, width, height;
Tk_Image image;
@@ -713,9 +710,9 @@ EmbImageDisplayProc(
static void
EmbImageBboxProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
- int index, /* Index of desired character within the
+ TCL_UNUSED(int), /* Index of desired character within the
* chunk. */
int y, /* Topmost pixel in area allocated for this
* line. */
@@ -729,7 +726,7 @@ EmbImageBboxProc(
int *heightPtr) /* Gets filled in with height of image, in
* pixels. */
{
- TkTextSegment *eiPtr = chunkPtr->clientData;
+ TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData;
Tk_Image image;
image = eiPtr->body.ei.image;
@@ -794,7 +791,7 @@ TkTextImageIndex(
if (hPtr == NULL) {
return 0;
}
- eiPtr = Tcl_GetHashValue(hPtr);
+ eiPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
indexPtr->tree = textPtr->sharedTextPtr->tree;
indexPtr->linePtr = eiPtr->body.ei.linePtr;
indexPtr->byteIndex = TkTextSegToOffset(eiPtr, indexPtr->linePtr);
@@ -821,14 +818,17 @@ TkTextImageIndex(
static void
EmbImageProc(
ClientData clientData, /* Pointer to widget record. */
- int x, int y, /* Upper left pixel (within image) that must
+ TCL_UNUSED(int), /* Upper left pixel (within image) that must
* be redisplayed. */
- int width, int height, /* Dimensions of area to redisplay (may be
+ TCL_UNUSED(int),
+ TCL_UNUSED(int), /* Dimensions of area to redisplay (may be
* <= 0). */
- int imgWidth, int imgHeight)/* New dimensions of image. */
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),/* New dimensions of image. */
+ TCL_UNUSED(int))
{
- TkTextSegment *eiPtr = clientData;
+ TkTextSegment *eiPtr = (TkTextSegment *)clientData;
TkTextIndex index;
index.tree = eiPtr->body.ei.sharedTextPtr->tree;
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index 8f30b7d..1628389 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -11,9 +11,9 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "default.h"
#include "tkInt.h"
#include "tkText.h"
+#include "default.h"
/*
* Index to use to select last character in line (very large integer):
@@ -62,7 +62,7 @@ static void UpdateStringOfTextIndex(Tcl_Obj *objPtr);
#define GET_INDEXEPOCH(objPtr) \
(PTR2INT((objPtr)->internalRep.twoPtrValue.ptr2))
#define SET_TEXTINDEX(objPtr, indexPtr) \
- ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (indexPtr))
+ ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *)(indexPtr))
#define SET_INDEXEPOCH(objPtr, epoch) \
((objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(epoch))
@@ -107,7 +107,7 @@ DupTextIndexInternalRep(
int epoch;
TkTextIndex *dupIndexPtr, *indexPtr;
- dupIndexPtr = ckalloc(sizeof(TkTextIndex));
+ dupIndexPtr = (TkTextIndex *)ckalloc(sizeof(TkTextIndex));
indexPtr = GET_TEXTINDEX(srcPtr);
epoch = GET_INDEXEPOCH(srcPtr);
@@ -139,7 +139,7 @@ UpdateStringOfTextIndex(
len = TkTextPrintIndex(indexPtr->textPtr, indexPtr, buffer);
- objPtr->bytes = ckalloc(len + 1);
+ objPtr->bytes = (char *)ckalloc(len + 1);
strcpy(objPtr->bytes, buffer);
objPtr->length = len;
}
@@ -176,7 +176,7 @@ MakeObjIndex(
* position. */
const TkTextIndex *origPtr) /* Pointer to index. */
{
- TkTextIndex *indexPtr = ckalloc(sizeof(TkTextIndex));
+ TkTextIndex *indexPtr = (TkTextIndex *)ckalloc(sizeof(TkTextIndex));
indexPtr->tree = origPtr->tree;
indexPtr->linePtr = origPtr->linePtr;
@@ -477,7 +477,7 @@ TkTextMakeCharIndex(
int charIndex, /* Index of desired character. */
TkTextIndex *indexPtr) /* Structure to fill in. */
{
- register TkTextSegment *segPtr;
+ TkTextSegment *segPtr;
char *p, *start, *end;
int index, offset;
int ch;
@@ -816,7 +816,7 @@ GetIndex(
hPtr = Tcl_FindHashEntry(&sharedPtr->tagTable, tagName);
*p = '.';
if (hPtr != NULL) {
- tagPtr = Tcl_GetHashValue(hPtr);
+ tagPtr = (TkTextTag *)Tcl_GetHashValue(hPtr);
}
}
@@ -832,7 +832,7 @@ GetIndex(
if (tagPtr == textPtr->selTagPtr) {
tagName = "sel";
} else if (hPtr != NULL) {
- tagName = Tcl_GetHashKey(&sharedPtr->tagTable, hPtr);
+ tagName = (const char *)Tcl_GetHashKey(&sharedPtr->tagTable, hPtr);
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"text doesn't contain any characters tagged with \"%s\"",
@@ -923,7 +923,7 @@ GetIndex(
}
if ((string[0] == 'e')
&& (strncmp(string, "end",
- (size_t) (endOfBase-Tcl_DStringValue(&copy))) == 0)) {
+ endOfBase-Tcl_DStringValue(&copy)) == 0)) {
/*
* Base position is end of text.
*/
@@ -1151,7 +1151,7 @@ ForwBack(
* or "-" that starts modifier. */
TkTextIndex *indexPtr) /* Index to update as specified in string. */
{
- register const char *p, *units;
+ const char *p, *units;
char *end;
int count, lineIndex, modifier;
size_t length;
@@ -1499,7 +1499,7 @@ TkTextIndexForwChars(
return;
}
if (checkElided) {
- infoPtr = ckalloc(sizeof(TkTextElideInfo));
+ infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo));
elide = TkTextIsElided(textPtr, srcPtr, infoPtr);
}
@@ -1597,7 +1597,7 @@ TkTextIndexForwChars(
charCount--;
}
} else if (type & COUNT_INDICES) {
- if (charCount < segPtr->size - byteOffset) {
+ if (charCount + byteOffset < segPtr->size) {
dstPtr->byteIndex += charCount;
goto forwardCharDone;
}
@@ -1767,7 +1767,7 @@ TkTextIndexCount(
seg2Ptr = TkTextIndexToSeg(indexPtr2, &maxBytes);
if (checkElided) {
- infoPtr = ckalloc(sizeof(TkTextElideInfo));
+ infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo));
elide = TkTextIsElided(textPtr, indexPtr1, infoPtr);
}
@@ -1844,12 +1844,12 @@ TkTextIndexCount(
if (segPtr->typePtr == &tkTextCharType) {
int byteLen = segPtr->size - byteOffset;
- register unsigned char *str = (unsigned char *)
+ unsigned char *str = (unsigned char *)
segPtr->body.chars + byteOffset;
- register int i;
+ int i;
if (segPtr == seg2Ptr) {
- if (byteLen > (maxBytes - byteOffset)) {
+ if (byteLen + byteOffset > maxBytes) {
byteLen = maxBytes - byteOffset;
}
}
@@ -1879,7 +1879,7 @@ TkTextIndexCount(
int byteLen = segPtr->size - byteOffset;
if (segPtr == seg2Ptr) {
- if (byteLen > (maxBytes - byteOffset)) {
+ if (byteLen + byteOffset > maxBytes) {
byteLen = maxBytes - byteOffset;
}
}
@@ -2025,7 +2025,7 @@ TkTextIndexBackChars(
return;
}
if (checkElided) {
- infoPtr = ckalloc(sizeof(TkTextElideInfo));
+ infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo));
elide = TkTextIsElided(textPtr, srcPtr, infoPtr);
}
@@ -2225,7 +2225,7 @@ StartEnd(
{
const char *p;
size_t length;
- register TkTextSegment *segPtr;
+ TkTextSegment *segPtr;
int modifier;
/*
diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c
index 6a41c77..dcd7008 100644
--- a/generic/tkTextMark.c
+++ b/generic/tkTextMark.c
@@ -19,7 +19,7 @@
* Macro that determines the size of a mark segment:
*/
-#define MSEG_SIZE ((unsigned) (Tk_Offset(TkTextSegment, body) \
+#define MSEG_SIZE ((unsigned)(Tk_Offset(TkTextSegment, body) \
+ sizeof(TkTextMark)))
/*
@@ -93,7 +93,7 @@ const Tk_SegType tkTextLeftMarkType = {
int
TkTextMarkCmd(
- register TkText *textPtr, /* Information about text widget. */
+ TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
@@ -147,7 +147,7 @@ TkTextMarkCmd(
NULL);
return TCL_ERROR;
}
- markPtr = Tcl_GetHashValue(hPtr);
+ markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
}
if (objc == 4) {
const char *typeStr;
@@ -162,10 +162,10 @@ TkTextMarkCmd(
}
str = Tcl_GetStringFromObj(objv[4],&length);
c = str[0];
- if ((c == 'l') && (strncmp(str, "left", (unsigned) length) == 0)) {
+ if ((c == 'l') && (strncmp(str, "left", length) == 0)) {
newTypePtr = &tkTextLeftMarkType;
} else if ((c == 'r') &&
- (strncmp(str, "right", (unsigned) length) == 0)) {
+ (strncmp(str, "right", length) == 0)) {
newTypePtr = &tkTextRightMarkType;
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -194,7 +194,7 @@ TkTextMarkCmd(
for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->markTable,
&search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
- Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
+ (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
-1));
}
Tcl_SetObjResult(interp, resultObj);
@@ -229,7 +229,7 @@ TkTextMarkCmd(
hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable,
Tcl_GetString(objv[i]));
if (hPtr != NULL) {
- markPtr = Tcl_GetHashValue(hPtr);
+ markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
/*
* Special case not needed with peer widgets.
@@ -290,7 +290,7 @@ TkTextSetMark(
widgetSpecific = 0;
hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->markTable, name,
&isNew);
- markPtr = Tcl_GetHashValue(hPtr);
+ markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
}
if (!isNew) {
/*
@@ -330,7 +330,7 @@ TkTextSetMark(
}
TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr);
} else {
- markPtr = ckalloc(MSEG_SIZE);
+ markPtr = (TkTextSegment *)ckalloc(MSEG_SIZE);
markPtr->typePtr = &tkTextRightMarkType;
markPtr->size = 0;
markPtr->body.mark.textPtr = textPtr;
@@ -452,7 +452,7 @@ TkTextMarkNameToIndex(
if (hPtr == NULL) {
return TCL_ERROR;
}
- segPtr = Tcl_GetHashValue(hPtr);
+ segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
}
TkTextMarkSegToIndex(textPtr, segPtr, indexPtr);
@@ -499,12 +499,11 @@ TkTextMarkNameToIndex(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
MarkDeleteProc(
- TkTextSegment *segPtr, /* Segment being deleted. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextSegment *), /* Segment being deleted. */
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
@@ -559,18 +558,18 @@ MarkCleanupProc(
static int
MarkLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *segPtr, /* Segment corresponding to indexPtr. */
- int offset, /* Offset within segPtr corresponding to
+ TCL_UNUSED(int), /* Offset within segPtr corresponding to
* indexPtr (always 0). */
- int maxX, /* Chunk must not occupy pixels at this
+ TCL_UNUSED(int), /* Chunk must not occupy pixels at this
* position or higher. */
- int maxChars, /* Chunk must not include more than this many
+ TCL_UNUSED(int), /* Chunk must not include more than this many
* characters. */
- int noCharsYet, /* Non-zero means no characters have been
+ TCL_UNUSED(int), /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode, /* Not used. */
- register TkTextDispChunk *chunkPtr)
+ TCL_UNUSED(TkWrapMode), /* Not used. */
+ TkTextDispChunk *chunkPtr)
/* Structure to fill in with information about
* this chunk. The x field has already been
* set by the caller. */
@@ -615,19 +614,18 @@ MarkLayoutProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
void
TkTextInsertDisplayProc(
TkText *textPtr, /* The current text widget. */
- TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
+ TCL_UNUSED(TkTextDispChunk *), /* Chunk that is to be drawn. */
int x, /* X-position in dst at which to draw this
* chunk (may differ from the x-position in
* the chunk because of scrolling). */
int y, /* Y-position at which to draw this chunk in
* dst (x-position is in the chunk itself). */
int height, /* Total height of line. */
- int baseline, /* Offset of baseline from y. */
- Display *display, /* Display to use for drawing. */
+ TCL_UNUSED(int), /* Offset of baseline from y. */
+ TCL_UNUSED(Display *), /* Display to use for drawing. */
Drawable dst, /* Pixmap or window in which to draw chunk. */
int screenY) /* Y-coordinate in text window that
* corresponds to y. */
@@ -721,11 +719,10 @@ TkTextInsertDisplayProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static void
InsertUndisplayProc(
- TkText *textPtr, /* Overall information about text widget. */
- TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
+ TCL_UNUSED(TkText *), /* Overall information about text widget. */
+ TCL_UNUSED(TkTextDispChunk *)) /* Chunk that is about to be freed. */
{
return;
}
@@ -809,7 +806,7 @@ MarkFindNext(
{
TkTextIndex index;
Tcl_HashEntry *hPtr;
- register TkTextSegment *segPtr;
+ TkTextSegment *segPtr;
int offset;
const char *string = Tcl_GetString(obj);
@@ -830,7 +827,7 @@ MarkFindNext(
* position.
*/
- segPtr = Tcl_GetHashValue(hPtr);
+ segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
TkTextMarkSegToIndex(textPtr, segPtr, &index);
segPtr = segPtr->nextPtr;
} else {
@@ -900,7 +897,7 @@ MarkFindPrev(
{
TkTextIndex index;
Tcl_HashEntry *hPtr;
- register TkTextSegment *segPtr, *seg2Ptr, *prevPtr;
+ TkTextSegment *segPtr, *seg2Ptr, *prevPtr;
int offset;
const char *string = Tcl_GetString(obj);
@@ -919,7 +916,7 @@ MarkFindPrev(
* position.
*/
- segPtr = Tcl_GetHashValue(hPtr);
+ segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
TkTextMarkSegToIndex(textPtr, segPtr, &index);
} else {
/*
@@ -1012,7 +1009,7 @@ GetMarkName(
return NULL;
} else {
- markName = Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
+ markName = (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
segPtr->body.mark.hPtr);
}
return Tcl_NewStringObj(markName, -1);
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index f7e4294..c15773e 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.c
@@ -12,9 +12,9 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "default.h"
#include "tkInt.h"
#include "tkText.h"
+#include "default.h"
/*
* The 'TkWrapMode' enum in tkText.h is used to define a type for the -wrap
@@ -137,7 +137,7 @@ static void TagBindEvent(TkText *textPtr, XEvent *eventPtr,
int
TkTextTagCmd(
- register TkText *textPtr, /* Information about text widget. */
+ TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
@@ -154,7 +154,7 @@ TkTextTagCmd(
TAG_REMOVE
};
int optionIndex, i;
- register TkTextTag *tagPtr;
+ TkTextTag *tagPtr;
TkTextIndex index1, index2;
if (objc < 3) {
@@ -343,7 +343,7 @@ TkTextTagCmd(
if (tagPtr == NULL) {
return TCL_ERROR;
}
- objPtr = Tk_GetOptionValue(interp, (char *) tagPtr,
+ objPtr = Tk_GetOptionValue(interp, (char *)tagPtr,
tagPtr->optionTable, objv[4], textPtr->tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
@@ -362,7 +362,7 @@ TkTextTagCmd(
}
tagPtr = TkTextCreateTag(textPtr, Tcl_GetString(objv[3]), &newTag);
if (objc <= 5) {
- Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, (char *) tagPtr,
+ Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, (char *)tagPtr,
tagPtr->optionTable,
(objc == 5) ? objv[4] : NULL, textPtr->tkwin);
@@ -374,7 +374,7 @@ TkTextTagCmd(
} else {
int result = TCL_OK;
- if (Tk_SetOptions(interp, (char *) tagPtr, tagPtr->optionTable,
+ if (Tk_SetOptions(interp, (char *)tagPtr, tagPtr->optionTable,
objc-4, objv+4, textPtr->tkwin, NULL, NULL) != TCL_OK) {
return TCL_ERROR;
}
@@ -584,7 +584,7 @@ TkTextTagCmd(
continue;
}
- tagPtr = Tcl_GetHashValue(hPtr);
+ tagPtr = (TkTextTag *)Tcl_GetHashValue(hPtr);
if (tagPtr == textPtr->selTagPtr) {
continue;
}
@@ -645,12 +645,12 @@ TkTextTagCmd(
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
- arrayPtr = ckalloc(textPtr->sharedTextPtr->numTags
+ arrayPtr = (TkTextTag **)ckalloc(textPtr->sharedTextPtr->numTags
* sizeof(TkTextTag *));
for (i=0, hPtr = Tcl_FirstHashEntry(
&textPtr->sharedTextPtr->tagTable, &search);
hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) {
- arrayPtr[i] = Tcl_GetHashValue(hPtr);
+ arrayPtr[i] = (TkTextTag *)Tcl_GetHashValue(hPtr);
}
/*
@@ -986,7 +986,7 @@ TkTextCreateTag(
int *newTag) /* If non-NULL, then return 1 if new, or 0 if
* already exists. */
{
- register TkTextTag *tagPtr;
+ TkTextTag *tagPtr;
Tcl_HashEntry *hPtr = NULL;
int isNew;
const char *name;
@@ -1009,9 +1009,9 @@ TkTextCreateTag(
*newTag = isNew;
}
if (!isNew) {
- return Tcl_GetHashValue(hPtr);
+ return (TkTextTag *)Tcl_GetHashValue(hPtr);
}
- name = Tcl_GetHashKey(&textPtr->sharedTextPtr->tagTable, hPtr);
+ name = (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->tagTable, hPtr);
}
/*
@@ -1019,7 +1019,7 @@ TkTextCreateTag(
* to it to the hash table entry.
*/
- tagPtr = ckalloc(sizeof(TkTextTag));
+ tagPtr = (TkTextTag *)ckalloc(sizeof(TkTextTag));
tagPtr->name = name;
tagPtr->textPtr = NULL;
tagPtr->toggleCount = 0;
@@ -1118,7 +1118,7 @@ FindTag(
hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->tagTable,
Tcl_GetString(tagName));
if (hPtr != NULL) {
- return Tcl_GetHashValue(hPtr);
+ return (TkTextTag *)Tcl_GetHashValue(hPtr);
}
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -1158,7 +1158,7 @@ FindTag(
void
TkTextDeleteTag(
TkText *textPtr, /* Info about overall widget. */
- register TkTextTag *tagPtr) /* Tag being deleted. */
+ TkTextTag *tagPtr) /* Tag being deleted. */
{
TkTextIndex first, last;
@@ -1216,7 +1216,7 @@ TkTextDeleteTag(
void
TkTextFreeTag(
TkText *textPtr, /* Info about overall widget. */
- register TkTextTag *tagPtr) /* Tag being deleted. */
+ TkTextTag *tagPtr) /* Tag being deleted. */
{
int i;
@@ -1295,7 +1295,7 @@ SortTags(
TkTextTag **tagArrayPtr) /* Pointer to array of pointers. */
{
int i, j, prio;
- register TkTextTag **tagPtrPtr;
+ TkTextTag **tagPtrPtr;
TkTextTag **maxPtrPtr, *tmp;
if (numTags < 2) {
@@ -1379,7 +1379,7 @@ ChangeTagPriority(
int prio) /* New priority for tag. */
{
int low, high, delta;
- register TkTextTag *tagPtr2;
+ TkTextTag *tagPtr2;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
@@ -1412,7 +1412,7 @@ ChangeTagPriority(
}
for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->tagTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- tagPtr2 = Tcl_GetHashValue(hPtr);
+ tagPtr2 = (TkTextTag *)Tcl_GetHashValue(hPtr);
if ((tagPtr2->priority >= low) && (tagPtr2->priority <= high)) {
tagPtr2->priority += delta;
}
@@ -1443,7 +1443,7 @@ TkTextBindProc(
ClientData clientData, /* Pointer to text widget structure. */
XEvent *eventPtr) /* Pointer to X event that just happened. */
{
- TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
int repick = 0;
textPtr->refCount++;
@@ -1529,7 +1529,7 @@ TkTextBindProc(
void
TkTextPickCurrent(
- register TkText *textPtr, /* Text widget in which to select current
+ TkText *textPtr, /* Text widget in which to select current
* character. */
XEvent *eventPtr) /* Event describing location of mouse cursor.
* Must be EnterWindow, LeaveWindow,
@@ -1632,8 +1632,8 @@ TkTextPickCurrent(
SortTags(textPtr->numCurTags, textPtr->curTagArrayPtr);
if (numNewTags > 0) {
size = numNewTags * sizeof(TkTextTag *);
- copyArrayPtr = ckalloc(size);
- memcpy(copyArrayPtr, newArrayPtr, (size_t) size);
+ copyArrayPtr = (TkTextTag **)ckalloc(size);
+ memcpy(copyArrayPtr, newArrayPtr, size);
for (i = 0; i < textPtr->numCurTags; i++) {
for (j = 0; j < numNewTags; j++) {
if (textPtr->curTagArrayPtr[i] == copyArrayPtr[j]) {
@@ -1736,7 +1736,7 @@ TagBindEvent(
*/
if (numTags > NUM_BIND_TAGS) {
- nameArrPtr = ckalloc(numTags * sizeof(const char *));
+ nameArrPtr = (const char **)ckalloc(numTags * sizeof(const char *));
} else {
nameArrPtr = nameArray;
}
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index a0e7089..c160083 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -35,7 +35,7 @@ static const Tk_GeomMgr textGeomType = {
* Macro that determines the size of an embedded window segment:
*/
-#define EW_SEG_SIZE ((unsigned) (Tk_Offset(TkTextSegment, body) \
+#define EW_SEG_SIZE ((unsigned)(Tk_Offset(TkTextSegment, body) \
+ sizeof(TkTextEmbWindow)))
/*
@@ -133,7 +133,7 @@ static const Tk_OptionSpec optionSpecs[] = {
int
TkTextWindowCmd(
- register TkText *textPtr, /* Information about text widget. */
+ TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
@@ -147,7 +147,7 @@ TkTextWindowCmd(
enum windOptions {
WIND_CGET, WIND_CONFIGURE, WIND_CREATE, WIND_NAMES
};
- register TkTextSegment *ewPtr;
+ TkTextSegment *ewPtr;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?");
@@ -191,7 +191,7 @@ TkTextWindowCmd(
ewPtr->body.ew.tkwin = NULL;
}
- objPtr = Tk_GetOptionValue(interp, (char *) &ewPtr->body.ew,
+ objPtr = Tk_GetOptionValue(interp, (char *)&ewPtr->body.ew,
ewPtr->body.ew.optionTable, objv[4], textPtr->tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
@@ -233,7 +233,7 @@ TkTextWindowCmd(
ewPtr->body.ew.tkwin = NULL;
}
- objPtr = Tk_GetOptionInfo(interp, (char *) &ewPtr->body.ew,
+ objPtr = Tk_GetOptionInfo(interp, (char *)&ewPtr->body.ew,
ewPtr->body.ew.optionTable, (objc == 5) ? objv[4] : NULL,
textPtr->tkwin);
if (objPtr == NULL) {
@@ -290,7 +290,7 @@ TkTextWindowCmd(
* Create the new window segment and initialize it.
*/
- ewPtr = ckalloc(EW_SEG_SIZE);
+ ewPtr = (TkTextSegment *)ckalloc(EW_SEG_SIZE);
ewPtr->typePtr = &tkTextEmbWindowType;
ewPtr->size = 1;
ewPtr->body.ew.sharedTextPtr = textPtr->sharedTextPtr;
@@ -302,7 +302,7 @@ TkTextWindowCmd(
ewPtr->body.ew.stretch = 0;
ewPtr->body.ew.optionTable = Tk_CreateOptionTable(interp, optionSpecs);
- client = ckalloc(sizeof(TkTextEmbWindowClient));
+ client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient));
client->next = NULL;
client->textPtr = textPtr;
client->tkwin = NULL;
@@ -345,7 +345,7 @@ TkTextWindowCmd(
for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->windowTable,
&search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
- Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
+ (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
-1));
}
Tcl_SetObjResult(interp, resultObj);
@@ -403,7 +403,7 @@ EmbWinConfigure(
}
oldWindow = ewPtr->body.ew.tkwin;
- if (Tk_SetOptions(textPtr->interp, (char *) &ewPtr->body.ew,
+ if (Tk_SetOptions(textPtr->interp, (char *)&ewPtr->body.ew,
ewPtr->body.ew.optionTable, objc, objv, textPtr->tkwin, NULL,
NULL) != TCL_OK) {
return TCL_ERROR;
@@ -467,7 +467,7 @@ EmbWinConfigure(
* Have to make the new client.
*/
- client = ckalloc(sizeof(TkTextEmbWindowClient));
+ client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient));
client->next = ewPtr->body.ew.clients;
client->textPtr = textPtr;
client->tkwin = NULL;
@@ -526,7 +526,7 @@ EmbWinStructureProc(
ClientData clientData, /* Pointer to record describing window item. */
XEvent *eventPtr) /* Describes what just happened. */
{
- TkTextEmbWindowClient *client = clientData;
+ TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData;
TkTextSegment *ewPtr = client->parent;
TkTextIndex index;
Tcl_HashEntry *hPtr;
@@ -573,13 +573,12 @@ EmbWinStructureProc(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static void
EmbWinRequestProc(
ClientData clientData, /* Pointer to record for window item. */
- Tk_Window tkwin) /* Window that changed its desired size. */
+ TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */
{
- TkTextEmbWindowClient *client = clientData;
+ TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData;
TkTextSegment *ewPtr = client->parent;
TkTextIndex index;
@@ -616,7 +615,7 @@ EmbWinLostContentProc(
Tk_Window tkwin) /* Window that was claimed away by another
* geometry manager. */
{
- TkTextEmbWindowClient *client = clientData;
+ TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData;
TkTextSegment *ewPtr = client->parent;
TkTextIndex index;
Tcl_HashEntry *hPtr;
@@ -736,12 +735,11 @@ TkTextWinFreeClient(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
EmbWinDeleteProc(
TkTextSegment *ewPtr, /* Segment being deleted. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
@@ -816,24 +814,23 @@ EmbWinCleanupProc(
*--------------------------------------------------------------
*/
- /*ARGSUSED*/
static int
EmbWinLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *ewPtr, /* Segment corresponding to indexPtr. */
int offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- int maxChars, /* Chunk must not include more than this many
+ TCL_UNUSED(int), /* Chunk must not include more than this many
* characters. */
int noCharsYet, /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode, /* Wrap mode to use for line:
+ TCL_UNUSED(TkWrapMode), /* Wrap mode to use for line:
* TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
* TEXT_WRAPMODE_WORD. */
- register TkTextDispChunk *chunkPtr)
+ TkTextDispChunk *chunkPtr)
/* Structure to fill in with information about
* this chunk. The x field has already been
* set by the caller. */
@@ -959,7 +956,7 @@ EmbWinLayoutProc(
* now need to add to our client list.
*/
- client = ckalloc(sizeof(TkTextEmbWindowClient));
+ client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient));
client->next = ewPtr->body.ew.clients;
client->textPtr = textPtr;
client->tkwin = NULL;
@@ -1052,7 +1049,7 @@ EmbWinLayoutProc(
static void
EmbWinCheckProc(
TkTextSegment *ewPtr, /* Segment to check. */
- TkTextLine *linePtr) /* Line containing segment. */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segment. */
{
if (ewPtr->nextPtr == NULL) {
Tcl_Panic("EmbWinCheckProc: embedded window is last segment in line");
@@ -1087,20 +1084,20 @@ TkTextEmbWinDisplayProc(
int x, /* X-position in dst at which to draw this
* chunk (differs from the x-position in the
* chunk because of scrolling). */
- int y, /* Top of rectangular bounding box for line:
+ TCL_UNUSED(int), /* Top of rectangular bounding box for line:
* tells where to draw this chunk in dst
* (x-position is in the chunk itself). */
int lineHeight, /* Total height of line. */
int baseline, /* Offset of baseline from y. */
- Display *display, /* Display to use for drawing (unused). */
- Drawable dst, /* Pixmap or window in which to draw
+ TCL_UNUSED(Display *), /* Display to use for drawing (unused). */
+ TCL_UNUSED(Drawable), /* Pixmap or window in which to draw
* (unused). */
int screenY) /* Y-coordinate in text window that
* corresponds to y. */
{
int lineX, windowX, windowY, width, height;
Tk_Window tkwin;
- TkTextSegment *ewPtr = chunkPtr->clientData;
+ TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData;
TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
if (client == NULL) {
@@ -1180,7 +1177,7 @@ EmbWinUndisplayProc(
TkText *textPtr, /* Overall information about text widget. */
TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
{
- TkTextSegment *ewPtr = chunkPtr->clientData;
+ TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData;
TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
if (client == NULL) {
@@ -1228,7 +1225,7 @@ static void
EmbWinBboxProc(
TkText *textPtr, /* Information about text widget. */
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
- int index, /* Index of desired character within the
+ TCL_UNUSED(int), /* Index of desired character within the
* chunk. */
int y, /* Topmost pixel in area allocated for this
* line. */
@@ -1243,7 +1240,7 @@ EmbWinBboxProc(
* pixels. */
{
Tk_Window tkwin;
- TkTextSegment *ewPtr = chunkPtr->clientData;
+ TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData;
TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
if (client == NULL) {
@@ -1305,7 +1302,7 @@ static void
EmbWinDelayedUnmap(
ClientData clientData) /* Token for the window to be unmapped. */
{
- TkTextEmbWindowClient *client = clientData;
+ TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData;
if (!client->displayed && (client->tkwin != NULL)) {
if (client->textPtr->tkwin != Tk_Parent(client->tkwin)) {
@@ -1353,7 +1350,7 @@ TkTextWindowIndex(
return 0;
}
- ewPtr = Tcl_GetHashValue(hPtr);
+ ewPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
indexPtr->tree = textPtr->sharedTextPtr->tree;
indexPtr->linePtr = ewPtr->body.ew.linePtr;
indexPtr->byteIndex = TkTextSegToOffset(ewPtr, indexPtr->linePtr);