This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

unidiff version of the last patch I submitted


As per request, the unidiff version is attached.

Index: include/win32.h
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/include/win32.h,v
retrieving revision 1.8
diff -u -r1.8 win32.h
--- include/win32.h	24 Apr 2002 01:33:19 -0000	1.8
+++ include/win32.h	6 Jul 2002 02:36:17 -0000
@@ -15,6 +15,7 @@
 #undef STRICT
 
 #undef __INSIDE_CYGWIN__
+#include <io.h>
 #include <winsock.h>
 #include <gcj/cni.h>
 #include <java/util/Properties.h>
Index: java/io/FileDescriptor.java
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/io/FileDescriptor.java,v
retrieving revision 1.9
diff -u -r1.9 FileDescriptor.java
--- java/io/FileDescriptor.java	6 Mar 2002 22:37:26 -0000	1.9
+++ java/io/FileDescriptor.java	6 Jul 2002 02:36:18 -0000
@@ -65,6 +65,9 @@
   native void write (byte[] b, int offset, int len)
     throws IOException, NullPointerException, IndexOutOfBoundsException;
   native void close () throws IOException;
+  native void shutdownInput () throws IOException;
+  native void shutdownOutput () throws IOException;
+  native void setLength (long pos) throws IOException;
   // EOF_TRUNC is true if a request to seek past the end of file
   // should actually stop at the end of file.  If false, then a seek
   // past the end is ok (and if a subsequent write occurs the file
Index: java/io/RandomAccessFile.java
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/io/RandomAccessFile.java,v
retrieving revision 1.6
diff -u -r1.6 RandomAccessFile.java
--- java/io/RandomAccessFile.java	2 Aug 2001 23:46:39 -0000	1.6
+++ java/io/RandomAccessFile.java	6 Jul 2002 02:36:18 -0000
@@ -40,6 +40,12 @@
     return fd.getFilePointer();
   }
 
+  public void setLength (long pos) throws IOException
+  {
+    fd.setLength(pos);
+    return;
+  }
+
   public long length () throws IOException
   {
     return fd.length();
Index: java/io/natFileDescriptorEcos.cc
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/io/natFileDescriptorEcos.cc,v
retrieving revision 1.8
diff -u -r1.8 natFileDescriptorEcos.cc
--- java/io/natFileDescriptorEcos.cc	6 Mar 2002 23:23:34 -0000	1.8
+++ java/io/natFileDescriptorEcos.cc	6 Jul 2002 02:36:18 -0000
@@ -95,6 +95,21 @@
 {
 }
 
+void
+java::io::FileDescriptor::shutdownInput (void)
+{
+}
+
+void
+java::io::FileDescriptor::shutdownOutput (void)
+{
+}
+
+void
+java::io::FileDescriptor::setLength (jlong pos)
+{
+}
+
 jint
 java::io::FileDescriptor::seek (jlong pos, jint whence, jboolean)
 {
Index: java/io/natFileDescriptorPosix.cc
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/io/natFileDescriptorPosix.cc,v
retrieving revision 1.19
diff -u -r1.19 natFileDescriptorPosix.cc
--- java/io/natFileDescriptorPosix.cc	10 Mar 2002 17:59:23 -0000	1.19
+++ java/io/natFileDescriptorPosix.cc	6 Jul 2002 02:36:18 -0000
@@ -17,6 +17,8 @@
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/param.h>
+#include <sys/socket.h>
+#include <fcntl.h>
 
 #ifdef HAVE_SYS_IOCTL_H
 #define BSD_COMP /* Get FIONREAD on Solaris2. */
@@ -187,6 +189,50 @@
   fd = -1;
   if (::close (save))
     throw new IOException (JvNewStringLatin1 (strerror (errno)));
+}
+
+void
+java::io::FileDescriptor::shutdownInput (void)
+{
+  if (::shutdown(fd,0))
+    throw new IOException (JvNewStringLatin1 (strerror (errno)));
+}
+
+void
+java::io::FileDescriptor::shutdownOutput (void)
+{
+  if (::shutdown(fd,1))
+    throw new IOException (JvNewStringLatin1 (strerror (errno)));
+}
+
+void
+java::io::FileDescriptor::setLength (jlong pos)
+{
+  struct stat sb;
+  off_t orig;
+
+  if (::fstat (fd, &sb))
+    throw new IOException (JvNewStringLatin1 (strerror (errno)));
+
+  if ((jlong)sb.st_size == pos) 
+    return;
+  
+  orig = ::lseek(fd, (off_t) 0, SEEK_CUR);
+  if (orig == -1)
+    throw new IOException (JvNewStringLatin1 (strerror (errno)));
+
+  if ((jlong)sb.st_size < pos) {
+    if (::lseek(fd, (off_t)pos, SEEK_SET) == -1) 
+      throw new IOException (JvNewStringLatin1 (strerror (errno)));
+    if (::lseek(fd, orig, SEEK_SET) == -1) 
+      throw new IOException (JvNewStringLatin1 (strerror (errno)));
+    return;
+  } 
+
+  if (::ftruncate (fd, (off_t) pos))
+    throw new IOException (JvNewStringLatin1 (strerror (errno)));
+
+  return;
 }
 
 jint
Index: java/io/natFileDescriptorWin32.cc
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/io/natFileDescriptorWin32.cc,v
retrieving revision 1.9
diff -u -r1.9 natFileDescriptorWin32.cc
--- java/io/natFileDescriptorWin32.cc	6 Jun 2002 20:39:37 -0000	1.9
+++ java/io/natFileDescriptorWin32.cc	6 Jul 2002 02:36:18 -0000
@@ -186,6 +186,66 @@
     throw new IOException (JvNewStringLatin1 (winerr ()));
 }
 
