src/windows/native/java/net/net_util_md.c

Print this page

        

@@ -232,11 +232,11 @@
 }
 
 jint  IPv6_supported()
 {
     HMODULE lib;
-    int fd = socket(AF_INET6, SOCK_STREAM, 0) ;
+    int fd = (int)socket(AF_INET6, SOCK_STREAM, 0) ;
     if (fd < 0) {
         return JNI_FALSE;
     }
     closesocket (fd);
 

@@ -689,19 +689,19 @@
     /* We need to bind on both stacks, with the same port number */
 
     memset (&oaddr, 0, sizeof(oaddr));
     if (family == AF_INET) {
         ofamily = AF_INET6;
-        fd = b->ipv4_fd;
-        ofd = b->ipv6_fd;
+        fd = (int)b->ipv4_fd;
+        ofd = (int)b->ipv6_fd;
         port = (u_short)GET_PORT (b->addr);
         IN6ADDR_SETANY (&oaddr.him6);
         oaddr.him6.sin6_port = port;
     } else {
         ofamily = AF_INET;
-        ofd = b->ipv4_fd;
-        fd = b->ipv6_fd;
+        ofd = (int)b->ipv4_fd;
+        fd = (int)b->ipv6_fd;
         port = (u_short)GET_PORT (b->addr);
         oaddr.him4.sin_family = AF_INET;
         oaddr.him4.sin_port = port;
         oaddr.him4.sin_addr.s_addr = INADDR_ANY;
     }

@@ -742,15 +742,15 @@
             close_ofd = ofd; ofd = -1;
             b->ipv4_fd = SOCKET_ERROR;
             b->ipv6_fd = SOCKET_ERROR;
 
             /* create two new sockets */
-            fd = socket (family, sotype, 0);
+            fd = (int)socket (family, sotype, 0);
             if (fd == SOCKET_ERROR) {
                 CLOSE_SOCKETS_AND_RETURN;
             }
-            ofd = socket (ofamily, sotype, 0);
+            ofd = (int)socket (ofamily, sotype, 0);
             if (ofd == SOCKET_ERROR) {
                 CLOSE_SOCKETS_AND_RETURN;
             }
 
             /* bind random port on first socket */

@@ -847,14 +847,14 @@
                 caddr[10] = 0xff;
                 caddr[11] = 0xff; */
             } else {
                 caddr[10] = 0xff;
                 caddr[11] = 0xff;
-                caddr[12] = ((address >> 24) & 0xff);
-                caddr[13] = ((address >> 16) & 0xff);
-                caddr[14] = ((address >> 8) & 0xff);
-                caddr[15] = (address & 0xff);
+                caddr[12] = (jbyte)((address >> 24) & 0xff);
+                caddr[13] = (jbyte)((address >> 16) & 0xff);
+                caddr[14] = (jbyte)((address >> 8) & 0xff);
+                caddr[15] = (jbyte)(address & 0xff);
             }
         } else {
             ipaddress = (*env)->GetObjectField(env, iaObj, ia6_ipaddressID);
             scopeid = (jint)(*env)->GetIntField(env, iaObj, ia6_scopeidID);
             cached_scope_id = (jint)(*env)->GetIntField(env, iaObj, ia6_cachedscopeidID);

@@ -1000,11 +1000,11 @@
     return timeout;
 }
 
 int NET_Socket (int domain, int type, int protocol) {
     int sock;
-    sock = socket (domain, type, protocol);
+    sock = (int)socket (domain, type, protocol);
     if (sock != INVALID_SOCKET) {
         SetHandleInformation((HANDLE)(uintptr_t)sock, HANDLE_FLAG_INHERIT, FALSE);
     }
     return sock;
 }