diff options
author | Mohan Embar <gnustuff@thisiscool.com> | 2003-12-02 22:26:50 +0000 |
---|---|---|
committer | Mohan Embar <membar@gcc.gnu.org> | 2003-12-02 22:26:50 +0000 |
commit | 83c02e38a3bf8e6d547a292754a581096021b594 (patch) | |
tree | 4db34f47c7611b5c83b79334f47f1a5411fbbc44 /libjava/java/lang/natWin32Process.cc | |
parent | 5f8a45f75c9e3785bb7146721910d6ffe4e9d7e6 (diff) | |
download | gcc-83c02e38a3bf8e6d547a292754a581096021b594.zip gcc-83c02e38a3bf8e6d547a292754a581096021b594.tar.gz gcc-83c02e38a3bf8e6d547a292754a581096021b594.tar.bz2 |
configure.in: Added new MinGW-specific configure flag --with-win32-nlsapi.
* configure.in: Added new MinGW-specific configure flag
--with-win32-nlsapi.
Added new AC_DEFINE MINGW_LIBGCJ_UNICODE.
Add -lunicows to MinGW SYSTEMSPEC if --with-win32-nlsapi
is set to unicows.
* configure: Rebuilt.
* include/config.h.in: Rebuilt.
* win32.cc (_Jv_Win32NewString): Implemented.
(nativeToUnicode): New helper function defined only for
non-UNICODE builds.
(unicodeToNative): Likewise.
(_Jv_Win32TempString): Implemented.
(lots): Refactored using tchar.h macros.
(WSAEventWrapper): Use _Jv_Win32NewString.
(_Jv_platform_initialize): Use GetModuleFileNameA instead
of GetModuleFileName.
(_Jv_platform_initProperties): Use _Jv_Win32NewString.
Use temporary stack buffer instead of a heap buffer.
* include/win32.h
Added defines for UNICODE and _UNICODE if MINGW_LIBGCJ_UNICODE is
defined; added tchar.h include.
(_Jv_Win32TempString): Declared new helper class.
(JV_TEMP_STRING_WIN32): New helper macro.
(_Jv_Win32NewString): Declared new helper method.
* java/io/natFileDescriptorWin32.cc (open): Use
JV_TEMP_STRING_WIN32 instead of JV_TEMP_UTF_STRING.
(write): Reformatted slightly.
* java/io/natFileWin32.cc (lots): Use tchar.h macros;
use JV_TEMP_STRING_WIN32 instead of JV_TEMP_UTF_STRING.
(getCanonicalPath): Use _Jv_Win32NewString instead of
JvNewStringUTF.
(performList): Likewise.
* java/lang/natWin32Process.cc (ChildProcessPipe):
Use tchar.h macros.
(startProcess): Use tchar.h macros, JV_TEMP_STRING_WIN32,
and UNICODE environment flag for CreateProcess.
* java/net/natNetworkInterfaceWin32.cc
(winsock2GetRealNetworkInterfaces): Use tchar.h macros and
_Jv_Win32NewString.
From-SVN: r74201
Diffstat (limited to 'libjava/java/lang/natWin32Process.cc')
-rw-r--r-- | libjava/java/lang/natWin32Process.cc | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/libjava/java/lang/natWin32Process.cc b/libjava/java/lang/natWin32Process.cc index 56394cf..7337ab3 100644 --- a/libjava/java/lang/natWin32Process.cc +++ b/libjava/java/lang/natWin32Process.cc @@ -173,7 +173,7 @@ ChildProcessPipe::ChildProcessPipe(EType eType): { DWORD dwErrorCode = GetLastError (); throw new java::io::IOException ( - _Jv_WinStrError ("Error creating pipe", dwErrorCode)); + _Jv_WinStrError (_T("Error creating pipe"), dwErrorCode)); } // If this is the read end of the child, we need @@ -220,48 +220,53 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray, int cmdLineLen = 0; for (int i = 0; i < progarray->length; ++i) - cmdLineLen += (_Jv_GetStringUTFLength (elts[i]) + 1); + cmdLineLen += (elts[i]->length() + 1); - char *cmdLine = (char *) _Jv_Malloc (cmdLineLen + 1); - char *cmdLineCurPos = cmdLine; + LPTSTR cmdLine = (LPTSTR) _Jv_Malloc ((cmdLineLen + 1) * sizeof(TCHAR)); + LPTSTR cmdLineCurPos = cmdLine; for (int i = 0; i < progarray->length; ++i) { if (i > 0) - *cmdLineCurPos++ = ' '; - jsize s = _Jv_GetStringUTFLength (elts[i]); - _Jv_GetStringUTFRegion (elts[i], 0, elts[i]->length(), cmdLineCurPos); - cmdLineCurPos += s; + *cmdLineCurPos++ = _T(' '); + + jint len = elts[i]->length(); + JV_TEMP_STRING_WIN32(thiselt, elts[i]); + _tcscpy(cmdLineCurPos, thiselt); + cmdLineCurPos += len; } - *cmdLineCurPos = '\0'; + *cmdLineCurPos = _T('\0'); // Get the environment, if any. - char *env = NULL; + LPTSTR env = NULL; if (envp) { elts = elements (envp); int envLen = 0; for (int i = 0; i < envp->length; ++i) - envLen += (_Jv_GetStringUTFLength (elts[i]) + 1); + envLen += (elts[i]->length() + 1); - env = (char *) _Jv_Malloc (envLen + 1); + env = (LPTSTR) _Jv_Malloc ((envLen + 1) * sizeof(TCHAR)); int j = 0; for (int i = 0; i < envp->length; ++i) { - jsize s = _Jv_GetStringUTFLength (elts[i]); - _Jv_GetStringUTFRegion (elts[i], 0, elts[i]->length(), (env + j)); - - j += s; - *(env + j) = '\0'; + jint len = elts[i]->length(); + + JV_TEMP_STRING_WIN32(thiselt, elts[i]); + _tcscpy(env + j, thiselt); + + j += len; + + // Skip past the null terminator that _tcscpy just inserted. j++; } - *(env + j) = '\0'; + *(env + j) = _T('\0'); } // Get the working directory path, if specified. - JV_TEMP_UTF_STRING (wdir, dir ? dir->getPath () : 0); + JV_TEMP_STRING_WIN32 (wdir, dir ? dir->getPath () : 0); errorStream = NULL; inputStream = NULL; @@ -304,12 +309,13 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray, // starting a console application; it suppresses the // creation of a console window. This flag is ignored on // Win9X. + if (CreateProcess (NULL, cmdLine, NULL, NULL, 1, - CREATE_NO_WINDOW, + CREATE_NO_WINDOW | CREATE_UNICODE_ENVIRONMENT, env, wdir, &si, @@ -317,7 +323,7 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray, { DWORD dwErrorCode = GetLastError (); throw new IOException ( - _Jv_WinStrError ("Error creating child process", dwErrorCode)); + _Jv_WinStrError (_T("Error creating child process"), dwErrorCode)); } procHandle = (jint ) pi.hProcess; |