diff --git a/classpath/java-io.cpp b/classpath/java-io.cpp index 9bcfa88afd..9175c6e978 100644 --- a/classpath/java-io.cpp +++ b/classpath/java-io.cpp @@ -342,15 +342,33 @@ Java_java_io_File_toAbsolutePath(JNIEnv* e UNUSED, jclass, jstring path) extern "C" JNIEXPORT jlong JNICALL Java_java_io_File_length(JNIEnv* e, jclass, jstring path) { - string_t chars = getChars(e, path); - if (chars) { - STRUCT_STAT s; - int r = STAT(chars, &s); + + #ifdef PLATFORM_WINDOWS + + LARGE_INTEGER fileSize; + string_t chars = getChars(e, path); + HANDLE file = CreateFileW + (chars, FILE_READ_DATA, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); releaseChars(e, path, chars); - if (r == 0) { - return s.st_size; + if (file != INVALID_HANDLE_VALUE) + GetFileSizeEx(file, &fileSize); + else return 0; + CloseHandle(file); + return static_cast(fileSize.QuadPart); + + #else + + string_t chars = getChars(e, path); + if (chars) { + STRUCT_STAT s; + int r = STAT(chars, &s); + releaseChars(e, path, chars); + if (r == 0) { + return s.st_size; + } } - } + + #endif return 0; } diff --git a/makefile b/makefile index e8645506f4..23fbc291bd 100755 --- a/makefile +++ b/makefile @@ -985,11 +985,12 @@ ifeq ($(platform),windows) < "$(openjdk-src)/windows/native/java/net/net_util_md.h" \ > $(build)/openjdk/net_util_md.h sed \ - -e 's/IpPrefix/hide_IpPrefix/' \ - -e 's/IpSuffix/hide_IpSuffix/' \ - -e 's/IpDad/hide_IpDad/' \ - -e 's/ScopeLevel/hide_ScopeLevel/' \ - -e 's/SCOPE_LEVEL/hide_SCOPE_LEVEL/' \ + -e 's/\(^#include "net_util.h"\)/\1\n#if (defined _INC_NLDEF) || (defined _WS2DEF_)\n#define HIDE(x) hide_##x\n#else\n#define HIDE(x) x\n#define _WINSOCK2API_\n#endif/' \ + -e 's/\(IpPrefix[a-zA-Z_]*\)/HIDE(\1)/' \ + -e 's/\(IpSuffix[a-zA-Z_]*\)/HIDE(\1)/' \ + -e 's/\(IpDad[a-zA-Z_]*\)/HIDE(\1)/' \ + -e 's/\(ScopeLevel[a-zA-Z_]*\)/HIDE(\1)/' \ + -e 's/\(SCOPE_LEVEL[a-zA-Z_]*\)/HIDE(\1)/' \ < "$(openjdk-src)/windows/native/java/net/NetworkInterface.h" \ > $(build)/openjdk/NetworkInterface.h echo 'static int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP);' >> $(build)/openjdk/NetworkInterface.h diff --git a/src/boot-javahome.cpp b/src/boot-javahome.cpp index 8f32d545c7..3ea90b33f8 100644 --- a/src/boot-javahome.cpp +++ b/src/boot-javahome.cpp @@ -18,7 +18,7 @@ typedef unsigned char uint8_t; #ifdef BOOT_JAVAHOME -#if (defined __MINGW32__) || (defined _MSC_VER) +#if (! defined __x86_64__) && ((defined __MINGW32__) || (defined _MSC_VER)) # define EXPORT __declspec(dllexport) # define SYMBOL(x) binary_javahome_jar_##x #else diff --git a/test/Zip.java b/test/Zip.java index 9b34444023..36d08b6ca2 100644 --- a/test/Zip.java +++ b/test/Zip.java @@ -10,6 +10,9 @@ public class Zip { for (File file: directory.listFiles()) { if (file.isFile()) { if (file.getName().endsWith(".jar")) { + System.out.println + ("found " + file.getAbsolutePath() + " length " + file.length()); + return file.getAbsolutePath(); } } else if (file.isDirectory()) {