summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstanton <stanton>1999-05-03 19:19:03 (GMT)
committerstanton <stanton>1999-05-03 19:19:03 (GMT)
commitf6a3092a5a7c9cae226fa90d90f7859359042ffa (patch)
treeaa7b6cb1593cd98967663f168531c6770b566c18
parent98d911dd458ceb02d94c4f97769cf2340fb127cc (diff)
downloadtcl-f6a3092a5a7c9cae226fa90d90f7859359042ffa.zip
tcl-f6a3092a5a7c9cae226fa90d90f7859359042ffa.tar.gz
tcl-f6a3092a5a7c9cae226fa90d90f7859359042ffa.tar.bz2
* tests/binary.test:
* generic/tclBinary.c (DupByteArrayInternalRep): Fixed bug where type was not being set in duplicated object.
-rw-r--r--generic/tclBinary.c4
-rw-r--r--tests/binary.test12
2 files changed, 14 insertions, 2 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 5156465..4c55c40 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBinary.c,v 1.5 1999/04/16 00:46:42 stanton Exp $
+ * RCS: @(#) $Id: tclBinary.c,v 1.6 1999/05/03 19:19:03 stanton Exp $
*/
#include <math.h>
@@ -457,6 +457,8 @@ DupByteArrayInternalRep(srcPtr, copyPtr)
memcpy((VOID *) copyArrayPtr->bytes, (VOID *) srcArrayPtr->bytes,
(size_t) length);
SET_BYTEARRAY(copyPtr, copyArrayPtr);
+
+ copyPtr->typePtr = &tclByteArrayType;
}
/*
diff --git a/tests/binary.test b/tests/binary.test
index 1399edd..c0da86b 100644
--- a/tests/binary.test
+++ b/tests/binary.test
@@ -10,12 +10,22 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: binary.test,v 1.3 1999/04/16 00:47:23 stanton Exp $
+# RCS: @(#) $Id: binary.test,v 1.4 1999/05/03 19:19:04 stanton Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
}
+test binary-2.1 {DupByteArrayInternalRep} {
+ set hdr [binary format cc 0 0316]
+ set buf hellomatt
+
+ set data $hdr
+ append data $buf
+
+ string length $data
+} 11
+
test binary-1.1 {Tcl_BinaryObjCmd: bad args} {
list [catch {binary} msg] $msg
} {1 {wrong # args: should be "binary option ?arg arg ...?"}}