From 2a1443e0e07d217161b094cf6e550f63ef2cab54 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 14 Nov 2022 17:23:52 +0000 Subject: Test suite hygiene - Several tests missing the "testdstring" constraint - [package require tcltests] is fragile, and almost all test files that had it were not making use of anything it provides. Removed. --- tests/chanio.test | 1 - tests/env.test | 2 -- tests/exec.test | 2 -- tests/io.test | 1 - tests/ioCmd.test | 2 -- tests/platform.test | 1 - tests/thread.test | 3 ++- tests/util.test | 10 +++++----- 8 files changed, 7 insertions(+), 15 deletions(-) diff --git a/tests/chanio.test b/tests/chanio.test index 5381a88..0f45819 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -34,7 +34,6 @@ namespace eval ::tcl::test::io { package require -exact Tcltest [info patchlevel] set ::tcltestlib [lindex [package ifneeded Tcltest [info patchlevel]] 1] } - package require tcltests testConstraint testbytestring [llength [info commands testbytestring]] testConstraint testchannel [llength [info commands testchannel]] diff --git a/tests/env.test b/tests/env.test index ff111e9..6c46532 100644 --- a/tests/env.test +++ b/tests/env.test @@ -16,8 +16,6 @@ if {"::tcltest" ni [namespace children]} { namespace import -force ::tcltest::* } -package require tcltests - # [exec] is required here to see the actual environment received by child # processes. proc getenv {} { diff --git a/tests/exec.test b/tests/exec.test index 0f5db76..4cc4a05 100644 --- a/tests/exec.test +++ b/tests/exec.test @@ -19,8 +19,6 @@ if {"::tcltest" ni [namespace children]} { namespace import -force ::tcltest::* } -package require tcltests - # All tests require the "exec" command. # Skip them if exec is not defined. testConstraint exec [llength [info commands exec]] diff --git a/tests/io.test b/tests/io.test index 94d8764..cd4c954 100644 --- a/tests/io.test +++ b/tests/io.test @@ -34,7 +34,6 @@ namespace eval ::tcl::test::io { package require -exact Tcltest [info patchlevel] set ::tcltestlib [lindex [package ifneeded Tcltest [info patchlevel]] 1] } - package require tcltests testConstraint testbytestring [llength [info commands testbytestring]] testConstraint testchannel [llength [info commands testchannel]] diff --git a/tests/ioCmd.test b/tests/ioCmd.test index 898d076..99bb464 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -21,8 +21,6 @@ if {"::tcltest" ni [namespace children]} { ::tcltest::loadTestedCommands catch [list package require -exact Tcltest [info patchlevel]] -package require tcltests - # Custom constraints used in this file testConstraint testchannel [llength [info commands testchannel]] diff --git a/tests/platform.test b/tests/platform.test index 042469b..6b775cf 100644 --- a/tests/platform.test +++ b/tests/platform.test @@ -10,7 +10,6 @@ # of this file, and for a DISCLAIMER OF ALL WARRANTIES. package require tcltest 2.5 -package require tcltests namespace eval ::tcl::test::platform { namespace import ::tcltest::testConstraint diff --git a/tests/thread.test b/tests/thread.test index 7c7dc27..28934a2 100644 --- a/tests/thread.test +++ b/tests/thread.test @@ -15,7 +15,8 @@ # when thread::release is used, -wait is passed in order allow the thread to # be fully finalized, which avoids valgrind "still reachable" reports. -package require tcltests +package require tcltest 2.5 +namespace import ::tcltest::* ::tcltest::loadTestedCommands catch [list package require -exact Tcltest [info patchlevel]] diff --git a/tests/util.test b/tests/util.test index d0b98a5..11ee3fa 100644 --- a/tests/util.test +++ b/tests/util.test @@ -528,7 +528,7 @@ test util-8.6 {TclNeedSpace - correct utf-8 handling} testdstring { testdstring append \} -1 list [llength [testdstring get]] [string length [testdstring get]] } {2 8} -test util-8.7 {TclNeedSpace - watch out for escaped space} { +test util-8.7 {TclNeedSpace - watch out for escaped space} testdstring { testdstring free testdstring append {\ } -1 testdstring start @@ -537,7 +537,7 @@ test util-8.7 {TclNeedSpace - watch out for escaped space} { # Should make {\ {}} list [llength [testdstring get]] [string index [testdstring get] 3] } {2 \{} -test util-8.8 {TclNeedSpace - watch out for escaped space} { +test util-8.8 {TclNeedSpace - watch out for escaped space} testdstring { testdstring free testdstring append {\\ } -1 testdstring start @@ -546,7 +546,7 @@ test util-8.8 {TclNeedSpace - watch out for escaped space} { # Should make {\\ {}} list [llength [testdstring get]] [string index [testdstring get] 3] } {2 \{} -test util-8.9 {TclNeedSpace - watch out for escaped space} { +test util-8.9 {TclNeedSpace - watch out for escaped space} testdstring { testdstring free testdstring append {\\\ } -1 testdstring start @@ -555,7 +555,7 @@ test util-8.9 {TclNeedSpace - watch out for escaped space} { # Should make {\\\ {}} list [llength [testdstring get]] [string index [testdstring get] 5] } {2 \{} -test util-8.10 {TclNeedSpace - watch out for escaped space} { +test util-8.10 {TclNeedSpace - watch out for escaped space} testdstring { testdstring free testdstring append {\\\\\\\ } -1 testdstring start @@ -564,7 +564,7 @@ test util-8.10 {TclNeedSpace - watch out for escaped space} { # Should make {\\\\\\\ {}} list [llength [testdstring get]] [string index [testdstring get] 9] } {2 \{} -test util-8.11 {TclNeedSpace - watch out for escaped space} { +test util-8.11 {TclNeedSpace - watch out for escaped space} testdstring { testdstring free testdstring append {\\\\\\\\ } -1 testdstring start -- cgit v0.12 From bc7b50deb01ade74b10ba048ed869537d7d8b1d1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 15 Nov 2022 22:09:09 +0000 Subject: Make httpd11.tcl work with Tcl 8.6 too --- tests/httpd11.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/httpd11.tcl b/tests/httpd11.tcl index 55b52fd..b605005 100644 --- a/tests/httpd11.tcl +++ b/tests/httpd11.tcl @@ -8,7 +8,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -package require tcl +package require Tcl proc ::tcl::dict::get? {dict key} { if {[dict exists $dict $key]} { -- cgit v0.12 From c432e303c0b17ee4dde9a3ec3bc1e04c381b32e3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 16 Nov 2022 09:37:42 +0000 Subject: http 2.10a4 -> 2.10b1, for upcoming release --- library/http/http.tcl | 2 +- library/http/pkgIndex.tcl | 2 +- library/manifest.txt | 2 +- unix/Makefile.in | 4 ++-- win/Makefile.in | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/library/http/http.tcl b/library/http/http.tcl index a1d4a2b..1f476f3 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -11,7 +11,7 @@ package require Tcl 8.6- # Keep this in sync with pkgIndex.tcl and with the install directories in # Makefiles -package provide http 2.10a4 +package provide http 2.10b1 namespace eval http { # Allow resourcing to not clobber existing data diff --git a/library/http/pkgIndex.tcl b/library/http/pkgIndex.tcl index 5437859..8977ef3 100644 --- a/library/http/pkgIndex.tcl +++ b/library/http/pkgIndex.tcl @@ -1,2 +1,2 @@ if {![package vsatisfies [package provide Tcl] 8.6-]} {return} -package ifneeded http 2.10a4 [list tclPkgSetup $dir http 2.10a4 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}] +package ifneeded http 2.10b1 [list tclPkgSetup $dir http 2.10b1 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}] diff --git a/library/manifest.txt b/library/manifest.txt index 6d999e8..cc1e223 100644 --- a/library/manifest.txt +++ b/library/manifest.txt @@ -5,7 +5,7 @@ apply {{dir} { set ::test [info script] set isafe [interp issafe] foreach {safe package version file} { - 0 http 2.10a4 {http http.tcl} + 0 http 2.10b1 {http http.tcl} 1 msgcat 1.7.1 {msgcat msgcat.tcl} 1 opt 0.4.8 {opt optparse.tcl} 0 cookiejar 0.2.0 {cookiejar cookiejar.tcl} diff --git a/unix/Makefile.in b/unix/Makefile.in index edcb010..dcaf6e3 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -1041,9 +1041,9 @@ install-libraries: libraries do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)/cookiejar0.2"; \ done - @echo "Installing package http 2.10a4 as a Tcl Module" + @echo "Installing package http 2.10b1 as a Tcl Module" @$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl \ - "$(MODULE_INSTALL_DIR)/8.6/http-2.10a4.tm" + "$(MODULE_INSTALL_DIR)/8.6/http-2.10b1.tm" @echo "Installing package opt0.4 files to $(SCRIPT_INSTALL_DIR)/opt0.4/" @for i in $(TOP_DIR)/library/opt/*.tcl; do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)/opt0.4"; \ diff --git a/win/Makefile.in b/win/Makefile.in index 8d28c9e..689f9b8 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -881,8 +881,8 @@ install-libraries: libraries install-tzdata install-msgs $(ROOT_DIR)/library/cookiejar/*.gz; do \ $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/cookiejar0.2"; \ done; - @echo "Installing package http 2.10a4 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/http/http.tcl "$(MODULE_INSTALL_DIR)/8.6/http-2.10a4.tm"; + @echo "Installing package http 2.10b1 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/http/http.tcl "$(MODULE_INSTALL_DIR)/8.6/http-2.10b1.tm"; @echo "Installing package opt 0.4.7"; @for j in $(ROOT_DIR)/library/opt/*.tcl; do \ $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/opt0.4"; \ -- cgit v0.12 From 00c7d174e45b9a5f10dc0de803dc98c4f1490061 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Thu, 17 Nov 2022 03:52:45 +0000 Subject: Reserve stub entry 687 for TIP #651 --- generic/tcl.decls | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/generic/tcl.decls b/generic/tcl.decls index adaaf7c..3f4103f 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2566,6 +2566,10 @@ declare 683 { # Tcl_WideUInt *uwidePtr) #} +# TIP 651 (reserved) +#declare 687 { +# Tcl_Obj *Tcl_DStringToObj(Tcl_DString *dsPtr) +#} # ----- BASELINE -- FOR -- 8.7.0 / 9.0.0 ----- # -- cgit v0.12 From 8b9fe0fa5355f282642f092c269ffa174813ba73 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 17 Nov 2022 11:18:51 +0000 Subject: doc update --- doc/OpenFileChnl.3 | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/OpenFileChnl.3 b/doc/OpenFileChnl.3 index 4e42b93..e8ed521 100644 --- a/doc/OpenFileChnl.3 +++ b/doc/OpenFileChnl.3 @@ -406,10 +406,10 @@ to UTF-8 based on the channel's encoding and storing the produced data in \fIreadObjPtr\fR's string representation. The return value of \fBTcl_ReadChars\fR is the number of characters, up to \fIcharsToRead\fR, that were stored in \fIreadObjPtr\fR. If an error occurs while reading, the -return value is \-1 and \fBTcl_ReadChars\fR records a POSIX error code that +return value is TCL_INDEX_NONE and \fBTcl_ReadChars\fR records a POSIX error code that can be retrieved with \fBTcl_GetErrno\fR. .PP -Setting \fIcharsToRead\fR to \fB\-1\fR will cause the command to read +Setting \fIcharsToRead\fR to TCL_INDEX_NONE will cause the command to read all characters currently available (non-blocking) or everything until eof (blocking mode). .PP @@ -471,14 +471,14 @@ character(s) are read and discarded. .PP If a line was successfully read, the return value is greater than or equal to zero and indicates the number of bytes stored in \fIlineObjPtr\fR. If an -error occurs, \fBTcl_GetsObj\fR returns \-1 and records a POSIX error code +error occurs, \fBTcl_GetsObj\fR returns TCL_INDEX_NONE and records a POSIX error code that can be retrieved with \fBTcl_GetErrno\fR. \fBTcl_GetsObj\fR also -returns \-1 if the end of the file is reached; the \fBTcl_Eof\fR procedure +returns TCL_INDEX_NONE if the end of the file is reached; the \fBTcl_Eof\fR procedure can be used to distinguish an error from an end-of-file condition. .PP -If the channel is in nonblocking mode, the return value can also be \-1 if -no data was available or the data that was available did not contain an -end-of-line character. When \-1 is returned, the \fBTcl_InputBlocked\fR +If the channel is in nonblocking mode, the return value can also be TCL_INDEX_NONE +if no data was available or the data that was available did not contain an +end-of-line character. When TCL_INDEX_NONE is returned, the \fBTcl_InputBlocked\fR procedure may be invoked to determine if the channel is blocked because of input unavailability. .PP @@ -496,7 +496,7 @@ head of the queue. If \fIchannel\fR has a .QW sticky EOF set, no data will be added to the input queue. \fBTcl_Ungets\fR returns \fIinputLen\fR or -\-1 if an error occurs. +TCL_INDEX_NONE if an error occurs. .SH "TCL_WRITECHARS, TCL_WRITEOBJ, AND TCL_WRITE" .PP \fBTcl_WriteChars\fR accepts \fIbytesToWrite\fR bytes of character data at @@ -513,10 +513,10 @@ to appear as soon as a complete line is accepted for output, set the \fB\-buffering\fR option on the channel to \fBline\fR mode. .PP The return value of \fBTcl_WriteChars\fR is a count of how many bytes were -accepted for output to the channel. This is either greater than zero to -indicate success or \-1 to indicate that an error occurred. If an error -occurs, \fBTcl_WriteChars\fR records a POSIX error code that may be -retrieved with \fBTcl_GetErrno\fR. +accepted for output to the channel. This is either TCL_INDEX_NONE to +indicate that an error occurred or another number greater than +zero to indicate success. If an error occurs, \fBTcl_WriteChars\fR records +a POSIX error code that may be retrieved with \fBTcl_GetErrno\fR. .PP Newline characters in the output data are translated to platform-specific end-of-line sequences according to the \fB\-translation\fR option for the -- cgit v0.12 From b669079dd69a6f5b0027edd74d53f8b0390769f3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 17 Nov 2022 20:24:20 +0000 Subject: Add dummy TCL_OBJTYPE_V0 #define. Minimal no-op backport of TIP #644 --- generic/tcl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/generic/tcl.h b/generic/tcl.h index e705cdb..800ffa1 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -752,6 +752,7 @@ typedef struct Tcl_ObjType { * to this type. Frees the internal rep of the * old type. Returns TCL_ERROR on failure. */ } Tcl_ObjType; +#define TCL_OBJTYPE_V0 /* just empty */ /* * The following structure stores an internal representation (internalrep) for -- cgit v0.12 From 78bce4ec934a2cce5174e894d2c845df212f71b9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 18 Nov 2022 19:17:32 +0000 Subject: Fix [bec4219123]: test utf-4.12 fails in custom builds --- generic/tclTest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generic/tclTest.c b/generic/tclTest.c index c9bad56..2ebbcc2 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -20,10 +20,12 @@ #ifndef USE_TCL_STUBS # define USE_TCL_STUBS #endif +#undef TCL_UTF_MAX #ifdef TCL_NO_DEPRECATED # define TCL_UTF_MAX 4 #else # define TCL_NO_DEPRECATED +# define TCL_UTF_MAX 3 #endif #include "tclInt.h" #ifdef TCL_WITH_EXTERNAL_TOMMATH -- cgit v0.12 From 90a23f176d6423227cc2fd2be8cd3a88ceb1c088 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 18 Nov 2022 19:43:09 +0000 Subject: Fix [https://core.tcl-lang.org/thread/tktview?name=16bf24d70b|16bf24d70b]: Installed Thread for Tcl 8.7 breaks availability of Thread in 8.6 --- generic/tcl.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 800ffa1..26054ea 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2405,27 +2405,14 @@ const char * TclTomMathInitializeStubs(Tcl_Interp *interp, #endif #ifdef USE_TCL_STUBS -#if TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE # define Tcl_InitStubs(interp, version, exact) \ (Tcl_InitStubs)(interp, version, \ (exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16), \ TCL_STUB_MAGIC) #else # define Tcl_InitStubs(interp, version, exact) \ - (Tcl_InitStubs)(interp, TCL_PATCH_LEVEL, \ - 1|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16), \ - TCL_STUB_MAGIC) -#endif -#else -#if TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE -# define Tcl_InitStubs(interp, version, exact) \ Tcl_PkgInitStubsCheck(interp, version, \ (exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16)) -#else -# define Tcl_InitStubs(interp, version, exact) \ - Tcl_PkgInitStubsCheck(interp, TCL_PATCH_LEVEL, \ - 1|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16)) -#endif #endif /* -- cgit v0.12 From 0bcca87681ea390671d67a96f771697c9f5ff3be Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 18 Nov 2022 20:26:52 +0000 Subject: Backout [52a52a65f0], let's see if this fixes the Windows crash --- generic/tclLink.c | 19 +++++++++++++++++-- generic/tclObj.c | 34 ++++++++++++++++++++++++---------- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/generic/tclLink.c b/generic/tclLink.c index 397c9bc..1973067 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -537,10 +537,15 @@ GetUWide( } else if (type == TCL_NUMBER_BIG) { mp_int *numPtr = (mp_int *)clientData; Tcl_WideUInt value = 0; + union { + Tcl_WideUInt value; + unsigned char bytes[sizeof(Tcl_WideUInt)]; + } scratch; size_t numBytes; + unsigned char *bytes = scratch.bytes; - if (numPtr->sign || (MP_OKAY != mp_pack(&value, 1, - &numBytes, 0, sizeof(Tcl_WideUInt), 0, 0, numPtr))) { + if (numPtr->sign || (MP_OKAY != mp_to_ubin(numPtr, + bytes, sizeof(Tcl_WideUInt), &numBytes))) { /* * If the sign bit is set (a negative value) or if the value * can't possibly fit in the bits of an unsigned wide, there's @@ -548,6 +553,16 @@ GetUWide( */ return 1; } +#ifndef WORDS_BIGENDIAN + while (numBytes-- > 0) { + value = (value << CHAR_BIT) | *bytes++; + } +#else /* WORDS_BIGENDIAN */ + /* + * Big-endian can read the value directly. + */ + value = scratch.value; +#endif /* WORDS_BIGENDIAN */ *uwidePtr = value; return 0; } diff --git a/generic/tclObj.c b/generic/tclObj.c index bad3f85..ce8e610 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -3124,12 +3124,15 @@ Tcl_GetLongFromObj( { mp_int big; - unsigned long value = 0; + unsigned long scratch, value = 0; + unsigned char *bytes = (unsigned char *) &scratch; size_t numBytes; TclUnpackBignum(objPtr, big); - if (mp_pack(&value, 1, - &numBytes, 0, sizeof(Tcl_WideUInt), 0, 0, &big) == MP_OKAY) { + if (mp_to_ubin(&big, bytes, sizeof(long), &numBytes) == MP_OKAY) { + while (numBytes-- > 0) { + value = (value << CHAR_BIT) | *bytes++; + } if (big.sign) { if (value <= 1 + (unsigned long)LONG_MAX) { *longPtr = (long)(-value); @@ -3361,10 +3364,14 @@ Tcl_GetWideIntFromObj( mp_int big; Tcl_WideUInt value = 0; size_t numBytes; + Tcl_WideInt scratch; + unsigned char *bytes = (unsigned char *) &scratch; TclUnpackBignum(objPtr, big); - if (mp_pack(&value, 1, - &numBytes, 0, sizeof(Tcl_WideUInt), 0, 0, &big) == MP_OKAY) { + if (mp_to_ubin(&big, bytes, sizeof(Tcl_WideInt), &numBytes) == MP_OKAY) { + while (numBytes-- > 0) { + value = (value << CHAR_BIT) | *bytes++; + } if (big.sign) { if (value <= 1 + ~(Tcl_WideUInt)WIDE_MIN) { *wideIntPtr = (Tcl_WideInt)(-value); @@ -3437,18 +3444,21 @@ TclGetWideBitsFromObj( mp_int big; mp_err err; - Tcl_WideUInt value = 0; + Tcl_WideUInt value = 0, scratch; size_t numBytes; + unsigned char *bytes = (unsigned char *) &scratch; Tcl_GetBignumFromObj(NULL, objPtr, &big); err = mp_mod_2d(&big, (int) (CHAR_BIT * sizeof(Tcl_WideInt)), &big); if (err == MP_OKAY) { - err = mp_pack(&value, 1, - &numBytes, 0, sizeof(Tcl_WideUInt), 0, 0, &big); + err = mp_to_ubin(&big, bytes, sizeof(Tcl_WideInt), &numBytes); } if (err != MP_OKAY) { return TCL_ERROR; } + while (numBytes-- > 0) { + value = (value << CHAR_BIT) | *bytes++; + } *wideIntPtr = !big.sign ? (Tcl_WideInt)value : -(Tcl_WideInt)value; mp_clear(&big); return TCL_OK; @@ -3818,15 +3828,19 @@ Tcl_SetBignumObj( { Tcl_WideUInt value = 0; size_t numBytes; + Tcl_WideUInt scratch; + unsigned char *bytes = (unsigned char *) &scratch; mp_int *bignumValue = (mp_int *) big; if (Tcl_IsShared(objPtr)) { Tcl_Panic("%s called with shared object", "Tcl_SetBignumObj"); } - if (mp_pack(&value, 1, - &numBytes, 0, sizeof(Tcl_WideUInt), 0, 0, bignumValue) != MP_OKAY) { + if (mp_to_ubin(bignumValue, bytes, sizeof(Tcl_WideUInt), &numBytes) != MP_OKAY) { goto tooLargeForWide; } + while (numBytes-- > 0) { + value = (value << CHAR_BIT) | *bytes++; + } if (value > ((Tcl_WideUInt)WIDE_MAX + bignumValue->sign)) { goto tooLargeForWide; } -- cgit v0.12