From 007d9e39f648e52cd140aa44bf441a1fa211b4dc Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 29 Jun 2011 14:37:34 +0300 Subject: [PATCH] gobex: Don't export final bit details in public API --- gobex/gobex-packet.c | 8 +++++--- gobex/gobex-packet.h | 2 -- gobex/gobex.c | 4 +++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gobex/gobex-packet.c b/gobex/gobex-packet.c index 6ac77bf6a..94b302454 100644 --- a/gobex/gobex-packet.c +++ b/gobex/gobex-packet.c @@ -24,6 +24,8 @@ #include "gobex-packet.h" +#define FINAL_BIT 0x80 + struct _GObexPacket { guint8 opcode; gboolean final; @@ -209,8 +211,8 @@ GObexPacket *g_obex_packet_decode(const void *data, gsize len, return NULL; } - final = (opcode & G_OBEX_PACKET_FINAL) ? TRUE : FALSE; - opcode &= ~G_OBEX_PACKET_FINAL; + final = (opcode & FINAL_BIT) ? TRUE : FALSE; + opcode &= ~FINAL_BIT; pkt = g_obex_packet_new(opcode, final); @@ -251,7 +253,7 @@ gssize g_obex_packet_encode(GObexPacket *pkt, guint8 *buf, gsize len) buf[0] = pkt->opcode; if (pkt->final) - buf[0] |= G_OBEX_PACKET_FINAL; + buf[0] |= FINAL_BIT; u16 = g_htons(pkt_len); memcpy(&buf[1], &u16, sizeof(u16)); diff --git a/gobex/gobex-packet.h b/gobex/gobex-packet.h index 38a8ff280..40580cb9f 100644 --- a/gobex/gobex-packet.h +++ b/gobex/gobex-packet.h @@ -36,8 +36,6 @@ #define G_OBEX_OP_SESSION 0x07 #define G_OBEX_OP_ABORT 0x7f -#define G_OBEX_PACKET_FINAL 0x80 - typedef struct _GObexPacket GObexPacket; GObexHeader *g_obex_packet_get_header(GObexPacket *pkt, guint8 id); diff --git a/gobex/gobex.c b/gobex/gobex.c index be4fc5f59..1c1f41366 100644 --- a/gobex/gobex.c +++ b/gobex/gobex.c @@ -28,6 +28,8 @@ #define G_OBEX_MINIMUM_MTU 255 #define G_OBEX_MAXIMUM_MTU 65535 +#define FINAL_BIT 0x80 + struct _GObex { gint ref_count; GIOChannel *io; @@ -402,7 +404,7 @@ static gboolean incoming_data(GIOChannel *io, GIOCondition cond, guint8 opcode = g_obex_packet_get_operation(p->pkt, NULL); header_offset = req_header_offset(opcode); } else { - guint8 opcode = obex->rx_buf[0] & ~G_OBEX_PACKET_FINAL; + guint8 opcode = obex->rx_buf[0] & ~FINAL_BIT; header_offset = rsp_header_offset(opcode); } -- 2.47.3