summaryrefslogtreecommitdiffstats
path: root/generic/tclObj.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-07-01 06:21:55 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-07-01 06:21:55 (GMT)
commit3dc03bc4ac97274d4f260b16b1b7f5e5d550666a (patch)
tree7e8cec9383e19d9a5599cc2f6e21dcdbb6836db4 /generic/tclObj.c
parent94741577ee73184dd04e947e9a87bc9227c4ebab (diff)
downloadtcl-3dc03bc4ac97274d4f260b16b1b7f5e5d550666a.zip
tcl-3dc03bc4ac97274d4f260b16b1b7f5e5d550666a.tar.gz
tcl-3dc03bc4ac97274d4f260b16b1b7f5e5d550666a.tar.bz2
Starting to update all callers of TclGetStringFromObj() to use size_t variables
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r--generic/tclObj.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 640900a..857c1f0 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -606,7 +606,8 @@ TclContinuationsEnterDerived(
int start,
int *clNext)
{
- int length, end, num;
+ size_t length;
+ int end, num;
int *wordCLLast = clNext;
/*
@@ -633,7 +634,7 @@ TclContinuationsEnterDerived(
* better way which doesn't shimmer?)
*/
- TclGetStringFromObj(objPtr, &length);
+ (void)TclGetStringFromObj(objPtr, &length);
end = start + length; /* First char after the word */
/*
@@ -1803,7 +1804,7 @@ TclSetBooleanFromAny(
badBoolean:
if (interp != NULL) {
- int length;
+ size_t length;
const char *str = TclGetStringFromObj(objPtr, &length);
Tcl_Obj *msg;
@@ -1822,8 +1823,8 @@ ParseBoolean(
{
int newBool;
char lowerCase[6];
- const char *str = TclGetString(objPtr);
- size_t i, length = objPtr->length;
+ size_t i, length;
+ const char *str = TclGetStringFromObj(objPtr, &length);
if ((length == 0) || (length > 5)) {
/*
@@ -2177,14 +2178,14 @@ UpdateStringOfDouble(
register Tcl_Obj *objPtr) /* Double obj with string rep to update. */
{
char buffer[TCL_DOUBLE_SPACE];
- register int len;
+ size_t len;
Tcl_PrintDouble(NULL, objPtr->internalRep.doubleValue, buffer);
len = strlen(buffer);
- objPtr->bytes = ckalloc(len + 1);
- memcpy(objPtr->bytes, buffer, (unsigned) len + 1);
objPtr->length = len;
+ objPtr->bytes = ckalloc(++len);
+ memcpy(objPtr->bytes, buffer, len);
}
/*
@@ -2293,13 +2294,13 @@ UpdateStringOfInt(
register Tcl_Obj *objPtr) /* Int object whose string rep to update. */
{
char buffer[TCL_INTEGER_SPACE];
- register int len;
+ size_t len;
len = TclFormatInt(buffer, objPtr->internalRep.wideValue);
+ objPtr->length = len;
objPtr->bytes = ckalloc(len + 1);
memcpy(objPtr->bytes, buffer, (unsigned) len + 1);
- objPtr->length = len;
}
/*