diff options
| author | membar <membar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-12-02 22:26:50 +0000 |
|---|---|---|
| committer | membar <membar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-12-02 22:26:50 +0000 |
| commit | 83d7b40bc88f78fd38cb5a30c789671169fe3741 (patch) | |
| tree | 4db34f47c7611b5c83b79334f47f1a5411fbbc44 /libjava/java/io/natFileDescriptorWin32.cc | |
| parent | 743d21d25e3ab9166ee5f9e0bcd6b44d42745b9f (diff) | |
| download | gcc-83d7b40bc88f78fd38cb5a30c789671169fe3741.tar.gz | |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74201 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/io/natFileDescriptorWin32.cc')
| -rw-r--r-- | libjava/java/io/natFileDescriptorWin32.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libjava/java/io/natFileDescriptorWin32.cc b/libjava/java/io/natFileDescriptorWin32.cc index 465d7557992..7811a73f493 100644 --- a/libjava/java/io/natFileDescriptorWin32.cc +++ b/libjava/java/io/natFileDescriptorWin32.cc @@ -87,7 +87,7 @@ java::io::FileDescriptor::open (jstring path, jint jflags) { DWORD access = 0; DWORD create = OPEN_EXISTING; - JV_TEMP_UTF_STRING(cpath, path) + JV_TEMP_STRING_WIN32(cpath, path) JvAssert((jflags & READ) || (jflags & WRITE)); @@ -115,7 +115,8 @@ java::io::FileDescriptor::open (jstring path, jint jflags) { create = CREATE_ALWAYS; } - handle = CreateFile(cpath, access, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, create, 0, NULL); + handle = CreateFile(cpath, access, FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, create, 0, NULL); if (handle == INVALID_HANDLE_VALUE) { @@ -174,13 +175,14 @@ java::io::FileDescriptor::write(jbyteArray b, jint offset, jint len) jbyte *buf = elements (b) + offset; DWORD bytesWritten; + if (WriteFile ((HANDLE)fd, buf, len, &bytesWritten, NULL)) { if (java::lang::Thread::interrupted()) { InterruptedIOException *iioe = new InterruptedIOException (JvNewStringLatin1 ("write interrupted")); iioe->bytesTransferred = bytesWritten; - throw iioe; + throw iioe; } } else |
