summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-02-01 15:49:33 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-02-01 15:49:33 (GMT)
commit6c9d67ac2ce6b610bb42688c03d6abf8e99f2a6b (patch)
treee0af1794b6829d3f838125af8b8c1f94632a35fc /generic
parent88df780305133662dbb17971c05b9663a2b69f9d (diff)
downloadtk-6c9d67ac2ce6b610bb42688c03d6abf8e99f2a6b.zip
tk-6c9d67ac2ce6b610bb42688c03d6abf8e99f2a6b.tar.gz
tk-6c9d67ac2ce6b610bb42688c03d6abf8e99f2a6b.tar.bz2
some more int -> size_t changes
Diffstat (limited to 'generic')
-rw-r--r--generic/tkCanvLine.c5
-rw-r--r--generic/tkCanvPoly.c5
-rw-r--r--generic/tkCanvas.c7
-rw-r--r--generic/tkCmds.c2
-rw-r--r--generic/tkOldConfig.c2
-rw-r--r--generic/tkPack.c14
-rw-r--r--generic/tkTest.c12
-rw-r--r--generic/tkText.c28
-rw-r--r--generic/tkUtil.c7
9 files changed, 43 insertions, 39 deletions
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index 9d68c37..087aa56 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -1743,11 +1743,10 @@ GetLineIndex(
int *indexPtr) /* Where to store converted index. */
{
LineItem *linePtr = (LineItem *) itemPtr;
- int length;
- const char *string = Tcl_GetStringFromObj(obj, &length);
+ const char *string = Tcl_GetString(obj);
if (string[0] == 'e') {
- if (strncmp(string, "end", (unsigned) length) == 0) {
+ if (strncmp(string, "end", obj->length) == 0) {
*indexPtr = 2*linePtr->numPoints;
} else {
goto badIndex;
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index f8ea42b..b4ef098 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.c
@@ -1673,11 +1673,10 @@ GetPolygonIndex(
int *indexPtr) /* Where to store converted index. */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
- int length;
- const char *string = Tcl_GetStringFromObj(obj, &length);
+ const char *string = Tcl_GetString(obj);
if (string[0] == 'e') {
- if (strncmp(string, "end", (unsigned)length) != 0) {
+ if (strncmp(string, "end", obj->length) != 0) {
goto badIndex;
}
*indexPtr = 2*(polyPtr->numPoints - polyPtr->autoClosed);
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 6972b18..23d8e04 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -1242,14 +1242,15 @@ CanvasWidgetCmd(
int isNew = 0;
Tcl_HashEntry *entryPtr;
const char *arg;
- int length;
+ size_t length;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "type coords ?arg ...?");
result = TCL_ERROR;
goto done;
}
- arg = Tcl_GetStringFromObj(objv[2], &length);
+ arg = Tcl_GetString(objv[2]);
+ length = objv[2]->length;
c = arg[0];
/*
@@ -1261,7 +1262,7 @@ CanvasWidgetCmd(
Tcl_MutexLock(&typeListMutex);
for (typePtr = typeList; typePtr != NULL; typePtr = typePtr->nextPtr){
if ((c == typePtr->name[0])
- && (!strncmp(arg, typePtr->name, (unsigned)length))) {
+ && (!strncmp(arg, typePtr->name, length))) {
if (matchPtr != NULL) {
Tcl_MutexUnlock(&typeListMutex);
goto badType;
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index f203c4c..9f0097e 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -452,7 +452,7 @@ TkFreeBindingTags(
* have to be freed.
*/
- ckfree(p);
+ ckfree((char *)p);
}
}
ckfree(winPtr->tagPtr);
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index a77edce..d2d864f 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.c
@@ -718,7 +718,7 @@ FormatConfigInfo(
result = Tcl_Merge(5, argv);
if (freeProc != NULL) {
if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) {
- ckfree(argv[4]);
+ ckfree((char *) argv[4]);
} else {
freeProc((char *) argv[4]);
}
diff --git a/generic/tkPack.c b/generic/tkPack.c
index 8428f09..88a4b2d 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -1101,7 +1101,6 @@ PackAfter(
{
register Packer *packPtr;
Tk_Window tkwin, ancestor, parent;
- int length;
Tcl_Obj **options;
int index, optionCount, c;
@@ -1170,24 +1169,25 @@ PackAfter(
packPtr->flags |= OLD_STYLE;
for (index = 0 ; index < optionCount; index++) {
Tcl_Obj *curOptPtr = options[index];
- const char *curOpt = Tcl_GetStringFromObj(curOptPtr, &length);
+ const char *curOpt = Tcl_GetString(curOptPtr);
+ size_t length = curOptPtr->length;
c = curOpt[0];
if ((c == 't')
- && (strncmp(curOpt, "top", (size_t) length)) == 0) {
+ && (strncmp(curOpt, "top", length)) == 0) {
packPtr->side = TOP;
} else if ((c == 'b')
- && (strncmp(curOpt, "bottom", (size_t) length)) == 0) {
+ && (strncmp(curOpt, "bottom", length)) == 0) {
packPtr->side = BOTTOM;
} else if ((c == 'l')
- && (strncmp(curOpt, "left", (size_t) length)) == 0) {
+ && (strncmp(curOpt, "left", length)) == 0) {
packPtr->side = LEFT;
} else if ((c == 'r')
- && (strncmp(curOpt, "right", (size_t) length)) == 0) {
+ && (strncmp(curOpt, "right", length)) == 0) {
packPtr->side = RIGHT;
} else if ((c == 'e')
- && (strncmp(curOpt, "expand", (size_t) length)) == 0) {
+ && (strncmp(curOpt, "expand", length)) == 0) {
packPtr->flags |= EXPAND;
} else if ((c == 'f')
&& (strcmp(curOpt, "fill")) == 0) {
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 782af01..ca0aa6a 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -1981,7 +1981,7 @@ CustomOptionSet(
char *saveInternalPtr,
int flags)
{
- int objEmpty, length;
+ int objEmpty;
char *newStr, *string, *internalPtr;
objEmpty = 0;
@@ -2002,14 +2002,14 @@ CustomOptionSet(
} else if ((*value)->bytes != NULL) {
objEmpty = ((*value)->length == 0);
} else {
- (void)Tcl_GetStringFromObj(*value, &length);
- objEmpty = (length == 0);
+ (void)Tcl_GetString(*value);
+ objEmpty = ((*value)->length == 0);
}
if ((flags & TK_OPTION_NULL_OK) && objEmpty) {
*value = NULL;
} else {
- string = Tcl_GetStringFromObj(*value, &length);
+ string = Tcl_GetString(*value);
Tcl_UtfToUpper(string);
if (strcmp(string, "BAD") == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("expected good value, got \"BAD\"", -1));
@@ -2018,8 +2018,8 @@ CustomOptionSet(
}
if (internalPtr != NULL) {
if (*value != NULL) {
- string = Tcl_GetStringFromObj(*value, &length);
- newStr = ckalloc(length + 1);
+ string = Tcl_GetString(*value);
+ newStr = ckalloc((*value)->length + 1);
strcpy(newStr, string);
} else {
newStr = NULL;
diff --git a/generic/tkText.c b/generic/tkText.c
index 07de6ee..b36b136 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -859,9 +859,10 @@ TextWidgetObjCmd(
for (i = 2; i < objc-2; i++) {
int value, length;
- const char *option = Tcl_GetStringFromObj(objv[i], &length);
+ const char *option = Tcl_GetString(objv[i]);
char c;
+ length = objv[i]->length;
if (length < 2 || option[0] != '-') {
goto badOption;
}
@@ -1260,12 +1261,14 @@ TextWidgetObjCmd(
i = 2;
if (objc > 3) {
- name = Tcl_GetStringFromObj(objv[i], &length);
+ name = Tcl_GetString(objv[i]);
+ length = objv[i]->length;
if (length > 1 && name[0] == '-') {
if (strncmp("-displaychars", name, (unsigned) length) == 0) {
i++;
visible = 1;
- name = Tcl_GetStringFromObj(objv[i], &length);
+ name = Tcl_GetString(objv[i]);
+ length = objv[i]->length;
}
if ((i < objc-1) && (length == 2) && !strcmp("--", name)) {
i++;
@@ -2552,9 +2555,9 @@ InsertChars(
int *lineAndByteIndex;
int resetViewCount;
int pixels[2*PIXEL_CLIENTS];
+ const char *string = Tcl_GetString(stringPtr);
- const char *string = Tcl_GetStringFromObj(stringPtr, &length);
-
+ length = stringPtr->length;
if (sharedTextPtr == NULL) {
sharedTextPtr = textPtr->sharedTextPtr;
}
@@ -4093,7 +4096,8 @@ TextSearchAddNextLine(
if (lenPtr != NULL) {
if (searchSpecPtr->exact) {
- Tcl_GetStringFromObj(theLine, lenPtr);
+ (void)Tcl_GetString(theLine);
+ *lenPtr = theLine->length;
} else {
*lenPtr = Tcl_GetCharLength(theLine);
}
@@ -4619,7 +4623,8 @@ TextDumpCmd(
if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) {
return TCL_ERROR;
}
- str = Tcl_GetStringFromObj(objv[arg], &length);
+ str = Tcl_GetString(objv[arg]);
+ length = objv[arg]->length;
if (strncmp(str, "end", (unsigned) length) == 0) {
atEnd = 1;
}
@@ -5541,7 +5546,8 @@ SearchCore(
* it has dual purpose.
*/
- pattern = Tcl_GetStringFromObj(patObj, &matchLength);
+ pattern = Tcl_GetString(patObj);
+ matchLength = patObj->length;
nl = strchr(pattern, '\n');
/*
@@ -6609,16 +6615,14 @@ static int
ObjectIsEmpty(
Tcl_Obj *objPtr) /* Object to test. May be NULL. */
{
- int length;
-
if (objPtr == NULL) {
return 1;
}
if (objPtr->bytes != NULL) {
return (objPtr->length == 0);
}
- (void)Tcl_GetStringFromObj(objPtr, &length);
- return (length == 0);
+ (void)Tcl_GetString(objPtr);
+ return (objPtr->length == 0);
}
/*
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index 0290c94..7ff9ecb 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -729,8 +729,8 @@ Tk_GetScrollInfoObj(
int *intPtr) /* Filled in with number of pages or lines to
* scroll, if any. */
{
- int length;
- const char *arg = Tcl_GetStringFromObj(objv[2], &length);
+ const char *arg = Tcl_GetString(objv[2]);
+ size_t length = objv[2]->length;
#define ArgPfxEq(str) \
((arg[0] == str[0]) && !strncmp(arg, str, (unsigned)length))
@@ -753,7 +753,8 @@ Tk_GetScrollInfoObj(
return TK_SCROLL_ERROR;
}
- arg = Tcl_GetStringFromObj(objv[4], &length);
+ arg = Tcl_GetString(objv[4]);
+ length = objv[4]->length;
if (ArgPfxEq("pages")) {
return TK_SCROLL_PAGES;
} else if (ArgPfxEq("units")) {