Remove implicit conversions that lose precision.
This commit is contained in:
parent
ce3671a320
commit
e8cda1fa30
|
@ -196,7 +196,7 @@ open_dns(struct sockaddr_storage *sockaddr, size_t sockaddr_len)
|
|||
setsockopt(fd, IPPROTO_IP, IP_OPT_DONT_FRAG, (const void*) &flag, sizeof(flag));
|
||||
#endif
|
||||
|
||||
if(bind(fd, (struct sockaddr*) sockaddr, sockaddr_len) < 0)
|
||||
if(bind(fd, (struct sockaddr*) sockaddr, (unsigned) sockaddr_len) < 0)
|
||||
err(1, "bind");
|
||||
|
||||
fprintf(stderr, "Opened IPv%d UDP socket\n", sockaddr->ss_family == AF_INET6 ? 6 : 4);
|
||||
|
|
|
@ -148,7 +148,7 @@ main(int argc, char **argv)
|
|||
#endif
|
||||
username = NULL;
|
||||
memset(password, 0, 33);
|
||||
srand(time(NULL));
|
||||
srand((unsigned) time(NULL));
|
||||
foreground = 0;
|
||||
newroot = NULL;
|
||||
context = NULL;
|
||||
|
|
|
@ -123,12 +123,12 @@ static int get_external_ip(struct in_addr *ip)
|
|||
freeaddrinfo(addr);
|
||||
if (res < 0) return 3;
|
||||
|
||||
res = write(sock, getstr, strlen(getstr));
|
||||
res = (int) write(sock, getstr, strlen(getstr));
|
||||
if (res != strlen(getstr)) return 4;
|
||||
|
||||
/* Zero buf before receiving, leave at least one zero at the end */
|
||||
memset(buf, 0, sizeof(buf));
|
||||
res = read(sock, buf, sizeof(buf) - 1);
|
||||
res = (int) read(sock, buf, sizeof(buf) - 1);
|
||||
if (res < 0) return 5;
|
||||
len = res;
|
||||
|
||||
|
@ -607,7 +607,7 @@ tunnel_tun(int tun_fd, int dns_fd)
|
|||
int userid;
|
||||
int read;
|
||||
|
||||
if ((read = read_tun(tun_fd, in, sizeof(in))) <= 0)
|
||||
if ((read = (int) read_tun(tun_fd, in, sizeof(in))) <= 0)
|
||||
return 0;
|
||||
|
||||
/* find target ip in packet, in is padded with 4 bytes TUN header */
|
||||
|
@ -625,12 +625,12 @@ tunnel_tun(int tun_fd, int dns_fd)
|
|||
If the queue is full, drop the packet. TCP will hopefully notice
|
||||
and reduce the packet rate. */
|
||||
if (users[userid].outpacket.len > 0) {
|
||||
save_to_outpacketq(userid, out, outlen);
|
||||
save_to_outpacketq(userid, out, (int) outlen);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
start_new_outpacket(userid, out, outlen);
|
||||
start_new_outpacket(userid, out, (int) outlen);
|
||||
|
||||
/* Start sending immediately if query is waiting */
|
||||
if (users[userid].q_sendrealsoon.id != 0)
|
||||
|
@ -638,10 +638,10 @@ tunnel_tun(int tun_fd, int dns_fd)
|
|||
else if (users[userid].q.id != 0)
|
||||
send_chunk_or_dataless(dns_fd, userid, &users[userid].q);
|
||||
|
||||
return outlen;
|
||||
return (int) outlen;
|
||||
} else { /* CONN_RAW_UDP */
|
||||
send_raw(dns_fd, out, outlen, userid, RAW_HDR_CMD_DATA, &users[userid].q);
|
||||
return outlen;
|
||||
send_raw(dns_fd, out, (int) outlen, userid, RAW_HDR_CMD_DATA, &users[userid].q);
|
||||
return (int) outlen;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue