changeset 439:89772d193b62

Merge
author alanb
date Fri, 25 Jul 2008 17:03:39 +0100
parents 4468ec9b1eb6 d01e7cae7b3e
children e709069bc182
files src/solaris/native/sun/nio/ch/DatagramChannelImpl.c src/solaris/native/sun/nio/ch/Net.c src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c src/solaris/native/sun/nio/ch/SocketChannelImpl.c
diffstat 29 files changed, 122 insertions(+), 124 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/back/ThreadReferenceImpl.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/back/ThreadReferenceImpl.c	Fri Jul 25 17:03:39 2008 +0100
@@ -540,7 +540,6 @@
 
         jvmtiError error = JVMTI_ERROR_NONE;
         jint count = 0;
-        jint depth;
         jvmtiMonitorStackDepthInfo *monitors=NULL;
 
         error = JVMTI_FUNC_PTR(gdata->jvmti,GetOwnedMonitorStackDepthInfo)
--- a/src/share/back/transport.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/back/transport.c	Fri Jul 25 17:03:39 2008 +0100
@@ -473,7 +473,7 @@
         /*
          * Record listener address in a system property
          */
-        len = strlen(name) + strlen(retAddress) + 2;    /* ':' and '\0' */
+        len = (int)strlen(name) + (int)strlen(retAddress) + 2; /* ':' and '\0' */
         prop_value = (char*)jvmtiAllocate(len);
         strcpy(prop_value, name);
         strcat(prop_value, ":");
--- a/src/share/classes/java/nio/channels/spi/AbstractSelector.java	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/classes/java/nio/channels/spi/AbstractSelector.java	Fri Jul 25 17:03:39 2008 +0100
@@ -82,7 +82,7 @@
         this.provider = provider;
     }
 
