summaryrefslogtreecommitdiffstats
path: root/generic/tclBinary.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclBinary.c')
-rw-r--r--generic/tclBinary.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 4d063b2..a3e5071 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -172,7 +172,7 @@ static const EnsembleImplMap decodeMap[] = {
* where the codepoint of each character is the value of corresponding byte.
* This approach creates a one-to-one map between all bytearray values
* and a subset of Tcl string values.
- *
+ *
* When converting a Tcl string value to the bytearray internal rep, the
* question arises what to do with strings outside that subset? That is,
* those Tcl strings containing at least one codepoint greater than 255?
@@ -180,7 +180,7 @@ static const EnsembleImplMap decodeMap[] = {
* does not represent any valid bytearray value. Full Stop. The
* setFromAnyProc signature has a completion code return value for just
* this reason, to reject invalid inputs.
- *
+ *
* Unfortunately this was not the path taken by the authors of the
* original tclByteArrayType. They chose to accept all Tcl string values
* as acceptable string encodings of the bytearray values that result
@@ -204,7 +204,7 @@ static const EnsembleImplMap decodeMap[] = {
* unsigned char *Tcl_GetByteArrayFromObj(objPtr, lenPtr)
*
* has a guarantee to always return a non-NULL value, but that value
- * points to a byte sequence that cannot be used by the caller to
+ * points to a byte sequence that cannot be used by the caller to
* process the Tcl value absent some sideband testing that objPtr
* is "pure". Tcl offers no public interface to perform this test,
* so callers either break encapsulation or are unavoidably buggy. Tcl
@@ -218,7 +218,7 @@ static const EnsembleImplMap decodeMap[] = {
* Bytearrays should simply be usable as bytearrays without a kabuki
* dance of testing.
*
- * The Tcl_ObjType "properByteArrayType" is (nearly) a correct
+ * The Tcl_ObjType "properByteArrayType" is (nearly) a correct
* implementation of bytearrays. Any Tcl value with the type
* properByteArrayType can have its bytearray value fetched and
* used with confidence that acting on that value is equivalent to
@@ -531,7 +531,8 @@ SetByteArrayFromAny(
Tcl_Interp *interp, /* Not used. */
Tcl_Obj *objPtr) /* The object to convert to type ByteArray. */
{
- int length, improper = 0;
+ size_t length;
+ int improper = 0;
const char *src, *srcEnd;
unsigned char *dst;
ByteArray *byteArrayPtr;
@@ -544,7 +545,8 @@ SetByteArrayFromAny(
return TCL_OK;
}
- src = TclGetStringFromObj(objPtr, &length);
+ src = TclGetString(objPtr);
+ length = objPtr->length;
srcEnd = src + length;
byteArrayPtr = ckalloc(BYTEARRAY_SIZE(length));