[Pkg-telepathy-commits] [libnice] 196/265: Don't mix gsize vs size_t, seems like they're not always the same size
Simon McVittie
smcv at debian.org
Wed May 14 12:05:07 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 bcfe6960993d4d56558ca275f33766df333c3aa3
Author: Olivier Crête <olivier.crete at collabora.com>
Date: Mon Mar 31 17:46:15 2014 -0400
Don't mix gsize vs size_t, seems like they're not always the same size
---
agent/conncheck.c | 35 +++++++++++++++++++++--------------
agent/discovery.c | 8 ++++----
socket/turn.c | 8 ++++----
3 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/agent/conncheck.c b/agent/conncheck.c
index 8577941..3bc29f0 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -587,8 +587,8 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
gchar tmpbuf[INET6_ADDRSTRLEN];
nice_address_to_string (&p->remote->addr, tmpbuf);
nice_debug ("Agent %p : Keepalive STUN-CC REQ to '%s:%u', "
- "socket=%u (c-id:%u), username='%s' (%" G_GSIZE_FORMAT "), "
- "password='%s' (%" G_GSIZE_FORMAT "), priority=%u.", agent,
+ "socket=%u (c-id:%u), username='%s' (%zd), "
+ "password='%s' (%zd), priority=%u.", agent,
tmpbuf, nice_address_get_port (&p->remote->addr),
g_socket_get_fd(((NiceSocket *)p->local->sockptr)->fileno),
component->id, uname, uname_len, password, password_len,
@@ -604,7 +604,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
NULL,
agent_to_ice_compatibility (agent));
- nice_debug ("Agent %p: conncheck created %" G_GSIZE_FORMAT " - %p",
+ nice_debug ("Agent %p: conncheck created %zd - %p",
agent, buf_len, p->keepalive.stun_message.buffer);
if (buf_len > 0) {
@@ -790,9 +790,9 @@ static gboolean priv_turn_allocate_refresh_retransmissions_tick (gpointer pointe
static void priv_turn_allocate_refresh_tick_unlocked (CandidateRefresh *cand)
{
uint8_t *username;
- size_t username_len;
+ gsize username_len;
uint8_t *password;
- size_t password_len;
+ gsize password_len;
size_t buffer_len = 0;
StunUsageTurnCompatibility turn_compat =
agent_to_turn_compatibility (cand->agent);
@@ -823,8 +823,8 @@ static void priv_turn_allocate_refresh_tick_unlocked (CandidateRefresh *cand)
cand->msn_turn_password = password;
}
- nice_debug ("Agent %p : Sending allocate Refresh %" G_GSIZE_FORMAT,
- cand->agent, buffer_len);
+ nice_debug ("Agent %p : Sending allocate Refresh %zd", cand->agent,
+ buffer_len);
if (cand->tick_source != NULL) {
g_source_destroy (cand->tick_source);
@@ -1650,11 +1650,11 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
pair->local->component_id);
uint8_t uname[NICE_STREAM_MAX_UNAME];
- size_t uname_len =
+ gsize uname_len =
priv_create_username (agent, agent_find_stream (agent, pair->stream_id),
pair->component_id, pair->remote, pair->local, uname, sizeof (uname), FALSE);
uint8_t *password = NULL;
- size_t password_len = priv_get_password (agent,
+ gsize password_len = priv_get_password (agent,
agent_find_stream (agent, pair->stream_id), pair->remote, &password);
bool controlling = agent->controlling_mode;
@@ -1697,8 +1697,8 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
pair->foundation,
agent_to_ice_compatibility (agent));
- nice_debug ("Agent %p: conncheck created %" G_GSIZE_FORMAT " - %p",
- agent, buffer_len, pair->stun_message.buffer);
+ nice_debug ("Agent %p: conncheck created %zd - %p", agent, buffer_len,
+ pair->stun_message.buffer);
if (agent->compatibility == NICE_COMPATIBILITY_MSN ||
agent->compatibility == NICE_COMPATIBILITY_OC2007) {
@@ -2684,8 +2684,11 @@ static bool conncheck_stun_validater (StunAgent *agent,
*password_len = strlen (pass);
if (msn_msoc_nice_compatibility) {
- data->password = g_base64_decode (pass, password_len);
+ gsize pass_len;
+
+ data->password = g_base64_decode (pass, &pass_len);
*password = data->password;
+ *password_len = pass_len;
}
}
@@ -2926,6 +2929,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
if ( agent->compatibility == NICE_COMPATIBILITY_MSN
|| agent->compatibility == NICE_COMPATIBILITY_OC2007) {
if (local_candidate && remote_candidate2) {
+ gsize key_len;
+
if (agent->compatibility == NICE_COMPATIBILITY_MSN) {
username = (uint8_t *) stun_message_find (&req,
STUN_ATTRIBUTE_USERNAME, &username_len);
@@ -2935,10 +2940,12 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
memcpy (username, uname, MIN (uname_len, username_len));
req.key = g_base64_decode ((gchar *) remote_candidate2->password,
- &req.key_len);
+ &key_len);
+ req.key_len = key_len;
} else if (agent->compatibility == NICE_COMPATIBILITY_OC2007) {
req.key = g_base64_decode ((gchar *) local_candidate->password,
- &req.key_len);
+ &key_len);
+ req.key_len = key_len;
}
} else {
nice_debug ("Agent %p : received MSN incoming check from unknown remote candidate. "
diff --git a/agent/discovery.c b/agent/discovery.c
index 049aa56..e7f3043 100644
--- a/agent/discovery.c
+++ b/agent/discovery.c
@@ -137,9 +137,9 @@ void refresh_free_item (gpointer data, gpointer user_data)
CandidateRefresh *cand = data;
NiceAgent *agent = cand->agent;
uint8_t *username;
- size_t username_len;
+ gsize username_len;
uint8_t *password;
- size_t password_len;
+ gsize password_len;
size_t buffer_len = 0;
StunUsageTurnCompatibility turn_compat = agent_to_turn_compatibility (agent);
@@ -866,9 +866,9 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
&cand->stun_message, cand->stun_buffer, sizeof(cand->stun_buffer));
} else if (cand->type == NICE_CANDIDATE_TYPE_RELAYED) {
uint8_t *username = (uint8_t *)cand->turn->username;
- size_t username_len = (size_t) strlen (cand->turn->username);
+ gsize username_len = strlen (cand->turn->username);
uint8_t *password = (uint8_t *)cand->turn->password;
- size_t password_len = (size_t) strlen (cand->turn->password);
+ gsize password_len = strlen (cand->turn->password);
StunUsageTurnCompatibility turn_compat =
agent_to_turn_compatibility (agent);
diff --git a/socket/turn.c b/socket/turn.c
index ad01c84..00d576b 100644
--- a/socket/turn.c
+++ b/socket/turn.c
@@ -83,9 +83,9 @@ typedef struct {
NiceSocket *base_socket;
NiceAddress server_addr;
uint8_t *username;
- size_t username_len;
+ gsize username_len;
uint8_t *password;
- size_t password_len;
+ gsize password_len;
NiceTurnSocketCompatibility compatibility;
GQueue *send_requests;
uint8_t ms_realm[STUN_MAX_MS_REALM_LEN + 1];
@@ -209,13 +209,13 @@ nice_turn_socket_new (GMainContext *ctx, NiceAddress *addr,
priv->password = g_base64_decode (password, &priv->password_len);
} else {
priv->username = (uint8_t *)g_strdup (username);
- priv->username_len = (size_t) strlen (username);
+ priv->username_len = (gsize) strlen (username);
if (compatibility == NICE_TURN_SOCKET_COMPATIBILITY_GOOGLE) {
priv->password = NULL;
priv->password_len = 0;
} else {
priv->password = (uint8_t *)g_strdup (password);
- priv->password_len = (size_t) strlen (password);
+ priv->password_len = (gsize) strlen (password);
}
}
priv->server_addr = *server_addr;
--
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