OriginalBugID: 1975 Bug
Version: 8.1
SubmitDate: '1999-05-04'
LastModified: '1999-05-14'
Severity: SER
Status: Released
Submitter: pat
ChangedBy: stanton
RelatedBugIDs: 2047
OS: Windows NT
Machine: X86
FixedDate: '1999-05-07'
FixedInVersion: 8.1.1
ClosedDate: '2000-10-25'
Name:
Matt Newman
Extensions:
BLT, INCRTCL, TCLX, TNSS, TRF, TCLODBC, SENTCL, LDAP.....
CustomShell:
Not yet - at last tcl has a binary safe "after" command.
Comments:
The bug is that when dup'ing the internal rep of a ByteArray it doesn't
set the new objects typePtr - which remains NULL so that when append is
called the object is assumed to contain no data.
ReproducibleScript:
set hdr [binary format cc 0 0316]
set buf hellomatt
set data $hdr
#UNCOMMENT TO MAKE WORK!!!#string length $data
append data $buf
if {[string length $data] == 11} {
tclLog GOOD
} else {
tclLog "BAD: expected 11, got [string length $data]"
}
ObservedBehavior:
Length is returned as 9 not 11. In fact if you uncomment the string
length $data line it forces an update of the internal string rep then
the script succeeds.
DesiredBehavior:
Length of 11
Patch:
diff -c -r1.1.1.2 tclBinary.c
*** tclBinary.c 1999/05/02 23:44:25 1.1.1.2
--- tclBinary.c 1999/05/03 13:37:47
***************
*** 457,462 ****
--- 457,463 ----
memcpy((VOID *) copyArrayPtr->bytes, (VOID *) srcArrayPtr->bytes,
(size_t) length);
SET_BYTEARRAY(copyPtr, copyArrayPtr);
+ copyPtr->typePtr = &tclByteArrayType;
}
♀
/*
PatchFiles:
generic/tclBinary.c
|