From d233fd15ae3557d7fee760120f736c0a0a90bae2 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Tue, 21 Sep 2010 21:50:35 +0000 Subject: [Bug 3069278]: Breakage on head Windows triggered by install-tzdata, final fix --- ChangeLog | 2 ++ win/tclWinFCmd.c | 20 ++++++-------------- win/tclWinPipe.c | 6 +++--- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index b340355..161c59f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ * win/tclWinFile.c: Fix declaration after statement. * win/tcl.m4: Add -Wdeclaration-after-statement, so * win/configure: this mistake cannot happen again. + * win/tclWinFCmd.c: [Bug 3069278]: Breakage on head Windows triggered + * win/tclWinPipe.c: by install-tzdata, final fix 2010-09-20 Jan Nijtmans diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index fe89976..47c1b09 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -9,17 +9,9 @@ * 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 2010/09/20 14:28:15 nijtmans Exp $ + * RCS: @(#) $Id: tclWinFCmd.c,v 1.68 2010/09/21 21:50:35 nijtmans Exp $ */ -/* TODO: This file does not compile in UNICODE mode. - * See [Freq 2965056]: Windows build with -DUNICODE - * and - * [Bug 3069278]: breakage on head Windows triggered by install-tzdata - */ -#undef UNICODE -#undef _UNICODE - #include "tclWinInt.h" /* @@ -339,8 +331,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; @@ -476,7 +468,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); @@ -484,7 +476,7 @@ DoRenameFile( return TCL_ERROR; } nativeTmp = (TCHAR *) tempBuf; - nativeRest[0] = '\0'; + nativeRest[0] = L'\0'; result = TCL_ERROR; nativePrefix = (TCHAR *) L"tclr"; @@ -1304,7 +1296,7 @@ TraverseWinTree( goto end; } - nativeSource[oldSourceLen + 1] = '\0'; + Tcl_DStringSetLength(sourcePtr, oldSourceLen + 1); Tcl_DStringSetLength(sourcePtr, oldSourceLen); result = traverseProc(nativeSource, nativeTarget, DOTREE_PRED, errorPtr); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index a41898d..3aa641a 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.83 2010/09/20 14:28:15 nijtmans Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.84 2010/09/21 21:50:35 nijtmans Exp $ */ #include "tclWinInt.h" @@ -3133,8 +3133,8 @@ TclpOpenTemporaryFile( sprintf(number, "%d.TMP", counter); counter = (unsigned short) (counter + 1); tclWinProcs->utf2tchar(number, strlen(number), &buf); - memcpy(namePtr, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf)); - *(WCHAR *)(namePtr + Tcl_DStringLength(&buf) + 1) = '\0'; + Tcl_DStringSetLength(&buf, Tcl_DStringLength(&buf) + 1); + memcpy(namePtr, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf) + 1); Tcl_DStringFree(&buf); handle = tclWinProcs->createFileProc((TCHAR *) name, -- cgit v0.12