+void
+java::io::FileDescriptor::shutdownInput (void)
+{
+  if (shutdown((SOCKET)fd,SD_RECEIVE) != 0)
+    throw new IOException (JvNewStringLatin1 (winerr ()));
+}
+
+void
+java::io::FileDescriptor::shutdownOutput (void)
+{
+  if (shutdown((SOCKET)fd,SD_SEND) != 0)
+    throw new IOException (JvNewStringLatin1 (winerr ()));
+}
+
+void
+java::io::FileDescriptor::setLength(jlong pos)
+{
+  LONG liOrigFilePointer;
+  LONG liNewFilePointer;
+  LONG liEndFilePointer;
+
+  // get the original file pointer
+  if (SetFilePointer((HANDLE)fd, (LONG)0, &liOrigFilePointer, FILE_CURRENT) != (BOOL)0
+      && (GetLastError() != NO_ERROR)) 
+    throw new IOException (JvNewStringLatin1 (winerr ()));
+  
+  // get the length of the file
+  if (SetFilePointer((HANDLE)fd, (LONG)0, &liEndFilePointer, FILE_END) != (BOOL)0
+      && (GetLastError() != NO_ERROR)) 
+    throw new IOException (JvNewStringLatin1 (winerr ()));
+  
+  if ((jlong)liEndFilePointer == pos) {
+    // restore the file pointer
+    if (liOrigFilePointer != liEndFilePointer) {
+      if (SetFilePointer((HANDLE)fd, liOrigFilePointer, &liNewFilePointer, FILE_BEGIN) != (BOOL)0
+          && (GetLastError() != NO_ERROR)) 
+        throw new IOException (JvNewStringLatin1 (winerr ()));
+    }
+    return;
+  }
+
+  // seek to the new end of file
+  if (SetFilePointer((HANDLE)fd, (LONG)pos, &liNewFilePointer, FILE_BEGIN) != (BOOL)0
+      && (GetLastError() != NO_ERROR)) 
+    throw new IOException (JvNewStringLatin1 (winerr ()));
+      
+  // truncate the file at this point
+  if (SetEndOfFile((HANDLE)fd) != (BOOL)0 && (GetLastError() != NO_ERROR)) 
+    throw new IOException (JvNewStringLatin1 (winerr ()));
+  
+  if (liOrigFilePointer < liNewFilePointer) {
+    // restore the file pointer
+    if (SetFilePointer((HANDLE)fd, liOrigFilePointer, &liNewFilePointer, FILE_BEGIN) != (BOOL)0
+        && (GetLastError() != NO_ERROR)) 
+      throw new IOException (JvNewStringLatin1 (winerr ()));
+  }
+
+  return;
+}
+
 jint
 java::io::FileDescriptor::seek (jlong pos, jint whence, jboolean eof_trunc)
 {
Index: java/lang/natRuntime.cc
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/lang/natRuntime.cc,v
retrieving revision 1.23
diff -u -r1.23 natRuntime.cc
--- java/lang/natRuntime.cc	14 May 2002 05:29:30 -0000	1.23
+++ java/lang/natRuntime.cc	6 Jul 2002 02:36:18 -0000
@@ -575,7 +575,7 @@
   // FIXME: use platform function here.
 #ifdef WIN32
   sb->append (JvNewStringLatin1 ("dll"));
-else
+#else
   sb->append (JvNewStringLatin1 ("so"));
 #endif
 
Index: java/net/DatagramSocket.java
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/net/DatagramSocket.java,v
retrieving revision 1.10
diff -u -r1.10 DatagramSocket.java
--- java/net/DatagramSocket.java	13 Jan 2002 11:59:37 -0000	1.10
+++ java/net/DatagramSocket.java	6 Jul 2002 02:36:19 -0000
@@ -25,6 +25,8 @@
 public class DatagramSocket
 {
   DatagramSocketImpl impl;
+  InetAddress remoteAddr = null;
+  int remotePort = -1;
 
   public DatagramSocket() throws SocketException
   {
@@ -128,26 +130,34 @@
 
   public synchronized void receive(DatagramPacket p) throws IOException
   {
-    SecurityManager s = System.getSecurityManager();
-    if (s != null)
-      s.checkAccept(p.getAddress().getHostAddress(), p.getPort());
-
+    if (p == null) {
+      SecurityManager s = System.getSecurityManager();
+	if (s != null)
+	  s.checkAccept(p.getAddress().getHostAddress(), p.getPort());
+    } else if ((p.getPort() != remotePort || !p.getAddress().equals(remoteAddr))) {
+      throw new IllegalArgumentException("Inconsistent packet address for connection to "
+					 +remoteAddr+" port "+remotePort);
+    }
     impl.receive(p);
   }
 
   public void send(DatagramPacket p) throws IOException
   {
     // JDK1.2: Don't do security checks if socket is connected; see jdk1.2 api.
-    SecurityManager s = System.getSecurityManager();
-    if (s != null)
+    if (p == null) {
+      SecurityManager s = System.getSecurityManager();
+      if (s != null)
       {
 	InetAddress addr = p.getAddress();
 	if (addr.isMulticastAddress())
 	  s.checkMulticast(addr);
 	else
-	  s.checkConnect(addr.getHostAddress(), p.getPort());
+          s.checkConnect(addr.getHostAddress(), p.getPort());
       }
-
+    } else if ((p.getPort() != remotePort || !p.getAddress().equals(remoteAddr))) {
+      throw new IllegalArgumentException("Inconsistent packet address for connection to "
+					 +remoteAddr+" port "+remotePort);
+    }
     // FIXME: if this is a subclass of MulticastSocket, use getTTL for TTL val.
     impl.send(p);
   }
@@ -160,35 +170,53 @@
     impl.setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
   }
 
-  // JDK1.2
-  // public void connect(InetAddress address, int port)
-  // {
-  // }
-
-  // JDK1.2
-  // public void disconnect()
-  // {
-  // }
-
-  // JDK1.2
-  // public InetAddress getInetAddress()
-  // {
-  // }
-
-  // JDK1.2
-  // public int getPort()
-  // {
-  // }
-
-  /**
-   * This method returns the value of the system level socket option
-   * SO_RCVBUF, which is used by the operating system to tune buffer
-   * sizes for data transfers.
-   *
-   * @return The receive buffer size.
-   *
-   * @exception SocketException If an error occurs.
-   *
+  public void connect(InetAddress address, int port) {
+    synchronized (this) {
+      SecurityManager s = System.getSecurityManager();
+      if (s != null)
+      {
+	if (address.isMulticastAddress())
+	  s.checkMulticast(address);
+	else
+	  s.checkConnect(address.getHostAddress(), port);
+
+	remoteAddr = address;
+	remotePort = port;
+	if (remotePort < -1 || remotePort > 65535) {
+	  throw new IllegalArgumentException("bad remote parameters for local port "+
+					     impl.localPort);
+	}
+      }
+    }
+  }
+
+  public void disconnect() 
+  {
+    synchronized (this) {
+      remotePort = -1;
+      remoteAddr = null;
+    }
+  }
+
+  public InetAddress getInetAddress()
+  {
+    return remoteAddr;
+  }
+
+  public int getPort()
+  {
+    return remotePort;
+  }
+
+/**
+ * This method returns the value of the system level socket option
+ SO_RCVBUF, which is used by the operating system to tune buffer
+ * sizes for data transfers.
+ *
+ @return The receive buffer size.
+ *
+ * @exception SocketException If an error occurs.
+ *
    * @since 1.2
    */
   public int getReceiveBufferSize() throws SocketException
Index: java/net/PlainSocketImpl.java
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/net/PlainSocketImpl.java,v
retrieving revision 1.10
diff -u -r1.10 PlainSocketImpl.java
--- java/net/PlainSocketImpl.java	28 Mar 2002 02:08:36 -0000	1.10
+++ java/net/PlainSocketImpl.java	6 Jul 2002 02:36:19 -0000
@@ -49,6 +49,8 @@
   // localAddress cache
   InetAddress localAddress;
 
+  int shutdownMask = 0;
+
   public native void setOption(int optID, Object value) throws SocketException;
 
   public native Object getOption(int optID) throws SocketException;
@@ -78,6 +80,32 @@
 
   protected native void close () throws IOException;
 
+  /**
+   * Closes the input side of the socket stream.
+   *
+   * @exception IOException If an error occurs.
+   */
+  public void shutdownInput() throws IOException 
+  {
+    if (fd.valid())
+      fd.shutdownInput();
+    if (in != null)
+      in.skip((long)in.available());
+    shutdownMask = shutdownMask | SHUTDOWN_INPUT;
+  }
+
+  /**
+   * Closes the output side of the socket stream.
+   *
+   * @exception IOException If an error occurs.
+   */
+  public void shutdownOutput() throws IOException
+  {
+    if (fd.valid())
+      fd.shutdownOutput();
+    shutdownMask = shutdownMask | SHUTDOWN_OUTPUT;
+  }
+
 
   // Stream handling.
 
@@ -124,6 +152,8 @@
    */
   protected InputStream getInputStream() throws IOException
   {
+    if ((shutdownMask & SHUTDOWN_INPUT) != 0)
+      throw new IOException("Socket input stream is shut down");
     if (in == null)
       in = new SocketInputStream();
     return in;
@@ -133,6 +163,8 @@
    */
   protected OutputStream getOutputStream() throws IOException
   {
+    if ((shutdownMask & SHUTDOWN_OUTPUT) != 0)
+      throw new IOException("Socket input stream is shut down");
     if (out == null)
       out = new SocketOutputStream();
     return out;
Index: java/net/Socket.java
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/net/Socket.java,v
retrieving revision 1.9
diff -u -r1.9 Socket.java
--- java/net/Socket.java	22 Jan 2002 22:40:23 -0000	1.9
+++ java/net/Socket.java	6 Jul 2002 02:36:19 -0000
@@ -629,6 +629,29 @@
   }
 
   /**
+   * Closes the input side of the socket stream.
+   *
+   * @exception IOException If an error occurs.
+   */
+  public void shutdownInput() throws IOException 
+  {
+    if (impl != null)
+      impl.shutdownInput();
+  }
+
+  /**
+   * Closes the output side of the socket stream.
+   *
+   * @exception IOException If an error occurs.
+   */
+  public void shutdownOutput() throws IOException
+  {
+    if (impl != null)
+      impl.shutdownOutput();
+  }
+
+
+  /**
    * Converts this <code>Socket</code> to a <code>String</code>.
    *
    * @return The <code>String</code> representation of this <code>Socket</code>
Index: java/net/SocketImpl.java
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/net/SocketImpl.java,v
retrieving revision 1.8
diff -u -r1.8 SocketImpl.java
--- java/net/SocketImpl.java	14 Feb 2002 23:16:06 -0000	1.8
+++ java/net/SocketImpl.java	6 Jul 2002 02:36:19 -0000
@@ -61,6 +61,9 @@
  */
 public abstract class SocketImpl implements SocketOptions
 {
+  final public static int SHUTDOWN_INPUT = 1;
+  final public static int SHUTDOWN_OUTPUT = 2;
+
   /**
    * The address of the remote end of the socket connection
    */
@@ -264,4 +267,19 @@
    * @XXX This redeclaration from SocketOptions is a workaround to a gcj bug.
    */
   public abstract Object getOption(int option_id) throws SocketException;
+
+  /**
+   * Closes the input side of the socket stream.
+   *
+   * @exception IOException If an error occurs.
+   */
+  protected abstract void shutdownInput() throws IOException;
+
+  /**
+   * Closes the output side of the socket stream.
+   *
+   * @exception IOException If an error occurs.
+   */
+  protected abstract void shutdownOutput() throws IOException;
+
 }
Index: java/net/URL.java
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/net/URL.java,v
retrieving revision 1.10
diff -u -r1.10 URL.java
--- java/net/URL.java	23 Feb 2002 00:15:48 -0000	1.10
+++ java/net/URL.java	6 Jul 2002 02:36:19 -0000
@@ -31,6 +31,8 @@
   private String host;
   private int port = -1;	// Initialize for constructor using context.
   private String file;
+  private String query = null;
+  private String path;
   private String ref;
   private int hashCode = 0;
   transient private URLStreamHandler handler;
@@ -93,6 +95,18 @@
 	this.file = file.substring(0, hashAt);
 	this.ref = file.substring(hashAt + 1);
       }
+
+    int queryAt = file.lastIndexOf('?');
+    if (queryAt < 0)
+      {
+	this.path = file;
+      }
+    else
+      {
+	this.path = file.substring(0, queryAt);
+	this.query = file.substring(++queryAt);
+      }
+
     hashCode = hashCode();			// Used for serialization.
   }
 
@@ -186,6 +200,17 @@
     if (hashAt >= 0)
       ref = spec.substring(hashAt + 1);
 
+    int queryAt = file.lastIndexOf('?');
+    if (queryAt < 0)
+      {
+	this.path = file;
+      }
+    else
+      {
+	this.path = file.substring(0, queryAt);
+	this.query = file.substring(++queryAt);
+      }
+
     hashCode = hashCode();			// Used for serialization.
   }
 
