gunichar2 *utf16;
glong utf16_len;
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x",
+ G_OBEX_HDR_ENC(header->id));
+
if (buf_len < header->hlen)
return -1;
ptr = get_bytes(&header->id, ptr, sizeof(header->id));
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x",
+ G_OBEX_HDR_ENC(header->id));
+
switch (G_OBEX_HDR_ENC(header->id)) {
case G_OBEX_HDR_ENC_UNICODE:
if (len < 3) {
void g_obex_header_free(GObexHeader *header)
{
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x",
+ G_OBEX_HDR_ENC(header->id));
+
switch (G_OBEX_HDR_ENC(header->id)) {
case G_OBEX_HDR_ENC_UNICODE:
g_free(header->v.string);
gboolean g_obex_header_get_unicode(GObexHeader *header, const char **str)
{
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x",
+ G_OBEX_HDR_ENC(header->id));
+
if (G_OBEX_HDR_ENC(header->id) != G_OBEX_HDR_ENC_UNICODE)
return FALSE;
*str = header->v.string;
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "%s", *str);
+
return TRUE;
}
gboolean g_obex_header_get_bytes(GObexHeader *header, const guint8 **val,
gsize *len)
{
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x",
+ G_OBEX_HDR_ENC(header->id));
+
if (G_OBEX_HDR_ENC(header->id) != G_OBEX_HDR_ENC_BYTES)
return FALSE;
gboolean g_obex_header_get_uint8(GObexHeader *header, guint8 *val)
{
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x",
+ G_OBEX_HDR_ENC(header->id));
+
if (G_OBEX_HDR_ENC(header->id) != G_OBEX_HDR_ENC_UINT8)
return FALSE;
*val = header->v.u8;
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "%u", *val);
+
return TRUE;
}
gboolean g_obex_header_get_uint32(GObexHeader *header, guint32 *val)
{
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x",
+ G_OBEX_HDR_ENC(header->id));
+
if (G_OBEX_HDR_ENC(header->id) != G_OBEX_HDR_ENC_UINT32)
return FALSE;
*val = header->v.u32;
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "%u", *val);
+
return TRUE;
}
GObexHeader *header;
gsize len;
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x", G_OBEX_HDR_ENC(id));
+
if (G_OBEX_HDR_ENC(id) != G_OBEX_HDR_ENC_UNICODE)
return NULL;
header->hlen = len == 0 ? 3 : 3 + ((len + 1) * 2);
header->v.string = g_strdup(str);
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "%s", header->v.string);
+
return header;
}
{
GObexHeader *header;
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x", G_OBEX_HDR_ENC(id));
+
if (G_OBEX_HDR_ENC(id) != G_OBEX_HDR_ENC_BYTES)
return NULL;
{
GObexHeader *header;
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x", G_OBEX_HDR_ENC(id));
+
if (G_OBEX_HDR_ENC(id) != G_OBEX_HDR_ENC_UINT8)
return NULL;
header->hlen = 2;
header->v.u8 = val;
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "%u", header->v.u8);
+
return header;
}
{
GObexHeader *header;
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x", G_OBEX_HDR_ENC(id));
+
if (G_OBEX_HDR_ENC(id) != G_OBEX_HDR_ENC_UINT32)
return NULL;
header->hlen = 5;
header->v.u32 = val;
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "%u", header->v.u32);
+
return header;
}
guint8 g_obex_header_get_id(GObexHeader *header)
{
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x id 0x%02x",
+ G_OBEX_HDR_ENC(header->id), header->id);
+
return header->id;
}
guint16 g_obex_header_get_length(GObexHeader *header)
{
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x length %zu",
+ G_OBEX_HDR_ENC(header->id), header->hlen);
+
return header->hlen;
}
unsigned int id = first_hdr_id;
GSList *l = NULL;
+ g_obex_debug(G_OBEX_DEBUG_HEADER, "");
+
*total_len = 0;
while (id != G_OBEX_HDR_INVALID) {