-    private final Set cancelledKeys = new HashSet();
+    private final Set<SelectionKey> cancelledKeys = new HashSet<SelectionKey>();
 
     void cancel(SelectionKey k) {                       // package-private
         synchronized (cancelledKeys) {
--- a/src/share/classes/java/nio/charset/Charset-X-Coder.java	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/classes/java/nio/charset/Charset-X-Coder.java	Fri Jul 25 17:03:39 2008 +0100
@@ -303,7 +303,7 @@
 
 #if[encoder]
 
-    private WeakReference cachedDecoder = null;
+    private WeakReference<CharsetDecoder> cachedDecoder = null;
 
     /**
      * Tells whether or not the given byte array is a legal replacement value
@@ -322,13 +322,13 @@
      *          is a legal replacement value for this encoder
      */
     public boolean isLegalReplacement(byte[] repl) {
-        WeakReference wr = cachedDecoder;
+        WeakReference<CharsetDecoder> wr = cachedDecoder;
         CharsetDecoder dec = null;
-        if ((wr == null) || ((dec = (CharsetDecoder)wr.get()) == null)) {
+        if ((wr == null) || ((dec = wr.get()) == null)) {
             dec = charset().newDecoder();
             dec.onMalformedInput(CodingErrorAction.REPORT);
             dec.onUnmappableCharacter(CodingErrorAction.REPORT);
-            cachedDecoder = new WeakReference(dec);
+            cachedDecoder = new WeakReference<CharsetDecoder>(dec);
         } else {
             dec.reset();
         }
--- a/src/share/classes/java/nio/charset/Charset.java	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/classes/java/nio/charset/Charset.java	Fri Jul 25 17:03:39 2008 +0100
@@ -379,7 +379,7 @@
     }
 
     // Thread-local gate to prevent recursive provider lookups
-    private static ThreadLocal gate = new ThreadLocal();
+    private static ThreadLocal<ThreadLocal> gate = new ThreadLocal<ThreadLocal>();
 
     private static Charset lookupViaProviders(final String charsetName) {
 
@@ -539,9 +539,9 @@
     // Fold charsets from the given iterator into the given map, ignoring
     // charsets whose names already have entries in the map.
     //
-    private static void put(Iterator i, Map m) {
+    private static void put(Iterator<Charset> i, Map<String,Charset> m) {
         while (i.hasNext()) {
-            Charset cs = (Charset)i.next();
+            Charset cs = i.next();
             if (!m.containsKey(cs.name()))
                 m.put(cs.name(), cs);
         }
@@ -623,7 +623,7 @@
 
     private final String name;          // tickles a bug in oldjavac
     private final String[] aliases;     // tickles a bug in oldjavac
-    private Set aliasSet = null;
+    private Set<String> aliasSet = null;
 
     /**
      * Initializes a new charset with the given canonical name and alias
@@ -665,7 +665,7 @@
         if (aliasSet != null)
             return aliasSet;
         int n = aliases.length;
-        HashSet hs = new HashSet(n);
+        HashSet<String> hs = new HashSet<String>(n);
         for (int i = 0; i < n; i++)
             hs.add(aliases[i]);
         aliasSet = Collections.unmodifiableSet(hs);
--- a/src/share/classes/java/nio/charset/CoderResult.java	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/classes/java/nio/charset/CoderResult.java	Fri Jul 25 17:03:39 2008 +0100
@@ -194,7 +194,7 @@
 
     private static abstract class Cache {
 
-        private Map cache = null;
+        private Map<Integer,WeakReference<CoderResult>> cache = null;
 
         protected abstract CoderResult create(int len);
 
@@ -202,16 +202,16 @@
             if (len <= 0)
                 throw new IllegalArgumentException("Non-positive length");
             Integer k = new Integer(len);
-            WeakReference w;
+            WeakReference<CoderResult> w;
             CoderResult e = null;
             if (cache == null) {
-                cache = new HashMap();
-            } else if ((w = (WeakReference)cache.get(k)) != null) {
-                e = (CoderResult)w.get();
+                cache = new HashMap<Integer,WeakReference<CoderResult>>();
+            } else if ((w = cache.get(k)) != null) {
+                e = w.get();
             }
             if (e == null) {
                 e = create(len);
-                cache.put(k, new WeakReference(e));
+                cache.put(k, new WeakReference<CoderResult>(e));
             }
             return e;
         }
--- a/src/share/classes/sun/nio/ch/SelectorImpl.java	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/classes/sun/nio/ch/SelectorImpl.java	Fri Jul 25 17:03:39 2008 +0100
@@ -42,19 +42,19 @@
 {
 
     // The set of keys with data ready for an operation
-    protected Set selectedKeys;
+    protected Set<SelectionKey> selectedKeys;
 
     // The set of keys registered with this Selector
-    protected HashSet keys;
+    protected HashSet<SelectionKey> keys;
 
     // Public views of the key sets
-    private Set publicKeys;             // Immutable
-    private Set publicSelectedKeys;     // Removal allowed, but not addition
+    private Set<SelectionKey> publicKeys;             // Immutable
+    private Set<SelectionKey> publicSelectedKeys;     // Removal allowed, but not addition
 
     protected SelectorImpl(SelectorProvider sp) {
         super(sp);
-        keys = new HashSet();
-        selectedKeys = new HashSet();
+        keys = new HashSet<SelectionKey>();
+        selectedKeys = new HashSet<SelectionKey>();
         if (Util.atBugLevel("1.4")) {
             publicKeys = keys;
             publicSelectedKeys = selectedKeys;
@@ -64,13 +64,13 @@
         }
     }
 
-    public Set keys() {
+    public Set<SelectionKey> keys() {
         if (!isOpen() && !Util.atBugLevel("1.4"))
             throw new ClosedSelectorException();
         return publicKeys;
     }
 
-    public Set selectedKeys() {
+    public Set<SelectionKey> selectedKeys() {
         if (!isOpen() && !Util.atBugLevel("1.4"))
             throw new ClosedSelectorException();
         return publicSelectedKeys;
--- a/src/share/classes/sun/nio/ch/Util.java	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/classes/sun/nio/ch/Util.java	Fri Jul 25 17:03:39 2008 +0100
@@ -51,9 +51,13 @@
     // Per-thread soft cache of the last temporary direct buffer
     private static ThreadLocal<SoftReference<ByteBuffer>>[] bufferPool;
 
+    @SuppressWarnings("unchecked")
+    static ThreadLocal<SoftReference<ByteBuffer>>[] createThreadLocalBufferPool() {
+        return new ThreadLocal[TEMP_BUF_POOL_SIZE];
+    }
+
     static {
-        bufferPool = (ThreadLocal<SoftReference<ByteBuffer>>[])
-            new ThreadLocal[TEMP_BUF_POOL_SIZE];
+        bufferPool = createThreadLocalBufferPool();
         for (int i=0; i<TEMP_BUF_POOL_SIZE; i++)
             bufferPool[i] = new ThreadLocal<SoftReference<ByteBuffer>>();
     }
--- a/src/share/demo/jvmti/hprof/hprof_io.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/demo/jvmti/hprof/hprof_io.c	Fri Jul 25 17:03:39 2008 +0100
@@ -1900,7 +1900,6 @@
 dump_heap_segment_and_reset(jlong segment_size)
 {
     int   fd;
-    char *last_chunk;
     jlong last_chunk_len;
 
     HPROF_ASSERT(gdata->heap_fd >= 0);
--- a/src/share/demo/jvmti/hprof/hprof_util.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/demo/jvmti/hprof/hprof_util.c	Fri Jul 25 17:03:39 2008 +0100
@@ -1174,7 +1174,7 @@
 
         finfo           = empty_finfo;
         finfo.cnum      = cnum;
-        finfo.modifiers = getFieldModifiers(klass, idlist[i]);
+        finfo.modifiers = (unsigned short)getFieldModifiers(klass, idlist[i]);
         if ( ( finfo.modifiers & JVM_ACC_STATIC ) == 0 ||
              !skip_static_field_names ) {
             char *field_name;
--- a/src/share/native/java/nio/Bits.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/native/java/nio/Bits.c	Fri Jul 25 17:03:39 2008 +0100
@@ -116,7 +116,7 @@
     jshort *srcShort, *dstShort, *endShort;
     jshort tmpShort;
 
-    dstShort = (jshort *)dstAddr;
+    dstShort = (jshort *)jlong_to_ptr(dstAddr);
 
     while (length > 0) {
         /* do not change this if-else statement, see WARNING above */
@@ -151,7 +151,7 @@
     jshort *srcShort, *dstShort, *endShort;
     jshort tmpShort;
 
-    srcShort = (jshort *)srcAddr;
+    srcShort = (jshort *)jlong_to_ptr(srcAddr);
 
     while (length > 0) {
         /* do not change this if-else statement, see WARNING above */
@@ -186,7 +186,7 @@
     jint *srcInt, *dstInt, *endInt;
     jint tmpInt;
 
-    dstInt = (jint *)dstAddr;
+    dstInt = (jint *)jlong_to_ptr(dstAddr);
 
     while (length > 0) {
         /* do not change this code, see WARNING above */
@@ -221,7 +221,7 @@
     jint *srcInt, *dstInt, *endInt;
     jint tmpInt;
 
-    srcInt = (jint *)srcAddr;
+    srcInt = (jint *)jlong_to_ptr(srcAddr);
 
     while (length > 0) {
         /* do not change this code, see WARNING above */
@@ -256,7 +256,7 @@
     jlong *srcLong, *dstLong, *endLong;
     jlong tmpLong;
 
-    dstLong = (jlong *)dstAddr;
+    dstLong = (jlong *)jlong_to_ptr(dstAddr);
 
     while (length > 0) {
         /* do not change this code, see WARNING above */
@@ -291,7 +291,7 @@
     jlong *srcLong, *dstLong, *endLong;
     jlong tmpLong;
 
-    srcLong = (jlong *)srcAddr;
+    srcLong = (jlong *)jlong_to_ptr(srcAddr);
 
     while (length > 0) {
         /* do not change this code, see WARNING above */
--- a/src/share/transport/shmem/shmemBack.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/transport/shmem/shmemBack.c	Fri Jul 25 17:03:39 2008 +0100
@@ -96,7 +96,8 @@
      */
     if (err == JDWPTRANSPORT_ERROR_IO_ERROR) {
         char *join_str = ": ";
-        int msg_len = strlen(newmsg) + strlen(join_str) + strlen(buf) + 3;
+        int msg_len = (int)strlen(newmsg) + (int)strlen(join_str) +
+                      (int)strlen(buf) + 3;
         msg = (*callbacks->alloc)(msg_len);
         if (msg != NULL) {
             strcpy(msg, newmsg);
@@ -104,7 +105,7 @@
             strcat(msg, buf);
         }
     } else {
-        msg = (*callbacks->alloc)(strlen(newmsg)+1);
+        msg = (*callbacks->alloc)((int)strlen(newmsg)+1);
         if (msg != NULL) {
             strcpy(msg, newmsg);
         }
@@ -183,7 +184,7 @@
         char *name2;
         rc = shmemBase_name(transport, &name);
         if (rc == SYS_OK) {
-            name2 = (callbacks->alloc)(strlen(name) + 1);
+            name2 = (callbacks->alloc)((int)strlen(name) + 1);
             if (name2 == NULL) {
                 RETURN_ERROR(JDWPTRANSPORT_ERROR_OUT_OF_MEMORY, "out of memory");
             } else {
@@ -329,7 +330,7 @@
     if (msg == NULL) {
         return JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE;
     }
-    *msgP = (*callbacks->alloc)(strlen(msg)+1);
+    *msgP = (*callbacks->alloc)((int)strlen(msg)+1);
     if (*msgP == NULL) {
         return JDWPTRANSPORT_ERROR_OUT_OF_MEMORY;
     }
--- a/src/share/transport/shmem/shmemBase.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/transport/shmem/shmemBase.c	Fri Jul 25 17:03:39 2008 +0100
@@ -167,7 +167,7 @@
 
     msg = (char *)sysTlsGet(tlsIndex);
     if (msg == NULL) {
-        msg = (*callback->alloc)(strlen(newmsg)+1);
+        msg = (*callback->alloc)((int)strlen(newmsg)+1);
         if (msg != NULL) {
            strcpy(msg, newmsg);
         }
--- a/src/share/transport/socket/socketTransport.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/transport/socket/socketTransport.c	Fri Jul 25 17:03:39 2008 +0100
@@ -85,7 +85,8 @@
 
     if (err == JDWPTRANSPORT_ERROR_IO_ERROR) {
         char *join_str = ": ";
-        int msg_len = strlen(newmsg) + strlen(join_str) + strlen(buf) + 3;
+        int msg_len = (int)strlen(newmsg) + (int)strlen(join_str) +
+                      (int)strlen(buf) + 3;
         msg = (*callback->alloc)(msg_len);
         if (msg != NULL) {
             strcpy(msg, newmsg);
@@ -93,7 +94,7 @@
             strcat(msg, buf);
         }
     } else {
-        msg = (*callback->alloc)(strlen(newmsg)+1);
+        msg = (*callback->alloc)((int)strlen(newmsg)+1);
         if (msg != NULL) {
             strcpy(msg, newmsg);
         }
@@ -153,7 +154,7 @@
         }
         buf = b;
         buf += received;
-        n = dbgsysRecv(fd, buf, strlen(hello)-received, 0);
+        n = dbgsysRecv(fd, buf, (int)strlen(hello)-received, 0);
         if (n == 0) {
             setLastError(0, "handshake failed - connection prematurally closed");
             return JDWPTRANSPORT_ERROR_IO_ERROR;
@@ -179,14 +180,14 @@
         }
     }
 
-    if (dbgsysSend(fd, hello, strlen(hello), 0) != (int)strlen(hello)) {
+    if (dbgsysSend(fd, hello, (int)strlen(hello), 0) != (int)strlen(hello)) {
         RETURN_IO_ERROR("send failed during handshake");
     }
     return JDWPTRANSPORT_ERROR_NONE;
 }
 
 static jdwpTransportError
-parseAddress(const char *address, struct sockaddr_in *sa, UINT32 defaultHost) {
+parseAddress(const char *address, struct sockaddr_in *sa, uint32_t defaultHost) {
     char *colon;
 
     memset((void *)sa,0,sizeof(struct sockaddr_in));
@@ -202,9 +203,9 @@
         char *buf;
         char *hostname;
         u_short port;
-        UINT32 addr;
+        uint32_t addr;
 
-        buf = (*callback->alloc)(strlen(address)+1);
+        buf = (*callback->alloc)((int)strlen(address)+1);
         if (buf == NULL) {
             RETURN_ERROR(JDWPTRANSPORT_ERROR_OUT_OF_MEMORY, "out of memory");
         }
@@ -306,7 +307,7 @@
                                (struct sockaddr *)&sa, &len);
         portNum = dbgsysNetworkToHostShort(sa.sin_port);
         sprintf(buf, "%d", portNum);
-        *actualAddress = (*callback->alloc)(strlen(buf) + 1);
+        *actualAddress = (*callback->alloc)((int)strlen(buf) + 1);
         if (*actualAddress == NULL) {
             RETURN_ERROR(JDWPTRANSPORT_ERROR_OUT_OF_MEMORY, "out of memory");
         } else {
@@ -679,7 +680,7 @@
     if (msg == NULL) {
         return JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE;
     }
-    *msgP = (*callback->alloc)(strlen(msg)+1);
+    *msgP = (*callback->alloc)((int)strlen(msg)+1);
     if (*msgP == NULL) {
         return JDWPTRANSPORT_ERROR_OUT_OF_MEMORY;
     }
--- a/src/share/transport/socket/sysSocket.h	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/share/transport/socket/sysSocket.h	Fri Jul 25 17:03:39 2008 +0100
@@ -29,14 +29,6 @@
 #include "sys.h"
 #include "socket_md.h"
 
-#ifdef _LP64
-typedef unsigned int    UINT32;
-typedef int             INT32;
-#else /* _LP64 */
-typedef unsigned long   UINT32;
-typedef long            INT32;
-#endif /* _LP64 */
-
 #define DBG_POLLIN              1
 #define DBG_POLLOUT             2
 
@@ -44,7 +36,6 @@
 #define DBG_ETIMEOUT            -200
 
 int dbgsysSocketClose(int fd);
-INT32 dbgsysSocketAvailable(int fd, INT32 *pbytes);
 int dbgsysConnect(int fd, struct sockaddr *him, int len);
 int dbgsysFinishConnect(int fd, long timeout);
 int dbgsysAccept(int fd, struct sockaddr *him, int *len);
@@ -52,18 +43,17 @@
               int tolen);
 int dbgsysRecvFrom(int fd, char *buf, int nbytes, int flags,
                 struct sockaddr *from, int *fromlen);
-int dbgsysListen(int fd, INT32 count);
+int dbgsysListen(int fd, int backlog);
 int dbgsysRecv(int fd, char *buf, int nBytes, int flags);
 int dbgsysSend(int fd, char *buf, int nBytes, int flags);
-int dbgsysTimeout(int fd, INT32 timeout);
 struct hostent *dbgsysGetHostByName(char *hostname);
 int dbgsysSocket(int domain, int type, int protocol);
 int dbgsysBind(int fd, struct sockaddr *name, int namelen);
 int dbgsysSetSocketOption(int fd, jint cmd, jboolean on, jvalue value);
-UINT32 dbgsysInetAddr(const char* cp);
-UINT32 dbgsysHostToNetworkLong(UINT32 hostlong);
+uint32_t dbgsysInetAddr(const char* cp);
+uint32_t dbgsysHostToNetworkLong(uint32_t hostlong);
 unsigned short dbgsysHostToNetworkShort(unsigned short hostshort);
-UINT32 dbgsysNetworkToHostLong(UINT32 netlong);
+uint32_t dbgsysNetworkToHostLong(uint32_t netlong);
 unsigned short dbgsysNetworkToHostShort(unsigned short netshort);
 int dbgsysGetSocketName(int fd, struct sockaddr *him, int *len);
 int dbgsysConfigureBlocking(int fd, jboolean blocking);
--- a/src/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/solaris/classes/sun/nio/ch/DevPollSelectorImpl.java	Fri Jul 25 17:03:39 2008 +0100
@@ -50,7 +50,7 @@
     private int totalChannels;
 
     // Maps from file descriptors to keys
-    private HashMap fdToKey;
+    private Map<Integer,SelectionKeyImpl> fdToKey;
 
     // True if this Selector has been closed
     private boolean closed = false;
@@ -71,7 +71,7 @@
         fd1 = fdes[1];
         pollWrapper = new DevPollArrayWrapper();
         pollWrapper.initInterrupt(fd0, fd1);
-        fdToKey = new HashMap();
+        fdToKey = new HashMap<Integer,SelectionKeyImpl>();
         totalChannels = 1;
     }
 
@@ -110,8 +110,7 @@
         int numKeysUpdated = 0;
         for (int i=0; i<entries; i++) {
             int nextFD = pollWrapper.getDescriptor(i);
-            SelectionKeyImpl ski = (SelectionKeyImpl) fdToKey.get(
-                new Integer(nextFD));
+            SelectionKeyImpl ski = fdToKey.get(Integer.valueOf(nextFD));
             // ski is null in the case of an interrupt
             if (ski != null) {
                 int rOps = pollWrapper.getReventOps(i);
@@ -169,7 +168,7 @@
 
     protected void implRegister(SelectionKeyImpl ski) {
         int fd = IOUtil.fdVal(ski.channel.getFD());
-        fdToKey.put(new Integer(fd), ski);
+        fdToKey.put(Integer.valueOf(fd), ski);
         totalChannels++;
         keys.add(ski);
     }
@@ -178,7 +177,7 @@
         int i = ski.getIndex();
         assert (i >= 0);
         int fd = ski.channel.getFDVal();
-        fdToKey.remove(new Integer(fd));
+        fdToKey.remove(Integer.valueOf(fd));
         pollWrapper.release(fd);
         totalChannels--;
         ski.setIndex(-1);
--- a/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java	Fri Jul 25 17:03:39 2008 +0100
@@ -48,7 +48,7 @@
     EPollArrayWrapper pollWrapper;
 
     // Maps from file descriptors to keys
-    private HashMap fdToKey;
+    private Map<Integer,SelectionKeyImpl> fdToKey;
 
     // True if this Selector has been closed
     private boolean closed = false;
@@ -69,7 +69,7 @@
         fd1 = fdes[1];
         pollWrapper = new EPollArrayWrapper();
         pollWrapper.initInterrupt(fd0, fd1);
-        fdToKey = new HashMap();
+        fdToKey = new HashMap<Integer,SelectionKeyImpl>();
     }
 
     protected int doSelect(long timeout)
@@ -107,8 +107,7 @@
         int numKeysUpdated = 0;
         for (int i=0; i<entries; i++) {
             int nextFD = pollWrapper.getDescriptor(i);
-            SelectionKeyImpl ski = (SelectionKeyImpl) fdToKey.get(
-                new Integer(nextFD));
+            SelectionKeyImpl ski = fdToKey.get(Integer.valueOf(nextFD));
             // ski is null in the case of an interrupt
             if (ski != null) {
                 int rOps = pollWrapper.getEventOps(i);
@@ -164,7 +163,7 @@
 
     protected void implRegister(SelectionKeyImpl ski) {
         int fd = IOUtil.fdVal(ski.channel.getFD());
-        fdToKey.put(new Integer(fd), ski);
+        fdToKey.put(Integer.valueOf(fd), ski);
         pollWrapper.add(fd);
         keys.add(ski);
     }
@@ -172,7 +171,7 @@
     protected void implDereg(SelectionKeyImpl ski) throws IOException {
         assert (ski.getIndex() >= 0);
         int fd = ski.channel.getFDVal();
-        fdToKey.remove(new Integer(fd));
+        fdToKey.remove(Integer.valueOf(fd));
         pollWrapper.release(fd);
         ski.setIndex(-1);
         keys.remove(ski);
--- a/src/solaris/native/java/nio/MappedByteBuffer.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/solaris/native/java/nio/MappedByteBuffer.c	Fri Jul 25 17:03:39 2008 +0100
@@ -43,7 +43,11 @@
     int result = 0;
     int i = 0;
     void *a = (void *) jlong_to_ptr(address);
-    char * vec = (char *)malloc(numPages * sizeof(char));
+#ifdef __linux__
+    unsigned char *vec = (unsigned char *)malloc(numPages * sizeof(char));
+#else
+    char *vec = (char *)malloc(numPages * sizeof(char));
+#endif
 
     if (vec == NULL) {
         JNU_ThrowOutOfMemoryError(env, NULL);
--- a/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/solaris/native/sun/nio/ch/DatagramChannelImpl.c	Fri Jul 25 17:03:39 2008 +0100
@@ -123,7 +123,7 @@
     jint fd = fdval(env, fdo);
     void *buf = (void *)jlong_to_ptr(address);
     SOCKADDR sa;
-    int sa_len = SOCKADDR_LEN;
+    socklen_t sa_len = SOCKADDR_LEN;
     jboolean retry = JNI_FALSE;
     jint n = 0;
     jobject senderAddr;
--- a/src/solaris/native/sun/nio/ch/InheritedChannel.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/solaris/native/sun/nio/ch/InheritedChannel.c	Fri Jul 25 17:03:39 2008 +0100
@@ -88,7 +88,8 @@
 JNIEXPORT jint JNICALL
 Java_sun_nio_ch_InheritedChannel_soType0(JNIEnv *env, jclass cla, jint fd)
 {
-    int sotype, arglen=sizeof(sotype);
+    int sotype;
+    socklen_t arglen=sizeof(sotype);
     if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void *)&sotype, &arglen) == 0) {
         if (sotype == SOCK_STREAM)
             return sun_nio_ch_InheritedChannel_SOCK_STREAM;
--- a/src/solaris/native/sun/nio/ch/Net.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/solaris/native/sun/nio/ch/Net.c	Fri Jul 25 17:03:39 2008 +0100
@@ -248,7 +248,7 @@
 Java_sun_nio_ch_Net_localPort(JNIEnv *env, jclass clazz, jobject fdo)
 {
     SOCKADDR sa;
-    int sa_len = SOCKADDR_LEN;
+    socklen_t sa_len = SOCKADDR_LEN;
     if (getsockname(fdval(env, fdo), (struct sockaddr *)&sa, &sa_len) < 0) {
         handleSocketError(env, errno);
         return -1;
@@ -260,7 +260,7 @@
 Java_sun_nio_ch_Net_localInetAddress(JNIEnv *env, jclass clazz, jobject fdo)
 {
     SOCKADDR sa;
-    int sa_len = SOCKADDR_LEN;
+    socklen_t sa_len = SOCKADDR_LEN;
     int port;
     if (getsockname(fdval(env, fdo), (struct sockaddr *)&sa, &sa_len) < 0) {
         handleSocketError(env, errno);
--- a/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c	Fri Jul 25 17:03:39 2008 +0100
@@ -73,12 +73,12 @@
     jint ssfd = (*env)->GetIntField(env, ssfdo, fd_fdID);
     jint newfd;
     struct sockaddr *sa;
-    int sa_len;
+    int alloc_len;
     jobject remote_ia = 0;
     jobject isa;
     jint remote_port;
 
-    NET_AllocSockaddr(&sa, &sa_len);
+    NET_AllocSockaddr(&sa, &alloc_len);
 
     /*
      * accept connection but ignore ECONNABORTED indicating that
@@ -86,6 +86,7 @@
      * accept() was called.
      */
     for (;;) {
+        socklen_t sa_len = alloc_len;
         newfd = accept(ssfd, sa, &sa_len);
         if (newfd >= 0) {
             break;
--- a/src/solaris/native/sun/nio/ch/SocketChannelImpl.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/solaris/native/sun/nio/ch/SocketChannelImpl.c	Fri Jul 25 17:03:39 2008 +0100
@@ -51,7 +51,7 @@
                                                jboolean ready)
 {
     int error = 0;
-    int n = sizeof(int);
+    socklen_t n = sizeof(int);
     jint fd = fdval(env, fdo);
     int result = 0;
     struct pollfd poller;
--- a/src/solaris/transport/socket/socket_md.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/solaris/transport/socket/socket_md.c	Fri Jul 25 17:03:39 2008 +0100
@@ -45,8 +45,8 @@
 #include "sysSocket.h"
 
 int
-dbgsysListen(int fd, INT32 count) {
-    return listen(fd, count);
+dbgsysListen(int fd, int backlog) {
+    return listen(fd, backlog);
 }
 
 int
@@ -131,13 +131,13 @@
     return bind(fd, name, namelen);
 }
 
-UINT32
+uint32_t
 dbgsysInetAddr(const char* cp) {
-    return (UINT32)inet_addr(cp);
+    return (uint32_t)inet_addr(cp);
 }
 
-UINT32
-dbgsysHostToNetworkLong(UINT32 hostlong) {
+uint32_t
+dbgsysHostToNetworkLong(uint32_t hostlong) {
     return htonl(hostlong);
 }
 
@@ -151,8 +151,8 @@
     return getsockname(fd, name, namelen);
 }
 
-UINT32
-dbgsysNetworkToHostLong(UINT32 netlong) {
+uint32_t
+dbgsysNetworkToHostLong(uint32_t netlong) {
     return ntohl(netlong);
 }
 
@@ -163,10 +163,10 @@
     if (cmd == TCP_NODELAY) {
         struct protoent *proto = getprotobyname("TCP");
         int tcp_level = (proto == 0 ? IPPROTO_TCP: proto->p_proto);
-        INT32 onl = (INT32)on;
+        uint32_t onl = (uint32_t)on;
 
         if (setsockopt(fd, tcp_level, TCP_NODELAY,
-                       (char *)&onl, sizeof(INT32)) < 0) {
+                       (char *)&onl, sizeof(uint32_t)) < 0) {
                 return SYS_ERR;
         }
     } else if (cmd == SO_LINGER) {
--- a/src/windows/classes/sun/nio/ch/PipeImpl.java	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/windows/classes/sun/nio/ch/PipeImpl.java	Fri Jul 25 17:03:39 2008 +0100
@@ -67,7 +67,7 @@
     }
 
     private class Initializer
-        implements PrivilegedExceptionAction
+        implements PrivilegedExceptionAction<Void>
     {
 
         private final SelectorProvider sp;
@@ -76,7 +76,7 @@
             this.sp = sp;
         }
 
-        public Object run() throws IOException {
+        public Void run() throws IOException {
             ServerSocketChannel ssc = null;
             SocketChannel sc1 = null;
             SocketChannel sc2 = null;
--- a/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java	Fri Jul 25 17:03:39 2008 +0100
@@ -72,7 +72,7 @@
     private int threadsCount = 0;
 
     // A list of helper threads for select.
-    private final List threads = new ArrayList();
+    private final List<Thread> threads = new ArrayList<Thread>();
 
     //Pipe used as a wakeup object.
     private final Pipe wakeupPipe;
@@ -82,6 +82,7 @@
 
     // Maps file descriptors to their indices in  pollArray
     private final static class FdMap extends HashMap<Integer, MapEntry> {
+        static final long serialVersionUID = 0L;
         private MapEntry get(int desc) {
             return get(new Integer(desc));
         }
--- a/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c	Fri Jul 25 17:03:39 2008 +0100
@@ -37,6 +37,7 @@
 #include "jni.h"
 #include "jni_util.h"
 #include "sun_nio_ch_WindowsSelectorImpl.h"
+#include "sun_nio_ch_PollArrayWrapper.h"
 #include "winsock2.h"
 
 
@@ -45,10 +46,6 @@
     jshort events;
 } pollfd;
 
-static int POLLIN   = 1;
-static int POLLCONN = 2;
-static int POLLOUT  = 4;
-
 #define WAKEUP_SOCKET_BUF_SIZE 16
 
 
@@ -82,11 +79,13 @@
 
     /* Set FD_SET structures required for select */
     for (i = 0; i < numfds; i++) {
-        if (fds[i].events & POLLIN) {
+        if (fds[i].events & sun_nio_ch_PollArrayWrapper_POLLIN) {
            readfds.fd_array[read_count] = fds[i].fd;
            read_count++;
         }
-        if (fds[i].events & (POLLOUT | POLLCONN)) {
+        if (fds[i].events & (sun_nio_ch_PollArrayWrapper_POLLOUT |
+                             sun_nio_ch_PollArrayWrapper_POLLCONN))
+        {
            writefds.fd_array[write_count] = fds[i].fd;
            write_count++;
         }
@@ -111,11 +110,13 @@
             /* prepare select structures for the i-th socket */
             errreadfds.fd_count = 0;
             errwritefds.fd_count = 0;
-            if (fds[i].events & POLLIN) {
+            if (fds[i].events & sun_nio_ch_PollArrayWrapper_POLLIN) {
                errreadfds.fd_array[0] = fds[i].fd;
                errreadfds.fd_count = 1;
             }
-            if (fds[i].events & (POLLOUT | POLLCONN)) {
+            if (fds[i].events & (sun_nio_ch_PollArrayWrapper_POLLOUT |
+                                 sun_nio_ch_PollArrayWrapper_POLLCONN))
+            {
                 errwritefds.fd_array[0] = fds[i].fd;
                 errwritefds.fd_count = 1;
             }
@@ -187,7 +188,8 @@
                                                 jint scoutFd)
 {
     /* Write one byte into the pipe */
-    send(scoutFd, (char*)&POLLIN, 1, 0);
+    const char byte = 1;
+    send(scoutFd, &byte, 1, 0);
 }
 
 JNIEXPORT void JNICALL
--- a/src/windows/transport/socket/socket_md.c	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/windows/transport/socket/socket_md.c	Fri Jul 25 17:03:39 2008 +0100
@@ -120,8 +120,8 @@
  * function pointer table, but our pointer should still be good.
  */
 int
-dbgsysListen(int fd, INT32 count) {
-    return listen(fd, (int)count);
+dbgsysListen(int fd, int backlog) {
+    return listen(fd, backlog);
 }
 
 int
@@ -172,7 +172,7 @@
 
 int
 dbgsysAccept(int fd, struct sockaddr *name, int *namelen) {
-    return accept(fd, name, namelen);
+    return (int)accept(fd, name, namelen);
 }
 
 int
@@ -209,7 +209,7 @@
 
 int
 dbgsysSocket(int domain, int type, int protocol) {
-  int fd = socket(domain, type, protocol);
+  int fd = (int)socket(domain, type, protocol);
   if (fd != SOCKET_ERROR) {
       SetHandleInformation((HANDLE)(UINT_PTR)fd, HANDLE_FLAG_INHERIT, FALSE);
   }
@@ -229,12 +229,6 @@
     return closesocket(fd);
 }
 
-INT32
-dbgsysSocketAvailable(int fd, INT32 *pbytes) {
-    u_long arg = (u_long)*pbytes;
-    return (INT32)ioctlsocket(fd, FIONREAD, &arg);
-}
-
 /* Additions to original follow */
 
 int
@@ -243,14 +237,14 @@
 }
 
 
-UINT32
+uint32_t
 dbgsysInetAddr(const char* cp) {
-    return (UINT32)inet_addr(cp);
+    return (uint32_t)inet_addr(cp);
 }
 
-UINT32
-dbgsysHostToNetworkLong(UINT32 hostlong) {
-    return (UINT32)htonl((u_long)hostlong);
+uint32_t
+dbgsysHostToNetworkLong(uint32_t hostlong) {
+    return (uint32_t)htonl((u_long)hostlong);
 }
 
 unsigned short
@@ -263,9 +257,9 @@
     return getsockname(fd, name, namelen);
 }
 
-UINT32
-dbgsysNetworkToHostLong(UINT32 netlong) {
-    return (UINT32)ntohl((u_long)netlong);
+uint32_t
+dbgsysNetworkToHostLong(uint32_t netlong) {
+    return (uint32_t)ntohl((u_long)netlong);
 }
 
 /*
--- a/src/windows/transport/socket/socket_md.h	Wed Jul 23 14:30:16 2008 +0100
+++ b/src/windows/transport/socket/socket_md.h	Fri Jul 25 17:03:39 2008 +0100
@@ -25,3 +25,6 @@
 /* Use its data structures and constants; don't make direct calls */
 
 #include <winsock2.h>
+
+#define uint32_t UINT32
+