diff options
author | Coren[m] <Break@Ocean> | 2013-09-27 11:24:33 +0200 |
---|---|---|
committer | Coren[m] <Break@Ocean> | 2013-09-27 11:24:33 +0200 |
commit | 6fe25e4f6f49d1f19bdcc5ce89a587c29757b266 (patch) | |
tree | 07fcf0108fe1813db5d386974eedb9fac5c67d62 /toxcore | |
parent | beff2b6de659a708ed366a9ae925eab8c4ca0ddd (diff) |
Permit -Wshadow as useful warning.
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/Messenger.c | 8 | ||||
-rw-r--r-- | toxcore/net_crypto.c | 14 |
2 files changed, 11 insertions, 11 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index f22a8d57..07c8096f 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -613,11 +613,11 @@ static void check_friend_connectionstatus(Messenger *m, int friendnumber, uint8_ | |||
613 | if (status == NOFRIEND) | 613 | if (status == NOFRIEND) |
614 | return; | 614 | return; |
615 | 615 | ||
616 | const uint8_t was_connected = m->friendlist[friendnumber].status == FRIEND_ONLINE; | 616 | const uint8_t was_online = m->friendlist[friendnumber].status == FRIEND_ONLINE; |
617 | const uint8_t is_connected = status == FRIEND_ONLINE; | 617 | const uint8_t is_online = status == FRIEND_ONLINE; |
618 | 618 | ||
619 | if (is_connected != was_connected) | 619 | if (is_online != was_online) |
620 | m->friend_connectionstatuschange(m, friendnumber, is_connected, m->friend_connectionstatuschange_userdata); | 620 | m->friend_connectionstatuschange(m, friendnumber, is_online, m->friend_connectionstatuschange_userdata); |
621 | } | 621 | } |
622 | 622 | ||
623 | void set_friend_status(Messenger *m, int friendnumber, uint8_t status) | 623 | void set_friend_status(Messenger *m, int friendnumber, uint8_t status) |
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 744bc754..8f3a6be1 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -446,10 +446,10 @@ int realloc_cryptoconnection(Net_Crypto *c, uint32_t num) | |||
446 | int crypto_connect(Net_Crypto *c, uint8_t *public_key, IP_Port ip_port) | 446 | int crypto_connect(Net_Crypto *c, uint8_t *public_key, IP_Port ip_port) |
447 | { | 447 | { |
448 | uint32_t i; | 448 | uint32_t i; |
449 | int id = getcryptconnection_id(c, public_key); | 449 | int id_existing = getcryptconnection_id(c, public_key); |
450 | 450 | ||
451 | if (id != -1) { | 451 | if (id_existing != -1) { |
452 | IP_Port c_ip = connection_ip(c->lossless_udp, c->crypto_connections[id].number); | 452 | IP_Port c_ip = connection_ip(c->lossless_udp, c->crypto_connections[id_existing].number); |
453 | 453 | ||
454 | if (ipport_equal(&c_ip, &ip_port)) | 454 | if (ipport_equal(&c_ip, &ip_port)) |
455 | return -1; | 455 | return -1; |
@@ -464,12 +464,12 @@ int crypto_connect(Net_Crypto *c, uint8_t *public_key, IP_Port ip_port) | |||
464 | 464 | ||
465 | for (i = 0; i <= c->crypto_connections_length; ++i) { | 465 | for (i = 0; i <= c->crypto_connections_length; ++i) { |
466 | if (c->crypto_connections[i].status == CONN_NO_CONNECTION) { | 466 | if (c->crypto_connections[i].status == CONN_NO_CONNECTION) { |
467 | int id = new_connection(c->lossless_udp, ip_port); | 467 | int id_new = new_connection(c->lossless_udp, ip_port); |
468 | 468 | ||
469 | if (id == -1) | 469 | if (id_new == -1) |
470 | return -1; | 470 | return -1; |
471 | 471 | ||
472 | c->crypto_connections[i].number = id; | 472 | c->crypto_connections[i].number = id_new; |
473 | c->crypto_connections[i].status = CONN_HANDSHAKE_SENT; | 473 | c->crypto_connections[i].status = CONN_HANDSHAKE_SENT; |
474 | random_nonce(c->crypto_connections[i].recv_nonce); | 474 | random_nonce(c->crypto_connections[i].recv_nonce); |
475 | memcpy(c->crypto_connections[i].public_key, public_key, crypto_box_PUBLICKEYBYTES); | 475 | memcpy(c->crypto_connections[i].public_key, public_key, crypto_box_PUBLICKEYBYTES); |
@@ -478,7 +478,7 @@ int crypto_connect(Net_Crypto *c, uint8_t *public_key, IP_Port ip_port) | |||
478 | if (c->crypto_connections_length == i) | 478 | if (c->crypto_connections_length == i) |
479 | ++c->crypto_connections_length; | 479 | ++c->crypto_connections_length; |
480 | 480 | ||
481 | if (send_cryptohandshake(c, id, public_key, c->crypto_connections[i].recv_nonce, | 481 | if (send_cryptohandshake(c, id_new, public_key, c->crypto_connections[i].recv_nonce, |
482 | c->crypto_connections[i].sessionpublic_key) == 1) { | 482 | c->crypto_connections[i].sessionpublic_key) == 1) { |
483 | increment_nonce(c->crypto_connections[i].recv_nonce); | 483 | increment_nonce(c->crypto_connections[i].recv_nonce); |
484 | return i; | 484 | return i; |