@@ -221,8 +246,12 @@
 
   public String getPath()
   {
-    int quest = file.indexOf('?');
-    return quest < 0 ? file : file.substring(0, quest);
+    return path;
+  }
+
+  public String getQuery() 
+  {
+    return query;
   }
 
   public String getHost()
Index: java/net/natPlainDatagramSocketImpl.cc
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/net/natPlainDatagramSocketImpl.cc,v
retrieving revision 1.39
diff -u -r1.39 natPlainDatagramSocketImpl.cc
--- java/net/natPlainDatagramSocketImpl.cc	25 Jun 2002 05:29:22 -0000	1.39
+++ java/net/natPlainDatagramSocketImpl.cc	6 Jul 2002 02:36:19 -0000
@@ -11,19 +11,14 @@
 #include <platform.h>
 
 #ifdef WIN32
+#define NATIVE_CLOSE(s) closesocket(s);
 #include <errno.h>
 #include <string.h>
 #ifndef ENOPROTOOPT
 #define ENOPROTOOPT 109
 #endif
-
-static inline int
-close(int s)
-{
-  return closesocket(s);
-}
-
 #else /* WIN32 */
+#define NATIVE_CLOSE(s) close(s);
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -303,7 +298,7 @@
 
   // The method isn't declared to throw anything, so we disregard
   // the return value.
