Commit 23c34a87 authored by Philip Withnall's avatar Philip Withnall Committed by Olivier Crête

agent: Use guint8* as the type for internal buffers

…rather than gchar*. This differentiates binary buffers from strings a
little better, although the two types are functionally equivalent.

Also use gsize for buffer sizes, rather than guint.
parent 6fe29601
...@@ -1037,8 +1037,8 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data) ...@@ -1037,8 +1037,8 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data)
NiceAgent *agent = data->agent; NiceAgent *agent = data->agent;
Component *component = data->component; Component *component = data->component;
Stream *stream = data->stream; Stream *stream = data->stream;
gchar buf[MAX_BUFFER_SIZE]; guint8 buf[MAX_BUFFER_SIZE];
gint len; gssize len;
nice_debug ("Agent %p: s%d:%d pseudo Tcp socket readable", agent, nice_debug ("Agent %p: s%d:%d pseudo Tcp socket readable", agent,
stream->id, component->id); stream->id, component->id);
...@@ -1050,7 +1050,7 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data) ...@@ -1050,7 +1050,7 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data)
do { do {
if (component->io_callback != NULL) if (component->io_callback != NULL)
len = pseudo_tcp_socket_recv (sock, buf, sizeof(buf)); len = pseudo_tcp_socket_recv (sock, (gchar *) buf, sizeof(buf));
else else
len = 0; len = 0;
...@@ -1058,8 +1058,7 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data) ...@@ -1058,8 +1058,7 @@ pseudo_tcp_socket_readable (PseudoTcpSocket *sock, gpointer user_data)
gint sid = stream->id; gint sid = stream->id;
gint cid = component->id; gint cid = component->id;
component_emit_io_callback (component, agent, sid, cid, component_emit_io_callback (component, agent, sid, cid, buf, len);
(guint8 *) buf, len);
if (sock == NULL) { if (sock == NULL) {
nice_debug ("PseudoTCP socket got destroyed in readable callback!"); nice_debug ("PseudoTCP socket got destroyed in readable callback!");
break; break;
...@@ -2327,14 +2326,14 @@ _nice_agent_recv ( ...@@ -2327,14 +2326,14 @@ _nice_agent_recv (
Stream *stream, Stream *stream,
Component *component, Component *component,
NiceSocket *socket, NiceSocket *socket,
guint buf_len, gsize buf_len,
gchar *buf) guint8 *buf)
{ {
NiceAddress from; NiceAddress from;
gint len; gssize len;
GList *item; GList *item;
len = nice_socket_recv (socket, &from, buf_len, buf); len = nice_socket_recv (socket, &from, buf_len, (gchar *) buf);
if (len == 0) { if (len == 0) {
return 0; return 0;
...@@ -2355,7 +2354,7 @@ _nice_agent_recv ( ...@@ -2355,7 +2354,7 @@ _nice_agent_recv (
#endif #endif
if ((guint)len > buf_len) if ((gsize) len > buf_len)
{ {
/* buffer is not big enough to accept this packet */ /* buffer is not big enough to accept this packet */
/* XXX: test this case */ /* XXX: test this case */
...@@ -2376,7 +2375,7 @@ _nice_agent_recv ( ...@@ -2376,7 +2375,7 @@ _nice_agent_recv (
cand->stream_id == stream->id && cand->stream_id == stream->id &&
cand->component_id == component->id) { cand->component_id == component->id) {
len = nice_turn_socket_parse_recv (cand->sockptr, &socket, len = nice_turn_socket_parse_recv (cand->sockptr, &socket,
&from, len, buf, &from, buf, len); &from, len, (gchar *) buf, &from, (gchar *) buf, len);
} }
} }
break; break;
...@@ -2393,7 +2392,7 @@ _nice_agent_recv ( ...@@ -2393,7 +2392,7 @@ _nice_agent_recv (
if (conn_check_handle_inbound_stun (agent, stream, component, socket, if (conn_check_handle_inbound_stun (agent, stream, component, socket,
&from, buf, len)) &from, (gchar *) buf, len))
/* handled STUN message*/ /* handled STUN message*/
return 0; return 0;
...@@ -2402,7 +2401,7 @@ handle_tcp: ...@@ -2402,7 +2401,7 @@ handle_tcp:
if (len > 0 && component->tcp) { if (len > 0 && component->tcp) {
/* Received data on a reliable connection. */ /* Received data on a reliable connection. */
g_object_add_weak_pointer (G_OBJECT (agent), (gpointer *) &agent); g_object_add_weak_pointer (G_OBJECT (agent), (gpointer *) &agent);
pseudo_tcp_socket_notify_packet (component->tcp, buf, len); pseudo_tcp_socket_notify_packet (component->tcp, (gchar *) buf, len);
if (agent) { if (agent) {
adjust_tcp_clock (agent, stream, component); adjust_tcp_clock (agent, stream, component);
...@@ -2676,7 +2675,7 @@ nice_agent_g_source_cb ( ...@@ -2676,7 +2675,7 @@ nice_agent_g_source_cb (
NiceAgent *agent = ctx->agent; NiceAgent *agent = ctx->agent;
Stream *stream = ctx->stream; Stream *stream = ctx->stream;
Component *component = ctx->component; Component *component = ctx->component;
gchar buf[MAX_BUFFER_SIZE]; guint8 buf[MAX_BUFFER_SIZE];
gssize len; gssize len;
agent_lock (); agent_lock ();
...@@ -2702,8 +2701,7 @@ nice_agent_g_source_cb ( ...@@ -2702,8 +2701,7 @@ nice_agent_g_source_cb (
gint sid = stream->id; gint sid = stream->id;
gint cid = component->id; gint cid = component->id;
component_emit_io_callback (component, agent, sid, cid, component_emit_io_callback (component, agent, sid, cid, buf, len);
(guint8 *) buf, len);
} }
agent_unlock (); agent_unlock ();
......
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