Tcl Source Code

Artifact [df3c761b24]
Login

Artifact df3c761b246c85bd41343d34e31588be1f19adaf:

Attachment "patch.txt" to ticket [528669ffff] added by davygrvy 2002-03-12 05:11:51.
Index: tclAppInit.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclAppInit.c,v
retrieving revision 1.8
diff -c -r1.8 tclAppInit.c
*** tclAppInit.c	21 Feb 2002 21:20:08 -0000	1.8
--- tclAppInit.c	11 Mar 2002 22:06:47 -0000
***************
*** 218,225 ****
      char *cmdLine, *p, *arg, *argSpace;
      char **argv;
      int argc, size, inquote, copy, slashes;
      
!     cmdLine = GetCommandLine();	/* INTL: BUG */
  
      /*
       * Precompute an overly pessimistic guess at the number of arguments
--- 218,236 ----
      char *cmdLine, *p, *arg, *argSpace;
      char **argv;
      int argc, size, inquote, copy, slashes;
+     WCHAR *cmdLineUni;
+ 
+     cmdLineUni = GetCommandLineW();
      
!     /* calculate the size needed. */
!     size = WideCharToMultiByte(CP_OEMCP, 0, cmdLineUni, -1, 0, 0, NULL, NULL);
!     cmdLine = Tcl_Alloc(size);
! 
!     /* INTL: BUG */
!     /* We should replace the conversion with CP_UTF8, but Tcl_Main() expects
!      * argv to be dirty.  So we can't clean it here.  This, thus, creates a
!      * unicode loss. */
!     WideCharToMultiByte(CP_OEMCP, 0, cmdLineUni, -1, cmdLine, size, NULL, NULL);
  
      /*
       * Precompute an overly pessimistic guess at the number of arguments
***************
*** 298,301 ****
--- 309,313 ----
  
      *argcPtr = argc;
      *argvPtr = argv;
+     Tcl_Free(cmdLine);
  }