summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2010-12-01 16:42:33 (GMT)
committerKevin B Kenny <kennykb@acm.org>2010-12-01 16:42:33 (GMT)
commit921c2612861d68b7b4eee66736379431ac081f30 (patch)
tree47091361dfd1c093c24bb1dc06082c6dc469eaad /win
parent86b28e0c4b2444435a30d345b3fe26daaf9de126 (diff)
downloadtcl-921c2612861d68b7b4eee66736379431ac081f30.zip
tcl-921c2612861d68b7b4eee66736379431ac081f30.tar.gz
tcl-921c2612861d68b7b4eee66736379431ac081f30.tar.bz2
merge
Diffstat (limited to 'win')
-rw-r--r--win/.cvsignore1
-rw-r--r--win/Makefile.in8
-rw-r--r--win/cat.c11
-rwxr-xr-xwin/configure70
-rw-r--r--win/configure.in3
-rw-r--r--win/makefile.vc9
-rw-r--r--win/tcl.m418
-rw-r--r--win/tclAppInit.c66
-rw-r--r--win/tclWin32Dll.c8
-rw-r--r--win/tclWinChan.c4
-rw-r--r--win/tclWinFCmd.c20
-rw-r--r--win/tclWinFile.c16
-rw-r--r--win/tclWinPort.h6
-rw-r--r--win/tclWinReg.c28
14 files changed, 185 insertions, 83 deletions
diff --git a/win/.cvsignore b/win/.cvsignore
index c3044c9..90b96de 100644
--- a/win/.cvsignore
+++ b/win/.cvsignore
@@ -29,3 +29,4 @@ tcl.suo
*.pch
versions.vc
vercl.x
+Release_VC*
diff --git a/win/Makefile.in b/win/Makefile.in
index ed7377a..2d1c4c4 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -4,7 +4,7 @@
# "./configure", which is a configuration script generated by the "autoconf"
# program (constructs like "@foo@" will get replaced in the actual Makefile.
#
-# RCS: @(#) $Id: Makefile.in,v 1.184.2.1 2010/09/21 19:32:26 kennykb Exp $
+# RCS: @(#) $Id: Makefile.in,v 1.184.2.2 2010/12/01 16:42:37 kennykb Exp $
VERSION = @TCL_VERSION@
@@ -252,6 +252,7 @@ GENERIC_OBJS = \
tclListObj.$(OBJEXT) \
tclLoad.$(OBJEXT) \
tclMain.$(OBJEXT) \
+ tclMain2.$(OBJEXT) \
tclNamesp.$(OBJEXT) \
tclNotify.$(OBJEXT) \
tclOO.$(OBJEXT) \
@@ -318,6 +319,7 @@ TOMMATH_OBJS = \
bn_mp_init_copy.${OBJEXT} \
bn_mp_init_multi.${OBJEXT} \
bn_mp_init_set.${OBJEXT} \
+ bn_mp_init_set_int.${OBJEXT} \
bn_mp_init_size.${OBJEXT} \
bn_mp_karatsuba_mul.${OBJEXT} \
bn_mp_karatsuba_sqr.$(OBJEXT) \
@@ -335,6 +337,7 @@ TOMMATH_OBJS = \
bn_mp_read_radix.${OBJEXT} \
bn_mp_rshd.${OBJEXT} \
bn_mp_set.${OBJEXT} \
+ bn_mp_set_int.${OBJEXT} \
bn_mp_shrink.${OBJEXT} \
bn_mp_sqr.${OBJEXT} \
bn_mp_sqrt.${OBJEXT} \
@@ -500,6 +503,9 @@ tclWinPipe.${OBJEXT}: tclWinPipe.c
testMain.${OBJEXT}: tclAppInit.c
$(CC) -c $(CC_SWITCHES) -DTCL_TEST @DEPARG@ $(CC_OBJNAME)
+tclMain2.${OBJEXT}: tclMain.c
+ $(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DTCL_ASCII_MAIN @DEPARG@ $(CC_OBJNAME)
+
# TIP #59, embedding of configuration information into the binary library.
#
# Part of Tcl's configuration information are the paths where it was installed
diff --git a/win/cat.c b/win/cat.c
index c91e0d2..680f959 100644
--- a/win/cat.c
+++ b/win/cat.c
@@ -8,9 +8,15 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: cat.c,v 1.5 2010/01/13 06:46:56 nijtmans Exp $
+ * RCS: @(#) $Id: cat.c,v 1.5.4.1 2010/12/01 16:42:37 kennykb Exp $
*/
+#ifdef TCL_BROKEN_MAINARGS
+/* On mingw32 and cygwin this doesn't work */
+# undef UNICODE
+# undef _UNICODE
+#endif
+
#include <stdio.h>
#ifdef __CYGWIN__
# include <unistd.h>
@@ -18,9 +24,10 @@
# include <io.h>
#endif
#include <string.h>
+#include <tchar.h>
int
-main(void)
+_tmain(void)
{
char buf[1024];
int n;
diff --git a/win/configure b/win/configure
index f6f8b81..472ad1b 100755
--- a/win/configure
+++ b/win/configure
@@ -4047,6 +4047,72 @@ echo "$as_me: WARNING: 64bit mode not supported with GCC on Windows" >&2;}
rm -f ac$$.o ac$$.c
fi
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -mwindows -municode -Dmain=xxmain"
+ echo "$as_me:$LINENO: checking for working -municode linker flag" >&5
+echo $ECHO_N "checking for working -municode linker flag... $ECHO_C" >&6
+if test "${ac_cv_municode+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+ #include <windows.h>
+ int APIENTRY wWinMain(HINSTANCE a, HINSTANCE b, LPWSTR c, int d) {return 0;}
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_municode=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_municode=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_municode" >&5
+echo "${ECHO_T}$ac_cv_municode" >&6
+ CFLAGS=$hold_cflags
+ if test "$ac_cv_municode" = "yes" ; then
+ extra_ldflags="$extra_ldflags -municode"
+ else
+ extra_cflags="$extra_cflags -DTCL_BROKEN_MAINARGS"
+ fi
+
if test "${SHARED_BUILD}" = "0" ; then
# static
echo "$as_me:$LINENO: result: using static flags" >&5
@@ -4461,6 +4527,10 @@ else
ZLIB_OBJS=\${ZLIB_OBJS}
+ cat >>confdefs.h <<_ACEOF
+#define NO_VIZ 1
+_ACEOF
+
fi
diff --git a/win/configure.in b/win/configure.in
index 0074038..e3a175a 100644
--- a/win/configure.in
+++ b/win/configure.in
@@ -3,7 +3,7 @@
# generate the file "configure", which is run during Tcl installation
# to configure the system for the local environment.
#
-# RCS: @(#) $Id: configure.in,v 1.123.2.1 2010/09/28 15:43:01 kennykb Exp $
+# RCS: @(#) $Id: configure.in,v 1.123.2.2 2010/12/01 16:42:37 kennykb Exp $
AC_INIT(../generic/tcl.h)
AC_PREREQ(2.59)
@@ -326,6 +326,7 @@ AS_IF([test "$tcl_ok" = "yes"], [
AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win32/zdll.lib])
], [
AC_SUBST(ZLIB_OBJS,[\${ZLIB_OBJS}])
+ AC_DEFINE_UNQUOTED(NO_VIZ, 1)
])
AC_DEFINE(HAVE_ZLIB, 1, [Is there an installed zlib?])
diff --git a/win/makefile.vc b/win/makefile.vc
index 4586c14..cfa8770 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -13,7 +13,7 @@
# Copyright (c) 2003-2008 Pat Thoyts.
#
#------------------------------------------------------------------------------
-# RCS: @(#) $Id: makefile.vc,v 1.214.2.2 2010/10/20 01:50:19 kennykb Exp $
+# RCS: @(#) $Id: makefile.vc,v 1.214.2.3 2010/12/01 16:42:37 kennykb Exp $
#------------------------------------------------------------------------------
# Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR)
@@ -290,6 +290,7 @@ COREOBJS = \
$(TMP_DIR)\tclLiteral.obj \
$(TMP_DIR)\tclLoad.obj \
$(TMP_DIR)\tclMain.obj \
+ $(TMP_DIR)\tclMain2.obj \
$(TMP_DIR)\tclNamesp.obj \
$(TMP_DIR)\tclNotify.obj \
$(TMP_DIR)\tclOO.obj \
@@ -369,6 +370,7 @@ TOMMATHOBJS = \
$(TMP_DIR)\bn_mp_init_copy.obj \
$(TMP_DIR)\bn_mp_init_multi.obj \
$(TMP_DIR)\bn_mp_init_set.obj \
+ $(TMP_DIR)\bn_mp_init_set_int.obj \
$(TMP_DIR)\bn_mp_init_size.obj \
$(TMP_DIR)\bn_mp_karatsuba_mul.obj \
$(TMP_DIR)\bn_mp_karatsuba_sqr.obj \
@@ -386,6 +388,7 @@ TOMMATHOBJS = \
$(TMP_DIR)\bn_mp_read_radix.obj \
$(TMP_DIR)\bn_mp_rshd.obj \
$(TMP_DIR)\bn_mp_set.obj \
+ $(TMP_DIR)\bn_mp_set_int.obj \
$(TMP_DIR)\bn_mp_shrink.obj \
$(TMP_DIR)\bn_mp_sqr.obj \
$(TMP_DIR)\bn_mp_sqrt.obj \
@@ -897,6 +900,10 @@ $(TMP_DIR)\testMain.obj: $(WINDIR)\tclAppInit.c
-DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
-Fo$@ $?
+$(TMP_DIR)\tclMain2.obj: $(GENERICDIR)\tclMain.c
+ $(cc32) $(TCL_CFLAGS) -DBUILD_tcl -DTCL_ASCII_MAIN \
+ -Fo$@ $?
+
$(TMP_DIR)\tclTest.obj: $(GENERICDIR)\tclTest.c
$(cc32) $(TCL_CFLAGS) -Fo$@ $?
diff --git a/win/tcl.m4 b/win/tcl.m4
index ff07c34..88ec090 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -495,6 +495,24 @@ file for information about building with Mingw.])
rm -f ac$$.o ac$$.c
fi
+ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -mwindows -municode -Dmain=xxmain"
+ AC_CACHE_CHECK(for working -municode linker flag,
+ ac_cv_municode,
+ AC_TRY_LINK([
+ #include <windows.h>
+ int APIENTRY wWinMain(HINSTANCE a, HINSTANCE b, LPWSTR c, int d) {return 0;}
+ ],
+ [],
+ ac_cv_municode=yes,
+ ac_cv_municode=no)
+ )
+ CFLAGS=$hold_cflags
+ if test "$ac_cv_municode" = "yes" ; then
+ extra_ldflags="$extra_ldflags -municode"
+ else
+ extra_cflags="$extra_cflags -DTCL_BROKEN_MAINARGS"
+ fi
+
if test "${SHARED_BUILD}" = "0" ; then
# static
AC_MSG_RESULT([using static flags])
diff --git a/win/tclAppInit.c b/win/tclAppInit.c
index 6711384..eb4347b 100644
--- a/win/tclAppInit.c
+++ b/win/tclAppInit.c
@@ -12,15 +12,9 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclAppInit.c,v 1.31.2.1 2010/09/25 14:51:13 kennykb Exp $
+ * RCS: @(#) $Id: tclAppInit.c,v 1.31.2.2 2010/12/01 16:42:38 kennykb Exp $
*/
-/* TODO: This file does not compile in UNICODE mode.
- * See [Freq 2965056]: Windows build with -DUNICODE
- */
-#undef UNICODE
-#undef _UNICODE
-
#include "tcl.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -34,9 +28,15 @@ extern Tcl_PackageInitProc Tcltest_Init;
extern Tcl_PackageInitProc Tcltest_SafeInit;
#endif /* TCL_TEST */
-#if defined(__GNUC__)
+#if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES
+extern Tcl_PackageInitProc Registry_Init;
+extern Tcl_PackageInitProc Dde_Init;
+extern Tcl_PackageInitProc Dde_SafeInit;
+#endif
+
+#ifdef TCL_BROKEN_MAINARGS
static void setargv(int *argcPtr, TCHAR ***argvPtr);
-#endif /* __GNUC__ */
+#endif
/*
* The following #if block allows you to change the AppInit function by using
@@ -76,11 +76,20 @@ extern int TCL_LOCAL_MAIN_HOOK(int *argc, TCHAR ***argv);
*----------------------------------------------------------------------
*/
+#ifdef TCL_BROKEN_MAINARGS
+int
+main(
+ int argc,
+ char *dummy[])
+{
+ TCHAR **argv;
+#else
int
_tmain(
int argc,
TCHAR *argv[])
{
+#endif
TCHAR *p;
/*
@@ -90,11 +99,11 @@ _tmain(
setlocale(LC_ALL, "C");
+#ifdef TCL_BROKEN_MAINARGS
/*
* Get our args from the c-runtime. Ignore lpszCmdLine.
*/
-#if defined(__GNUC__)
setargv(&argc, &argv);
#endif
@@ -144,21 +153,15 @@ Tcl_AppInit(
}
#if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES
- {
- extern Tcl_PackageInitProc Registry_Init;
- extern Tcl_PackageInitProc Dde_Init;
- extern Tcl_PackageInitProc Dde_SafeInit;
-
- if (Registry_Init(interp) == TCL_ERROR) {
- return TCL_ERROR;
- }
- Tcl_StaticPackage(interp, "registry", Registry_Init, NULL);
+ if (Registry_Init(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ Tcl_StaticPackage(interp, "registry", Registry_Init, NULL);
- if (Dde_Init(interp) == TCL_ERROR) {
- return TCL_ERROR;
- }
- Tcl_StaticPackage(interp, "dde", Dde_Init, Dde_SafeInit);
- }
+ if (Dde_Init(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ Tcl_StaticPackage(interp, "dde", Dde_Init, Dde_SafeInit);
#endif
#ifdef TCL_TEST
@@ -223,7 +226,7 @@ Tcl_AppInit(
*--------------------------------------------------------------------------
*/
-#if defined(__GNUC__)
+#ifdef TCL_BROKEN_MAINARGS
static void
setargv(
int *argcPtr, /* Filled with number of argument strings. */
@@ -252,10 +255,15 @@ setargv(
}
}
}
+
+ /* Make sure we don't call ckalloc through the (not yet initialized) stub table */
+ #undef Tcl_Alloc
+ #undef Tcl_DbCkalloc
+
argSpace = (TCHAR *) ckalloc(
- (unsigned) (size * sizeof(TCHAR *) + (_tcslen(cmdLine) * sizeof(TCHAR)) + 1));
+ (unsigned) (size * sizeof(char *) + (_tcslen(cmdLine) * sizeof(TCHAR)) + sizeof(TCHAR)));
argv = (TCHAR **) argSpace;
- argSpace += size * sizeof(TCHAR *);
+ argSpace += size * (sizeof(char *)/sizeof(TCHAR));
size--;
p = cmdLine;
@@ -305,7 +313,7 @@ setargv(
}
p++;
}
- *arg = TEXT('\0');
+ *arg = '\0';
argSpace = arg + 1;
}
argv[argc] = NULL;
@@ -313,7 +321,7 @@ setargv(
*argcPtr = argc;
*argvPtr = argv;
}
-#endif /* __GNUC__ */
+#endif /* TCL_BROKEN_MAINARGS */
/*
* Local Variables:
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index 673d811..eb19cea 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.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: tclWin32Dll.c,v 1.68.2.1 2010/10/20 01:50:19 kennykb Exp $
+ * RCS: @(#) $Id: tclWin32Dll.c,v 1.68.2.2 2010/12/01 16:42:38 kennykb Exp $
*/
#include "tclWinInt.h"
@@ -522,7 +522,7 @@ TclWinDriveLetterForVolMountPoint(
*/
Tcl_MutexUnlock(&mountPointMap);
- return dlIter->driveLetter;
+ return (char) dlIter->driveLetter;
}
}
@@ -602,7 +602,7 @@ TclWinDriveLetterForVolMountPoint(
dlIter = dlIter->nextPtr) {
if (_tcscmp(dlIter->volumeName, mountPoint) == 0) {
Tcl_MutexUnlock(&mountPointMap);
- return dlIter->driveLetter;
+ return (char) dlIter->driveLetter;
}
}
@@ -718,7 +718,7 @@ TclWinCPUID(
unsigned int index, /* Which CPUID value to retrieve. */
unsigned int *regsPtr) /* Registers after the CPUID. */
{
-#ifdef HAVE_NO_SEH
+#if defined(__GNUC__) && !defined(_WIN64)
EXCEPTION_REGISTRATION registration;
#endif
int status = TCL_ERROR;
diff --git a/win/tclWinChan.c b/win/tclWinChan.c
index 37e9011..caa0c9f 100644
--- a/win/tclWinChan.c
+++ b/win/tclWinChan.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinChan.c,v 1.59 2010/09/13 14:20:39 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinChan.c,v 1.59.2.1 2010/12/01 16:42:38 kennykb Exp $
*/
#include "tclWinInt.h"
@@ -1027,7 +1027,7 @@ Tcl_MakeFileChannel(
int mode) /* ORed combination of TCL_READABLE and
* TCL_WRITABLE to indicate file mode. */
{
-#ifdef HAVE_NO_SEH
+#if defined(HAVE_NO_SEH) && !defined(_WIN64)
EXCEPTION_REGISTRATION registration;
#endif
char channelName[16 + TCL_INTEGER_SPACE];
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index 3856ffa..149e135 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinFCmd.c,v 1.67.2.2 2010/10/20 01:50:19 kennykb Exp $
+ * RCS: @(#) $Id: tclWinFCmd.c,v 1.67.2.3 2010/12/01 16:42:38 kennykb Exp $
*/
#include "tclWinInt.h"
@@ -177,7 +177,7 @@ DoRenameFile(
const TCHAR *nativeDst) /* New pathname for file or directory
* (native). */
{
-#ifdef HAVE_NO_SEH
+#if defined(HAVE_NO_SEH) && !defined(_WIN64)
EXCEPTION_REGISTRATION registration;
#endif
DWORD srcAttr, dstAttr;
@@ -564,7 +564,7 @@ DoCopyFile(
const TCHAR *nativeSrc, /* Pathname of file to be copied (native). */
const TCHAR *nativeDst) /* Pathname of file to copy to (native). */
{
-#ifdef HAVE_NO_SEH
+#if defined(HAVE_NO_SEH) && !defined(_WIN64)
EXCEPTION_REGISTRATION registration;
#endif
int retval = -1;
@@ -1278,7 +1278,7 @@ TraverseWinTree(
return traverseProc(nativeSource, nativeTarget, DOTREE_F, errorPtr);
}
- Tcl_DStringAppend(sourcePtr, (char *) L"\\*.*", 4 * sizeof(WCHAR) + 1);
+ Tcl_DStringAppend(sourcePtr, (char *) TEXT("\\*.*"), 4 * sizeof(TCHAR) + 1);
Tcl_DStringSetLength(sourcePtr, Tcl_DStringLength(sourcePtr) - 1);
nativeSource = (TCHAR *) Tcl_DStringValue(sourcePtr);
@@ -1302,15 +1302,15 @@ TraverseWinTree(
return result;
}
- sourceLen = oldSourceLen + sizeof(WCHAR);
- Tcl_DStringAppend(sourcePtr, (char *) L"\\", sizeof(WCHAR) + 1);
+ sourceLen = oldSourceLen + sizeof(TCHAR);
+ Tcl_DStringAppend(sourcePtr, (char *) TEXT("\\"), sizeof(TCHAR) + 1);
Tcl_DStringSetLength(sourcePtr, sourceLen);
if (targetPtr != NULL) {
oldTargetLen = Tcl_DStringLength(targetPtr);
targetLen = oldTargetLen;
- targetLen += sizeof(WCHAR);
- Tcl_DStringAppend(targetPtr, (char *) L"\\", sizeof(WCHAR) + 1);
+ targetLen += sizeof(TCHAR);
+ Tcl_DStringAppend(targetPtr, (char *) TEXT("\\"), sizeof(TCHAR) + 1);
Tcl_DStringSetLength(targetPtr, targetLen);
}
@@ -1319,7 +1319,7 @@ TraverseWinTree(
TCHAR *nativeName;
int len;
- WCHAR *wp = data.cFileName;
+ TCHAR *wp = data.cFileName;
if (*wp == '.') {
wp++;
if (*wp == '.') {
@@ -1330,7 +1330,7 @@ TraverseWinTree(
}
}
nativeName = (TCHAR *) data.cFileName;
- len = wcslen(data.cFileName) * sizeof(WCHAR);
+ len = _tcslen(data.cFileName) * sizeof(TCHAR);
/*
* Append name after slash, and recurse on the file.
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index ab4eb76..1858756 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinFile.c,v 1.112.2.2 2010/10/20 01:50:19 kennykb Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.112.2.3 2010/12/01 16:42:38 kennykb Exp $
*/
#include "tclWinInt.h"
@@ -573,6 +573,7 @@ WinReadLinkDirectory(
*/
offset = 0;
+#ifdef UNICODE
if (reparseBuffer->MountPointReparseBuffer.PathBuffer[0] == L'\\') {
/*
* Check whether this is a mounted volume.
@@ -634,6 +635,7 @@ WinReadLinkDirectory(
offset = 4;
}
}
+#endif /* UNICODE */
Tcl_WinTCharToUtf((const TCHAR *)
reparseBuffer->MountPointReparseBuffer.PathBuffer,
@@ -1712,19 +1714,19 @@ static int
NativeIsExec(
const TCHAR *path)
{
- int len = wcslen(path);
+ int len = _tcslen(path);
if (len < 5) {
return 0;
}
- if (path[len-4] != L'.') {
+ if (path[len-4] != TEXT('.')) {
return 0;
}
- if ((_wcsicmp(path+len-3, L"exe") == 0)
- || (_wcsicmp(path+len-3, L"com") == 0)
- || (_wcsicmp(path+len-3, L"bat") == 0)) {
+ if ((_tcsicmp(path+len-3, TEXT("exe")) == 0)
+ || (_tcsicmp(path+len-3, TEXT("com")) == 0)
+ || (_tcsicmp(path+len-3, TEXT("bat")) == 0)) {
return 1;
}
return 0;
@@ -3128,7 +3130,7 @@ TclNativeDupInternalRep(
return NULL;
}
- len = sizeof(TCHAR) * (_tcslen((const WCHAR *) clientData) + 1);
+ len = sizeof(TCHAR) * (_tcslen((const TCHAR *) clientData) + 1);
copy = (char *) ckalloc(len);
memcpy(copy, clientData, len);
diff --git a/win/tclWinPort.h b/win/tclWinPort.h
index 689cc14..fdede5b 100644
--- a/win/tclWinPort.h
+++ b/win/tclWinPort.h
@@ -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: tclWinPort.h,v 1.61.2.1 2010/09/28 15:43:01 kennykb Exp $
+ * RCS: @(#) $Id: tclWinPort.h,v 1.61.2.2 2010/12/01 16:42:38 kennykb Exp $
*/
#ifndef _TCLWINPORT
@@ -58,6 +58,10 @@
typedef _TCHAR TCHAR;
# define _TCHAR_DEFINED
#endif
+#if defined(_MSC_VER) && defined(__STDC__)
+ /* VS2005 SP1 misses this. See [Bug #3110161] */
+ typedef _TCHAR TCHAR;
+#endif
/*
*---------------------------------------------------------------------------
diff --git a/win/tclWinReg.c b/win/tclWinReg.c
index 3bc4ae3..f59ee23 100644
--- a/win/tclWinReg.c
+++ b/win/tclWinReg.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinReg.c,v 1.54.2.1 2010/10/20 01:50:19 kennykb Exp $
+ * RCS: @(#) $Id: tclWinReg.c,v 1.54.2.2 2010/12/01 16:42:38 kennykb Exp $
*/
#undef STATIC_BUILD
@@ -1491,34 +1491,12 @@ AppendSystemError(
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (TCHAR *) tMsgPtrPtr,
0, NULL);
if (length == 0) {
- char *msgPtr;
-
- length = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM
- | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, error,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (char *) &msgPtr,
- 0, NULL);
- if (length > 0) {
- tMsgPtr = (TCHAR *)
- LocalAlloc(LPTR, (length + 1) * sizeof(TCHAR));
- MultiByteToWideChar(CP_ACP, 0, msgPtr, length + 1, tMsgPtr,
- length + 1);
- LocalFree(msgPtr);
- }
- }
- if (length == 0) {
- if (error == ERROR_CALL_NOT_IMPLEMENTED) {
- strcpy(msgBuf, "function not supported under Win32s");
- } else {
- sprintf(msgBuf, "unknown error: %ld", error);
- }
+ sprintf(msgBuf, "unknown error: %ld", error);
msg = msgBuf;
} else {
- Tcl_Encoding encoding;
char *msgPtr;
- encoding = Tcl_GetEncoding(NULL, "unicode");
- Tcl_ExternalToUtfDString(encoding, (char *) tMsgPtr, -1, &ds);
- Tcl_FreeEncoding(encoding);
+ Tcl_WinTCharToUtf(tMsgPtr, -1, &ds);
LocalFree(tMsgPtr);
msgPtr = Tcl_DStringValue(&ds);