From ab22fce6bb008088618839fdd33bb8a138f29117 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 27 Mar 2014 18:03:58 +0200 Subject: [PATCH] gobex/header: Add g_obex_header_new_tag function This function can be used to set tag using GObexApparam as argument but for arbritary headers. --- gobex/gobex-header.c | 9 +++++++-- gobex/gobex-header.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gobex/gobex-header.c b/gobex/gobex-header.c index 281f8ea21..fe70c8b35 100644 --- a/gobex/gobex-header.c +++ b/gobex/gobex-header.c @@ -425,7 +425,7 @@ GObexHeader *g_obex_header_new_bytes(guint8 id, const void *data, gsize len) return header; } -GObexHeader *g_obex_header_new_apparam(GObexApparam *apparam) +GObexHeader *g_obex_header_new_tag(guint8 id, GObexApparam *apparam) { guint8 buf[1024]; gssize len; @@ -434,7 +434,12 @@ GObexHeader *g_obex_header_new_apparam(GObexApparam *apparam) if (len < 0) return NULL; - return g_obex_header_new_bytes(G_OBEX_HDR_APPARAM, buf, len); + return g_obex_header_new_bytes(id, buf, len); +} + +GObexHeader *g_obex_header_new_apparam(GObexApparam *apparam) +{ + return g_obex_header_new_tag(G_OBEX_HDR_APPARAM, apparam); } GObexHeader *g_obex_header_new_uint8(guint8 id, guint8 val) diff --git a/gobex/gobex-header.h b/gobex/gobex-header.h index 42a2a0cb1..c2f975f22 100644 --- a/gobex/gobex-header.h +++ b/gobex/gobex-header.h @@ -85,6 +85,7 @@ GObexHeader *g_obex_header_new_unicode(guint8 id, const char *str); GObexHeader *g_obex_header_new_bytes(guint8 id, const void *data, gsize len); GObexHeader *g_obex_header_new_uint8(guint8 id, guint8 val); GObexHeader *g_obex_header_new_uint32(guint8 id, guint32 val); +GObexHeader *g_obex_header_new_tag(guint8 id, GObexApparam *apparam); GObexHeader *g_obex_header_new_apparam(GObexApparam *apparam); GSList *g_obex_header_create_list(guint8 first_hdr_id, va_list args,