From 3fd6af152fc1244dcb12008825db8af89b15e8ab Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Sat, 26 Mar 2011 11:45:33 -0600 Subject: [PATCH] fix Windows and GCC 3.4 builds --- src/classpath-openjdk.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/classpath-openjdk.cpp b/src/classpath-openjdk.cpp index cc2074396c..09a1ed69bf 100644 --- a/src/classpath-openjdk.cpp +++ b/src/classpath-openjdk.cpp @@ -952,6 +952,10 @@ class ZipFile { Entry(int64_t entry): hash(0), start(0), next(0), entry(entry) { } + + Entry(): + hash(0), start(0), next(0), entry(0) + { } unsigned hash; const uint8_t* start; @@ -4383,7 +4387,14 @@ EXPORT(JVM_SetLength)(jint fd, jlong length) return -1; } - if (SetEndOfFile(h, length)) { + long high = length >> 32; + DWORD r = SetFilePointer(h, static_cast(length), &high, FILE_BEGIN); + if (r == 0xFFFFFFFF and GetLastError() != NO_ERROR) { + errno = EIO; + return -1; + } + + if (SetEndOfFile(h)) { return 0; } else { errno = EIO; @@ -4505,7 +4516,14 @@ EXPORT(JVM_SendTo)(jint, char*, int, extern "C" JNIEXPORT jint JNICALL EXPORT(JVM_SocketAvailable)(jint socket, jint* count) { +#ifdef PLATFORM_WINDOWS + unsigned long c = *count; + int r = ioctlsocket(socket, FIONREAD, &c); + *count = c; + return r; +#else return ioctl(socket, FIONREAD, count) < 0 ? 0 : 1; +#endif } extern "C" JNIEXPORT jint JNICALL