-  ::close (fnum);
+  (void)NATIVE_CLOSE(fnum);
   fnum = -1;
   timeout = 0;
 }
@@ -410,6 +405,7 @@
 void
 java::net::PlainDatagramSocketImpl::setTimeToLive (jint ttl)
 {
+#ifdef IP_MULTICAST_TTL
   // Assumes IPPROTO_IP rather than IPPROTO_IPV6 since socket created is IPv4.
   char val = (char) ttl;
   socklen_t val_len = sizeof(val);
@@ -418,11 +414,15 @@
 
   char* strerr = strerror (errno);
   throw new java::io::IOException (JvNewStringUTF (strerr));
+#else
+  throw new java::io::IOException (JvNewStringUTF ("IP_MULTICAST_TTL unimplemented"));
+#endif
 }
 
 jint
 java::net::PlainDatagramSocketImpl::getTimeToLive ()
 {
+#ifdef IP_MULTICAST_TTL
   // Assumes IPPROTO_IP rather than IPPROTO_IPV6 since socket created is IPv4.
   char val;
   socklen_t val_len = sizeof(val);
@@ -431,6 +431,9 @@
 
   char* strerr = strerror (errno);
   throw new java::io::IOException (JvNewStringUTF (strerr));
+#else
+  throw new java::io::IOException (JvNewStringUTF ("IP_MULTICAST_TTL unimplemented"));
+#endif
 }
 
 void
