6729881: Compiler warning in networking native code
Cleanup compiler warnings Reviewed-by: alanb, jccollet, michaelm
This commit is contained in:
parent
4d46dbd62c
commit
da50d1d60b
@ -201,7 +201,6 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||
}
|
||||
if (hp != NULL) {
|
||||
struct in_addr **addrp = (struct in_addr **) hp->h_addr_list;
|
||||
int len = sizeof(struct in_addr);
|
||||
int i = 0;
|
||||
|
||||
while (*addrp != (struct in_addr *) 0) {
|
||||
|
@ -143,7 +143,6 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||
const char *hostname;
|
||||
jobjectArray ret = 0;
|
||||
int retLen = 0;
|
||||
jclass byteArrayCls;
|
||||
jboolean preferIPv6Address;
|
||||
|
||||
int error=0;
|
||||
@ -219,7 +218,7 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||
} else {
|
||||
int i = 0;
|
||||
int inetCount = 0, inet6Count = 0, inetIndex, inet6Index;
|
||||
struct addrinfo *itr, *last, *iterator = res;
|
||||
struct addrinfo *itr, *last = NULL, *iterator = res;
|
||||
while (iterator != NULL) {
|
||||
int skip = 0;
|
||||
itr = resNew;
|
||||
@ -393,10 +392,7 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
|
||||
|
||||
#ifdef AF_INET6
|
||||
char host[NI_MAXHOST+1];
|
||||
jfieldID fid;
|
||||
int error = 0;
|
||||
jint family;
|
||||
struct sockaddr *him ;
|
||||
int len = 0;
|
||||
jbyte caddr[16];
|
||||
|
||||
@ -459,11 +455,10 @@ static jboolean
|
||||
ping6(JNIEnv *env, jint fd, struct sockaddr_in6* him, jint timeout,
|
||||
struct sockaddr_in6* netif, jint ttl) {
|
||||
jint size;
|
||||
jint n, len, hlen1, icmplen;
|
||||
jint n, len;
|
||||
char sendbuf[1500];
|
||||
unsigned char recvbuf[1500];
|
||||
struct icmp6_hdr *icmp6;
|
||||
struct ip6_hdr *ip6;
|
||||
struct sockaddr_in6 sa_recv;
|
||||
jbyte *caddr, *recv_caddr;
|
||||
jchar pid;
|
||||
@ -561,7 +556,6 @@ Java_java_net_Inet6AddressImpl_isReachable0(JNIEnv *env, jobject this,
|
||||
jbyteArray ifArray,
|
||||
jint ttl, jint if_scope) {
|
||||
#ifdef AF_INET6
|
||||
jint addr;
|
||||
jbyte caddr[16];
|
||||
jint fd, sz;
|
||||
struct sockaddr_in6 him6;
|
||||
|
@ -398,7 +398,6 @@ jobject createNetworkInterface(JNIEnv *env, netif *ifs)
|
||||
jobjectArray addrArr;
|
||||
jobjectArray bindArr;
|
||||
jobjectArray childArr;
|
||||
netaddr *addrs;
|
||||
jint addr_index, addr_count, bind_index;
|
||||
jint child_count, child_index;
|
||||
netaddr *addrP;
|
||||
@ -815,8 +814,6 @@ static netif *enumIPv6Interfaces(JNIEnv *env, netif *ifs) {
|
||||
addr6p[0], addr6p[1], addr6p[2], addr6p[3],
|
||||
addr6p[4], addr6p[5], addr6p[6], addr6p[7],
|
||||
&if_idx, &plen, &scope, &dad_status, devname) != EOF) {
|
||||
struct netif *ifs_ptr = NULL;
|
||||
struct netif *last_ptr = NULL;
|
||||
struct sockaddr_in6 addr;
|
||||
|
||||
sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s",
|
||||
@ -852,7 +849,6 @@ static netif *enumIPv6Interfaces(JNIEnv *env, netif *ifs) {
|
||||
*/
|
||||
void freeif(netif *ifs) {
|
||||
netif *currif = ifs;
|
||||
netif *child = NULL;
|
||||
|
||||
while (currif != NULL) {
|
||||
netaddr *addrP = currif->addr;
|
||||
@ -1158,10 +1154,9 @@ static short getFlags(JNIEnv *env, jstring name) {
|
||||
*/
|
||||
static struct sockaddr *getBroadcast(JNIEnv *env, const char *ifname) {
|
||||
int sock;
|
||||
unsigned int mask;
|
||||
struct sockaddr *ret = NULL;
|
||||
struct ifreq if2;
|
||||
short flag;
|
||||
short flag = 0;
|
||||
|
||||
sock = JVM_Socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (sock < 0) {
|
||||
|
@ -89,7 +89,6 @@ static jfieldID pdsi_ttlID;
|
||||
static jobject createInteger(JNIEnv *env, int i) {
|
||||
static jclass i_class;
|
||||
static jmethodID i_ctrID;
|
||||
static jfieldID i_valueID;
|
||||
|
||||
if (i_class == NULL) {
|
||||
jclass c = (*env)->FindClass(env, "java/lang/Integer");
|
||||
@ -109,7 +108,6 @@ static jobject createInteger(JNIEnv *env, int i) {
|
||||
static jobject createBoolean(JNIEnv *env, int b) {
|
||||
static jclass b_class;
|
||||
static jmethodID b_ctrID;
|
||||
static jfieldID b_valueID;
|
||||
|
||||
if (b_class == NULL) {
|
||||
jclass c = (*env)->FindClass(env, "java/lang/Boolean");
|
||||
@ -148,8 +146,6 @@ Java_java_net_PlainDatagramSocketImpl_init(JNIEnv *env, jclass cls) {
|
||||
#ifdef __linux__
|
||||
struct utsname sysinfo;
|
||||
#endif
|
||||
char *s;
|
||||
|
||||
pdsi_fdID = (*env)->GetFieldID(env, cls, "fd",
|
||||
"Ljava/io/FileDescriptor;");
|
||||
CHECK_NULL(pdsi_fdID);
|
||||
@ -373,7 +369,7 @@ Java_java_net_PlainDatagramSocketImpl_disconnect0(JNIEnv *env, jobject this, jin
|
||||
if (JVM_GetSockName(fd, (struct sockaddr *)&addr, &len) == -1) {
|
||||
return;
|
||||
}
|
||||
localPort = NET_GetPortFromSockaddr(&addr);
|
||||
localPort = NET_GetPortFromSockaddr((struct sockaddr *)&addr);
|
||||
if (localPort == 0) {
|
||||
localPort = (*env)->GetIntField(env, this, pdsi_localPortID);
|
||||
#ifdef AF_INET6
|
||||
@ -416,7 +412,6 @@ Java_java_net_PlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
||||
/* The fdObj'fd */
|
||||
jint fd;
|
||||
|
||||
ssize_t n = -1;
|
||||
SOCKADDR rmtaddr, *rmtaddrP=&rmtaddr;
|
||||
int len;
|
||||
|
||||
@ -633,9 +628,7 @@ Java_java_net_PlainDatagramSocketImpl_peekData(JNIEnv *env, jobject this,
|
||||
jint packetBufferOffset, packetBufferLen;
|
||||
|
||||
int fd;
|
||||
jbyteArray data;
|
||||
|
||||
int datalen;
|
||||
int n;
|
||||
SOCKADDR remote_addr;
|
||||
int len;
|
||||
@ -812,9 +805,7 @@ Java_java_net_PlainDatagramSocketImpl_receive0(JNIEnv *env, jobject this,
|
||||
jint packetBufferOffset, packetBufferLen;
|
||||
|
||||
int fd;
|
||||
jbyteArray data;
|
||||
|
||||
int datalen;
|
||||
int n;
|
||||
SOCKADDR remote_addr;
|
||||
int len;
|
||||
@ -1059,7 +1050,6 @@ Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate(JNIEnv *env,
|
||||
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
||||
int fd;
|
||||
|
||||
int arg = -1;
|
||||
int t = 1;
|
||||
|
||||
if (IS_NULL(fdObj)) {
|
||||
|
@ -136,8 +136,6 @@ static int getFD(JNIEnv *env, jobject this) {
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_net_PlainSocketImpl_initProto(JNIEnv *env, jclass cls) {
|
||||
char *s;
|
||||
|
||||
psi_fdID = (*env)->GetFieldID(env, cls , "fd",
|
||||
"Ljava/io/FileDescriptor;");
|
||||
CHECK_NULL(psi_fdID);
|
||||
@ -183,7 +181,6 @@ Java_java_net_PlainSocketImpl_socketCreate(JNIEnv *env, jobject this,
|
||||
jboolean stream) {
|
||||
jobject fdObj, ssObj;
|
||||
int fd;
|
||||
int arg = -1;
|
||||
|
||||
if (socketExceptionCls == NULL) {
|
||||
jclass c = (*env)->FindClass(env, "java/net/SocketException");
|
||||
@ -290,7 +287,6 @@ Java_java_net_PlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
|
||||
while (1) {
|
||||
#ifndef USE_SELECT
|
||||
{
|
||||
fprintf(stdout,"\nNATIVE: fd = %d] ", fd);
|
||||
struct pollfd pfd;
|
||||
pfd.fd = fd;
|
||||
pfd.events = POLLOUT;
|
||||
@ -673,8 +669,6 @@ Java_java_net_PlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
|
||||
/* accepted fd */
|
||||
jint newfd;
|
||||
|
||||
jthrowable error;
|
||||
|
||||
SOCKADDR him;
|
||||
int len;
|
||||
|
||||
@ -1087,7 +1081,6 @@ Java_java_net_PlainSocketImpl_socketGetOption(JNIEnv *env, jobject this,
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_net_PlainSocketImpl_socketSendUrgentData(JNIEnv *env, jobject this,
|
||||
jint data) {
|
||||
char *buf;
|
||||
/* The fd field */
|
||||
jobject fdObj = (*env)->GetObjectField(env, this, psi_fdID);
|
||||
int n, fd;
|
||||
|
@ -65,7 +65,6 @@ Java_java_net_SocketInputStream_socketRead0(JNIEnv *env, jobject this,
|
||||
char BUF[MAX_BUFFER_LEN];
|
||||
char *bufP;
|
||||
jint fd, nread;
|
||||
jint n;
|
||||
|
||||
if (IS_NULL(fdObj)) {
|
||||
/* should't this be a NullPointerException? -br */
|
||||
|
@ -67,7 +67,6 @@ Java_java_net_SocketOutputStream_socketWrite0(JNIEnv *env, jobject this,
|
||||
char BUF[MAX_BUFFER_LEN];
|
||||
int buflen;
|
||||
int fd;
|
||||
jint n = 0;
|
||||
|
||||
if (IS_NULL(fdObj)) {
|
||||
JNU_ThrowByName(env, "java/net/SocketException", "Socket closed");
|
||||
|
@ -281,7 +281,7 @@ int NET_ReadV(int s, const struct iovec * vector, int count) {
|
||||
|
||||
int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
|
||||
struct sockaddr *from, int *fromlen) {
|
||||
BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, fromlen) );
|
||||
BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf, len, flags, from, (socklen_t)fromlen) );
|
||||
}
|
||||
|
||||
int NET_Send(int s, void *msg, int len, unsigned int flags) {
|
||||
@ -298,7 +298,7 @@ int NET_SendTo(int s, const void *msg, int len, unsigned int
|
||||
}
|
||||
|
||||
int NET_Accept(int s, struct sockaddr *addr, int *addrlen) {
|
||||
BLOCKING_IO_RETURN_INT( s, accept(s, addr, addrlen) );
|
||||
BLOCKING_IO_RETURN_INT( s, accept(s, addr, (socklen_t)addrlen) );
|
||||
}
|
||||
|
||||
int NET_Connect(int s, struct sockaddr *addr, int addrlen) {
|
||||
@ -323,7 +323,7 @@ int NET_Select(int s, fd_set *readfds, fd_set *writefds,
|
||||
* signal other than our wakeup signal.
|
||||
*/
|
||||
int NET_Timeout(int s, long timeout) {
|
||||
long prevtime,newtime;
|
||||
long prevtime = 0, newtime;
|
||||
struct timeval t;
|
||||
fdEntry_t *fdEntry = getFdEntry(s);
|
||||
|
||||
|
@ -229,7 +229,7 @@ jint IPv6_supported()
|
||||
int fd;
|
||||
void *ipv6_fn;
|
||||
SOCKADDR sa;
|
||||
int sa_len = sizeof(sa);
|
||||
socklen_t sa_len = sizeof(sa);
|
||||
|
||||
fd = JVM_Socket(AF_INET6, SOCK_STREAM, 0) ;
|
||||
if (fd < 0) {
|
||||
@ -447,7 +447,6 @@ static void initLoopbackRoutes() {
|
||||
char dest_str[40];
|
||||
struct in6_addr dest_addr;
|
||||
char device[16];
|
||||
jboolean match = JNI_FALSE;
|
||||
|
||||
if (loRoutes != 0) {
|
||||
free (loRoutes);
|
||||
@ -525,7 +524,7 @@ static void initLoopbackRoutes() {
|
||||
{
|
||||
/* now find the scope_id for "lo" */
|
||||
|
||||
char addr6[40], devname[20];
|
||||
char devname[20];
|
||||
char addr6p[8][5];
|
||||
int plen, scope, dad_status, if_idx;
|
||||
|
||||
@ -1019,7 +1018,7 @@ int getDefaultIPv6Interface(struct in6_addr *target_addr) {
|
||||
* index.
|
||||
*/
|
||||
if (match) {
|
||||
char addr6[40], devname[20];
|
||||
char devname[20];
|
||||
char addr6p[8][5];
|
||||
int plen, scope, dad_status, if_idx;
|
||||
|
||||
@ -1086,7 +1085,7 @@ NET_GetSockOpt(int fd, int level, int opt, void *result,
|
||||
}
|
||||
#endif
|
||||
|
||||
rv = getsockopt(fd, level, opt, result, len);
|
||||
rv = getsockopt(fd, level, opt, result, (socklen_t)len);
|
||||
if (rv < 0) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <sys/types.h>
|
||||
#include <process.h>
|
||||
|
||||
#include "java_net_InetAddress.h"
|
||||
#include "java_net_Inet4AddressImpl.h"
|
||||
@ -141,7 +142,6 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||
unsigned int addr[4];
|
||||
|
||||
jobjectArray ret = NULL;
|
||||
jclass byteArrayCls;
|
||||
|
||||
if (!initialized) {
|
||||
ni_iacls = (*env)->FindClass(env, "java/net/InetAddress");
|
||||
@ -315,7 +315,7 @@ ping4(JNIEnv *env, jint fd, struct sockaddr_in* him, jint timeout,
|
||||
seq = ((unsigned short)rand()) >> 1;
|
||||
|
||||
/* icmp_id is a 16 bit data type, therefore down cast the pid */
|
||||
pid = (u_short) getpid();
|
||||
pid = (u_short) _getpid();
|
||||
size = 60*1024;
|
||||
setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (const char *) &size, sizeof(size));
|
||||
/**
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <sys/types.h>
|
||||
#include <process.h>
|
||||
|
||||
#include "java_net_InetAddress.h"
|
||||
#include "java_net_Inet4AddressImpl.h"
|
||||
@ -307,10 +308,7 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
|
||||
jstring ret = NULL;
|
||||
|
||||
char host[NI_MAXHOST+1];
|
||||
jfieldID fid;
|
||||
int error = 0;
|
||||
jint family;
|
||||
struct sockaddr *him ;
|
||||
int len = 0;
|
||||
jbyte caddr[16];
|
||||
|
||||
@ -374,7 +372,7 @@ static jboolean
|
||||
ping6(JNIEnv *env, jint fd, struct SOCKADDR_IN6* him, jint timeout,
|
||||
struct SOCKADDR_IN6* netif, jint ttl) {
|
||||
jint size;
|
||||
jint n, len, hlen1, icmplen, i;
|
||||
jint n, len, i;
|
||||
char sendbuf[1500];
|
||||
char auxbuf[1500];
|
||||
unsigned char recvbuf[1500];
|
||||
@ -392,7 +390,7 @@ ping6(JNIEnv *env, jint fd, struct SOCKADDR_IN6* him, jint timeout,
|
||||
seq = ((unsigned short)rand()) >> 1;
|
||||
|
||||
/* icmp_id is a 16 bit data type, therefore down cast the pid */
|
||||
pid = (unsigned short) getpid();
|
||||
pid = (unsigned short) _getpid();
|
||||
|
||||
size = 60*1024;
|
||||
setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (const char *)&size, sizeof(size));
|
||||
@ -520,7 +518,6 @@ Java_java_net_Inet6AddressImpl_isReachable0(JNIEnv *env, jobject this,
|
||||
jbyteArray ifArray,
|
||||
jint ttl, jint if_scope) {
|
||||
#ifdef AF_INET6
|
||||
jint addr;
|
||||
jbyte caddr[16];
|
||||
jint fd, sz;
|
||||
struct sockaddr_in6 him6;
|
||||
|
@ -75,7 +75,6 @@ extern int enumInterfaces_win9x(JNIEnv *, netif **);
|
||||
extern int enumAddresses_win9x(JNIEnv *, netif *, netaddr **);
|
||||
extern int init_win9x(void);
|
||||
#endif
|
||||
extern int enumInterfaces_win(JNIEnv *env, netif **netifPP);
|
||||
|
||||
|
||||
/* Windows 95/98/ME running */
|
||||
@ -209,7 +208,6 @@ int enumInterfaces_win(JNIEnv *env, netif **netifPP)
|
||||
int count;
|
||||
netif *netifP;
|
||||
DWORD i;
|
||||
wchar_t wName[128];
|
||||
int lo=0, eth=0, tr=0, fddi=0, ppp=0, sl=0, net=0;
|
||||
|
||||
/*
|
||||
|
@ -87,6 +87,8 @@ extern jfieldID ni_ibaddressID; /* InterfaceAddress.address */
|
||||
extern jfieldID ni_ibbroadcastID; /* InterfaceAddress.broadcast */
|
||||
extern jfieldID ni_ibmaskID; /* InterfaceAddress.maskLength */
|
||||
|
||||
int enumInterfaces_win(JNIEnv *env, netif **netifPP);
|
||||
|
||||
/* We have included iphlpapi.h which includes iptypes.h which has the definition
|
||||
* for MAX_ADAPTER_DESCRIPTION_LENGTH (along with the other definitions in this
|
||||
* ifndef block). Therefore if MAX_ADAPTER_DESCRIPTION_LENGTH is defined we can
|
||||
@ -379,6 +381,9 @@ typedef struct {
|
||||
UINT EnableProxy;
|
||||
UINT EnableDns;
|
||||
} FIXED_INFO, *PFIXED_INFO;
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
#endif /*!MAX_ADAPTER_DESCRIPTION_LENGTH*/
|
||||
|
||||
#ifndef IP_INTERFACE_NAME_INFO_DEFINED
|
||||
@ -397,7 +402,6 @@ typedef struct ip_interface_name_info {
|
||||
|
||||
#endif
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
/* from ipifcons.h */
|
||||
|
||||
|
@ -417,8 +417,8 @@ static int getAdapters(JNIEnv *env, adapter **adapterPP)
|
||||
return -1;
|
||||
}
|
||||
curr->index = ++adapterCount;
|
||||
curr->name = strdup("lo");
|
||||
curr->displayName = strdup("TCP Loopback interface");
|
||||
curr->name = _strdup("lo");
|
||||
curr->displayName = _strdup("TCP Loopback interface");
|
||||
curr->next = adapterP;
|
||||
*adapterPP = curr;
|
||||
|
||||
@ -513,12 +513,11 @@ static int getStaticAddresses(JNIEnv *env, char *reg_key, netaddr **netaddrPP)
|
||||
HKEY enumKey, bindingKey;
|
||||
DWORD dwLen;
|
||||
ULONG ulType;
|
||||
TCHAR driver[MAX_STR_LEN];
|
||||
char addresses[MAX_STR_LEN];
|
||||
unsigned long addr; /* IPv4 address */
|
||||
unsigned char byte;
|
||||
netaddr *netaddrP, *curr;
|
||||
int i, addrCount, if_count;
|
||||
int i, addrCount;
|
||||
|
||||
/*
|
||||
* Open the HKEY_LOCAL_MACHINE\Enum\%s\%s\%s key
|
||||
@ -1055,8 +1054,8 @@ int enumInterfaces_win9x(JNIEnv *env, netif **netifPP) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ifs->name = strdup(adapterP->name);
|
||||
ifs->displayName = strdup(adapterP->displayName);
|
||||
ifs->name = _strdup(adapterP->name);
|
||||
ifs->displayName = _strdup(adapterP->displayName);
|
||||
ifs->dwIndex = adapterP->index;
|
||||
ifs->index = adapterP->index;
|
||||
ifs->next = netifP;
|
||||
|
@ -41,6 +41,7 @@
|
||||
*/
|
||||
|
||||
extern int enumAddresses_win(JNIEnv *env, netif *netifP, netaddr **netaddrPP);
|
||||
int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP);
|
||||
|
||||
/* IP helper library routines */
|
||||
int (PASCAL FAR *GetIpAddrTable_fn)();
|
||||
@ -168,11 +169,10 @@ static int ipinflen = 2048;
|
||||
*/
|
||||
int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP)
|
||||
{
|
||||
DWORD ret, numInterfaces;
|
||||
IP_ADAPTER_ADDRESSES *ptr, *ptr1, *adapters=0;
|
||||
DWORD ret;
|
||||
IP_ADAPTER_ADDRESSES *ptr, *adapters=0;
|
||||
ULONG len=ipinflen, count=0;
|
||||
netif *nif=0, *dup_nif, *last=0, *loopif=0;
|
||||
netaddr *addr, *addr1;
|
||||
int tun=0, net=0;
|
||||
|
||||
*netifPP = 0;
|
||||
@ -330,7 +330,7 @@ err:
|
||||
|
||||
static int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP) {
|
||||
LPSOCKADDR sock;
|
||||
int ret, count = 0;
|
||||
int count = 0;
|
||||
netaddr *curr, *start=0, *prev=0;
|
||||
PIP_ADAPTER_UNICAST_ADDRESS uni_addr;
|
||||
PIP_ADAPTER_ANYCAST_ADDRESS any_addr;
|
||||
@ -364,7 +364,7 @@ static int getAddrsFromAdapter(IP_ADAPTER_ADDRESSES *ptr, netaddr **netaddrPP) {
|
||||
sock = uni_addr->Address.lpSockaddr;
|
||||
SOCKETADDRESS_COPY (&curr->addr, sock);
|
||||
if (prefix != NULL) {
|
||||
curr->mask = prefix->PrefixLength;
|
||||
curr->mask = (short)prefix->PrefixLength;
|
||||
if (sock->sa_family == AF_INET) {
|
||||
sock = prefix->Address.lpSockaddr;
|
||||
SOCKETADDRESS_COPY(&curr->brdcast, sock);
|
||||
|
@ -64,7 +64,6 @@ Java_java_net_SocketOutputStream_socketWrite0(JNIEnv *env, jobject this,
|
||||
char BUF[MAX_BUFFER_LEN];
|
||||
int buflen;
|
||||
int fd;
|
||||
jint n;
|
||||
|
||||
if (IS_NULL(fdObj)) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
|
||||
|
@ -651,7 +651,6 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
|
||||
SOCKETADDRESS rmtaddr;
|
||||
SOCKETADDRESS *addrp = &rmtaddr;
|
||||
int addrlen;
|
||||
int x; /* DELETE ME */
|
||||
|
||||
|
||||
if (IS_NULL(packet)) {
|
||||
@ -883,7 +882,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_peek(JNIEnv *env, jobject this,
|
||||
*/
|
||||
if (timeout) {
|
||||
jlong newTime = JVM_CurrentTimeMillis(env, 0);
|
||||
timeout -= (newTime - prevTime);
|
||||
timeout -= (jint)(newTime - prevTime);
|
||||
if (timeout <= 0) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
|
||||
"Receive timed out");
|
||||
@ -929,9 +928,8 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_peekData(JNIEnv *env, jobject thi
|
||||
|
||||
int fd, fd1, fduse, nsockets=0, errorCode;
|
||||
int port;
|
||||
jbyteArray data;
|
||||
|
||||
int checkBoth = 0, datalen;
|
||||
int checkBoth = 0;
|
||||
int n;
|
||||
SOCKETADDRESS remote_addr;
|
||||
jint remote_addrsize=sizeof(remote_addr);
|
||||
@ -1101,7 +1099,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_peekData(JNIEnv *env, jobject thi
|
||||
*/
|
||||
if (timeout) {
|
||||
jlong newTime = JVM_CurrentTimeMillis(env, 0);
|
||||
timeout -= (newTime - prevTime);
|
||||
timeout -= (jint)(newTime - prevTime);
|
||||
if (timeout <= 0) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
|
||||
"Receive timed out");
|
||||
@ -1203,9 +1201,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_receive0(JNIEnv *env, jobject thi
|
||||
* must be called prior to receive() so that fduse can be set.
|
||||
*/
|
||||
int fd, fd1, fduse, errorCode;
|
||||
jbyteArray data;
|
||||
|
||||
int datalen;
|
||||
int n, nsockets=0;
|
||||
SOCKETADDRESS remote_addr;
|
||||
jint remote_addrsize=sizeof(remote_addr);
|
||||
@ -1376,7 +1372,7 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_receive0(JNIEnv *env, jobject thi
|
||||
if (timeout) {
|
||||
int ret;
|
||||
jlong newTime = JVM_CurrentTimeMillis(env, 0);
|
||||
timeout -= (newTime - prevTime);
|
||||
timeout -= (jint)(newTime - prevTime);
|
||||
prevTime = newTime;
|
||||
|
||||
if (timeout <= 0) {
|
||||
|
@ -966,7 +966,8 @@ Java_java_net_TwoStacksPlainSocketImpl_socketSetOption(JNIEnv *env, jobject this
|
||||
|
||||
if (on) {
|
||||
optval.ling.l_onoff = 1;
|
||||
optval.ling.l_linger = (*env)->GetIntField(env, value, fid);
|
||||
optval.ling.l_linger =
|
||||
(unsigned short)(*env)->GetIntField(env, value, fid);
|
||||
} else {
|
||||
optval.ling.l_onoff = 0;
|
||||
optval.ling.l_linger = 0;
|
||||
|
@ -985,7 +985,7 @@ NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout)
|
||||
read_rv = select(fd+1, &rd, &wr, &ex, &t);
|
||||
|
||||
newTime = JVM_CurrentTimeMillis(env, 0);
|
||||
timeout -= (newTime - prevTime);
|
||||
timeout -= (jint)(newTime - prevTime);
|
||||
if (timeout <= 0) {
|
||||
return read_rv > 0 ? 0 : -1;
|
||||
}
|
||||
|
@ -294,6 +294,15 @@ JNIEXPORT int JNICALL NET_SocketClose(int fd);
|
||||
|
||||
JNIEXPORT int JNICALL NET_Timeout(int fd, long timeout);
|
||||
|
||||
int NET_Socket(int domain, int type, int protocol);
|
||||
|
||||
void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
|
||||
const char *defaultDetail);
|
||||
|
||||
void NET_ThrowSocketException(JNIEnv *env, char* msg);
|
||||
|
||||
jboolean NET_addrtransAvailable();
|
||||
|
||||
/*
|
||||
* differs from NET_Timeout() as follows:
|
||||
*
|
||||
|
@ -159,7 +159,6 @@ static int loadStaticConfig9x(char *sl, char *ns) {
|
||||
DWORD dwLen;
|
||||
ULONG ulType;
|
||||
char result[MAX_STR_LEN];
|
||||
int index;
|
||||
int sts = STS_NO_CONFIG;
|
||||
|
||||
ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
@ -275,7 +274,7 @@ static int loadConfig95(char *sl, char *ns) {
|
||||
* the DHCP packet - see RFC 2132).
|
||||
*/
|
||||
if (ret == ERROR_SUCCESS) {
|
||||
int pos = 0;
|
||||
unsigned int pos = 0;
|
||||
|
||||
while (pos < dwLen) {
|
||||
int code, len;
|
||||
|
@ -40,7 +40,6 @@
|
||||
|
||||
#define SECURITY_WIN32
|
||||
#include "sspi.h"
|
||||
#include "issperr.h"
|
||||
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user