mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Merge pull request #554 from nurupo/master
Fixed missing field initializer warnings
This commit is contained in:
commit
25480852ac
@ -1070,7 +1070,7 @@ static void punch_holes(DHT *dht, IP ip, uint16_t *port_list, uint16_t numports,
|
|||||||
for (i = dht->friends_list[friend_num].punching_index; i != top; i++) {
|
for (i = dht->friends_list[friend_num].punching_index; i != top; i++) {
|
||||||
/* TODO: improve port guessing algorithm */
|
/* TODO: improve port guessing algorithm */
|
||||||
uint16_t port = port_list[(i / 2) % numports] + (i / (2 * numports)) * ((i % 2) ? -1 : 1);
|
uint16_t port = port_list[(i / 2) % numports] + (i / (2 * numports)) * ((i % 2) ? -1 : 1);
|
||||||
IP_Port pinging = {{ip, htons(port)}};
|
IP_Port pinging = {{ip, htons(port), 0}};
|
||||||
send_ping_request(dht->ping, dht->c, pinging, dht->friends_list[friend_num].client_id);
|
send_ping_request(dht->ping, dht->c, pinging, dht->friends_list[friend_num].client_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ int send_LANdiscovery(uint16_t port, Net_Crypto *c)
|
|||||||
uint8_t data[crypto_box_PUBLICKEYBYTES + 1];
|
uint8_t data[crypto_box_PUBLICKEYBYTES + 1];
|
||||||
data[0] = NET_PACKET_LAN_DISCOVERY;
|
data[0] = NET_PACKET_LAN_DISCOVERY;
|
||||||
memcpy(data + 1, c->self_public_key, crypto_box_PUBLICKEYBYTES);
|
memcpy(data + 1, c->self_public_key, crypto_box_PUBLICKEYBYTES);
|
||||||
IP_Port ip_port = {{broadcast_ip(), port}};
|
IP_Port ip_port = {{broadcast_ip(), port, 0}};
|
||||||
return sendpacket(c->lossless_udp->net->sock, ip_port, data, 1 + crypto_box_PUBLICKEYBYTES);
|
return sendpacket(c->lossless_udp->net->sock, ip_port, data, 1 + crypto_box_PUBLICKEYBYTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ int sendpacket(unsigned int sock, IP_Port ip_port, uint8_t *data, uint32_t lengt
|
|||||||
int sendpacket(int sock, IP_Port ip_port, uint8_t *data, uint32_t length)
|
int sendpacket(int sock, IP_Port ip_port, uint8_t *data, uint32_t length)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ADDR addr = {AF_INET, ip_port.port, ip_port.ip};
|
ADDR addr = {AF_INET, ip_port.port, ip_port.ip, {0}};
|
||||||
return sendto(sock, (char *) data, length, 0, (struct sockaddr *)&addr, sizeof(addr));
|
return sendto(sock, (char *) data, length, 0, (struct sockaddr *)&addr, sizeof(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ Networking_Core *new_networking(IP ip, uint16_t port)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Bind our socket to port PORT and address 0.0.0.0 */
|
/* Bind our socket to port PORT and address 0.0.0.0 */
|
||||||
ADDR addr = {AF_INET, htons(port), ip};
|
ADDR addr = {AF_INET, htons(port), ip, {0}};
|
||||||
bind(temp->sock, (struct sockaddr *)&addr, sizeof(addr));
|
bind(temp->sock, (struct sockaddr *)&addr, sizeof(addr));
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user