From af6af80ab88abd5db88a9b378434fa041f19a74a Mon Sep 17 00:00:00 2001 From: nijtmans Date: Mon, 30 Aug 2010 09:19:37 +0000 Subject: [Freq 2965056]: Windows build with -DUNICODE --- ChangeLog | 12 ++++++++++++ win/Makefile.in | 4 ++-- win/rules.vc | 4 ++-- win/tclWinDde.c | 8 +++++++- win/tclWinFCmd.c | 11 +++++------ win/tclWinFile.c | 14 +++++++------- win/tclWinPipe.c | 14 +++++++------- win/tclWinReg.c | 8 +++++++- win/tclWinSock.c | 4 ++-- win/tclWinTest.c | 8 +++++++- 10 files changed, 58 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ff80ad..efb5703 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2010-08-30 Jan Nijtmans + + * win/Makefile.in: [Freq 2965056]: Windows build with -DUNICODE + * win/rules.vc: + * win/tclWinFCmd.c: Make sure that allocated TCHAR arrays are + * win/tclWinFile.c: always properly aligned as wchar_t, and + * win/tclWinPipe.c: not bigger than necessary. + * win/tclWinSock.c: + * win/tclWinDde.c: Those 3 files are not converted yet to be + * win/tclWinReg.c: built with -DUNICODE, so add a TODO. + * win/tclWinTest.c: + 2010-08-29 Donal K. Fellows * doc/dict.n: [Bug 3046999]: Corrected cross reference to array diff --git a/win/Makefile.in b/win/Makefile.in index dbebfc4..0c0c0bb 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.183 2010/08/27 00:50:51 hobbs Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.184 2010/08/30 09:19:38 nijtmans Exp $ VERSION = @TCL_VERSION@ @@ -82,7 +82,7 @@ CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ #CFLAGS = $(CFLAGS_DEBUG) #CFLAGS = $(CFLAGS_OPTIMIZE) #CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) -CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ +CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -DUNICODE -D_UNICODE # To enable compilation debugging reverse the comment characters on one of the # following lines. diff --git a/win/rules.vc b/win/rules.vc index cfddff3..b86c138 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -11,7 +11,7 @@ # Copyright (c) 2003-2007 Patrick Thoyts # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: rules.vc,v 1.42 2010/07/01 21:28:16 nijtmans Exp $ +# RCS: @(#) $Id: rules.vc,v 1.43 2010/08/30 09:19:38 nijtmans Exp $ #------------------------------------------------------------------------------ !ifndef _RULES_VC @@ -130,7 +130,7 @@ DEBUGFLAGS = $(DEBUGFLAGS) -RTC1 DEBUGFLAGS = $(DEBUGFLAGS) -GZ !endif -COMPILERFLAGS =-W3 +COMPILERFLAGS =-W3 -DUNICODE -D_UNICODE # In v13 -GL and -YX are incompatible. !if [nmakehlp -c -YX] diff --git a/win/tclWinDde.c b/win/tclWinDde.c index a0d8145..9909d3a 100644 --- a/win/tclWinDde.c +++ b/win/tclWinDde.c @@ -9,9 +9,15 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinDde.c,v 1.43 2010/05/11 14:47:12 nijtmans Exp $ + * RCS: @(#) $Id: tclWinDde.c,v 1.44 2010/08/30 09:19:38 nijtmans Exp $ */ +/* TODO: This file does not compile in UNICODE mode. + * See [Freq 2965056]: Windows build with -DUNICODE + */ +#undef UNICODE +#undef _UNICODE + #undef STATIC_BUILD #ifndef USE_TCL_STUBS # define USE_TCL_STUBS diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index fd5cd5d..7853227 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.63 2010/08/14 17:13:02 nijtmans Exp $ + * RCS: @(#) $Id: tclWinFCmd.c,v 1.64 2010/08/30 09:19:38 nijtmans Exp $ */ #include "tclWinInt.h" @@ -328,8 +328,8 @@ DoRenameFile( TCHAR *nativeSrcRest, *nativeDstRest; const char **srcArgv, **dstArgv; int size, srcArgc, dstArgc; - TCHAR nativeSrcPath[MAX_PATH*2]; - TCHAR nativeDstPath[MAX_PATH*2]; + TCHAR nativeSrcPath[MAX_PATH]; + TCHAR nativeDstPath[MAX_PATH]; Tcl_DString srcString, dstString; const char *src, *dst; @@ -465,7 +465,7 @@ DoRenameFile( TCHAR *nativeRest, *nativeTmp, *nativePrefix; int result, size; - TCHAR tempBuf[MAX_PATH*2]; + TCHAR tempBuf[MAX_PATH]; size = tclWinProcs->getFullPathNameProc(nativeDst, MAX_PATH, tempBuf, &nativeRest); @@ -473,8 +473,7 @@ DoRenameFile( return TCL_ERROR; } nativeTmp = (TCHAR *) tempBuf; - ((char *) nativeRest)[0] = '\0'; - ((char *) nativeRest)[1] = '\0'; /* In case it's Unicode. */ + nativeRest[0] = '\0'; result = TCL_ERROR; nativePrefix = (tclWinProcs->useWide) diff --git a/win/tclWinFile.c b/win/tclWinFile.c index c38a86f..cb055ac 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.107 2010/04/22 11:40:32 nijtmans Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.108 2010/08/30 09:19:38 nijtmans Exp $ */ /* #define _WIN32_WINNT 0x0500 */ @@ -224,7 +224,7 @@ WinLink( const TCHAR *linkTargetPath, int linkAction) { - TCHAR tempFileName[MAX_PATH*2]; + TCHAR tempFileName[MAX_PATH]; TCHAR *tempFilePart; DWORD attr; @@ -345,7 +345,7 @@ static Tcl_Obj * WinReadLink( const TCHAR *linkSourcePath) { - TCHAR tempFileName[MAX_PATH*2]; + TCHAR tempFileName[MAX_PATH]; TCHAR *tempFilePart; DWORD attr; @@ -1946,7 +1946,7 @@ TclpGetCwd( Tcl_DString *bufferPtr) /* Uninitialized or free DString filled with * name of current directory. */ { - TCHAR buffer[MAX_PATH*2]; + TCHAR buffer[MAX_PATH]; char *p; if (tclWinProcs->getCurrentDirectoryProc(MAX_PATH, buffer) == 0) { @@ -2193,7 +2193,7 @@ NativeDev( { int dev; Tcl_DString ds; - TCHAR nativeFullPath[MAX_PATH*2]; + TCHAR nativeFullPath[MAX_PATH]; TCHAR *nativePart; const char *fullPath; @@ -2367,7 +2367,7 @@ ClientData TclpGetNativeCwd( ClientData clientData) { - TCHAR buffer[MAX_PATH*2]; + TCHAR buffer[MAX_PATH]; if (tclWinProcs->getCurrentDirectoryProc(MAX_PATH, buffer) == 0) { TclWinConvertError(GetLastError()); @@ -2485,7 +2485,7 @@ TclpFilesystemPathType( { #define VOL_BUF_SIZE 32 int found; - TCHAR volType[VOL_BUF_SIZE*2]; + TCHAR volType[VOL_BUF_SIZE]; char *firstSeparator; const char *path; Tcl_Obj *normPath = Tcl_FSGetNormalizedPath(NULL, pathPtr); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 4debaa4..86c546b 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.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: tclWinPipe.c,v 1.80 2010/08/04 21:37:19 hobbs Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.81 2010/08/30 09:19:38 nijtmans Exp $ */ #include "tclWinInt.h" @@ -196,7 +196,7 @@ static DWORD WINAPI PipeReaderThread(LPVOID arg); static void PipeSetupProc(ClientData clientData, int flags); static void PipeWatchProc(ClientData instanceData, int mask); static DWORD WINAPI PipeWriterThread(LPVOID arg); -static int TempFileName(TCHAR name[MAX_PATH*2]); +static int TempFileName(TCHAR name[MAX_PATH]); static int WaitForRead(PipeInfo *infoPtr, int blocking); static void PipeThreadActionProc(ClientData instanceData, int action); @@ -474,7 +474,7 @@ TclWinMakeFile( static int TempFileName( - TCHAR name[MAX_PATH*2]) /* Buffer in which name for temporary file + TCHAR name[MAX_PATH]) /* Buffer in which name for temporary file * gets stored. */ { TCHAR *prefix; @@ -668,7 +668,7 @@ TclFile TclpCreateTempFile( const char *contents) /* String to write into temp file, or NULL. */ { - TCHAR name[MAX_PATH*2]; + TCHAR name[MAX_PATH]; const char *native; Tcl_DString dstring; HANDLE handle; @@ -760,7 +760,7 @@ TclpCreateTempFile( Tcl_Obj * TclpTempFileName(void) { - TCHAR fileName[MAX_PATH*2]; + TCHAR fileName[MAX_PATH]; if (TempFileName(fileName) == 0) { return NULL; @@ -1302,7 +1302,7 @@ ApplicationType( IMAGE_DOS_HEADER header; Tcl_DString nameBuf, ds; const TCHAR *nativeName; - TCHAR nativeFullPath[MAX_PATH*2]; + TCHAR nativeFullPath[MAX_PATH]; static char extensions[][5] = {"", ".com", ".exe", ".bat"}; /* @@ -3099,7 +3099,7 @@ TclpOpenTemporaryFile( Tcl_Obj *extensionObj, Tcl_Obj *resultingNameObj) { - TCHAR name[MAX_PATH*2]; + TCHAR name[MAX_PATH]; char *namePtr; HANDLE handle; DWORD flags = FILE_ATTRIBUTE_TEMPORARY; diff --git a/win/tclWinReg.c b/win/tclWinReg.c index a2d9085..987099c 100644 --- a/win/tclWinReg.c +++ b/win/tclWinReg.c @@ -11,9 +11,15 @@ * 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.53 2010/04/02 19:27:44 kennykb Exp $ + * RCS: @(#) $Id: tclWinReg.c,v 1.54 2010/08/30 09:19:38 nijtmans Exp $ */ +/* TODO: This file does not compile in UNICODE mode. + * See [Freq 2965056]: Windows build with -DUNICODE + */ +#undef UNICODE +#undef _UNICODE + #undef STATIC_BUILD #ifndef USE_TCL_STUBS # define USE_TCL_STUBS diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 5734cb5..b4ae07b 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -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. * - * RCS: @(#) $Id: tclWinSock.c,v 1.72 2010/05/11 14:47:12 nijtmans Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.73 2010/08/30 09:19:37 nijtmans Exp $ */ #include "tclWinInt.h" @@ -2424,7 +2424,7 @@ InitializeHostName( int *lengthPtr, Tcl_Encoding *encodingPtr) { - TCHAR tbuf[(MAX_COMPUTERNAME_LENGTH + 1)*2]; + TCHAR tbuf[MAX_COMPUTERNAME_LENGTH + 1]; DWORD length = MAX_COMPUTERNAME_LENGTH + 1; Tcl_DString ds; diff --git a/win/tclWinTest.c b/win/tclWinTest.c index 33ceaf6..1a1c9d2 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.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: tclWinTest.c,v 1.26 2009/11/18 23:46:05 nijtmans Exp $ + * RCS: @(#) $Id: tclWinTest.c,v 1.27 2010/08/30 09:19:38 nijtmans Exp $ */ +/* TODO: This file does not compile in UNICODE mode. + * See [Freq 2965056]: Windows build with -DUNICODE + */ +#undef UNICODE +#undef _UNICODE + #ifndef USE_TCL_STUBS # define USE_TCL_STUBS #endif -- cgit v0.12