summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-04-04 06:34:40 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-04-04 06:34:40 (GMT)
commit2eb951782866ecd73369684de756732a468a79e1 (patch)
tree804636611ff0ae8242adfab2a8b9a067f4466a54 /generic
parent6d61d799f483c98a1e0aeb624fa001a7fce24af0 (diff)
downloadtk-2eb951782866ecd73369684de756732a468a79e1.zip
tk-2eb951782866ecd73369684de756732a468a79e1.tar.gz
tk-2eb951782866ecd73369684de756732a468a79e1.tar.bz2
Change size_t usages to (internal type) TkSizeT usages, which is "int" when compiling against 8.x headers.
Diffstat (limited to 'generic')
-rw-r--r--generic/tkCanvText.c4
-rw-r--r--generic/tkCanvas.c2
-rw-r--r--generic/tkClipboard.c2
-rw-r--r--generic/tkCmds.c2
-rw-r--r--generic/tkConfig.c2
-rw-r--r--generic/tkEntry.c2
-rw-r--r--generic/tkFileFilter.c6
-rw-r--r--generic/tkFont.c4
-rw-r--r--generic/tkFrame.c4
-rw-r--r--generic/tkGrab.c2
-rw-r--r--generic/tkGrid.c2
-rw-r--r--generic/tkImgGIF.c4
-rw-r--r--generic/tkImgListFormat.c2
-rw-r--r--generic/tkImgPNG.c10
-rw-r--r--generic/tkImgPPM.c2
-rw-r--r--generic/tkImgPhoto.c8
-rw-r--r--generic/tkInt.h7
-rw-r--r--generic/tkListbox.c14
-rw-r--r--generic/tkPack.c2
-rw-r--r--generic/tkScrollbar.c2
-rw-r--r--generic/tkSelect.c2
-rw-r--r--generic/tkText.c70
-rw-r--r--generic/tkTextDisp.c4
-rw-r--r--generic/tkTextMark.c2
-rw-r--r--generic/tkTextTag.c2
-rw-r--r--generic/tkUtil.c17
-rw-r--r--generic/tkWindow.c2
-rw-r--r--generic/ttk/ttkEntry.c4
28 files changed, 92 insertions, 94 deletions
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index c918399..e38f74b 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -1007,7 +1007,7 @@ TextInsert(
{
TextItem *textPtr = (TextItem *) itemPtr;
int byteIndex, charsAdded;
- size_t byteCount;
+ TkSizeT byteCount;
char *newStr, *text;
const char *string;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
@@ -1344,7 +1344,7 @@ GetTextIndex(
* index. */
{
TextItem *textPtr = (TextItem *) itemPtr;
- size_t length;
+ TkSizeT length;
int c;
TkCanvas *canvasPtr = (TkCanvas *) canvas;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 6db501b..6b3c054 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -1153,7 +1153,7 @@ CanvasWidgetCmd(
int isNew = 0;
Tcl_HashEntry *entryPtr;
const char *arg;
- size_t length;
+ TkSizeT length;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "type coords ?arg ...?");
diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c
index 9f6822f..3c3d89b 100644
--- a/generic/tkClipboard.c
+++ b/generic/tkClipboard.c
@@ -450,7 +450,7 @@ Tk_ClipboardObjCmd(
};
enum appendOptions { APPEND_DISPLAYOF, APPEND_FORMAT, APPEND_TYPE };
int subIndex;
- size_t length;
+ TkSizeT length;
for (i = 2; i < objc - 1; i++) {
string = TkGetStringFromObj(objv[i], &length);
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index 391d906..f0abd70 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -2071,7 +2071,7 @@ TkGetDisplayOf(
* present. */
{
const char *string;
- size_t length;
+ TkSizeT length;
if (objc < 1) {
return 0;
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index 892692a..7b84207 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -656,7 +656,7 @@ DoObjConfig(
case TK_OPTION_STRING: {
char *newStr;
const char *value;
- size_t length;
+ TkSizeT length;
if (nullOK && ObjectIsEmpty(valuePtr)) {
valuePtr = NULL;
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index fea83b5..af4ddc6 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -4385,7 +4385,7 @@ SpinboxInvoke(
*/
int i, listc;
- size_t elemLen, length = entryPtr->numChars;
+ TkSizeT elemLen, length = entryPtr->numChars;
const char *bytes;
Tcl_Obj **listv;
diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c
index 6cb188b..561676b 100644
--- a/generic/tkFileFilter.c
+++ b/generic/tkFileFilter.c
@@ -262,7 +262,7 @@ AddClause(
*/
for (i=0; i<ostypeCount; i++) {
- size_t len;
+ TkSizeT len;
const char *strType = TkGetStringFromObj(ostypeList[i], &len);
/*
@@ -322,7 +322,7 @@ AddClause(
if (globCount > 0 && globList != NULL) {
for (i=0; i<globCount; i++) {
GlobPattern *globPtr = ckalloc(sizeof(GlobPattern));
- size_t len;
+ TkSizeT len;
const char *str = TkGetStringFromObj(globList[i], &len);
len = (len + 1) * sizeof(char);
@@ -375,7 +375,7 @@ AddClause(
}
for (i=0; i<ostypeCount; i++) {
Tcl_DString osTypeDS;
- size_t len;
+ TkSizeT len;
MacFileType *mfPtr = ckalloc(sizeof(MacFileType));
const char *strType = TkGetStringFromObj(ostypeList[i], &len);
char *string;
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 053524c..31b05b9 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -712,7 +712,7 @@ Tk_FontObjCmd(
case FONT_MEASURE: {
const char *string;
Tk_Font tkfont;
- size_t length = 0;
+ TkSizeT length = 0;
int skip = 0;
if (objc > 4) {
@@ -3245,7 +3245,7 @@ Tk_TextLayoutToPostscript(
int baseline = chunkPtr->y;
Tcl_Obj *psObj = Tcl_NewObj();
int i, j;
- size_t len;
+ TkSizeT len;
const char *p, *glyphname;
char uindex[5], c, *ps;
int ch;
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index 392799e..95a14b5 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -489,7 +489,7 @@ CreateFrame(
const char *className, *screenName, *visualName, *colormapName;
const char *arg, *useOption;
int i, depth;
- size_t length;
+ TkSizeT length;
unsigned int mask;
Colormap colormap;
Visual *visual;
@@ -745,7 +745,7 @@ FrameWidgetObjCmd(
register Frame *framePtr = clientData;
int result = TCL_OK, index;
int c, i;
- size_t length;
+ TkSizeT length;
Tcl_Obj *objPtr;
if (objc < 2) {
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index ff5d083..0efddee 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.c
@@ -190,7 +190,7 @@ Tk_GrabObjCmd(
TkDisplay *dispPtr;
const char *arg;
int index;
- size_t len;
+ TkSizeT len;
static const char *const optionStrings[] = {
"current", "release", "set", "status", NULL
};
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 436151a..b5e89ce 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -2968,7 +2968,7 @@ ConfigureSlaves(
firstChar = 0;
for (numWindows=0, i=0; i < objc; i++) {
- size_t length;
+ TkSizeT length;
char prevChar = firstChar;
string = TkGetStringFromObj(objv[i], &length);
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index da62d1f..cebf8e3 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -757,7 +757,7 @@ StringMatchGIF(
Tcl_Interp *interp) /* not used */
{
unsigned char *data, header[10];
- size_t got, length;
+ TkSizeT got, length;
MFile handle;
data = TkGetByteArrayFromObj(dataObj, &length);
@@ -826,7 +826,7 @@ StringReadGIF(
int srcX, int srcY)
{
MFile handle, *hdlPtr = &handle;
- size_t length;
+ TkSizeT length;
const char *xferFormat;
unsigned char *data = TkGetByteArrayFromObj(dataObj, &length);
diff --git a/generic/tkImgListFormat.c b/generic/tkImgListFormat.c
index 4636c41..0a4435c 100644
--- a/generic/tkImgListFormat.c
+++ b/generic/tkImgListFormat.c
@@ -772,7 +772,7 @@ ParseColor(
unsigned char *alphaPtr)
{
const char *specString;
- size_t charCount;
+ TkSizeT charCount;
/*
* Find out which color format we have
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c
index a620515..871684d 100644
--- a/generic/tkImgPNG.c
+++ b/generic/tkImgPNG.c
@@ -127,7 +127,7 @@ typedef struct {
Tcl_Channel channel; /* Channel for from-file reads. */
Tcl_Obj *objDataPtr;
unsigned char *strDataBuf; /* Raw source data for from-string reads. */
- size_t strDataLen; /* Length of source data. */
+ TkSizeT strDataLen; /* Length of source data. */
unsigned char *base64Data; /* base64 encoded string data. */
unsigned char base64Bits; /* Remaining bits from last base64 read. */
unsigned char base64State; /* Current state of base64 decoder. */
@@ -2098,7 +2098,7 @@ ReadIDAT(
*/
while (chunkSz && !Tcl_ZlibStreamEof(pngPtr->stream)) {
- size_t len1, len2;
+ TkSizeT len1, len2;
/*
* Read another block of input into the zlib stream if data remains.
@@ -2154,7 +2154,7 @@ ReadIDAT(
}
TkGetByteArrayFromObj(pngPtr->thisLineObj, &len2);
- if (len2 == (size_t)pngPtr->phaseSize) {
+ if (len2 == (TkSizeT)pngPtr->phaseSize) {
if (pngPtr->phase > 7) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"extra data after final scan line of final phase",
@@ -2863,7 +2863,7 @@ WriteData(
*/
if (pngPtr->objDataPtr) {
- size_t objSz;
+ TkSizeT objSz;
unsigned char *destPtr;
TkGetByteArrayFromObj(pngPtr->objDataPtr, &objSz);
@@ -3135,7 +3135,7 @@ WriteIDAT(
int rowNum, flush = TCL_ZLIB_NO_FLUSH, result;
Tcl_Obj *outputObj;
unsigned char *outputBytes;
- size_t outputSize;
+ TkSizeT outputSize;
/*
* Filter and compress each row one at a time.
diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c
index d6ec63c..ea49fc2 100644
--- a/generic/tkImgPPM.c
+++ b/generic/tkImgPPM.c
@@ -765,7 +765,7 @@ ReadPPMStringHeader(
#define BUFFER_SIZE 1000
char buffer[BUFFER_SIZE], c;
int i, numFields, type = 0;
- size_t dataSize;
+ TkSizeT dataSize;
unsigned char *dataBuffer;
dataBuffer = TkGetByteArrayFromObj(dataPtr, &dataSize);
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index c1055ac..40cc98a 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -410,7 +410,7 @@ ImgPhotoCmd(
unsigned char *pixelPtr;
Tk_PhotoImageBlock block;
Tk_PhotoImageFormat *imageFormat;
- size_t length;
+ TkSizeT length;
int imageWidth, imageHeight, matched, oldformat = 0;
Tcl_Channel chan;
Tk_PhotoHandle srcHandle;
@@ -1476,7 +1476,7 @@ ParseSubcommandOptions(
* TK_PHOTO_COMPOSITE_* constants. */
NULL
};
- size_t length;
+ TkSizeT length;
int index, c, bit, currentBit;
int values[4], numValues, maxValues, argIndex;
const char *option, *expandedOption, *needed;
@@ -1758,7 +1758,7 @@ ImgPhotoConfigureMaster(
const char *oldFileString, *oldPaletteString;
Tcl_Obj *oldData, *data = NULL, *oldFormat, *format = NULL;
Tcl_Obj *tempdata, *tempformat;
- size_t length;
+ TkSizeT length;
int i, j, result, imageWidth, imageHeight, oldformat;
double oldGamma;
Tcl_Channel chan;
@@ -1846,7 +1846,7 @@ ImgPhotoConfigureMaster(
* Force into ByteArray format, which most (all) image handlers will
* use anyway. Empty length means ignore the -data option.
*/
- size_t bytesize;
+ TkSizeT bytesize;
(void) TkGetByteArrayFromObj(data, &bytesize);
if (bytesize) {
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 767bbbb..bbf29fb 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -1279,12 +1279,17 @@ MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion);
MODULE_SCOPE size_t TkUniCharToUtf(int, char *);
#endif
+#if TCL_MAJOR_VERSION > 8
#define TkGetStringFromObj(objPtr, lenPtr) \
(((objPtr)->bytes ? 0 : Tcl_GetString(objPtr)), \
*(lenPtr) = (objPtr)->length, (objPtr)->bytes)
-
MODULE_SCOPE unsigned char *TkGetByteArrayFromObj(Tcl_Obj *objPtr,
size_t *lengthPtr);
+#else
+#define TkGetStringFromObj Tcl_GetStringFromObj
+#define TkGetByteArrayFromObj Tcl_GetByteArrayFromObj
+#endif
+
/*
* Unsupported commands.
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index fec3759..b3d251b 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -1103,7 +1103,7 @@ ListboxBboxSubCmd(
Tcl_Obj *el, *results[4];
const char *stringRep;
int pixelWidth, x, y, result;
- size_t stringLen;
+ TkSizeT stringLen;
Tk_FontMetrics fm;
/*
@@ -1842,7 +1842,7 @@ DisplayListbox(
register Tk_Window tkwin = listPtr->tkwin;
GC gc;
int i, limit, x, y, prevSelected, freeGC;
- size_t stringLen;
+ TkSizeT stringLen;
Tk_FontMetrics fm;
Tcl_Obj *curElement;
Tcl_HashEntry *entry;
@@ -2239,7 +2239,7 @@ ListboxComputeGeometry(
* window. */
{
int width, height, pixelWidth, pixelHeight, i, result;
- size_t textLength;
+ TkSizeT textLength;
Tk_FontMetrics fm;
Tcl_Obj *element;
const char *text;
@@ -2327,7 +2327,7 @@ ListboxInsertSubCmd(
Tcl_Obj *const objv[]) /* New elements (one per entry). */
{
int i, oldMaxWidth, pixelWidth, result;
- size_t length;
+ TkSizeT length;
Tcl_Obj *newListObj;
const char *stringRep;
@@ -2442,7 +2442,7 @@ ListboxDeleteSubCmd(
int last) /* Index of last element to delete. */
{
int count, i, widthChanged, result, pixelWidth;
- size_t length;
+ TkSizeT length;
Tcl_Obj *newListObj, *element;
const char *stringRep;
Tcl_HashEntry *entry;
@@ -3128,7 +3128,7 @@ ListboxFetchSelection(
register Listbox *listPtr = clientData;
Tcl_DString selection;
int count, needNewline, i;
- size_t length, stringLen;
+ TkSizeT length, stringLen;
Tcl_Obj *curElement;
const char *stringRep;
Tcl_HashEntry *entry;
@@ -3166,7 +3166,7 @@ ListboxFetchSelection(
* Copy the requested portion of the selection to the buffer.
*/
- if (length <= (size_t)offset) {
+ if (length <= (TkSizeT)offset) {
count = 0;
} else {
count = length - offset;
diff --git a/generic/tkPack.c b/generic/tkPack.c
index c1b6345..cfeea02 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -1182,7 +1182,7 @@ PackAfter(
packPtr->flags |= OLD_STYLE;
for (index = 0 ; index < optionCount; index++) {
Tcl_Obj *curOptPtr = options[index];
- size_t length;
+ TkSizeT length;
const char *curOpt = TkGetStringFromObj(curOptPtr, &length);
c = curOpt[0];
diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c
index 4dba6e6..b1389a8 100644
--- a/generic/tkScrollbar.c
+++ b/generic/tkScrollbar.c
@@ -227,7 +227,7 @@ ScrollbarWidgetObjCmd(
{
register TkScrollbar *scrollPtr = clientData;
int result = TCL_OK, cmdIndex;
- size_t length;
+ TkSizeT length;
static const char *const commandNames[] = {
"activate", "cget", "configure", "delta", "fraction",
"get", "identify", "set", NULL
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index 9e9b3c9..e088bf5 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -831,7 +831,7 @@ Tk_SelectionObjCmd(
const char *targetName = NULL;
const char *formatName = NULL;
register CommandInfo *cmdInfoPtr;
- size_t cmdLength;
+ TkSizeT cmdLength;
static const char *const handleOptionStrings[] = {
"-format", "-selection", "-type", NULL
};
diff --git a/generic/tkText.c b/generic/tkText.c
index 688fdce..d4f780c 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -864,7 +864,7 @@ TextWidgetObjCmd(
for (i = 2; i < objc-2; i++) {
int value;
- size_t length;
+ TkSizeT length;
const char *option = TkGetStringFromObj(objv[i], &length);
char c;
@@ -1259,7 +1259,7 @@ TextWidgetObjCmd(
Tcl_Obj *objPtr = NULL;
int i, found = 0, visible = 0;
const char *name;
- size_t length;
+ TkSizeT length;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -2631,7 +2631,7 @@ InsertChars(
int viewUpdate) /* Update the view if set. */
{
int lineIndex;
- size_t length;
+ TkSizeT length;
TkText *tPtr;
int *lineAndByteIndex;
int resetViewCount;
@@ -3509,7 +3509,7 @@ TextFetchSelection(
if ((segPtr->typePtr == &tkTextCharType)
&& !TkTextIsElided(textPtr, &textPtr->selIndex, NULL)) {
memcpy(buffer, segPtr->body.chars + offsetInSeg,
- (size_t) chunkSize);
+ chunkSize);
buffer += chunkSize;
maxBytes -= chunkSize;
count += chunkSize;
@@ -4273,7 +4273,7 @@ TextSearchFoundMatch(
int matchLength) /* Length also in bytes/chars as per search
* type. */
{
- size_t numChars;
+ TkSizeT numChars;
int leftToScan;
TkTextIndex curIndex, foundIndex;
TkTextSegment *segPtr;
@@ -4313,7 +4313,7 @@ TextSearchFoundMatch(
if (searchSpecPtr->strictLimits && lineNum == searchSpecPtr->stopLine) {
if (searchSpecPtr->backwards ^
- ((matchOffset + numChars + 1) > (size_t) searchSpecPtr->stopOffset + 1)) {
+ ((matchOffset + numChars + 1) > (TkSizeT) searchSpecPtr->stopOffset + 1)) {
return 0;
}
}
@@ -4753,7 +4753,7 @@ TextDumpCmd(
if (objc == arg) {
TkTextIndexForwChars(NULL, &index1, 1, &index2, COUNT_INDICES);
} else {
- size_t length;
+ TkSizeT length;
const char *str;
if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) {
@@ -5760,7 +5760,7 @@ SearchCore(
*/
int firstOffset, lastOffset;
- size_t matchOffset, matchLength;
+ TkSizeT matchOffset, matchLength;
int passes;
int lineNum = searchSpecPtr->startLine;
int code = TCL_OK;
@@ -5781,9 +5781,9 @@ SearchCore(
#define LOTS_OF_MATCHES 20
int matchNum = LOTS_OF_MATCHES;
- size_t smArray[2 * LOTS_OF_MATCHES];
- size_t *storeMatch = smArray;
- size_t *storeLength = smArray + LOTS_OF_MATCHES;
+ TkSizeT smArray[2 * LOTS_OF_MATCHES];
+ TkSizeT *storeMatch = smArray;
+ TkSizeT *storeLength = smArray + LOTS_OF_MATCHES;
int lastBackwardsLineMatch = -1;
int lastBackwardsMatchOffset = -1;
@@ -5968,11 +5968,11 @@ SearchCore(
do {
int ch;
const char *p;
- size_t lastFullLine = lastOffset;
+ TkSizeT lastFullLine = lastOffset;
if (firstNewLine == -1) {
if (searchSpecPtr->strictLimits
- && (firstOffset + matchLength + 1 > (size_t)lastOffset + 1)) {
+ && (firstOffset + matchLength + 1 > (TkSizeT)lastOffset + 1)) {
/*
* Not enough characters to match.
*/
@@ -6090,7 +6090,7 @@ SearchCore(
* exact searches.
*/
- if ((size_t)lastTotal - skipFirst + 1 >= matchLength + 1) {
+ if ((TkSizeT)lastTotal - skipFirst + 1 >= matchLength + 1) {
/*
* We now have enough text to match, so we
* make a final test and break whatever the
@@ -6172,7 +6172,7 @@ SearchCore(
}
} else {
firstOffset = matchLength ? p - startOfLine + matchLength
- : p - startOfLine + (size_t)1;
+ : p - startOfLine + (TkSizeT)1;
if (firstOffset >= lastOffset) {
/*
* Now, we have to be careful not to find
@@ -6212,7 +6212,7 @@ SearchCore(
do {
Tcl_RegExpInfo info;
int match;
- size_t lastFullLine = lastOffset;
+ TkSizeT lastFullLine = lastOffset;
match = Tcl_RegExpExecObj(interp, regexp, theLine,
firstOffset, 1, (firstOffset>0 ? TCL_REG_NOTBOL : 0));
@@ -6230,9 +6230,9 @@ SearchCore(
if (!match ||
((info.extendStart == info.matches[0].start)
- && ((size_t) info.matches[0].end == (size_t) lastOffset - firstOffset))) {
+ && ((TkSizeT) info.matches[0].end == (TkSizeT) lastOffset - firstOffset))) {
int extraLines = 0;
- size_t prevFullLine;
+ TkSizeT prevFullLine;
/*
* If we find a match that overlaps more than one line, we
@@ -6248,7 +6248,7 @@ SearchCore(
lastNonOverlap = lastTotal;
}
- if ((size_t) info.extendStart == (size_t) -1) {
+ if ((TkSizeT) info.extendStart == TCL_AUTO_LENGTH) {
/*
* No multi-line match is possible.
*/
@@ -6345,9 +6345,9 @@ SearchCore(
*/
if ((match &&
- firstOffset+(size_t) info.matches[0].end != (size_t) lastTotal &&
- firstOffset+(size_t) info.matches[0].end + 1 < prevFullLine + 1)
- || (size_t) info.extendStart == (size_t) -1) {
+ firstOffset + (TkSizeT) info.matches[0].end != (TkSizeT) lastTotal &&
+ firstOffset + (TkSizeT) info.matches[0].end + 1 < prevFullLine + 1)
+ || (TkSizeT) info.extendStart == TCL_AUTO_LENGTH) {
break;
}
@@ -6358,10 +6358,10 @@ SearchCore(
* that line.
*/
- if (match && ((size_t) info.matches[0].start + 1 >= (size_t) lastOffset + 1)) {
+ if (match && ((TkSizeT) info.matches[0].start + 1 >= (TkSizeT) lastOffset + 1)) {
break;
}
- if (match && ((firstOffset + (size_t) info.matches[0].end)
+ if (match && ((firstOffset + (TkSizeT) info.matches[0].end)
>= prevFullLine)) {
if (extraLines > 0) {
extraLinesSearched = extraLines - 1;
@@ -6415,7 +6415,7 @@ SearchCore(
* Possible overlap or enclosure.
*/
- if ((size_t)thisOffset - lastNonOverlap >=
+ if ((TkSizeT)thisOffset - lastNonOverlap >=
lastBackwardsMatchOffset + matchLength + 1){
/*
* Totally encloses previous match, so
@@ -6497,11 +6497,11 @@ SearchCore(
* previous match.
*/
- if (matchOffset == (size_t)-1 ||
+ if (matchOffset == TCL_AUTO_LENGTH ||
((searchSpecPtr->all || searchSpecPtr->backwards)
- && (((size_t)firstOffset + 1< matchOffset + 1)
- || ((firstOffset + (size_t) info.matches[0].end
- - (size_t) info.matches[0].start)
+ && (((TkSizeT)firstOffset + 1< matchOffset + 1)
+ || ((firstOffset + (TkSizeT) info.matches[0].end
+ - (TkSizeT) info.matches[0].start)
> matchOffset + matchLength)))) {
matchOffset = firstOffset;
@@ -6520,11 +6520,11 @@ SearchCore(
* matches on the heap.
*/
- size_t *newArray =
- ckalloc(4 * matchNum * sizeof(size_t));
- memcpy(newArray, storeMatch, matchNum*sizeof(size_t));
+ TkSizeT *newArray =
+ ckalloc(4 * matchNum * sizeof(TkSizeT));
+ memcpy(newArray, storeMatch, matchNum*sizeof(TkSizeT));
memcpy(newArray + 2*matchNum, storeLength,
- matchNum * sizeof(int));
+ matchNum * sizeof(TkSizeT));
if (storeMatch != smArray) {
ckfree(storeMatch);
}
@@ -6665,7 +6665,7 @@ SearchCore(
* we are done.
*/
- if ((lastBackwardsLineMatch == -1) && (matchOffset != (size_t) -1)
+ if ((lastBackwardsLineMatch == -1) && (matchOffset != TCL_AUTO_LENGTH)
&& !searchSpecPtr->all) {
searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr, lineInfo,
theLine, matchOffset, matchLength);
@@ -6940,7 +6940,7 @@ TkpTesttextCmd(
Tcl_Obj *const objv[]) /* Argument strings. */
{
TkText *textPtr;
- size_t len;
+ TkSizeT len;
int lineIndex, byteIndex, byteOffset;
TkTextIndex index;
char buf[64];
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 66ff744..bd1250f 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -6153,7 +6153,7 @@ TkTextYviewCmd(
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
int pickPlace, type;
int pixels, count;
- size_t switchLength;
+ TkSizeT switchLength;
double fraction;
TkTextIndex index;
@@ -6172,7 +6172,7 @@ TkTextYviewCmd(
pickPlace = 0;
if (Tcl_GetString(objv[2])[0] == '-') {
- register const char *switchStr =
+ const char *switchStr =
TkGetStringFromObj(objv[2], &switchLength);
if ((switchLength >= 2) && (strncmp(switchStr, "-pickplace",
diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c
index da455d3..958b84a 100644
--- a/generic/tkTextMark.c
+++ b/generic/tkTextMark.c
@@ -126,7 +126,7 @@ TkTextMarkCmd(
switch ((enum markOptions) optionIndex) {
case MARK_GRAVITY: {
char c;
- size_t length;
+ TkSizeT length;
const char *str;
if (objc < 4 || objc > 5) {
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index e20bf58..f1afe36 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.c
@@ -1108,7 +1108,7 @@ FindTag(
Tcl_Obj *tagName) /* Name of desired tag. */
{
Tcl_HashEntry *hPtr;
- size_t len;
+ TkSizeT len;
const char *str;
str = TkGetStringFromObj(tagName, &len);
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index 6850f47..2950fe0 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -729,7 +729,7 @@ Tk_GetScrollInfoObj(
int *intPtr) /* Filled in with number of pages or lines to
* scroll, if any. */
{
- size_t length;
+ TkSizeT length;
const char *arg = TkGetStringFromObj(objv[2], &length);
#define ArgPfxEq(str) \
@@ -1272,24 +1272,17 @@ size_t TkUniCharToUtf(int ch, char *buf)
#endif
+#if TCL_MAJOR_VERSION > 8
unsigned char *
TkGetByteArrayFromObj(
Tcl_Obj *objPtr,
size_t *lengthPtr
) {
- int length;
-
- unsigned char *result = Tcl_GetByteArrayFromObj(objPtr, &length);
-#if TCL_MAJOR_VERSION > 8
- if (sizeof(TCL_HASH_TYPE) > sizeof(int)) {
- /* 64-bit and TIP #494 situation: */
- *lengthPtr = *(TCL_HASH_TYPE *) objPtr->internalRep.twoPtrValue.ptr1;
- } else
-#endif
- /* 32-bit or without TIP #494 */
- *lengthPtr = (size_t) (unsigned) length;
+ unsigned char *result = Tcl_GetByteArrayFromObj(objPtr, NULL);
+ *lengthPtr = *(size_t *) objPtr->internalRep.twoPtrValue.ptr1;
return result;
}
+#endif /* TCL_MAJOR_VERSION > 8 */
/*
* Local Variables:
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index d8c2068..fd83e2c 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -3202,7 +3202,7 @@ Initialize(
*/
{
- size_t numBytes;
+ TkSizeT numBytes;
const char *bytes = TkGetStringFromObj(nameObj, &numBytes);
classObj = Tcl_NewStringObj(bytes, numBytes);
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index 3fc0c36..4e702be 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -315,7 +315,7 @@ static char *EntryDisplayString(const char *showChar, int numChars)
*/
static void EntryUpdateTextLayout(Entry *entryPtr)
{
- size_t length;
+ TkSizeT length;
char *text;
Tk_FreeTextLayout(entryPtr->entry.textLayout);
if ((entryPtr->entry.numChars != 0) || (entryPtr->entry.placeholderObj == NULL)) {
@@ -1362,7 +1362,7 @@ EntryIndex(
int *indexPtr) /* Return value */
{
# define EntryWidth(e) (Tk_Width(entryPtr->core.tkwin)) /* Not Right */
- size_t length;
+ TkSizeT length;
const char *string = TkGetStringFromObj(indexObj, &length);
if (strncmp(string, "end", length) == 0) {