diff options
-rw-r--r-- | generic/tclCompCmdsSZ.c | 1 | ||||
-rw-r--r-- | generic/tclExecute.c | 35 | ||||
-rw-r--r-- | generic/tclIOUtil.c | 4 | ||||
-rw-r--r-- | generic/tclLoad.c | 2 | ||||
-rw-r--r-- | generic/tclStubInit.c | 8 | ||||
-rw-r--r-- | generic/tclZipfs.c | 4 | ||||
-rw-r--r-- | libtommath/tommath_private.h | 4 | ||||
-rw-r--r-- | tests/oo.test | 4 | ||||
-rwxr-xr-x | unix/configure | 51 | ||||
-rw-r--r-- | unix/configure.ac | 5 | ||||
-rw-r--r-- | unix/tcl.m4 | 2 | ||||
-rw-r--r-- | unix/tcl.pc.in | 2 | ||||
-rw-r--r-- | unix/tclUnixThrd.c | 4 | ||||
-rw-r--r-- | win/tclWinInit.c | 12 |
14 files changed, 77 insertions, 61 deletions
diff --git a/generic/tclCompCmdsSZ.c b/generic/tclCompCmdsSZ.c index db51890..f665e0a 100644 --- a/generic/tclCompCmdsSZ.c +++ b/generic/tclCompCmdsSZ.c @@ -694,6 +694,7 @@ TclCompileStringIsCmd( OP( LNOT); return TCL_OK; } + break; case STR_IS_DOUBLE: { int satisfied, isEmpty; diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 8bc83cc..aa049dc 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -317,12 +317,16 @@ VarHashCreateVar( switch (*pc) { \ case INST_JUMP_FALSE1: \ NEXT_INST_F(((condition)? 2 : TclGetInt1AtPtr(pc+1)), (cleanup), 0); \ + break; \ case INST_JUMP_TRUE1: \ NEXT_INST_F(((condition)? TclGetInt1AtPtr(pc+1) : 2), (cleanup), 0); \ + break; \ case INST_JUMP_FALSE4: \ NEXT_INST_F(((condition)? 5 : TclGetInt4AtPtr(pc+1)), (cleanup), 0); \ + break; \ case INST_JUMP_TRUE4: \ NEXT_INST_F(((condition)? TclGetInt4AtPtr(pc+1) : 5), (cleanup), 0); \ + break; \ default: \ if ((condition) < 0) { \ TclNewIntObj(objResultPtr, -1); \ @@ -330,6 +334,7 @@ VarHashCreateVar( objResultPtr = TCONST((condition) > 0); \ } \ NEXT_INST_F(0, (cleanup), 1); \ + break; \ } \ } while (0) #define JUMP_PEEPHOLE_V(condition, pcAdjustment, cleanup) \ @@ -338,12 +343,16 @@ VarHashCreateVar( switch (*pc) { \ case INST_JUMP_FALSE1: \ NEXT_INST_V(((condition)? 2 : TclGetInt1AtPtr(pc+1)), (cleanup), 0); \ + break; \ case INST_JUMP_TRUE1: \ NEXT_INST_V(((condition)? TclGetInt1AtPtr(pc+1) : 2), (cleanup), 0); \ + break; \ case INST_JUMP_FALSE4: \ NEXT_INST_V(((condition)? 5 : TclGetInt4AtPtr(pc+1)), (cleanup), 0); \ + break; \ case INST_JUMP_TRUE4: \ NEXT_INST_V(((condition)? TclGetInt4AtPtr(pc+1) : 5), (cleanup), 0); \ + break; \ default: \ if ((condition) < 0) { \ TclNewIntObj(objResultPtr, -1); \ @@ -351,6 +360,7 @@ VarHashCreateVar( objResultPtr = TCONST((condition) > 0); \ } \ NEXT_INST_V(0, (cleanup), 1); \ + break; \ } \ } while (0) #else /* TCL_COMPILE_DEBUG */ @@ -2576,23 +2586,27 @@ TEBCresume( objResultPtr = codePtr->objArrayPtr[TclGetUInt4AtPtr(pc+1)]; TRACE_WITH_OBJ(("%u => ", TclGetUInt4AtPtr(pc+1)), objResultPtr); NEXT_INST_F(5, 0, 1); + break; case INST_POP: TRACE_WITH_OBJ(("=> discarding "), OBJ_AT_TOS); objPtr = POP_OBJECT(); TclDecrRefCount(objPtr); NEXT_INST_F(1, 0, 0); + break; case INST_DUP: objResultPtr = OBJ_AT_TOS; TRACE_WITH_OBJ(("=> "), objResultPtr); NEXT_INST_F(1, 0, 1); + break; case INST_OVER: opnd = TclGetUInt4AtPtr(pc+1); objResultPtr = OBJ_AT_DEPTH(opnd); TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr); NEXT_INST_F(5, 0, 1); + break; case INST_REVERSE: { Tcl_Obj **a, **b; @@ -2623,6 +2637,7 @@ TEBCresume( TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr); NEXT_INST_V(2, opnd, 1); + break; case INST_CONCAT_STK: /* @@ -2634,6 +2649,7 @@ TEBCresume( objResultPtr = Tcl_ConcatObj(opnd, &OBJ_AT_DEPTH(opnd-1)); TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr); NEXT_INST_V(5, opnd, 1); + break; case INST_EXPAND_START: /* @@ -2655,6 +2671,7 @@ TEBCresume( PUSH_TAUX_OBJ(objPtr); TRACE(("=> mark depth as %d\n", (int) CURR_DEPTH)); NEXT_INST_F(1, 0, 0); + break; case INST_EXPAND_DROP: /* @@ -2781,6 +2798,7 @@ TEBCresume( TclNewObj(objResultPtr); NEXT_INST_F(1, 0, 1); + break; case INST_INVOKE_STK4: objc = TclGetUInt4AtPtr(pc+1); @@ -4262,6 +4280,7 @@ TEBCresume( TRACE(("%d => new pc %u\n", opnd, (unsigned)(pc + opnd - codePtr->codeStart))); NEXT_INST_F(opnd, 0, 0); + break; case INST_JUMP4: opnd = TclGetInt4AtPtr(pc+1); @@ -4431,6 +4450,7 @@ TEBCresume( TclNewIntObj(objResultPtr, iPtr->varFramePtr->level); TRACE_WITH_OBJ(("=> "), objResultPtr); NEXT_INST_F(1, 0, 1); + break; case INST_INFO_LEVEL_ARGS: { int level; CallFrame *framePtr = iPtr->varFramePtr; @@ -5662,7 +5682,6 @@ TEBCresume( JUMP_PEEPHOLE_F(match, 2, 2); } - break; /* * End of string-related instructions. @@ -6092,6 +6111,7 @@ TEBCresume( TclSetIntObj(valuePtr, wResult); TRACE(("%s\n", O2S(valuePtr))); NEXT_INST_F(1, 1, 0); + break; case INST_DIV: if (w2 == 0) { @@ -6231,6 +6251,7 @@ TEBCresume( /* -NaN => NaN */ TRACE_APPEND(("%s\n", O2S(valuePtr))); NEXT_INST_F(1, 0, 0); + break; case TCL_NUMBER_INT: w1 = *((const Tcl_WideInt *) ptr1); if (w1 != WIDE_MIN) { @@ -6356,6 +6377,7 @@ TEBCresume( } TRACE_WITH_OBJ(("\"%.30s\" => ", O2S(valuePtr)), objResultPtr); NEXT_INST_F(1, 0, 1); + break; case INST_BREAK: /* @@ -6751,6 +6773,7 @@ TEBCresume( TclGetUInt4AtPtr(pc+1), (int) (catchTop - initCatchTop - 1), (int) CURR_DEPTH)); NEXT_INST_F(5, 0, 0); + break; case INST_END_CATCH: catchTop--; @@ -6760,6 +6783,7 @@ TEBCresume( result = TCL_OK; TRACE(("=> catchTop=%d\n", (int) (catchTop - initCatchTop - 1))); NEXT_INST_F(1, 0, 0); + break; case INST_PUSH_RESULT: objResultPtr = Tcl_GetObjResult(interp); @@ -6773,11 +6797,13 @@ TEBCresume( Tcl_IncrRefCount(objPtr); iPtr->objResultPtr = objPtr; NEXT_INST_F(1, 0, -1); + break; case INST_PUSH_RETURN_CODE: TclNewIntObj(objResultPtr, result); TRACE(("=> %u\n", result)); NEXT_INST_F(1, 0, 1); + break; case INST_PUSH_RETURN_OPTIONS: DECACHE_STACK_INFO(); @@ -6785,6 +6811,7 @@ TEBCresume( CACHE_STACK_INFO(); TRACE_WITH_OBJ(("=> "), objResultPtr); NEXT_INST_F(1, 0, 1); + break; case INST_RETURN_CODE_BRANCH: { int code; @@ -6824,6 +6851,7 @@ TEBCresume( } TRACE_APPEND(("OK\n")); NEXT_INST_F(1, 1, 0); + break; case INST_DICT_EXISTS: { int found; @@ -8823,6 +8851,7 @@ TclCompareTwoNumbers( mp_clear(&big2); return compare; } + break; case TCL_NUMBER_DOUBLE: d1 = *((const double *)ptr1); @@ -8869,6 +8898,7 @@ TclCompareTwoNumbers( Tcl_InitBignumFromDouble(NULL, d1, &big1); goto bigCompare; } + break; case TCL_NUMBER_BIG: Tcl_TakeBignumFromObj(NULL, valuePtr, &big1); @@ -8905,10 +8935,11 @@ TclCompareTwoNumbers( mp_clear(&big2); return compare; } + break; default: Tcl_Panic("unexpected number type"); - return TCL_ERROR; } + return TCL_ERROR; } #ifdef TCL_COMPILE_DEBUG diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 28e1df5..622fec6 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -171,7 +171,7 @@ const Tcl_Filesystem tclNativeFilesystem = { TclpObjCopyDirectory, TclpObjLstat, /* Needs casts since we're using version_2. */ - (Tcl_FSLoadFileProc *) TclpDlopen, + (Tcl_FSLoadFileProc *)(void *) TclpDlopen, (Tcl_FSGetCwdProc *) TclpGetNativeCwd, TclpObjChdir }; @@ -3176,7 +3176,7 @@ Tcl_LoadFile( } if (fsPtr->loadFileProc != NULL) { - int retVal = ((Tcl_FSLoadFileProc2 *)(fsPtr->loadFileProc)) + int retVal = ((Tcl_FSLoadFileProc2 *)(void *)(fsPtr->loadFileProc)) (interp, pathPtr, handlePtr, &unloadProcPtr, flags); if (retVal == TCL_OK) { diff --git a/generic/tclLoad.c b/generic/tclLoad.c index add4f6f..c5ac35c 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.c @@ -884,7 +884,7 @@ Tcl_UnloadObjCmd( for (ipPrevPtr = ipPtr; ipPtr != NULL; ipPrevPtr = ipPtr, ipPtr = ipPtr->nextPtr) { - if (ipPtr->pkgPtr == pkgPtr) { + if (ipPtr->pkgPtr == defaultPtr) { ipPrevPtr->nextPtr = ipPtr->nextPtr; break; } diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 65c6e1a..e4ef7dd 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -174,7 +174,7 @@ static mp_err TclBN_mp_set_long(mp_int *a, unsigned long i) return MP_OKAY; } -#define TclBN_mp_set_ul (void (*)(mp_int *a, unsigned long i))TclBN_mp_set_long +#define TclBN_mp_set_ul (void (*)(mp_int *a, unsigned long i))(void *)TclBN_mp_set_long mp_err MP_WUR TclBN_mp_expt_u32(const mp_int *a, unsigned int b, mp_int *c) { return mp_expt_u32(a, b, c); @@ -507,7 +507,7 @@ static int exprIntObj(Tcl_Interp *interp, Tcl_Obj*expr, int *ptr){ static int uniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned int n){ return Tcl_UniCharNcmp(ucs, uct, (unsigned long)n); } -#define Tcl_UniCharNcmp (int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long))uniCharNcmp +#define Tcl_UniCharNcmp (int(*)(const Tcl_UniChar*,const Tcl_UniChar*,unsigned long))(void *)uniCharNcmp static int uniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsigned int n){ return Tcl_UniCharNcasecmp(ucs, uct, (unsigned long)n); } @@ -516,11 +516,11 @@ static int uniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, unsig static int utfNcmp(const char *s1, const char *s2, unsigned int n){ return Tcl_UtfNcmp(s1, s2, (unsigned long)n); } -#define Tcl_UtfNcmp (int(*)(const char*,const char*,unsigned long))utfNcmp +#define Tcl_UtfNcmp (int(*)(const char*,const char*,unsigned long))(void *)utfNcmp static int utfNcasecmp(const char *s1, const char *s2, unsigned int n){ return Tcl_UtfNcasecmp(s1, s2, (unsigned long)n); } -#define Tcl_UtfNcasecmp (int(*)(const char*,const char*,unsigned long))utfNcasecmp +#define Tcl_UtfNcasecmp (int(*)(const char*,const char*,unsigned long))(void *)utfNcasecmp #endif /* TCL_WIDE_INT_IS_LONG */ diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 393db5c..9aa26d9 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -430,7 +430,7 @@ static const Tcl_Filesystem zipfsFilesystem = { NULL, /* renameFileProc */ NULL, /* copyDirectoryProc */ NULL, /* lstatProc */ - (Tcl_FSLoadFileProc *) ZipFSLoadFile, + (Tcl_FSLoadFileProc *)(void *)ZipFSLoadFile, NULL, /* getCwdProc */ NULL, /* chdirProc */ }; @@ -4696,7 +4696,7 @@ ZipFSLoadFile( Tcl_DecrRefCount(objs[1]); } - loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; + loadFileProc = (Tcl_FSLoadFileProc2 *)(void *)tclNativeFilesystem.loadFileProc; if (loadFileProc) { ret = loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); } else { diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index 072d603..5123f53 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -276,10 +276,6 @@ MP_DEPRECATED(s_mp_reverse) void bn_reverse(unsigned char *s, int len); MP_ZERO_DIGITS(a->dp + a->used, a->alloc - a->used); \ } -#ifdef _MSC_VER -/* Prevent false positive: unary minus operator applied to unsigned type, result still unsigned */ -#pragma warning(disable: 4146) -#endif #define MP_SET_SIGNED(name, uname, type, utype) \ void name(mp_int * a, type b) \ { \ diff --git a/tests/oo.test b/tests/oo.test index 235a90d..3b56f30 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -111,8 +111,8 @@ test oo-0.8 {leak in variable management} -setup { } -result 0 test oo-0.9 {various types of presence of the TclOO package} { list [lsearch -nocase -all -inline [package names] tcloo] \ - [package present TclOO] [package versions TclOO] -} [list TclOO $::oo::patchlevel $::oo::patchlevel] + [package present TclOO] [expr {$::oo::patchlevel in [package versions TclOO]}] +} [list TclOO $::oo::patchlevel 1] test oo-1.1 {basic test of OO functionality: no classes} { set result {} diff --git a/unix/configure b/unix/configure index 04f1dbc..8fc9a13 100755 --- a/unix/configure +++ b/unix/configure @@ -4681,12 +4681,13 @@ fi if test $libtommath_ok = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing mp_log_u32" >&5 -$as_echo_n "checking for library containing mp_log_u32... " >&6; } -if ${ac_cv_search_mp_log_u32+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mp_log_u32 in -ltommath" >&5 +$as_echo_n "checking for mp_log_u32 in -ltommath... " >&6; } +if ${ac_cv_lib_tommath_mp_log_u32+:} false; then : $as_echo_n "(cached) " >&6 else - ac_func_search_save_LIBS=$LIBS + ac_check_lib_save_LIBS=$LIBS +LIBS="-ltommath $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4705,40 +4706,22 @@ return mp_log_u32 (); return 0; } _ACEOF -for ac_lib in '' tommath; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_mp_log_u32=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_mp_log_u32+:} false; then : - break -fi -done -if ${ac_cv_search_mp_log_u32+:} false; then : - +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_tommath_mp_log_u32=yes else - ac_cv_search_mp_log_u32=no + ac_cv_lib_tommath_mp_log_u32=no fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_mp_log_u32" >&5 -$as_echo "$ac_cv_search_mp_log_u32" >&6; } -ac_res=$ac_cv_search_mp_log_u32 -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tommath_mp_log_u32" >&5 +$as_echo "$ac_cv_lib_tommath_mp_log_u32" >&6; } +if test "x$ac_cv_lib_tommath_mp_log_u32" = xyes; then : + MATH_LIBS="$MATH_LIBS -ltommath" else - libtommath_ok=no - + libtommath_ok=no fi fi @@ -6600,7 +6583,7 @@ fi if test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""; then : LIB_SUFFIX=${SHARED_LIB_SUFFIX} - MAKE_LIB='${SHLIB_LD} -o $@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}' + MAKE_LIB='${SHLIB_LD} -o $@ ${OBJS} ${LDFLAGS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}' if test "${SHLIB_SUFFIX}" = ".dll"; then : INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)";if test -f $(LIB_FILE).a; then $(INSTALL_DATA) $(LIB_FILE).a "$(LIB_INSTALL_DIR)"; fi;' diff --git a/unix/configure.ac b/unix/configure.ac index f0ba688..b893d1a 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -180,9 +180,8 @@ if test x"${libtommath_ok}" = x -o x"${libtommath_ok}" != xno; then AC_CHECK_TYPE([mp_int],[],[libtommath_ok=no],[#include <tommath.h>])],[ libtommath_ok=no]) AS_IF([test $libtommath_ok = yes], [ - AC_SEARCH_LIBS([mp_log_u32],[tommath],[],[ - libtommath_ok=no - ])]) + AC_CHECK_LIB([tommath],[mp_log_u32],[MATH_LIBS="$MATH_LIBS -ltommath"],[ + libtommath_ok=no])]) fi AS_IF([test $libtommath_ok = yes], [ AC_DEFINE(TCL_WITH_EXTERNAL_TOMMATH, 1, [Tcl with external libtommath]) diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 9c88a42..6bfb10e 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1821,7 +1821,7 @@ dnl # preprocessing tests use only CPPFLAGS. AS_IF([test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""], [ LIB_SUFFIX=${SHARED_LIB_SUFFIX} - MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}' + MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${LDFLAGS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}' AS_IF([test "${SHLIB_SUFFIX}" = ".dll"], [ INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)";if test -f $(LIB_FILE).a; then $(INSTALL_DATA) $(LIB_FILE).a "$(LIB_INSTALL_DIR)"; fi;' DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)" diff --git a/unix/tcl.pc.in b/unix/tcl.pc.in index ca932d2..a343707 100644 --- a/unix/tcl.pc.in +++ b/unix/tcl.pc.in @@ -11,7 +11,7 @@ Name: Tool Command Language Description: Tcl is a powerful, easy-to-learn dynamic programming language, suitable for a wide range of uses. URL: http://www.tcl.tk/ Version: @TCL_VERSION@@TCL_PATCH_LEVEL@ -Requires.private: zlib >= 1.2.3 +Requires.private: zlib >= 1.2.3, libtommath >= 1.2.0 Libs: -L${libdir} @TCL_LIB_FLAG@ @TCL_STUB_LIB_FLAG@ Libs.private: @TCL_LIBS@ Cflags: -I${includedir} diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index 35eca8d..054a5d2 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -266,9 +266,9 @@ TclpThreadCreate( } if (pthread_create(&theThread, &attr, - (void * (*)(void *)) proc, (void *) clientData) && + (void * (*)(void *))(void *)proc, (void *) clientData) && pthread_create(&theThread, NULL, - (void * (*)(void *)) proc, (void *) clientData)) { + (void * (*)(void *))(void *)proc, (void *) clientData)) { result = TCL_ERROR; } else { *idPtr = (Tcl_ThreadId) theThread; diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 0d37d1a..09e98e2 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -454,10 +454,16 @@ const char * Tcl_GetEncodingNameFromEnvironment( Tcl_DString *bufPtr) { + UINT acp = GetACP(); + Tcl_DStringInit(bufPtr); - Tcl_DStringSetLength(bufPtr, 2+TCL_INTEGER_SPACE); - wsprintfA(Tcl_DStringValue(bufPtr), "cp%d", GetACP()); - Tcl_DStringSetLength(bufPtr, strlen(Tcl_DStringValue(bufPtr))); + if (acp == CP_UTF8) { + Tcl_DStringAppend(bufPtr, "utf-8", 5); + } else { + Tcl_DStringSetLength(bufPtr, 2+TCL_INTEGER_SPACE); + wsprintfA(Tcl_DStringValue(bufPtr), "cp%d", GetACP()); + Tcl_DStringSetLength(bufPtr, strlen(Tcl_DStringValue(bufPtr))); + } return Tcl_DStringValue(bufPtr); } |