OSDN Git Service

gobex: Don't export final bit details in public API
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 29 Jun 2011 11:37:34 +0000 (14:37 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 4 Dec 2012 21:21:57 +0000 (22:21 +0100)
gobex/gobex-packet.c
gobex/gobex-packet.h
gobex/gobex.c

index 6ac77bf..94b3024 100644 (file)
@@ -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));
index 38a8ff2..40580cb 100644 (file)
@@ -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);
index be4fc5f..1c1f413 100644 (file)
@@ -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);
        }