summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclFileName.c6
-rw-r--r--generic/tclIOUtil.c4
-rw-r--r--generic/tclInt.h11
-rw-r--r--generic/tclLink.c6
-rw-r--r--generic/tclObj.c19
-rw-r--r--generic/tclPathObj.c66
-rw-r--r--generic/tclStubInit.c55
-rw-r--r--generic/tclTomMath.decls48
-rw-r--r--generic/tclTomMathDecls.h73
-rw-r--r--unix/tclUnixFile.c9
10 files changed, 175 insertions, 122 deletions
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index 0f3f8b1..bf01c02 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -2440,7 +2440,8 @@ DoGlob(
joinedPtr = TclDStringToObj(&append);
} else if (flags) {
joinedPtr = TclNewFSPathObj(pathPtr, Tcl_DStringValue(&append),
- Tcl_DStringLength(&append));
+ Tcl_DStringLength(&append),
+ TclFSPathEncoding(interp, pathPtr));
} else {
joinedPtr = Tcl_DuplicateObj(pathPtr);
if (strchr(separators, Tcl_DStringValue(&append)[0]) == NULL) {
@@ -2473,7 +2474,8 @@ DoGlob(
if (pathPtr == NULL) {
joinedPtr = Tcl_NewStringObj(pattern, p-pattern);
} else if (flags) {
- joinedPtr = TclNewFSPathObj(pathPtr, pattern, p-pattern);
+ joinedPtr = TclNewFSPathObj(pathPtr, pattern, p-pattern,
+ TclFSPathEncoding(interp, pathPtr));
} else {
joinedPtr = Tcl_DuplicateObj(pathPtr);
if (strchr(separators, pattern[0]) == NULL) {
diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c
index 21d7c67..8b5508f 100644
--- a/generic/tclIOUtil.c
+++ b/generic/tclIOUtil.c
@@ -1225,7 +1225,9 @@ FsAddMountsToGlobResult(
len--;
}
len++; /* account for '/' in the mElt [Bug 1602539] */
- mElt = TclNewFSPathObj(pathPtr, mount + len, mlen - len);
+
+ mElt = TclNewFSPathObj(pathPtr, mount + len, mlen - len
+ , TclFSPathEncoding(NULL, pathPtr));
Tcl_ListObjAppendElement(NULL, resultPtr, mElt);
}
/*
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 7fcaf3b..03469fa 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -2938,6 +2938,12 @@ MODULE_SCOPE double TclFloor(const mp_int *a);
MODULE_SCOPE void TclFormatNaN(double value, char *buffer);
MODULE_SCOPE int TclFSFileAttrIndex(Tcl_Obj *pathPtr,
const char *attributeName, int *indexPtr);
+MODULE_SCOPE
+ Tcl_Encoding TclFSPathEncoding(
+ Tcl_Interp *interp,
+ Tcl_Obj *pathPtr
+ );
+
MODULE_SCOPE Tcl_Command TclNRCreateCommandInNs(Tcl_Interp *interp,
const char *cmdName, Tcl_Namespace *nsPtr,
Tcl_ObjCmdProc *proc, Tcl_ObjCmdProc *nreProc,
@@ -3061,7 +3067,7 @@ MODULE_SCOPE int TclpObjLstat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf);
MODULE_SCOPE Tcl_Obj * TclpTempFileName(void);
MODULE_SCOPE Tcl_Obj * TclpTempFileNameForLibrary(Tcl_Interp *interp, Tcl_Obj* pathPtr);
MODULE_SCOPE Tcl_Obj * TclNewFSPathObj(Tcl_Obj *dirPtr, const char *addStrRep,
- size_t len);
+ size_t len, Tcl_Encoding encoding);
MODULE_SCOPE int TclpDeleteFile(const void *path);
MODULE_SCOPE void TclpFinalizeCondition(Tcl_Condition *condPtr);
MODULE_SCOPE void TclpFinalizeMutex(Tcl_Mutex *mutexPtr);
@@ -4110,9 +4116,6 @@ MODULE_SCOPE int TclIndexEncode(Tcl_Interp *interp, Tcl_Obj *objPtr,
size_t before, size_t after, int *indexPtr);
MODULE_SCOPE size_t TclIndexDecode(int encoded, size_t endValue);
-MODULE_SCOPE int TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written);
-MODULE_SCOPE size_t TclBN_mp_ubin_size(const mp_int *a);
-MODULE_SCOPE int TclBN_mp_to_radix(const mp_int *a, char *str, size_t maxlen, size_t *written, int radix);
MODULE_SCOPE void TclBN_int_reverse(unsigned char *s, size_t len);
/* Constants used in index value encoding routines. */
diff --git a/generic/tclLink.c b/generic/tclLink.c
index 67f1ec9..73eee2d 100644
--- a/generic/tclLink.c
+++ b/generic/tclLink.c
@@ -533,11 +533,11 @@ GetUWide(
Tcl_WideUInt value;
unsigned char bytes[sizeof(Tcl_WideUInt)];
} scratch;
- unsigned long numBytes = sizeof(Tcl_WideUInt);
+ size_t numBytes;
unsigned char *bytes = scratch.bytes;
- if (numPtr->sign || (MP_OKAY != mp_to_unsigned_bin_n(numPtr,
- bytes, &numBytes))) {
+ 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
diff --git a/generic/tclObj.c b/generic/tclObj.c
index d711adb..89125cf 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -2571,11 +2571,12 @@ Tcl_GetLongFromObj(
*/
mp_int big;
- unsigned long scratch, value = 0, numBytes = sizeof(unsigned long);
+ unsigned long scratch, value = 0;
unsigned char *bytes = (unsigned char *) &scratch;
+ size_t numBytes;
TclUnpackBignum(objPtr, big);
- if (mp_to_unsigned_bin_n(&big, bytes, &numBytes) == MP_OKAY) {
+ if (mp_to_ubin(&big, bytes, sizeof(long), &numBytes) == MP_OKAY) {
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
@@ -2810,12 +2811,12 @@ Tcl_GetWideIntFromObj(
mp_int big;
Tcl_WideUInt value = 0;
- unsigned long numBytes = sizeof(Tcl_WideInt);
+ size_t numBytes;
Tcl_WideInt scratch;
unsigned char *bytes = (unsigned char *) &scratch;
TclUnpackBignum(objPtr, big);
- if (mp_to_unsigned_bin_n(&big, bytes, &numBytes) == MP_OKAY) {
+ if (mp_to_ubin(&big, bytes, sizeof(Tcl_WideInt), &numBytes) == MP_OKAY) {
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
@@ -2891,12 +2892,12 @@ TclGetWideBitsFromObj(
mp_int big;
Tcl_WideUInt value = 0, scratch;
- unsigned long numBytes = sizeof(Tcl_WideInt);
+ size_t numBytes;
unsigned char *bytes = (unsigned char *) &scratch;
Tcl_GetBignumFromObj(NULL, objPtr, &big);
mp_mod_2d(&big, (int) (CHAR_BIT * sizeof(Tcl_WideInt)), &big);
- mp_to_unsigned_bin_n(&big, bytes, &numBytes);
+ mp_to_ubin(&big, bytes, sizeof(Tcl_WideInt), &numBytes);
while (numBytes-- > 0) {
value = (value << CHAR_BIT) | *bytes++;
}
@@ -3016,7 +3017,7 @@ UpdateStringOfBignum(
stringVal = Tcl_InitStringRep(objPtr, NULL, size - 1);
TclOOM(stringVal, size);
- if (MP_OKAY != mp_toradix_n(&bignumVal, stringVal, 10, size)) {
+ if (MP_OKAY != mp_to_radix(&bignumVal, stringVal, size, NULL, 10)) {
Tcl_Panic("conversion failure in UpdateStringOfBignum");
}
(void) Tcl_InitStringRep(objPtr, NULL, size - 1);
@@ -3265,14 +3266,14 @@ Tcl_SetBignumObj(
mp_int *bignumValue) /* Value to store */
{
Tcl_WideUInt value = 0;
- unsigned long numBytes = sizeof(Tcl_WideUInt);
+ size_t numBytes;
Tcl_WideUInt scratch;
unsigned char *bytes = (unsigned char *) &scratch;
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object", "Tcl_SetBignumObj");
}
- if (mp_to_unsigned_bin_n(bignumValue, bytes, &numBytes) != MP_OKAY) {
+ if (mp_to_ubin(bignumValue, bytes, sizeof(Tcl_WideUInt), &numBytes) != MP_OKAY) {
goto tooLargeForWide;
}
while (numBytes-- > 0) {
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index 927ba35..bbf20c7 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -87,6 +87,7 @@ typedef struct {
* epoch. The epoch changes when
* filesystem-mounts are changed. */
const Tcl_Filesystem *fsPtr;/* The Tcl_Filesystem that claims this path */
+ Tcl_Encoding encoding;
} FsPath;
/*
@@ -660,9 +661,18 @@ TclPathPart(
* the tail.
*/
+ /*
+ * We don't know that the encoding of the fileName is the
+ * same as the encoding of, but that's on the caller to
+ * harmonize. In any case, if the encoding doesn't match
+ * at the time it the FsPath object is used, the object is
+ * ignored.
+ */
+
Tcl_Obj *resultPtr =
- TclNewFSPathObj(fsPathPtr->cwdPtr, fileName,
- length - strlen(extension));
+ TclNewFSPathObj(fsPathPtr->cwdPtr, fileName,
+ length - strlen(extension),
+ TclFSPathEncoding(interp, fsPathPtr->cwdPtr));
Tcl_IncrRefCount(resultPtr);
return resultPtr;
@@ -876,6 +886,7 @@ TclJoinPath(
&& !((elt->bytes != NULL) && (elt->bytes[0] == '\0'))
&& TclGetPathType(elt, NULL, NULL, NULL) == TCL_PATH_ABSOLUTE) {
Tcl_Obj *tailObj = objv[1];
+
Tcl_PathType type;
/* if forceRelative - second path is relative */
@@ -917,14 +928,17 @@ TclJoinPath(
|| (strchr(TclGetString(elt), '\\') == NULL)) {
if (PATHFLAGS(elt)) {
- return TclNewFSPathObj(elt, str, len);
+ return TclNewFSPathObj(elt, str, len,
+ TclFSPathEncoding(NULL, elt));
}
if (TCL_PATH_ABSOLUTE != Tcl_FSGetPathType(elt)) {
- return TclNewFSPathObj(elt, str, len);
+ return TclNewFSPathObj(
+ elt, str, len, TclFSPathEncoding(NULL, elt));
}
(void) Tcl_FSGetNormalizedPath(NULL, elt);
if (elt == PATHOBJ(elt)->normPathPtr) {
- return TclNewFSPathObj(elt, str, len);
+ return TclNewFSPathObj(
+ elt, str, len, TclFSPathEncoding(NULL, elt));
}
}
}
@@ -1257,7 +1271,8 @@ Tcl_Obj *
TclNewFSPathObj(
Tcl_Obj *dirPtr,
const char *addStrRep,
- size_t len)
+ size_t len,
+ Tcl_Encoding encoding)
{
FsPath *fsPathPtr;
Tcl_Obj *pathPtr;
@@ -1303,6 +1318,7 @@ TclNewFSPathObj(
fsPathPtr->nativePathPtr = NULL;
fsPathPtr->fsPtr = NULL;
fsPathPtr->filesystemEpoch = 0;
+ fsPathPtr->encoding = encoding;
SETPATHOBJ(pathPtr, fsPathPtr);
PATHFLAGS(pathPtr) = TCLPATH_APPENDED;
@@ -2160,6 +2176,39 @@ TclFSSetPathDetails(
/*
*---------------------------------------------------------------------------
*
+ * TclFSPathEncoding --
+ *
+ * Produce the encoding, if any, associated with a filesystem path.
+ *
+ * Results:
+ * NULL or a valid Tcl_Encoding.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+Tcl_Encoding
+TclFSPathEncoding(
+ Tcl_Interp *interp,
+ Tcl_Obj *pathPtr)
+{
+ FsPath *fsPathPtr;
+ Tcl_Encoding encoding = NULL;
+
+ if (Tcl_FSConvertToPathType(interp, pathPtr) != TCL_OK) {
+ return NULL;
+ }
+ if (TclFetchIntRep(pathPtr, &fsPathType)) {
+ fsPathPtr = PATHOBJ(pathPtr);
+ encoding = fsPathPtr->encoding;
+ }
+ return encoding;
+}
+/*
+ *---------------------------------------------------------------------------
+ *
* Tcl_FSEqualPaths --
*
* This function tests whether the two paths given are equal path
@@ -2245,7 +2294,10 @@ SetFsPathFromAny(
Tcl_Obj *transPtr;
const char *name;
- if (TclHasIntRep(pathPtr, &fsPathType)) {
+ Tcl_Encoding sysencoding = Tcl_GetEncoding(interp, NULL);
+
+ if (TclHasIntRep(pathPtr, &fsPathType)
+ && TclFSPathEncoding(interp, pathPtr) == sysencoding) {
return TCL_OK;
}
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index b084c06..db2ed5c 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -70,10 +70,13 @@ mp_err TclBN_mp_set_int(mp_int *a, unsigned long i)
mp_err TclBN_mp_init_set_int(mp_int *a, unsigned long i)
{
- mp_init(a);
+ mp_err result = mp_init(a);
+ if (result == MP_OKAY) {
TclBN_mp_set_ul(a, i);
- return MP_OKAY;
+ }
+ return result;
}
+
static mp_err TclBN_mp_set_long(mp_int *a, unsigned long i)
{
TclBN_mp_set_ul(a, i);
@@ -82,11 +85,6 @@ static mp_err TclBN_mp_set_long(mp_int *a, unsigned long i)
#define TclBN_mp_set_ul (void (*)(mp_int *a, unsigned long i))TclBN_mp_set_long
-int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
-{
- return mp_expt_u32(a, b, c);
-}
-
#ifdef _WIN32
# define TclUnixWaitForFile 0
# define TclUnixCopyFile 0
@@ -177,37 +175,9 @@ static int exprIntObj(Tcl_Interp *interp, Tcl_Obj*expr, int *ptr){
#endif /* __CYGWIN__ */
-mp_err mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
-{
- return mp_to_ubin(a, b, INT_MAX, NULL);
-}
-
-mp_err mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen)
-{
- size_t n = mp_ubin_size(a);
- if (*outlen < (unsigned long)n) {
- return MP_VAL;
- }
- *outlen = (unsigned long)n;
- return mp_to_ubin(a, b, n, NULL);
-}
-
-mp_err mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
-{
- if (maxlen < 0) {
- return MP_VAL;
- }
- return mp_to_radix(a, str, (size_t)maxlen, NULL, radix);
-}
#undef TclBN_mp_unsigned_bin_size
#define TclBN_mp_unsigned_bin_size (int (*)(const mp_int *a)) mp_ubin_size
-void bn_reverse(unsigned char *s, int len)
-{
- if (len > 0) {
- s_mp_reverse(s, (size_t)len);
- }
-}
/*
* WARNING: The contents of this file is automatically generated by the
* tools/genStubs.tcl script. Any modifications to the function declarations
@@ -627,7 +597,7 @@ const TclTomMathStubs tclTomMathStubs = {
TclBN_mp_div_2d, /* 16 */
TclBN_mp_div_3, /* 17 */
TclBN_mp_exch, /* 18 */
- TclBN_mp_expt_d, /* 19 */
+ TclBN_mp_expt_u32, /* 19 */
TclBN_mp_grow, /* 20 */
TclBN_mp_init, /* 21 */
TclBN_mp_init_copy, /* 22 */
@@ -652,9 +622,9 @@ const TclTomMathStubs tclTomMathStubs = {
TclBN_mp_sqrt, /* 41 */
TclBN_mp_sub, /* 42 */
TclBN_mp_sub_d, /* 43 */
- TclBN_mp_to_unsigned_bin, /* 44 */
- TclBN_mp_to_unsigned_bin_n, /* 45 */
- TclBN_mp_toradix_n, /* 46 */
+ 0, /* 44 */
+ 0, /* 45 */
+ 0, /* 46 */
TclBN_mp_unsigned_bin_size, /* 47 */
TclBN_mp_xor, /* 48 */
TclBN_mp_zero, /* 49 */
@@ -675,7 +645,7 @@ const TclTomMathStubs tclTomMathStubs = {
0, /* 64 */
0, /* 65 */
0, /* 66 */
- TclBN_mp_expt_d_ex, /* 67 */
+ 0, /* 67 */
TclBN_mp_set_ull, /* 68 */
TclBN_mp_get_mag_ull, /* 69 */
TclBN_mp_set_ul, /* 70 */
@@ -685,7 +655,10 @@ const TclTomMathStubs tclTomMathStubs = {
0, /* 74 */
0, /* 75 */
TclBN_mp_signed_rsh, /* 76 */
- TclBN_mp_get_bit, /* 77 */
+ 0, /* 77 */
+ TclBN_mp_to_ubin, /* 78 */
+ TclBN_mp_ubin_size, /* 79 */
+ TclBN_mp_to_radix, /* 80 */
};
static const TclStubHooks tclStubHooks = {
diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls
index 217ca0c..c5c21b9 100644
--- a/generic/tclTomMath.decls
+++ b/generic/tclTomMath.decls
@@ -81,7 +81,7 @@ declare 18 {
void TclBN_mp_exch(mp_int *a, mp_int *b)
}
declare 19 {
- mp_err TclBN_mp_expt_d(const mp_int *a, unsigned int b, mp_int *c)
+ mp_err TclBN_mp_expt_u32(const mp_int *a, unsigned int b, mp_int *c)
}
declare 20 {
mp_err TclBN_mp_grow(mp_int *a, int size)
@@ -155,16 +155,19 @@ declare 42 {
declare 43 {
mp_err TclBN_mp_sub_d(const mp_int *a, mp_digit b, mp_int *c)
}
-declare 44 {
- mp_err TclBN_mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
-}
-declare 45 {
- mp_err TclBN_mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b,
- unsigned long *outlen)
-}
-declare 46 {
- mp_err TclBN_mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
-}
+# Removed in 9.0
+#declare 44 {
+# mp_err TclBN_mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
+#}
+# Removed in 9.0
+#declare 45 {
+# mp_err TclBN_mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b,
+# unsigned long *outlen)
+#}
+# Removed in 9.0
+#declare 46 {
+# mp_err TclBN_mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen)
+#}
declare 47 {
int TclBN_mp_unsigned_bin_size(const mp_int *a)
}
@@ -199,10 +202,10 @@ declare 63 {
# void TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal)
#}
-# Added in libtommath 1.0
-declare 67 {
- mp_err TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
-}
+# Removed in 9.0
+#declare 67 {
+# mp_err TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast)
+#}
# Added in libtommath 1.0.1
declare 68 {
void TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i)
@@ -233,9 +236,20 @@ declare 71 {
declare 76 {
mp_err TclBN_mp_signed_rsh(const mp_int *a, int b, mp_int *c)
}
+# Removed in 9.0
+#declare 77 {
+# mp_bool TclBN_mp_get_bit(const mp_int *a, unsigned int b)
+#}
-declare 77 {
- mp_bool TclBN_mp_get_bit(const mp_int *a, unsigned int b)
+# Added in libtommath 1.2.0
+declare 78 {
+ int TclBN_mp_to_ubin(const mp_int *a, unsigned char *buf, size_t maxlen, size_t *written)
+}
+declare 79 {
+ size_t TclBN_mp_ubin_size(const mp_int *a)
+}
+declare 80 {
+ int TclBN_mp_to_radix(const mp_int *a, char *str, size_t maxlen, size_t *written, int radix)
}
diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h
index c0a7fa0..8907462 100644
--- a/generic/tclTomMathDecls.h
+++ b/generic/tclTomMathDecls.h
@@ -75,9 +75,9 @@
#define mp_div_3 TclBN_mp_div_3
#define mp_div_d TclBN_mp_div_d
#define mp_exch TclBN_mp_exch
-#define mp_expt_d TclBN_mp_expt_d
+#define mp_expt_d TclBN_mp_expt_u32
#define mp_expt_d_ex TclBN_mp_expt_d_ex
-#define mp_expt_u32 TclBN_mp_expt_d
+#define mp_expt_u32 TclBN_mp_expt_u32
#define mp_get_bit TclBN_mp_get_bit
#define mp_get_long TclBN_mp_get_mag_ul
#define mp_get_mag_ul TclBN_mp_get_mag_ul
@@ -234,7 +234,7 @@ EXTERN mp_err TclBN_mp_div_3(const mp_int *a, mp_int *q,
/* 18 */
EXTERN void TclBN_mp_exch(mp_int *a, mp_int *b);
/* 19 */
-EXTERN mp_err TclBN_mp_expt_d(const mp_int *a, unsigned int b,
+EXTERN mp_err TclBN_mp_expt_u32(const mp_int *a, unsigned int b,
mp_int *c);
/* 20 */
EXTERN mp_err TclBN_mp_grow(mp_int *a, int size);
@@ -292,15 +292,9 @@ EXTERN mp_err TclBN_mp_sub(const mp_int *a, const mp_int *b,
/* 43 */
EXTERN mp_err TclBN_mp_sub_d(const mp_int *a, mp_digit b,
mp_int *c);
-/* 44 */
-EXTERN mp_err TclBN_mp_to_unsigned_bin(const mp_int *a,
- unsigned char *b);
-/* 45 */
-EXTERN mp_err TclBN_mp_to_unsigned_bin_n(const mp_int *a,
- unsigned char *b, unsigned long *outlen);
-/* 46 */
-EXTERN mp_err TclBN_mp_toradix_n(const mp_int *a, char *str,
- int radix, int maxlen);
+/* Slot 44 is reserved */
+/* Slot 45 is reserved */
+/* Slot 46 is reserved */
/* 47 */
EXTERN int TclBN_mp_unsigned_bin_size(const mp_int *a);
/* 48 */
@@ -328,9 +322,7 @@ EXTERN int TclBN_mp_cnt_lsb(const mp_int *a);
/* Slot 64 is reserved */
/* Slot 65 is reserved */
/* Slot 66 is reserved */
-/* 67 */
-EXTERN mp_err TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b,
- mp_int *c, int fast);
+/* Slot 67 is reserved */
/* 68 */
EXTERN void TclBN_mp_set_ull(mp_int *a, Tcl_WideUInt i);
/* 69 */
@@ -346,8 +338,15 @@ EXTERN unsigned long TclBN_mp_get_mag_ul(const mp_int *a);
/* 76 */
EXTERN mp_err TclBN_mp_signed_rsh(const mp_int *a, int b,
mp_int *c);
-/* 77 */
-EXTERN 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);
+/* 79 */
+EXTERN size_t TclBN_mp_ubin_size(const mp_int *a);
+/* 80 */
+EXTERN int TclBN_mp_to_radix(const mp_int *a, char *str,
+ size_t maxlen, size_t *written, int radix);
typedef struct TclTomMathStubs {
int magic;
@@ -372,7 +371,7 @@ typedef struct TclTomMathStubs {
mp_err (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */
mp_err (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, mp_digit *r); /* 17 */
void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */
- mp_err (*tclBN_mp_expt_d) (const mp_int *a, unsigned int b, mp_int *c); /* 19 */
+ mp_err (*tclBN_mp_expt_u32) (const mp_int *a, unsigned int b, mp_int *c); /* 19 */
mp_err (*tclBN_mp_grow) (mp_int *a, int size); /* 20 */
mp_err (*tclBN_mp_init) (mp_int *a); /* 21 */
mp_err (*tclBN_mp_init_copy) (mp_int *a, const mp_int *b); /* 22 */
@@ -397,9 +396,9 @@ typedef struct TclTomMathStubs {
mp_err (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b); /* 41 */
mp_err (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 42 */
mp_err (*tclBN_mp_sub_d) (const mp_int *a, mp_digit b, mp_int *c); /* 43 */
- mp_err (*tclBN_mp_to_unsigned_bin) (const mp_int *a, unsigned char *b); /* 44 */
- mp_err (*tclBN_mp_to_unsigned_bin_n) (const mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */
- mp_err (*tclBN_mp_toradix_n) (const mp_int *a, char *str, int radix, int maxlen); /* 46 */
+ void (*reserved44)(void);
+ void (*reserved45)(void);
+ void (*reserved46)(void);
int (*tclBN_mp_unsigned_bin_size) (const mp_int *a); /* 47 */
mp_err (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 48 */
void (*tclBN_mp_zero) (mp_int *a); /* 49 */
@@ -420,7 +419,7 @@ typedef struct TclTomMathStubs {
void (*reserved64)(void);
void (*reserved65)(void);
void (*reserved66)(void);
- mp_err (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */
+ void (*reserved67)(void);
void (*tclBN_mp_set_ull) (mp_int *a, Tcl_WideUInt i); /* 68 */
Tcl_WideUInt (*tclBN_mp_get_mag_ull) (const mp_int *a); /* 69 */
void (*tclBN_mp_set_ul) (mp_int *a, unsigned long i); /* 70 */
@@ -430,7 +429,10 @@ typedef struct TclTomMathStubs {
void (*reserved74)(void);
void (*reserved75)(void);
mp_err (*tclBN_mp_signed_rsh) (const mp_int *a, int b, mp_int *c); /* 76 */
- 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); /* 78 */
+ size_t (*tclBN_mp_ubin_size) (const mp_int *a); /* 79 */
+ int (*tclBN_mp_to_radix) (const mp_int *a, char *str, size_t maxlen, size_t *written, int radix); /* 80 */
} TclTomMathStubs;
extern const TclTomMathStubs *tclTomMathStubsPtr;
@@ -483,8 +485,8 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
(tclTomMathStubsPtr->tclBN_mp_div_3) /* 17 */
#define TclBN_mp_exch \
(tclTomMathStubsPtr->tclBN_mp_exch) /* 18 */
-#define TclBN_mp_expt_d \
- (tclTomMathStubsPtr->tclBN_mp_expt_d) /* 19 */
+#define TclBN_mp_expt_u32 \
+ (tclTomMathStubsPtr->tclBN_mp_expt_u32) /* 19 */
#define TclBN_mp_grow \
(tclTomMathStubsPtr->tclBN_mp_grow) /* 20 */
#define TclBN_mp_init \
@@ -533,12 +535,9 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
(tclTomMathStubsPtr->tclBN_mp_sub) /* 42 */
#define TclBN_mp_sub_d \
(tclTomMathStubsPtr->tclBN_mp_sub_d) /* 43 */
-#define TclBN_mp_to_unsigned_bin \
- (tclTomMathStubsPtr->tclBN_mp_to_unsigned_bin) /* 44 */
-#define TclBN_mp_to_unsigned_bin_n \
- (tclTomMathStubsPtr->tclBN_mp_to_unsigned_bin_n) /* 45 */
-#define TclBN_mp_toradix_n \
- (tclTomMathStubsPtr->tclBN_mp_toradix_n) /* 46 */
+/* Slot 44 is reserved */
+/* Slot 45 is reserved */
+/* Slot 46 is reserved */
#define TclBN_mp_unsigned_bin_size \
(tclTomMathStubsPtr->tclBN_mp_unsigned_bin_size) /* 47 */
#define TclBN_mp_xor \
@@ -565,8 +564,7 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
/* Slot 64 is reserved */
/* Slot 65 is reserved */
/* Slot 66 is reserved */
-#define TclBN_mp_expt_d_ex \
- (tclTomMathStubsPtr->tclBN_mp_expt_d_ex) /* 67 */
+/* Slot 67 is reserved */
#define TclBN_mp_set_ull \
(tclTomMathStubsPtr->tclBN_mp_set_ull) /* 68 */
#define TclBN_mp_get_mag_ull \
@@ -581,8 +579,13 @@ extern const TclTomMathStubs *tclTomMathStubsPtr;
/* Slot 75 is reserved */
#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_ubin_size \
+ (tclTomMathStubsPtr->tclBN_mp_ubin_size) /* 79 */
+#define TclBN_mp_to_radix \
+ (tclTomMathStubsPtr->tclBN_mp_to_radix) /* 80 */
#endif /* defined(USE_TCL_STUBS) */
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index 352c04e..c81ebb6 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -269,7 +269,8 @@ TclpMatchInDirectory(
Tcl_DString dsOrig; /* utf-8 encoding of dir */
Tcl_DStringInit(&dsOrig);
- dirName = TclGetStringFromObj(fileNamePtr, &dirLength);
+ Tcl_Encoding encoding;
+ dirName = TclGetStringFromObj(fileNamePtr, &dirLength);
Tcl_DStringAppend(&dsOrig, dirName, dirLength);
/*
@@ -363,7 +364,9 @@ TclpMatchInDirectory(
* and pattern. If so, add the file to the result.
*/
- utfname = Tcl_ExternalToUtfDString(NULL, entryPtr->d_name, -1,
+
+ encoding = Tcl_GetEncoding(interp ,NULL);
+ utfname = Tcl_ExternalToUtfDString(encoding, entryPtr->d_name, -1,
&utfDs);
if (Tcl_StringCaseMatch(utfname, pattern, 0)) {
int typeOk = 1;
@@ -378,7 +381,7 @@ TclpMatchInDirectory(
if (typeOk) {
Tcl_ListObjAppendElement(interp, resultPtr,
TclNewFSPathObj(pathPtr, utfname,
- Tcl_DStringLength(&utfDs)));
+ Tcl_DStringLength(&utfDs), encoding));
}
}
Tcl_DStringFree(&utfDs);