Commit 5b3c4134 authored by Dafydd Harries's avatar Dafydd Harries

give _stun_attribute_unpack a return value so that it can indicate errors

darcs-hash:20070126082317-c9803-d7cc6d7e1beea6c01496ecd27fdc91e04782599f.gz
parent 7be20192
...@@ -32,7 +32,7 @@ stun_attribute_free (StunAttribute *attr) ...@@ -32,7 +32,7 @@ stun_attribute_free (StunAttribute *attr)
g_slice_free (StunAttribute, attr); g_slice_free (StunAttribute, attr);
} }
static void static gboolean
_stun_attribute_unpack (StunAttribute *attr, guint length, const gchar *s) _stun_attribute_unpack (StunAttribute *attr, guint length, const gchar *s)
{ {
attr->type = ntohs (*(guint16 *) s); attr->type = ntohs (*(guint16 *) s);
...@@ -49,6 +49,8 @@ _stun_attribute_unpack (StunAttribute *attr, guint length, const gchar *s) ...@@ -49,6 +49,8 @@ _stun_attribute_unpack (StunAttribute *attr, guint length, const gchar *s)
/* unknown attribute; we can only unpack the type */ /* unknown attribute; we can only unpack the type */
break; break;
} }
return TRUE;
} }
StunAttribute * StunAttribute *
...@@ -58,9 +60,11 @@ stun_attribute_unpack (guint length, const gchar *s) ...@@ -58,9 +60,11 @@ stun_attribute_unpack (guint length, const gchar *s)
g_assert (length); g_assert (length);
attr = stun_attribute_new (0); attr = stun_attribute_new (0);
_stun_attribute_unpack (attr, length, s);
if (_stun_attribute_unpack (attr, length, s))
return attr; return attr;
else
return NULL;
} }
guint guint
......
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