[Pkg-telepathy-commits] [libnice] 20/265: Fix variable shadowing

Simon McVittie smcv at debian.org
Wed May 14 12:04:48 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository libnice.

commit 332c9c5b329426f2d255e9eaf856aa79fe813a77
Author: Philip Withnall <philip.withnall at collabora.co.uk>
Date:   Tue Dec 17 09:21:24 2013 +0000

    Fix variable shadowing
---
 agent/agent.c             | 10 +++++-----
 examples/simple-example.c | 32 ++++++++++++++++----------------
 socket/http.c             | 14 +++++++-------
 socket/socks5.c           |  4 ++--
 socket/turn.c             | 14 +++++++-------
 5 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/agent/agent.c b/agent/agent.c
index 364dfac..e09855b 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -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
 
diff --git a/examples/simple-example.c b/examples/simple-example.c
index f8b2688..e02654d 100644
--- a/examples/simple-example.c
+++ b/examples/simple-example.c
@@ -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;
diff --git a/socket/http.c b/socket/http.c
index 90b11b2..eaea4b6 100644
--- a/socket/http.c
+++ b/socket/http.c
@@ -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:
diff --git a/socket/socks5.c b/socket/socks5.c
index 9e9b258..d6083a2 100644
--- a/socket/socks5.c
+++ b/socket/socks5.c
@@ -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:
       {
diff --git a/socket/turn.c b/socket/turn.c
index 5b91b35..41de521 100644
--- a/socket/turn.c
+++ b/socket/turn.c
@@ -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])) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/libnice.git



More information about the Pkg-telepathy-commits mailing list