gcc/libjava/java/io/natFileWin32.cc

352 lines
9.0 KiB
C++
Raw Normal View History

// natFileWin32.cc - Native part of File class for Win32.
/* Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#include <config.h>
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
#include <platform.h>
#include <stdio.h>
#include <string.h>
#undef STRICT
#include <java/io/File.h>
#include <java/io/IOException.h>
#include <java/util/Vector.h>
#include <java/lang/String.h>
#include <java/io/FilenameFilter.h>
#include <java/io/FileFilter.h>
#include <java/lang/System.h>
// Java timestamps are milliseconds since the UNIX epoch (00:00:00 UTC on
// January 1, 1970) while Win32 file-times are 100-nanosecond intervals
// since the Win32 epoch (00:00:00 UTC on January 1, 1601). The following
// constant represents the number of milliseconds to be added to a
// Java timestamp to base it on the Win32 epoch.
//
// There were 369 years between 1601 and 1970, including 89 leap years
// (since 1700, 1800 and 1900 were not leap years):
//
// (89*366 + 280*365) days * 86400 seconds/day = 11644473600 seconds
//
#define WIN32_EPOCH_MILLIS 11644473600000LL
jboolean
java::io::File::_access (jint query)
{
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
2003-12-02 23:26:50 +01:00
JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
if (!canon)
return false;
JvAssert (query == READ || query == WRITE || query == EXISTS);
// FIXME: Is it possible to differentiate between existing and reading?
// If the file exists but cannot be read because of the secuirty attributes
// on an NTFS disk this wont work (it reports it can be read but cant)
// Could we use something from the security API?
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
DWORD attributes = GetFileAttributes (canon);
if ((query == EXISTS) || (query == READ))
return (attributes == 0xffffffff) ? false : true;
else
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
2003-12-02 23:26:50 +01:00
return ((attributes != 0xffffffff) &&
((attributes & FILE_ATTRIBUTE_READONLY) == 0)) ? true : false;
}
jboolean
java::io::File::_stat (jint query)
{
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
2003-12-02 23:26:50 +01:00
JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
if (!canon)
return false;
JvAssert (query == DIRECTORY || query == ISFILE);
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
DWORD attributes = GetFileAttributes (canon);
if (attributes == 0xffffffff)
return false;
if (query == DIRECTORY)
return attributes & FILE_ATTRIBUTE_DIRECTORY ? true : false;
else
return attributes & FILE_ATTRIBUTE_DIRECTORY ? false : true;
}
jlong
1.3-Compliant Implementation of java.io.File. * java/lang/natSystem.cc (init_properties): Get "file.separator", "path.separator", and "java.io.tmpdir" from the File class, instead of setting them explicitly. * java/io/File.java: Do not canonicalize paths for security manager checks. Call init_native() from static initializer. Do not pass path argument to native methods. New native method declarations. Some security manager checks moved to checkWrite(). (equals): Check file system case sensitivity and act appropriatly. (hashCode): Likewise. (isHidden): New method implemented. (performList): Changed prototype. Now takes a class argument specifying the class of the returned array: Strings or File objects. Also added FileFilter argument. (listFiles): New variants with "File" return type implemented. (createTempFile): Use createNewFile(). Use maxPathLen. (setReadOnly): New method implemented. (listRoots): Likewise. (compareTo): Likewise. (setLastModified): Likewise. (checkWrite): New method. (setPath): Removed. * java/io/natFile.cc: Various functions no longer take canonical path argument. (stat): Handle ISHIDDEN query. (isAbsolute): Remove WIN32 cruft. (performList): New arguments. Handle returning either File[] or String[] arrays. Check with FileFilter or FilenameFilter arguments as appropriate. Use an ArrayList, not a Vector, for the temporary list. (performSetReadOnly): New method implemented. (performListRoots): Likewise. (performSetLastModified): Likewise. (performCreate): Likewise. (init_native): New initialization function. * java/io/natFileWin32.cc: Various functions no longer take canonical path argument. (stat): Add FIXME about ISHIDDEN query. (performList): New arguments. Handle returning either File[] or String[] arrays. Check with FileFilter or FilenameFilter arguments as appropriate. Use an ArrayList, not a Vector, for the temporary list. (performSetReadOnly): New. Stubbed. (performListRoots): Likewise. (performSetLastModified): Likewise. (performCreate): Likewise. (init_native) New initialization function. * configure.in: Check for utime() and chmod(). * configure: Rebuilt. * include/config.h.in: Rebuilt. Resolves PR libgcj/1759. From-SVN: r40985
2001-04-01 13:16:40 +02:00
java::io::File::attr (jint query)
{
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
2003-12-02 23:26:50 +01:00
JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
if (!canon)
return false;
JvAssert (query == MODIFIED || query == LENGTH);
WIN32_FIND_DATA info;
HANDLE sHandle;
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
if ( ( sHandle = FindFirstFile( canon, &info)) == INVALID_HANDLE_VALUE)
return 0;
FindClose( sHandle);
if (query == LENGTH)
return ((long long)info.nFileSizeHigh) << 32
| (unsigned long long)info.nFileSizeLow;
else
{
// The file time as returned by Windows is in terms of the number
// of 100-nanosecond intervals since 00:00:00 UTC, January 1, 1601.
return (((((long long)info.ftLastWriteTime.dwHighDateTime) << 32)
| ((unsigned long long)info.ftLastWriteTime.dwLowDateTime))
- WIN32_EPOCH_MILLIS*10000LL) / 10000LL;
}
}
jstring
java::io::File::getCanonicalPath (void)
{
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
2003-12-02 23:26:50 +01:00
JV_TEMP_STRING_WIN32 (cpath, path);
// If the filename is blank, use the current directory.
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
2003-12-02 23:26:50 +01:00
LPCTSTR thepath = cpath.buf();
if (*thepath == 0)
thepath = _T(".");
LPTSTR unused;
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
2003-12-02 23:26:50 +01:00
TCHAR buf2[MAX_PATH];
if(!GetFullPathName(thepath, MAX_PATH, buf2, &unused))
throw new IOException (JvNewStringLatin1 ("GetFullPathName failed"));
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
2003-12-02 23:26:50 +01:00
return _Jv_Win32NewString (buf2);
}
jboolean
java::io::File::isAbsolute (void)
{
// See if the path represents a Windows UNC network path.
if (path->length () > 2
&& (path->charAt (0) == '\\') && (path->charAt (1) == '\\'))
return true;
// Note that the path is not an absolute path even if it starts with
// a '/' or a '\' because it lacks a drive specifier.
if (path->length() < 3)
return false;
// Hard-code A-Za-z because Windows (I think) can't use non-ASCII
// letters as drive names.
if ((path->charAt(0) < 'a' || path->charAt(0) > 'z')
&& (path->charAt(0) < 'A' || path->charAt(0) > 'Z'))
return false;
return (path->charAt(1) == ':'
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
&& (path->charAt(2) == '/' || path->charAt(2) == '\\'));
}
void java::io::File::init_native ()
{
maxPathLen = MAX_PATH;
caseSensitive = false;
}
jobjectArray
1.3-Compliant Implementation of java.io.File. * java/lang/natSystem.cc (init_properties): Get "file.separator", "path.separator", and "java.io.tmpdir" from the File class, instead of setting them explicitly. * java/io/File.java: Do not canonicalize paths for security manager checks. Call init_native() from static initializer. Do not pass path argument to native methods. New native method declarations. Some security manager checks moved to checkWrite(). (equals): Check file system case sensitivity and act appropriatly. (hashCode): Likewise. (isHidden): New method implemented. (performList): Changed prototype. Now takes a class argument specifying the class of the returned array: Strings or File objects. Also added FileFilter argument. (listFiles): New variants with "File" return type implemented. (createTempFile): Use createNewFile(). Use maxPathLen. (setReadOnly): New method implemented. (listRoots): Likewise. (compareTo): Likewise. (setLastModified): Likewise. (checkWrite): New method. (setPath): Removed. * java/io/natFile.cc: Various functions no longer take canonical path argument. (stat): Handle ISHIDDEN query. (isAbsolute): Remove WIN32 cruft. (performList): New arguments. Handle returning either File[] or String[] arrays. Check with FileFilter or FilenameFilter arguments as appropriate. Use an ArrayList, not a Vector, for the temporary list. (performSetReadOnly): New method implemented. (performListRoots): Likewise. (performSetLastModified): Likewise. (performCreate): Likewise. (init_native): New initialization function. * java/io/natFileWin32.cc: Various functions no longer take canonical path argument. (stat): Add FIXME about ISHIDDEN query. (performList): New arguments. Handle returning either File[] or String[] arrays. Check with FileFilter or FilenameFilter arguments as appropriate. Use an ArrayList, not a Vector, for the temporary list. (performSetReadOnly): New. Stubbed. (performListRoots): Likewise. (performSetLastModified): Likewise. (performCreate): Likewise. (init_native) New initialization function. * configure.in: Check for utime() and chmod(). * configure: Rebuilt. * include/config.h.in: Rebuilt. Resolves PR libgcj/1759. From-SVN: r40985
2001-04-01 13:16:40 +02:00
java::io::File::performList (java::io::FilenameFilter *filter,
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
java::io::FileFilter *fileFilter,
java::lang::Class *clazz)
{
jstring canon = getCanonicalPath();
if (! canon)
return NULL;
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
2003-12-02 23:26:50 +01:00
int len = canon->length();
TCHAR buf[len + 5];
JV_TEMP_STRING_WIN32(canonstr, canon);
_tcscpy(buf, canonstr);
if (buf[len - 1] == _T('\\'))
_tcscpy (&buf[len], _T("*.*"));
else
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
2003-12-02 23:26:50 +01:00
_tcscpy (&buf[len], _T("\\*.*"));
WIN32_FIND_DATA data;
HANDLE handle = FindFirstFile (buf, &data);
if (handle == INVALID_HANDLE_VALUE)
return NULL;
java::util::Vector *vec = new java::util::Vector ();
do
{
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
2003-12-02 23:26:50 +01:00
if (_tcscmp (data.cFileName, _T(".")) &&
_tcscmp (data.cFileName, _T("..")))
{
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
2003-12-02 23:26:50 +01:00
jstring name = _Jv_Win32NewString (data.cFileName);
1.3-Compliant Implementation of java.io.File. * java/lang/natSystem.cc (init_properties): Get "file.separator", "path.separator", and "java.io.tmpdir" from the File class, instead of setting them explicitly. * java/io/File.java: Do not canonicalize paths for security manager checks. Call init_native() from static initializer. Do not pass path argument to native methods. New native method declarations. Some security manager checks moved to checkWrite(). (equals): Check file system case sensitivity and act appropriatly. (hashCode): Likewise. (isHidden): New method implemented. (performList): Changed prototype. Now takes a class argument specifying the class of the returned array: Strings or File objects. Also added FileFilter argument. (listFiles): New variants with "File" return type implemented. (createTempFile): Use createNewFile(). Use maxPathLen. (setReadOnly): New method implemented. (listRoots): Likewise. (compareTo): Likewise. (setLastModified): Likewise. (checkWrite): New method. (setPath): Removed. * java/io/natFile.cc: Various functions no longer take canonical path argument. (stat): Handle ISHIDDEN query. (isAbsolute): Remove WIN32 cruft. (performList): New arguments. Handle returning either File[] or String[] arrays. Check with FileFilter or FilenameFilter arguments as appropriate. Use an ArrayList, not a Vector, for the temporary list. (performSetReadOnly): New method implemented. (performListRoots): Likewise. (performSetLastModified): Likewise. (performCreate): Likewise. (init_native): New initialization function. * java/io/natFileWin32.cc: Various functions no longer take canonical path argument. (stat): Add FIXME about ISHIDDEN query. (performList): New arguments. Handle returning either File[] or String[] arrays. Check with FileFilter or FilenameFilter arguments as appropriate. Use an ArrayList, not a Vector, for the temporary list. (performSetReadOnly): New. Stubbed. (performListRoots): Likewise. (performSetLastModified): Likewise. (performCreate): Likewise. (init_native) New initialization function. * configure.in: Check for utime() and chmod(). * configure: Rebuilt. * include/config.h.in: Rebuilt. Resolves PR libgcj/1759. From-SVN: r40985
2001-04-01 13:16:40 +02:00
if (filter && !filter->accept(this, name))
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
2003-12-02 23:26:50 +01:00
continue;
if (clazz == &java::io::File::class$)
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
2003-12-02 23:26:50 +01:00
{
java::io::File *file = new java::io::File (this, name);
if (fileFilter && !fileFilter->accept(file))
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
2003-12-02 23:26:50 +01:00
continue;
vec->addElement (file);
}
else
vec->addElement (name);
}
}
while (FindNextFile (handle, &data));
if (GetLastError () != ERROR_NO_MORE_FILES)
return NULL;
FindClose (handle);
jobjectArray ret = JvNewObjectArray (vec->size(), clazz, NULL);
vec->copyInto (ret);
return ret;
}
jboolean
java::io::File::performMkdir (void)
{
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
2003-12-02 23:26:50 +01:00
JV_TEMP_STRING_WIN32 (cpath, path);
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
return (CreateDirectory(cpath, NULL)) ? true : false;
}
jboolean
java::io::File::performRenameTo (File *dest)
{
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
2003-12-02 23:26:50 +01:00
JV_TEMP_STRING_WIN32 (pathFrom, path);
JV_TEMP_STRING_WIN32 (pathTo, dest->path);
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
return (MoveFile(pathFrom, pathTo)) ? true : false;
}
1.3-Compliant Implementation of java.io.File. * java/lang/natSystem.cc (init_properties): Get "file.separator", "path.separator", and "java.io.tmpdir" from the File class, instead of setting them explicitly. * java/io/File.java: Do not canonicalize paths for security manager checks. Call init_native() from static initializer. Do not pass path argument to native methods. New native method declarations. Some security manager checks moved to checkWrite(). (equals): Check file system case sensitivity and act appropriatly. (hashCode): Likewise. (isHidden): New method implemented. (performList): Changed prototype. Now takes a class argument specifying the class of the returned array: Strings or File objects. Also added FileFilter argument. (listFiles): New variants with "File" return type implemented. (createTempFile): Use createNewFile(). Use maxPathLen. (setReadOnly): New method implemented. (listRoots): Likewise. (compareTo): Likewise. (setLastModified): Likewise. (checkWrite): New method. (setPath): Removed. * java/io/natFile.cc: Various functions no longer take canonical path argument. (stat): Handle ISHIDDEN query. (isAbsolute): Remove WIN32 cruft. (performList): New arguments. Handle returning either File[] or String[] arrays. Check with FileFilter or FilenameFilter arguments as appropriate. Use an ArrayList, not a Vector, for the temporary list. (performSetReadOnly): New method implemented. (performListRoots): Likewise. (performSetLastModified): Likewise. (performCreate): Likewise. (init_native): New initialization function. * java/io/natFileWin32.cc: Various functions no longer take canonical path argument. (stat): Add FIXME about ISHIDDEN query. (performList): New arguments. Handle returning either File[] or String[] arrays. Check with FileFilter or FilenameFilter arguments as appropriate. Use an ArrayList, not a Vector, for the temporary list. (performSetReadOnly): New. Stubbed. (performListRoots): Likewise. (performSetLastModified): Likewise. (performCreate): Likewise. (init_native) New initialization function. * configure.in: Check for utime() and chmod(). * configure: Rebuilt. * include/config.h.in: Rebuilt. Resolves PR libgcj/1759. From-SVN: r40985
2001-04-01 13:16:40 +02:00
jboolean
java::io::File::performDelete ()
{
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
2003-12-02 23:26:50 +01:00
JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
if (!canon)
return false;
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
DWORD attributes = GetFileAttributes (canon);
if (attributes == 0xffffffff)
return false;
if (attributes & FILE_ATTRIBUTE_DIRECTORY)
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
return (RemoveDirectory (canon)) ? true : false;
else
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
return (DeleteFile (canon)) ? true : false;
}
1.3-Compliant Implementation of java.io.File. * java/lang/natSystem.cc (init_properties): Get "file.separator", "path.separator", and "java.io.tmpdir" from the File class, instead of setting them explicitly. * java/io/File.java: Do not canonicalize paths for security manager checks. Call init_native() from static initializer. Do not pass path argument to native methods. New native method declarations. Some security manager checks moved to checkWrite(). (equals): Check file system case sensitivity and act appropriatly. (hashCode): Likewise. (isHidden): New method implemented. (performList): Changed prototype. Now takes a class argument specifying the class of the returned array: Strings or File objects. Also added FileFilter argument. (listFiles): New variants with "File" return type implemented. (createTempFile): Use createNewFile(). Use maxPathLen. (setReadOnly): New method implemented. (listRoots): Likewise. (compareTo): Likewise. (setLastModified): Likewise. (checkWrite): New method. (setPath): Removed. * java/io/natFile.cc: Various functions no longer take canonical path argument. (stat): Handle ISHIDDEN query. (isAbsolute): Remove WIN32 cruft. (performList): New arguments. Handle returning either File[] or String[] arrays. Check with FileFilter or FilenameFilter arguments as appropriate. Use an ArrayList, not a Vector, for the temporary list. (performSetReadOnly): New method implemented. (performListRoots): Likewise. (performSetLastModified): Likewise. (performCreate): Likewise. (init_native): New initialization function. * java/io/natFileWin32.cc: Various functions no longer take canonical path argument. (stat): Add FIXME about ISHIDDEN query. (performList): New arguments. Handle returning either File[] or String[] arrays. Check with FileFilter or FilenameFilter arguments as appropriate. Use an ArrayList, not a Vector, for the temporary list. (performSetReadOnly): New. Stubbed. (performListRoots): Likewise. (performSetLastModified): Likewise. (performCreate): Likewise. (init_native) New initialization function. * configure.in: Check for utime() and chmod(). * configure: Rebuilt. * include/config.h.in: Rebuilt. Resolves PR libgcj/1759. From-SVN: r40985
2001-04-01 13:16:40 +02:00
jboolean java::io::File::performCreate (void)
{
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
2003-12-02 23:26:50 +01:00
JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
if (!canon)
return false;
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
HANDLE h = CreateFile (canon, 0, 0, NULL, CREATE_NEW,
FILE_ATTRIBUTE_NORMAL, NULL);
if (h != INVALID_HANDLE_VALUE)
{
CloseHandle (h);
return true;
}
else
{
if (GetLastError () == ERROR_ALREADY_EXISTS)
return false;
else
throw new IOException (JvNewStringLatin1 ("CreateFile failed"));
}
}
jboolean java::io::File::performSetReadOnly ()
{
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
2003-12-02 23:26:50 +01:00
JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
if (!canon)
return false;
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
DWORD attrs = GetFileAttributes (canon);
if (attrs != INVALID_FILE_ATTRIBUTES)
{
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
if (SetFileAttributes (canon, attrs | FILE_ATTRIBUTE_READONLY) != 0)
return true;
else
return false;
}
else
return false;
}
jboolean java::io::File::performSetLastModified (jlong time)
{
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
2003-12-02 23:26:50 +01:00
JV_TEMP_STRING_WIN32 (canon, getCanonicalPath());
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
if (!canon)
return false;
FILETIME modTime;
long long mTime100ns = ((long long) time /* Ha! */
+ WIN32_EPOCH_MILLIS) * 10000LL;
modTime.dwLowDateTime = (DWORD) mTime100ns;
modTime.dwHighDateTime = (DWORD) (mTime100ns >> 32);
jboolean retVal = false;
win32.cc: fixed tab... * win32.cc: fixed tab, indentation and whitespace inconsistencies removed jvm.h include added includes java/lang/UnsupportedOperationException.h, java/io/IOException.h, java/net/SocketException.h (WSAEventWrapper): class implementation (_Jv_WinStrError): implemented both overloads (_Jv_ThrowIOException): implemented both overloads (_Jv_ThrowSocketException): implemented both overloads (_Jv_select): implemented * include/win32.h: fixed tab, indentation and whitespace inconsistencies wrapped <windows.h> include with #define WIN32_LEAN_AND_MEAN added jvm.h include (WSAEventWrapper): added class declaration (_Jv_WinStrError): added both overload declarations (_Jv_ThrowIOException): added both overload declarations (_Jv_ThrowSocketException): added both overload declarations removed ENOTCONN, ECONNRESET and ENOPROTOOPT defines (_Jv_select): added declaration (_Jv_socket): removed (_Jv_connect): removed (_Jv_close): removed (_Jv_bind): removed (_Jv_accept): removed (_Jv_listen): removed (_Jv_write): removed (_Jv_read): removed * java/io/natFileDescriptorWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (testCanUseGetHandleInfo): new function which tests whether Win32 GetHandleInformation() call can be used with console buffer handles (only supported on >=WinNT 5.0) (winerr): removed (superseded by _Jv_WinStrError in include/win32.h) (valid): rewrote implementation using GetHandleInformation() (sync): changed exception throwing to use error string and exception helper methods declared in include/win32.h (open): likewise (write): likewise (setLength): likewise (close): likewise (seek): likewise (getFilePointer): likewise (read): likewise * java/io/natFileWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include (_access): use JV_TEMP_UTF_STRING (_stat): likewise (performMkDir): use JV_TEMP_UTF_STRING (performRenameTo): likewise (performDelete): likewise (performCreate): likewise (performSetReadOnly): likewise (performSetLastModified): likewise * java/lang/natWin32Process.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed includes gcj/cni.h, jvm.h (new_string): removed (startProcess): use JV_TEMP_UTF_STRING, changed exception throwing to use error string and exception helper methods declared in include/win32.h * java/net/natInetAddressWin32.cc: fixed tab, indentation and whitespace inconsistencies replaced <windows.h> #include with <platform.h> removed jvm.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (aton): use JV_TEMP_UTF_STRING removed POSIX conditional code not relevant to Win32 (lookup): likewise (getLocalHostName): likewise * java/net/natNetworkInterfaceWin32.cc: fixed tab, indentation and whitespace inconsistencies removed unnecessary windows.h, winsock.h and gcj/cni.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 (winsock2GetRealNetworkInterfaces): new function to compute network interfaces via Winsock2 API (determineGetRealNetworkInterfacesFN): new function for returning a function pointer to the function used to compute network interfaces. (getRealNetworkInterfaces): implemented * java/net/natPlainDatagramSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h include removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (peekData): implemented timeout support (receive): likewise * java/net/natPlainSocketImplWin32.cc: fixed tab, indentation and whitespace inconsistencies removed gcj/cni.h and gcj/javaprims.h includes removed DISABLE_JAVA_NET conditional code removed POSIX conditional code not relevant to Win32 changed net POSIXisms to Win32isms replaced _Jv socket-related calls with their real Win32 equivalents changed exception throwing to use error string and exception helper methods declared in include/win32.h (throwConnectException): helper function for connect() (connect): implemented timeout support (accept): likewise (doRead): new helper function common to both read() method overloads, includes timeout support (read): implemented both overloads in terms of doRead() (available): implemented using ioctlsocket() From-SVN: r70904
2003-08-29 06:21:01 +02:00
HANDLE h = CreateFile (canon, FILE_WRITE_ATTRIBUTES,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
if (h != INVALID_HANDLE_VALUE)
{
if (SetFileTime (h, NULL, &modTime, &modTime) != 0)
retVal = true;
CloseHandle (h);
}
return retVal;
}
JArray<java::io::File*>* java::io::File::performListRoots ()
{
DWORD drivesBitmap = GetLogicalDrives ();
DWORD mask;
// Possible drive letters are from ASCII 'A'-'Z'.
int numDrives = 0;
mask = 1;
for (int i = 0; i < 26; i++)
{
if ((drivesBitmap & mask) != 0)
numDrives++;
mask <<= 1;
}
JArray<java::io::File *> *roots
= reinterpret_cast <JArray<java::io::File *>*>
(JvNewObjectArray (numDrives, &java::io::File::class$, NULL));
::java::io::File **rootsArray = elements (roots);
char aDriveRoot[] = {'A', ':', '\\', '\0'};
mask = 1;
for (int i = 0, j = 0; i < 26; i++)
{
if ((drivesBitmap & mask) != 0)
{
rootsArray[j]
= new ::java::io::File (JvNewStringLatin1 (aDriveRoot));
j++;
}
mask <<= 1;
aDriveRoot[0]++;
}
return roots;
}