summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 0acc6e2..959a221 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -2481,14 +2481,14 @@ Tcl_AppendFormatToObj(
*p++ = '+';
}
if (width) {
- p += sprintf(p, "%d", width);
+ p += snprintf(p, TCL_INTEGER_SPACE, "%d", width);
if (width > length) {
length = width;
}
}
if (gotPrecision) {
*p++ = '.';
- p += sprintf(p, "%d", precision);
+ p += snprintf(p, TCL_INTEGER_SPACE, "%d", precision);
if (precision > INT_MAX - length) {
msg = overflow;
errCode = "OVERFLOW";
@@ -2512,7 +2512,7 @@ Tcl_AppendFormatToObj(
goto errorMsg;
}
bytes = TclGetString(segment);
- if (!Tcl_AttemptSetObjLength(segment, sprintf(bytes, spec, d))) {
+ if (!Tcl_AttemptSetObjLength(segment, snprintf(bytes, segment->length, spec, d))) {
msg = overflow;
errCode = "OVERFLOW";
goto errorMsg;
@@ -2960,13 +2960,11 @@ TclStringRepeat(
/* Result will be pure byte array. Pre-size it */
(void)Tcl_GetByteArrayFromObj(objPtr, &length);
maxCount = TCL_SIZE_SMAX;
- }
- else if (unichar) {
+ } else if (unichar) {
/* Result will be pure Tcl_UniChar array. Pre-size it. */
(void)Tcl_GetUnicodeFromObj(objPtr, &length);
maxCount = TCL_SIZE_SMAX/sizeof(Tcl_UniChar);
- }
- else {
+ } else {
/* Result will be concat of string reps. Pre-size it. */
(void)Tcl_GetStringFromObj(objPtr, &length);
maxCount = TCL_SIZE_SMAX;
@@ -4168,7 +4166,7 @@ TclStringReplace(
* FillUnicodeRep --
*
* Populate the Unicode internal rep with the Unicode form of its string
- * rep. The object must alread have a "String" internal rep.
+ * rep. The object must already have a "String" internal rep.
*
* Results:
* None.
@@ -4318,7 +4316,7 @@ DupStringInternalRep(
* This operation always succeeds and returns TCL_OK.
*
* Side effects:
- * Any old internal reputation for objPtr is freed and the internal
+ * Any old internal representation for objPtr is freed and the internal
* representation is set to "String".
*
*----------------------------------------------------------------------