summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclBinary.c19
-rw-r--r--generic/tclIOUtil.c17
2 files changed, 19 insertions, 17 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 429f7c1..314e9fd 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -208,7 +208,7 @@ TclIsPureByteArray(
* from the given array of bytes.
*
* Results:
- * The newly create object is returned. This object will have no initial
+ * The newly created object is returned. This object has no initial
* string representation. The returned object has a ref count of 0.
*
* Side effects:
@@ -223,7 +223,8 @@ Tcl_Obj *
Tcl_NewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
- Tcl_Size numBytes) /* Number of bytes in the array */
+ Tcl_Size numBytes) /* Number of bytes in the array,
+ * must be >= 0. */
{
#ifdef TCL_MEM_DEBUG
return Tcl_DbNewByteArrayObj(bytes, numBytes, "unknown", 0);
@@ -266,7 +267,8 @@ Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
- Tcl_Size numBytes, /* Number of bytes in the array */
+ Tcl_Size numBytes, /* Number of bytes in the array,
+ * must be >= 0. */
const char *file, /* The name of the source file calling this
* procedure; used for debugging. */
int line) /* Line number in the source file; used for
@@ -283,7 +285,8 @@ Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
- Tcl_Size numBytes, /* Number of bytes in the array */
+ Tcl_Size numBytes, /* Number of bytes in the array,
+ * must be >= 0. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
@@ -314,8 +317,8 @@ Tcl_SetByteArrayObj(
Tcl_Obj *objPtr, /* Object to initialize as a ByteArray. */
const unsigned char *bytes, /* The array of bytes to use as the new value.
* May be NULL even if numBytes > 0. */
- Tcl_Size numBytes) /* Number of bytes in the array.
- * Must be >= 0 */
+ Tcl_Size numBytes) /* Number of bytes in the array,
+ * must be >= 0 */
{
ByteArray *byteArrayPtr;
Tcl_ObjInternalRep ir;
@@ -1405,7 +1408,7 @@ BinaryScanCmd(
if (count == BINARY_NOCOUNT) {
count = 1;
}
- if (count > length - offset) {
+ if (count > (length - offset)) {
goto done;
}
}
@@ -1603,7 +1606,7 @@ BinaryScanCmd(
goto badIndex;
}
if (count == BINARY_NOCOUNT) {
- if (length < size + offset) {
+ if (length < (size + offset)) {
goto done;
}
valuePtr = ScanNumber(buffer+offset, cmd, flags,
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 921d79e..df218b3 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -1802,12 +1802,12 @@ Tcl_FSEvalFileEx(
*/
const char *pathString = Tcl_GetStringFromObj(pathPtr, &length);
- unsigned limit = 150;
- int overflow = ((unsigned)length > limit);
+ int limit = 150;
+ int overflow = (length > limit);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (file \"%.*s%s\" line %d)",
- (overflow ? limit : (unsigned)length), pathString,
+ (overflow ? limit : (int)length), pathString,
(overflow ? "..." : ""), Tcl_GetErrorLine(interp)));
}
@@ -1955,12 +1955,12 @@ EvalFileCallback(
Tcl_Size length;
const char *pathString = Tcl_GetStringFromObj(pathPtr, &length);
- const unsigned limit = 150;
- int overflow = ((unsigned)length > limit);
+ const int limit = 150;
+ int overflow = (length > limit);
Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf(
"\n (file \"%.*s%s\" line %d)",
- (overflow ? limit : (unsigned)length), pathString,
+ (overflow ? limit : (int)length), pathString,
(overflow ? "..." : ""), Tcl_GetErrorLine(interp)));
}
@@ -3798,7 +3798,6 @@ FsListMounts(
*---------------------------------------------------------------------------
*/
-#undef Tcl_FSSplitPath
Tcl_Obj *
Tcl_FSSplitPath(
Tcl_Obj *pathPtr, /* The pathname to split. */
@@ -3862,8 +3861,8 @@ Tcl_FSSplitPath(
length = p - elementStart;
if (length > 0) {
Tcl_Obj *nextElt;
- nextElt = Tcl_NewStringObj(elementStart, length);
- Tcl_ListObjAppendElement(NULL, result, nextElt);
+ nextElt = Tcl_NewStringObj(elementStart, length);
+ Tcl_ListObjAppendElement(NULL, result, nextElt);
}
if (*p++ == '\0') {
break;