Tcl Source Code

Artifact [693fe8205e]
Login

Artifact 693fe8205ef85c69409151fd8c09ffd17fba3f50:

Attachment "3069278.patch" to ticket [3069278fff] added by nijtmans 2010-09-21 18:32:20.
Index: win/tclWinFCmd.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinFCmd.c,v
retrieving revision 1.67
diff -u -r1.67 tclWinFCmd.c
--- win/tclWinFCmd.c	20 Sep 2010 14:28:15 -0000	1.67
+++ win/tclWinFCmd.c	21 Sep 2010 09:34:36 -0000
@@ -12,14 +12,6 @@
  * RCS: @(#) $Id: tclWinFCmd.c,v 1.67 2010/09/20 14:28:15 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 @@
 	    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 @@
 
 		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 @@
 		    return TCL_ERROR;
 		}
 		nativeTmp = (TCHAR *) tempBuf;
-		nativeRest[0] = '\0';
+		nativeRest[0] = L'\0';
 
 		result = TCL_ERROR;
 		nativePrefix = (TCHAR *) L"tclr";
@@ -1304,7 +1296,7 @@
 	goto end;
     }
 
-    nativeSource[oldSourceLen + 1] = '\0';
+    Tcl_DStringSetLength(sourcePtr, oldSourceLen + 1);
     Tcl_DStringSetLength(sourcePtr, oldSourceLen);
     result = traverseProc(nativeSource, nativeTarget, DOTREE_PRED,
 	    errorPtr);
Index: win/tclWinPipe.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWinPipe.c,v
retrieving revision 1.83
diff -u -r1.83 tclWinPipe.c
--- win/tclWinPipe.c	20 Sep 2010 14:28:15 -0000	1.83
+++ win/tclWinPipe.c	21 Sep 2010 09:34:38 -0000
@@ -3133,8 +3133,8 @@
 	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,
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.5225
diff -u -r1.5225 ChangeLog
--- ChangeLog	20 Sep 2010 14:28:15 -0000	1.5225
+++ ChangeLog	21 Sep 2010 09:34:35 -0000
@@ -1,3 +1,8 @@
+2010-09-21  Jan Nijtmans  <[email protected]>
+
+	* win/tclWinFCmd.c: [Bug 3069278]: Breakage on head Windows triggered
+	* win/tclWinPipe.c: by install-tzdata.
+
 2010-09-20  Jan Nijtmans  <[email protected]>
 
 	* win/tclWinFCmd.c: Eliminate tclWinProcs->useWide everywhere, since