Commit 332c9c5b authored by Philip Withnall's avatar Philip Withnall Committed by Olivier Crête

Fix variable shadowing

parent 4b11c683
...@@ -1097,7 +1097,7 @@ pseudo_tcp_socket_closed (PseudoTcpSocket *sock, guint32 err, ...@@ -1097,7 +1097,7 @@ pseudo_tcp_socket_closed (PseudoTcpSocket *sock, guint32 err,
static PseudoTcpWriteResult static PseudoTcpWriteResult
pseudo_tcp_socket_write_packet (PseudoTcpSocket *sock, pseudo_tcp_socket_write_packet (PseudoTcpSocket *socket,
const gchar *buffer, guint32 len, gpointer user_data) const gchar *buffer, guint32 len, gpointer user_data)
{ {
TcpUserData *data = (TcpUserData *)user_data; TcpUserData *data = (TcpUserData *)user_data;
...@@ -1870,13 +1870,13 @@ nice_agent_gather_candidates ( ...@@ -1870,13 +1870,13 @@ nice_agent_gather_candidates (
#ifdef HAVE_GUPNP #ifdef HAVE_GUPNP
if (agent->upnp_enabled) { if (agent->upnp_enabled) {
NiceAddress *addr = nice_address_dup (&host_candidate->base_addr); NiceAddress *base_addr = nice_address_dup (&host_candidate->base_addr);
nice_debug ("Agent %p: Adding UPnP port %s:%d", agent, local_ip, nice_debug ("Agent %p: Adding UPnP port %s:%d", agent, local_ip,
nice_address_get_port (&host_candidate->base_addr)); nice_address_get_port (base_addr));
gupnp_simple_igd_add_port (GUPNP_SIMPLE_IGD (agent->upnp), "UDP", gupnp_simple_igd_add_port (GUPNP_SIMPLE_IGD (agent->upnp), "UDP",
0, local_ip, nice_address_get_port (&host_candidate->base_addr), 0, local_ip, nice_address_get_port (base_addr),
0, PACKAGE_STRING); 0, PACKAGE_STRING);
agent->upnp_mapping = g_slist_prepend (agent->upnp_mapping, addr); agent->upnp_mapping = g_slist_prepend (agent->upnp_mapping, base_addr);
} }
#endif #endif
......
...@@ -155,7 +155,7 @@ main(int argc, char *argv[]) ...@@ -155,7 +155,7 @@ main(int argc, char *argv[])
} }
static void static void
cb_candidate_gathering_done(NiceAgent *agent, guint stream_id, cb_candidate_gathering_done(NiceAgent *agent, guint _stream_id,
gpointer data) gpointer data)
{ {
...@@ -164,7 +164,7 @@ cb_candidate_gathering_done(NiceAgent *agent, guint stream_id, ...@@ -164,7 +164,7 @@ cb_candidate_gathering_done(NiceAgent *agent, guint stream_id,
// Candidate gathering is done. Send our local candidates on stdout // Candidate gathering is done. Send our local candidates on stdout
printf("Copy this line to remote client:\n"); printf("Copy this line to remote client:\n");
printf("\n "); printf("\n ");
print_local_data(agent, stream_id, 1); print_local_data(agent, _stream_id, 1);
printf("\n"); printf("\n");
// Listen on stdin for the remote candidate list // Listen on stdin for the remote candidate list
...@@ -206,19 +206,19 @@ stdin_remote_info_cb (GIOChannel *source, GIOCondition cond, ...@@ -206,19 +206,19 @@ stdin_remote_info_cb (GIOChannel *source, GIOCondition cond,
} }
static void static void
cb_component_state_changed(NiceAgent *agent, guint stream_id, cb_component_state_changed(NiceAgent *agent, guint _stream_id,
guint component_id, guint state, guint component_id, guint state,
gpointer data) gpointer data)
{ {
g_debug("SIGNAL: state changed %d %d %s[%d]\n", g_debug("SIGNAL: state changed %d %d %s[%d]\n",
stream_id, component_id, state_name[state], state); _stream_id, component_id, state_name[state], state);
if (state == NICE_COMPONENT_STATE_READY) { if (state == NICE_COMPONENT_STATE_READY) {
NiceCandidate *local, *remote; NiceCandidate *local, *remote;
// Get current selected candidate pair and print IP address used // Get current selected candidate pair and print IP address used
if (nice_agent_get_selected_pair (agent, stream_id, component_id, if (nice_agent_get_selected_pair (agent, _stream_id, component_id,
&local, &remote)) { &local, &remote)) {
gchar ipaddr[INET6_ADDRSTRLEN]; gchar ipaddr[INET6_ADDRSTRLEN];
...@@ -262,7 +262,7 @@ stdin_send_data_cb (GIOChannel *source, GIOCondition cond, ...@@ -262,7 +262,7 @@ stdin_send_data_cb (GIOChannel *source, GIOCondition cond,
} }
static void static void
cb_new_selected_pair(NiceAgent *agent, guint stream_id, cb_new_selected_pair(NiceAgent *agent, guint _stream_id,
guint component_id, gchar *lfoundation, guint component_id, gchar *lfoundation,
gchar *rfoundation, gpointer data) gchar *rfoundation, gpointer data)
{ {
...@@ -270,7 +270,7 @@ cb_new_selected_pair(NiceAgent *agent, guint stream_id, ...@@ -270,7 +270,7 @@ cb_new_selected_pair(NiceAgent *agent, guint stream_id,
} }
static void static void
cb_nice_recv(NiceAgent *agent, guint stream_id, guint component_id, cb_nice_recv(NiceAgent *agent, guint _stream_id, guint component_id,
guint len, gchar *buf, gpointer data) guint len, gchar *buf, gpointer data)
{ {
if (len == 1 && buf[0] == '\0') if (len == 1 && buf[0] == '\0')
...@@ -280,7 +280,7 @@ cb_nice_recv(NiceAgent *agent, guint stream_id, guint component_id, ...@@ -280,7 +280,7 @@ cb_nice_recv(NiceAgent *agent, guint stream_id, guint component_id,
} }
static NiceCandidate * static NiceCandidate *
parse_candidate(char *scand, guint stream_id) parse_candidate(char *scand, guint _stream_id)
{ {
NiceCandidate *cand = NULL; NiceCandidate *cand = NULL;
NiceCandidateType ntype; NiceCandidateType ntype;
...@@ -303,7 +303,7 @@ parse_candidate(char *scand, guint stream_id) ...@@ -303,7 +303,7 @@ parse_candidate(char *scand, guint stream_id)
cand = nice_candidate_new(ntype); cand = nice_candidate_new(ntype);
cand->component_id = 1; cand->component_id = 1;
cand->stream_id = stream_id; cand->stream_id = _stream_id;
cand->transport = NICE_CANDIDATE_TRANSPORT_UDP; cand->transport = NICE_CANDIDATE_TRANSPORT_UDP;
strncpy(cand->foundation, tokens[0], NICE_CANDIDATE_MAX_FOUNDATION); strncpy(cand->foundation, tokens[0], NICE_CANDIDATE_MAX_FOUNDATION);
cand->priority = atoi (tokens[1]); cand->priority = atoi (tokens[1]);
...@@ -325,7 +325,7 @@ parse_candidate(char *scand, guint stream_id) ...@@ -325,7 +325,7 @@ parse_candidate(char *scand, guint stream_id)
static int static int
print_local_data (NiceAgent *agent, guint stream_id, guint component_id) print_local_data (NiceAgent *agent, guint _stream_id, guint component_id)
{ {
int result = EXIT_FAILURE; int result = EXIT_FAILURE;
gchar *local_ufrag = NULL; gchar *local_ufrag = NULL;
...@@ -333,11 +333,11 @@ print_local_data (NiceAgent *agent, guint stream_id, guint component_id) ...@@ -333,11 +333,11 @@ print_local_data (NiceAgent *agent, guint stream_id, guint component_id)
gchar ipaddr[INET6_ADDRSTRLEN]; gchar ipaddr[INET6_ADDRSTRLEN];
GSList *cands = NULL, *item; GSList *cands = NULL, *item;
if (!nice_agent_get_local_credentials(agent, stream_id, if (!nice_agent_get_local_credentials(agent, _stream_id,
&local_ufrag, &local_password)) &local_ufrag, &local_password))
goto end; goto end;
cands = nice_agent_get_local_candidates(agent, stream_id, component_id); cands = nice_agent_get_local_candidates(agent, _stream_id, component_id);
if (cands == NULL) if (cands == NULL)
goto end; goto end;
...@@ -372,7 +372,7 @@ print_local_data (NiceAgent *agent, guint stream_id, guint component_id) ...@@ -372,7 +372,7 @@ print_local_data (NiceAgent *agent, guint stream_id, guint component_id)
static int static int
parse_remote_data(NiceAgent *agent, guint stream_id, parse_remote_data(NiceAgent *agent, guint _stream_id,
guint component_id, char *line) guint component_id, char *line)
{ {
GSList *remote_candidates = NULL; GSList *remote_candidates = NULL;
...@@ -394,7 +394,7 @@ parse_remote_data(NiceAgent *agent, guint stream_id, ...@@ -394,7 +394,7 @@ parse_remote_data(NiceAgent *agent, guint stream_id,
passwd = line_argv[i]; passwd = line_argv[i];
} else { } else {
// Remaining args are serialized canidates (at least one is required) // Remaining args are serialized canidates (at least one is required)
NiceCandidate *c = parse_candidate(line_argv[i], stream_id); NiceCandidate *c = parse_candidate(line_argv[i], _stream_id);
if (c == NULL) { if (c == NULL) {
g_message("failed to parse candidate: %s", line_argv[i]); g_message("failed to parse candidate: %s", line_argv[i]);
...@@ -408,13 +408,13 @@ parse_remote_data(NiceAgent *agent, guint stream_id, ...@@ -408,13 +408,13 @@ parse_remote_data(NiceAgent *agent, guint stream_id,
goto end; goto end;
} }
if (!nice_agent_set_remote_credentials(agent, stream_id, ufrag, passwd)) { if (!nice_agent_set_remote_credentials(agent, _stream_id, ufrag, passwd)) {
g_message("failed to set remote credentials"); g_message("failed to set remote credentials");
goto end; goto end;
} }
// Note: this will trigger the start of negotiation. // Note: this will trigger the start of negotiation.
if (nice_agent_set_remote_candidates(agent, stream_id, component_id, if (nice_agent_set_remote_candidates(agent, _stream_id, component_id,
remote_candidates) < 1) { remote_candidates) < 1) {
g_message("failed to set remote candidates"); g_message("failed to set remote candidates");
goto end; goto end;
......
...@@ -317,17 +317,17 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) ...@@ -317,17 +317,17 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
break; break;
case HTTP_STATE_CONNECTED: case HTTP_STATE_CONNECTED:
{ {
guint read = priv->recv_len; guint recv_len = priv->recv_len;
struct to_be_sent *tbs = NULL; struct to_be_sent *tbs = NULL;
if (read > len) if (recv_len > len)
read = len; recv_len = len;
memcpy (buf, priv->recv_buf, read); memcpy (buf, priv->recv_buf, recv_len);
/* consume the data we returned */ /* consume the data we returned */
priv->recv_len -= read; priv->recv_len -= recv_len;
memmove (priv->recv_buf, priv->recv_buf + read, priv->recv_len); memmove (priv->recv_buf, priv->recv_buf + recv_len, priv->recv_len);
priv->recv_buf = g_realloc (priv->recv_buf, priv->recv_len); priv->recv_buf = g_realloc (priv->recv_buf, priv->recv_len);
/* Send the pending data */ /* Send the pending data */
...@@ -338,7 +338,7 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) ...@@ -338,7 +338,7 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
g_slice_free (struct to_be_sent, tbs); g_slice_free (struct to_be_sent, tbs);
} }
return read; return recv_len;
} }
break; break;
default: default:
......
...@@ -160,7 +160,7 @@ socket_close (NiceSocket *sock) ...@@ -160,7 +160,7 @@ socket_close (NiceSocket *sock)
static gint static gint
socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) socket_recv (NiceSocket *sock, NiceAddress *from, guint buf_len, gchar *buf)
{ {
Socks5Priv *priv = sock->priv; Socks5Priv *priv = sock->priv;
...@@ -170,7 +170,7 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf) ...@@ -170,7 +170,7 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
switch (priv->state) { switch (priv->state) {
case SOCKS_STATE_CONNECTED: case SOCKS_STATE_CONNECTED:
if (priv->base_socket) if (priv->base_socket)
return nice_socket_recv (priv->base_socket, NULL, len, buf); return nice_socket_recv (priv->base_socket, NULL, buf_len, buf);
break; break;
case SOCKS_STATE_INIT: case SOCKS_STATE_INIT:
{ {
......
...@@ -146,9 +146,9 @@ priv_nice_address_hash (gconstpointer data) ...@@ -146,9 +146,9 @@ priv_nice_address_hash (gconstpointer data)
} }
static void static void
priv_send_data_queue_destroy (gpointer data) priv_send_data_queue_destroy (gpointer user_data)
{ {
GQueue *send_queue = (GQueue *) data; GQueue *send_queue = (GQueue *) user_data;
GList *i; GList *i;
for (i = g_queue_peek_head_link (send_queue); i; i = i->next) { for (i = g_queue_peek_head_link (send_queue); i; i = i->next) {
...@@ -762,9 +762,7 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock, ...@@ -762,9 +762,7 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
TurnPriv *priv = (TurnPriv *) sock->priv; TurnPriv *priv = (TurnPriv *) sock->priv;
StunValidationStatus valid; StunValidationStatus valid;
StunMessage msg; StunMessage msg;
struct sockaddr_storage sa; GList *l;
socklen_t from_len = sizeof (sa);
GList *i = priv->channels;
ChannelBinding *binding = NULL; ChannelBinding *binding = NULL;
if (nice_address_equal (&priv->server_addr, recv_from)) { if (nice_address_equal (&priv->server_addr, recv_from)) {
...@@ -1035,6 +1033,8 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock, ...@@ -1035,6 +1033,8 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
stun_message_get_method (&msg) == STUN_IND_DATA) { stun_message_get_method (&msg) == STUN_IND_DATA) {
uint16_t data_len; uint16_t data_len;
uint8_t *data; uint8_t *data;
struct sockaddr_storage sa;
socklen_t from_len = sizeof (sa);
if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 || if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) { priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) {
...@@ -1074,8 +1074,8 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock, ...@@ -1074,8 +1074,8 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
} }
recv: recv:
for (i = priv->channels; i; i = i->next) { for (l = priv->channels; l; l = l->next) {
ChannelBinding *b = i->data; ChannelBinding *b = l->data;
if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 || if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) { priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) {
if (b->channel == ntohs(((uint16_t *)recv_buf)[0])) { if (b->channel == ntohs(((uint16_t *)recv_buf)[0])) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment