1
0
mirror of https://code.semirocket.science/wrapsix synced 2024-11-22 09:22:28 +02:00

Fixed comparing of signed and unsigned numbers

This commit is contained in:
Michal Zima 2012-04-27 14:44:09 +02:00
parent 7012d02ab4
commit d7e506abed

View File

@ -116,7 +116,7 @@ int transmission_quit(void)
*/ */
int transmit_raw(unsigned char *data, unsigned int length) int transmit_raw(unsigned char *data, unsigned int length)
{ {
if (sendto(sock, data, length, 0, (struct sockaddr *) &socket_address, sizeof(struct sockaddr_ll)) != length) { if (sendto(sock, data, length, 0, (struct sockaddr *) &socket_address, sizeof(struct sockaddr_ll)) != (int) length) {
fprintf(stderr, "[Error] Couldn't send a RAW packet.\n"); fprintf(stderr, "[Error] Couldn't send a RAW packet.\n");
perror("sendto()"); perror("sendto()");
return 1; return 1;
@ -140,7 +140,7 @@ int transmit_ipv4(struct s_ipv4_addr *ip, unsigned char *data, unsigned int leng
/* set the destination IPv4 address */ /* set the destination IPv4 address */
memcpy(&socket_address_ipv4.sin_addr.s_addr, ip, sizeof(struct s_ipv4_addr)); memcpy(&socket_address_ipv4.sin_addr.s_addr, ip, sizeof(struct s_ipv4_addr));
if (sendto(sock_ipv4, data, length, 0, (struct sockaddr *) &socket_address_ipv4, sizeof(struct sockaddr)) != length) { if (sendto(sock_ipv4, data, length, 0, (struct sockaddr *) &socket_address_ipv4, sizeof(struct sockaddr)) != (int) length) {
fprintf(stderr, "[Error] Couldn't send an IPv4 packet.\n"); fprintf(stderr, "[Error] Couldn't send an IPv4 packet.\n");
perror("sendto()"); perror("sendto()");
return 1; return 1;