summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-11-15 14:20:45 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-11-15 14:20:45 (GMT)
commitce1e21eb7c7a6eb5d9322835e2889da39aaca46c (patch)
tree1422cfb211e4adeb4e6aa01cc7f9f37bb7583df1 /generic
parent9e9a51f3cbb24996975fd7e2513e30bb642dc916 (diff)
parente2e22061b0f8500c89ddd65a65a1266179a58140 (diff)
downloadtcl-ce1e21eb7c7a6eb5d9322835e2889da39aaca46c.zip
tcl-ce1e21eb7c7a6eb5d9322835e2889da39aaca46c.tar.gz
tcl-ce1e21eb7c7a6eb5d9322835e2889da39aaca46c.tar.bz2
Merge 8.7
Diffstat (limited to 'generic')
-rw-r--r--generic/tclEncoding.c28
-rw-r--r--generic/tclOOMethod.c8
-rw-r--r--generic/tclStubInit.c3
-rw-r--r--generic/tclTomMath.decls5
-rw-r--r--generic/tclTomMathDecls.h14
5 files changed, 28 insertions, 30 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 83f4787..e318d5b 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -2202,7 +2202,7 @@ BinaryProc(
/*
*-------------------------------------------------------------------------
*
- * UtfExtToUtfIntProc --
+ * UtfIntToUtfExtProc --
*
* Convert from UTF-8 to UTF-8. While converting null-bytes from the
* Tcl's internal representation (0xc0, 0x80) to the official
@@ -2343,7 +2343,7 @@ UtfToUtfProc(
* output buffer. */
int pureNullMode) /* Convert embedded nulls from internal
* representation to real null-bytes or vice
- * versa. */
+ * versa. Also combine or separate surrogate pairs */
{
const char *srcStart, *srcEnd, *srcClose;
const char *dstStart, *dstEnd;
@@ -2359,7 +2359,7 @@ UtfToUtfProc(
srcEnd = src + srcLen;
srcClose = srcEnd;
if ((flags & TCL_ENCODING_END) == 0) {
- srcClose -= TCL_UTF_MAX;
+ srcClose -= 6;
}
if (flags & TCL_ENCODING_CHAR_LIMIT) {
charLimit = *dstCharsPtr;
@@ -2408,15 +2408,21 @@ UtfToUtfProc(
src += 1;
dst += Tcl_UniCharToUtf(*chPtr, dst);
} else {
- int len = TclUtfToUniChar(src, chPtr);
- src += len;
- dst += Tcl_UniCharToUtf(*chPtr, dst);
-#if TCL_UTF_MAX <= 4
- if ((*chPtr >= 0xD800) && (len < 3)) {
- src += Tcl_UtfToUniChar(src, chPtr);
- dst += Tcl_UniCharToUtf(*chPtr, dst);
+ src += TclUtfToUniChar(src, chPtr);
+ if ((*chPtr & 0xFC00) == 0xD800) {
+ /* A high surrogate character is detected, handle especially */
+ Tcl_UniChar low = *chPtr;
+ if (src <= srcEnd-3) {
+ Tcl_UtfToUniChar(src, &low);
+ }
+ if ((low & 0xFC00) != 0xDC00) {
+ *dst++ = (char) (((*chPtr >> 12) | 0xE0) & 0xEF);
+ *dst++ = (char) (((*chPtr >> 6) | 0x80) & 0xBF);
+ *dst++ = (char) ((*chPtr | 0x80) & 0xBF);
+ continue;
+ }
}
-#endif
+ dst += Tcl_UniCharToUtf(*chPtr, dst);
}
}
diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c
index 78421e1..88782dd 100644
--- a/generic/tclOOMethod.c
+++ b/generic/tclOOMethod.c
@@ -679,11 +679,13 @@ InvokeProcedureMethod(
* call frame's lifetime). */
/*
- * If the interpreter was deleted, we just skip to the next thing in the
- * chain.
+ * If the object namespace (or interpreter) were deleted, we just skip to
+ * the next thing in the chain.
*/
- if (Tcl_InterpDeleted(interp)) {
+ if (!((CallContext *)context)->oPtr->namespacePtr ||
+ Tcl_InterpDeleted(interp)
+ ) {
return TclNRObjectContextInvokeNext(interp, context, objc, objv,
Tcl_ObjectContextSkippedArgs(context));
}
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index c54d78a..52f7e24 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -117,7 +117,6 @@
#define TclBN_mp_zero mp_zero
#define TclBN_s_mp_add s_mp_add
#define TclBN_s_mp_balance_mul mp_balance_mul
-#define TclBN_mp_get_bit s_mp_get_bit
#define TclBN_mp_karatsuba_mul s_mp_karatsuba_mul
#define TclBN_mp_karatsuba_sqr s_mp_karatsuba_sqr
#define TclBN_s_mp_mul_digs s_mp_mul_digs
@@ -1144,7 +1143,7 @@ const TclTomMathStubs tclTomMathStubs = {
TclBN_mp_tc_or, /* 74 */
TclBN_mp_tc_xor, /* 75 */
TclBN_mp_signed_rsh, /* 76 */
- TclBN_mp_get_bit, /* 77 */
+ 0, /* 77 */
TclBN_mp_to_ubin, /* 78 */
TclBN_mp_div_ld, /* 79 */
TclBN_mp_to_radix, /* 80 */
diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls
index e059ba0..9d6eb1c 100644
--- a/generic/tclTomMath.decls
+++ b/generic/tclTomMath.decls
@@ -143,7 +143,7 @@ declare 38 {
declare 39 {deprecated {macro calling mp_set_u64}} {
void TclBN_mp_set(mp_int *a, unsigned int b)
}
-declare 40 {deprecated {is private function in libtommath}} {
+declare 40 {nostub {is private function in libtommath}} {
mp_err TclBN_mp_sqr(const mp_int *a, mp_int *b)
}
declare 41 {
@@ -258,9 +258,6 @@ declare 75 {deprecated {merged with mp_xor}} {
declare 76 {
mp_err MP_WUR TclBN_mp_signed_rsh(const mp_int *a, int b, mp_int *c)
}
-declare 77 {deprecated {is private function in libtommath}} {
- mp_bool TclBN_mp_get_bit(const mp_int *a, unsigned int b)
-}
# Added in libtommath 1.2.0
declare 78 {
diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h
index 34e0ec1..20c082f 100644
--- a/generic/tclTomMathDecls.h
+++ b/generic/tclTomMathDecls.h
@@ -87,7 +87,6 @@ MODULE_SCOPE mp_err TclBN_s_mp_expt_u32(const mp_int *a, unsigned int b, mp_int
#define mp_exch TclBN_mp_exch
#define mp_expt_d TclBN_mp_expt_d
#define mp_expt_d_ex TclBN_mp_expt_d_ex
-#define mp_get_bit TclBN_mp_get_bit
#define mp_get_mag_u64 TclBN_mp_get_mag_u64
#define mp_grow TclBN_mp_grow
#define mp_init TclBN_mp_init
@@ -126,7 +125,6 @@ MODULE_SCOPE mp_err TclBN_s_mp_expt_u32(const mp_int *a, unsigned int b, mp_int
#define mp_zero TclBN_mp_zero
#define s_mp_add TclBN_s_mp_add
#define s_mp_balance_mul TclBN_mp_balance_mul
-#define s_mp_get_bit TclBN_mp_get_bit
#define s_mp_karatsuba_mul TclBN_mp_karatsuba_mul
#define s_mp_karatsuba_sqr TclBN_mp_karatsuba_sqr
#define s_mp_mul_digs TclBN_s_mp_mul_digs
@@ -269,8 +267,7 @@ EXTERN mp_err TclBN_mp_shrink(mp_int *a) MP_WUR;
TCL_DEPRECATED("macro calling mp_set_u64")
void TclBN_mp_set(mp_int *a, unsigned int b);
/* 40 */
-TCL_DEPRECATED("is private function in libtommath")
-mp_err TclBN_mp_sqr(const mp_int *a, mp_int *b);
+EXTERN mp_err TclBN_mp_sqr(const mp_int *a, mp_int *b);
/* 41 */
EXTERN mp_err TclBN_mp_sqrt(const mp_int *a, mp_int *b) MP_WUR;
/* 42 */
@@ -379,9 +376,7 @@ mp_err TclBN_mp_tc_xor(const mp_int *a, const mp_int *b,
/* 76 */
EXTERN mp_err TclBN_mp_signed_rsh(const mp_int *a, int b,
mp_int *c) MP_WUR;
-/* 77 */
-TCL_DEPRECATED("is private function in libtommath")
-mp_bool TclBN_mp_get_bit(const mp_int *a, unsigned int b);
+/* Slot 77 is reserved */
/* 78 */
EXTERN int TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf,
size_t maxlen, size_t *written) MP_WUR;
@@ -473,7 +468,7 @@ typedef struct TclTomMathStubs {
TCL_DEPRECATED_API("merged with mp_or") mp_err (*tclBN_mp_tc_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 74 */
TCL_DEPRECATED_API("merged with mp_xor") mp_err (*tclBN_mp_tc_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 75 */
mp_err (*tclBN_mp_signed_rsh) (const mp_int *a, int b, mp_int *c) MP_WUR; /* 76 */
- TCL_DEPRECATED_API("is private function in libtommath") mp_bool (*tclBN_mp_get_bit) (const mp_int *a, unsigned int b); /* 77 */
+ void (*reserved77)(void);
int (*tclBN_mp_to_ubin) (const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written) MP_WUR; /* 78 */
mp_err (*tclBN_mp_div_ld) (const mp_int *a, uint64_t b, mp_int *q, uint64_t *r) MP_WUR; /* 79 */
int (*tclBN_mp_to_radix) (const mp_int *a, char *str, size_t maxlen, size_t *written, int radix) MP_WUR; /* 80 */
@@ -643,8 +638,7 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
(tclTomMathStubsPtr->tclBN_mp_tc_xor) /* 75 */
#define TclBN_mp_signed_rsh \
(tclTomMathStubsPtr->tclBN_mp_signed_rsh) /* 76 */
-#define TclBN_mp_get_bit \
- (tclTomMathStubsPtr->tclBN_mp_get_bit) /* 77 */
+/* Slot 77 is reserved */
#define TclBN_mp_to_ubin \
(tclTomMathStubsPtr->tclBN_mp_to_ubin) /* 78 */
#define TclBN_mp_div_ld \