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,
static PseudoTcpWriteResult
pseudo_tcp_socket_write_packet (PseudoTcpSocket *sock,
pseudo_tcp_socket_write_packet (PseudoTcpSocket *socket,
const gchar *buffer, guint32 len, gpointer user_data)
{
TcpUserData *data = (TcpUserData *)user_data;
......@@ -1870,13 +1870,13 @@ nice_agent_gather_candidates (
#ifdef HAVE_GUPNP
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_address_get_port (&host_candidate->base_addr));
nice_address_get_port (base_addr));
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);
agent->upnp_mapping = g_slist_prepend (agent->upnp_mapping, addr);
agent->upnp_mapping = g_slist_prepend (agent->upnp_mapping, base_addr);
}
#endif
......
......@@ -155,7 +155,7 @@ main(int argc, char *argv[])
}
static void
cb_candidate_gathering_done(NiceAgent *agent, guint stream_id,
cb_candidate_gathering_done(NiceAgent *agent, guint _stream_id,
gpointer data)
{
......@@ -164,7 +164,7 @@ cb_candidate_gathering_done(NiceAgent *agent, guint stream_id,
// Candidate gathering is done. Send our local candidates on stdout
printf("Copy this line to remote client:\n");
printf("\n ");
print_local_data(agent, stream_id, 1);
print_local_data(agent, _stream_id, 1);
printf("\n");
// Listen on stdin for the remote candidate list
......@@ -206,19 +206,19 @@ stdin_remote_info_cb (GIOChannel *source, GIOCondition cond,
}
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,
gpointer data)
{
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) {
NiceCandidate *local, *remote;
// 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)) {
gchar ipaddr[INET6_ADDRSTRLEN];
......@@ -262,7 +262,7 @@ stdin_send_data_cb (GIOChannel *source, GIOCondition cond,
}
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,
gchar *rfoundation, gpointer data)
{
......@@ -270,7 +270,7 @@ cb_new_selected_pair(NiceAgent *agent, guint stream_id,
}
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)
{
if (len == 1 && buf[0] == '\0')
......@@ -280,7 +280,7 @@ cb_nice_recv(NiceAgent *agent, guint stream_id, guint component_id,
}
static NiceCandidate *
parse_candidate(char *scand, guint stream_id)
parse_candidate(char *scand, guint _stream_id)
{
NiceCandidate *cand = NULL;
NiceCandidateType ntype;
......@@ -303,7 +303,7 @@ parse_candidate(char *scand, guint stream_id)
cand = nice_candidate_new(ntype);
cand->component_id = 1;
cand->stream_id = stream_id;
cand->stream_id = _stream_id;
cand->transport = NICE_CANDIDATE_TRANSPORT_UDP;
strncpy(cand->foundation, tokens[0], NICE_CANDIDATE_MAX_FOUNDATION);
cand->priority = atoi (tokens[1]);
......@@ -325,7 +325,7 @@ parse_candidate(char *scand, guint stream_id)
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;
gchar *local_ufrag = NULL;
......@@ -333,11 +333,11 @@ print_local_data (NiceAgent *agent, guint stream_id, guint component_id)
gchar ipaddr[INET6_ADDRSTRLEN];
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))
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)
goto end;
......@@ -372,7 +372,7 @@ print_local_data (NiceAgent *agent, guint stream_id, guint component_id)
static int
parse_remote_data(NiceAgent *agent, guint stream_id,
parse_remote_data(NiceAgent *agent, guint _stream_id,
guint component_id, char *line)
{
GSList *remote_candidates = NULL;
......@@ -394,7 +394,7 @@ parse_remote_data(NiceAgent *agent, guint stream_id,
passwd = line_argv[i];
} else {
// 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) {
g_message("failed to parse candidate: %s", line_argv[i]);
......@@ -408,13 +408,13 @@ parse_remote_data(NiceAgent *agent, guint stream_id,
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");
goto end;
}
// 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) {
g_message("failed to set remote candidates");
goto end;
......
......@@ -317,17 +317,17 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
break;
case HTTP_STATE_CONNECTED:
{
guint read = priv->recv_len;
guint recv_len = priv->recv_len;
struct to_be_sent *tbs = NULL;
if (read > len)
read = len;
if (recv_len > len)
recv_len = len;
memcpy (buf, priv->recv_buf, read);
memcpy (buf, priv->recv_buf, recv_len);
/* consume the data we returned */
priv->recv_len -= read;
memmove (priv->recv_buf, priv->recv_buf + read, priv->recv_len);
priv->recv_len -= 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);
/* Send the pending data */
......@@ -338,7 +338,7 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
g_slice_free (struct to_be_sent, tbs);
}
return read;
return recv_len;
}
break;
default:
......
......@@ -160,7 +160,7 @@ socket_close (NiceSocket *sock)
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;
......@@ -170,7 +170,7 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
switch (priv->state) {
case SOCKS_STATE_CONNECTED:
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;
case SOCKS_STATE_INIT:
{
......
......@@ -146,9 +146,9 @@ priv_nice_address_hash (gconstpointer data)
}
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;
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,
TurnPriv *priv = (TurnPriv *) sock->priv;
StunValidationStatus valid;
StunMessage msg;
struct sockaddr_storage sa;
socklen_t from_len = sizeof (sa);
GList *i = priv->channels;
GList *l;
ChannelBinding *binding = NULL;
if (nice_address_equal (&priv->server_addr, recv_from)) {
......@@ -1035,6 +1033,8 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
stun_message_get_method (&msg) == STUN_IND_DATA) {
uint16_t data_len;
uint8_t *data;
struct sockaddr_storage sa;
socklen_t from_len = sizeof (sa);
if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) {
......@@ -1074,8 +1074,8 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
}
recv:
for (i = priv->channels; i; i = i->next) {
ChannelBinding *b = i->data;
for (l = priv->channels; l; l = l->next) {
ChannelBinding *b = l->data;
if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 ||
priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) {
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