@@ -558,6 +561,7 @@
 	int level, opname;
 	const char *ptr;
 
+#ifdef IP_MULTICAST_IF
 	haddress = ((java::net::InetAddress *) value)->addr;
 	bytes = elements (haddress);
 	len = haddress->length;
@@ -583,7 +587,10 @@
 	else
 	  throw
 	    new java::net::SocketException (JvNewStringUTF ("invalid length"));
-
+#else
+	  throw
+	    new java::net::SocketException (JvNewStringUTF ("IP_MULTICAST_IF unimplemented"));
+#endif
 	if (::setsockopt (fnum, level, opname, ptr, len) != 0)
 	  goto error;
         return;
@@ -674,6 +681,7 @@
   	socklen_t inaddr_len;
 	char *bytes;
 
+#ifdef IP_MULTICAST_IF
   	inaddr_len = sizeof(inaddr);
 	if (::getsockopt (fnum, IPPROTO_IP, IP_MULTICAST_IF, (char *) &inaddr,
 	    &inaddr_len) != 0)
@@ -682,6 +690,10 @@
 	bytes = inet_ntoa (inaddr);
 
 	return java::net::InetAddress::getByName (JvNewStringLatin1 (bytes));
+#else
+	throw new java::net::SocketException (
+	  JvNewStringUTF ("IP_MULTICAST_IF unimplemented"));
+#endif
 #else
 	throw new java::net::SocketException (
 	  JvNewStringUTF ("IP_MULTICAST_IF: not available - no inet_ntoa()"));
Index: java/net/natPlainSocketImpl.cc
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/net/natPlainSocketImpl.cc,v
retrieving revision 1.42
diff -u -r1.42 natPlainSocketImpl.cc
--- java/net/natPlainSocketImpl.cc	18 Jun 2002 16:25:00 -0000	1.42
+++ java/net/natPlainSocketImpl.cc	6 Jul 2002 02:36:19 -0000
@@ -11,6 +11,7 @@
 
 #ifndef DISABLE_JAVA_NET
 #ifdef WIN32
+#define NATIVE_CLOSE(s) closesocket(s);
 #include <windows.h>
 #include <winsock.h>
 #include <errno.h>
@@ -20,13 +21,6 @@
 #undef MIN_PRIORITY
 #undef FIONREAD
 
-// These functions make the Win32 socket API look more POSIXy
-static inline int
-close(int s)
-{
-  return closesocket(s);
-}
-
 static inline int
 write(int s, void *buf, int len)
 {
@@ -46,7 +40,7 @@
 #define ENOPROTOOPT 109
 #endif
 #else /* WIN32 */
-
+#define NATIVE_CLOSE(s) close(s);
 #ifdef HAVE_SYS_IOCTL_H
 #define BSD_COMP /* Get FIONREAD on Solaris2. */
 #include <sys/ioctl.h>
@@ -429,7 +423,7 @@
   JvSynchronize sync (this);
 
   // should we use shutdown here? how would that effect so_linger?
-  int res = ::close (fnum);
+  int res = NATIVE_CLOSE(fnum);
 
   if (res == -1)
     {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]